aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com')
-rw-r--r--vendor/github.com/99designs/gqlgen/LICENSE19
-rw-r--r--vendor/github.com/99designs/gqlgen/api/generate.go78
-rw-r--r--vendor/github.com/99designs/gqlgen/api/option.go20
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/args.go120
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/args.gotpl35
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/complexity.go11
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/config/binder.go448
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/config/config.go490
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/data.go170
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/directive.go175
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/directives.gotpl137
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/field.go413
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/field.gotpl145
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/generate.go15
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl235
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/input.gotpl48
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/interface.go63
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/interface.gotpl20
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/object.go171
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/object.gotpl85
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/templates/import.go138
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/templates/templates.go572
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/type.go18
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/type.gotpl130
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/util.go47
-rw-r--r--vendor/github.com/99designs/gqlgen/complexity/complexity.go104
l---------vendor/github.com/99designs/gqlgen/docs/content/_introduction.md1
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/any.go19
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/bool.go30
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/context.go274
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/error.go33
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/exec.go144
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/fieldset.go63
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/float.go31
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/id.go57
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/int.go79
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/introspection/introspection.go72
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/introspection/query.go104
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/introspection/schema.go68
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/introspection/type.go176
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/jsonw.go52
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/map.go24
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/oneshot.go14
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/recovery.go19
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/response.go24
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/root.go7
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/string.go68
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/time.go25
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/tracer.go58
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/upload.go26
-rw-r--r--vendor/github.com/99designs/gqlgen/graphql/version.go3
-rw-r--r--vendor/github.com/99designs/gqlgen/handler/context.go57
-rw-r--r--vendor/github.com/99designs/gqlgen/handler/graphql.go802
-rw-r--r--vendor/github.com/99designs/gqlgen/handler/mock.go57
-rw-r--r--vendor/github.com/99designs/gqlgen/handler/playground.go61
-rw-r--r--vendor/github.com/99designs/gqlgen/handler/stub.go51
-rw-r--r--vendor/github.com/99designs/gqlgen/handler/websocket.go323
-rw-r--r--vendor/github.com/99designs/gqlgen/internal/code/compare.go163
-rw-r--r--vendor/github.com/99designs/gqlgen/internal/code/imports.go115
-rw-r--r--vendor/github.com/99designs/gqlgen/internal/code/util.go56
-rw-r--r--vendor/github.com/99designs/gqlgen/internal/imports/prune.go100
-rw-r--r--vendor/github.com/99designs/gqlgen/plugin/modelgen/models.go237
-rw-r--r--vendor/github.com/99designs/gqlgen/plugin/modelgen/models.gotpl85
-rw-r--r--vendor/github.com/99designs/gqlgen/plugin/plugin.go20
-rw-r--r--vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.go54
-rw-r--r--vendor/github.com/99designs/gqlgen/plugin/resolvergen/resolver.gotpl40
-rw-r--r--vendor/github.com/99designs/gqlgen/plugin/schemaconfig/schemaconfig.go93
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/.gitignore1
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/.travis.yml16
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/LICENSE21
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/Readme.md74
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/align.go67
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/escape_state.go265
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/escapes.go95
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/go.mod8
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/go.sum9
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/left_pad.go50
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/len.go45
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/trim.go28
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/truncate.go24
-rw-r--r--vendor/github.com/MichaelMure/go-term-text/wrap.go407
-rw-r--r--vendor/github.com/agnivade/levenshtein/.gitignore5
-rw-r--r--vendor/github.com/agnivade/levenshtein/.travis.yml7
-rw-r--r--vendor/github.com/agnivade/levenshtein/License.txt21
-rw-r--r--vendor/github.com/agnivade/levenshtein/Makefile13
-rw-r--r--vendor/github.com/agnivade/levenshtein/README.md57
-rw-r--r--vendor/github.com/agnivade/levenshtein/go.mod1
-rw-r--r--vendor/github.com/agnivade/levenshtein/levenshtein.go71
-rw-r--r--vendor/github.com/araddon/dateparse/.travis.yml14
-rw-r--r--vendor/github.com/araddon/dateparse/LICENSE21
-rw-r--r--vendor/github.com/araddon/dateparse/README.md282
-rw-r--r--vendor/github.com/araddon/dateparse/parseany.go1864
-rw-r--r--vendor/github.com/awesome-gocui/gocui/.gitignore1
-rw-r--r--vendor/github.com/awesome-gocui/gocui/AUTHORS30
-rw-r--r--vendor/github.com/awesome-gocui/gocui/CODE_OF_CONDUCT.md76
-rw-r--r--vendor/github.com/awesome-gocui/gocui/CONTRIBUTING.md33
-rw-r--r--vendor/github.com/awesome-gocui/gocui/LICENSE23
-rw-r--r--vendor/github.com/awesome-gocui/gocui/README.md135
-rw-r--r--vendor/github.com/awesome-gocui/gocui/attribute.go32
-rw-r--r--vendor/github.com/awesome-gocui/gocui/doc.go118
-rw-r--r--vendor/github.com/awesome-gocui/gocui/edit.go449
-rw-r--r--vendor/github.com/awesome-gocui/gocui/escape.go259
-rw-r--r--vendor/github.com/awesome-gocui/gocui/go.mod9
-rw-r--r--vendor/github.com/awesome-gocui/gocui/go.sum6
-rw-r--r--vendor/github.com/awesome-gocui/gocui/gui.go832
-rw-r--r--vendor/github.com/awesome-gocui/gocui/gui_others.go60
-rw-r--r--vendor/github.com/awesome-gocui/gocui/gui_windows.go53
-rw-r--r--vendor/github.com/awesome-gocui/gocui/keybinding.go285
-rw-r--r--vendor/github.com/awesome-gocui/gocui/loader.go46
-rw-r--r--vendor/github.com/awesome-gocui/gocui/view.go800
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/AUTHORS4
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/LICENSE19
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/README.md49
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/api.go506
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/api_common.go187
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/api_windows.go245
-rwxr-xr-xvendor/github.com/awesome-gocui/termbox-go/collect_terminfo.py110
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/escwait.go11
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/escwait_darwin.go9
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/syscalls.go39
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/syscalls_darwin.go41
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/syscalls_darwin_amd64.go40
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/syscalls_dragonfly.go39
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/syscalls_freebsd.go39
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/syscalls_linux.go33
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/syscalls_netbsd.go39
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/syscalls_openbsd.go39
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/syscalls_windows.go61
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/termbox.go529
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/termbox_common.go59
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/termbox_windows.go948
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/terminfo.go232
-rw-r--r--vendor/github.com/awesome-gocui/termbox-go/terminfo_builtin.go64
-rw-r--r--vendor/github.com/blang/semver/.travis.yml25
-rw-r--r--vendor/github.com/blang/semver/LICENSE22
-rw-r--r--vendor/github.com/blang/semver/README.md194
-rw-r--r--vendor/github.com/blang/semver/go.mod1
-rw-r--r--vendor/github.com/blang/semver/json.go23
-rw-r--r--vendor/github.com/blang/semver/package.json17
-rw-r--r--vendor/github.com/blang/semver/range.go416
-rw-r--r--vendor/github.com/blang/semver/semver.go455
-rw-r--r--vendor/github.com/blang/semver/sort.go28
-rw-r--r--vendor/github.com/blang/semver/sql.go30
-rw-r--r--vendor/github.com/cheekybits/genny/LICENSE22
-rw-r--r--vendor/github.com/cheekybits/genny/generic/doc.go2
-rw-r--r--vendor/github.com/cheekybits/genny/generic/generic.go13
-rw-r--r--vendor/github.com/corpix/uarand/.gitignore3
-rw-r--r--vendor/github.com/corpix/uarand/.go-makefile.json11
-rw-r--r--vendor/github.com/corpix/uarand/.travis.yml9
-rw-r--r--vendor/github.com/corpix/uarand/LICENSE21
-rw-r--r--vendor/github.com/corpix/uarand/Makefile52
-rw-r--r--vendor/github.com/corpix/uarand/README.md38
-rw-r--r--vendor/github.com/corpix/uarand/glide.lock16
-rw-r--r--vendor/github.com/corpix/uarand/glide.yaml7
-rw-r--r--vendor/github.com/corpix/uarand/uarand.go41
-rw-r--r--vendor/github.com/corpix/uarand/useragents.go829
-rw-r--r--vendor/github.com/corpix/uarand/useragents.mk10
-rw-r--r--vendor/github.com/cpuguy83/go-md2man/LICENSE.md21
-rw-r--r--vendor/github.com/cpuguy83/go-md2man/md2man/md2man.go20
-rw-r--r--vendor/github.com/cpuguy83/go-md2man/md2man/roff.go285
-rw-r--r--vendor/github.com/davecgh/go-spew/LICENSE15
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/bypass.go145
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/bypasssafe.go38
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/common.go341
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/config.go306
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/doc.go211
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/dump.go509
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/format.go419
-rw-r--r--vendor/github.com/davecgh/go-spew/spew/spew.go148
-rw-r--r--vendor/github.com/dustin/go-humanize/.travis.yml21
-rw-r--r--vendor/github.com/dustin/go-humanize/LICENSE21
-rw-r--r--vendor/github.com/dustin/go-humanize/README.markdown124
-rw-r--r--vendor/github.com/dustin/go-humanize/big.go31
-rw-r--r--vendor/github.com/dustin/go-humanize/bigbytes.go173
-rw-r--r--vendor/github.com/dustin/go-humanize/bytes.go143
-rw-r--r--vendor/github.com/dustin/go-humanize/comma.go116
-rw-r--r--vendor/github.com/dustin/go-humanize/commaf.go40
-rw-r--r--vendor/github.com/dustin/go-humanize/ftoa.go46
-rw-r--r--vendor/github.com/dustin/go-humanize/humanize.go8
-rw-r--r--vendor/github.com/dustin/go-humanize/number.go192
-rw-r--r--vendor/github.com/dustin/go-humanize/ordinals.go25
-rw-r--r--vendor/github.com/dustin/go-humanize/si.go123
-rw-r--r--vendor/github.com/dustin/go-humanize/times.go117
-rw-r--r--vendor/github.com/fatih/color/.travis.yml5
-rw-r--r--vendor/github.com/fatih/color/Gopkg.lock27
-rw-r--r--vendor/github.com/fatih/color/Gopkg.toml30
-rw-r--r--vendor/github.com/fatih/color/LICENSE.md20
-rw-r--r--vendor/github.com/fatih/color/README.md179
-rw-r--r--vendor/github.com/fatih/color/color.go603
-rw-r--r--vendor/github.com/fatih/color/doc.go133
-rw-r--r--vendor/github.com/go-errors/errors/.travis.yml5
-rw-r--r--vendor/github.com/go-errors/errors/LICENSE.MIT7
-rw-r--r--vendor/github.com/go-errors/errors/README.md66
-rw-r--r--vendor/github.com/go-errors/errors/cover.out89
-rw-r--r--vendor/github.com/go-errors/errors/error.go217
-rw-r--r--vendor/github.com/go-errors/errors/parse_panic.go127
-rw-r--r--vendor/github.com/go-errors/errors/stackframe.go102
-rw-r--r--vendor/github.com/golang/protobuf/AUTHORS3
-rw-r--r--vendor/github.com/golang/protobuf/CONTRIBUTORS3
-rw-r--r--vendor/github.com/golang/protobuf/LICENSE28
-rw-r--r--vendor/github.com/golang/protobuf/proto/clone.go253
-rw-r--r--vendor/github.com/golang/protobuf/proto/decode.go428
-rw-r--r--vendor/github.com/golang/protobuf/proto/discard.go350
-rw-r--r--vendor/github.com/golang/protobuf/proto/encode.go203
-rw-r--r--vendor/github.com/golang/protobuf/proto/equal.go300
-rw-r--r--vendor/github.com/golang/protobuf/proto/extensions.go543
-rw-r--r--vendor/github.com/golang/protobuf/proto/lib.go979
-rw-r--r--vendor/github.com/golang/protobuf/proto/message_set.go314
-rw-r--r--vendor/github.com/golang/protobuf/proto/pointer_reflect.go357
-rw-r--r--vendor/github.com/golang/protobuf/proto/pointer_unsafe.go308
-rw-r--r--vendor/github.com/golang/protobuf/proto/properties.go544
-rw-r--r--vendor/github.com/golang/protobuf/proto/table_marshal.go2767
-rw-r--r--vendor/github.com/golang/protobuf/proto/table_merge.go654
-rw-r--r--vendor/github.com/golang/protobuf/proto/table_unmarshal.go2051
-rw-r--r--vendor/github.com/golang/protobuf/proto/text.go843
-rw-r--r--vendor/github.com/golang/protobuf/proto/text_parser.go880
-rw-r--r--vendor/github.com/google/go-querystring/LICENSE27
-rw-r--r--vendor/github.com/google/go-querystring/query/encode.go320
-rw-r--r--vendor/github.com/gorilla/mux/AUTHORS8
-rw-r--r--vendor/github.com/gorilla/mux/LICENSE27
-rw-r--r--vendor/github.com/gorilla/mux/README.md718
-rw-r--r--vendor/github.com/gorilla/mux/context.go18
-rw-r--r--vendor/github.com/gorilla/mux/doc.go306
-rw-r--r--vendor/github.com/gorilla/mux/go.mod1
-rw-r--r--vendor/github.com/gorilla/mux/middleware.go79
-rw-r--r--vendor/github.com/gorilla/mux/mux.go607
-rw-r--r--vendor/github.com/gorilla/mux/regexp.go345
-rw-r--r--vendor/github.com/gorilla/mux/route.go710
-rw-r--r--vendor/github.com/gorilla/mux/test_helpers.go19
-rw-r--r--vendor/github.com/gorilla/websocket/.gitignore25
-rw-r--r--vendor/github.com/gorilla/websocket/.travis.yml19
-rw-r--r--vendor/github.com/gorilla/websocket/AUTHORS8
-rw-r--r--vendor/github.com/gorilla/websocket/LICENSE22
-rw-r--r--vendor/github.com/gorilla/websocket/README.md64
-rw-r--r--vendor/github.com/gorilla/websocket/client.go392
-rw-r--r--vendor/github.com/gorilla/websocket/client_clone.go16
-rw-r--r--vendor/github.com/gorilla/websocket/client_clone_legacy.go38
-rw-r--r--vendor/github.com/gorilla/websocket/compression.go148
-rw-r--r--vendor/github.com/gorilla/websocket/conn.go1149
-rw-r--r--vendor/github.com/gorilla/websocket/conn_read.go18
-rw-r--r--vendor/github.com/gorilla/websocket/conn_read_legacy.go21
-rw-r--r--vendor/github.com/gorilla/websocket/doc.go180
-rw-r--r--vendor/github.com/gorilla/websocket/json.go55
-rw-r--r--vendor/github.com/gorilla/websocket/mask.go55
-rw-r--r--vendor/github.com/gorilla/websocket/mask_safe.go15
-rw-r--r--vendor/github.com/gorilla/websocket/prepared.go103
-rw-r--r--vendor/github.com/gorilla/websocket/server.go291
-rw-r--r--vendor/github.com/gorilla/websocket/util.go214
-rw-r--r--vendor/github.com/hashicorp/golang-lru/.gitignore23
-rw-r--r--vendor/github.com/hashicorp/golang-lru/2q.go223
-rw-r--r--vendor/github.com/hashicorp/golang-lru/LICENSE362
-rw-r--r--vendor/github.com/hashicorp/golang-lru/README.md25
-rw-r--r--vendor/github.com/hashicorp/golang-lru/arc.go257
-rw-r--r--vendor/github.com/hashicorp/golang-lru/doc.go21
-rw-r--r--vendor/github.com/hashicorp/golang-lru/go.mod1
-rw-r--r--vendor/github.com/hashicorp/golang-lru/lru.go110
-rw-r--r--vendor/github.com/hashicorp/golang-lru/simplelru/lru.go161
-rw-r--r--vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go36
-rw-r--r--vendor/github.com/icrowley/fake/.gitignore26
-rw-r--r--vendor/github.com/icrowley/fake/.go-makefile.json11
-rw-r--r--vendor/github.com/icrowley/fake/.travis.yml11
-rw-r--r--vendor/github.com/icrowley/fake/LICENSE22
-rw-r--r--vendor/github.com/icrowley/fake/Makefile48
-rw-r--r--vendor/github.com/icrowley/fake/README.md90
-rw-r--r--vendor/github.com/icrowley/fake/addresses.go69
-rw-r--r--vendor/github.com/icrowley/fake/credit_cards.go69
-rw-r--r--vendor/github.com/icrowley/fake/currencies.go11
-rw-r--r--vendor/github.com/icrowley/fake/data.go493
-rw-r--r--vendor/github.com/icrowley/fake/dates.go42
-rw-r--r--vendor/github.com/icrowley/fake/fake.go214
-rw-r--r--vendor/github.com/icrowley/fake/general.go79
-rw-r--r--vendor/github.com/icrowley/fake/geo.go57
-rw-r--r--vendor/github.com/icrowley/fake/glide.lock6
-rw-r--r--vendor/github.com/icrowley/fake/glide.yaml3
-rw-r--r--vendor/github.com/icrowley/fake/internet.go77
-rw-r--r--vendor/github.com/icrowley/fake/jobs.go25
-rw-r--r--vendor/github.com/icrowley/fake/lorem_ipsum.go103
-rw-r--r--vendor/github.com/icrowley/fake/names.go147
-rw-r--r--vendor/github.com/icrowley/fake/personal.go24
-rw-r--r--vendor/github.com/icrowley/fake/products.go26
-rw-r--r--vendor/github.com/inconshreveable/mousetrap/LICENSE13
-rw-r--r--vendor/github.com/inconshreveable/mousetrap/README.md23
-rw-r--r--vendor/github.com/inconshreveable/mousetrap/trap_others.go15
-rw-r--r--vendor/github.com/inconshreveable/mousetrap/trap_windows.go98
-rw-r--r--vendor/github.com/inconshreveable/mousetrap/trap_windows_1.4.go46
-rw-r--r--vendor/github.com/mattn/go-colorable/.travis.yml9
-rw-r--r--vendor/github.com/mattn/go-colorable/LICENSE21
-rw-r--r--vendor/github.com/mattn/go-colorable/README.md48
-rw-r--r--vendor/github.com/mattn/go-colorable/colorable_appengine.go29
-rw-r--r--vendor/github.com/mattn/go-colorable/colorable_others.go30
-rw-r--r--vendor/github.com/mattn/go-colorable/colorable_windows.go884
-rw-r--r--vendor/github.com/mattn/go-colorable/noncolorable.go55
-rw-r--r--vendor/github.com/mattn/go-isatty/.travis.yml9
-rw-r--r--vendor/github.com/mattn/go-isatty/LICENSE9
-rw-r--r--vendor/github.com/mattn/go-isatty/README.md50
-rw-r--r--vendor/github.com/mattn/go-isatty/doc.go2
-rw-r--r--vendor/github.com/mattn/go-isatty/isatty_appengine.go15
-rw-r--r--vendor/github.com/mattn/go-isatty/isatty_bsd.go18
-rw-r--r--vendor/github.com/mattn/go-isatty/isatty_linux.go18
-rw-r--r--vendor/github.com/mattn/go-isatty/isatty_linux_ppc64x.go19
-rw-r--r--vendor/github.com/mattn/go-isatty/isatty_others.go10
-rw-r--r--vendor/github.com/mattn/go-isatty/isatty_solaris.go16
-rw-r--r--vendor/github.com/mattn/go-isatty/isatty_windows.go94
-rw-r--r--vendor/github.com/mattn/go-runewidth/.travis.yml8
-rw-r--r--vendor/github.com/mattn/go-runewidth/LICENSE21
-rw-r--r--vendor/github.com/mattn/go-runewidth/README.mkd27
-rw-r--r--vendor/github.com/mattn/go-runewidth/runewidth.go1223
-rw-r--r--vendor/github.com/mattn/go-runewidth/runewidth_js.go8
-rw-r--r--vendor/github.com/mattn/go-runewidth/runewidth_posix.go77
-rw-r--r--vendor/github.com/mattn/go-runewidth/runewidth_windows.go25
-rw-r--r--vendor/github.com/mitchellh/mapstructure/.travis.yml8
-rw-r--r--vendor/github.com/mitchellh/mapstructure/LICENSE21
-rw-r--r--vendor/github.com/mitchellh/mapstructure/README.md46
-rw-r--r--vendor/github.com/mitchellh/mapstructure/decode_hooks.go171
-rw-r--r--vendor/github.com/mitchellh/mapstructure/error.go50
-rw-r--r--vendor/github.com/mitchellh/mapstructure/go.mod1
-rw-r--r--vendor/github.com/mitchellh/mapstructure/mapstructure.go1064
-rw-r--r--vendor/github.com/phayes/freeport/.gitignore1
-rw-r--r--vendor/github.com/phayes/freeport/.goreleaser.yml134
-rw-r--r--vendor/github.com/phayes/freeport/LICENSE.md15
-rw-r--r--vendor/github.com/phayes/freeport/README.md54
-rw-r--r--vendor/github.com/phayes/freeport/freeport.go30
-rw-r--r--vendor/github.com/pkg/errors/.gitignore24
-rw-r--r--vendor/github.com/pkg/errors/.travis.yml11
-rw-r--r--vendor/github.com/pkg/errors/LICENSE23
-rw-r--r--vendor/github.com/pkg/errors/README.md52
-rw-r--r--vendor/github.com/pkg/errors/appveyor.yml32
-rw-r--r--vendor/github.com/pkg/errors/errors.go269
-rw-r--r--vendor/github.com/pkg/errors/stack.go178
-rw-r--r--vendor/github.com/pmezard/go-difflib/LICENSE27
-rw-r--r--vendor/github.com/pmezard/go-difflib/difflib/difflib.go772
-rw-r--r--vendor/github.com/russross/blackfriday/.gitignore8
-rw-r--r--vendor/github.com/russross/blackfriday/.travis.yml30
-rw-r--r--vendor/github.com/russross/blackfriday/LICENSE.txt29
-rw-r--r--vendor/github.com/russross/blackfriday/README.md363
-rw-r--r--vendor/github.com/russross/blackfriday/block.go1450
-rw-r--r--vendor/github.com/russross/blackfriday/doc.go32
-rw-r--r--vendor/github.com/russross/blackfriday/html.go950
-rw-r--r--vendor/github.com/russross/blackfriday/inline.go1154
-rw-r--r--vendor/github.com/russross/blackfriday/latex.go332
-rw-r--r--vendor/github.com/russross/blackfriday/markdown.go931
-rw-r--r--vendor/github.com/russross/blackfriday/smartypants.go430
-rw-r--r--vendor/github.com/shurcooL/githubv4/.travis.yml16
-rw-r--r--vendor/github.com/shurcooL/githubv4/LICENSE21
-rw-r--r--vendor/github.com/shurcooL/githubv4/README.md408
-rw-r--r--vendor/github.com/shurcooL/githubv4/doc.go13
-rw-r--r--vendor/github.com/shurcooL/githubv4/enum.go795
-rw-r--r--vendor/github.com/shurcooL/githubv4/gen.go193
-rw-r--r--vendor/github.com/shurcooL/githubv4/githubv4.go56
-rw-r--r--vendor/github.com/shurcooL/githubv4/input.go1051
-rw-r--r--vendor/github.com/shurcooL/githubv4/scalar.go139
-rw-r--r--vendor/github.com/shurcooL/go/browser/LICENSE27
-rw-r--r--vendor/github.com/shurcooL/go/ctxhttp/ctxhttp.go78
-rw-r--r--vendor/github.com/shurcooL/graphql/.travis.yml16
-rw-r--r--vendor/github.com/shurcooL/graphql/LICENSE21
-rw-r--r--vendor/github.com/shurcooL/graphql/README.md293
-rw-r--r--vendor/github.com/shurcooL/graphql/doc.go11
-rw-r--r--vendor/github.com/shurcooL/graphql/graphql.go119
-rw-r--r--vendor/github.com/shurcooL/graphql/ident/ident.go240
-rw-r--r--vendor/github.com/shurcooL/graphql/internal/jsonutil/graphql.go308
-rw-r--r--vendor/github.com/shurcooL/graphql/query.go131
-rw-r--r--vendor/github.com/shurcooL/graphql/scalar.go51
-rw-r--r--vendor/github.com/shurcooL/httpfs/filter/filter.go133
-rw-r--r--vendor/github.com/shurcooL/httpfs/filter/filters.go26
-rw-r--r--vendor/github.com/shurcooL/httpfs/vfsutil/file.go21
-rw-r--r--vendor/github.com/shurcooL/httpfs/vfsutil/vfsutil.go39
-rw-r--r--vendor/github.com/shurcooL/httpfs/vfsutil/walk.go146
-rw-r--r--vendor/github.com/shurcooL/vfsgen/.travis.yml16
-rw-r--r--vendor/github.com/shurcooL/vfsgen/CONTRIBUTING.md10
-rw-r--r--vendor/github.com/shurcooL/vfsgen/LICENSE21
-rw-r--r--vendor/github.com/shurcooL/vfsgen/README.md201
-rw-r--r--vendor/github.com/shurcooL/vfsgen/commentwriter.go45
-rw-r--r--vendor/github.com/shurcooL/vfsgen/doc.go15
-rw-r--r--vendor/github.com/shurcooL/vfsgen/generator.go485
-rw-r--r--vendor/github.com/shurcooL/vfsgen/options.go45
-rw-r--r--vendor/github.com/shurcooL/vfsgen/stringwriter.go27
-rw-r--r--vendor/github.com/skratchdot/open-golang/LICENSE-MIT22
-rw-r--r--vendor/github.com/skratchdot/open-golang/open/exec.go18
-rw-r--r--vendor/github.com/skratchdot/open-golang/open/exec_darwin.go15
-rw-r--r--vendor/github.com/skratchdot/open-golang/open/exec_windows.go33
-rw-r--r--vendor/github.com/skratchdot/open-golang/open/open.go50
-rw-r--r--vendor/github.com/spf13/cobra/.gitignore38
-rw-r--r--vendor/github.com/spf13/cobra/.mailmap3
-rw-r--r--vendor/github.com/spf13/cobra/.travis.yml31
-rw-r--r--vendor/github.com/spf13/cobra/LICENSE.txt174
-rw-r--r--vendor/github.com/spf13/cobra/README.md741
-rw-r--r--vendor/github.com/spf13/cobra/args.go101
-rw-r--r--vendor/github.com/spf13/cobra/bash_completions.go547
-rw-r--r--vendor/github.com/spf13/cobra/bash_completions.md256
-rw-r--r--vendor/github.com/spf13/cobra/cobra.go207
-rw-r--r--vendor/github.com/spf13/cobra/cobra/cmd/testdata/LICENSE.golden202
-rw-r--r--vendor/github.com/spf13/cobra/command.go1594
-rw-r--r--vendor/github.com/spf13/cobra/command_notwin.go5
-rw-r--r--vendor/github.com/spf13/cobra/command_win.go26
-rw-r--r--vendor/github.com/spf13/cobra/doc/man_docs.go247
-rw-r--r--vendor/github.com/spf13/cobra/doc/man_docs.md31
-rw-r--r--vendor/github.com/spf13/cobra/doc/md_docs.go159
-rw-r--r--vendor/github.com/spf13/cobra/doc/md_docs.md115
-rw-r--r--vendor/github.com/spf13/cobra/doc/rest_docs.go185
-rw-r--r--vendor/github.com/spf13/cobra/doc/rest_docs.md114
-rw-r--r--vendor/github.com/spf13/cobra/doc/util.go51
-rw-r--r--vendor/github.com/spf13/cobra/doc/yaml_docs.go169
-rw-r--r--vendor/github.com/spf13/cobra/doc/yaml_docs.md112
-rw-r--r--vendor/github.com/spf13/cobra/go.mod13
-rw-r--r--vendor/github.com/spf13/cobra/go.sum51
-rw-r--r--vendor/github.com/spf13/cobra/powershell_completions.go100
-rw-r--r--vendor/github.com/spf13/cobra/powershell_completions.md14
-rw-r--r--vendor/github.com/spf13/cobra/shell_completions.go85
-rw-r--r--vendor/github.com/spf13/cobra/zsh_completions.go336
-rw-r--r--vendor/github.com/spf13/cobra/zsh_completions.md39
-rw-r--r--vendor/github.com/spf13/pflag/.gitignore2
-rw-r--r--vendor/github.com/spf13/pflag/.travis.yml21
-rw-r--r--vendor/github.com/spf13/pflag/LICENSE28
-rw-r--r--vendor/github.com/spf13/pflag/README.md296
-rw-r--r--vendor/github.com/spf13/pflag/bool.go94
-rw-r--r--vendor/github.com/spf13/pflag/bool_slice.go147
-rw-r--r--vendor/github.com/spf13/pflag/bytes.go105
-rw-r--r--vendor/github.com/spf13/pflag/count.go96
-rw-r--r--vendor/github.com/spf13/pflag/duration.go86
-rw-r--r--vendor/github.com/spf13/pflag/duration_slice.go128
-rw-r--r--vendor/github.com/spf13/pflag/flag.go1223
-rw-r--r--vendor/github.com/spf13/pflag/float32.go88
-rw-r--r--vendor/github.com/spf13/pflag/float64.go84
-rw-r--r--vendor/github.com/spf13/pflag/golangflag.go105
-rw-r--r--vendor/github.com/spf13/pflag/int.go84
-rw-r--r--vendor/github.com/spf13/pflag/int16.go88
-rw-r--r--vendor/github.com/spf13/pflag/int32.go88
-rw-r--r--vendor/github.com/spf13/pflag/int64.go84
-rw-r--r--vendor/github.com/spf13/pflag/int8.go88
-rw-r--r--vendor/github.com/spf13/pflag/int_slice.go128
-rw-r--r--vendor/github.com/spf13/pflag/ip.go94
-rw-r--r--vendor/github.com/spf13/pflag/ip_slice.go148
-rw-r--r--vendor/github.com/spf13/pflag/ipmask.go122
-rw-r--r--vendor/github.com/spf13/pflag/ipnet.go98
-rw-r--r--vendor/github.com/spf13/pflag/string.go80
-rw-r--r--vendor/github.com/spf13/pflag/string_array.go103
-rw-r--r--vendor/github.com/spf13/pflag/string_slice.go149
-rw-r--r--vendor/github.com/spf13/pflag/uint.go88
-rw-r--r--vendor/github.com/spf13/pflag/uint16.go88
-rw-r--r--vendor/github.com/spf13/pflag/uint32.go88
-rw-r--r--vendor/github.com/spf13/pflag/uint64.go88
-rw-r--r--vendor/github.com/spf13/pflag/uint8.go88
-rw-r--r--vendor/github.com/spf13/pflag/uint_slice.go126
-rw-r--r--vendor/github.com/stretchr/testify/LICENSE22
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertion_format.go484
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl5
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertion_forward.go956
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl5
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertions.go1394
-rw-r--r--vendor/github.com/stretchr/testify/assert/doc.go45
-rw-r--r--vendor/github.com/stretchr/testify/assert/errors.go10
-rw-r--r--vendor/github.com/stretchr/testify/assert/forward_assertions.go16
-rw-r--r--vendor/github.com/stretchr/testify/assert/http_assertions.go143
-rw-r--r--vendor/github.com/stretchr/testify/require/doc.go28
-rw-r--r--vendor/github.com/stretchr/testify/require/forward_requirements.go16
-rw-r--r--vendor/github.com/stretchr/testify/require/require.go1227
-rw-r--r--vendor/github.com/stretchr/testify/require/require.go.tmpl6
-rw-r--r--vendor/github.com/stretchr/testify/require/require_forward.go957
-rw-r--r--vendor/github.com/stretchr/testify/require/require_forward.go.tmpl5
-rw-r--r--vendor/github.com/stretchr/testify/require/requirements.go29
-rw-r--r--vendor/github.com/theckman/goconstraint/LICENSE9
-rw-r--r--vendor/github.com/theckman/goconstraint/LICENSES/unlicense.txt24
-rw-r--r--vendor/github.com/theckman/goconstraint/go1.10/gte/constraint.go8
-rw-r--r--vendor/github.com/theckman/goconstraint/go1.10/gte/go110.go7
-rw-r--r--vendor/github.com/vektah/gqlgen/LICENSE19
-rw-r--r--vendor/github.com/vektah/gqlgen/client/client.go141
-rw-r--r--vendor/github.com/vektah/gqlgen/client/readme.md5
-rw-r--r--vendor/github.com/vektah/gqlgen/client/websocket.go103
-rw-r--r--vendor/github.com/vektah/gqlparser/.gitignore5
-rw-r--r--vendor/github.com/vektah/gqlparser/.gometalinter.json13
-rw-r--r--vendor/github.com/vektah/gqlparser/LICENSE19
-rw-r--r--vendor/github.com/vektah/gqlparser/ast/argmap.go37
-rw-r--r--vendor/github.com/vektah/gqlparser/ast/collections.go138
-rw-r--r--vendor/github.com/vektah/gqlparser/ast/definition.go93
-rw-r--r--vendor/github.com/vektah/gqlparser/ast/directive.go42
-rw-r--r--vendor/github.com/vektah/gqlparser/ast/document.go67
-rw-r--r--vendor/github.com/vektah/gqlparser/ast/dumper.go159
-rw-r--r--vendor/github.com/vektah/gqlparser/ast/fragment.go38
-rw-r--r--vendor/github.com/vektah/gqlparser/ast/operation.go29
-rw-r--r--vendor/github.com/vektah/gqlparser/ast/selection.go39
-rw-r--r--vendor/github.com/vektah/gqlparser/ast/source.go15
-rw-r--r--vendor/github.com/vektah/gqlparser/ast/type.go68
-rw-r--r--vendor/github.com/vektah/gqlparser/ast/value.go120
-rw-r--r--vendor/github.com/vektah/gqlparser/gqlerror/error.go133
-rw-r--r--vendor/github.com/vektah/gqlparser/gqlparser.go42
-rw-r--r--vendor/github.com/vektah/gqlparser/lexer/blockstring.go58
-rw-r--r--vendor/github.com/vektah/gqlparser/lexer/lexer.go510
-rw-r--r--vendor/github.com/vektah/gqlparser/lexer/lexer_test.yml672
-rw-r--r--vendor/github.com/vektah/gqlparser/lexer/token.go148
-rw-r--r--vendor/github.com/vektah/gqlparser/parser/parser.go136
-rw-r--r--vendor/github.com/vektah/gqlparser/parser/query.go348
-rw-r--r--vendor/github.com/vektah/gqlparser/parser/query_test.yml520
-rw-r--r--vendor/github.com/vektah/gqlparser/parser/schema.go527
-rw-r--r--vendor/github.com/vektah/gqlparser/parser/schema_test.yml540
-rw-r--r--vendor/github.com/vektah/gqlparser/readme.md17
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/error.go55
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/imported/LICENSE33
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/messaging.go39
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/prelude.go9
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/prelude.graphql119
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/fields_on_correct_type.go86
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/fragments_on_composite_types.go39
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/known_argument_names.go57
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/known_directives.go31
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/known_fragment_names.go19
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/known_type_names.go61
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/lone_anonymous_operation.go19
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/no_fragment_cycles.go93
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/no_undefined_variables.go28
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/no_unused_fragments.go30
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/no_unused_variables.go30
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/overlapping_fields_can_be_merged.go557
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/possible_fragment_spreads.go68
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/provided_required_arguments.go63
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/scalar_leafs.go36
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/single_field_subscriptions.go30
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/unique_argument_names.go33
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/unique_directives_per_location.go24
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/unique_fragment_names.go22
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/unique_input_field_names.go27
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/unique_operation_names.go22
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/unique_variable_names.go23
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/values_of_correct_type.go130
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/variables_are_input_types.go28
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/rules/variables_in_allowed_position.go36
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/schema.go276
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/schema_test.yml323
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/suggestionList.go69
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/validator.go44
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/vars.go199
-rw-r--r--vendor/github.com/vektah/gqlparser/validator/walk.go286
-rw-r--r--vendor/github.com/xanzy/go-gitlab/.gitignore28
-rw-r--r--vendor/github.com/xanzy/go-gitlab/.travis.yml28
-rw-r--r--vendor/github.com/xanzy/go-gitlab/CHANGELOG.md27
-rw-r--r--vendor/github.com/xanzy/go-gitlab/LICENSE202
-rw-r--r--vendor/github.com/xanzy/go-gitlab/README.md173
-rw-r--r--vendor/github.com/xanzy/go-gitlab/access_requests.go236
-rw-r--r--vendor/github.com/xanzy/go-gitlab/award_emojis.go467
-rw-r--r--vendor/github.com/xanzy/go-gitlab/boards.go344
-rw-r--r--vendor/github.com/xanzy/go-gitlab/branches.go242
-rw-r--r--vendor/github.com/xanzy/go-gitlab/broadcast_messages.go172
-rw-r--r--vendor/github.com/xanzy/go-gitlab/ci_yml_templates.go69
-rw-r--r--vendor/github.com/xanzy/go-gitlab/commits.go593
-rw-r--r--vendor/github.com/xanzy/go-gitlab/custom_attributes.go171
-rw-r--r--vendor/github.com/xanzy/go-gitlab/deploy_keys.go200
-rw-r--r--vendor/github.com/xanzy/go-gitlab/deployments.go120
-rw-r--r--vendor/github.com/xanzy/go-gitlab/discussions.go1112
-rw-r--r--vendor/github.com/xanzy/go-gitlab/environments.go212
-rw-r--r--vendor/github.com/xanzy/go-gitlab/epics.go211
-rw-r--r--vendor/github.com/xanzy/go-gitlab/event_parsing.go117
-rw-r--r--vendor/github.com/xanzy/go-gitlab/event_types.go815
-rw-r--r--vendor/github.com/xanzy/go-gitlab/events.go146
-rw-r--r--vendor/github.com/xanzy/go-gitlab/feature_flags.go79
-rw-r--r--vendor/github.com/xanzy/go-gitlab/gitignore_templates.go84
-rw-r--r--vendor/github.com/xanzy/go-gitlab/gitlab.go955
-rw-r--r--vendor/github.com/xanzy/go-gitlab/go.mod12
-rw-r--r--vendor/github.com/xanzy/go-gitlab/go.sum25
-rw-r--r--vendor/github.com/xanzy/go-gitlab/group_badges.go213
-rw-r--r--vendor/github.com/xanzy/go-gitlab/group_boards.go261
-rw-r--r--vendor/github.com/xanzy/go-gitlab/group_clusters.go211
-rw-r--r--vendor/github.com/xanzy/go-gitlab/group_labels.go196
-rw-r--r--vendor/github.com/xanzy/go-gitlab/group_members.go219
-rw-r--r--vendor/github.com/xanzy/go-gitlab/group_milestones.go249
-rw-r--r--vendor/github.com/xanzy/go-gitlab/group_variables.go196
-rw-r--r--vendor/github.com/xanzy/go-gitlab/groups.go335
-rw-r--r--vendor/github.com/xanzy/go-gitlab/issue_links.go127
-rw-r--r--vendor/github.com/xanzy/go-gitlab/issues.go568
-rw-r--r--vendor/github.com/xanzy/go-gitlab/jobs.go408
-rw-r--r--vendor/github.com/xanzy/go-gitlab/keys.go65
-rw-r--r--vendor/github.com/xanzy/go-gitlab/labels.go250
-rw-r--r--vendor/github.com/xanzy/go-gitlab/license.go94
-rw-r--r--vendor/github.com/xanzy/go-gitlab/license_templates.go92
-rw-r--r--vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go191
-rw-r--r--vendor/github.com/xanzy/go-gitlab/merge_requests.go836
-rw-r--r--vendor/github.com/xanzy/go-gitlab/milestones.go267
-rw-r--r--vendor/github.com/xanzy/go-gitlab/namespaces.go122
-rw-r--r--vendor/github.com/xanzy/go-gitlab/notes.go678
-rw-r--r--vendor/github.com/xanzy/go-gitlab/notifications.go213
-rw-r--r--vendor/github.com/xanzy/go-gitlab/pages_domains.go193
-rw-r--r--vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go327
-rw-r--r--vendor/github.com/xanzy/go-gitlab/pipeline_triggers.go231
-rw-r--r--vendor/github.com/xanzy/go-gitlab/pipelines.go286
-rw-r--r--vendor/github.com/xanzy/go-gitlab/project_badges.go207
-rw-r--r--vendor/github.com/xanzy/go-gitlab/project_clusters.go221
-rw-r--r--vendor/github.com/xanzy/go-gitlab/project_import_export.go196
-rw-r--r--vendor/github.com/xanzy/go-gitlab/project_members.go209
-rw-r--r--vendor/github.com/xanzy/go-gitlab/project_snippets.go206
-rw-r--r--vendor/github.com/xanzy/go-gitlab/project_variables.go201
-rw-r--r--vendor/github.com/xanzy/go-gitlab/projects.go1512
-rw-r--r--vendor/github.com/xanzy/go-gitlab/protected_branches.go165
-rw-r--r--vendor/github.com/xanzy/go-gitlab/protected_tags.go145
-rw-r--r--vendor/github.com/xanzy/go-gitlab/registry.go219
-rw-r--r--vendor/github.com/xanzy/go-gitlab/releaselinks.go176
-rw-r--r--vendor/github.com/xanzy/go-gitlab/releases.go212
-rw-r--r--vendor/github.com/xanzy/go-gitlab/repositories.go327
-rw-r--r--vendor/github.com/xanzy/go-gitlab/repository_files.go311
-rw-r--r--vendor/github.com/xanzy/go-gitlab/resource_label_events.go219
-rw-r--r--vendor/github.com/xanzy/go-gitlab/runners.go415
-rw-r--r--vendor/github.com/xanzy/go-gitlab/search.go354
-rw-r--r--vendor/github.com/xanzy/go-gitlab/services.go864
-rw-r--r--vendor/github.com/xanzy/go-gitlab/settings.go409
-rw-r--r--vendor/github.com/xanzy/go-gitlab/sidekiq_metrics.go154
-rw-r--r--vendor/github.com/xanzy/go-gitlab/snippets.go230
-rw-r--r--vendor/github.com/xanzy/go-gitlab/strings.go94
-rw-r--r--vendor/github.com/xanzy/go-gitlab/system_hooks.go143
-rw-r--r--vendor/github.com/xanzy/go-gitlab/tags.go243
-rw-r--r--vendor/github.com/xanzy/go-gitlab/time_stats.go162
-rw-r--r--vendor/github.com/xanzy/go-gitlab/todos.go176
-rw-r--r--vendor/github.com/xanzy/go-gitlab/users.go871
-rw-r--r--vendor/github.com/xanzy/go-gitlab/validate.go40
-rw-r--r--vendor/github.com/xanzy/go-gitlab/version.go56
-rw-r--r--vendor/github.com/xanzy/go-gitlab/wikis.go204
612 files changed, 0 insertions, 108964 deletions
diff --git a/vendor/github.com/99designs/gqlgen/LICENSE b/vendor/github.com/99designs/gqlgen/LICENSE
deleted file mode 100644
index 18e1b249..00000000
--- 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 3256bdc3..00000000
--- 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 f7ba6774..00000000
--- 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 1d3e51aa..00000000
--- 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 318f1ff4..00000000
--- 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 e9c6a20e..00000000
--- 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 72956de4..00000000
--- 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 8e8992e3..00000000
--- 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 f743dee3..00000000
--- 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 491f92f4..00000000
--- 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 67a0783e..00000000
--- 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 fab26f2b..00000000
--- 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 1970614b..00000000
--- 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 eafa3f87..00000000
--- 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 a95e57b6..00000000
--- 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 bdf3622c..00000000
--- 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 f59e8ed0..00000000
--- 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 81a58076..00000000
--- 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 08ae09aa..00000000
--- 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 98a75740..00000000
--- 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 d5bd16a6..00000000
--- 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 5d5f69bf..00000000
--- 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 4a14454c..00000000
--- 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 cb2782c3..00000000
--- 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 59dfde08..00000000
--- 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 d5b46bf4..00000000
--- 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 fe840054..00000000
--- 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 6ea8bf2e..00000000
--- 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 b175ca98..00000000
--- 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 356f5175..00000000
--- 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 af8b4ce4..00000000
--- 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 3e00a4d5..00000000
--- 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 351e266f..00000000
--- 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 fabbad04..00000000
--- 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 4f532037..00000000
--- 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 57d0d589..00000000
--- 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 ca0b065f..00000000
--- 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 b1e4fbc6..00000000
--- 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 a57272d5..00000000
--- 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 9aceebdc..00000000
--- 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 db95d8e4..00000000
--- 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 1e91d1d9..00000000
--- 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 dd31f5ba..00000000
--- 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 3aa032dc..00000000
--- 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 6fe55d56..00000000
--- 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 3405d180..00000000
--- 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 7c1b7d95..00000000
--- 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 9945f3fb..00000000
--- 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 0597ce8c..00000000
--- 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 22d61031..00000000
--- 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 ea211574..00000000
--- 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 2992aa3d..00000000
--- 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 289901f0..00000000
--- 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 3e70cf03..00000000
--- 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 0e1ca768..00000000
--- 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(`<!DOCTYPE html>
-<html>
-<head>
- <meta charset=utf-8/>
- <meta name="viewport" content="user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, minimal-ui">
- <link rel="shortcut icon" href="https://graphcool-playground.netlify.com/favicon.png">
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/graphql-playground-react@{{ .version }}/build/static/css/index.css"
- integrity="{{ .cssSRI }}" crossorigin="anonymous"/>
- <link rel="shortcut icon" href="https://cdn.jsdelivr.net/npm/graphql-playground-react@{{ .version }}/build/favicon.png"
- integrity="{{ .faviconSRI }}" crossorigin="anonymous"/>
- <script src="https://cdn.jsdelivr.net/npm/graphql-playground-react@{{ .version }}/build/static/js/middleware.js"
- integrity="{{ .jsSRI }}" crossorigin="anonymous"></script>
- <title>{{.title}}</title>
-</head>
-<body>
-<style type="text/css">
- html { font-family: "Open Sans", sans-serif; overflow: hidden; }
- body { margin: 0; background: #172a3a; }
-</style>
-<div id="root"/>
-<script type="text/javascript">
- window.addEventListener('load', function (event) {
- const root = document.getElementById('root');
- root.classList.add('playgroundIn');
- const wsProto = location.protocol == 'https:' ? 'wss:' : 'ws:'
- GraphQLPlayground.init(root, {
- endpoint: location.protocol + '//' + location.host + '{{.endpoint}}',
- subscriptionsEndpoint: wsProto + '//' + location.host + '{{.endpoint }}',
- settings: {
- 'request.credentials': 'same-origin'
- }
- })
- })
-</script>
-</body>
-</html>
-`))
-
-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 d237e188..00000000
--- 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 0637cfb1..00000000
--- 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 dce9aea5..00000000
--- 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 ad62f7c5..00000000
--- 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 2be83a23..00000000
--- 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 27ac94ac..00000000
--- 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 376499ae..00000000
--- 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 a4579f87..00000000
--- 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 a84bfd32..00000000
--- 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 6785c77c..00000000
--- 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 66d6efac..00000000
--- 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 1fcf4105..00000000
--- 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 9f11b755..00000000
--- 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 c5db9518..00000000
--- 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 5ba12bf4..00000000
--- 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 25722ee9..00000000
--- a/vendor/github.com/MichaelMure/go-term-text/Readme.md
+++ /dev/null
@@ -1,74 +0,0 @@
-# go-term-text
-
-[![Build Status](https://travis-ci.org/MichaelMure/go-term-text.svg?branch=master)](https://travis-ci.org/MichaelMure/go-term-text)
-[![GoDoc](https://godoc.org/github.com/MichaelMure/go-term-text?status.svg)](https://godoc.org/github.com/MichaelMure/go-term-text)
-[![Go Report Card](https://goreportcard.com/badge/github.com/MichaelMure/go-term-text)](https://goreportcard.com/report/github.com/MichaelMure/go-term-text)
-[![codecov](https://codecov.io/gh/MichaelMure/go-term-text/branch/master/graph/badge.svg)](https://codecov.io/gh/MichaelMure/go-term-text)
-[![GitHub license](https://img.shields.io/github/license/MichaelMure/go-term-text.svg)](https://github.com/MichaelMure/go-term-text/blob/master/LICENSE)
-[![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](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:
-
-![example output](/img/example.png)
-
-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 8262a4de..00000000
--- 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 cec35c26..00000000
--- 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 19f78c92..00000000
--- 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 a03c8606..00000000
--- 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 a119b457..00000000
--- 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 a63fedb9..00000000
--- 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 c6bcaeac..00000000
--- 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 eaf2ca0c..00000000
--- 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 b51bb39e..00000000
--- 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 eba9e0b8..00000000
--- 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 345780a4..00000000
--- 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 06b3ba55..00000000
--- 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 54b51f49..00000000
--- 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 4bef27dd..00000000
--- 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 b0fd81df..00000000
--- a/vendor/github.com/agnivade/levenshtein/README.md
+++ /dev/null
@@ -1,57 +0,0 @@
-levenshtein [![Build Status](https://travis-ci.org/agnivade/levenshtein.svg?branch=master)](https://travis-ci.org/agnivade/levenshtein) [![Go Report Card](https://goreportcard.com/badge/github.com/agnivade/levenshtein)](https://goreportcard.com/report/github.com/agnivade/levenshtein) [![GoDoc](https://godoc.org/github.com/agnivade/levenshtein?status.svg)](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 b2921fb3..00000000
--- 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 e215813f..00000000
--- 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 f071cf95..00000000
--- 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 f675ed31..00000000
--- 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 005e456f..00000000
--- 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.
-
-
-[![Code Coverage](https://codecov.io/gh/araddon/dateparse/branch/master/graph/badge.svg)](https://codecov.io/gh/araddon/dateparse)
-[![GoDoc](https://godoc.org/github.com/araddon/dateparse?status.svg)](http://godoc.org/github.com/araddon/dateparse)
-[![Build Status](https://travis-ci.org/araddon/dateparse.svg?branch=master)](https://travis-ci.org/araddon/dateparse)
-[![Go ReportCard](https://goreportcard.com/badge/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 5e66aa6d..00000000
--- 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 1377554e..00000000
--- 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 43ec4cec..00000000
--- 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 <email address> contribution
-# Contribution
-# The email address is not required for organizations.
-
-Roi Martin <jroi.martin@gmail.com>
- Main developer
-
-Ryan Sullivan <kayoticsully@gmail.com>
- Toggleable view frames
-
-Matthieu Rakotojaona <matthieu.rakotojaona@gmail.com>
- Wrapped views
-
-Harry Lawrence <hazbo@gmx.com>
- Basic mouse support
-
-Danny Tylman <dtylman@gmail.com>
- Masked views
-
-Frederik Deweerdt <frederik.deweerdt@gmail.com>
- Colored fonts
-
-Henri Koski <henri.t.koski@gmail.com>
- Custom current view color
-
-Dustin Willis Webber <dustin.webber@gmail.com>
- 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 1bdac055..00000000
--- 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 b93e45b2..00000000
--- 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 8cb28215..00000000
--- 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 be212c58..00000000
--- a/vendor/github.com/awesome-gocui/gocui/README.md
+++ /dev/null
@@ -1,135 +0,0 @@
-# GOCUI - Go Console User Interface
-[![CircleCI](https://circleci.com/gh/awesome-gocui/gocui/tree/master.svg?style=svg)](https://circleci.com/gh/awesome-gocui/gocui/tree/master)
-[![CodeCov](https://codecov.io/gh/awesome-gocui/gocui/branch/master/graph/badge.svg)](https://codecov.io/gh/awesome-gocui/gocui)
-[![Go Report Card](https://goreportcard.com/badge/github.com/awesome-gocui/gocui)](https://goreportcard.com/report/github.com/awesome-gocui/gocui)
-[![GolangCI](https://golangci.com/badges/github.com/awesome-gocui/gocui.svg)](https://golangci.com/badges/github.com/awesome-gocui/gocui.svg)
-[![GoDoc](https://godoc.org/github.com/awesome-gocui/gocui?status.svg)](https://godoc.org/github.com/awesome-gocui/gocui)
-![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/awesome-gocui/gocui.svg)
-
-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
-
-![r2cui](https://cloud.githubusercontent.com/assets/1223476/19418932/63645052-93ce-11e6-867c-da5e97e37237.png)
-
-![_examples/demo.go](https://cloud.githubusercontent.com/assets/1223476/5992750/720b84f0-aa36-11e4-88ec-296fa3247b52.png)
-
-![_examples/dynamic.go](https://cloud.githubusercontent.com/assets/1223476/5992751/76ad5cc2-aa36-11e4-8204-6a90269db827.png)
-
-## 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 3d986a71..00000000
--- 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 ca7113fa..00000000
--- 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 b5630df3..00000000
--- 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 64360802..00000000
--- 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 5791b4e4..00000000
--- 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 25f1c037..00000000
--- 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 6fe0d5d8..00000000
--- 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 5d247a19..00000000
--- 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 db1faab7..00000000
--- 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 d294e70d..00000000
--- 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 d6715ac6..00000000
--- 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 81f90603..00000000
--- 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 fe26fb0f..00000000
--- a/vendor/github.com/awesome-gocui/termbox-go/AUTHORS
+++ /dev/null
@@ -1,4 +0,0 @@
-# Please keep this file sorted.
-
-Georg Reinke <guelfey@googlemail.com>
-nsf <no.smile.face@gmail.com>
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 d9bc068c..00000000
--- 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 734aab73..00000000
--- a/vendor/github.com/awesome-gocui/termbox-go/README.md
+++ /dev/null
@@ -1,49 +0,0 @@
-[![GoDoc](https://godoc.org/github.com/nsf/termbox-go?status.svg)](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 a461fc27..00000000
--- 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 5ca1371a..00000000
--- 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 5c1e388a..00000000
--- 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 5e50975e..00000000
--- 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 b7bbb891..00000000
--- 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 dde69b6c..00000000
--- 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 4f52bb9a..00000000
--- a/vendor/github.com/awesome-gocui/termbox-go/syscalls.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// +build ignore
-
-package termbox
-
-/*
-#include <termios.h>
-#include <sys/ioctl.h>
-*/
-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 25b78f7a..00000000
--- 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 11f25be7..00000000
--- 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 e03624eb..00000000
--- 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 e03624eb..00000000
--- 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 b88960de..00000000
--- 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 49a3355b..00000000
--- 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 49a3355b..00000000
--- 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 472d002a..00000000
--- 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 fbe4c3de..00000000
--- 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 c3355cc2..00000000
--- 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 22e0f9ea..00000000
--- 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 ab2e7a19..00000000
--- 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 a9486606..00000000
--- 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 7319bdea..00000000
--- 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 5ba5c86f..00000000
--- a/vendor/github.com/blang/semver/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-The MIT License
-
-Copyright (c) 2014 Benedikt Lang <github at benediktlang.de>
-
-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 e05f9865..00000000
--- a/vendor/github.com/blang/semver/README.md
+++ /dev/null
@@ -1,194 +0,0 @@
-semver for golang [![Build Status](https://travis-ci.org/blang/semver.svg?branch=master)](https://travis-ci.org/blang/semver) [![GoDoc](https://godoc.org/github.com/blang/semver?status.svg)](https://godoc.org/github.com/blang/semver) [![Coverage Status](https://img.shields.io/coveralls/blang/semver.svg)](https://coveralls.io/r/blang/semver?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/blang/semver)](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 d0083058..00000000
--- 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 a74bf7c4..00000000
--- 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 1cf8ebdd..00000000
--- 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 95f7139b..00000000
--- 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 4165bc79..00000000
--- 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 e18f8808..00000000
--- 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 db958134..00000000
--- 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 519d7f22..00000000
--- 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 3bd6c869..00000000
--- 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 04a2306c..00000000
--- 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 4f59364b..00000000
--- 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 b111df4e..00000000
--- 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 0d9e6e63..00000000
--- 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 e70c2b1f..00000000
--- 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 d9658215..00000000
--- 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 d79b5c29..00000000
--- a/vendor/github.com/corpix/uarand/README.md
+++ /dev/null
@@ -1,38 +0,0 @@
-uarand
-----------------
-
-[![Build Status](https://travis-ci.org/corpix/uarand.svg?branch=master)](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 abb3ec57..00000000
--- 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 037ee245..00000000
--- 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 04f9247c..00000000
--- 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 aa8e44cc..00000000
--- 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 2e2e457b..00000000
--- 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 1cade6ce..00000000
--- 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 af62279a..00000000
--- 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 8c29ec68..00000000
--- 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 bc52e96f..00000000
--- a/vendor/github.com/davecgh/go-spew/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-ISC License
-
-Copyright (c) 2012-2016 Dave Collins <dave@davec.name>
-
-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 79299478..00000000
--- a/vendor/github.com/davecgh/go-spew/spew/bypass.go
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>
-//
-// 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 205c28d6..00000000
--- a/vendor/github.com/davecgh/go-spew/spew/bypasssafe.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2015-2016 Dave Collins <dave@davec.name>
-//
-// 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 1be8ce94..00000000
--- a/vendor/github.com/davecgh/go-spew/spew/common.go
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
- *
- * 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("<nil>")
- maxNewlineBytes = []byte("<max depth reached>\n")
- maxShortBytes = []byte("<max>")
- circularBytes = []byte("<already shown>")
- circularShortBytes = []byte("<shown>")
- invalidAngleBytes = []byte("<invalid>")
- 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 2e3d22f3..00000000
--- a/vendor/github.com/davecgh/go-spew/spew/config.go
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
- *
- * 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 aacaac6f..00000000
--- a/vendor/github.com/davecgh/go-spew/spew/doc.go
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
- *
- * 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) <nil>
- }),
- 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 <*><shown>}
- %+v: <*>(0xf84003e260){ui8:1 c:<*>(0xf84003e260)<shown>}
- %#v: (*main.circular){ui8:(uint8)1 c:(*main.circular)<shown>}
- %#+v: (*main.circular)(0xf84003e260){ui8:(uint8)1 c:(*main.circular)(0xf84003e260)<shown>}
-
-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 f78d89fc..00000000
--- a/vendor/github.com/davecgh/go-spew/spew/dump.go
+++ /dev/null
@@ -1,509 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
- *
- * 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 b04edb7d..00000000
--- a/vendor/github.com/davecgh/go-spew/spew/format.go
+++ /dev/null
@@ -1,419 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
- *
- * 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 32c0e338..00000000
--- a/vendor/github.com/davecgh/go-spew/spew/spew.go
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (c) 2013-2016 Dave Collins <dave@davec.name>
- *
- * 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 ba95cdd1..00000000
--- 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 8d9a94a9..00000000
--- a/vendor/github.com/dustin/go-humanize/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-Copyright (c) 2005-2008 Dustin Sallings <dustin@spy.net>
-
-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.
-
-<http://www.opensource.org/licenses/mit-license.php>
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 91b4ae56..00000000
--- a/vendor/github.com/dustin/go-humanize/README.markdown
+++ /dev/null
@@ -1,124 +0,0 @@
-# Humane Units [![Build Status](https://travis-ci.org/dustin/go-humanize.svg?branch=master)](https://travis-ci.org/dustin/go-humanize) [![GoDoc](https://godoc.org/github.com/dustin/go-humanize?status.svg)](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 f49dc337..00000000
--- 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 1a2bf617..00000000
--- 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 0b498f48..00000000
--- 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 520ae3e5..00000000
--- 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 620690de..00000000
--- 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 1c62b640..00000000
--- 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 a2c2da31..00000000
--- 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 dec61865..00000000
--- 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 43d88a86..00000000
--- 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 ae659e0e..00000000
--- 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 dd3fbf5e..00000000
--- 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 95f8a1ff..00000000
--- 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 7d879e9c..00000000
--- 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 ff1617f7..00000000
--- 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 25fdaf63..00000000
--- 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 3fc95446..00000000
--- a/vendor/github.com/fatih/color/README.md
+++ /dev/null
@@ -1,179 +0,0 @@
-# Color [![GoDoc](https://godoc.org/github.com/fatih/color?status.svg)](https://godoc.org/github.com/fatih/color) [![Build Status](https://img.shields.io/travis/fatih/color.svg?style=flat-square)](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.
-
-
-![Color](https://i.imgur.com/c1JI0lA.png)
-
-
-## 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 91c8e9f0..00000000
--- 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 cf1e9650..00000000
--- 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 9d00fdd5..00000000
--- 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 c9a5b2ee..00000000
--- a/vendor/github.com/go-errors/errors/LICENSE.MIT
+++ /dev/null
@@ -1,7 +0,0 @@
-Copyright (c) 2015 Conrad Irwin <conrad@bugsnag.com>
-
-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 5d4f1873..00000000
--- a/vendor/github.com/go-errors/errors/README.md
+++ /dev/null
@@ -1,66 +0,0 @@
-go-errors/errors
-================
-
-[![Build Status](https://travis-ci.org/go-errors/errors.svg?branch=master)](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 ab18b051..00000000
--- 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 60062a43..00000000
--- 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 cc37052d..00000000
--- 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 750ab9a5..00000000
--- 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 15167cd7..00000000
--- 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 1c4577e9..00000000
--- 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 0f646931..00000000
--- 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 3cd3249f..00000000
--- 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 d9aa3c42..00000000
--- 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 dea2617c..00000000
--- 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 3abfed2c..00000000
--- 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 d4db5a1c..00000000
--- 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 816a3b9d..00000000
--- 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 75565cc6..00000000
--- 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 3b6ca41d..00000000
--- 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 b6cad908..00000000
--- 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 d55a335d..00000000
--- 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 50b99b83..00000000
--- 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 b1679449..00000000
--- 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 5525def6..00000000
--- 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 ebf1caa5..00000000
--- 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<<len(reqFields)-1
- unrecognized field // offset of []byte to put unrecognized data (or invalidField if we should throw it away)
- extensions field // offset of extensions field (of type proto.XXX_InternalExtensions), or invalidField if it does not exist
- oldExtensions field // offset of old-form extensions field (of type map[int]Extension)
- extensionRanges []ExtensionRange // if non-nil, implies extensions field is valid
- isMessageSet bool // if true, implies extensions field is valid
-}
-
-// An unmarshaler takes a stream of bytes and a pointer to a field of a message.
-// It decodes the field, stores it at f, and returns the unused bytes.
-// w is the wire encoding.
-// b is the data after the tag and wire encoding have been read.
-type unmarshaler func(b []byte, f pointer, w int) ([]byte, error)
-
-type unmarshalFieldInfo struct {
- // location of the field in the proto message structure.
- field field
-
- // function to unmarshal the data for the field.
- unmarshal unmarshaler
-
- // if a required field, contains a single set bit at this field's index in the required field list.
- reqMask uint64
-
- name string // name of the field, for error reporting
-}
-
-var (
- unmarshalInfoMap = map[reflect.Type]*unmarshalInfo{}
- unmarshalInfoLock sync.Mutex
-)
-
-// getUnmarshalInfo returns the data structure which can be
-// subsequently used to unmarshal a message of the given type.
-// t is the type of the message (note: not pointer to message).
-func getUnmarshalInfo(t reflect.Type) *unmarshalInfo {
- // It would be correct to return a new unmarshalInfo
- // unconditionally. We would end up allocating one
- // per occurrence of that type as a message or submessage.
- // We use a cache here just to reduce memory usage.
- unmarshalInfoLock.Lock()
- defer unmarshalInfoLock.Unlock()
- u := unmarshalInfoMap[t]
- if u == nil {
- u = &unmarshalInfo{typ: t}
- // Note: we just set the type here. The rest of the fields
- // will be initialized on first use.
- unmarshalInfoMap[t] = u
- }
- return u
-}
-
-// unmarshal does the main work of unmarshaling a message.
-// u provides type information used to unmarshal the message.
-// m is a pointer to a protocol buffer message.
-// b is a byte stream to unmarshal into m.
-// This is top routine used when recursively unmarshaling submessages.
-func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error {
- if atomic.LoadInt32(&u.initialized) == 0 {
- u.computeUnmarshalInfo()
- }
- if u.isMessageSet {
- return UnmarshalMessageSet(b, m.offset(u.extensions).toExtensions())
- }
- var reqMask uint64 // bitmask of required fields we've seen.
- var errLater error
- for len(b) > 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)<<uint(len(u.reqFields)) - 1
-
- atomic.StoreInt32(&u.initialized, 1)
-}
-
-// setTag stores the unmarshal information for the given tag.
-// tag = tag # for field
-// field/unmarshal = unmarshal info for that field.
-// reqMask = if required, bitmask for field position in required field list. 0 otherwise.
-// name = short name of the field.
-func (u *unmarshalInfo) setTag(tag int, field field, unmarshal unmarshaler, reqMask uint64, name string) {
- i := unmarshalFieldInfo{field: field, unmarshal: unmarshal, reqMask: reqMask, name: name}
- n := u.typ.NumField()
- if tag >= 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 1aaee725..00000000
--- 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("<nil>\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("<nil>"))
- 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 bb55a3af..00000000
--- 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.<unknown field name>", 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 ae121a1e..00000000
--- 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 37080b19..00000000
--- 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 b722392e..00000000
--- 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 <kamil@kamilkisiel.net>
-Matt Silverlock <matt@eatsleeprepeat.net>
-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 6903df63..00000000
--- 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 92e422ee..00000000
--- a/vendor/github.com/gorilla/mux/README.md
+++ /dev/null
@@ -1,718 +0,0 @@
-# gorilla/mux
-
-[![GoDoc](https://godoc.org/github.com/gorilla/mux?status.svg)](https://godoc.org/github.com/gorilla/mux)
-[![Build Status](https://travis-ci.org/gorilla/mux.svg?branch=master)](https://travis-ci.org/gorilla/mux)
-[![CircleCI](https://circleci.com/gh/gorilla/mux.svg?style=svg)](https://circleci.com/gh/gorilla/mux)
-[![Sourcegraph](https://sourcegraph.com/github.com/gorilla/mux/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/mux?badge)
-
-![Gorilla Logo](http://www.gorillatoolkit.org/static/images/gorilla-icon-64.png)
-
-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/<filename>
- 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 665940a2..00000000
--- 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 bd5a38b5..00000000
--- 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/<filename>
- 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 cfc8ede5..00000000
--- 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 cf2b26dc..00000000
--- 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 a2cd193e..00000000
--- 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 ac1abcd4..00000000
--- 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 8479c68c..00000000
--- 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 32ecffde..00000000
--- 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 ac710204..00000000
--- 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 3d8d29cf..00000000
--- 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 b003eca0..00000000
--- 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 <gary@beagledreams.com>
-Joachim Bauch <mail@joachim-bauch.de>
-
diff --git a/vendor/github.com/gorilla/websocket/LICENSE b/vendor/github.com/gorilla/websocket/LICENSE
deleted file mode 100644
index 9171c972..00000000
--- 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 33c3d2be..00000000
--- 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.
-
-[![Build Status](https://travis-ci.org/gorilla/websocket.svg?branch=master)](https://travis-ci.org/gorilla/websocket)
-[![GoDoc](https://godoc.org/github.com/gorilla/websocket?status.svg)](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
-
-<table>
-<tr>
-<th></th>
-<th><a href="http://godoc.org/github.com/gorilla/websocket">github.com/gorilla</a></th>
-<th><a href="http://godoc.org/golang.org/x/net/websocket">golang.org/x/net</a></th>
-</tr>
-<tr>
-<tr><td colspan="3"><a href="http://tools.ietf.org/html/rfc6455">RFC 6455</a> Features</td></tr>
-<tr><td>Passes <a href="http://autobahn.ws/testsuite/">Autobahn Test Suite</a></td><td><a href="https://github.com/gorilla/websocket/tree/master/examples/autobahn">Yes</a></td><td>No</td></tr>
-<tr><td>Receive <a href="https://tools.ietf.org/html/rfc6455#section-5.4">fragmented</a> message<td>Yes</td><td><a href="https://code.google.com/p/go/issues/detail?id=7632">No</a>, see note 1</td></tr>
-<tr><td>Send <a href="https://tools.ietf.org/html/rfc6455#section-5.5.1">close</a> message</td><td><a href="http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages">Yes</a></td><td><a href="https://code.google.com/p/go/issues/detail?id=4588">No</a></td></tr>
-<tr><td>Send <a href="https://tools.ietf.org/html/rfc6455#section-5.5.2">pings</a> and receive <a href="https://tools.ietf.org/html/rfc6455#section-5.5.3">pongs</a></td><td><a href="http://godoc.org/github.com/gorilla/websocket#hdr-Control_Messages">Yes</a></td><td>No</td></tr>
-<tr><td>Get the <a href="https://tools.ietf.org/html/rfc6455#section-5.6">type</a> of a received data message</td><td>Yes</td><td>Yes, see note 2</td></tr>
-<tr><td colspan="3">Other Features</tr></td>
-<tr><td><a href="https://tools.ietf.org/html/rfc7692">Compression Extensions</a></td><td>Experimental</td><td>No</td></tr>
-<tr><td>Read message using io.Reader</td><td><a href="http://godoc.org/github.com/gorilla/websocket#Conn.NextReader">Yes</a></td><td>No, see note 3</td></tr>
-<tr><td>Write message using io.WriteCloser</td><td><a href="http://godoc.org/github.com/gorilla/websocket#Conn.NextWriter">Yes</a></td><td>No, see note 3</td></tr>
-</table>
-
-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 43a87c75..00000000
--- 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 4f0d9437..00000000
--- 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 babb007f..00000000
--- 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 813ffb1e..00000000
--- 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 97e1dbac..00000000
--- 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 1ea15059..00000000
--- 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 018541cf..00000000
--- 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 e291a952..00000000
--- 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 4f0e3687..00000000
--- 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 6a88bbc7..00000000
--- 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 2aac060e..00000000
--- 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 1efffbd1..00000000
--- 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 3495e0f1..00000000
--- 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 9a4908df..00000000
--- 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 = <any 8-bit sequence of data>
- // CHAR = <any US-ASCII character (octets 0 - 127)>
- // CTL = <any US-ASCII control character (octets 0 - 31) and DEL (127)>
- // CR = <US-ASCII CR, carriage return (13)>
- // LF = <US-ASCII LF, linefeed (10)>
- // SP = <US-ASCII SP, space (32)>
- // HT = <US-ASCII HT, horizontal-tab (9)>
- // <"> = <US-ASCII double-quote mark (34)>
- // CRLF = CR LF
- // LWS = [CRLF] 1*( SP | HT )
- // TEXT = <any OCTET except CTLs, but including LWS>
- // separators = "(" | ")" | "<" | ">" | "@" | "," | ";" | ":" | "\" | <">
- // | "/" | "[" | "]" | "?" | "=" | "{" | "}" | SP | HT
- // token = 1*<any CHAR except CTLs or separators>
- // qdtext = <any TEXT except <">>
-
- 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 83656241..00000000
--- 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 e474cd07..00000000
--- 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 be2cc4df..00000000
--- 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 33e58cfa..00000000
--- 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 555225a2..00000000
--- 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 2547df97..00000000
--- 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 824cb97e..00000000
--- 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 c8d9b0a2..00000000
--- 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 5673773b..00000000
--- 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 74c70774..00000000
--- 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 3df5d9f0..00000000
--- 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 7f688de0..00000000
--- 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 b809e455..00000000
--- 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 ad962fa7..00000000
--- 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 ab4233b3..00000000
--- 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 3c1fe8a1..00000000
--- a/vendor/github.com/icrowley/fake/README.md
+++ /dev/null
@@ -1,90 +0,0 @@
-[![Build Status](https://img.shields.io/travis/icrowley/fake.svg?style=flat)](https://travis-ci.org/icrowley/fake) [![Godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/icrowley/fake) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](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 4ef4011e..00000000
--- 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 47d6ca72..00000000
--- 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 b85c9436..00000000
--- 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 7249a9d3..00000000
--- 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<d\xc9\x16\x02\xf1\r\r\xf6\xe8\xe0\xeaj\x9e\xb9\x97\x81\x02q\x16\x97\xa1\ta\xaf\x06\xbaN\x98\x9c\x9aGA\x9c\xe9\xb3Ga\x1c\x04\x98\x9c\xf0\f{\x19\x00\x1e\xf6\xd18|:\xaaܘk\xfb!'\x1d\x14\xac\xf3h\x12VlW!\xb7\xdb)b\xebxb\x05v\xec\xdb{\xbeb\xfd\xbc\x17\x88\x1f8\xedc\x80\xa7\xf0<$ě\vD\x17\x8f\x18}\x9c\x05\xa7\x83\xd8Ò\x10>\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\x82<D\x94\xb67\xb9\x14\v\xbd1\xeak\\\x13\xeb\xaa\x16\xbc\xe9<e\x9f\x10co\xf6lHK\n\xe2X\xa6\x9ci9\xda\xf6-\xf4\x16?\xa3\xb4\x9c/\x846\xab\x98B\a\xe1\x8f\xcb\x11\x03\x9e\xe0\x04 (64ZU\x8a\xf2\x0f\xb4\u0600:\xdb\x13S0ځ:\xebE\xca\xfc\xabh\x15x\xbbz=m\xa5\xefw\x14\x8c\xfd\f1\x8e!\x0fZ\x10\x134?H\x06Qԭ@Ϧ\xe3d\xf4Ga*\xc0\xab`\x8e\xfd$\xb8V\x12zG\xfa\xe8\xfa\xdd3\v\x162\xe0\x9di\x8e#B\x82>5\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<JIk\xe2\x18\x94H\xdeI\x8b\xedv\x10V\xef\xf7\x1bGZsi\xdegT\x01\x12\xda7\x99\xf8\x83>\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<P\xa2\t\xb8\x96\vTc\x98\x81*\xb3Q\xcb֞\\\xd8L{\xb0\x97l!ܦ\xa22\x1d\xd1\xc2Q\xd73i\x86}WC\x044\x9b\x86\xd8p=ei\xee\x80\xf3\u007f\x05r\x89\xc0\xfd\xd7H\x99\x81r\x9dI\x80\x9f\xdfğ!\xa1\x83R\xb3IO\x12\xc8\xdaㅛH羏\xc78\xf0\x10\x1dNG4\rH\n\x9a73}\xb2\xb1\x02/\x83g[,\x83\x83\xac\x1e\x98\a\x9d\x18\xd9\\9\x97F90\x99CC\x00\xb8̄l\xdb{4\x9f`\xcb\xc2Է\x9cM\x0fj\x88\xf3\x15\xfe\xf5?\xc8X\\\xc1]\xa5\xb1A\xe5\x04G\xb6\xf4\x9a\x00\xb8\x12\x85\xc11\xa6J\xf8\x8a\xad]Ŭ9%\nk\xf6\xe4^r\x80\x8f̗p\x16\x15\xd7\xd2\xf5By\xc9X\x96\xbah\xd3\x06\x03\xf8(:ъ\x8c1\x966<c\xd0 \xa9\xb2\xbd\xe2\xe5^p\x80\xf8$1\xe7\xed\xd9\x17\xa2\x1c:\xb5fF\x00\x83\xba\x94\x06\xe9\xa3;\xf7\x18\n\xc3K\xcf4\xf5=\xd9\xc0\x16ܨG\xbb\xec\xf7\x1c7h\x81܁\f帞5?\xa4\x06h\x8a\xa7_\x01\tA\xc8%o&)\xf5(\x16\x86\x8b\xba`>$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<U\f\x00\x00",
- },
-
- "/data/en/continents": {
- local: "data/en/continents",
- size: 68,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffr,\xceL\xe4\xf2\xcb/*\xc9Pp\xccM-\xcaLN\xe4\n\xce/E\xe29\x96\x16\x97\x14%\xe6\x00U9\xa6\x81\x05\\K\x8b\xf2\vR\xb9\x1c\xf3J\x12\x8b\x92K@\"\x80\x00\x00\x00\xff\xff\xffM\x18\xc9D\x00\x00\x00",
- },
-
- "/data/en/countries": {
- local: "data/en/countries",
- size: 2774,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\\VM\x96\xdb8\x0e\xde\xf3\x14\xdaM\xf2^\xfa\x10\xb1\xeb\xdfv\xc5SrU\xbf\xce\x0e\x92\x10\t1E:\x14iG\xde\xcf\xc9\xe6b\xfd\x81\x92]\xf5\xb2!@\x80\"\xf1\xf3\x01\xd0\xd7\x1fmGN\x86H\xce\xfc\xff\u007f\x96\\c\xbe\xda\n\x12\x02m9(\xedAjrEI\xbd\xc7\xd65>\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\xaf<nR\x86\x83\xf7\x0e\x8c\xa3F\xf7\a.\xde84\fv\xec\xe9݂%\"\x8d\x10\x16_\u007fL\x89{\xe1C\xaa\xac\xd4f\xd9Q\x83E,\xeb\n\xbf\x96]@\xee\x11ыkK_\xfb\xa1\xf8\xb4b\x04͵\x9f\xdf\xc5\xd6\xf7\x95\x1a\xe1{\x1f\x10\xe4\xa5G\xfa\xbf\\o.\xfc\x8f\x8b\xe8\x86{_\a\x02\x10\xfe\xd0\xfa\xfd\xbb\x81\x1e\x80+^\x14+K\x1f\xb9h\xfe\xf3x\xf4\x12`U\xf0\xf8\x12R\x85\xc6r<h\x1e\x97g\xae\xbbw\x1fn\xd8\xf5\x14\xf6\xe6\xe6\xa7T>E17\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<xפ@\x99i\x8b\x15\x16\xf3\x90\x1c\x10=\x9aǚ\xb3)\xb9\x14t\xf5\x93ӏ\b\x8d.\xbf\xb0\xcc'\x06ˀI\xb1Q\xc5\x10\x88\xady\x8cdG\xf3\x84z\xd7\xe4>\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<R]\xaf\x9b0\f}\xf7\xbf*\xed\xdd\xee(\xb7\xaaJ\xb5=\x1b\xf0\x1aK!ٜp\xa5\xec\xd7\xef\x18\xa6\xbd\x99\xd8\xc7\xe7\xc3|\xb05\xbas5\x9d\x95iд0ul\x13\x1b\xd3[\xd4?<I\r\xd4KJ\xfaS\x8c0\x8e\xb1q+\x9c\xbc~\xb1I\xa5K\xb6\\C\x03\xba0\xdd8͍\xaeh$\xea\xa4\xd6F\xef\x12Q\x8f\x9c\x16\xec\xbc䔘\xcel9\xd2c\xc3\xea1\xa0\xc62\x9d\x83\xc4(4\xf0\x86\xb1\x11\xfc\x81\xae\xbaNb\xb1\xd1E\xa6\xec\x0f\xbd\x94\xa23\xdaA-J\xa3sK5@\xd0)\xbd$2}H\xd4\x02\r\x1d\xc8\xe1\xe3\xb46t@\xf7\x90If\xc0\xbe\xab\xbd4a\xfe\xca5D\x81\xaa;\xaf;\x90\xad\x06v\x1as\x18;z\xac\xf2+pR9ԶD\xe7`Z\xaa&\xd9c\x10\xea9\xc1\xfd\x19\xbb\xc4\xfc\xf5\x8b\xc1\xbb\x14\xe7\xa4>\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\xd61<d\xc0\xa9\x0f\xad]-\x01\x06\xcb;\x9f\xdb^qo\xaf\xf6D\xa6\x96\x93;\x16\v\xd8\xdd\xf7$\xe9\x96pz\xbc\x9d\xeb1\x00\xc6Ɵ\xbb\x84\xe4\xfet\x93X\x87݈S\xf8>d\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=<A\x17dmE\x15\xf9\xcb\x04\xa7 \x96\"\x10\x01\xb1\x86\x88)\x99H\xcbN;\x1f\x04zN\xa8\xf5o\x00\x00\x00\xff\xffl@\xa6y\xe4\x06\x00\x00",
- },
-
- "/data/en/female_name_prefixes": {
- local: "data/en/female_name_prefixes",
- size: 14,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\xf2-*\xd6S\xf0\x05\xe1\xcc\xe2b.@\x00\x00\x00\xff\xff \xc7\"\xf4\x0e\x00\x00\x00",
- },
-
- "/data/en/female_name_suffixes": {
- local: "data/en/female_name_suffixes",
- size: 29,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\xf2T\xf0\x04! \x0eS\bS\xf0uQpq\tV\b\xc8\x00\xd2a\xbe\\\x80\x00\x00\x00\xff\xff\x93~\xf7\xc6\x1d\x00\x00\x00",
- },
-
- "/data/en/female_patronymics": {
- local: "data/en/female_patronymics",
- size: 666,
- 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\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<w\xaaQ\xf5\x15)(\xeaNq\xbd\xa2)\x1c\x01\x81m\xe4k=\xd6@\xa2\xe1K\xb9\xba\xaf嶾\xa8r%iU{j\xech\f-\x89\xa5\xbc慸\x99\x97\x93cH\x16\xdc2\x1aG7\xb8>\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<p)\x05X\xb9\xcaI\xbb\xc7V\x94g\x1e\x0eW7\xad\xec\xb8\xe0P\xed\xa0K\xb4\x16v\xee\x1a\xa3l*n͑Ky\x15\x0f\x1a\x8eS!D\x84u\xb9\xcel\xa5\x91\xb9ii\x91\x89P\xa7\xfad\xe2\xacT\xdb\x036\xeen\x9b\xb1Š\xf8\x95\u007f\xf2$\x9d\xe2c˓\x97\xf9A\xa9\xe6ǜ\x8c)\x06\xb0\x15\xcf\xfc:\xb3\x94\fYpd\x1f\xac\x89\x9dj\x9aц\x8c\x12\xe0\x19eO\xb7\x11\xc1f\x96t\x80yPE\v\xae\xb6x\xb0\x9fLIs\xf9DiR\xda\xc2\x1e*\\\x84\x91\xecS\xfeP\x13F\fs!\xa9C\x051\x15\xe0\xb6}Nz?\xeb\xfd\x87\x9fb~\xf8\x15\x00\xdfө52\v\xd7|\x96\xfd\x90\x90\xa8\xd9\x12'\xf9<+\f9,\xcenXr\xaa\xd1JT%\x8fg\xb8\x8a\xf6'*\xa9n\x85\x87\x8f\xecgv\xa46<\xe1\x8a\xf9\xf8p\xf8ȋ+Pi\xf1!p)\xca\x11P\xd0\xd2w]a`X\xfe\xc3ܫ\xedG\xc3M\"\x9a\vl2NE\x02\n\xee\xe6\xa6(A\xf7J5v\xe6W\xfe!p+\xe8p^\xc1=&\xf9;5\xfc\x84\xbc\x12!\x17\x84\xa3\xc5\xe1\x90\xc8\xf4\x02\x96\xa9(1\xc3\x13\x8f\x99\x97uh>\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<!и\x99P/\xe9\xfcK\xf0Sb\xcesM\xcd.e\x9e\xb5\xff6\x9e\xddz\xa2\x95\x88\xfc;0J\xf8\xe7\x9f\xf8\xf5ɑ%\xdf\xff\x0f\x00\x00\xff\xff$w\xa6\f:\x13\x00\x00",
- },
-
- "/data/en/jobs": {
- local: "data/en/jobs",
- size: 2246,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffdU]r\xe36\f~\xd7)8\xd3\x03\xf4\f\xa9㵷\xb3\x89\xd5\xc8\xd3<3\x14$q#\x91\x1a\xfex\xe3\xe9\xf4\xee\v\x88\xa4H\xc9/\x1e\xf3\x03 \x02\x1f>\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<z\x86\"^\xbd\x18\x81\x1bV\xeb_\b\xad\x9e\xaf\xdeX\b\xbf8\xea\\\xd0\x00kb\xf3\"\x84\x9f\x97\xdaH\x00\x03\xd27S\x03\xc3>\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\xd61<d\xc0\xa9\x0f\xad]-\x01\x06\xcb;\x9f\xdb^qo\xaf\xf6D\xa6\x96\x93;\x16\v\xd8\xdd\xf7$\xe9\x96pz\xbc\x9d\xeb1\x00\xc6Ɵ\xbb\x84\xe4\xfet\x93X\x87݈S\xf8>d\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=<A\x17dmE\x15\xf9\xcb\x04\xa7 \x96\"\x10\x01\xb1\x86\x88)\x99H\xcbN;\x1f\x04zN\xa8\xf5o\x00\x00\x00\xff\xffl@\xa6y\xe4\x06\x00\x00",
- },
-
- "/data/en/male_name_prefixes": {
- local: "data/en/male_name_prefixes",
- size: 8,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\xf2-\xd2Sp)\xd2\xe3\x02\x04\x00\x00\xff\xffs\x11\xfb\xf8\b\x00\x00\x00",
- },
-
- "/data/en/male_name_suffixes": {
- local: "data/en/male_name_suffixes",
- size: 37,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\xf2*\xd2S\b\x06bO\x05O\x10\x02\xe20\x850\x05_\x17\x05\x17\x97`\x85\x80\f \x1d\xe6\xcb\x05\b\x00\x00\xff\xff\x93:h\xda%\x00\x00\x00",
- },
-
- "/data/en/male_patronymics": {
- local: "data/en/male_patronymics",
- size: 666,
- 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\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<e}\"\xe8\xc4A\x8b\x15\xf1\xc61\xc4\vV\xf0+a\xd9\xe5א0\xad\xf5\x9fSA.\u007f\x03\x00\x00\xff\xffh\xac\xda\x1b\x80\x00\x00\x00",
- },
-
- "/data/en/phones_format": {
- local: "data/en/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/en/state_abbrevs": {
- local: "data/en/state_abbrevs",
- size: 149,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\f\xc6\xc1\r\x02 \f@\xd1\xfbߪ\x01\x94\n-\x06\x10\xc4\xfd\a\x91\xe4\x1d\x9eT\xa4 ?\xa4\x13\x84\xd0\b\x93\x98xT\x9eBV4\xa2\x15uT(\x83r\xa8\x82%,b7\x8a96\xb0\x86M<\xe1\v\xcf\xf8\v7\xfc\xe0\x01\x8f\xb4L+\xb4\xce[\xe8\xca\b\x8c\xc8t\xe6\x97\xcfd]¾\x16[\xd9\xe7\x1f\x00\x00\xff\xff\xc9\xcb@ƕ\x00\x00\x00",
- },
-
- "/data/en/states": {
- local: "data/en/states",
- size: 471,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffL\x90oo\xc2@\b\xc6\xdf\xf3)\xfaU\x16\xcdf\xe7\xd4e\u007f4{\x89-\xeb\x91^\xc1\x1cW\xb5\xfb\xf4\xe3\xaaɖ4\xe5\xc7A\x1exx\x88x\xc4\x01\xc1\xa3\xf5\x1e\x12\xff\xa8\x94أ\x18\x1a,0\xf2\xb7&a\x84\x85FMت\x83\b5\x99\x9b1Ò\"^0\x11<z\x91[\x84'\xd2\xd4y\xf7ʟ\x99\xa1n1(\xd41\xb2(\x1b\xd4\xd22\xba~\xad\x17\x84\xf5mĚ$\x8fM?\xc1\x8b\x8elsy\x83,\xe4\xff4E\x94\xd6\xc1\f\x9b0\x1a\xe5l\xb0\xe1&p\x87\xe2\xe0{\x98f\xefg\xb3\xf2\x9dN<\xb3\x8e\xc9A%\x17\xb1-\x1d\xd3lnKglK\xb8T+\x1cN\x16\xd8\xf7.\xd93%\xa3i\xc6\r]\xb9\xd1\x19\xbf4\xf5\xb0ՔC\xb5\xc0\xa4\xee\x00\xef\xe9\x12\xfb2u\x17Xa\xd7Gw\xe8\x17\xdc%\xeaT\xe0\x95Dl\x8ag,'{\v\xdaRU\xdb\xec\xe2]\xc7\xffR\xb7\xf4.\xf5AŊ\x119]\xfd&\x9f\x19\x03\xec)\r\xee\x01\xf6\xec\x17-r\a\xf4\x9d\xa5\xcb>\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<J\x02\xfb\xb2~\xe0\x1d\xd1\\\xcc\x18pr\xb4_\xc1\xe3\xb68\x19\x9f\f\x96\xc4٦l;NŰ\x84\xd0\x03d\x9bxy\xaeÒ\xcb\xecۭ\x98s\xf3`z1\x05\xcc\xf78\x18<\x9en\xa4^r&\xcf\xe2*\xb7\xce\xe1\x89\x0f&\x8d\xe7\x00\x1d\x00X\a\xcaŷd{i\x1eD\x85\u007f\x10\xeb\xce%%\x00\xe7\x86\x18\xae\x98\xb1\xb1\x1b\xf5\xe6\ag\xba\xe9d\xa3\"\xea\xe5\xc1\x15i\x1fpv\xbb\xa7\xc4\x1c\xfe\xc13\xc1S\x96\xb9y\b\xa7e\xb4\x19\v\x83\xf7<=,3\x04y\b7\x1c\x11\xc5W\x81\x1e\xa25\xb1]E\xec!\xee&h\xf3~ 4\xe0+U\xf1\n\x1eE\xeaM\xfb\x0e-\x19\xe0\xd1\xf1\xdc\xe2\xb2\x1e\\<\x84h7V\x97\xf9\\7Enn?\xf4\xaaB\xa5B\xba\x92\xb3ij\x15\xd7߱/\xb9Y\x19g\x8d\x1f\x14\xdc.)\x80ϧh\xfbA\x80<\xed\xb8\x82\x82%V\x00\x8d\x1bG :\xb4\xa13\xe4\x17\x88\x85'\xadL\xea`\x9cfu\x1f\x8eX\x81W\xacb\x80rW\xa3\xc40\tfG\xebC\x98ȡ\xe9\x95\xc3as\xf0\xb9\"\xdf\xc3d+\xc7\u007f\xb0\xc5\x05]q\xeb\xa5]\x1b\xe7\xcc0\xf2\xd8\xd0\xe3\xf2\x805\x90\x1e<D\xd3\a\x822\x9f\n6\xc1\x91}7\n\x01<\xb7\xb3|p\xa0^\xf0*\xc5\xc1U\xf1\x02\xe4\xe2\t\xb1\x17耀B\x86\x98\xba\x80ׄ\x9c\x83W[\xd1J\x1d6\xb7\xaffJ:\xca햮\x00\xc1\x16GM\xd0X\x10\xb6\xcfͣ\x81q@\xa7\x00K=\x1aD\x12h\\\x94]m\x0f\xba\x10\xde`\xc8H\x8e;\x9aG9EC\x9a@:h\xc1d\xab\u007f\xbbv\xc7U\xe0\xc7\xe0\xc8\xcd\x02\x15\x118\x88\x8c\x98\x03D\xc0q[\x94\t\xf4\x93j\u007f\xb4\xed6D\xc9\x01\xe8j\x93\x1ee?I\x83T[\xd0E\x1e\x11\x81p\x84\xc7\x10\xf5\t\x90\xd6\xe2d\xe8;\x1bD\xc9c\x94\x05\xcax\x8cP=f˄\xb9\xe2\xd5!\x1f\x17;\x8c\xb9y2\x03\xd4\x0f\xea\xe4\xee\xc6O\xe6N\x1ce$P\xed=\r\x03\xac\x8apl\x9e\xdc\x00q\x9e\x9c\rē\x01\x995\x0e\x9f`(\xfc\x15\xf1\x82\xa7ԍ \f\xcb'$\x12\x864\xf9\x10\x05\xefx\xfa\xbc\xe0\xa6\xd4<\x1b\x1b\xab1\x88\xaaG\x13]\xad,\x00\xce\xddA\x9c\xbb@\x16\xcd\x00O\aX\x18K\xcf\\\x9f \xb5\x00\xa6\xa9y\x86\a\x89G\xf2y\xa6'\xccd\x14\xa7\xb2\xf6\xd18\xf9Ƈ\xe2\t\x13\xb5\xfc|\xf7\xda\xe7\xe2\x18\x8d`\xd4㚫\u05f8\xd1&\x1deY\x90\x1b\xd6\x12\xa9\xeb5\x82\xa7Y#\x9f\xd8\xefx];\xaa\x86[\x82\x83\xa2k~\x03\xae\xa4]\x85\x12\x93T\xfcN\x91\xd6P\xa8C\xdek\xd6\xd1t\xf2\x8d\x04\xfeK\xee\x91\a\xc1R\x9a\xcc|!\xba\x8df\x99\x00\xa8;\xa5\xedA=\u007f\x1d\xed\f\x02c\xc7f]\\\x12\xa4\xf4\x8dA\"ިQ7\xd0 \x13\xc6\xc6x]\x02Ni*\xe3\xdf\xf1\x04\xaf!\xbf\xe8l\x99@\xae\x88\x83\x8d\xb9\t\xe7\xbf\xc4u\xaaÍ\x18\x1e-\xe73\x92\rO\x16\bl\xc0\x90\xf0\xc9\xe1I\u007fz\xe4\xc6\xfa\xfc%\xcd& \x90@\xe5B'\u0604\xf3\x99q\xbe\t|\xd3\xfd\xfd\x18\xccZ\xbc\x00n\xf7\xf4\xb2\t\xb3\xa8\xbfm\x90[t\xe3\x15\x9e\xb5)\xbd>\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\"<f\xcb0\xddJ쑲\xc8\x03f,<e\xcb\xf8\x1eCI(s\x86\xff9V\bp\xdfS\xe9\xa3\"]\x973\x82\xff\xd9I\x89\xcd\x16\xf6B\x19\xc3d8\xe74@\x06\xbcv\x1b\xe8N\xdb\xc0\xa4\xdek\t\x01\x1e48\xb7!\xa0惡G\xb8\xe2\x06\bR\xfa\xbb\x86\xb6e\x9ax~\xe1&0\x8d\xb7퍾\xb73\xdde\xac\xad\xc7\xce\f\xcc\xdb0\xe8\x0eu\x19\x04I\x11\x9a#\x0f\xb8i\aMD\xc8O`sX,\x9a\x17@\xba\x01X9\x9b.C\v\x91G^\x9cTZ\xeb%rn\xc7E\xa8]\x98G\x10^9\x1d\xff[T\xdf@7\xd5\xf2\x0e\xce\x1eIk\xfe\x01P\x9d\xef:VO\xac\xeb\xba\x00/\xef&\xa0\xa1X\xa4\xed\x9d i\u007f\xbb\xf0}\xf0\xce\xe0\xff\x13\xeb\xebĝ\x94\xb2́\xc1\xbb\xb9\x049\rB\"\xe7D\x16\xb4\x1d\v%*\fx@\x1a\xb2\\\x81\x8e\xc5 !\x01D\xbdV\x15\xbeC\xbe\x84\x14\xdd8۞sl v\xb0\x93\xa5ev\xf6|v<\xd6j\x0e\x03[\x10\xcc(\xd1;\x9bQA\xe1\xe2\xbb\xd0M\xb0\x8a\xf6?\xbbP\xe5\xc6u\xa8\xfa`\x99\x01B.l\a\x00\xca,|@\xd0\x17\amA\xbe\xb9\xd6;`TJ0\xc4\x02o\t5i\ue81efw\x8b\xf0\xa6旙e2\x03\xfe\xfd\x85*~k~\x89\xa3\xb1\u007f\xc9\xd5\xf4\x06liW\xac0X\x18N\xf0\xe1_HDc\xa5\xd5\f\n\xf5\x9d\x8a.LT\x8ajK\xa3P\x1dP\xd1\u0096-z\x0e\x90\xa7\xdb\xea\n\xbf\xc2ՐP\x89(2\xfc}\xdb\x06\xb0\x9e\xf3:\xdaм:F\x16|\x82\xe08\xa2F4\xaf^\x98\xd7_}\x1a茯\xf0!\x124+\xcd\xeb\xa7F\xf6ް\xe7L\xe0\x03j\xde\xde\xf8\t\xe5\xfe\xaba\xeb\xd7VGP\xacuqo\x16\x8d\xfe\xbd\x18u\xf9=\xb2I\xba\xb9+<\xda`pA\xfa\xad.\xbb\xa7kF\\\xb2GiAi\x8b\xe73\xa0\xbf'\x86\xbd\x13\x93\xe0\xec\xcd\x1ea\b\x123\xeeV\x0e\xa3\xef#\n\xa7\x95\xf6@\xa3\xdd\a\xaa\xa0={U\xf6\xe4\xff)\x96\x968\x989\t\x99\xefI\xaf\x88Ѓ\xf4-z\xb4\xd2\x13-|\xe9A\x90\x1b\x98O\b\x10|\xea\xec,\xd5\x15\xe9\xc1\x8aX\x16\x0fV\x18\xe0\a;x\x1e\xac\x1f\x0e\x14\xfb\x00\xa7\x93\xb3\xa8O\x1e\xb4Mi\x0fB\u007f=\xf0\xdb〞\x8b\xf6=\x84\xcfS\x81\x87\x1f\nj8\tT\r\x96趇\x02\x17\xa1\x9d\x0e7l;\x9anLJ\xf3\x1f\xc2!&\x8e\xc8\x19\x19\rwq\x80\x05\xe9\x0e\x1a;\",\xf4R\x00g\xe7\x81k\x118x$S1 :G\xb2\x12\xbf\xc0Bu8\x00\xf4(\xa05\x8b\x1d\x05]\b\x94v\x1c\rC\xed\xc8(\x82p\xe0p\x1c\x9e\x02\xa0\xa7\x8d\xe12\x05\xb24\xb2\x139\xba\xc0\u007f\xb5e\xc5[\x03\x9eTi\xf5\xb7\xe3\xc5h\xd7uD\xe1J|\xe1\x05\xb5\a4jݨ\\\x95{DP\x0e\xa4Q=\xe7\x98Q\xf5\x93\xea\v\x10\xa9\x13\x9b\xd8\xf9 \xabE~\x9c`Ppn\xe0\xdf\xd1\x14\x86\xd41\x176k\xc7\xc2f\xed\x88\xee\xc6^\xf9\xb2\u0097ݓW\x1d\xd4\xfb\x00-W\xfbSdS\x0f\xd0\xf3\xfb\x05\xfc\xae\x1f\xb4\x8d\xf5k\xebX\xe0\xaf6\xf0\xd0Ȅq,I\x0fF\x05\x88\xf5\x85\xfaQRoX\xb4\ai\x8e\xb7\xce\xcc\f\xac7|\xa6hE\x04\x98\r\x97\xbc\xb1\xb4\xc2\xdc\x15\xdd\x18\x1fo\xf2\x89&\xe6m\xd4\x10\x83\x83\xbd\x8d\b\aH\xf96\x86\xf9\xa2\v\u0089G\x84Y[\xfc\xb7\xe0\xb1\x06\xaf\xc5\x11p|\x97\xe8\x94@>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<Jj?U||\xf5Y>\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<u(\x03\x03\v\b\tP\x91\x10HH\xacP\xfe\t\xcd3|~#δ4\x83eߗ\x9c}\xd4\x169و֦\xbc\x02{\x9e\xb4*\x8d\v2\xc9Ɯ\xd5%W\xdcH\xaa\xfe\xe3ҥU\x9d\xd8\xfa\x12\xf9\xee\x82M\x87\x0eZ\x92\xdd`\x95z\x0f7\x82\xa9ȵ,W\xa1\v9\xb0\x13\u007f\x94\xb7\x19o\x1a-\xfd(]\xf4P\x81\x9a\xec\xa3Md\x1b\xee\x1cu!\xfeC\xcd\u007f\xa1|\xfc\x06\x00\x00\xff\xff^6\xf4&\xd8\x00\x00\x00",
- },
-
- "/data/ru/continents": {
- local: "data/ru/continents",
- size: 133,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xfft\xcc\xc1\r\x85 \x10\x84\xe1;U\xbcRy\xc4;\\,\xc0\x06\f!\xa2\x04E[\xf8\xb7#7r\xf0\xe4i\xb3\xf3M\x86\xc0F\x11o\x98\xc8$\xb2X\x1aQ\xfcO\xe5x\xdeB%\x1af\xd6\x0f\t$\xf9\x8b\xd3 \xb2\xf7\xb1 \xc3룺\xe5\xe4\xea\xe5&Ng,Uoa\xd1\xf0\x0e\x00\x00\xff\xff\u007f\xf5p\x8b\x85\x00\x00\x00",
- },
-
- "/data/ru/countries": {
- local: "data/ru/countries",
- size: 3010,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xfflVYv\x1b\xb7\x12\xfd\xe7^\xb8G\x0e\x96\x9fΑ_d\r9\xb6I1\"%%֏\xe2f\x930\xc1\xa1\x9b[@o!+ɽ\xb7\nݭ\xe3|\x01u\x01\xd4< }Ne3n&\xcd(\x15\xe9\x98bs=\xe8AN\xeeR\x00\xb1ƍ}ڦ\x9fX+\xc2GAU\xbeu\xc4IlF\xdcVi\x93j\x00\x85\x11\xdbT7#J\x10\xd9LRL\x9bf*\x12\xe8&\x05\a\xab\f\x9d\b9\xdf\xe6\x03n\x98\x18(e\xb2o\xb0\x10<5WFP \xc4ARh.\x05\xb9\xc2\x14=6\xe0\x02P\x80\x05z\x1fp\x9dJM\xc1tl\x92\f\x8ci\xe7\xdb\xe6\x13\x98\xb6'\x15\xf5\xe3\x96vm\xc4\xdf\xcfj\xbd*[\x12\xfc\xaa\x8e\x98\x80,\xa5!l\xbb\x91\x9bw\xb8\uebbe\xa1\n8\x83^$\xa68?\x98#\x86\xe9\x05BƩv\\\u05f6)\x1a\xe9~\xb8\xe5BOB̔\xa4Yp\x80Nk)8\xe9\x02t+#6Yo#\x03̟6\xff\xb7P\xddRw<\xa9\x9b\xff\x81\xeb\x15U\xba\x85\x13\x02\xa0\x8a\xce\x1e\xa4;,k0\xaflK\xfeѶ\xfbl\"\x89\x13.I\xc8]\x87\x96T\x122O\xca3\x87\xa2T\xb8~G\f\xe16\x84\x1aקăҡ\xb5\xe2\x8e\xd2\xd3V\x9e*\x18\xd9;E\xb5R\xa8\v'\x9b\x8f~Yn\xdb\x19q\xdf1\xb9g\xa6\xc2CS\xd3\xff\x1e<O\x12O\xd7\x15\xbf\x00pƘ+\x9f\xfeΜHg:e\x90\xbe\xf4m\xfd\x02\xfc\xa4\x9c[Ø0H_\xd3N\xe1\x8eL%\x92\x8a\x1f\xafڶV\xdcw\x19B6҄\xac\xe3W\xbd=\xe4Me\x9b\xa3.d6P\xeb\x17\xe0\xdcg1\xe9\x8a\xfa\x9b|\x1f\xc8hfQ\x1c2\a$4\x18\xb6S\x91\xb4E6s\xebj\xab\xf9\f\x04\xcbE#[\xbf\xcf\x14ނ\xe5?\xeb\x8awF_\x19\x16U\xe91\xdbk@\xa4\xbf,\b\xb3\xb4HK.('\xf0o\xdd:S,X\xaa(\xf5%\x13\x16\x1c\xa78=vѢeu:(%\xc0\f\xe9\x1b\xba\x88\x91\xf1=Y\xff\xe7\xe3\x99\xe7<\xeam\xd9\xc7&ô\xfdg\xf4\rq)U_\xb4A/\v۔,Y\xe6\xc0\x1c\x1eP\x8b\x99K\xb8\xb7\x81\xb9d\xd5,&\x12\xb43\xe4ʛ\xab[\xc8\xc5\xf3\xaeq\xccUM%\xf9s{\xa1b\xa9\x9aK\xadjZ\xf3\xe67\xd88\x96\xb5k\x15\xc0f\x90\x1e\xc0\xa8\x94'\xd97\xf6=\xa0_\xfb\x0f\x16&\xf5-s\xcc\xc8\xc0\x03\xb8Y&\xb6\xf7\x98Q%#\x92\x89}\x8e\x99\x01\xf9\x04\x9daK\xf5\x19\x17\a(R\x04\xe4#\x1e\xecCN6\x97z\x8b\x9e\x9b\x1f\x04\xd9\xe2\x1e\u007f\x00\xbe\xcb\xc5Ĥ\u007fPWݚ*&\xbbV\xb29˺\x1d1v\n\xd9׀Nd\xb6\x10\xa3\x98\x13h\xc1N\u009c\xe56\xa8>\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\b<y\xf6#@O./J\x05\xbeRkbL\xa7F\xe8ۤ\xad\xbe\x16\xbd\x8f\x95\xa0<)\x9f\xfd\x8f\xa5\x1cy\x86\xd85\v\xb4\xaf\u07b3\xf5\xd7\xfcK{\xd6\x14hs\xf3E}$\xe4\x0e\f\x98\x1f\x88\xc0\x83h\xc6\xda\xf6\xa8\xe1yVp\xaf\f\xaa\xa0\xecu7\xc3^l\xdce\xc5\xfe\xf4Ҳ\xc6\x0e\xe0/\x8b\xbb\xfdW\xe1aF\xa5h>x\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<Jn\xaa\x88\xf8i\x12=$\x01^\xee\f3V\xe8q+U\n\xc4f\x9ar\x8b\xce\x009\x00<6R\xb8\xb91\xc6-\x11\xa6\x14R\xd7ΡVY\xd5*+\xdf\x1a\xba^&kiǤ-i\xa6%be\\\xbfA\xdd\xecĹ\xa8j,1\xcd\x01\xefOc\x8d\xfe\xa3\x9bd\xcdf_~\xfd\xbda\xc0\xe7X\xc9o)E\x9e\xfe\xaa>+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<d\xee/\xf7 \x83\xf2g\xf7āG\x9fI\xd2B\x04\xec7^\x90m\\\xbf\x11a{f\xd6\x06\xe3\n\xc2\xe3%\x05rx$\xb0\xad\u007f\xc3t\xfe\xbf2X\xbe/]\xf9\x15\xff\xff\"Έ+'\xbe\x05\xaa\x94\xd6\xca3\xf5\x99\\\xc8ib\xfe\xfa\x14$\xee\x91+\x134\xadd\x8b\x84 \x90\xb3q\xf3\xbb\xbc\xd1\xff\r\x00\x00\xff\xff\xee\xbd\u0600\x1c\x12\x00\x00",
- },
-
- "/data/ru/female_first_names": {
- local: "data/ru/female_first_names",
- size: 506,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xffD\x90]N\xc3@\f\x84\xdf9u\x93\xe7\nP!\x02\xb5\x94\xbf\x03\xa0%?\xb0JZ\xb8\xc2\xf8F\x9d\xb1w\x1bU\xaa\xec\xf1\xf8\xf3dq\x8f\xc16\xc8\xf8\xe7/\xe3\x8ctCi\xc1\x84\xd9\x1a$\n#\xc7.rf\x8d\xb5\xfaG\xb6\xbb\x90\xca\u0099\xfa\x1f\x9bB\xd8qS\f\xc9Wi\nЎ\xca,\xbb\xce\n\xf3\xe0\xe6b{$~c[\xe9\x1dz\x8c\xa4\xcea\xebX$\xeeM\x1e\xd7\xcd]\x1c\xa9e\xc6/Q=\x1d\xad\xa4'\x9e\xe0\xde\xf3\xea\xdfӔ\x9c\xeaĽ'h\u058c\a\x1d\x97\x14M\xaeƃ\xdd\xe2\x9bIz\xdbF3\xe2\xc4\xe9\"\xdbK\xec\x04\xa04\xda9\xf2\xd2\xc8t?\xfcO\xde*\x15\x96\xf8\xb6c\xddx\xbd\xbe\xb37\x1ccP\xf9\xe6$=\xf5LH\x1f\xd2\xe4\xf9\x878\xf0βD\xfd(\x1f\xbdT\xd0'\x8bS\x10\xbc\xb1Vgc\xf6\xa5\x97\"\xe0\x12\x00\x00\xff\xff\xaf\x88\x9c\xa1\xfa\x01\x00\x00",
- },
-
- "/data/ru/female_last_names": {
- local: "data/ru/female_last_names",
- size: 1726,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xfflT[n\xdb@\f\xfc\xef\xa9\x1d%\r\n$@\xfcJc\xb8n\\\xa7\x06\x9a~U\x92%X\xd1\xf3\n\xdc\x1bu\xc8}\x90v\xfbax\xc5%\xb9Ù٥\r\x95\x94\xd3@#\xff\u007f\xa2%\xe5\xee\x86\x1a\xea\xdc#\xd5>\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^<is\xd5%\x04\xbcg\xdfI48\xa15F\xc4;\xefC\x17/I\xe4t\x80\xba\xe7[\v<d\xcf,\t\xf1@\xfe\x12\x1c\x15\x02[\x98\xad\xca\xc3j\x8a6g\xdaWD4\xc9u,\xb6s#\xfd\xa2\x1c;2\xd7\xf9ES\xa2\x1a7JI#\xa4+\xfeA\xc5\x0f\xa1\xc0\x04Zꚪ\x9f\xda\x13\xc8R\xf6\x84j\\ݧ\xd3\xdf7~Gg\xdb \f\xee=\xb3v\"Vd\xf4\xac@\x8d\xb5\"\n\x03H\x95?%\x83\xfcr,\xe0\xeb\xf6\x86!\xf3\x8c\xb7]G\x15\x00\xdd#&\xa0\xbdq+\xec\b9\x8e4#\x1dC\xbe\x1c\x91\x9d\xd6\xcb\x19\x83\xba\xd5Xm\x10\xae\xe2~FK\x03\xc1\xa3\x8f\xbe\xa4\xca6\b7>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<u\x02\xfa\xf5W\x02\t\xf5\xa2V\n\xa5)\x9b\xb6+\x14.\x03\t)\xe1\x15\x8eߨ\xc7\xceL=\xea\"A\xb6\x0f\xf6\xe7\xe3\xe0\x03\x01W\x99J\x81\x06\xbd,pE#\xcb\t^1\xa0\xe7sd\xf9\x94\x92_\xb8h\xdaU\x1b\x86{\x04\xfe\xbdd\xc9R+\x86e\xaa\xaf\xad\x1e\xa5\r\x9b\xfd\x86k\x86;J\x8b\xbc\xff\v\u007f\x98\x90\xffN\xd1*\x98ue\xaeռ\xca\x02\xd9B\x12Ն\x1aR\xe7\x95\xccp\xf0Ao\xb8\x10o\x89\x9d\x14\xb2p̊\x8ao\x86|\x8f+y\xe9\x91h\a#\x89\xf3j\xe3ܛ\xb6A\xe7ʍM\xd5b\xf2C\xa6L\xddr{z\x06\xd9F\x95mdt\x13l}\xf5\x9a\xc3\x06\x93\x16\xde\xff>\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<hs[\xdd\xe9\xba\xe0v\x05\x00\x00\xff\xff\xcbVS\xadu\x00\x00\x00",
- },
-
- "/data/ru/weekdays_short": {
- local: "data/ru/weekdays_short",
- size: 35,
- compressed: "\x1f\x8b\b\x00\x00\tn\x88\x00\xff\xba0\xff\xc2^\xae\v\x93.6q]Xx\xb1\x81\xeb\xc2r\x10k>\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 a5e1d945..00000000
--- 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 df3cb77c..00000000
--- 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 8b1ec7cb..00000000
--- 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 12625b93..00000000
--- 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 515144a3..00000000
--- 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 93f9bfae..00000000
--- 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 8fd1c273..00000000
--- 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 6895c7c9..00000000
--- 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 8386d5a5..00000000
--- 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 fde3eaf2..00000000
--- 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 57aa2521..00000000
--- 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 9c45fb3a..00000000
--- 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 5f0d1fb6..00000000
--- 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 7a950d17..00000000
--- 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 9d2d8a4b..00000000
--- 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 336142a5..00000000
--- 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 9a28e57c..00000000
--- 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 98db8f06..00000000
--- 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 91b5cef3..00000000
--- 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 56729a92..00000000
--- a/vendor/github.com/mattn/go-colorable/README.md
+++ /dev/null
@@ -1,48 +0,0 @@
-# go-colorable
-
-[![Godoc Reference](https://godoc.org/github.com/mattn/go-colorable?status.svg)](http://godoc.org/github.com/mattn/go-colorable)
-[![Build Status](https://travis-ci.org/mattn/go-colorable.svg?branch=master)](https://travis-ci.org/mattn/go-colorable)
-[![Coverage Status](https://coveralls.io/repos/github/mattn/go-colorable/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-colorable?branch=master)
-[![Go Report Card](https://goreportcard.com/badge/mattn/go-colorable)](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!
-
-![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png)
-
-
-## So Good!
-
-![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png)
-
-## 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 1f28d773..00000000
--- 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 887f203d..00000000
--- 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 e17a5474..00000000
--- 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 9721e16f..00000000
--- 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 b9f8b239..00000000
--- 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 65dc692b..00000000
--- a/vendor/github.com/mattn/go-isatty/LICENSE
+++ /dev/null
@@ -1,9 +0,0 @@
-Copyright (c) Yasuhiro MATSUMOTO <mattn.jp@gmail.com>
-
-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 1e69004b..00000000
--- a/vendor/github.com/mattn/go-isatty/README.md
+++ /dev/null
@@ -1,50 +0,0 @@
-# go-isatty
-
-[![Godoc Reference](https://godoc.org/github.com/mattn/go-isatty?status.svg)](http://godoc.org/github.com/mattn/go-isatty)
-[![Build Status](https://travis-ci.org/mattn/go-isatty.svg?branch=master)](https://travis-ci.org/mattn/go-isatty)
-[![Coverage Status](https://coveralls.io/repos/github/mattn/go-isatty/badge.svg?branch=master)](https://coveralls.io/github/mattn/go-isatty?branch=master)
-[![Go Report Card](https://goreportcard.com/badge/mattn/go-isatty)](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 17d4f90e..00000000
--- 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 9584a988..00000000
--- 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 42f2514d..00000000
--- 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 7384cf99..00000000
--- 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 44e5d213..00000000
--- 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 ff4de3d9..00000000
--- 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 1f0c6bf5..00000000
--- 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 af51cbca..00000000
--- 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 5c9c2a30..00000000
--- 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 91b5cef3..00000000
--- 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 66663a94..00000000
--- a/vendor/github.com/mattn/go-runewidth/README.mkd
+++ /dev/null
@@ -1,27 +0,0 @@
-go-runewidth
-============
-
-[![Build Status](https://travis-ci.org/mattn/go-runewidth.png?branch=master)](https://travis-ci.org/mattn/go-runewidth)
-[![Coverage Status](https://coveralls.io/repos/mattn/go-runewidth/badge.png?branch=HEAD)](https://coveralls.io/r/mattn/go-runewidth?branch=HEAD)
-[![GoDoc](https://godoc.org/github.com/mattn/go-runewidth?status.svg)](http://godoc.org/github.com/mattn/go-runewidth)
-[![Go Report Card](https://goreportcard.com/badge/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 2164497a..00000000
--- 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 0ce32c5e..00000000
--- 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 c579e9a3..00000000
--- 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 0258876b..00000000
--- 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 d9deadb8..00000000
--- 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 f9c841a5..00000000
--- 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 0018dc7d..00000000
--- a/vendor/github.com/mitchellh/mapstructure/README.md
+++ /dev/null
@@ -1,46 +0,0 @@
-# mapstructure [![Godoc](https://godoc.org/github.com/mitchellh/mapstructure?status.svg)](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 2a727575..00000000
--- 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 47a99e5a..00000000
--- 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 d2a71256..00000000
--- 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 d3222b8f..00000000
--- 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 1521c8b7..00000000
--- 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 ab1043df..00000000
--- 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 <patrick.d.hayes@gmail.com>
-
- # 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: |
- # <?xml version="1.0" encoding="UTF-8"?>
- # ...
-
- # 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 d9882e59..00000000
--- 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 4f9245d9..00000000
--- 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 c44b60df..00000000
--- 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 daf913b1..00000000
--- 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 588ceca1..00000000
--- 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 835ba3e7..00000000
--- a/vendor/github.com/pkg/errors/LICENSE
+++ /dev/null
@@ -1,23 +0,0 @@
-Copyright (c) 2015, Dave Cheney <dave@cheney.net>
-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 273db3c9..00000000
--- a/vendor/github.com/pkg/errors/README.md
+++ /dev/null
@@ -1,52 +0,0 @@
-# errors [![Travis-CI](https://travis-ci.org/pkg/errors.svg)](https://travis-ci.org/pkg/errors) [![AppVeyor](https://ci.appveyor.com/api/projects/status/b98mptawhudj53ep/branch/master?svg=true)](https://ci.appveyor.com/project/davecheney/errors/branch/master) [![GoDoc](https://godoc.org/github.com/pkg/errors?status.svg)](http://godoc.org/github.com/pkg/errors) [![Report card](https://goreportcard.com/badge/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 a932eade..00000000
--- 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 842ee804..00000000
--- 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 6b1f2891..00000000
--- 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 c67dad61..00000000
--- 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 003e99fa..00000000
--- 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 "<P>" lines in HTML files). That may be
-// because this is the only method of the 3 that has a *concept* of
-// "junk" <wink>.
-//
-// 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 75623dcc..00000000
--- 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 a1687f17..00000000
--- 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 2885af36..00000000
--- 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 a6c94b79..00000000
--- 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:
-
-* <http://github.com/russross/blackfriday-tool>
-
-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 `&ndash;`, and `---` is translated into
- `&mdash;`. 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 `<sup>4</sup>&frasl;<sub>5</sub>`, which renders as
- <sup>4</sup>&frasl;<sub>5</sub>.
-
-
-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 7fc731d5..00000000
--- 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 <russ@russross.com>.
-// 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:
- //
- // <div>
- // ...
- // </div>
- 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 <hr> 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 = "<![cdata["
- const cdataTagLen = len(cdataTag)
- if len(data) < cdataTagLen+1 {
- return 0
- }
- if !bytes.Equal(bytes.ToLower(data[:cdataTagLen]), []byte(cdataTag)) {
- return 0
- }
- i := cdataTagLen
- // scan for an end-of-comment marker, across lines if necessary
- for i < len(data) && !(data[i-2] == ']' && data[i-1] == ']' && data[i] == '>') {
- 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 <hr> 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 9656c42a..00000000
--- 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 c917c7d3..00000000
--- 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 <russ@russross.com>.
-// 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 <style> elements
- HTML_SKIP_IMAGES // skip embedded images
- HTML_SKIP_LINKS // skip all links
- HTML_SAFELINK // only link to trusted protocols
- HTML_NOFOLLOW_LINKS // only link with rel="nofollow"
- HTML_NOREFERRER_LINKS // only link with rel="noreferrer"
- HTML_HREF_TARGET_BLANK // add a blank target
- HTML_TOC // generate a table of contents
- HTML_OMIT_CONTENTS // skip the main contents (for a standalone table of contents)
- HTML_COMPLETE_PAGE // generate a complete HTML page
- HTML_USE_XHTML // generate XHTML output instead of HTML
- HTML_USE_SMARTYPANTS // enable smart punctuation substitutions
- HTML_SMARTYPANTS_FRACTIONS // enable smart fractions (with HTML_USE_SMARTYPANTS)
- HTML_SMARTYPANTS_DASHES // enable smart dashes (with HTML_USE_SMARTYPANTS)
- HTML_SMARTYPANTS_LATEX_DASHES // enable LaTeX-style dashes (with HTML_USE_SMARTYPANTS and HTML_SMARTYPANTS_DASHES)
- HTML_SMARTYPANTS_ANGLED_QUOTES // enable angled double quotes (with HTML_USE_SMARTYPANTS) for double quotes rendering
- HTML_SMARTYPANTS_QUOTES_NBSP // enable "French guillemets" (with HTML_USE_SMARTYPANTS)
- HTML_FOOTNOTE_RETURN_LINKS // generate a link at the end of a footnote to return to the source
-)
-
-var (
- alignments = []string{
- "left",
- "right",
- "center",
- }
-
- // TODO: improve this regexp to catch all possible entities:
- htmlEntity = regexp.MustCompile(`&[a-z]{2,5};`)
-)
-
-type HtmlRendererParameters struct {
- // Prepend this text to each relative URL.
- AbsolutePrefix string
- // Add this text to each footnote anchor, to ensure uniqueness.
- FootnoteAnchorPrefix string
- // Show this text inside the <a> tag for a footnote return link, if the
- // HTML_FOOTNOTE_RETURN_LINKS flag is enabled. If blank, the string
- // <sup>[return]</sup> is used.
- FootnoteReturnLinkContents string
- // If set, add this text to the front of each Header ID, to ensure
- // uniqueness.
- HeaderIDPrefix string
- // If set, add this text to the back of each Header ID, to ensure uniqueness.
- HeaderIDSuffix string
-}
-
-// Html is a type that implements the Renderer interface for HTML output.
-//
-// Do not create this directly, instead use the HtmlRenderer function.
-type Html struct {
- flags int // HTML_* options
- closeTag string // how to end singleton tags: either " />" or ">"
- title string // document title
- css string // optional css file url (used with HTML_COMPLETE_PAGE)
-
- parameters HtmlRendererParameters
-
- // table of contents data
- tocMarker int
- headerCount int
- currentLevel int
- toc *bytes.Buffer
-
- // Track header IDs to prevent ID collision in a single generation.
- headerIDs map[string]int
-
- smartypants *smartypantsRenderer
-}
-
-const (
- xhtmlClose = " />"
- htmlClose = ">"
-)
-
-// HtmlRenderer creates and configures an Html object, which
-// satisfies the Renderer interface.
-//
-// flags is a set of HTML_* options ORed together.
-// title is the title of the document, and css is a URL for the document's
-// stylesheet.
-// title and css are only used when HTML_COMPLETE_PAGE is selected.
-func HtmlRenderer(flags int, title string, css string) Renderer {
- return HtmlRendererWithParameters(flags, title, css, HtmlRendererParameters{})
-}
-
-func HtmlRendererWithParameters(flags int, title string,
- css string, renderParameters HtmlRendererParameters) Renderer {
- // configure the rendering engine
- closeTag := htmlClose
- if flags&HTML_USE_XHTML != 0 {
- closeTag = xhtmlClose
- }
-
- if renderParameters.FootnoteReturnLinkContents == "" {
- renderParameters.FootnoteReturnLinkContents = `<sup>[return]</sup>`
- }
-
- return &Html{
- flags: flags,
- closeTag: closeTag,
- title: title,
- css: css,
- parameters: renderParameters,
-
- headerCount: 0,
- currentLevel: 0,
- toc: new(bytes.Buffer),
-
- headerIDs: make(map[string]int),
-
- smartypants: smartypants(flags),
- }
-}
-
-// Using if statements is a bit faster than a switch statement. As the compiler
-// improves, this should be unnecessary this is only worthwhile because
-// attrEscape is the single largest CPU user in normal use.
-// Also tried using map, but that gave a ~3x slowdown.
-func escapeSingleChar(char byte) (string, bool) {
- if char == '"' {
- return "&quot;", true
- }
- if char == '&' {
- return "&amp;", true
- }
- if char == '<' {
- return "&lt;", true
- }
- if char == '>' {
- return "&gt;", true
- }
- return "", false
-}
-
-func attrEscape(out *bytes.Buffer, src []byte) {
- org := 0
- for i, ch := range src {
- if entity, ok := escapeSingleChar(ch); ok {
- if i > org {
- // copy all the normal characters since the last escape
- out.Write(src[org:i])
- }
- org = i + 1
- out.WriteString(entity)
- }
- }
- if org < len(src) {
- out.Write(src[org:])
- }
-}
-
-func entityEscapeWithSkip(out *bytes.Buffer, src []byte, skipRanges [][]int) {
- end := 0
- for _, rang := range skipRanges {
- attrEscape(out, src[end:rang[0]])
- out.Write(src[rang[0]:rang[1]])
- end = rang[1]
- }
- attrEscape(out, src[end:])
-}
-
-func (options *Html) GetFlags() int {
- return options.flags
-}
-
-func (options *Html) TitleBlock(out *bytes.Buffer, text []byte) {
- text = bytes.TrimPrefix(text, []byte("% "))
- text = bytes.Replace(text, []byte("\n% "), []byte("\n"), -1)
- out.WriteString("<h1 class=\"title\">")
- out.Write(text)
- out.WriteString("\n</h1>")
-}
-
-func (options *Html) Header(out *bytes.Buffer, text func() bool, level int, id string) {
- marker := out.Len()
- doubleSpace(out)
-
- if id == "" && options.flags&HTML_TOC != 0 {
- id = fmt.Sprintf("toc_%d", options.headerCount)
- }
-
- if id != "" {
- id = options.ensureUniqueHeaderID(id)
-
- if options.parameters.HeaderIDPrefix != "" {
- id = options.parameters.HeaderIDPrefix + id
- }
-
- if options.parameters.HeaderIDSuffix != "" {
- id = id + options.parameters.HeaderIDSuffix
- }
-
- out.WriteString(fmt.Sprintf("<h%d id=\"%s\">", level, id))
- } else {
- out.WriteString(fmt.Sprintf("<h%d>", level))
- }
-
- tocMarker := out.Len()
- if !text() {
- out.Truncate(marker)
- return
- }
-
- // are we building a table of contents?
- if options.flags&HTML_TOC != 0 {
- options.TocHeaderWithAnchor(out.Bytes()[tocMarker:], level, id)
- }
-
- out.WriteString(fmt.Sprintf("</h%d>\n", level))
-}
-
-func (options *Html) BlockHtml(out *bytes.Buffer, text []byte) {
- if options.flags&HTML_SKIP_HTML != 0 {
- return
- }
-
- doubleSpace(out)
- out.Write(text)
- out.WriteByte('\n')
-}
-
-func (options *Html) HRule(out *bytes.Buffer) {
- doubleSpace(out)
- out.WriteString("<hr")
- out.WriteString(options.closeTag)
- out.WriteByte('\n')
-}
-
-func (options *Html) BlockCode(out *bytes.Buffer, text []byte, lang string) {
- doubleSpace(out)
-
- // parse out the language names/classes
- count := 0
- for _, elt := range strings.Fields(lang) {
- if elt[0] == '.' {
- elt = elt[1:]
- }
- if len(elt) == 0 {
- continue
- }
- if count == 0 {
- out.WriteString("<pre><code class=\"language-")
- } else {
- out.WriteByte(' ')
- }
- attrEscape(out, []byte(elt))
- count++
- }
-
- if count == 0 {
- out.WriteString("<pre><code>")
- } else {
- out.WriteString("\">")
- }
-
- attrEscape(out, text)
- out.WriteString("</code></pre>\n")
-}
-
-func (options *Html) BlockQuote(out *bytes.Buffer, text []byte) {
- doubleSpace(out)
- out.WriteString("<blockquote>\n")
- out.Write(text)
- out.WriteString("</blockquote>\n")
-}
-
-func (options *Html) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) {
- doubleSpace(out)
- out.WriteString("<table>\n<thead>\n")
- out.Write(header)
- out.WriteString("</thead>\n\n<tbody>\n")
- out.Write(body)
- out.WriteString("</tbody>\n</table>\n")
-}
-
-func (options *Html) TableRow(out *bytes.Buffer, text []byte) {
- doubleSpace(out)
- out.WriteString("<tr>\n")
- out.Write(text)
- out.WriteString("\n</tr>\n")
-}
-
-func (options *Html) TableHeaderCell(out *bytes.Buffer, text []byte, align int) {
- doubleSpace(out)
- switch align {
- case TABLE_ALIGNMENT_LEFT:
- out.WriteString("<th align=\"left\">")
- case TABLE_ALIGNMENT_RIGHT:
- out.WriteString("<th align=\"right\">")
- case TABLE_ALIGNMENT_CENTER:
- out.WriteString("<th align=\"center\">")
- default:
- out.WriteString("<th>")
- }
-
- out.Write(text)
- out.WriteString("</th>")
-}
-
-func (options *Html) TableCell(out *bytes.Buffer, text []byte, align int) {
- doubleSpace(out)
- switch align {
- case TABLE_ALIGNMENT_LEFT:
- out.WriteString("<td align=\"left\">")
- case TABLE_ALIGNMENT_RIGHT:
- out.WriteString("<td align=\"right\">")
- case TABLE_ALIGNMENT_CENTER:
- out.WriteString("<td align=\"center\">")
- default:
- out.WriteString("<td>")
- }
-
- out.Write(text)
- out.WriteString("</td>")
-}
-
-func (options *Html) Footnotes(out *bytes.Buffer, text func() bool) {
- out.WriteString("<div class=\"footnotes\">\n")
- options.HRule(out)
- options.List(out, text, LIST_TYPE_ORDERED)
- out.WriteString("</div>\n")
-}
-
-func (options *Html) FootnoteItem(out *bytes.Buffer, name, text []byte, flags int) {
- if flags&LIST_ITEM_CONTAINS_BLOCK != 0 || flags&LIST_ITEM_BEGINNING_OF_LIST != 0 {
- doubleSpace(out)
- }
- slug := slugify(name)
- out.WriteString(`<li id="`)
- out.WriteString(`fn:`)
- out.WriteString(options.parameters.FootnoteAnchorPrefix)
- out.Write(slug)
- out.WriteString(`">`)
- out.Write(text)
- if options.flags&HTML_FOOTNOTE_RETURN_LINKS != 0 {
- out.WriteString(` <a class="footnote-return" href="#`)
- out.WriteString(`fnref:`)
- out.WriteString(options.parameters.FootnoteAnchorPrefix)
- out.Write(slug)
- out.WriteString(`">`)
- out.WriteString(options.parameters.FootnoteReturnLinkContents)
- out.WriteString(`</a>`)
- }
- out.WriteString("</li>\n")
-}
-
-func (options *Html) List(out *bytes.Buffer, text func() bool, flags int) {
- marker := out.Len()
- doubleSpace(out)
-
- if flags&LIST_TYPE_DEFINITION != 0 {
- out.WriteString("<dl>")
- } else if flags&LIST_TYPE_ORDERED != 0 {
- out.WriteString("<ol>")
- } else {
- out.WriteString("<ul>")
- }
- if !text() {
- out.Truncate(marker)
- return
- }
- if flags&LIST_TYPE_DEFINITION != 0 {
- out.WriteString("</dl>\n")
- } else if flags&LIST_TYPE_ORDERED != 0 {
- out.WriteString("</ol>\n")
- } else {
- out.WriteString("</ul>\n")
- }
-}
-
-func (options *Html) ListItem(out *bytes.Buffer, text []byte, flags int) {
- if (flags&LIST_ITEM_CONTAINS_BLOCK != 0 && flags&LIST_TYPE_DEFINITION == 0) ||
- flags&LIST_ITEM_BEGINNING_OF_LIST != 0 {
- doubleSpace(out)
- }
- if flags&LIST_TYPE_TERM != 0 {
- out.WriteString("<dt>")
- } else if flags&LIST_TYPE_DEFINITION != 0 {
- out.WriteString("<dd>")
- } else {
- out.WriteString("<li>")
- }
- out.Write(text)
- if flags&LIST_TYPE_TERM != 0 {
- out.WriteString("</dt>\n")
- } else if flags&LIST_TYPE_DEFINITION != 0 {
- out.WriteString("</dd>\n")
- } else {
- out.WriteString("</li>\n")
- }
-}
-
-func (options *Html) Paragraph(out *bytes.Buffer, text func() bool) {
- marker := out.Len()
- doubleSpace(out)
-
- out.WriteString("<p>")
- if !text() {
- out.Truncate(marker)
- return
- }
- out.WriteString("</p>\n")
-}
-
-func (options *Html) AutoLink(out *bytes.Buffer, link []byte, kind int) {
- skipRanges := htmlEntity.FindAllIndex(link, -1)
- if options.flags&HTML_SAFELINK != 0 && !isSafeLink(link) && kind != LINK_TYPE_EMAIL {
- // mark it but don't link it if it is not a safe link: no smartypants
- out.WriteString("<tt>")
- entityEscapeWithSkip(out, link, skipRanges)
- out.WriteString("</tt>")
- return
- }
-
- out.WriteString("<a href=\"")
- if kind == LINK_TYPE_EMAIL {
- out.WriteString("mailto:")
- } else {
- options.maybeWriteAbsolutePrefix(out, link)
- }
-
- entityEscapeWithSkip(out, link, skipRanges)
-
- var relAttrs []string
- if options.flags&HTML_NOFOLLOW_LINKS != 0 && !isRelativeLink(link) {
- relAttrs = append(relAttrs, "nofollow")
- }
- if options.flags&HTML_NOREFERRER_LINKS != 0 && !isRelativeLink(link) {
- relAttrs = append(relAttrs, "noreferrer")
- }
- if len(relAttrs) > 0 {
- out.WriteString(fmt.Sprintf("\" rel=\"%s", strings.Join(relAttrs, " ")))
- }
-
- // blank target only add to external link
- if options.flags&HTML_HREF_TARGET_BLANK != 0 && !isRelativeLink(link) {
- out.WriteString("\" target=\"_blank")
- }
-
- out.WriteString("\">")
-
- // Pretty print: if we get an email address as
- // an actual URI, e.g. `mailto:foo@bar.com`, we don't
- // want to print the `mailto:` prefix
- switch {
- case bytes.HasPrefix(link, []byte("mailto://")):
- attrEscape(out, link[len("mailto://"):])
- case bytes.HasPrefix(link, []byte("mailto:")):
- attrEscape(out, link[len("mailto:"):])
- default:
- entityEscapeWithSkip(out, link, skipRanges)
- }
-
- out.WriteString("</a>")
-}
-
-func (options *Html) CodeSpan(out *bytes.Buffer, text []byte) {
- out.WriteString("<code>")
- attrEscape(out, text)
- out.WriteString("</code>")
-}
-
-func (options *Html) DoubleEmphasis(out *bytes.Buffer, text []byte) {
- out.WriteString("<strong>")
- out.Write(text)
- out.WriteString("</strong>")
-}
-
-func (options *Html) Emphasis(out *bytes.Buffer, text []byte) {
- if len(text) == 0 {
- return
- }
- out.WriteString("<em>")
- out.Write(text)
- out.WriteString("</em>")
-}
-
-func (options *Html) maybeWriteAbsolutePrefix(out *bytes.Buffer, link []byte) {
- if options.parameters.AbsolutePrefix != "" && isRelativeLink(link) && link[0] != '.' {
- out.WriteString(options.parameters.AbsolutePrefix)
- if link[0] != '/' {
- out.WriteByte('/')
- }
- }
-}
-
-func (options *Html) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
- if options.flags&HTML_SKIP_IMAGES != 0 {
- return
- }
-
- out.WriteString("<img src=\"")
- options.maybeWriteAbsolutePrefix(out, link)
- attrEscape(out, link)
- out.WriteString("\" alt=\"")
- if len(alt) > 0 {
- attrEscape(out, alt)
- }
- if len(title) > 0 {
- out.WriteString("\" title=\"")
- attrEscape(out, title)
- }
-
- out.WriteByte('"')
- out.WriteString(options.closeTag)
-}
-
-func (options *Html) LineBreak(out *bytes.Buffer) {
- out.WriteString("<br")
- out.WriteString(options.closeTag)
- out.WriteByte('\n')
-}
-
-func (options *Html) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
- if options.flags&HTML_SKIP_LINKS != 0 {
- // write the link text out but don't link it, just mark it with typewriter font
- out.WriteString("<tt>")
- attrEscape(out, content)
- out.WriteString("</tt>")
- return
- }
-
- if options.flags&HTML_SAFELINK != 0 && !isSafeLink(link) {
- // write the link text out but don't link it, just mark it with typewriter font
- out.WriteString("<tt>")
- attrEscape(out, content)
- out.WriteString("</tt>")
- return
- }
-
- out.WriteString("<a href=\"")
- options.maybeWriteAbsolutePrefix(out, link)
- attrEscape(out, link)
- if len(title) > 0 {
- out.WriteString("\" title=\"")
- attrEscape(out, title)
- }
- var relAttrs []string
- if options.flags&HTML_NOFOLLOW_LINKS != 0 && !isRelativeLink(link) {
- relAttrs = append(relAttrs, "nofollow")
- }
- if options.flags&HTML_NOREFERRER_LINKS != 0 && !isRelativeLink(link) {
- relAttrs = append(relAttrs, "noreferrer")
- }
- if len(relAttrs) > 0 {
- out.WriteString(fmt.Sprintf("\" rel=\"%s", strings.Join(relAttrs, " ")))
- }
-
- // blank target only add to external link
- if options.flags&HTML_HREF_TARGET_BLANK != 0 && !isRelativeLink(link) {
- out.WriteString("\" target=\"_blank")
- }
-
- out.WriteString("\">")
- out.Write(content)
- out.WriteString("</a>")
- return
-}
-
-func (options *Html) RawHtmlTag(out *bytes.Buffer, text []byte) {
- if options.flags&HTML_SKIP_HTML != 0 {
- return
- }
- if options.flags&HTML_SKIP_STYLE != 0 && isHtmlTag(text, "style") {
- return
- }
- if options.flags&HTML_SKIP_LINKS != 0 && isHtmlTag(text, "a") {
- return
- }
- if options.flags&HTML_SKIP_IMAGES != 0 && isHtmlTag(text, "img") {
- return
- }
- out.Write(text)
-}
-
-func (options *Html) TripleEmphasis(out *bytes.Buffer, text []byte) {
- out.WriteString("<strong><em>")
- out.Write(text)
- out.WriteString("</em></strong>")
-}
-
-func (options *Html) StrikeThrough(out *bytes.Buffer, text []byte) {
- out.WriteString("<del>")
- out.Write(text)
- out.WriteString("</del>")
-}
-
-func (options *Html) FootnoteRef(out *bytes.Buffer, ref []byte, id int) {
- slug := slugify(ref)
- out.WriteString(`<sup class="footnote-ref" id="`)
- out.WriteString(`fnref:`)
- out.WriteString(options.parameters.FootnoteAnchorPrefix)
- out.Write(slug)
- out.WriteString(`"><a href="#`)
- out.WriteString(`fn:`)
- out.WriteString(options.parameters.FootnoteAnchorPrefix)
- out.Write(slug)
- out.WriteString(`">`)
- out.WriteString(strconv.Itoa(id))
- out.WriteString(`</a></sup>`)
-}
-
-func (options *Html) Entity(out *bytes.Buffer, entity []byte) {
- out.Write(entity)
-}
-
-func (options *Html) NormalText(out *bytes.Buffer, text []byte) {
- if options.flags&HTML_USE_SMARTYPANTS != 0 {
- options.Smartypants(out, text)
- } else {
- attrEscape(out, text)
- }
-}
-
-func (options *Html) Smartypants(out *bytes.Buffer, text []byte) {
- smrt := smartypantsData{false, false}
-
- // first do normal entity escaping
- var escaped bytes.Buffer
- attrEscape(&escaped, text)
- text = escaped.Bytes()
-
- mark := 0
- for i := 0; i < len(text); i++ {
- if action := options.smartypants[text[i]]; action != nil {
- if i > mark {
- out.Write(text[mark:i])
- }
-
- previousChar := byte(0)
- if i > 0 {
- previousChar = text[i-1]
- }
- i += action(out, &smrt, previousChar, text[i:])
- mark = i + 1
- }
- }
-
- if mark < len(text) {
- out.Write(text[mark:])
- }
-}
-
-func (options *Html) DocumentHeader(out *bytes.Buffer) {
- if options.flags&HTML_COMPLETE_PAGE == 0 {
- return
- }
-
- ending := ""
- if options.flags&HTML_USE_XHTML != 0 {
- out.WriteString("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" ")
- out.WriteString("\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n")
- out.WriteString("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n")
- ending = " /"
- } else {
- out.WriteString("<!DOCTYPE html>\n")
- out.WriteString("<html>\n")
- }
- out.WriteString("<head>\n")
- out.WriteString(" <title>")
- options.NormalText(out, []byte(options.title))
- out.WriteString("</title>\n")
- out.WriteString(" <meta name=\"GENERATOR\" content=\"Blackfriday Markdown Processor v")
- out.WriteString(VERSION)
- out.WriteString("\"")
- out.WriteString(ending)
- out.WriteString(">\n")
- out.WriteString(" <meta charset=\"utf-8\"")
- out.WriteString(ending)
- out.WriteString(">\n")
- if options.css != "" {
- out.WriteString(" <link rel=\"stylesheet\" type=\"text/css\" href=\"")
- attrEscape(out, []byte(options.css))
- out.WriteString("\"")
- out.WriteString(ending)
- out.WriteString(">\n")
- }
- out.WriteString("</head>\n")
- out.WriteString("<body>\n")
-
- options.tocMarker = out.Len()
-}
-
-func (options *Html) DocumentFooter(out *bytes.Buffer) {
- // finalize and insert the table of contents
- if options.flags&HTML_TOC != 0 {
- options.TocFinalize()
-
- // now we have to insert the table of contents into the document
- var temp bytes.Buffer
-
- // start by making a copy of everything after the document header
- temp.Write(out.Bytes()[options.tocMarker:])
-
- // now clear the copied material from the main output buffer
- out.Truncate(options.tocMarker)
-
- // corner case spacing issue
- if options.flags&HTML_COMPLETE_PAGE != 0 {
- out.WriteByte('\n')
- }
-
- // insert the table of contents
- out.WriteString("<nav>\n")
- out.Write(options.toc.Bytes())
- out.WriteString("</nav>\n")
-
- // corner case spacing issue
- if options.flags&HTML_COMPLETE_PAGE == 0 && options.flags&HTML_OMIT_CONTENTS == 0 {
- out.WriteByte('\n')
- }
-
- // write out everything that came after it
- if options.flags&HTML_OMIT_CONTENTS == 0 {
- out.Write(temp.Bytes())
- }
- }
-
- if options.flags&HTML_COMPLETE_PAGE != 0 {
- out.WriteString("\n</body>\n")
- out.WriteString("</html>\n")
- }
-
-}
-
-func (options *Html) TocHeaderWithAnchor(text []byte, level int, anchor string) {
- for level > options.currentLevel {
- switch {
- case bytes.HasSuffix(options.toc.Bytes(), []byte("</li>\n")):
- // this sublist can nest underneath a header
- size := options.toc.Len()
- options.toc.Truncate(size - len("</li>\n"))
-
- case options.currentLevel > 0:
- options.toc.WriteString("<li>")
- }
- if options.toc.Len() > 0 {
- options.toc.WriteByte('\n')
- }
- options.toc.WriteString("<ul>\n")
- options.currentLevel++
- }
-
- for level < options.currentLevel {
- options.toc.WriteString("</ul>")
- if options.currentLevel > 1 {
- options.toc.WriteString("</li>\n")
- }
- options.currentLevel--
- }
-
- options.toc.WriteString("<li><a href=\"#")
- if anchor != "" {
- options.toc.WriteString(anchor)
- } else {
- options.toc.WriteString("toc_")
- options.toc.WriteString(strconv.Itoa(options.headerCount))
- }
- options.toc.WriteString("\">")
- options.headerCount++
-
- options.toc.Write(text)
-
- options.toc.WriteString("</a></li>\n")
-}
-
-func (options *Html) TocHeader(text []byte, level int) {
- options.TocHeaderWithAnchor(text, level, "")
-}
-
-func (options *Html) TocFinalize() {
- for options.currentLevel > 1 {
- options.toc.WriteString("</ul></li>\n")
- options.currentLevel--
- }
-
- if options.currentLevel > 0 {
- options.toc.WriteString("</ul>\n")
- }
-}
-
-func isHtmlTag(tag []byte, tagname string) bool {
- found, _ := findHtmlTagPos(tag, tagname)
- return found
-}
-
-// Look for a character, but ignore it when it's in any kind of quotes, it
-// might be JavaScript
-func skipUntilCharIgnoreQuotes(html []byte, start int, char byte) int {
- inSingleQuote := false
- inDoubleQuote := false
- inGraveQuote := false
- i := start
- for i < len(html) {
- switch {
- case html[i] == char && !inSingleQuote && !inDoubleQuote && !inGraveQuote:
- return i
- case html[i] == '\'':
- inSingleQuote = !inSingleQuote
- case html[i] == '"':
- inDoubleQuote = !inDoubleQuote
- case html[i] == '`':
- inGraveQuote = !inGraveQuote
- }
- i++
- }
- return start
-}
-
-func findHtmlTagPos(tag []byte, tagname string) (bool, int) {
- i := 0
- if i < len(tag) && tag[0] != '<' {
- return false, -1
- }
- i++
- i = skipSpace(tag, i)
-
- if i < len(tag) && tag[i] == '/' {
- i++
- }
-
- i = skipSpace(tag, i)
- j := 0
- for ; i < len(tag); i, j = i+1, j+1 {
- if j >= len(tagname) {
- break
- }
-
- if strings.ToLower(string(tag[i]))[0] != tagname[j] {
- return false, -1
- }
- }
-
- if i == len(tag) {
- return false, -1
- }
-
- rightAngle := skipUntilCharIgnoreQuotes(tag, i, '>')
- if rightAngle > i {
- return true, rightAngle
- }
-
- return false, -1
-}
-
-func skipUntilChar(text []byte, start int, char byte) int {
- i := start
- for i < len(text) && text[i] != char {
- i++
- }
- return i
-}
-
-func skipSpace(tag []byte, i int) int {
- for i < len(tag) && isspace(tag[i]) {
- i++
- }
- return i
-}
-
-func skipChar(data []byte, start int, char byte) int {
- i := start
- for i < len(data) && data[i] == char {
- i++
- }
- return i
-}
-
-func doubleSpace(out *bytes.Buffer) {
- if out.Len() > 0 {
- out.WriteByte('\n')
- }
-}
-
-func isRelativeLink(link []byte) (yes bool) {
- // a tag begin with '#'
- if link[0] == '#' {
- return true
- }
-
- // link begin with '/' but not '//', the second maybe a protocol relative link
- if len(link) >= 2 && link[0] == '/' && link[1] != '/' {
- return true
- }
-
- // only the root '/'
- if len(link) == 1 && link[0] == '/' {
- return true
- }
-
- // current directory : begin with "./"
- if bytes.HasPrefix(link, []byte("./")) {
- return true
- }
-
- // parent directory : begin with "../"
- if bytes.HasPrefix(link, []byte("../")) {
- return true
- }
-
- return false
-}
-
-func (options *Html) ensureUniqueHeaderID(id string) string {
- for count, found := options.headerIDs[id]; found; count, found = options.headerIDs[id] {
- tmp := fmt.Sprintf("%s-%d", id, count+1)
-
- if _, tmpFound := options.headerIDs[tmp]; !tmpFound {
- options.headerIDs[id] = count + 1
- id = tmp
- } else {
- id = id + "-1"
- }
- }
-
- if _, found := options.headerIDs[id]; !found {
- options.headerIDs[id] = 0
- }
-
- return id
-}
diff --git a/vendor/github.com/russross/blackfriday/inline.go b/vendor/github.com/russross/blackfriday/inline.go
deleted file mode 100644
index 4483b8f1..00000000
--- a/vendor/github.com/russross/blackfriday/inline.go
+++ /dev/null
@@ -1,1154 +0,0 @@
-//
-// Blackfriday Markdown Processor
-// Available at http://github.com/russross/blackfriday
-//
-// Copyright © 2011 Russ Ross <russ@russross.com>.
-// Distributed under the Simplified BSD License.
-// See README.md for details.
-//
-
-//
-// Functions to parse inline elements.
-//
-
-package blackfriday
-
-import (
- "bytes"
- "regexp"
- "strconv"
-)
-
-var (
- urlRe = `((https?|ftp):\/\/|\/)[-A-Za-z0-9+&@#\/%?=~_|!:,.;\(\)]+`
- anchorRe = regexp.MustCompile(`^(<a\shref="` + urlRe + `"(\stitle="[^"<>]+")?\s?>` + urlRe + `<\/a>)`)
-)
-
-// Functions to parse text within a block
-// Each function returns the number of chars taken care of
-// data is the complete block being rendered
-// offset is the number of valid chars before the current cursor
-
-func (p *parser) inline(out *bytes.Buffer, data []byte) {
- // this is called recursively: enforce a maximum depth
- if p.nesting >= p.maxNesting {
- return
- }
- p.nesting++
-
- i, end := 0, 0
- for i < len(data) {
- // copy inactive chars into the output
- for end < len(data) && p.inlineCallback[data[end]] == nil {
- end++
- }
-
- p.r.NormalText(out, data[i:end])
-
- if end >= len(data) {
- break
- }
- i = end
-
- // call the trigger
- handler := p.inlineCallback[data[end]]
- if consumed := handler(p, out, data, i); consumed == 0 {
- // no action from the callback; buffer the byte for later
- end = i + 1
- } else {
- // skip past whatever the callback used
- i += consumed
- end = i
- }
- }
-
- p.nesting--
-}
-
-// single and double emphasis parsing
-func emphasis(p *parser, out *bytes.Buffer, data []byte, offset int) int {
- data = data[offset:]
- c := data[0]
- ret := 0
-
- if len(data) > 2 && data[1] != c {
- // whitespace cannot follow an opening emphasis;
- // strikethrough only takes two characters '~~'
- if c == '~' || isspace(data[1]) {
- return 0
- }
- if ret = helperEmphasis(p, out, data[1:], c); ret == 0 {
- return 0
- }
-
- return ret + 1
- }
-
- if len(data) > 3 && data[1] == c && data[2] != c {
- if isspace(data[2]) {
- return 0
- }
- if ret = helperDoubleEmphasis(p, out, data[2:], c); ret == 0 {
- return 0
- }
-
- return ret + 2
- }
-
- if len(data) > 4 && data[1] == c && data[2] == c && data[3] != c {
- if c == '~' || isspace(data[3]) {
- return 0
- }
- if ret = helperTripleEmphasis(p, out, data, 3, c); ret == 0 {
- return 0
- }
-
- return ret + 3
- }
-
- return 0
-}
-
-func codeSpan(p *parser, out *bytes.Buffer, data []byte, offset int) int {
- data = data[offset:]
-
- nb := 0
-
- // count the number of backticks in the delimiter
- for nb < len(data) && data[nb] == '`' {
- nb++
- }
-
- // find the next delimiter
- i, end := 0, 0
- for end = nb; end < len(data) && i < nb; end++ {
- if data[end] == '`' {
- i++
- } else {
- i = 0
- }
- }
-
- // no matching delimiter?
- if i < nb && end >= len(data) {
- return 0
- }
-
- // trim outside whitespace
- fBegin := nb
- for fBegin < end && data[fBegin] == ' ' {
- fBegin++
- }
-
- fEnd := end - nb
- for fEnd > fBegin && data[fEnd-1] == ' ' {
- fEnd--
- }
-
- // render the code span
- if fBegin != fEnd {
- p.r.CodeSpan(out, data[fBegin:fEnd])
- }
-
- return end
-
-}
-
-// newline preceded by two spaces becomes <br>
-// newline without two spaces works when EXTENSION_HARD_LINE_BREAK is enabled
-func lineBreak(p *parser, out *bytes.Buffer, data []byte, offset int) int {
- // remove trailing spaces from out
- outBytes := out.Bytes()
- end := len(outBytes)
- eol := end
- for eol > 0 && outBytes[eol-1] == ' ' {
- eol--
- }
- out.Truncate(eol)
-
- precededByTwoSpaces := offset >= 2 && data[offset-2] == ' ' && data[offset-1] == ' '
- precededByBackslash := offset >= 1 && data[offset-1] == '\\' // see http://spec.commonmark.org/0.18/#example-527
- precededByBackslash = precededByBackslash && p.flags&EXTENSION_BACKSLASH_LINE_BREAK != 0
-
- if p.flags&EXTENSION_JOIN_LINES != 0 {
- return 1
- }
-
- // should there be a hard line break here?
- if p.flags&EXTENSION_HARD_LINE_BREAK == 0 && !precededByTwoSpaces && !precededByBackslash {
- return 0
- }
-
- if precededByBackslash && eol > 0 {
- out.Truncate(eol - 1)
- }
- p.r.LineBreak(out)
- return 1
-}
-
-type linkType int
-
-const (
- linkNormal linkType = iota
- linkImg
- linkDeferredFootnote
- linkInlineFootnote
-)
-
-func isReferenceStyleLink(data []byte, pos int, t linkType) bool {
- if t == linkDeferredFootnote {
- return false
- }
- return pos < len(data)-1 && data[pos] == '[' && data[pos+1] != '^'
-}
-
-// '[': parse a link or an image or a footnote
-func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
- // no links allowed inside regular links, footnote, and deferred footnotes
- if p.insideLink && (offset > 0 && data[offset-1] == '[' || len(data)-1 > offset && data[offset+1] == '^') {
- return 0
- }
-
- var t linkType
- switch {
- // special case: ![^text] == deferred footnote (that follows something with
- // an exclamation point)
- case p.flags&EXTENSION_FOOTNOTES != 0 && len(data)-1 > offset && data[offset+1] == '^':
- t = linkDeferredFootnote
- // ![alt] == image
- case offset > 0 && data[offset-1] == '!':
- t = linkImg
- // ^[text] == inline footnote
- // [^refId] == deferred footnote
- case p.flags&EXTENSION_FOOTNOTES != 0:
- if offset > 0 && data[offset-1] == '^' {
- t = linkInlineFootnote
- } else if len(data)-1 > offset && data[offset+1] == '^' {
- t = linkDeferredFootnote
- }
- // [text] == regular link
- default:
- t = linkNormal
- }
-
- data = data[offset:]
-
- var (
- i = 1
- noteId int
- title, link, altContent []byte
- textHasNl = false
- )
-
- if t == linkDeferredFootnote {
- i++
- }
-
- brace := 0
-
- // look for the matching closing bracket
- for level := 1; level > 0 && i < len(data); i++ {
- switch {
- case data[i] == '\n':
- textHasNl = true
-
- case data[i-1] == '\\':
- continue
-
- case data[i] == '[':
- level++
-
- case data[i] == ']':
- level--
- if level <= 0 {
- i-- // compensate for extra i++ in for loop
- }
- }
- }
-
- if i >= len(data) {
- return 0
- }
-
- txtE := i
- i++
-
- // skip any amount of whitespace or newline
- // (this is much more lax than original markdown syntax)
- for i < len(data) && isspace(data[i]) {
- i++
- }
-
- switch {
- // inline style link
- case i < len(data) && data[i] == '(':
- // skip initial whitespace
- i++
-
- for i < len(data) && isspace(data[i]) {
- i++
- }
-
- linkB := i
-
- // look for link end: ' " ), check for new opening braces and take this
- // into account, this may lead for overshooting and probably will require
- // some fine-tuning.
- findlinkend:
- for i < len(data) {
- switch {
- case data[i] == '\\':
- i += 2
-
- case data[i] == '(':
- brace++
- i++
-
- case data[i] == ')':
- if brace <= 0 {
- break findlinkend
- }
- brace--
- i++
-
- case data[i] == '\'' || data[i] == '"':
- break findlinkend
-
- default:
- i++
- }
- }
-
- if i >= len(data) {
- return 0
- }
- linkE := i
-
- // look for title end if present
- titleB, titleE := 0, 0
- if data[i] == '\'' || data[i] == '"' {
- i++
- titleB = i
-
- findtitleend:
- for i < len(data) {
- switch {
- case data[i] == '\\':
- i += 2
-
- case data[i] == ')':
- break findtitleend
-
- default:
- i++
- }
- }
-
- if i >= len(data) {
- return 0
- }
-
- // skip whitespace after title
- titleE = i - 1
- for titleE > titleB && isspace(data[titleE]) {
- titleE--
- }
-
- // check for closing quote presence
- if data[titleE] != '\'' && data[titleE] != '"' {
- titleB, titleE = 0, 0
- linkE = i
- }
- }
-
- // remove whitespace at the end of the link
- for linkE > linkB && isspace(data[linkE-1]) {
- linkE--
- }
-
- // remove optional angle brackets around the link
- if data[linkB] == '<' {
- linkB++
- }
- if data[linkE-1] == '>' {
- linkE--
- }
-
- // build escaped link and title
- if linkE > linkB {
- link = data[linkB:linkE]
- }
-
- if titleE > titleB {
- title = data[titleB:titleE]
- }
-
- i++
-
- // reference style link
- case isReferenceStyleLink(data, i, t):
- var id []byte
- altContentConsidered := false
-
- // look for the id
- i++
- linkB := i
- for i < len(data) && data[i] != ']' {
- i++
- }
- if i >= len(data) {
- return 0
- }
- linkE := i
-
- // find the reference
- if linkB == linkE {
- if textHasNl {
- var b bytes.Buffer
-
- for j := 1; j < txtE; j++ {
- switch {
- case data[j] != '\n':
- b.WriteByte(data[j])
- case data[j-1] != ' ':
- b.WriteByte(' ')
- }
- }
-
- id = b.Bytes()
- } else {
- id = data[1:txtE]
- altContentConsidered = true
- }
- } else {
- id = data[linkB:linkE]
- }
-
- // find the reference with matching id
- lr, ok := p.getRef(string(id))
- if !ok {
- return 0
- }
-
- // keep link and title from reference
- link = lr.link
- title = lr.title
- if altContentConsidered {
- altContent = lr.text
- }
- i++
-
- // shortcut reference style link or reference or inline footnote
- default:
- var id []byte
-
- // craft the id
- if textHasNl {
- var b bytes.Buffer
-
- for j := 1; j < txtE; j++ {
- switch {
- case data[j] != '\n':
- b.WriteByte(data[j])
- case data[j-1] != ' ':
- b.WriteByte(' ')
- }
- }
-
- id = b.Bytes()
- } else {
- if t == linkDeferredFootnote {
- id = data[2:txtE] // get rid of the ^
- } else {
- id = data[1:txtE]
- }
- }
-
- if t == linkInlineFootnote {
- // create a new reference
- noteId = len(p.notes) + 1
-
- var fragment []byte
- if len(id) > 0 {
- if len(id) < 16 {
- fragment = make([]byte, len(id))
- } else {
- fragment = make([]byte, 16)
- }
- copy(fragment, slugify(id))
- } else {
- fragment = append([]byte("footnote-"), []byte(strconv.Itoa(noteId))...)
- }
-
- ref := &reference{
- noteId: noteId,
- hasBlock: false,
- link: fragment,
- title: id,
- }
-
- p.notes = append(p.notes, ref)
- p.notesRecord[string(ref.link)] = struct{}{}
-
- link = ref.link
- title = ref.title
- } else {
- // find the reference with matching id
- lr, ok := p.getRef(string(id))
- if !ok {
- return 0
- }
-
- if t == linkDeferredFootnote && !p.isFootnote(lr) {
- lr.noteId = len(p.notes) + 1
- p.notes = append(p.notes, lr)
- p.notesRecord[string(lr.link)] = struct{}{}
- }
-
- // keep link and title from reference
- link = lr.link
- // if inline footnote, title == footnote contents
- title = lr.title
- noteId = lr.noteId
- }
-
- // rewind the whitespace
- i = txtE + 1
- }
-
- // build content: img alt is escaped, link content is parsed
- var content bytes.Buffer
- if txtE > 1 {
- if t == linkImg {
- content.Write(data[1:txtE])
- } else {
- // links cannot contain other links, so turn off link parsing temporarily
- insideLink := p.insideLink
- p.insideLink = true
- p.inline(&content, data[1:txtE])
- p.insideLink = insideLink
- }
- }
-
- var uLink []byte
- if t == linkNormal || t == linkImg {
- if len(link) > 0 {
- var uLinkBuf bytes.Buffer
- unescapeText(&uLinkBuf, link)
- uLink = uLinkBuf.Bytes()
- }
-
- // links need something to click on and somewhere to go
- if len(uLink) == 0 || (t == linkNormal && content.Len() == 0) {
- return 0
- }
- }
-
- // call the relevant rendering function
- switch t {
- case linkNormal:
- if len(altContent) > 0 {
- p.r.Link(out, uLink, title, altContent)
- } else {
- p.r.Link(out, uLink, title, content.Bytes())
- }
-
- case linkImg:
- outSize := out.Len()
- outBytes := out.Bytes()
- if outSize > 0 && outBytes[outSize-1] == '!' {
- out.Truncate(outSize - 1)
- }
-
- p.r.Image(out, uLink, title, content.Bytes())
-
- case linkInlineFootnote:
- outSize := out.Len()
- outBytes := out.Bytes()
- if outSize > 0 && outBytes[outSize-1] == '^' {
- out.Truncate(outSize - 1)
- }
-
- p.r.FootnoteRef(out, link, noteId)
-
- case linkDeferredFootnote:
- p.r.FootnoteRef(out, link, noteId)
-
- default:
- return 0
- }
-
- return i
-}
-
-func (p *parser) inlineHTMLComment(out *bytes.Buffer, data []byte) int {
- if len(data) < 5 {
- return 0
- }
- if data[0] != '<' || data[1] != '!' || data[2] != '-' || data[3] != '-' {
- return 0
- }
- i := 5
- // scan for an end-of-comment marker, across lines if necessary
- for i < len(data) && !(data[i-2] == '-' && data[i-1] == '-' && data[i] == '>') {
- i++
- }
- // no end-of-comment marker
- if i >= len(data) {
- return 0
- }
- return i + 1
-}
-
-// '<' when tags or autolinks are allowed
-func leftAngle(p *parser, out *bytes.Buffer, data []byte, offset int) int {
- data = data[offset:]
- altype := LINK_TYPE_NOT_AUTOLINK
- end := tagLength(data, &altype)
- if size := p.inlineHTMLComment(out, data); size > 0 {
- end = size
- }
- if end > 2 {
- if altype != LINK_TYPE_NOT_AUTOLINK {
- var uLink bytes.Buffer
- unescapeText(&uLink, data[1:end+1-2])
- if uLink.Len() > 0 {
- p.r.AutoLink(out, uLink.Bytes(), altype)
- }
- } else {
- p.r.RawHtmlTag(out, data[:end])
- }
- }
-
- return end
-}
-
-// '\\' backslash escape
-var escapeChars = []byte("\\`*_{}[]()#+-.!:|&<>~")
-
-func escape(p *parser, out *bytes.Buffer, data []byte, offset int) int {
- data = data[offset:]
-
- if len(data) > 1 {
- if bytes.IndexByte(escapeChars, data[1]) < 0 {
- return 0
- }
-
- p.r.NormalText(out, data[1:2])
- }
-
- return 2
-}
-
-func unescapeText(ob *bytes.Buffer, src []byte) {
- i := 0
- for i < len(src) {
- org := i
- for i < len(src) && src[i] != '\\' {
- i++
- }
-
- if i > org {
- ob.Write(src[org:i])
- }
-
- if i+1 >= len(src) {
- break
- }
-
- ob.WriteByte(src[i+1])
- i += 2
- }
-}
-
-// '&' escaped when it doesn't belong to an entity
-// valid entities are assumed to be anything matching &#?[A-Za-z0-9]+;
-func entity(p *parser, out *bytes.Buffer, data []byte, offset int) int {
- data = data[offset:]
-
- end := 1
-
- if end < len(data) && data[end] == '#' {
- end++
- }
-
- for end < len(data) && isalnum(data[end]) {
- end++
- }
-
- if end < len(data) && data[end] == ';' {
- end++ // real entity
- } else {
- return 0 // lone '&'
- }
-
- p.r.Entity(out, data[:end])
-
- return end
-}
-
-func linkEndsWithEntity(data []byte, linkEnd int) bool {
- entityRanges := htmlEntity.FindAllIndex(data[:linkEnd], -1)
- return entityRanges != nil && entityRanges[len(entityRanges)-1][1] == linkEnd
-}
-
-func autoLink(p *parser, out *bytes.Buffer, data []byte, offset int) int {
- // quick check to rule out most false hits on ':'
- if p.insideLink || len(data) < offset+3 || data[offset+1] != '/' || data[offset+2] != '/' {
- return 0
- }
-
- // Now a more expensive check to see if we're not inside an anchor element
- anchorStart := offset
- offsetFromAnchor := 0
- for anchorStart > 0 && data[anchorStart] != '<' {
- anchorStart--
- offsetFromAnchor++
- }
-
- anchorStr := anchorRe.Find(data[anchorStart:])
- if anchorStr != nil {
- out.Write(anchorStr[offsetFromAnchor:])
- return len(anchorStr) - offsetFromAnchor
- }
-
- // scan backward for a word boundary
- rewind := 0
- for offset-rewind > 0 && rewind <= 7 && isletter(data[offset-rewind-1]) {
- rewind++
- }
- if rewind > 6 { // longest supported protocol is "mailto" which has 6 letters
- return 0
- }
-
- origData := data
- data = data[offset-rewind:]
-
- if !isSafeLink(data) {
- return 0
- }
-
- linkEnd := 0
- for linkEnd < len(data) && !isEndOfLink(data[linkEnd]) {
- linkEnd++
- }
-
- // Skip punctuation at the end of the link
- if (data[linkEnd-1] == '.' || data[linkEnd-1] == ',') && data[linkEnd-2] != '\\' {
- linkEnd--
- }
-
- // But don't skip semicolon if it's a part of escaped entity:
- if data[linkEnd-1] == ';' && data[linkEnd-2] != '\\' && !linkEndsWithEntity(data, linkEnd) {
- linkEnd--
- }
-
- // See if the link finishes with a punctuation sign that can be closed.
- var copen byte
- switch data[linkEnd-1] {
- case '"':
- copen = '"'
- case '\'':
- copen = '\''
- case ')':
- copen = '('
- case ']':
- copen = '['
- case '}':
- copen = '{'
- default:
- copen = 0
- }
-
- if copen != 0 {
- bufEnd := offset - rewind + linkEnd - 2
-
- openDelim := 1
-
- /* Try to close the final punctuation sign in this same line;
- * if we managed to close it outside of the URL, that means that it's
- * not part of the URL. If it closes inside the URL, that means it
- * is part of the URL.
- *
- * Examples:
- *
- * foo http://www.pokemon.com/Pikachu_(Electric) bar
- * => http://www.pokemon.com/Pikachu_(Electric)
- *
- * foo (http://www.pokemon.com/Pikachu_(Electric)) bar
- * => http://www.pokemon.com/Pikachu_(Electric)
- *
- * foo http://www.pokemon.com/Pikachu_(Electric)) bar
- * => http://www.pokemon.com/Pikachu_(Electric))
- *
- * (foo http://www.pokemon.com/Pikachu_(Electric)) bar
- * => foo http://www.pokemon.com/Pikachu_(Electric)
- */
-
- for bufEnd >= 0 && origData[bufEnd] != '\n' && openDelim != 0 {
- if origData[bufEnd] == data[linkEnd-1] {
- openDelim++
- }
-
- if origData[bufEnd] == copen {
- openDelim--
- }
-
- bufEnd--
- }
-
- if openDelim == 0 {
- linkEnd--
- }
- }
-
- // we were triggered on the ':', so we need to rewind the output a bit
- if out.Len() >= rewind {
- out.Truncate(len(out.Bytes()) - rewind)
- }
-
- var uLink bytes.Buffer
- unescapeText(&uLink, data[:linkEnd])
-
- if uLink.Len() > 0 {
- p.r.AutoLink(out, uLink.Bytes(), LINK_TYPE_NORMAL)
- }
-
- return linkEnd - rewind
-}
-
-func isEndOfLink(char byte) bool {
- return isspace(char) || char == '<'
-}
-
-var validUris = [][]byte{[]byte("http://"), []byte("https://"), []byte("ftp://"), []byte("mailto://")}
-var validPaths = [][]byte{[]byte("/"), []byte("./"), []byte("../")}
-
-func isSafeLink(link []byte) bool {
- for _, path := range validPaths {
- if len(link) >= len(path) && bytes.Equal(link[:len(path)], path) {
- if len(link) == len(path) {
- return true
- } else if isalnum(link[len(path)]) {
- return true
- }
- }
- }
-
- for _, prefix := range validUris {
- // TODO: handle unicode here
- // case-insensitive prefix test
- if len(link) > len(prefix) && bytes.Equal(bytes.ToLower(link[:len(prefix)]), prefix) && isalnum(link[len(prefix)]) {
- return true
- }
- }
-
- return false
-}
-
-// return the length of the given tag, or 0 is it's not valid
-func tagLength(data []byte, autolink *int) int {
- var i, j int
-
- // a valid tag can't be shorter than 3 chars
- if len(data) < 3 {
- return 0
- }
-
- // begins with a '<' optionally followed by '/', followed by letter or number
- if data[0] != '<' {
- return 0
- }
- if data[1] == '/' {
- i = 2
- } else {
- i = 1
- }
-
- if !isalnum(data[i]) {
- return 0
- }
-
- // scheme test
- *autolink = LINK_TYPE_NOT_AUTOLINK
-
- // try to find the beginning of an URI
- for i < len(data) && (isalnum(data[i]) || data[i] == '.' || data[i] == '+' || data[i] == '-') {
- i++
- }
-
- if i > 1 && i < len(data) && data[i] == '@' {
- if j = isMailtoAutoLink(data[i:]); j != 0 {
- *autolink = LINK_TYPE_EMAIL
- return i + j
- }
- }
-
- if i > 2 && i < len(data) && data[i] == ':' {
- *autolink = LINK_TYPE_NORMAL
- i++
- }
-
- // complete autolink test: no whitespace or ' or "
- switch {
- case i >= len(data):
- *autolink = LINK_TYPE_NOT_AUTOLINK
- case *autolink != 0:
- j = i
-
- for i < len(data) {
- if data[i] == '\\' {
- i += 2
- } else if data[i] == '>' || data[i] == '\'' || data[i] == '"' || isspace(data[i]) {
- break
- } else {
- i++
- }
-
- }
-
- if i >= len(data) {
- return 0
- }
- if i > j && data[i] == '>' {
- return i + 1
- }
-
- // one of the forbidden chars has been found
- *autolink = LINK_TYPE_NOT_AUTOLINK
- }
-
- // look for something looking like a tag end
- for i < len(data) && data[i] != '>' {
- i++
- }
- if i >= len(data) {
- return 0
- }
- return i + 1
-}
-
-// look for the address part of a mail autolink and '>'
-// this is less strict than the original markdown e-mail address matching
-func isMailtoAutoLink(data []byte) int {
- nb := 0
-
- // address is assumed to be: [-@._a-zA-Z0-9]+ with exactly one '@'
- for i := 0; i < len(data); i++ {
- if isalnum(data[i]) {
- continue
- }
-
- switch data[i] {
- case '@':
- nb++
-
- case '-', '.', '_':
- // Do nothing.
-
- case '>':
- if nb == 1 {
- return i + 1
- } else {
- return 0
- }
- default:
- return 0
- }
- }
-
- return 0
-}
-
-// look for the next emph char, skipping other constructs
-func helperFindEmphChar(data []byte, c byte) int {
- i := 0
-
- for i < len(data) {
- for i < len(data) && data[i] != c && data[i] != '`' && data[i] != '[' {
- i++
- }
- if i >= len(data) {
- return 0
- }
- // do not count escaped chars
- if i != 0 && data[i-1] == '\\' {
- i++
- continue
- }
- if data[i] == c {
- return i
- }
-
- if data[i] == '`' {
- // skip a code span
- tmpI := 0
- i++
- for i < len(data) && data[i] != '`' {
- if tmpI == 0 && data[i] == c {
- tmpI = i
- }
- i++
- }
- if i >= len(data) {
- return tmpI
- }
- i++
- } else if data[i] == '[' {
- // skip a link
- tmpI := 0
- i++
- for i < len(data) && data[i] != ']' {
- if tmpI == 0 && data[i] == c {
- tmpI = i
- }
- i++
- }
- i++
- for i < len(data) && (data[i] == ' ' || data[i] == '\n') {
- i++
- }
- if i >= len(data) {
- return tmpI
- }
- if data[i] != '[' && data[i] != '(' { // not a link
- if tmpI > 0 {
- return tmpI
- } else {
- continue
- }
- }
- cc := data[i]
- i++
- for i < len(data) && data[i] != cc {
- if tmpI == 0 && data[i] == c {
- return i
- }
- i++
- }
- if i >= len(data) {
- return tmpI
- }
- i++
- }
- }
- return 0
-}
-
-func helperEmphasis(p *parser, out *bytes.Buffer, data []byte, c byte) int {
- i := 0
-
- // skip one symbol if coming from emph3
- if len(data) > 1 && data[0] == c && data[1] == c {
- i = 1
- }
-
- for i < len(data) {
- length := helperFindEmphChar(data[i:], c)
- if length == 0 {
- return 0
- }
- i += length
- if i >= len(data) {
- return 0
- }
-
- if i+1 < len(data) && data[i+1] == c {
- i++
- continue
- }
-
- if data[i] == c && !isspace(data[i-1]) {
-
- if p.flags&EXTENSION_NO_INTRA_EMPHASIS != 0 {
- if !(i+1 == len(data) || isspace(data[i+1]) || ispunct(data[i+1])) {
- continue
- }
- }
-
- var work bytes.Buffer
- p.inline(&work, data[:i])
- p.r.Emphasis(out, work.Bytes())
- return i + 1
- }
- }
-
- return 0
-}
-
-func helperDoubleEmphasis(p *parser, out *bytes.Buffer, data []byte, c byte) int {
- i := 0
-
- for i < len(data) {
- length := helperFindEmphChar(data[i:], c)
- if length == 0 {
- return 0
- }
- i += length
-
- if i+1 < len(data) && data[i] == c && data[i+1] == c && i > 0 && !isspace(data[i-1]) {
- var work bytes.Buffer
- p.inline(&work, data[:i])
-
- if work.Len() > 0 {
- // pick the right renderer
- if c == '~' {
- p.r.StrikeThrough(out, work.Bytes())
- } else {
- p.r.DoubleEmphasis(out, work.Bytes())
- }
- }
- return i + 2
- }
- i++
- }
- return 0
-}
-
-func helperTripleEmphasis(p *parser, out *bytes.Buffer, data []byte, offset int, c byte) int {
- i := 0
- origData := data
- data = data[offset:]
-
- for i < len(data) {
- length := helperFindEmphChar(data[i:], c)
- if length == 0 {
- return 0
- }
- i += length
-
- // skip whitespace preceded symbols
- if data[i] != c || isspace(data[i-1]) {
- continue
- }
-
- switch {
- case i+2 < len(data) && data[i+1] == c && data[i+2] == c:
- // triple symbol found
- var work bytes.Buffer
-
- p.inline(&work, data[:i])
- if work.Len() > 0 {
- p.r.TripleEmphasis(out, work.Bytes())
- }
- return i + 3
- case (i+1 < len(data) && data[i+1] == c):
- // double symbol found, hand over to emph1
- length = helperEmphasis(p, out, origData[offset-2:], c)
- if length == 0 {
- return 0
- } else {
- return length - 2
- }
- default:
- // single symbol found, hand over to emph2
- length = helperDoubleEmphasis(p, out, origData[offset-1:], c)
- if length == 0 {
- return 0
- } else {
- return length - 1
- }
- }
- }
- return 0
-}
diff --git a/vendor/github.com/russross/blackfriday/latex.go b/vendor/github.com/russross/blackfriday/latex.go
deleted file mode 100644
index 70705aa9..00000000
--- a/vendor/github.com/russross/blackfriday/latex.go
+++ /dev/null
@@ -1,332 +0,0 @@
-//
-// Blackfriday Markdown Processor
-// Available at http://github.com/russross/blackfriday
-//
-// Copyright © 2011 Russ Ross <russ@russross.com>.
-// Distributed under the Simplified BSD License.
-// See README.md for details.
-//
-
-//
-//
-// LaTeX rendering backend
-//
-//
-
-package blackfriday
-
-import (
- "bytes"
-)
-
-// Latex is a type that implements the Renderer interface for LaTeX output.
-//
-// Do not create this directly, instead use the LatexRenderer function.
-type Latex struct {
-}
-
-// LatexRenderer creates and configures a Latex object, which
-// satisfies the Renderer interface.
-//
-// flags is a set of LATEX_* options ORed together (currently no such options
-// are defined).
-func LatexRenderer(flags int) Renderer {
- return &Latex{}
-}
-
-func (options *Latex) GetFlags() int {
- return 0
-}
-
-// render code chunks using verbatim, or listings if we have a language
-func (options *Latex) BlockCode(out *bytes.Buffer, text []byte, lang string) {
- if lang == "" {
- out.WriteString("\n\\begin{verbatim}\n")
- } else {
- out.WriteString("\n\\begin{lstlisting}[language=")
- out.WriteString(lang)
- out.WriteString("]\n")
- }
- out.Write(text)
- if lang == "" {
- out.WriteString("\n\\end{verbatim}\n")
- } else {
- out.WriteString("\n\\end{lstlisting}\n")
- }
-}
-
-func (options *Latex) TitleBlock(out *bytes.Buffer, text []byte) {
-
-}
-
-func (options *Latex) BlockQuote(out *bytes.Buffer, text []byte) {
- out.WriteString("\n\\begin{quotation}\n")
- out.Write(text)
- out.WriteString("\n\\end{quotation}\n")
-}
-
-func (options *Latex) BlockHtml(out *bytes.Buffer, text []byte) {
- // a pretty lame thing to do...
- out.WriteString("\n\\begin{verbatim}\n")
- out.Write(text)
- out.WriteString("\n\\end{verbatim}\n")
-}
-
-func (options *Latex) Header(out *bytes.Buffer, text func() bool, level int, id string) {
- marker := out.Len()
-
- switch level {
- case 1:
- out.WriteString("\n\\section{")
- case 2:
- out.WriteString("\n\\subsection{")
- case 3:
- out.WriteString("\n\\subsubsection{")
- case 4:
- out.WriteString("\n\\paragraph{")
- case 5:
- out.WriteString("\n\\subparagraph{")
- case 6:
- out.WriteString("\n\\textbf{")
- }
- if !text() {
- out.Truncate(marker)
- return
- }
- out.WriteString("}\n")
-}
-
-func (options *Latex) HRule(out *bytes.Buffer) {
- out.WriteString("\n\\HRule\n")
-}
-
-func (options *Latex) List(out *bytes.Buffer, text func() bool, flags int) {
- marker := out.Len()
- if flags&LIST_TYPE_ORDERED != 0 {
- out.WriteString("\n\\begin{enumerate}\n")
- } else {
- out.WriteString("\n\\begin{itemize}\n")
- }
- if !text() {
- out.Truncate(marker)
- return
- }
- if flags&LIST_TYPE_ORDERED != 0 {
- out.WriteString("\n\\end{enumerate}\n")
- } else {
- out.WriteString("\n\\end{itemize}\n")
- }
-}
-
-func (options *Latex) ListItem(out *bytes.Buffer, text []byte, flags int) {
- out.WriteString("\n\\item ")
- out.Write(text)
-}
-
-func (options *Latex) Paragraph(out *bytes.Buffer, text func() bool) {
- marker := out.Len()
- out.WriteString("\n")
- if !text() {
- out.Truncate(marker)
- return
- }
- out.WriteString("\n")
-}
-
-func (options *Latex) Table(out *bytes.Buffer, header []byte, body []byte, columnData []int) {
- out.WriteString("\n\\begin{tabular}{")
- for _, elt := range columnData {
- switch elt {
- case TABLE_ALIGNMENT_LEFT:
- out.WriteByte('l')
- case TABLE_ALIGNMENT_RIGHT:
- out.WriteByte('r')
- default:
- out.WriteByte('c')
- }
- }
- out.WriteString("}\n")
- out.Write(header)
- out.WriteString(" \\\\\n\\hline\n")
- out.Write(body)
- out.WriteString("\n\\end{tabular}\n")
-}
-
-func (options *Latex) TableRow(out *bytes.Buffer, text []byte) {
- if out.Len() > 0 {
- out.WriteString(" \\\\\n")
- }
- out.Write(text)
-}
-
-func (options *Latex) TableHeaderCell(out *bytes.Buffer, text []byte, align int) {
- if out.Len() > 0 {
- out.WriteString(" & ")
- }
- out.Write(text)
-}
-
-func (options *Latex) TableCell(out *bytes.Buffer, text []byte, align int) {
- if out.Len() > 0 {
- out.WriteString(" & ")
- }
- out.Write(text)
-}
-
-// TODO: this
-func (options *Latex) Footnotes(out *bytes.Buffer, text func() bool) {
-
-}
-
-func (options *Latex) FootnoteItem(out *bytes.Buffer, name, text []byte, flags int) {
-
-}
-
-func (options *Latex) AutoLink(out *bytes.Buffer, link []byte, kind int) {
- out.WriteString("\\href{")
- if kind == LINK_TYPE_EMAIL {
- out.WriteString("mailto:")
- }
- out.Write(link)
- out.WriteString("}{")
- out.Write(link)
- out.WriteString("}")
-}
-
-func (options *Latex) CodeSpan(out *bytes.Buffer, text []byte) {
- out.WriteString("\\texttt{")
- escapeSpecialChars(out, text)
- out.WriteString("}")
-}
-
-func (options *Latex) DoubleEmphasis(out *bytes.Buffer, text []byte) {
- out.WriteString("\\textbf{")
- out.Write(text)
- out.WriteString("}")
-}
-
-func (options *Latex) Emphasis(out *bytes.Buffer, text []byte) {
- out.WriteString("\\textit{")
- out.Write(text)
- out.WriteString("}")
-}
-
-func (options *Latex) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte) {
- if bytes.HasPrefix(link, []byte("http://")) || bytes.HasPrefix(link, []byte("https://")) {
- // treat it like a link
- out.WriteString("\\href{")
- out.Write(link)
- out.WriteString("}{")
- out.Write(alt)
- out.WriteString("}")
- } else {
- out.WriteString("\\includegraphics{")
- out.Write(link)
- out.WriteString("}")
- }
-}
-
-func (options *Latex) LineBreak(out *bytes.Buffer) {
- out.WriteString(" \\\\\n")
-}
-
-func (options *Latex) Link(out *bytes.Buffer, link []byte, title []byte, content []byte) {
- out.WriteString("\\href{")
- out.Write(link)
- out.WriteString("}{")
- out.Write(content)
- out.WriteString("}")
-}
-
-func (options *Latex) RawHtmlTag(out *bytes.Buffer, tag []byte) {
-}
-
-func (options *Latex) TripleEmphasis(out *bytes.Buffer, text []byte) {
- out.WriteString("\\textbf{\\textit{")
- out.Write(text)
- out.WriteString("}}")
-}
-
-func (options *Latex) StrikeThrough(out *bytes.Buffer, text []byte) {
- out.WriteString("\\sout{")
- out.Write(text)
- out.WriteString("}")
-}
-
-// TODO: this
-func (options *Latex) FootnoteRef(out *bytes.Buffer, ref []byte, id int) {
-
-}
-
-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++ {
- // 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])
- }
-}
-
-func (options *Latex) Entity(out *bytes.Buffer, entity []byte) {
- // TODO: convert this into a unicode character or something
- out.Write(entity)
-}
-
-func (options *Latex) NormalText(out *bytes.Buffer, text []byte) {
- escapeSpecialChars(out, text)
-}
-
-// header and footer
-func (options *Latex) DocumentHeader(out *bytes.Buffer) {
- out.WriteString("\\documentclass{article}\n")
- out.WriteString("\n")
- out.WriteString("\\usepackage{graphicx}\n")
- out.WriteString("\\usepackage{listings}\n")
- out.WriteString("\\usepackage[margin=1in]{geometry}\n")
- out.WriteString("\\usepackage[utf8]{inputenc}\n")
- out.WriteString("\\usepackage{verbatim}\n")
- out.WriteString("\\usepackage[normalem]{ulem}\n")
- out.WriteString("\\usepackage{hyperref}\n")
- out.WriteString("\n")
- out.WriteString("\\hypersetup{colorlinks,%\n")
- out.WriteString(" citecolor=black,%\n")
- out.WriteString(" filecolor=black,%\n")
- out.WriteString(" linkcolor=black,%\n")
- out.WriteString(" urlcolor=black,%\n")
- out.WriteString(" pdfstartview=FitH,%\n")
- out.WriteString(" breaklinks=true,%\n")
- out.WriteString(" pdfauthor={Blackfriday Markdown Processor v")
- out.WriteString(VERSION)
- out.WriteString("}}\n")
- out.WriteString("\n")
- out.WriteString("\\newcommand{\\HRule}{\\rule{\\linewidth}{0.5mm}}\n")
- out.WriteString("\\addtolength{\\parskip}{0.5\\baselineskip}\n")
- out.WriteString("\\parindent=0pt\n")
- out.WriteString("\n")
- out.WriteString("\\begin{document}\n")
-}
-
-func (options *Latex) DocumentFooter(out *bytes.Buffer) {
- out.WriteString("\n\\end{document}\n")
-}
diff --git a/vendor/github.com/russross/blackfriday/markdown.go b/vendor/github.com/russross/blackfriday/markdown.go
deleted file mode 100644
index 1722a738..00000000
--- a/vendor/github.com/russross/blackfriday/markdown.go
+++ /dev/null
@@ -1,931 +0,0 @@
-//
-// Blackfriday Markdown Processor
-// Available at http://github.com/russross/blackfriday
-//
-// Copyright © 2011 Russ Ross <russ@russross.com>.
-// Distributed under the Simplified BSD License.
-// See README.md for details.
-//
-
-//
-//
-// Markdown parsing and processing
-//
-//
-
-package blackfriday
-
-import (
- "bytes"
- "fmt"
- "strings"
- "unicode/utf8"
-)
-
-const VERSION = "1.5"
-
-// These are the supported markdown parsing extensions.
-// OR these values together to select multiple extensions.
-const (
- EXTENSION_NO_INTRA_EMPHASIS = 1 << iota // ignore emphasis markers inside words
- EXTENSION_TABLES // render tables
- EXTENSION_FENCED_CODE // render fenced code blocks
- EXTENSION_AUTOLINK // detect embedded URLs that are not explicitly marked
- EXTENSION_STRIKETHROUGH // strikethrough text using ~~test~~
- EXTENSION_LAX_HTML_BLOCKS // loosen up HTML block parsing rules
- EXTENSION_SPACE_HEADERS // be strict about prefix header rules
- EXTENSION_HARD_LINE_BREAK // translate newlines into line breaks
- EXTENSION_TAB_SIZE_EIGHT // expand tabs to eight spaces instead of four
- EXTENSION_FOOTNOTES // Pandoc-style footnotes
- EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK // No need to insert an empty line to start a (code, quote, ordered list, unordered list) block
- EXTENSION_HEADER_IDS // specify header IDs with {#id}
- EXTENSION_TITLEBLOCK // Titleblock ala pandoc
- EXTENSION_AUTO_HEADER_IDS // Create the header ID from the text
- EXTENSION_BACKSLASH_LINE_BREAK // translate trailing backslashes into line breaks
- EXTENSION_DEFINITION_LISTS // render definition lists
- EXTENSION_JOIN_LINES // delete newline and join lines
-
- commonHtmlFlags = 0 |
- HTML_USE_XHTML |
- HTML_USE_SMARTYPANTS |
- HTML_SMARTYPANTS_FRACTIONS |
- HTML_SMARTYPANTS_DASHES |
- HTML_SMARTYPANTS_LATEX_DASHES
-
- commonExtensions = 0 |
- EXTENSION_NO_INTRA_EMPHASIS |
- EXTENSION_TABLES |
- EXTENSION_FENCED_CODE |
- EXTENSION_AUTOLINK |
- EXTENSION_STRIKETHROUGH |
- EXTENSION_SPACE_HEADERS |
- EXTENSION_HEADER_IDS |
- EXTENSION_BACKSLASH_LINE_BREAK |
- EXTENSION_DEFINITION_LISTS
-)
-
-// These are the possible flag values for the link renderer.
-// Only a single one of these values will be used; they are not ORed together.
-// These are mostly of interest if you are writing a new output format.
-const (
- LINK_TYPE_NOT_AUTOLINK = iota
- LINK_TYPE_NORMAL
- LINK_TYPE_EMAIL
-)
-
-// These are the possible flag values for the ListItem renderer.
-// Multiple flag values may be ORed together.
-// These are mostly of interest if you are writing a new output format.
-const (
- LIST_TYPE_ORDERED = 1 << iota
- LIST_TYPE_DEFINITION
- LIST_TYPE_TERM
- LIST_ITEM_CONTAINS_BLOCK
- LIST_ITEM_BEGINNING_OF_LIST
- LIST_ITEM_END_OF_LIST
-)
-
-// These are the possible flag values for the table cell renderer.
-// Only a single one of these values will be used; they are not ORed together.
-// These are mostly of interest if you are writing a new output format.
-const (
- TABLE_ALIGNMENT_LEFT = 1 << iota
- TABLE_ALIGNMENT_RIGHT
- TABLE_ALIGNMENT_CENTER = (TABLE_ALIGNMENT_LEFT | TABLE_ALIGNMENT_RIGHT)
-)
-
-// The size of a tab stop.
-const (
- TAB_SIZE_DEFAULT = 4
- TAB_SIZE_EIGHT = 8
-)
-
-// blockTags is a set of tags that are recognized as HTML block tags.
-// Any of these can be included in markdown text without special escaping.
-var blockTags = map[string]struct{}{
- "blockquote": {},
- "del": {},
- "div": {},
- "dl": {},
- "fieldset": {},
- "form": {},
- "h1": {},
- "h2": {},
- "h3": {},
- "h4": {},
- "h5": {},
- "h6": {},
- "iframe": {},
- "ins": {},
- "math": {},
- "noscript": {},
- "ol": {},
- "pre": {},
- "p": {},
- "script": {},
- "style": {},
- "table": {},
- "ul": {},
-
- // HTML5
- "address": {},
- "article": {},
- "aside": {},
- "canvas": {},
- "figcaption": {},
- "figure": {},
- "footer": {},
- "header": {},
- "hgroup": {},
- "main": {},
- "nav": {},
- "output": {},
- "progress": {},
- "section": {},
- "video": {},
-}
-
-// Renderer is the rendering interface.
-// This is mostly of interest if you are implementing a new rendering format.
-//
-// When a byte slice is provided, it contains the (rendered) contents of the
-// element.
-//
-// When a callback is provided instead, it will write the contents of the
-// respective element directly to the output buffer and return true on success.
-// If the callback returns false, the rendering function should reset the
-// output buffer as though it had never been called.
-//
-// Currently Html and Latex implementations are provided
-type Renderer interface {
- // block-level callbacks
- BlockCode(out *bytes.Buffer, text []byte, lang string)
- BlockQuote(out *bytes.Buffer, text []byte)
- BlockHtml(out *bytes.Buffer, text []byte)
- Header(out *bytes.Buffer, text func() bool, level int, id string)
- HRule(out *bytes.Buffer)
- List(out *bytes.Buffer, text func() bool, flags int)
- ListItem(out *bytes.Buffer, text []byte, flags int)
- Paragraph(out *bytes.Buffer, text func() bool)
- Table(out *bytes.Buffer, header []byte, body []byte, columnData []int)
- TableRow(out *bytes.Buffer, text []byte)
- TableHeaderCell(out *bytes.Buffer, text []byte, flags int)
- TableCell(out *bytes.Buffer, text []byte, flags int)
- Footnotes(out *bytes.Buffer, text func() bool)
- FootnoteItem(out *bytes.Buffer, name, text []byte, flags int)
- TitleBlock(out *bytes.Buffer, text []byte)
-
- // Span-level callbacks
- AutoLink(out *bytes.Buffer, link []byte, kind int)
- CodeSpan(out *bytes.Buffer, text []byte)
- DoubleEmphasis(out *bytes.Buffer, text []byte)
- Emphasis(out *bytes.Buffer, text []byte)
- Image(out *bytes.Buffer, link []byte, title []byte, alt []byte)
- LineBreak(out *bytes.Buffer)
- Link(out *bytes.Buffer, link []byte, title []byte, content []byte)
- RawHtmlTag(out *bytes.Buffer, tag []byte)
- TripleEmphasis(out *bytes.Buffer, text []byte)
- StrikeThrough(out *bytes.Buffer, text []byte)
- FootnoteRef(out *bytes.Buffer, ref []byte, id int)
-
- // Low-level callbacks
- Entity(out *bytes.Buffer, entity []byte)
- NormalText(out *bytes.Buffer, text []byte)
-
- // Header and footer
- DocumentHeader(out *bytes.Buffer)
- DocumentFooter(out *bytes.Buffer)
-
- GetFlags() int
-}
-
-// Callback functions for inline parsing. One such function is defined
-// for each character that triggers a response when parsing inline data.
-type inlineParser func(p *parser, out *bytes.Buffer, data []byte, offset int) int
-
-// Parser holds runtime state used by the parser.
-// This is constructed by the Markdown function.
-type parser struct {
- r Renderer
- refOverride ReferenceOverrideFunc
- refs map[string]*reference
- inlineCallback [256]inlineParser
- flags int
- nesting int
- maxNesting int
- insideLink bool
-
- // Footnotes need to be ordered as well as available to quickly check for
- // presence. If a ref is also a footnote, it's stored both in refs and here
- // in notes. Slice is nil if footnotes not enabled.
- notes []*reference
- notesRecord map[string]struct{}
-}
-
-func (p *parser) getRef(refid string) (ref *reference, found bool) {
- if p.refOverride != nil {
- r, overridden := p.refOverride(refid)
- if overridden {
- if r == nil {
- return nil, false
- }
- return &reference{
- link: []byte(r.Link),
- title: []byte(r.Title),
- noteId: 0,
- hasBlock: false,
- text: []byte(r.Text)}, true
- }
- }
- // refs are case insensitive
- ref, found = p.refs[strings.ToLower(refid)]
- return ref, found
-}
-
-func (p *parser) isFootnote(ref *reference) bool {
- _, ok := p.notesRecord[string(ref.link)]
- return ok
-}
-
-//
-//
-// Public interface
-//
-//
-
-// Reference represents the details of a link.
-// See the documentation in Options for more details on use-case.
-type Reference struct {
- // Link is usually the URL the reference points to.
- Link string
- // Title is the alternate text describing the link in more detail.
- Title string
- // Text is the optional text to override the ref with if the syntax used was
- // [refid][]
- Text string
-}
-
-// ReferenceOverrideFunc is expected to be called with a reference string and
-// return either a valid Reference type that the reference string maps to or
-// nil. If overridden is false, the default reference logic will be executed.
-// See the documentation in Options for more details on use-case.
-type ReferenceOverrideFunc func(reference string) (ref *Reference, overridden bool)
-
-// Options represents configurable overrides and callbacks (in addition to the
-// extension flag set) for configuring a Markdown parse.
-type Options struct {
- // Extensions is a flag set of bit-wise ORed extension bits. See the
- // EXTENSION_* flags defined in this package.
- Extensions int
-
- // ReferenceOverride is an optional function callback that is called every
- // time a reference is resolved.
- //
- // In Markdown, the link reference syntax can be made to resolve a link to
- // a reference instead of an inline URL, in one of the following ways:
- //
- // * [link text][refid]
- // * [refid][]
- //
- // Usually, the refid is defined at the bottom of the Markdown document. If
- // this override function is provided, the refid is passed to the override
- // function first, before consulting the defined refids at the bottom. If
- // the override function indicates an override did not occur, the refids at
- // the bottom will be used to fill in the link details.
- ReferenceOverride ReferenceOverrideFunc
-}
-
-// MarkdownBasic is a convenience function for simple rendering.
-// It processes markdown input with no extensions enabled.
-func MarkdownBasic(input []byte) []byte {
- // set up the HTML renderer
- htmlFlags := HTML_USE_XHTML
- renderer := HtmlRenderer(htmlFlags, "", "")
-
- // set up the parser
- return MarkdownOptions(input, renderer, Options{Extensions: 0})
-}
-
-// Call Markdown with most useful extensions enabled
-// MarkdownCommon is a convenience function for simple rendering.
-// It processes markdown input with common extensions enabled, including:
-//
-// * Smartypants processing with smart fractions and LaTeX dashes
-//
-// * Intra-word emphasis suppression
-//
-// * Tables
-//
-// * Fenced code blocks
-//
-// * Autolinking
-//
-// * Strikethrough support
-//
-// * Strict header parsing
-//
-// * Custom Header IDs
-func MarkdownCommon(input []byte) []byte {
- // set up the HTML renderer
- renderer := HtmlRenderer(commonHtmlFlags, "", "")
- return MarkdownOptions(input, renderer, Options{
- Extensions: commonExtensions})
-}
-
-// Markdown is the main rendering function.
-// It parses and renders a block of markdown-encoded text.
-// The supplied Renderer is used to format the output, and extensions dictates
-// which non-standard extensions are enabled.
-//
-// To use the supplied Html or LaTeX renderers, see HtmlRenderer and
-// LatexRenderer, respectively.
-func Markdown(input []byte, renderer Renderer, extensions int) []byte {
- return MarkdownOptions(input, renderer, Options{
- Extensions: extensions})
-}
-
-// MarkdownOptions is just like Markdown but takes additional options through
-// the Options struct.
-func MarkdownOptions(input []byte, renderer Renderer, opts Options) []byte {
- // no point in parsing if we can't render
- if renderer == nil {
- return nil
- }
-
- extensions := opts.Extensions
-
- // fill in the render structure
- p := new(parser)
- p.r = renderer
- p.flags = extensions
- p.refOverride = opts.ReferenceOverride
- p.refs = make(map[string]*reference)
- p.maxNesting = 16
- p.insideLink = false
-
- // register inline parsers
- p.inlineCallback['*'] = emphasis
- p.inlineCallback['_'] = emphasis
- if extensions&EXTENSION_STRIKETHROUGH != 0 {
- p.inlineCallback['~'] = emphasis
- }
- p.inlineCallback['`'] = codeSpan
- p.inlineCallback['\n'] = lineBreak
- p.inlineCallback['['] = link
- p.inlineCallback['<'] = leftAngle
- p.inlineCallback['\\'] = escape
- p.inlineCallback['&'] = entity
-
- if extensions&EXTENSION_AUTOLINK != 0 {
- p.inlineCallback[':'] = autoLink
- }
-
- if extensions&EXTENSION_FOOTNOTES != 0 {
- p.notes = make([]*reference, 0)
- p.notesRecord = make(map[string]struct{})
- }
-
- first := firstPass(p, input)
- second := secondPass(p, first)
- return second
-}
-
-// first pass:
-// - normalize newlines
-// - extract references (outside of fenced code blocks)
-// - expand tabs (outside of fenced code blocks)
-// - copy everything else
-func firstPass(p *parser, input []byte) []byte {
- var out bytes.Buffer
- tabSize := TAB_SIZE_DEFAULT
- if p.flags&EXTENSION_TAB_SIZE_EIGHT != 0 {
- tabSize = TAB_SIZE_EIGHT
- }
- beg := 0
- lastFencedCodeBlockEnd := 0
- for beg < len(input) {
- // Find end of this line, then process the line.
- end := beg
- for end < len(input) && input[end] != '\n' && input[end] != '\r' {
- end++
- }
-
- if p.flags&EXTENSION_FENCED_CODE != 0 {
- // track fenced code block boundaries to suppress tab expansion
- // and reference extraction inside them:
- if beg >= lastFencedCodeBlockEnd {
- if i := p.fencedCodeBlock(&out, input[beg:], false); i > 0 {
- lastFencedCodeBlockEnd = beg + i
- }
- }
- }
-
- // add the line body if present
- if end > beg {
- if end < lastFencedCodeBlockEnd { // Do not expand tabs while inside fenced code blocks.
- out.Write(input[beg:end])
- } else if refEnd := isReference(p, input[beg:], tabSize); refEnd > 0 {
- beg += refEnd
- continue
- } else {
- expandTabs(&out, input[beg:end], tabSize)
- }
- }
-
- if end < len(input) && input[end] == '\r' {
- end++
- }
- if end < len(input) && input[end] == '\n' {
- end++
- }
- out.WriteByte('\n')
-
- beg = end
- }
-
- // empty input?
- if out.Len() == 0 {
- out.WriteByte('\n')
- }
-
- return out.Bytes()
-}
-
-// second pass: actual rendering
-func secondPass(p *parser, input []byte) []byte {
- var output bytes.Buffer
-
- p.r.DocumentHeader(&output)
- p.block(&output, input)
-
- if p.flags&EXTENSION_FOOTNOTES != 0 && len(p.notes) > 0 {
- p.r.Footnotes(&output, func() bool {
- flags := LIST_ITEM_BEGINNING_OF_LIST
- for i := 0; i < len(p.notes); i += 1 {
- ref := p.notes[i]
- var buf bytes.Buffer
- if ref.hasBlock {
- flags |= LIST_ITEM_CONTAINS_BLOCK
- p.block(&buf, ref.title)
- } else {
- p.inline(&buf, ref.title)
- }
- p.r.FootnoteItem(&output, ref.link, buf.Bytes(), flags)
- flags &^= LIST_ITEM_BEGINNING_OF_LIST | LIST_ITEM_CONTAINS_BLOCK
- }
-
- return true
- })
- }
-
- p.r.DocumentFooter(&output)
-
- if p.nesting != 0 {
- panic("Nesting level did not end at zero")
- }
-
- return output.Bytes()
-}
-
-//
-// Link references
-//
-// This section implements support for references that (usually) appear
-// as footnotes in a document, and can be referenced anywhere in the document.
-// The basic format is:
-//
-// [1]: http://www.google.com/ "Google"
-// [2]: http://www.github.com/ "Github"
-//
-// Anywhere in the document, the reference can be linked by referring to its
-// label, i.e., 1 and 2 in this example, as in:
-//
-// This library is hosted on [Github][2], a git hosting site.
-//
-// Actual footnotes as specified in Pandoc and supported by some other Markdown
-// libraries such as php-markdown are also taken care of. They look like this:
-//
-// This sentence needs a bit of further explanation.[^note]
-//
-// [^note]: This is the explanation.
-//
-// Footnotes should be placed at the end of the document in an ordered list.
-// Inline footnotes such as:
-//
-// Inline footnotes^[Not supported.] also exist.
-//
-// are not yet supported.
-
-// References are parsed and stored in this struct.
-type reference struct {
- link []byte
- title []byte
- noteId int // 0 if not a footnote ref
- hasBlock bool
- text []byte
-}
-
-func (r *reference) String() string {
- return fmt.Sprintf("{link: %q, title: %q, text: %q, noteId: %d, hasBlock: %v}",
- r.link, r.title, r.text, r.noteId, r.hasBlock)
-}
-
-// Check whether or not data starts with a reference link.
-// If so, it is parsed and stored in the list of references
-// (in the render struct).
-// Returns the number of bytes to skip to move past it,
-// or zero if the first line is not a reference.
-func isReference(p *parser, data []byte, tabSize int) int {
- // up to 3 optional leading spaces
- if len(data) < 4 {
- return 0
- }
- i := 0
- for i < 3 && data[i] == ' ' {
- i++
- }
-
- noteId := 0
-
- // id part: anything but a newline between brackets
- if data[i] != '[' {
- return 0
- }
- i++
- if p.flags&EXTENSION_FOOTNOTES != 0 {
- if i < len(data) && data[i] == '^' {
- // we can set it to anything here because the proper noteIds will
- // be assigned later during the second pass. It just has to be != 0
- noteId = 1
- i++
- }
- }
- idOffset := i
- for i < len(data) && data[i] != '\n' && data[i] != '\r' && data[i] != ']' {
- i++
- }
- if i >= len(data) || data[i] != ']' {
- return 0
- }
- idEnd := i
-
- // spacer: colon (space | tab)* newline? (space | tab)*
- i++
- if i >= len(data) || data[i] != ':' {
- return 0
- }
- i++
- for i < len(data) && (data[i] == ' ' || data[i] == '\t') {
- i++
- }
- if i < len(data) && (data[i] == '\n' || data[i] == '\r') {
- i++
- if i < len(data) && data[i] == '\n' && data[i-1] == '\r' {
- i++
- }
- }
- for i < len(data) && (data[i] == ' ' || data[i] == '\t') {
- i++
- }
- if i >= len(data) {
- return 0
- }
-
- var (
- linkOffset, linkEnd int
- titleOffset, titleEnd int
- lineEnd int
- raw []byte
- hasBlock bool
- )
-
- if p.flags&EXTENSION_FOOTNOTES != 0 && noteId != 0 {
- linkOffset, linkEnd, raw, hasBlock = scanFootnote(p, data, i, tabSize)
- lineEnd = linkEnd
- } else {
- linkOffset, linkEnd, titleOffset, titleEnd, lineEnd = scanLinkRef(p, data, i)
- }
- if lineEnd == 0 {
- return 0
- }
-
- // a valid ref has been found
-
- ref := &reference{
- noteId: noteId,
- hasBlock: hasBlock,
- }
-
- if noteId > 0 {
- // reusing the link field for the id since footnotes don't have links
- ref.link = data[idOffset:idEnd]
- // if footnote, it's not really a title, it's the contained text
- ref.title = raw
- } else {
- ref.link = data[linkOffset:linkEnd]
- ref.title = data[titleOffset:titleEnd]
- }
-
- // id matches are case-insensitive
- id := string(bytes.ToLower(data[idOffset:idEnd]))
-
- p.refs[id] = ref
-
- return lineEnd
-}
-
-func scanLinkRef(p *parser, data []byte, i int) (linkOffset, linkEnd, titleOffset, titleEnd, lineEnd int) {
- // link: whitespace-free sequence, optionally between angle brackets
- if data[i] == '<' {
- i++
- }
- linkOffset = i
- if i == len(data) {
- return
- }
- for i < len(data) && data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r' {
- i++
- }
- linkEnd = i
- if data[linkOffset] == '<' && data[linkEnd-1] == '>' {
- linkOffset++
- linkEnd--
- }
-
- // optional spacer: (space | tab)* (newline | '\'' | '"' | '(' )
- for i < len(data) && (data[i] == ' ' || data[i] == '\t') {
- i++
- }
- if i < len(data) && data[i] != '\n' && data[i] != '\r' && data[i] != '\'' && data[i] != '"' && data[i] != '(' {
- return
- }
-
- // compute end-of-line
- if i >= len(data) || data[i] == '\r' || data[i] == '\n' {
- lineEnd = i
- }
- if i+1 < len(data) && data[i] == '\r' && data[i+1] == '\n' {
- lineEnd++
- }
-
- // optional (space|tab)* spacer after a newline
- if lineEnd > 0 {
- i = lineEnd + 1
- for i < len(data) && (data[i] == ' ' || data[i] == '\t') {
- i++
- }
- }
-
- // optional title: any non-newline sequence enclosed in '"() alone on its line
- if i+1 < len(data) && (data[i] == '\'' || data[i] == '"' || data[i] == '(') {
- i++
- titleOffset = i
-
- // look for EOL
- for i < len(data) && data[i] != '\n' && data[i] != '\r' {
- i++
- }
- if i+1 < len(data) && data[i] == '\n' && data[i+1] == '\r' {
- titleEnd = i + 1
- } else {
- titleEnd = i
- }
-
- // step back
- i--
- for i > titleOffset && (data[i] == ' ' || data[i] == '\t') {
- i--
- }
- if i > titleOffset && (data[i] == '\'' || data[i] == '"' || data[i] == ')') {
- lineEnd = titleEnd
- titleEnd = i
- }
- }
-
- return
-}
-
-// The first bit of this logic is the same as (*parser).listItem, but the rest
-// is much simpler. This function simply finds the entire block and shifts it
-// over by one tab if it is indeed a block (just returns the line if it's not).
-// blockEnd is the end of the section in the input buffer, and contents is the
-// extracted text that was shifted over one tab. It will need to be rendered at
-// the end of the document.
-func scanFootnote(p *parser, data []byte, i, indentSize int) (blockStart, blockEnd int, contents []byte, hasBlock bool) {
- if i == 0 || len(data) == 0 {
- return
- }
-
- // skip leading whitespace on first line
- for i < len(data) && data[i] == ' ' {
- i++
- }
-
- blockStart = i
-
- // find the end of the line
- blockEnd = i
- for i < len(data) && data[i-1] != '\n' {
- i++
- }
-
- // get working buffer
- var raw bytes.Buffer
-
- // put the first line into the working buffer
- raw.Write(data[blockEnd:i])
- blockEnd = i
-
- // process the following lines
- containsBlankLine := false
-
-gatherLines:
- for blockEnd < len(data) {
- i++
-
- // find the end of this line
- for i < len(data) && 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[blockEnd:i]) > 0 {
- containsBlankLine = true
- blockEnd = i
- continue
- }
-
- n := 0
- if n = isIndented(data[blockEnd:i], indentSize); n == 0 {
- // this is the end of the block.
- // we don't want to include this last line in the index.
- break gatherLines
- }
-
- // if there were blank lines before this one, insert a new one now
- if containsBlankLine {
- raw.WriteByte('\n')
- containsBlankLine = false
- }
-
- // get rid of that first tab, write to buffer
- raw.Write(data[blockEnd+n : i])
- hasBlock = true
-
- blockEnd = i
- }
-
- if data[blockEnd-1] != '\n' {
- raw.WriteByte('\n')
- }
-
- contents = raw.Bytes()
-
- return
-}
-
-//
-//
-// Miscellaneous helper functions
-//
-//
-
-// Test if a character is a punctuation symbol.
-// Taken from a private function in regexp in the stdlib.
-func ispunct(c byte) bool {
- for _, r := range []byte("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~") {
- if c == r {
- return true
- }
- }
- return false
-}
-
-// Test if a character is a whitespace character.
-func isspace(c byte) bool {
- return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f' || c == '\v'
-}
-
-// Test if a character is letter.
-func isletter(c byte) bool {
- return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
-}
-
-// Test if a character is a letter or a digit.
-// TODO: check when this is looking for ASCII alnum and when it should use unicode
-func isalnum(c byte) bool {
- return (c >= '0' && c <= '9') || isletter(c)
-}
-
-// Replace tab characters with spaces, aligning to the next TAB_SIZE column.
-// always ends output with a newline
-func expandTabs(out *bytes.Buffer, line []byte, tabSize int) {
- // first, check for common cases: no tabs, or only tabs at beginning of line
- i, prefix := 0, 0
- slowcase := false
- for i = 0; i < len(line); i++ {
- if line[i] == '\t' {
- if prefix == i {
- prefix++
- } else {
- slowcase = true
- break
- }
- }
- }
-
- // no need to decode runes if all tabs are at the beginning of the line
- if !slowcase {
- for i = 0; i < prefix*tabSize; i++ {
- out.WriteByte(' ')
- }
- out.Write(line[prefix:])
- return
- }
-
- // the slow case: we need to count runes to figure out how
- // many spaces to insert for each tab
- column := 0
- i = 0
- for i < len(line) {
- start := i
- for i < len(line) && line[i] != '\t' {
- _, size := utf8.DecodeRune(line[i:])
- i += size
- column++
- }
-
- if i > start {
- out.Write(line[start:i])
- }
-
- if i >= len(line) {
- break
- }
-
- for {
- out.WriteByte(' ')
- column++
- if column%tabSize == 0 {
- break
- }
- }
-
- i++
- }
-}
-
-// Find if a line counts as indented or not.
-// Returns number of characters the indent is (0 = not indented).
-func isIndented(data []byte, indentSize int) int {
- if len(data) == 0 {
- return 0
- }
- if data[0] == '\t' {
- return 1
- }
- if len(data) < indentSize {
- return 0
- }
- for i := 0; i < indentSize; i++ {
- if data[i] != ' ' {
- return 0
- }
- }
- return indentSize
-}
-
-// Create a url-safe slug for fragments
-func slugify(in []byte) []byte {
- if len(in) == 0 {
- return in
- }
- out := make([]byte, 0, len(in))
- sym := false
-
- for _, ch := range in {
- if isalnum(ch) {
- sym = false
- out = append(out, ch)
- } else if sym {
- continue
- } else {
- out = append(out, '-')
- sym = true
- }
- }
- var a, b int
- var ch byte
- for a, ch = range out {
- if ch != '-' {
- break
- }
- }
- for b = len(out) - 1; b > 0; b-- {
- if out[b] != '-' {
- break
- }
- }
- return out[a : b+1]
-}
diff --git a/vendor/github.com/russross/blackfriday/smartypants.go b/vendor/github.com/russross/blackfriday/smartypants.go
deleted file mode 100644
index f25bd07d..00000000
--- a/vendor/github.com/russross/blackfriday/smartypants.go
+++ /dev/null
@@ -1,430 +0,0 @@
-//
-// Blackfriday Markdown Processor
-// Available at http://github.com/russross/blackfriday
-//
-// Copyright © 2011 Russ Ross <russ@russross.com>.
-// Distributed under the Simplified BSD License.
-// See README.md for details.
-//
-
-//
-//
-// SmartyPants rendering
-//
-//
-
-package blackfriday
-
-import (
- "bytes"
-)
-
-type smartypantsData struct {
- inSingleQuote bool
- inDoubleQuote bool
-}
-
-func wordBoundary(c byte) bool {
- return c == 0 || isspace(c) || ispunct(c)
-}
-
-func tolower(c byte) byte {
- if c >= 'A' && c <= 'Z' {
- return c - 'A' + 'a'
- }
- return c
-}
-
-func isdigit(c byte) bool {
- return c >= '0' && c <= '9'
-}
-
-func smartQuoteHelper(out *bytes.Buffer, previousChar byte, nextChar byte, quote byte, isOpen *bool, addNBSP bool) bool {
- // edge of the buffer is likely to be a tag that we don't get to see,
- // so we treat it like text sometimes
-
- // enumerate all sixteen possibilities for (previousChar, nextChar)
- // each can be one of {0, space, punct, other}
- switch {
- case previousChar == 0 && nextChar == 0:
- // context is not any help here, so toggle
- *isOpen = !*isOpen
- case isspace(previousChar) && nextChar == 0:
- // [ "] might be [ "<code>foo...]
- *isOpen = true
- case ispunct(previousChar) && nextChar == 0:
- // [!"] hmm... could be [Run!"] or [("<code>...]
- *isOpen = false
- case /* isnormal(previousChar) && */ nextChar == 0:
- // [a"] is probably a close
- *isOpen = false
- case previousChar == 0 && isspace(nextChar):
- // [" ] might be [...foo</code>" ]
- *isOpen = false
- case isspace(previousChar) && isspace(nextChar):
- // [ " ] context is not any help here, so toggle
- *isOpen = !*isOpen
- case ispunct(previousChar) && isspace(nextChar):
- // [!" ] is probably a close
- *isOpen = false
- case /* isnormal(previousChar) && */ isspace(nextChar):
- // [a" ] this is one of the easy cases
- *isOpen = false
- case previousChar == 0 && ispunct(nextChar):
- // ["!] hmm... could be ["$1.95] or [</code>"!...]
- *isOpen = false
- case isspace(previousChar) && ispunct(nextChar):
- // [ "!] looks more like [ "$1.95]
- *isOpen = true
- case ispunct(previousChar) && ispunct(nextChar):
- // [!"!] context is not any help here, so toggle
- *isOpen = !*isOpen
- case /* isnormal(previousChar) && */ ispunct(nextChar):
- // [a"!] is probably a close
- *isOpen = false
- case previousChar == 0 /* && isnormal(nextChar) */ :
- // ["a] is probably an open
- *isOpen = true
- case isspace(previousChar) /* && isnormal(nextChar) */ :
- // [ "a] this is one of the easy cases
- *isOpen = true
- case ispunct(previousChar) /* && isnormal(nextChar) */ :
- // [!"a] is probably an open
- *isOpen = true
- default:
- // [a'b] maybe a contraction?
- *isOpen = false
- }
-
- // Note that with the limited lookahead, this non-breaking
- // space will also be appended to single double quotes.
- if addNBSP && !*isOpen {
- out.WriteString("&nbsp;")
- }
-
- out.WriteByte('&')
- if *isOpen {
- out.WriteByte('l')
- } else {
- out.WriteByte('r')
- }
- out.WriteByte(quote)
- out.WriteString("quo;")
-
- if addNBSP && *isOpen {
- out.WriteString("&nbsp;")
- }
-
- return true
-}
-
-func smartSingleQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
- if len(text) >= 2 {
- t1 := tolower(text[1])
-
- if t1 == '\'' {
- nextChar := byte(0)
- if len(text) >= 3 {
- nextChar = text[2]
- }
- if smartQuoteHelper(out, previousChar, nextChar, 'd', &smrt.inDoubleQuote, false) {
- return 1
- }
- }
-
- if (t1 == 's' || t1 == 't' || t1 == 'm' || t1 == 'd') && (len(text) < 3 || wordBoundary(text[2])) {
- out.WriteString("&rsquo;")
- return 0
- }
-
- if len(text) >= 3 {
- t2 := tolower(text[2])
-
- if ((t1 == 'r' && t2 == 'e') || (t1 == 'l' && t2 == 'l') || (t1 == 'v' && t2 == 'e')) &&
- (len(text) < 4 || wordBoundary(text[3])) {
- out.WriteString("&rsquo;")
- return 0
- }
- }
- }
-
- nextChar := byte(0)
- if len(text) > 1 {
- nextChar = text[1]
- }
- if smartQuoteHelper(out, previousChar, nextChar, 's', &smrt.inSingleQuote, false) {
- return 0
- }
-
- out.WriteByte(text[0])
- return 0
-}
-
-func smartParens(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
- if len(text) >= 3 {
- t1 := tolower(text[1])
- t2 := tolower(text[2])
-
- if t1 == 'c' && t2 == ')' {
- out.WriteString("&copy;")
- return 2
- }
-
- if t1 == 'r' && t2 == ')' {
- out.WriteString("&reg;")
- return 2
- }
-
- if len(text) >= 4 && t1 == 't' && t2 == 'm' && text[3] == ')' {
- out.WriteString("&trade;")
- return 3
- }
- }
-
- out.WriteByte(text[0])
- return 0
-}
-
-func smartDash(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
- if len(text) >= 2 {
- if text[1] == '-' {
- out.WriteString("&mdash;")
- return 1
- }
-
- if wordBoundary(previousChar) && wordBoundary(text[1]) {
- out.WriteString("&ndash;")
- return 0
- }
- }
-
- out.WriteByte(text[0])
- return 0
-}
-
-func smartDashLatex(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
- if len(text) >= 3 && text[1] == '-' && text[2] == '-' {
- out.WriteString("&mdash;")
- return 2
- }
- if len(text) >= 2 && text[1] == '-' {
- out.WriteString("&ndash;")
- return 1
- }
-
- out.WriteByte(text[0])
- return 0
-}
-
-func smartAmpVariant(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte, quote byte, addNBSP bool) int {
- if bytes.HasPrefix(text, []byte("&quot;")) {
- nextChar := byte(0)
- if len(text) >= 7 {
- nextChar = text[6]
- }
- if smartQuoteHelper(out, previousChar, nextChar, quote, &smrt.inDoubleQuote, addNBSP) {
- return 5
- }
- }
-
- if bytes.HasPrefix(text, []byte("&#0;")) {
- return 3
- }
-
- out.WriteByte('&')
- return 0
-}
-
-func smartAmp(angledQuotes, addNBSP bool) func(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
- var quote byte = 'd'
- if angledQuotes {
- quote = 'a'
- }
-
- return func(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
- return smartAmpVariant(out, smrt, previousChar, text, quote, addNBSP)
- }
-}
-
-func smartPeriod(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
- if len(text) >= 3 && text[1] == '.' && text[2] == '.' {
- out.WriteString("&hellip;")
- return 2
- }
-
- if len(text) >= 5 && text[1] == ' ' && text[2] == '.' && text[3] == ' ' && text[4] == '.' {
- out.WriteString("&hellip;")
- return 4
- }
-
- out.WriteByte(text[0])
- return 0
-}
-
-func smartBacktick(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
- if len(text) >= 2 && text[1] == '`' {
- nextChar := byte(0)
- if len(text) >= 3 {
- nextChar = text[2]
- }
- if smartQuoteHelper(out, previousChar, nextChar, 'd', &smrt.inDoubleQuote, false) {
- return 1
- }
- }
-
- out.WriteByte(text[0])
- return 0
-}
-
-func smartNumberGeneric(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
- if wordBoundary(previousChar) && previousChar != '/' && len(text) >= 3 {
- // is it of the form digits/digits(word boundary)?, i.e., \d+/\d+\b
- // note: check for regular slash (/) or fraction slash (⁄, 0x2044, or 0xe2 81 84 in utf-8)
- // and avoid changing dates like 1/23/2005 into fractions.
- numEnd := 0
- for len(text) > numEnd && isdigit(text[numEnd]) {
- numEnd++
- }
- if numEnd == 0 {
- out.WriteByte(text[0])
- return 0
- }
- denStart := numEnd + 1
- if len(text) > numEnd+3 && text[numEnd] == 0xe2 && text[numEnd+1] == 0x81 && text[numEnd+2] == 0x84 {
- denStart = numEnd + 3
- } else if len(text) < numEnd+2 || text[numEnd] != '/' {
- out.WriteByte(text[0])
- return 0
- }
- denEnd := denStart
- for len(text) > denEnd && isdigit(text[denEnd]) {
- denEnd++
- }
- if denEnd == denStart {
- out.WriteByte(text[0])
- return 0
- }
- if len(text) == denEnd || wordBoundary(text[denEnd]) && text[denEnd] != '/' {
- out.WriteString("<sup>")
- out.Write(text[:numEnd])
- out.WriteString("</sup>&frasl;<sub>")
- out.Write(text[denStart:denEnd])
- out.WriteString("</sub>")
- return denEnd - 1
- }
- }
-
- out.WriteByte(text[0])
- return 0
-}
-
-func smartNumber(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
- if wordBoundary(previousChar) && previousChar != '/' && len(text) >= 3 {
- if text[0] == '1' && text[1] == '/' && text[2] == '2' {
- if len(text) < 4 || wordBoundary(text[3]) && text[3] != '/' {
- out.WriteString("&frac12;")
- return 2
- }
- }
-
- if text[0] == '1' && text[1] == '/' && text[2] == '4' {
- if len(text) < 4 || wordBoundary(text[3]) && text[3] != '/' || (len(text) >= 5 && tolower(text[3]) == 't' && tolower(text[4]) == 'h') {
- out.WriteString("&frac14;")
- return 2
- }
- }
-
- if text[0] == '3' && text[1] == '/' && text[2] == '4' {
- if len(text) < 4 || wordBoundary(text[3]) && text[3] != '/' || (len(text) >= 6 && tolower(text[3]) == 't' && tolower(text[4]) == 'h' && tolower(text[5]) == 's') {
- out.WriteString("&frac34;")
- return 2
- }
- }
- }
-
- out.WriteByte(text[0])
- return 0
-}
-
-func smartDoubleQuoteVariant(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte, quote byte) int {
- nextChar := byte(0)
- if len(text) > 1 {
- nextChar = text[1]
- }
- if !smartQuoteHelper(out, previousChar, nextChar, quote, &smrt.inDoubleQuote, false) {
- out.WriteString("&quot;")
- }
-
- return 0
-}
-
-func smartDoubleQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
- return smartDoubleQuoteVariant(out, smrt, previousChar, text, 'd')
-}
-
-func smartAngledDoubleQuote(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
- return smartDoubleQuoteVariant(out, smrt, previousChar, text, 'a')
-}
-
-func smartLeftAngle(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int {
- i := 0
-
- for i < len(text) && text[i] != '>' {
- i++
- }
-
- out.Write(text[:i+1])
- return i
-}
-
-type smartCallback func(out *bytes.Buffer, smrt *smartypantsData, previousChar byte, text []byte) int
-
-type smartypantsRenderer [256]smartCallback
-
-var (
- smartAmpAngled = smartAmp(true, false)
- smartAmpAngledNBSP = smartAmp(true, true)
- smartAmpRegular = smartAmp(false, false)
- smartAmpRegularNBSP = smartAmp(false, true)
-)
-
-func smartypants(flags int) *smartypantsRenderer {
- r := new(smartypantsRenderer)
- addNBSP := flags&HTML_SMARTYPANTS_QUOTES_NBSP != 0
- if flags&HTML_SMARTYPANTS_ANGLED_QUOTES == 0 {
- r['"'] = smartDoubleQuote
- if !addNBSP {
- r['&'] = smartAmpRegular
- } else {
- r['&'] = smartAmpRegularNBSP
- }
- } else {
- r['"'] = smartAngledDoubleQuote
- if !addNBSP {
- r['&'] = smartAmpAngled
- } else {
- r['&'] = smartAmpAngledNBSP
- }
- }
- r['\''] = smartSingleQuote
- r['('] = smartParens
- if flags&HTML_SMARTYPANTS_DASHES != 0 {
- if flags&HTML_SMARTYPANTS_LATEX_DASHES == 0 {
- r['-'] = smartDash
- } else {
- r['-'] = smartDashLatex
- }
- }
- r['.'] = smartPeriod
- if flags&HTML_SMARTYPANTS_FRACTIONS == 0 {
- r['1'] = smartNumber
- r['3'] = smartNumber
- } else {
- for ch := '1'; ch <= '9'; ch++ {
- r[ch] = smartNumberGeneric
- }
- }
- r['<'] = smartLeftAngle
- r['`'] = smartBacktick
- return r
-}
diff --git a/vendor/github.com/shurcooL/githubv4/.travis.yml b/vendor/github.com/shurcooL/githubv4/.travis.yml
deleted file mode 100644
index 437c57db..00000000
--- a/vendor/github.com/shurcooL/githubv4/.travis.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-sudo: false
-language: go
-go:
- - 1.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 vet ./...
- - go test -v -race ./...
diff --git a/vendor/github.com/shurcooL/githubv4/LICENSE b/vendor/github.com/shurcooL/githubv4/LICENSE
deleted file mode 100644
index ca4c7764..00000000
--- a/vendor/github.com/shurcooL/githubv4/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2017 Dmitri Shuralyov
-
-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/shurcooL/githubv4/README.md b/vendor/github.com/shurcooL/githubv4/README.md
deleted file mode 100644
index 319a6428..00000000
--- a/vendor/github.com/shurcooL/githubv4/README.md
+++ /dev/null
@@ -1,408 +0,0 @@
-githubv4
-========
-
-[![Build Status](https://travis-ci.org/shurcooL/githubv4.svg?branch=master)](https://travis-ci.org/shurcooL/githubv4) [![GoDoc](https://godoc.org/github.com/shurcooL/githubv4?status.svg)](https://godoc.org/github.com/shurcooL/githubv4)
-
-Package `githubv4` is a client library for accessing GitHub GraphQL API v4 (https://developer.github.com/v4/).
-
-If you're looking for a client library for GitHub REST API v3, the recommended package is [`github.com/google/go-github/github`](https://godoc.org/github.com/google/go-github/github).
-
-**Status:** In research and development. The API will change when opportunities for improvement are discovered; it is not yet frozen.
-
-Focus
------
-
-- Friendly, simple and powerful API.
-- Correctness, high performance and efficiency.
-- Support all of GitHub GraphQL API v4 via code generation from schema.
-
-Installation
-------------
-
-`githubv4` requires Go version 1.8 or later.
-
-```bash
-go get -u github.com/shurcooL/githubv4
-```
-
-Usage
------
-
-### Authentication
-
-GitHub GraphQL API v4 [requires authentication](https://developer.github.com/v4/guides/forming-calls/#authenticating-with-graphql). The `githubv4` package does not directly handle authentication. Instead, when creating a new client, you're expected to pass an `http.Client` that performs authentication. The easiest and recommended way to do this is to use the [`golang.org/x/oauth2`](https://golang.org/x/oauth2) package. You'll need an OAuth token from GitHub (for example, a [personal API token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/)) with the right scopes. Then:
-
-```Go
-import "golang.org/x/oauth2"
-
-func main() {
- src := oauth2.StaticTokenSource(
- &oauth2.Token{AccessToken: os.Getenv("GITHUB_TOKEN")},
- )
- httpClient := oauth2.NewClient(context.Background(), src)
-
- client := githubv4.NewClient(httpClient)
- // Use client...
-}
-```
-
-### Simple Query
-
-To make a query, you need to define a Go type that corresponds to the GitHub GraphQL schema, and contains the fields you're interested in querying. You can look up the GitHub GraphQL schema at https://developer.github.com/v4/query/.
-
-For example, to make the following GraphQL query:
-
-```GraphQL
-query {
- viewer {
- login
- createdAt
- }
-}
-```
-
-You can define this variable:
-
-```Go
-var query struct {
- Viewer struct {
- Login githubv4.String
- CreatedAt githubv4.DateTime
- }
-}
-```
-
-Then call `client.Query`, passing a pointer to it:
-
-```Go
-err := client.Query(context.Background(), &query, nil)
-if err != nil {
- // Handle error.
-}
-fmt.Println(" Login:", query.Viewer.Login)
-fmt.Println("CreatedAt:", query.Viewer.CreatedAt)
-
-// Output:
-// Login: gopher
-// CreatedAt: 2017-05-26 21:17:14 +0000 UTC
-```
-
-### Scalar Types
-
-For each scalar in the GitHub GraphQL schema listed at https://developer.github.com/v4/scalar/, there is a corresponding Go type in package `githubv4`.
-
-You can use these types when writing queries:
-
-```Go
-var query struct {
- Viewer struct {
- Login githubv4.String
- CreatedAt githubv4.DateTime
- IsBountyHunter githubv4.Boolean
- BioHTML githubv4.HTML
- WebsiteURL githubv4.URI
- }
-}
-// Call client.Query() and use results in query...
-```
-
-However, depending on how you're planning to use the results of your query, it's often more convenient to use other Go types.
-
-The `encoding/json` rules are used for converting individual JSON-encoded fields from a GraphQL response into Go values. See https://godoc.org/encoding/json#Unmarshal for details. The [`json.Unmarshaler`](https://godoc.org/encoding/json#Unmarshaler) interface is respected.
-
-That means you can simplify the earlier query by using predeclared Go types:
-
-```Go
-// import "time"
-
-var query struct {
- Viewer struct {
- Login string // E.g., "gopher".
- CreatedAt time.Time // E.g., time.Date(2017, 5, 26, 21, 17, 14, 0, time.UTC).
- IsBountyHunter bool // E.g., true.
- BioHTML string // E.g., `I am learning <a href="https://graphql.org">GraphQL</a>!`.
- WebsiteURL string // E.g., "https://golang.org".
- }
-}
-// Call client.Query() and use results in query...
-```
-
-The [`DateTime`](https://developer.github.com/v4/scalar/datetime/) scalar is described as "an ISO-8601 encoded UTC date string". If you wanted to fetch in that form without parsing it into a `time.Time`, you can use the `string` type. For example, this would work:
-
-```Go
-// import "html/template"
-
-type MyBoolean bool
-
-var query struct {
- Viewer struct {
- Login string // E.g., "gopher".
- CreatedAt string // E.g., "2017-05-26T21:17:14Z".
- IsBountyHunter MyBoolean // E.g., MyBoolean(true).
- BioHTML template.HTML // E.g., template.HTML(`I am learning <a href="https://graphql.org">GraphQL</a>!`).
- WebsiteURL template.URL // E.g., template.URL("https://golang.org").
- }
-}
-// Call client.Query() and use results in query...
-```
-
-### Arguments and Variables
-
-Often, you'll want to specify arguments on some fields. You can use the `graphql` struct field tag for this.
-
-For example, to make the following GraphQL query:
-
-```GraphQL
-{
- repository(owner: "octocat", name: "Hello-World") {
- description
- }
-}
-```
-
-You can define this variable:
-
-```Go
-var q struct {
- Repository struct {
- Description string
- } `graphql:"repository(owner: \"octocat\", name: \"Hello-World\")"`
-}
-```
-
-Then call `client.Query`:
-
-```Go
-err := client.Query(context.Background(), &q, nil)
-if err != nil {
- // Handle error.
-}
-fmt.Println(q.Repository.Description)
-
-// Output:
-// My first repository on GitHub!
-```
-
-However, that'll only work if the arguments are constant and known in advance. Otherwise, you will need to make use of variables. Replace the constants in the struct field tag with variable names:
-
-```Go
-// fetchRepoDescription fetches description of repo with owner and name.
-func fetchRepoDescription(ctx context.Context, owner, name string) (string, error) {
- var q struct {
- Repository struct {
- Description string
- } `graphql:"repository(owner: $owner, name: $name)"`
- }
-```
-
-When sending variables to GraphQL, you need to use exact types that match GraphQL scalar types, otherwise the GraphQL server will return an error.
-
-So, define a `variables` map with their values that are converted to GraphQL scalar types:
-
-```Go
- variables := map[string]interface{}{
- "owner": githubv4.String(owner),
- "name": githubv4.String(name),
- }
-```
-
-Finally, call `client.Query` providing `variables`:
-
-```Go
- err := client.Query(ctx, &q, variables)
- return q.Repository.Description, err
-}
-```
-
-### Inline Fragments
-
-Some GraphQL queries contain inline fragments. You can use the `graphql` struct field tag to express them.
-
-For example, to make the following GraphQL query:
-
-```GraphQL
-{
- repositoryOwner(login: "github") {
- login
- ... on Organization {
- description
- }
- ... on User {
- bio
- }
- }
-}
-```
-
-You can define this variable:
-
-```Go
-var q struct {
- RepositoryOwner struct {
- Login string
- Organization struct {
- Description string
- } `graphql:"... on Organization"`
- User struct {
- Bio string
- } `graphql:"... on User"`
- } `graphql:"repositoryOwner(login: \"github\")"`
-}
-```
-
-Alternatively, you can define the struct types corresponding to inline fragments, and use them as embedded fields in your query:
-
-```Go
-type (
- OrganizationFragment struct {
- Description string
- }
- UserFragment struct {
- Bio string
- }
-)
-
-var q struct {
- RepositoryOwner struct {
- Login string
- OrganizationFragment `graphql:"... on Organization"`
- UserFragment `graphql:"... on User"`
- } `graphql:"repositoryOwner(login: \"github\")"`
-}
-```
-
-Then call `client.Query`:
-
-```Go
-err := client.Query(context.Background(), &q, nil)
-if err != nil {
- // Handle error.
-}
-fmt.Println(q.RepositoryOwner.Login)
-fmt.Println(q.RepositoryOwner.Description)
-fmt.Println(q.RepositoryOwner.Bio)
-
-// Output:
-// github
-// How people build software.
-//
-```
-
-### Pagination
-
-Imagine you wanted to get a complete list of comments in an issue, and not just the first 10 or so. To do that, you'll need to perform multiple queries and use pagination information. For example:
-
-```Go
-type comment struct {
- Body string
- Author struct {
- Login string
- AvatarURL string `graphql:"avatarUrl(size: 72)"`
- }
- ViewerCanReact bool
-}
-var q struct {
- Repository struct {
- Issue struct {
- Comments struct {
- Nodes []comment
- PageInfo struct {
- EndCursor githubv4.String
- HasNextPage bool
- }
- } `graphql:"comments(first: 100, after: $commentsCursor)"` // 100 per page.
- } `graphql:"issue(number: $issueNumber)"`
- } `graphql:"repository(owner: $repositoryOwner, name: $repositoryName)"`
-}
-variables := map[string]interface{}{
- "repositoryOwner": githubv4.String(owner),
- "repositoryName": githubv4.String(name),
- "issueNumber": githubv4.Int(issue),
- "commentsCursor": (*githubv4.String)(nil), // Null after argument to get first page.
-}
-
-// Get comments from all pages.
-var allComments []comment
-for {
- err := s.clQL.Query(ctx, &q, variables)
- if err != nil {
- return err
- }
- allComments = append(allComments, q.Repository.Issue.Comments.Nodes...)
- if !q.Repository.Issue.Comments.PageInfo.HasNextPage {
- break
- }
- variables["commentsCursor"] = githubv4.NewString(q.Repository.Issue.Comments.PageInfo.EndCursor)
-}
-```
-
-There is more than one way to perform pagination. Consider additional fields inside [`PageInfo`](https://developer.github.com/v4/object/pageinfo/) object.
-
-### Mutations
-
-Mutations often require information that you can only find out by performing a query first. Let's suppose you've already done that.
-
-For example, to make the following GraphQL mutation:
-
-```GraphQL
-mutation($input: AddReactionInput!) {
- addReaction(input: $input) {
- reaction {
- content
- }
- subject {
- id
- }
- }
-}
-variables {
- "input": {
- "subjectId": "MDU6SXNzdWUyMTc5NTQ0OTc=",
- "content": "HOORAY"
- }
-}
-```
-
-You can define:
-
-```Go
-var m struct {
- AddReaction struct {
- Reaction struct {
- Content githubv4.ReactionContent
- }
- Subject struct {
- ID githubv4.ID
- }
- } `graphql:"addReaction(input: $input)"`
-}
-input := githubv4.AddReactionInput{
- SubjectID: targetIssue.ID, // ID of the target issue from a previous query.
- Content: githubv4.ReactionContentHooray,
-}
-```
-
-Then call `client.Mutate`:
-
-```Go
-err := client.Mutate(context.Background(), &m, input, nil)
-if err != nil {
- // Handle error.
-}
-fmt.Printf("Added a %v reaction to subject with ID %#v!\n", m.AddReaction.Reaction.Content, m.AddReaction.Subject.ID)
-
-// Output:
-// Added a HOORAY reaction to subject with ID "MDU6SXNzdWUyMTc5NTQ0OTc="!
-```
-
-Directories
------------
-
-| Path | Synopsis |
-|-------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|
-| [example/githubv4dev](https://godoc.org/github.com/shurcooL/githubv4/example/githubv4dev) | githubv4dev is a test program currently being used for developing githubv4 package. |
-
-License
--------
-
-- [MIT License](LICENSE)
diff --git a/vendor/github.com/shurcooL/githubv4/doc.go b/vendor/github.com/shurcooL/githubv4/doc.go
deleted file mode 100644
index 0ce1a508..00000000
--- a/vendor/github.com/shurcooL/githubv4/doc.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// Package githubv4 is a client library for accessing GitHub
-// GraphQL API v4 (https://developer.github.com/v4/).
-//
-// If you're looking for a client library for GitHub REST API v3,
-// the recommended package is github.com/google/go-github/github.
-//
-// Status: In active early research and development. The API will change when
-// opportunities for improvement are discovered; it is not yet frozen.
-//
-// For now, see README for more details.
-package githubv4 // import "github.com/shurcooL/githubv4"
-
-//go:generate go run gen.go
diff --git a/vendor/github.com/shurcooL/githubv4/enum.go b/vendor/github.com/shurcooL/githubv4/enum.go
deleted file mode 100644
index 0ab92800..00000000
--- a/vendor/github.com/shurcooL/githubv4/enum.go
+++ /dev/null
@@ -1,795 +0,0 @@
-// Code generated by gen.go; DO NOT EDIT.
-
-package githubv4
-
-// CollaboratorAffiliation represents collaborators affiliation level with a subject.
-type CollaboratorAffiliation string
-
-// Collaborators affiliation level with a subject.
-const (
- CollaboratorAffiliationOutside CollaboratorAffiliation = "OUTSIDE" // All outside collaborators of an organization-owned subject.
- CollaboratorAffiliationDirect CollaboratorAffiliation = "DIRECT" // All collaborators with permissions to an organization-owned subject, regardless of organization membership status.
- CollaboratorAffiliationAll CollaboratorAffiliation = "ALL" // All collaborators the authenticated user can see.
-)
-
-// CommentAuthorAssociation represents a comment author association with repository.
-type CommentAuthorAssociation string
-
-// A comment author association with repository.
-const (
- CommentAuthorAssociationMember CommentAuthorAssociation = "MEMBER" // Author is a member of the organization that owns the repository.
- CommentAuthorAssociationOwner CommentAuthorAssociation = "OWNER" // Author is the owner of the repository.
- CommentAuthorAssociationCollaborator CommentAuthorAssociation = "COLLABORATOR" // Author has been invited to collaborate on the repository.
- CommentAuthorAssociationContributor CommentAuthorAssociation = "CONTRIBUTOR" // Author has previously committed to the repository.
- CommentAuthorAssociationFirstTimeContributor CommentAuthorAssociation = "FIRST_TIME_CONTRIBUTOR" // Author has not previously committed to the repository.
- CommentAuthorAssociationFirstTimer CommentAuthorAssociation = "FIRST_TIMER" // Author has not previously committed to GitHub.
- CommentAuthorAssociationNone CommentAuthorAssociation = "NONE" // Author has no association with the repository.
-)
-
-// CommentCannotUpdateReason represents the possible errors that will prevent a user from updating a comment.
-type CommentCannotUpdateReason string
-
-// The possible errors that will prevent a user from updating a comment.
-const (
- CommentCannotUpdateReasonInsufficientAccess CommentCannotUpdateReason = "INSUFFICIENT_ACCESS" // You must be the author or have write access to this repository to update this comment.
- CommentCannotUpdateReasonLocked CommentCannotUpdateReason = "LOCKED" // Unable to create comment because issue is locked.
- CommentCannotUpdateReasonLoginRequired CommentCannotUpdateReason = "LOGIN_REQUIRED" // You must be logged in to update this comment.
- CommentCannotUpdateReasonMaintenance CommentCannotUpdateReason = "MAINTENANCE" // Repository is under maintenance.
- CommentCannotUpdateReasonVerifiedEmailRequired CommentCannotUpdateReason = "VERIFIED_EMAIL_REQUIRED" // At least one email address must be verified to update this comment.
- CommentCannotUpdateReasonDenied CommentCannotUpdateReason = "DENIED" // You cannot update this comment.
-)
-
-// CommitContributionOrderField represents properties by which commit contribution connections can be ordered.
-type CommitContributionOrderField string
-
-// Properties by which commit contribution connections can be ordered.
-const (
- CommitContributionOrderFieldOccurredAt CommitContributionOrderField = "OCCURRED_AT" // Order commit contributions by when they were made.
- CommitContributionOrderFieldCommitCount CommitContributionOrderField = "COMMIT_COUNT" // Order commit contributions by how many commits they represent.
-)
-
-// ContributionOrderField represents properties by which contribution connections can be ordered.
-type ContributionOrderField string
-
-// Properties by which contribution connections can be ordered.
-const (
- ContributionOrderFieldOccurredAt ContributionOrderField = "OCCURRED_AT" // Order contributions by when they were made.
-)
-
-// DefaultRepositoryPermissionField represents the possible default permissions for repositories.
-type DefaultRepositoryPermissionField string
-
-// The possible default permissions for repositories.
-const (
- DefaultRepositoryPermissionFieldNone DefaultRepositoryPermissionField = "NONE" // No access.
- DefaultRepositoryPermissionFieldRead DefaultRepositoryPermissionField = "READ" // Can read repos by default.
- DefaultRepositoryPermissionFieldWrite DefaultRepositoryPermissionField = "WRITE" // Can read and write repos by default.
- DefaultRepositoryPermissionFieldAdmin DefaultRepositoryPermissionField = "ADMIN" // Can read, write, and administrate repos by default.
-)
-
-// DeploymentOrderField represents properties by which deployment connections can be ordered.
-type DeploymentOrderField string
-
-// Properties by which deployment connections can be ordered.
-const (
- DeploymentOrderFieldCreatedAt DeploymentOrderField = "CREATED_AT" // Order collection by creation time.
-)
-
-// DeploymentState represents the possible states in which a deployment can be.
-type DeploymentState string
-
-// The possible states in which a deployment can be.
-const (
- DeploymentStateAbandoned DeploymentState = "ABANDONED" // The pending deployment was not updated after 30 minutes.
- DeploymentStateActive DeploymentState = "ACTIVE" // The deployment is currently active.
- DeploymentStateDestroyed DeploymentState = "DESTROYED" // An inactive transient deployment.
- DeploymentStateError DeploymentState = "ERROR" // The deployment experienced an error.
- DeploymentStateFailure DeploymentState = "FAILURE" // The deployment has failed.
- DeploymentStateInactive DeploymentState = "INACTIVE" // The deployment is inactive.
- DeploymentStatePending DeploymentState = "PENDING" // The deployment is pending.
- DeploymentStateQueued DeploymentState = "QUEUED" // The deployment has queued.
- DeploymentStateInProgress DeploymentState = "IN_PROGRESS" // The deployment is in progress.
-)
-
-// DeploymentStatusState represents the possible states for a deployment status.
-type DeploymentStatusState string
-
-// The possible states for a deployment status.
-const (
- DeploymentStatusStatePending DeploymentStatusState = "PENDING" // The deployment is pending.
- DeploymentStatusStateSuccess DeploymentStatusState = "SUCCESS" // The deployment was successful.
- DeploymentStatusStateFailure DeploymentStatusState = "FAILURE" // The deployment has failed.
- DeploymentStatusStateInactive DeploymentStatusState = "INACTIVE" // The deployment is inactive.
- DeploymentStatusStateError DeploymentStatusState = "ERROR" // The deployment experienced an error.
- DeploymentStatusStateQueued DeploymentStatusState = "QUEUED" // The deployment is queued.
- DeploymentStatusStateInProgress DeploymentStatusState = "IN_PROGRESS" // The deployment is in progress.
-)
-
-// GistOrderField represents properties by which gist connections can be ordered.
-type GistOrderField string
-
-// Properties by which gist connections can be ordered.
-const (
- GistOrderFieldCreatedAt GistOrderField = "CREATED_AT" // Order gists by creation time.
- GistOrderFieldUpdatedAt GistOrderField = "UPDATED_AT" // Order gists by update time.
- GistOrderFieldPushedAt GistOrderField = "PUSHED_AT" // Order gists by push time.
-)
-
-// GistPrivacy represents the privacy of a Gist.
-type GistPrivacy string
-
-// The privacy of a Gist.
-const (
- GistPrivacyPublic GistPrivacy = "PUBLIC" // Public.
- GistPrivacySecret GistPrivacy = "SECRET" // Secret.
- GistPrivacyAll GistPrivacy = "ALL" // Gists that are public and secret.
-)
-
-// GitSignatureState represents the state of a Git signature.
-type GitSignatureState string
-
-// The state of a Git signature.
-const (
- GitSignatureStateValid GitSignatureState = "VALID" // Valid signature and verified by GitHub.
- GitSignatureStateInvalid GitSignatureState = "INVALID" // Invalid signature.
- GitSignatureStateMalformedSig GitSignatureState = "MALFORMED_SIG" // Malformed signature.
- GitSignatureStateUnknownKey GitSignatureState = "UNKNOWN_KEY" // Key used for signing not known to GitHub.
- GitSignatureStateBadEmail GitSignatureState = "BAD_EMAIL" // Invalid email used for signing.
- GitSignatureStateUnverifiedEmail GitSignatureState = "UNVERIFIED_EMAIL" // Email used for signing unverified on GitHub.
- GitSignatureStateNoUser GitSignatureState = "NO_USER" // Email used for signing not known to GitHub.
- GitSignatureStateUnknownSigType GitSignatureState = "UNKNOWN_SIG_TYPE" // Unknown signature type.
- GitSignatureStateUnsigned GitSignatureState = "UNSIGNED" // Unsigned.
- GitSignatureStateGpgverifyUnavailable GitSignatureState = "GPGVERIFY_UNAVAILABLE" // Internal error - the GPG verification service is unavailable at the moment.
- GitSignatureStateGpgverifyError GitSignatureState = "GPGVERIFY_ERROR" // Internal error - the GPG verification service misbehaved.
- GitSignatureStateNotSigningKey GitSignatureState = "NOT_SIGNING_KEY" // The usage flags for the key that signed this don't allow signing.
- GitSignatureStateExpiredKey GitSignatureState = "EXPIRED_KEY" // Signing key expired.
- GitSignatureStateOcspPending GitSignatureState = "OCSP_PENDING" // Valid signature, pending certificate revocation checking.
- GitSignatureStateOcspError GitSignatureState = "OCSP_ERROR" // Valid siganture, though certificate revocation check failed.
- GitSignatureStateBadCert GitSignatureState = "BAD_CERT" // The signing certificate or its chain could not be verified.
- GitSignatureStateOcspRevoked GitSignatureState = "OCSP_REVOKED" // One or more certificates in chain has been revoked.
-)
-
-// IdentityProviderConfigurationState represents the possible states in which authentication can be configured with an identity provider.
-type IdentityProviderConfigurationState string
-
-// The possible states in which authentication can be configured with an identity provider.
-const (
- IdentityProviderConfigurationStateEnforced IdentityProviderConfigurationState = "ENFORCED" // Authentication with an identity provider is configured and enforced.
- IdentityProviderConfigurationStateConfigured IdentityProviderConfigurationState = "CONFIGURED" // Authentication with an identity provider is configured but not enforced.
- IdentityProviderConfigurationStateUnconfigured IdentityProviderConfigurationState = "UNCONFIGURED" // Authentication with an identity provider is not configured.
-)
-
-// IssueOrderField represents properties by which issue connections can be ordered.
-type IssueOrderField string
-
-// Properties by which issue connections can be ordered.
-const (
- IssueOrderFieldCreatedAt IssueOrderField = "CREATED_AT" // Order issues by creation time.
- IssueOrderFieldUpdatedAt IssueOrderField = "UPDATED_AT" // Order issues by update time.
- IssueOrderFieldComments IssueOrderField = "COMMENTS" // Order issues by comment count.
-)
-
-// IssuePubSubTopic represents the possible PubSub channels for an issue.
-type IssuePubSubTopic string
-
-// The possible PubSub channels for an issue.
-const (
- IssuePubSubTopicUpdated IssuePubSubTopic = "UPDATED" // The channel ID for observing issue updates.
- IssuePubSubTopicMarkasread IssuePubSubTopic = "MARKASREAD" // The channel ID for marking an issue as read.
- IssuePubSubTopicTimeline IssuePubSubTopic = "TIMELINE" // The channel ID for updating items on the issue timeline.
- IssuePubSubTopicState IssuePubSubTopic = "STATE" // The channel ID for observing issue state updates.
-)
-
-// IssueState represents the possible states of an issue.
-type IssueState string
-
-// The possible states of an issue.
-const (
- IssueStateOpen IssueState = "OPEN" // An issue that is still open.
- IssueStateClosed IssueState = "CLOSED" // An issue that has been closed.
-)
-
-// IssueTimelineItemsItemType represents the possible item types found in a timeline.
-type IssueTimelineItemsItemType string
-
-// The possible item types found in a timeline.
-const (
- IssueTimelineItemsItemTypeIssueComment IssueTimelineItemsItemType = "ISSUE_COMMENT" // Represents a comment on an Issue.
- IssueTimelineItemsItemTypeCrossReferencedEvent IssueTimelineItemsItemType = "CROSS_REFERENCED_EVENT" // Represents a mention made by one issue or pull request to another.
- IssueTimelineItemsItemTypeAddedToProjectEvent IssueTimelineItemsItemType = "ADDED_TO_PROJECT_EVENT" // Represents a 'added_to_project' event on a given issue or pull request.
- IssueTimelineItemsItemTypeAssignedEvent IssueTimelineItemsItemType = "ASSIGNED_EVENT" // Represents an 'assigned' event on any assignable object.
- IssueTimelineItemsItemTypeClosedEvent IssueTimelineItemsItemType = "CLOSED_EVENT" // Represents a 'closed' event on any `Closable`.
- IssueTimelineItemsItemTypeCommentDeletedEvent IssueTimelineItemsItemType = "COMMENT_DELETED_EVENT" // Represents a 'comment_deleted' event on a given issue or pull request.
- IssueTimelineItemsItemTypeConvertedNoteToIssueEvent IssueTimelineItemsItemType = "CONVERTED_NOTE_TO_ISSUE_EVENT" // Represents a 'converted_note_to_issue' event on a given issue or pull request.
- IssueTimelineItemsItemTypeDemilestonedEvent IssueTimelineItemsItemType = "DEMILESTONED_EVENT" // Represents a 'demilestoned' event on a given issue or pull request.
- IssueTimelineItemsItemTypeLabeledEvent IssueTimelineItemsItemType = "LABELED_EVENT" // Represents a 'labeled' event on a given issue or pull request.
- IssueTimelineItemsItemTypeLockedEvent IssueTimelineItemsItemType = "LOCKED_EVENT" // Represents a 'locked' event on a given issue or pull request.
- IssueTimelineItemsItemTypeMentionedEvent IssueTimelineItemsItemType = "MENTIONED_EVENT" // Represents a 'mentioned' event on a given issue or pull request.
- IssueTimelineItemsItemTypeMilestonedEvent IssueTimelineItemsItemType = "MILESTONED_EVENT" // Represents a 'milestoned' event on a given issue or pull request.
- IssueTimelineItemsItemTypeMovedColumnsInProjectEvent IssueTimelineItemsItemType = "MOVED_COLUMNS_IN_PROJECT_EVENT" // Represents a 'moved_columns_in_project' event on a given issue or pull request.
- IssueTimelineItemsItemTypePinnedEvent IssueTimelineItemsItemType = "PINNED_EVENT" // Represents a 'pinned' event on a given issue or pull request.
- IssueTimelineItemsItemTypeReferencedEvent IssueTimelineItemsItemType = "REFERENCED_EVENT" // Represents a 'referenced' event on a given `ReferencedSubject`.
- IssueTimelineItemsItemTypeRemovedFromProjectEvent IssueTimelineItemsItemType = "REMOVED_FROM_PROJECT_EVENT" // Represents a 'removed_from_project' event on a given issue or pull request.
- IssueTimelineItemsItemTypeRenamedTitleEvent IssueTimelineItemsItemType = "RENAMED_TITLE_EVENT" // Represents a 'renamed' event on a given issue or pull request.
- IssueTimelineItemsItemTypeReopenedEvent IssueTimelineItemsItemType = "REOPENED_EVENT" // Represents a 'reopened' event on any `Closable`.
- IssueTimelineItemsItemTypeSubscribedEvent IssueTimelineItemsItemType = "SUBSCRIBED_EVENT" // Represents a 'subscribed' event on a given `Subscribable`.
- IssueTimelineItemsItemTypeTransferredEvent IssueTimelineItemsItemType = "TRANSFERRED_EVENT" // Represents a 'transferred' event on a given issue or pull request.
- IssueTimelineItemsItemTypeUnassignedEvent IssueTimelineItemsItemType = "UNASSIGNED_EVENT" // Represents an 'unassigned' event on any assignable object.
- IssueTimelineItemsItemTypeUnlabeledEvent IssueTimelineItemsItemType = "UNLABELED_EVENT" // Represents an 'unlabeled' event on a given issue or pull request.
- IssueTimelineItemsItemTypeUnlockedEvent IssueTimelineItemsItemType = "UNLOCKED_EVENT" // Represents an 'unlocked' event on a given issue or pull request.
- IssueTimelineItemsItemTypeUserBlockedEvent IssueTimelineItemsItemType = "USER_BLOCKED_EVENT" // Represents a 'user_blocked' event on a given user.
- IssueTimelineItemsItemTypeUnpinnedEvent IssueTimelineItemsItemType = "UNPINNED_EVENT" // Represents an 'unpinned' event on a given issue or pull request.
- IssueTimelineItemsItemTypeUnsubscribedEvent IssueTimelineItemsItemType = "UNSUBSCRIBED_EVENT" // Represents an 'unsubscribed' event on a given `Subscribable`.
-)
-
-// LanguageOrderField represents properties by which language connections can be ordered.
-type LanguageOrderField string
-
-// Properties by which language connections can be ordered.
-const (
- LanguageOrderFieldSize LanguageOrderField = "SIZE" // Order languages by the size of all files containing the language.
-)
-
-// LockReason represents the possible reasons that an issue or pull request was locked.
-type LockReason string
-
-// The possible reasons that an issue or pull request was locked.
-const (
- LockReasonOffTopic LockReason = "OFF_TOPIC" // The issue or pull request was locked because the conversation was off-topic.
- LockReasonTooHeated LockReason = "TOO_HEATED" // The issue or pull request was locked because the conversation was too heated.
- LockReasonResolved LockReason = "RESOLVED" // The issue or pull request was locked because the conversation was resolved.
- LockReasonSpam LockReason = "SPAM" // The issue or pull request was locked because the conversation was spam.
-)
-
-// MergeableState represents whether or not a PullRequest can be merged.
-type MergeableState string
-
-// Whether or not a PullRequest can be merged.
-const (
- MergeableStateMergeable MergeableState = "MERGEABLE" // The pull request can be merged.
- MergeableStateConflicting MergeableState = "CONFLICTING" // The pull request cannot be merged due to merge conflicts.
- MergeableStateUnknown MergeableState = "UNKNOWN" // The mergeability of the pull request is still being calculated.
-)
-
-// MilestoneOrderField represents properties by which milestone connections can be ordered.
-type MilestoneOrderField string
-
-// Properties by which milestone connections can be ordered.
-const (
- MilestoneOrderFieldDueDate MilestoneOrderField = "DUE_DATE" // Order milestones by when they are due.
- MilestoneOrderFieldCreatedAt MilestoneOrderField = "CREATED_AT" // Order milestones by when they were created.
- MilestoneOrderFieldUpdatedAt MilestoneOrderField = "UPDATED_AT" // Order milestones by when they were last updated.
- MilestoneOrderFieldNumber MilestoneOrderField = "NUMBER" // Order milestones by their number.
-)
-
-// MilestoneState represents the possible states of a milestone.
-type MilestoneState string
-
-// The possible states of a milestone.
-const (
- MilestoneStateOpen MilestoneState = "OPEN" // A milestone that is still open.
- MilestoneStateClosed MilestoneState = "CLOSED" // A milestone that has been closed.
-)
-
-// OrderDirection represents possible directions in which to order a list of items when provided an `orderBy` argument.
-type OrderDirection string
-
-// Possible directions in which to order a list of items when provided an `orderBy` argument.
-const (
- OrderDirectionAsc OrderDirection = "ASC" // Specifies an ascending order for a given `orderBy` argument.
- OrderDirectionDesc OrderDirection = "DESC" // Specifies a descending order for a given `orderBy` argument.
-)
-
-// OrganizationInvitationRole represents the possible organization invitation roles.
-type OrganizationInvitationRole string
-
-// The possible organization invitation roles.
-const (
- OrganizationInvitationRoleDirectMember OrganizationInvitationRole = "DIRECT_MEMBER" // The user is invited to be a direct member of the organization.
- OrganizationInvitationRoleAdmin OrganizationInvitationRole = "ADMIN" // The user is invited to be an admin of the organization.
- OrganizationInvitationRoleBillingManager OrganizationInvitationRole = "BILLING_MANAGER" // The user is invited to be a billing manager of the organization.
- OrganizationInvitationRoleReinstate OrganizationInvitationRole = "REINSTATE" // The user's previous role will be reinstated.
-)
-
-// OrganizationInvitationType represents the possible organization invitation types.
-type OrganizationInvitationType string
-
-// The possible organization invitation types.
-const (
- OrganizationInvitationTypeUser OrganizationInvitationType = "USER" // The invitation was to an existing user.
- OrganizationInvitationTypeEmail OrganizationInvitationType = "EMAIL" // The invitation was to an email address.
-)
-
-// OrganizationMemberRole represents the possible roles within an organization for its members.
-type OrganizationMemberRole string
-
-// The possible roles within an organization for its members.
-const (
- OrganizationMemberRoleMember OrganizationMemberRole = "MEMBER" // The user is a member of the organization.
- OrganizationMemberRoleAdmin OrganizationMemberRole = "ADMIN" // The user is an administrator of the organization.
-)
-
-// PinnableItemType represents represents items that can be pinned to a profile page or dashboard.
-type PinnableItemType string
-
-// Represents items that can be pinned to a profile page or dashboard.
-const (
- PinnableItemTypeRepository PinnableItemType = "REPOSITORY" // A repository.
- PinnableItemTypeGist PinnableItemType = "GIST" // A gist.
- PinnableItemTypeIssue PinnableItemType = "ISSUE" // An issue.
-)
-
-// ProjectCardArchivedState represents the possible archived states of a project card.
-type ProjectCardArchivedState string
-
-// The possible archived states of a project card.
-const (
- ProjectCardArchivedStateArchived ProjectCardArchivedState = "ARCHIVED" // A project card that is archived.
- ProjectCardArchivedStateNotArchived ProjectCardArchivedState = "NOT_ARCHIVED" // A project card that is not archived.
-)
-
-// ProjectCardState represents various content states of a ProjectCard.
-type ProjectCardState string
-
-// Various content states of a ProjectCard.
-const (
- ProjectCardStateContentOnly ProjectCardState = "CONTENT_ONLY" // The card has content only.
- ProjectCardStateNoteOnly ProjectCardState = "NOTE_ONLY" // The card has a note only.
- ProjectCardStateRedacted ProjectCardState = "REDACTED" // The card is redacted.
-)
-
-// ProjectColumnPurpose represents the semantic purpose of the column - todo, in progress, or done.
-type ProjectColumnPurpose string
-
-// The semantic purpose of the column - todo, in progress, or done.
-const (
- ProjectColumnPurposeTodo ProjectColumnPurpose = "TODO" // The column contains cards still to be worked on.
- ProjectColumnPurposeInProgress ProjectColumnPurpose = "IN_PROGRESS" // The column contains cards which are currently being worked on.
- ProjectColumnPurposeDone ProjectColumnPurpose = "DONE" // The column contains cards which are complete.
-)
-
-// ProjectOrderField represents properties by which project connections can be ordered.
-type ProjectOrderField string
-
-// Properties by which project connections can be ordered.
-const (
- ProjectOrderFieldCreatedAt ProjectOrderField = "CREATED_AT" // Order projects by creation time.
- ProjectOrderFieldUpdatedAt ProjectOrderField = "UPDATED_AT" // Order projects by update time.
- ProjectOrderFieldName ProjectOrderField = "NAME" // Order projects by name.
-)
-
-// ProjectState represents state of the project; either 'open' or 'closed'.
-type ProjectState string
-
-// State of the project; either 'open' or 'closed'.
-const (
- ProjectStateOpen ProjectState = "OPEN" // The project is open.
- ProjectStateClosed ProjectState = "CLOSED" // The project is closed.
-)
-
-// PullRequestOrderField represents properties by which pull_requests connections can be ordered.
-type PullRequestOrderField string
-
-// Properties by which pull_requests connections can be ordered.
-const (
- PullRequestOrderFieldCreatedAt PullRequestOrderField = "CREATED_AT" // Order pull_requests by creation time.
- PullRequestOrderFieldUpdatedAt PullRequestOrderField = "UPDATED_AT" // Order pull_requests by update time.
-)
-
-// PullRequestPubSubTopic represents the possible PubSub channels for a pull request.
-type PullRequestPubSubTopic string
-
-// The possible PubSub channels for a pull request.
-const (
- PullRequestPubSubTopicUpdated PullRequestPubSubTopic = "UPDATED" // The channel ID for observing pull request updates.
- PullRequestPubSubTopicMarkasread PullRequestPubSubTopic = "MARKASREAD" // The channel ID for marking an pull request as read.
- PullRequestPubSubTopicHeadRef PullRequestPubSubTopic = "HEAD_REF" // The channel ID for observing head ref updates.
- PullRequestPubSubTopicTimeline PullRequestPubSubTopic = "TIMELINE" // The channel ID for updating items on the pull request timeline.
- PullRequestPubSubTopicState PullRequestPubSubTopic = "STATE" // The channel ID for observing pull request state updates.
-)
-
-// PullRequestReviewCommentState represents the possible states of a pull request review comment.
-type PullRequestReviewCommentState string
-
-// The possible states of a pull request review comment.
-const (
- PullRequestReviewCommentStatePending PullRequestReviewCommentState = "PENDING" // A comment that is part of a pending review.
- PullRequestReviewCommentStateSubmitted PullRequestReviewCommentState = "SUBMITTED" // A comment that is part of a submitted review.
-)
-
-// PullRequestReviewEvent represents the possible events to perform on a pull request review.
-type PullRequestReviewEvent string
-
-// The possible events to perform on a pull request review.
-const (
- PullRequestReviewEventComment PullRequestReviewEvent = "COMMENT" // Submit general feedback without explicit approval.
- PullRequestReviewEventApprove PullRequestReviewEvent = "APPROVE" // Submit feedback and approve merging these changes.
- PullRequestReviewEventRequestChanges PullRequestReviewEvent = "REQUEST_CHANGES" // Submit feedback that must be addressed before merging.
- PullRequestReviewEventDismiss PullRequestReviewEvent = "DISMISS" // Dismiss review so it now longer effects merging.
-)
-
-// PullRequestReviewState represents the possible states of a pull request review.
-type PullRequestReviewState string
-
-// The possible states of a pull request review.
-const (
- PullRequestReviewStatePending PullRequestReviewState = "PENDING" // A review that has not yet been submitted.
- PullRequestReviewStateCommented PullRequestReviewState = "COMMENTED" // An informational review.
- PullRequestReviewStateApproved PullRequestReviewState = "APPROVED" // A review allowing the pull request to merge.
- PullRequestReviewStateChangesRequested PullRequestReviewState = "CHANGES_REQUESTED" // A review blocking the pull request from merging.
- PullRequestReviewStateDismissed PullRequestReviewState = "DISMISSED" // A review that has been dismissed.
-)
-
-// PullRequestState represents the possible states of a pull request.
-type PullRequestState string
-
-// The possible states of a pull request.
-const (
- PullRequestStateOpen PullRequestState = "OPEN" // A pull request that is still open.
- PullRequestStateClosed PullRequestState = "CLOSED" // A pull request that has been closed without being merged.
- PullRequestStateMerged PullRequestState = "MERGED" // A pull request that has been closed by being merged.
-)
-
-// PullRequestTimelineItemsItemType represents the possible item types found in a timeline.
-type PullRequestTimelineItemsItemType string
-
-// The possible item types found in a timeline.
-const (
- PullRequestTimelineItemsItemTypePullRequestCommit PullRequestTimelineItemsItemType = "PULL_REQUEST_COMMIT" // Represents a Git commit part of a pull request.
- PullRequestTimelineItemsItemTypePullRequestCommitCommentThread PullRequestTimelineItemsItemType = "PULL_REQUEST_COMMIT_COMMENT_THREAD" // Represents a commit comment thread part of a pull request.
- PullRequestTimelineItemsItemTypePullRequestReview PullRequestTimelineItemsItemType = "PULL_REQUEST_REVIEW" // A review object for a given pull request.
- PullRequestTimelineItemsItemTypePullRequestReviewThread PullRequestTimelineItemsItemType = "PULL_REQUEST_REVIEW_THREAD" // A threaded list of comments for a given pull request.
- PullRequestTimelineItemsItemTypePullRequestRevisionMarker PullRequestTimelineItemsItemType = "PULL_REQUEST_REVISION_MARKER" // Represents the latest point in the pull request timeline for which the viewer has seen the pull request's commits.
- PullRequestTimelineItemsItemTypeBaseRefChangedEvent PullRequestTimelineItemsItemType = "BASE_REF_CHANGED_EVENT" // Represents a 'base_ref_changed' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeBaseRefForcePushedEvent PullRequestTimelineItemsItemType = "BASE_REF_FORCE_PUSHED_EVENT" // Represents a 'base_ref_force_pushed' event on a given pull request.
- PullRequestTimelineItemsItemTypeDeployedEvent PullRequestTimelineItemsItemType = "DEPLOYED_EVENT" // Represents a 'deployed' event on a given pull request.
- PullRequestTimelineItemsItemTypeDeploymentEnvironmentChangedEvent PullRequestTimelineItemsItemType = "DEPLOYMENT_ENVIRONMENT_CHANGED_EVENT" // Represents a 'deployment_environment_changed' event on a given pull request.
- PullRequestTimelineItemsItemTypeHeadRefDeletedEvent PullRequestTimelineItemsItemType = "HEAD_REF_DELETED_EVENT" // Represents a 'head_ref_deleted' event on a given pull request.
- PullRequestTimelineItemsItemTypeHeadRefForcePushedEvent PullRequestTimelineItemsItemType = "HEAD_REF_FORCE_PUSHED_EVENT" // Represents a 'head_ref_force_pushed' event on a given pull request.
- PullRequestTimelineItemsItemTypeHeadRefRestoredEvent PullRequestTimelineItemsItemType = "HEAD_REF_RESTORED_EVENT" // Represents a 'head_ref_restored' event on a given pull request.
- PullRequestTimelineItemsItemTypeMergedEvent PullRequestTimelineItemsItemType = "MERGED_EVENT" // Represents a 'merged' event on a given pull request.
- PullRequestTimelineItemsItemTypeReviewDismissedEvent PullRequestTimelineItemsItemType = "REVIEW_DISMISSED_EVENT" // Represents a 'review_dismissed' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeReviewRequestedEvent PullRequestTimelineItemsItemType = "REVIEW_REQUESTED_EVENT" // Represents an 'review_requested' event on a given pull request.
- PullRequestTimelineItemsItemTypeReviewRequestRemovedEvent PullRequestTimelineItemsItemType = "REVIEW_REQUEST_REMOVED_EVENT" // Represents an 'review_request_removed' event on a given pull request.
- PullRequestTimelineItemsItemTypeIssueComment PullRequestTimelineItemsItemType = "ISSUE_COMMENT" // Represents a comment on an Issue.
- PullRequestTimelineItemsItemTypeCrossReferencedEvent PullRequestTimelineItemsItemType = "CROSS_REFERENCED_EVENT" // Represents a mention made by one issue or pull request to another.
- PullRequestTimelineItemsItemTypeAddedToProjectEvent PullRequestTimelineItemsItemType = "ADDED_TO_PROJECT_EVENT" // Represents a 'added_to_project' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeAssignedEvent PullRequestTimelineItemsItemType = "ASSIGNED_EVENT" // Represents an 'assigned' event on any assignable object.
- PullRequestTimelineItemsItemTypeClosedEvent PullRequestTimelineItemsItemType = "CLOSED_EVENT" // Represents a 'closed' event on any `Closable`.
- PullRequestTimelineItemsItemTypeCommentDeletedEvent PullRequestTimelineItemsItemType = "COMMENT_DELETED_EVENT" // Represents a 'comment_deleted' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeConvertedNoteToIssueEvent PullRequestTimelineItemsItemType = "CONVERTED_NOTE_TO_ISSUE_EVENT" // Represents a 'converted_note_to_issue' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeDemilestonedEvent PullRequestTimelineItemsItemType = "DEMILESTONED_EVENT" // Represents a 'demilestoned' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeLabeledEvent PullRequestTimelineItemsItemType = "LABELED_EVENT" // Represents a 'labeled' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeLockedEvent PullRequestTimelineItemsItemType = "LOCKED_EVENT" // Represents a 'locked' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeMentionedEvent PullRequestTimelineItemsItemType = "MENTIONED_EVENT" // Represents a 'mentioned' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeMilestonedEvent PullRequestTimelineItemsItemType = "MILESTONED_EVENT" // Represents a 'milestoned' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeMovedColumnsInProjectEvent PullRequestTimelineItemsItemType = "MOVED_COLUMNS_IN_PROJECT_EVENT" // Represents a 'moved_columns_in_project' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypePinnedEvent PullRequestTimelineItemsItemType = "PINNED_EVENT" // Represents a 'pinned' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeReferencedEvent PullRequestTimelineItemsItemType = "REFERENCED_EVENT" // Represents a 'referenced' event on a given `ReferencedSubject`.
- PullRequestTimelineItemsItemTypeRemovedFromProjectEvent PullRequestTimelineItemsItemType = "REMOVED_FROM_PROJECT_EVENT" // Represents a 'removed_from_project' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeRenamedTitleEvent PullRequestTimelineItemsItemType = "RENAMED_TITLE_EVENT" // Represents a 'renamed' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeReopenedEvent PullRequestTimelineItemsItemType = "REOPENED_EVENT" // Represents a 'reopened' event on any `Closable`.
- PullRequestTimelineItemsItemTypeSubscribedEvent PullRequestTimelineItemsItemType = "SUBSCRIBED_EVENT" // Represents a 'subscribed' event on a given `Subscribable`.
- PullRequestTimelineItemsItemTypeTransferredEvent PullRequestTimelineItemsItemType = "TRANSFERRED_EVENT" // Represents a 'transferred' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeUnassignedEvent PullRequestTimelineItemsItemType = "UNASSIGNED_EVENT" // Represents an 'unassigned' event on any assignable object.
- PullRequestTimelineItemsItemTypeUnlabeledEvent PullRequestTimelineItemsItemType = "UNLABELED_EVENT" // Represents an 'unlabeled' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeUnlockedEvent PullRequestTimelineItemsItemType = "UNLOCKED_EVENT" // Represents an 'unlocked' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeUserBlockedEvent PullRequestTimelineItemsItemType = "USER_BLOCKED_EVENT" // Represents a 'user_blocked' event on a given user.
- PullRequestTimelineItemsItemTypeUnpinnedEvent PullRequestTimelineItemsItemType = "UNPINNED_EVENT" // Represents an 'unpinned' event on a given issue or pull request.
- PullRequestTimelineItemsItemTypeUnsubscribedEvent PullRequestTimelineItemsItemType = "UNSUBSCRIBED_EVENT" // Represents an 'unsubscribed' event on a given `Subscribable`.
-)
-
-// ReactionContent represents emojis that can be attached to Issues, Pull Requests and Comments.
-type ReactionContent string
-
-// Emojis that can be attached to Issues, Pull Requests and Comments.
-const (
- ReactionContentThumbsUp ReactionContent = "THUMBS_UP" // Represents the 👍 emoji.
- ReactionContentThumbsDown ReactionContent = "THUMBS_DOWN" // Represents the 👎 emoji.
- ReactionContentLaugh ReactionContent = "LAUGH" // Represents the 😄 emoji.
- ReactionContentHooray ReactionContent = "HOORAY" // Represents the 🎉 emoji.
- ReactionContentConfused ReactionContent = "CONFUSED" // Represents the 😕 emoji.
- ReactionContentHeart ReactionContent = "HEART" // Represents the ❤️ emoji.
- ReactionContentRocket ReactionContent = "ROCKET" // Represents the 🚀 emoji.
- ReactionContentEyes ReactionContent = "EYES" // Represents the 👀 emoji.
-)
-
-// ReactionOrderField represents a list of fields that reactions can be ordered by.
-type ReactionOrderField string
-
-// A list of fields that reactions can be ordered by.
-const (
- ReactionOrderFieldCreatedAt ReactionOrderField = "CREATED_AT" // Allows ordering a list of reactions by when they were created.
-)
-
-// RefOrderField represents properties by which ref connections can be ordered.
-type RefOrderField string
-
-// Properties by which ref connections can be ordered.
-const (
- RefOrderFieldTagCommitDate RefOrderField = "TAG_COMMIT_DATE" // Order refs by underlying commit date if the ref prefix is refs/tags/.
- RefOrderFieldAlphabetical RefOrderField = "ALPHABETICAL" // Order refs by their alphanumeric name.
-)
-
-// ReleaseOrderField represents properties by which release connections can be ordered.
-type ReleaseOrderField string
-
-// Properties by which release connections can be ordered.
-const (
- ReleaseOrderFieldCreatedAt ReleaseOrderField = "CREATED_AT" // Order releases by creation time.
- ReleaseOrderFieldName ReleaseOrderField = "NAME" // Order releases alphabetically by name.
-)
-
-// ReportedContentClassifiers represents the reasons a piece of content can be reported or minimized.
-type ReportedContentClassifiers string
-
-// The reasons a piece of content can be reported or minimized.
-const (
- ReportedContentClassifiersSpam ReportedContentClassifiers = "SPAM" // A spammy piece of content.
- ReportedContentClassifiersAbuse ReportedContentClassifiers = "ABUSE" // An abusive or harassing piece of content.
- ReportedContentClassifiersOffTopic ReportedContentClassifiers = "OFF_TOPIC" // An irrelevant piece of content.
- ReportedContentClassifiersOutdated ReportedContentClassifiers = "OUTDATED" // An outdated piece of content.
- ReportedContentClassifiersResolved ReportedContentClassifiers = "RESOLVED" // The content has been resolved.
-)
-
-// RepositoryAffiliation represents the affiliation of a user to a repository.
-type RepositoryAffiliation string
-
-// The affiliation of a user to a repository.
-const (
- RepositoryAffiliationOwner RepositoryAffiliation = "OWNER" // Repositories that are owned by the authenticated user.
- RepositoryAffiliationCollaborator RepositoryAffiliation = "COLLABORATOR" // Repositories that the user has been added to as a collaborator.
- RepositoryAffiliationOrganizationMember RepositoryAffiliation = "ORGANIZATION_MEMBER" // Repositories that the user has access to through being a member of an organization. This includes every repository on every team that the user is on.
-)
-
-// RepositoryCollaboratorAffiliation represents the affiliation type between collaborator and repository.
-type RepositoryCollaboratorAffiliation string
-
-// The affiliation type between collaborator and repository.
-const (
- RepositoryCollaboratorAffiliationAll RepositoryCollaboratorAffiliation = "ALL" // All collaborators of the repository.
- RepositoryCollaboratorAffiliationOutside RepositoryCollaboratorAffiliation = "OUTSIDE" // All outside collaborators of an organization-owned repository.
-)
-
-// RepositoryContributionType represents the reason a repository is listed as 'contributed'.
-type RepositoryContributionType string
-
-// The reason a repository is listed as 'contributed'.
-const (
- RepositoryContributionTypeCommit RepositoryContributionType = "COMMIT" // Created a commit.
- RepositoryContributionTypeIssue RepositoryContributionType = "ISSUE" // Created an issue.
- RepositoryContributionTypePullRequest RepositoryContributionType = "PULL_REQUEST" // Created a pull request.
- RepositoryContributionTypeRepository RepositoryContributionType = "REPOSITORY" // Created the repository.
- RepositoryContributionTypePullRequestReview RepositoryContributionType = "PULL_REQUEST_REVIEW" // Reviewed a pull request.
-)
-
-// RepositoryLockReason represents the possible reasons a given repository could be in a locked state.
-type RepositoryLockReason string
-
-// The possible reasons a given repository could be in a locked state.
-const (
- RepositoryLockReasonMoving RepositoryLockReason = "MOVING" // The repository is locked due to a move.
- RepositoryLockReasonBilling RepositoryLockReason = "BILLING" // The repository is locked due to a billing related reason.
- RepositoryLockReasonRename RepositoryLockReason = "RENAME" // The repository is locked due to a rename.
- RepositoryLockReasonMigrating RepositoryLockReason = "MIGRATING" // The repository is locked due to a migration.
-)
-
-// RepositoryOrderField represents properties by which repository connections can be ordered.
-type RepositoryOrderField string
-
-// Properties by which repository connections can be ordered.
-const (
- RepositoryOrderFieldCreatedAt RepositoryOrderField = "CREATED_AT" // Order repositories by creation time.
- RepositoryOrderFieldUpdatedAt RepositoryOrderField = "UPDATED_AT" // Order repositories by update time.
- RepositoryOrderFieldPushedAt RepositoryOrderField = "PUSHED_AT" // Order repositories by push time.
- RepositoryOrderFieldName RepositoryOrderField = "NAME" // Order repositories by name.
- RepositoryOrderFieldStargazers RepositoryOrderField = "STARGAZERS" // Order repositories by number of stargazers.
-)
-
-// RepositoryPermission represents the access level to a repository.
-type RepositoryPermission string
-
-// The access level to a repository.
-const (
- RepositoryPermissionAdmin RepositoryPermission = "ADMIN" // Can read, clone, and push to this repository. Can also manage issues, pull requests, and repository settings, including adding collaborators.
- RepositoryPermissionMaintain RepositoryPermission = "MAINTAIN" // Can read, clone, and push to this repository. They can also manage issues, pull requests, and some repository settings.
- RepositoryPermissionWrite RepositoryPermission = "WRITE" // Can read, clone, and push to this repository. Can also manage issues and pull requests.
- RepositoryPermissionTriage RepositoryPermission = "TRIAGE" // Can read and clone this repository. Can also manage issues and pull requests.
- RepositoryPermissionRead RepositoryPermission = "READ" // Can read and clone this repository. Can also open and comment on issues and pull requests.
-)
-
-// RepositoryPrivacy represents the privacy of a repository.
-type RepositoryPrivacy string
-
-// The privacy of a repository.
-const (
- RepositoryPrivacyPublic RepositoryPrivacy = "PUBLIC" // Public.
- RepositoryPrivacyPrivate RepositoryPrivacy = "PRIVATE" // Private.
-)
-
-// SearchType represents represents the individual results of a search.
-type SearchType string
-
-// Represents the individual results of a search.
-const (
- SearchTypeIssue SearchType = "ISSUE" // Returns results matching issues in repositories.
- SearchTypeRepository SearchType = "REPOSITORY" // Returns results matching repositories.
- SearchTypeUser SearchType = "USER" // Returns results matching users and organizations on GitHub.
-)
-
-// SecurityAdvisoryEcosystem represents the possible ecosystems of a security vulnerability's package.
-type SecurityAdvisoryEcosystem string
-
-// The possible ecosystems of a security vulnerability's package.
-const (
- SecurityAdvisoryEcosystemRubygems SecurityAdvisoryEcosystem = "RUBYGEMS" // Ruby gems hosted at RubyGems.org.
- SecurityAdvisoryEcosystemNpm SecurityAdvisoryEcosystem = "NPM" // JavaScript packages hosted at npmjs.com.
- SecurityAdvisoryEcosystemPip SecurityAdvisoryEcosystem = "PIP" // Python packages hosted at PyPI.org.
- SecurityAdvisoryEcosystemMaven SecurityAdvisoryEcosystem = "MAVEN" // Java artifacts hosted at the Maven central repository.
- SecurityAdvisoryEcosystemNuget SecurityAdvisoryEcosystem = "NUGET" // .NET packages hosted at the NuGet Gallery.
-)
-
-// SecurityAdvisoryIdentifierType represents identifier formats available for advisories.
-type SecurityAdvisoryIdentifierType string
-
-// Identifier formats available for advisories.
-const (
- SecurityAdvisoryIdentifierTypeCve SecurityAdvisoryIdentifierType = "CVE" // Common Vulnerabilities and Exposures Identifier.
- SecurityAdvisoryIdentifierTypeGhsa SecurityAdvisoryIdentifierType = "GHSA" // GitHub Security Advisory ID.
-)
-
-// SecurityAdvisoryOrderField represents properties by which security advisory connections can be ordered.
-type SecurityAdvisoryOrderField string
-
-// Properties by which security advisory connections can be ordered.
-const (
- SecurityAdvisoryOrderFieldPublishedAt SecurityAdvisoryOrderField = "PUBLISHED_AT" // Order advisories by publication time.
- SecurityAdvisoryOrderFieldUpdatedAt SecurityAdvisoryOrderField = "UPDATED_AT" // Order advisories by update time.
-)
-
-// SecurityAdvisorySeverity represents severity of the vulnerability.
-type SecurityAdvisorySeverity string
-
-// Severity of the vulnerability.
-const (
- SecurityAdvisorySeverityLow SecurityAdvisorySeverity = "LOW" // Low.
- SecurityAdvisorySeverityModerate SecurityAdvisorySeverity = "MODERATE" // Moderate.
- SecurityAdvisorySeverityHigh SecurityAdvisorySeverity = "HIGH" // High.
- SecurityAdvisorySeverityCritical SecurityAdvisorySeverity = "CRITICAL" // Critical.
-)
-
-// SecurityVulnerabilityOrderField represents properties by which security vulnerability connections can be ordered.
-type SecurityVulnerabilityOrderField string
-
-// Properties by which security vulnerability connections can be ordered.
-const (
- SecurityVulnerabilityOrderFieldUpdatedAt SecurityVulnerabilityOrderField = "UPDATED_AT" // Order vulnerability by update time.
-)
-
-// StarOrderField represents properties by which star connections can be ordered.
-type StarOrderField string
-
-// Properties by which star connections can be ordered.
-const (
- StarOrderFieldStarredAt StarOrderField = "STARRED_AT" // Allows ordering a list of stars by when they were created.
-)
-
-// StatusState represents the possible commit status states.
-type StatusState string
-
-// The possible commit status states.
-const (
- StatusStateExpected StatusState = "EXPECTED" // Status is expected.
- StatusStateError StatusState = "ERROR" // Status is errored.
- StatusStateFailure StatusState = "FAILURE" // Status is failing.
- StatusStatePending StatusState = "PENDING" // Status is pending.
- StatusStateSuccess StatusState = "SUCCESS" // Status is successful.
-)
-
-// SubscriptionState represents the possible states of a subscription.
-type SubscriptionState string
-
-// The possible states of a subscription.
-const (
- SubscriptionStateUnsubscribed SubscriptionState = "UNSUBSCRIBED" // The User is only notified when participating or @mentioned.
- SubscriptionStateSubscribed SubscriptionState = "SUBSCRIBED" // The User is notified of all conversations.
- SubscriptionStateIgnored SubscriptionState = "IGNORED" // The User is never notified.
-)
-
-// TeamMemberOrderField represents properties by which team member connections can be ordered.
-type TeamMemberOrderField string
-
-// Properties by which team member connections can be ordered.
-const (
- TeamMemberOrderFieldLogin TeamMemberOrderField = "LOGIN" // Order team members by login.
- TeamMemberOrderFieldCreatedAt TeamMemberOrderField = "CREATED_AT" // Order team members by creation time.
-)
-
-// TeamMemberRole represents the possible team member roles; either 'maintainer' or 'member'.
-type TeamMemberRole string
-
-// The possible team member roles; either 'maintainer' or 'member'.
-const (
- TeamMemberRoleMaintainer TeamMemberRole = "MAINTAINER" // A team maintainer has permission to add and remove team members.
- TeamMemberRoleMember TeamMemberRole = "MEMBER" // A team member has no administrative permissions on the team.
-)
-
-// TeamMembershipType represents defines which types of team members are included in the returned list. Can be one of IMMEDIATE, CHILD_TEAM or ALL.
-type TeamMembershipType string
-
-// Defines which types of team members are included in the returned list. Can be one of IMMEDIATE, CHILD_TEAM or ALL.
-const (
- TeamMembershipTypeImmediate TeamMembershipType = "IMMEDIATE" // Includes only immediate members of the team.
- TeamMembershipTypeChildTeam TeamMembershipType = "CHILD_TEAM" // Includes only child team members for the team.
- TeamMembershipTypeAll TeamMembershipType = "ALL" // Includes immediate and child team members for the team.
-)
-
-// TeamOrderField represents properties by which team connections can be ordered.
-type TeamOrderField string
-
-// Properties by which team connections can be ordered.
-const (
- TeamOrderFieldName TeamOrderField = "NAME" // Allows ordering a list of teams by name.
-)
-
-// TeamPrivacy represents the possible team privacy values.
-type TeamPrivacy string
-
-// The possible team privacy values.
-const (
- TeamPrivacySecret TeamPrivacy = "SECRET" // A secret team can only be seen by its members.
- TeamPrivacyVisible TeamPrivacy = "VISIBLE" // A visible team can be seen and @mentioned by every member of the organization.
-)
-
-// TeamRepositoryOrderField represents properties by which team repository connections can be ordered.
-type TeamRepositoryOrderField string
-
-// Properties by which team repository connections can be ordered.
-const (
- TeamRepositoryOrderFieldCreatedAt TeamRepositoryOrderField = "CREATED_AT" // Order repositories by creation time.
- TeamRepositoryOrderFieldUpdatedAt TeamRepositoryOrderField = "UPDATED_AT" // Order repositories by update time.
- TeamRepositoryOrderFieldPushedAt TeamRepositoryOrderField = "PUSHED_AT" // Order repositories by push time.
- TeamRepositoryOrderFieldName TeamRepositoryOrderField = "NAME" // Order repositories by name.
- TeamRepositoryOrderFieldPermission TeamRepositoryOrderField = "PERMISSION" // Order repositories by permission.
- TeamRepositoryOrderFieldStargazers TeamRepositoryOrderField = "STARGAZERS" // Order repositories by number of stargazers.
-)
-
-// TeamRole represents the role of a user on a team.
-type TeamRole string
-
-// The role of a user on a team.
-const (
- TeamRoleAdmin TeamRole = "ADMIN" // User has admin rights on the team.
- TeamRoleMember TeamRole = "MEMBER" // User is a member of the team.
-)
-
-// TopicSuggestionDeclineReason represents reason that the suggested topic is declined.
-type TopicSuggestionDeclineReason string
-
-// Reason that the suggested topic is declined.
-const (
- TopicSuggestionDeclineReasonNotRelevant TopicSuggestionDeclineReason = "NOT_RELEVANT" // The suggested topic is not relevant to the repository.
- TopicSuggestionDeclineReasonTooSpecific TopicSuggestionDeclineReason = "TOO_SPECIFIC" // The suggested topic is too specific for the repository (e.g. #ruby-on-rails-version-4-2-1).
- TopicSuggestionDeclineReasonPersonalPreference TopicSuggestionDeclineReason = "PERSONAL_PREFERENCE" // The viewer does not like the suggested topic.
- TopicSuggestionDeclineReasonTooGeneral TopicSuggestionDeclineReason = "TOO_GENERAL" // The suggested topic is too general for the repository.
-)
-
-// UserBlockDuration represents the possible durations that a user can be blocked for.
-type UserBlockDuration string
-
-// The possible durations that a user can be blocked for.
-const (
- UserBlockDurationOneDay UserBlockDuration = "ONE_DAY" // The user was blocked for 1 day.
- UserBlockDurationThreeDays UserBlockDuration = "THREE_DAYS" // The user was blocked for 3 days.
- UserBlockDurationOneWeek UserBlockDuration = "ONE_WEEK" // The user was blocked for 7 days.
- UserBlockDurationOneMonth UserBlockDuration = "ONE_MONTH" // The user was blocked for 30 days.
- UserBlockDurationPermanent UserBlockDuration = "PERMANENT" // The user was blocked permanently.
-)
-
-// UserStatusOrderField represents properties by which user status connections can be ordered.
-type UserStatusOrderField string
-
-// Properties by which user status connections can be ordered.
-const (
- UserStatusOrderFieldUpdatedAt UserStatusOrderField = "UPDATED_AT" // Order user statuses by when they were updated.
-)
diff --git a/vendor/github.com/shurcooL/githubv4/gen.go b/vendor/github.com/shurcooL/githubv4/gen.go
deleted file mode 100644
index 628ce57b..00000000
--- a/vendor/github.com/shurcooL/githubv4/gen.go
+++ /dev/null
@@ -1,193 +0,0 @@
-// +build ignore
-
-package main
-
-import (
- "bytes"
- "encoding/json"
- "flag"
- "fmt"
- "go/format"
- "io/ioutil"
- "log"
- "net/http"
- "os"
- "sort"
- "strconv"
- "strings"
- "text/template"
-
- "github.com/shurcooL/graphql/ident"
-)
-
-func main() {
- flag.Parse()
-
- err := run()
- if err != nil {
- log.Fatalln(err)
- }
-}
-
-func run() error {
- githubToken, ok := os.LookupEnv("GITHUB_TOKEN")
- if !ok {
- return fmt.Errorf("GITHUB_TOKEN environment variable not set")
- }
- schema, err := loadSchema(githubToken)
- if err != nil {
- return err
- }
-
- for filename, t := range templates {
- var buf bytes.Buffer
- err := t.Execute(&buf, schema)
- if err != nil {
- return err
- }
- out, err := format.Source(buf.Bytes())
- if err != nil {
- log.Println(err)
- out = []byte("// gofmt error: " + err.Error() + "\n\n" + buf.String())
- }
- fmt.Println("writing", filename)
- err = ioutil.WriteFile(filename, out, 0644)
- if err != nil {
- return err
- }
- }
-
- return nil
-}
-
-func loadSchema(githubToken string) (schema interface{}, err error) {
- req, err := http.NewRequest("GET", "https://api.github.com/graphql", nil)
- if err != nil {
- return nil, err
- }
- req.Header.Set("Authorization", "bearer "+githubToken)
- resp, err := http.DefaultClient.Do(req)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
- err = json.NewDecoder(resp.Body).Decode(&schema)
- return schema, err
-}
-
-// Filename -> Template.
-var templates = map[string]*template.Template{
- "enum.go": t(`// Code generated by gen.go; DO NOT EDIT.
-
-package githubv4
-{{range .data.__schema.types | sortByName}}{{if and (eq .kind "ENUM") (not (internal .name))}}
-{{template "enum" .}}
-{{end}}{{end}}
-
-
-{{- define "enum" -}}
-// {{.name}} {{.description | clean | endSentence}}
-type {{.name}} string
-
-// {{.description | clean | fullSentence}}
-const ({{range .enumValues}}
- {{$.name}}{{.name | enumIdentifier}} {{$.name}} = {{.name | quote}} // {{.description | clean | fullSentence}}{{end}}
-)
-{{- end -}}
-`),
-
- "input.go": t(`// Code generated by gen.go; DO NOT EDIT.
-
-package githubv4
-
-// Input represents one of the Input structs:
-//
-// {{join (inputObjects .data.__schema.types) ", "}}.
-type Input interface{}
-{{range .data.__schema.types | sortByName}}{{if eq .kind "INPUT_OBJECT"}}
-{{template "inputObject" .}}
-{{end}}{{end}}
-
-
-{{- define "inputObject" -}}
-// {{.name}} {{.description | clean | endSentence}}
-type {{.name}} struct {{"{"}}{{range .inputFields}}{{if eq .type.kind "NON_NULL"}}
- // {{.description | clean | fullSentence}} (Required.)
- {{.name | identifier}} {{.type | type}} ` + "`" + `json:"{{.name}}"` + "`" + `{{end}}{{end}}
-{{range .inputFields}}{{if ne .type.kind "NON_NULL"}}
- // {{.description | clean | fullSentence}} (Optional.)
- {{.name | identifier}} {{.type | type}} ` + "`" + `json:"{{.name}},omitempty"` + "`" + `{{end}}{{end}}
-}
-{{- end -}}
-`),
-}
-
-func t(text string) *template.Template {
- // typeString returns a string representation of GraphQL type t.
- var typeString func(t map[string]interface{}) string
- typeString = func(t map[string]interface{}) string {
- switch t["kind"] {
- case "NON_NULL":
- s := typeString(t["ofType"].(map[string]interface{}))
- if !strings.HasPrefix(s, "*") {
- panic(fmt.Errorf("nullable type %q doesn't begin with '*'", s))
- }
- return s[1:] // Strip star from nullable type to make it non-null.
- case "LIST":
- return "*[]" + typeString(t["ofType"].(map[string]interface{}))
- default:
- return "*" + t["name"].(string)
- }
- }
-
- return template.Must(template.New("").Funcs(template.FuncMap{
- "internal": func(s string) bool { return strings.HasPrefix(s, "__") },
- "quote": strconv.Quote,
- "join": strings.Join,
- "sortByName": func(types []interface{}) []interface{} {
- sort.Slice(types, func(i, j int) bool {
- ni := types[i].(map[string]interface{})["name"].(string)
- nj := types[j].(map[string]interface{})["name"].(string)
- return ni < nj
- })
- return types
- },
- "inputObjects": func(types []interface{}) []string {
- var names []string
- for _, t := range types {
- t := t.(map[string]interface{})
- if t["kind"].(string) != "INPUT_OBJECT" {
- continue
- }
- names = append(names, t["name"].(string))
- }
- sort.Strings(names)
- return names
- },
- "identifier": func(name string) string { return ident.ParseLowerCamelCase(name).ToMixedCaps() },
- "enumIdentifier": func(name string) string { return ident.ParseScreamingSnakeCase(name).ToMixedCaps() },
- "type": typeString,
- "clean": func(s string) string { return strings.Join(strings.Fields(s), " ") },
- "endSentence": func(s string) string {
- s = strings.ToLower(s[0:1]) + s[1:]
- switch {
- default:
- s = "represents " + s
- case strings.HasPrefix(s, "autogenerated "):
- s = "is an " + s
- case strings.HasPrefix(s, "specifies "):
- // Do nothing.
- }
- if !strings.HasSuffix(s, ".") {
- s += "."
- }
- return s
- },
- "fullSentence": func(s string) string {
- if !strings.HasSuffix(s, ".") {
- s += "."
- }
- return s
- },
- }).Parse(text))
-}
diff --git a/vendor/github.com/shurcooL/githubv4/githubv4.go b/vendor/github.com/shurcooL/githubv4/githubv4.go
deleted file mode 100644
index 3a544bf2..00000000
--- a/vendor/github.com/shurcooL/githubv4/githubv4.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package githubv4
-
-import (
- "context"
- "net/http"
-
- "github.com/shurcooL/graphql"
-)
-
-// Client is a GitHub GraphQL API v4 client.
-type Client struct {
- client *graphql.Client
-}
-
-// NewClient creates a new GitHub GraphQL API v4 client with the provided http.Client.
-// If httpClient is nil, then http.DefaultClient is used.
-//
-// Note that GitHub GraphQL API v4 requires authentication, so
-// the provided http.Client is expected to take care of that.
-func NewClient(httpClient *http.Client) *Client {
- return &Client{
- client: graphql.NewClient("https://api.github.com/graphql", httpClient),
- }
-}
-
-// NewEnterpriseClient creates a new GitHub GraphQL API v4 client for the GitHub Enterprise
-// instance with the specified GraphQL endpoint URL, using the provided http.Client.
-// If httpClient is nil, then http.DefaultClient is used.
-//
-// Note that GitHub GraphQL API v4 requires authentication, so
-// the provided http.Client is expected to take care of that.
-func NewEnterpriseClient(url string, httpClient *http.Client) *Client {
- return &Client{
- client: graphql.NewClient(url, httpClient),
- }
-}
-
-// Query executes a single GraphQL query request,
-// with a query derived from q, populating the response into it.
-// q should be a pointer to struct that corresponds to the GitHub GraphQL schema.
-func (c *Client) Query(ctx context.Context, q interface{}, variables map[string]interface{}) error {
- return c.client.Query(ctx, q, variables)
-}
-
-// Mutate executes a single GraphQL mutation request,
-// with a mutation derived from m, populating the response into it.
-// m should be a pointer to struct that corresponds to the GitHub GraphQL schema.
-// Provided input will be set as a variable named "input".
-func (c *Client) Mutate(ctx context.Context, m interface{}, input Input, variables map[string]interface{}) error {
- if variables == nil {
- variables = map[string]interface{}{"input": input}
- } else {
- variables["input"] = input
- }
- return c.client.Mutate(ctx, m, variables)
-}
diff --git a/vendor/github.com/shurcooL/githubv4/input.go b/vendor/github.com/shurcooL/githubv4/input.go
deleted file mode 100644
index da00e3b3..00000000
--- a/vendor/github.com/shurcooL/githubv4/input.go
+++ /dev/null
@@ -1,1051 +0,0 @@
-// Code generated by gen.go; DO NOT EDIT.
-
-package githubv4
-
-// Input represents one of the Input structs:
-//
-// AcceptTopicSuggestionInput, AddAssigneesToAssignableInput, AddCommentInput, AddLabelsToLabelableInput, AddProjectCardInput, AddProjectColumnInput, AddPullRequestReviewCommentInput, AddPullRequestReviewInput, AddReactionInput, AddStarInput, ChangeUserStatusInput, ClearLabelsFromLabelableInput, CloneProjectInput, CloseIssueInput, ClosePullRequestInput, CommitAuthor, CommitContributionOrder, ContributionOrder, ConvertProjectCardNoteToIssueInput, CreateBranchProtectionRuleInput, CreateContentAttachmentInput, CreateIssueInput, CreateProjectInput, CreatePullRequestInput, DeclineTopicSuggestionInput, DeleteBranchProtectionRuleInput, DeleteIssueCommentInput, DeleteIssueInput, DeleteProjectCardInput, DeleteProjectColumnInput, DeleteProjectInput, DeletePullRequestReviewCommentInput, DeletePullRequestReviewInput, DeploymentOrder, DismissPullRequestReviewInput, DraftPullRequestReviewComment, GistOrder, ImportProjectInput, IssueFilters, IssueOrder, LanguageOrder, LockLockableInput, MergePullRequestInput, MilestoneOrder, MinimizeCommentInput, MoveProjectCardInput, MoveProjectColumnInput, PinIssueInput, ProjectCardImport, ProjectColumnImport, ProjectOrder, PullRequestOrder, ReactionOrder, RefOrder, ReleaseOrder, RemoveAssigneesFromAssignableInput, RemoveLabelsFromLabelableInput, RemoveOutsideCollaboratorInput, RemoveReactionInput, RemoveStarInput, ReopenIssueInput, ReopenPullRequestInput, RepositoryOrder, RequestReviewsInput, ResolveReviewThreadInput, SecurityAdvisoryIdentifierFilter, SecurityAdvisoryOrder, SecurityVulnerabilityOrder, StarOrder, SubmitPullRequestReviewInput, TeamMemberOrder, TeamOrder, TeamRepositoryOrder, UnlockLockableInput, UnmarkIssueAsDuplicateInput, UnminimizeCommentInput, UnpinIssueInput, UnresolveReviewThreadInput, UpdateBranchProtectionRuleInput, UpdateIssueCommentInput, UpdateIssueInput, UpdateProjectCardInput, UpdateProjectColumnInput, UpdateProjectInput, UpdatePullRequestInput, UpdatePullRequestReviewCommentInput, UpdatePullRequestReviewInput, UpdateSubscriptionInput, UpdateTopicsInput, UserStatusOrder.
-type Input interface{}
-
-// AcceptTopicSuggestionInput is an autogenerated input type of AcceptTopicSuggestion.
-type AcceptTopicSuggestionInput struct {
- // The Node ID of the repository. (Required.)
- RepositoryID ID `json:"repositoryId"`
- // The name of the suggested topic. (Required.)
- Name String `json:"name"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// AddAssigneesToAssignableInput is an autogenerated input type of AddAssigneesToAssignable.
-type AddAssigneesToAssignableInput struct {
- // The id of the assignable object to add assignees to. (Required.)
- AssignableID ID `json:"assignableId"`
- // The id of users to add as assignees. (Required.)
- AssigneeIDs []ID `json:"assigneeIds"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// AddCommentInput is an autogenerated input type of AddComment.
-type AddCommentInput struct {
- // The Node ID of the subject to modify. (Required.)
- SubjectID ID `json:"subjectId"`
- // The contents of the comment. (Required.)
- Body String `json:"body"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// AddLabelsToLabelableInput is an autogenerated input type of AddLabelsToLabelable.
-type AddLabelsToLabelableInput struct {
- // The id of the labelable object to add labels to. (Required.)
- LabelableID ID `json:"labelableId"`
- // The ids of the labels to add. (Required.)
- LabelIDs []ID `json:"labelIds"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// AddProjectCardInput is an autogenerated input type of AddProjectCard.
-type AddProjectCardInput struct {
- // The Node ID of the ProjectColumn. (Required.)
- ProjectColumnID ID `json:"projectColumnId"`
-
- // The content of the card. Must be a member of the ProjectCardItem union. (Optional.)
- ContentID *ID `json:"contentId,omitempty"`
- // The note on the card. (Optional.)
- Note *String `json:"note,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// AddProjectColumnInput is an autogenerated input type of AddProjectColumn.
-type AddProjectColumnInput struct {
- // The Node ID of the project. (Required.)
- ProjectID ID `json:"projectId"`
- // The name of the column. (Required.)
- Name String `json:"name"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// AddPullRequestReviewCommentInput is an autogenerated input type of AddPullRequestReviewComment.
-type AddPullRequestReviewCommentInput struct {
- // The Node ID of the review to modify. (Required.)
- PullRequestReviewID ID `json:"pullRequestReviewId"`
- // The text of the comment. (Required.)
- Body String `json:"body"`
-
- // The SHA of the commit to comment on. (Optional.)
- CommitOID *GitObjectID `json:"commitOID,omitempty"`
- // The relative path of the file to comment on. (Optional.)
- Path *String `json:"path,omitempty"`
- // The line index in the diff to comment on. (Optional.)
- Position *Int `json:"position,omitempty"`
- // The comment id to reply to. (Optional.)
- InReplyTo *ID `json:"inReplyTo,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// AddPullRequestReviewInput is an autogenerated input type of AddPullRequestReview.
-type AddPullRequestReviewInput struct {
- // The Node ID of the pull request to modify. (Required.)
- PullRequestID ID `json:"pullRequestId"`
-
- // The commit OID the review pertains to. (Optional.)
- CommitOID *GitObjectID `json:"commitOID,omitempty"`
- // The contents of the review body comment. (Optional.)
- Body *String `json:"body,omitempty"`
- // The event to perform on the pull request review. (Optional.)
- Event *PullRequestReviewEvent `json:"event,omitempty"`
- // The review line comments. (Optional.)
- Comments *[]*DraftPullRequestReviewComment `json:"comments,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// AddReactionInput is an autogenerated input type of AddReaction.
-type AddReactionInput struct {
- // The Node ID of the subject to modify. (Required.)
- SubjectID ID `json:"subjectId"`
- // The name of the emoji to react with. (Required.)
- Content ReactionContent `json:"content"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// AddStarInput is an autogenerated input type of AddStar.
-type AddStarInput struct {
- // The Starrable ID to star. (Required.)
- StarrableID ID `json:"starrableId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// ChangeUserStatusInput is an autogenerated input type of ChangeUserStatus.
-type ChangeUserStatusInput struct {
-
- // The emoji to represent your status. Can either be a native Unicode emoji or an emoji name with colons, e.g., :grinning:. (Optional.)
- Emoji *String `json:"emoji,omitempty"`
- // A short description of your current status. (Optional.)
- Message *String `json:"message,omitempty"`
- // The ID of the organization whose members will be allowed to see the status. If omitted, the status will be publicly visible. (Optional.)
- OrganizationID *ID `json:"organizationId,omitempty"`
- // Whether this status should indicate you are not fully available on GitHub, e.g., you are away. (Optional.)
- LimitedAvailability *Boolean `json:"limitedAvailability,omitempty"`
- // If set, the user status will not be shown after this date. (Optional.)
- ExpiresAt *DateTime `json:"expiresAt,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// ClearLabelsFromLabelableInput is an autogenerated input type of ClearLabelsFromLabelable.
-type ClearLabelsFromLabelableInput struct {
- // The id of the labelable object to clear the labels from. (Required.)
- LabelableID ID `json:"labelableId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// CloneProjectInput is an autogenerated input type of CloneProject.
-type CloneProjectInput struct {
- // The owner ID to create the project under. (Required.)
- TargetOwnerID ID `json:"targetOwnerId"`
- // The source project to clone. (Required.)
- SourceID ID `json:"sourceId"`
- // Whether or not to clone the source project's workflows. (Required.)
- IncludeWorkflows Boolean `json:"includeWorkflows"`
- // The name of the project. (Required.)
- Name String `json:"name"`
-
- // The description of the project. (Optional.)
- Body *String `json:"body,omitempty"`
- // The visibility of the project, defaults to false (private). (Optional.)
- Public *Boolean `json:"public,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// CloseIssueInput is an autogenerated input type of CloseIssue.
-type CloseIssueInput struct {
- // ID of the issue to be closed. (Required.)
- IssueID ID `json:"issueId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// ClosePullRequestInput is an autogenerated input type of ClosePullRequest.
-type ClosePullRequestInput struct {
- // ID of the pull request to be closed. (Required.)
- PullRequestID ID `json:"pullRequestId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// CommitAuthor specifies an author for filtering Git commits.
-type CommitAuthor struct {
-
- // ID of a User to filter by. If non-null, only commits authored by this user will be returned. This field takes precedence over emails. (Optional.)
- ID *ID `json:"id,omitempty"`
- // Email addresses to filter by. Commits authored by any of the specified email addresses will be returned. (Optional.)
- Emails *[]String `json:"emails,omitempty"`
-}
-
-// CommitContributionOrder represents ordering options for commit contribution connections.
-type CommitContributionOrder struct {
- // The field by which to order commit contributions. (Required.)
- Field CommitContributionOrderField `json:"field"`
- // The ordering direction. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// ContributionOrder represents ordering options for contribution connections.
-type ContributionOrder struct {
- // The field by which to order contributions. (Required.)
- Field ContributionOrderField `json:"field"`
- // The ordering direction. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// ConvertProjectCardNoteToIssueInput is an autogenerated input type of ConvertProjectCardNoteToIssue.
-type ConvertProjectCardNoteToIssueInput struct {
- // The ProjectCard ID to convert. (Required.)
- ProjectCardID ID `json:"projectCardId"`
- // The ID of the repository to create the issue in. (Required.)
- RepositoryID ID `json:"repositoryId"`
-
- // The title of the newly created issue. Defaults to the card's note text. (Optional.)
- Title *String `json:"title,omitempty"`
- // The body of the newly created issue. (Optional.)
- Body *String `json:"body,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// CreateBranchProtectionRuleInput is an autogenerated input type of CreateBranchProtectionRule.
-type CreateBranchProtectionRuleInput struct {
- // The global relay id of the repository in which a new branch protection rule should be created in. (Required.)
- RepositoryID ID `json:"repositoryId"`
- // The glob-like pattern used to determine matching branches. (Required.)
- Pattern String `json:"pattern"`
-
- // Are approving reviews required to update matching branches. (Optional.)
- RequiresApprovingReviews *Boolean `json:"requiresApprovingReviews,omitempty"`
- // Number of approving reviews required to update matching branches. (Optional.)
- RequiredApprovingReviewCount *Int `json:"requiredApprovingReviewCount,omitempty"`
- // Are commits required to be signed. (Optional.)
- RequiresCommitSignatures *Boolean `json:"requiresCommitSignatures,omitempty"`
- // Can admins overwrite branch protection. (Optional.)
- IsAdminEnforced *Boolean `json:"isAdminEnforced,omitempty"`
- // Are status checks required to update matching branches. (Optional.)
- RequiresStatusChecks *Boolean `json:"requiresStatusChecks,omitempty"`
- // Are branches required to be up to date before merging. (Optional.)
- RequiresStrictStatusChecks *Boolean `json:"requiresStrictStatusChecks,omitempty"`
- // Are reviews from code owners required to update matching branches. (Optional.)
- RequiresCodeOwnerReviews *Boolean `json:"requiresCodeOwnerReviews,omitempty"`
- // Will new commits pushed to matching branches dismiss pull request review approvals. (Optional.)
- DismissesStaleReviews *Boolean `json:"dismissesStaleReviews,omitempty"`
- // Is dismissal of pull request reviews restricted. (Optional.)
- RestrictsReviewDismissals *Boolean `json:"restrictsReviewDismissals,omitempty"`
- // A list of User or Team IDs allowed to dismiss reviews on pull requests targeting matching branches. (Optional.)
- ReviewDismissalActorIDs *[]ID `json:"reviewDismissalActorIds,omitempty"`
- // Is pushing to matching branches restricted. (Optional.)
- RestrictsPushes *Boolean `json:"restrictsPushes,omitempty"`
- // A list of User or Team IDs allowed to push to matching branches. (Optional.)
- PushActorIDs *[]ID `json:"pushActorIds,omitempty"`
- // List of required status check contexts that must pass for commits to be accepted to matching branches. (Optional.)
- RequiredStatusCheckContexts *[]String `json:"requiredStatusCheckContexts,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// CreateContentAttachmentInput is an autogenerated input type of CreateContentAttachment.
-type CreateContentAttachmentInput struct {
- // The node ID of the content_reference. (Required.)
- ContentReferenceID ID `json:"contentReferenceId"`
- // The title of the content attachment. (Required.)
- Title String `json:"title"`
- // The body of the content attachment, which may contain markdown. (Required.)
- Body String `json:"body"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// CreateIssueInput is an autogenerated input type of CreateIssue.
-type CreateIssueInput struct {
- // The Node ID of the repository. (Required.)
- RepositoryID ID `json:"repositoryId"`
- // The title for the issue. (Required.)
- Title String `json:"title"`
-
- // The body for the issue description. (Optional.)
- Body *String `json:"body,omitempty"`
- // The Node ID for the user assignee for this issue. (Optional.)
- AssigneeIDs *[]ID `json:"assigneeIds,omitempty"`
- // The Node ID of the milestone for this issue. (Optional.)
- MilestoneID *ID `json:"milestoneId,omitempty"`
- // An array of Node IDs of labels for this issue. (Optional.)
- LabelIDs *[]ID `json:"labelIds,omitempty"`
- // An array of Node IDs for projects associated with this issue. (Optional.)
- ProjectIDs *[]ID `json:"projectIds,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// CreateProjectInput is an autogenerated input type of CreateProject.
-type CreateProjectInput struct {
- // The owner ID to create the project under. (Required.)
- OwnerID ID `json:"ownerId"`
- // The name of project. (Required.)
- Name String `json:"name"`
-
- // The description of project. (Optional.)
- Body *String `json:"body,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// CreatePullRequestInput is an autogenerated input type of CreatePullRequest.
-type CreatePullRequestInput struct {
- // The Node ID of the repository. (Required.)
- RepositoryID ID `json:"repositoryId"`
- // The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot update the base branch on a pull request to point to another repository. (Required.)
- BaseRefName String `json:"baseRefName"`
- // The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace `head_ref_name` with a user like this: `username:branch`. (Required.)
- HeadRefName String `json:"headRefName"`
- // The title of the pull request. (Required.)
- Title String `json:"title"`
-
- // The contents of the pull request. (Optional.)
- Body *String `json:"body,omitempty"`
- // Indicates whether maintainers can modify the pull request. (Optional.)
- MaintainerCanModify *Boolean `json:"maintainerCanModify,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// DeclineTopicSuggestionInput is an autogenerated input type of DeclineTopicSuggestion.
-type DeclineTopicSuggestionInput struct {
- // The Node ID of the repository. (Required.)
- RepositoryID ID `json:"repositoryId"`
- // The name of the suggested topic. (Required.)
- Name String `json:"name"`
- // The reason why the suggested topic is declined. (Required.)
- Reason TopicSuggestionDeclineReason `json:"reason"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// DeleteBranchProtectionRuleInput is an autogenerated input type of DeleteBranchProtectionRule.
-type DeleteBranchProtectionRuleInput struct {
- // The global relay id of the branch protection rule to be deleted. (Required.)
- BranchProtectionRuleID ID `json:"branchProtectionRuleId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// DeleteIssueCommentInput is an autogenerated input type of DeleteIssueComment.
-type DeleteIssueCommentInput struct {
- // The ID of the comment to delete. (Required.)
- ID ID `json:"id"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// DeleteIssueInput is an autogenerated input type of DeleteIssue.
-type DeleteIssueInput struct {
- // The ID of the issue to delete. (Required.)
- IssueID ID `json:"issueId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// DeleteProjectCardInput is an autogenerated input type of DeleteProjectCard.
-type DeleteProjectCardInput struct {
- // The id of the card to delete. (Required.)
- CardID ID `json:"cardId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// DeleteProjectColumnInput is an autogenerated input type of DeleteProjectColumn.
-type DeleteProjectColumnInput struct {
- // The id of the column to delete. (Required.)
- ColumnID ID `json:"columnId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// DeleteProjectInput is an autogenerated input type of DeleteProject.
-type DeleteProjectInput struct {
- // The Project ID to update. (Required.)
- ProjectID ID `json:"projectId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// DeletePullRequestReviewCommentInput is an autogenerated input type of DeletePullRequestReviewComment.
-type DeletePullRequestReviewCommentInput struct {
- // The ID of the comment to delete. (Required.)
- ID ID `json:"id"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// DeletePullRequestReviewInput is an autogenerated input type of DeletePullRequestReview.
-type DeletePullRequestReviewInput struct {
- // The Node ID of the pull request review to delete. (Required.)
- PullRequestReviewID ID `json:"pullRequestReviewId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// DeploymentOrder represents ordering options for deployment connections.
-type DeploymentOrder struct {
- // The field to order deployments by. (Required.)
- Field DeploymentOrderField `json:"field"`
- // The ordering direction. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// DismissPullRequestReviewInput is an autogenerated input type of DismissPullRequestReview.
-type DismissPullRequestReviewInput struct {
- // The Node ID of the pull request review to modify. (Required.)
- PullRequestReviewID ID `json:"pullRequestReviewId"`
- // The contents of the pull request review dismissal message. (Required.)
- Message String `json:"message"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// DraftPullRequestReviewComment specifies a review comment to be left with a Pull Request Review.
-type DraftPullRequestReviewComment struct {
- // Path to the file being commented on. (Required.)
- Path String `json:"path"`
- // Position in the file to leave a comment on. (Required.)
- Position Int `json:"position"`
- // Body of the comment to leave. (Required.)
- Body String `json:"body"`
-}
-
-// GistOrder represents ordering options for gist connections.
-type GistOrder struct {
- // The field to order repositories by. (Required.)
- Field GistOrderField `json:"field"`
- // The ordering direction. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// ImportProjectInput is an autogenerated input type of ImportProject.
-type ImportProjectInput struct {
- // The name of the Organization or User to create the Project under. (Required.)
- OwnerName String `json:"ownerName"`
- // The name of Project. (Required.)
- Name String `json:"name"`
- // A list of columns containing issues and pull requests. (Required.)
- ColumnImports []ProjectColumnImport `json:"columnImports"`
-
- // The description of Project. (Optional.)
- Body *String `json:"body,omitempty"`
- // Whether the Project is public or not. (Optional.)
- Public *Boolean `json:"public,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// IssueFilters represents ways in which to filter lists of issues.
-type IssueFilters struct {
-
- // List issues assigned to given name. Pass in `null` for issues with no assigned user, and `*` for issues assigned to any user. (Optional.)
- Assignee *String `json:"assignee,omitempty"`
- // List issues created by given name. (Optional.)
- CreatedBy *String `json:"createdBy,omitempty"`
- // List issues where the list of label names exist on the issue. (Optional.)
- Labels *[]String `json:"labels,omitempty"`
- // List issues where the given name is mentioned in the issue. (Optional.)
- Mentioned *String `json:"mentioned,omitempty"`
- // List issues by given milestone argument. If an string representation of an integer is passed, it should refer to a milestone by its number field. Pass in `null` for issues with no milestone, and `*` for issues that are assigned to any milestone. (Optional.)
- Milestone *String `json:"milestone,omitempty"`
- // List issues that have been updated at or after the given date. (Optional.)
- Since *DateTime `json:"since,omitempty"`
- // List issues filtered by the list of states given. (Optional.)
- States *[]IssueState `json:"states,omitempty"`
- // List issues subscribed to by viewer. (Optional.)
- ViewerSubscribed *Boolean `json:"viewerSubscribed,omitempty"`
-}
-
-// IssueOrder represents ways in which lists of issues can be ordered upon return.
-type IssueOrder struct {
- // The field in which to order issues by. (Required.)
- Field IssueOrderField `json:"field"`
- // The direction in which to order issues by the specified field. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// LanguageOrder represents ordering options for language connections.
-type LanguageOrder struct {
- // The field to order languages by. (Required.)
- Field LanguageOrderField `json:"field"`
- // The ordering direction. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// LockLockableInput is an autogenerated input type of LockLockable.
-type LockLockableInput struct {
- // ID of the issue or pull request to be locked. (Required.)
- LockableID ID `json:"lockableId"`
-
- // A reason for why the issue or pull request will be locked. (Optional.)
- LockReason *LockReason `json:"lockReason,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// MergePullRequestInput is an autogenerated input type of MergePullRequest.
-type MergePullRequestInput struct {
- // ID of the pull request to be merged. (Required.)
- PullRequestID ID `json:"pullRequestId"`
-
- // Commit headline to use for the merge commit; if omitted, a default message will be used. (Optional.)
- CommitHeadline *String `json:"commitHeadline,omitempty"`
- // Commit body to use for the merge commit; if omitted, a default message will be used. (Optional.)
- CommitBody *String `json:"commitBody,omitempty"`
- // OID that the pull request head ref must match to allow merge; if omitted, no check is performed. (Optional.)
- ExpectedHeadOid *GitObjectID `json:"expectedHeadOid,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// MilestoneOrder represents ordering options for milestone connections.
-type MilestoneOrder struct {
- // The field to order milestones by. (Required.)
- Field MilestoneOrderField `json:"field"`
- // The ordering direction. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// MinimizeCommentInput is an autogenerated input type of MinimizeComment.
-type MinimizeCommentInput struct {
- // The Node ID of the subject to modify. (Required.)
- SubjectID ID `json:"subjectId"`
- // The classification of comment. (Required.)
- Classifier ReportedContentClassifiers `json:"classifier"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// MoveProjectCardInput is an autogenerated input type of MoveProjectCard.
-type MoveProjectCardInput struct {
- // The id of the card to move. (Required.)
- CardID ID `json:"cardId"`
- // The id of the column to move it into. (Required.)
- ColumnID ID `json:"columnId"`
-
- // Place the new card after the card with this id. Pass null to place it at the top. (Optional.)
- AfterCardID *ID `json:"afterCardId,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// MoveProjectColumnInput is an autogenerated input type of MoveProjectColumn.
-type MoveProjectColumnInput struct {
- // The id of the column to move. (Required.)
- ColumnID ID `json:"columnId"`
-
- // Place the new column after the column with this id. Pass null to place it at the front. (Optional.)
- AfterColumnID *ID `json:"afterColumnId,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// PinIssueInput is an autogenerated input type of PinIssue.
-type PinIssueInput struct {
- // The ID of the issue to be pinned. (Required.)
- IssueID ID `json:"issueId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// ProjectCardImport represents an issue or PR and its owning repository to be used in a project card.
-type ProjectCardImport struct {
- // Repository name with owner (owner/repository). (Required.)
- Repository String `json:"repository"`
- // The issue or pull request number. (Required.)
- Number Int `json:"number"`
-}
-
-// ProjectColumnImport represents a project column and a list of its issues and PRs.
-type ProjectColumnImport struct {
- // The name of the column. (Required.)
- ColumnName String `json:"columnName"`
- // The position of the column, starting from 0. (Required.)
- Position Int `json:"position"`
-
- // A list of issues and pull requests in the column. (Optional.)
- Issues *[]ProjectCardImport `json:"issues,omitempty"`
-}
-
-// ProjectOrder represents ways in which lists of projects can be ordered upon return.
-type ProjectOrder struct {
- // The field in which to order projects by. (Required.)
- Field ProjectOrderField `json:"field"`
- // The direction in which to order projects by the specified field. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// PullRequestOrder represents ways in which lists of issues can be ordered upon return.
-type PullRequestOrder struct {
- // The field in which to order pull requests by. (Required.)
- Field PullRequestOrderField `json:"field"`
- // The direction in which to order pull requests by the specified field. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// ReactionOrder represents ways in which lists of reactions can be ordered upon return.
-type ReactionOrder struct {
- // The field in which to order reactions by. (Required.)
- Field ReactionOrderField `json:"field"`
- // The direction in which to order reactions by the specified field. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// RefOrder represents ways in which lists of git refs can be ordered upon return.
-type RefOrder struct {
- // The field in which to order refs by. (Required.)
- Field RefOrderField `json:"field"`
- // The direction in which to order refs by the specified field. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// ReleaseOrder represents ways in which lists of releases can be ordered upon return.
-type ReleaseOrder struct {
- // The field in which to order releases by. (Required.)
- Field ReleaseOrderField `json:"field"`
- // The direction in which to order releases by the specified field. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// RemoveAssigneesFromAssignableInput is an autogenerated input type of RemoveAssigneesFromAssignable.
-type RemoveAssigneesFromAssignableInput struct {
- // The id of the assignable object to remove assignees from. (Required.)
- AssignableID ID `json:"assignableId"`
- // The id of users to remove as assignees. (Required.)
- AssigneeIDs []ID `json:"assigneeIds"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// RemoveLabelsFromLabelableInput is an autogenerated input type of RemoveLabelsFromLabelable.
-type RemoveLabelsFromLabelableInput struct {
- // The id of the Labelable to remove labels from. (Required.)
- LabelableID ID `json:"labelableId"`
- // The ids of labels to remove. (Required.)
- LabelIDs []ID `json:"labelIds"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// RemoveOutsideCollaboratorInput is an autogenerated input type of RemoveOutsideCollaborator.
-type RemoveOutsideCollaboratorInput struct {
- // The ID of the outside collaborator to remove. (Required.)
- UserID ID `json:"userId"`
- // The ID of the organization to remove the outside collaborator from. (Required.)
- OrganizationID ID `json:"organizationId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// RemoveReactionInput is an autogenerated input type of RemoveReaction.
-type RemoveReactionInput struct {
- // The Node ID of the subject to modify. (Required.)
- SubjectID ID `json:"subjectId"`
- // The name of the emoji reaction to remove. (Required.)
- Content ReactionContent `json:"content"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// RemoveStarInput is an autogenerated input type of RemoveStar.
-type RemoveStarInput struct {
- // The Starrable ID to unstar. (Required.)
- StarrableID ID `json:"starrableId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// ReopenIssueInput is an autogenerated input type of ReopenIssue.
-type ReopenIssueInput struct {
- // ID of the issue to be opened. (Required.)
- IssueID ID `json:"issueId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// ReopenPullRequestInput is an autogenerated input type of ReopenPullRequest.
-type ReopenPullRequestInput struct {
- // ID of the pull request to be reopened. (Required.)
- PullRequestID ID `json:"pullRequestId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// RepositoryOrder represents ordering options for repository connections.
-type RepositoryOrder struct {
- // The field to order repositories by. (Required.)
- Field RepositoryOrderField `json:"field"`
- // The ordering direction. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// RequestReviewsInput is an autogenerated input type of RequestReviews.
-type RequestReviewsInput struct {
- // The Node ID of the pull request to modify. (Required.)
- PullRequestID ID `json:"pullRequestId"`
-
- // The Node IDs of the user to request. (Optional.)
- UserIDs *[]ID `json:"userIds,omitempty"`
- // The Node IDs of the team to request. (Optional.)
- TeamIDs *[]ID `json:"teamIds,omitempty"`
- // Add users to the set rather than replace. (Optional.)
- Union *Boolean `json:"union,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// ResolveReviewThreadInput is an autogenerated input type of ResolveReviewThread.
-type ResolveReviewThreadInput struct {
- // The ID of the thread to resolve. (Required.)
- ThreadID ID `json:"threadId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// SecurityAdvisoryIdentifierFilter represents an advisory identifier to filter results on.
-type SecurityAdvisoryIdentifierFilter struct {
- // The identifier type. (Required.)
- Type SecurityAdvisoryIdentifierType `json:"type"`
- // The identifier string. Supports exact or partial matching. (Required.)
- Value String `json:"value"`
-}
-
-// SecurityAdvisoryOrder represents ordering options for security advisory connections.
-type SecurityAdvisoryOrder struct {
- // The field to order security advisories by. (Required.)
- Field SecurityAdvisoryOrderField `json:"field"`
- // The ordering direction. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// SecurityVulnerabilityOrder represents ordering options for security vulnerability connections.
-type SecurityVulnerabilityOrder struct {
- // The field to order security vulnerabilities by. (Required.)
- Field SecurityVulnerabilityOrderField `json:"field"`
- // The ordering direction. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// StarOrder represents ways in which star connections can be ordered.
-type StarOrder struct {
- // The field in which to order nodes by. (Required.)
- Field StarOrderField `json:"field"`
- // The direction in which to order nodes. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// SubmitPullRequestReviewInput is an autogenerated input type of SubmitPullRequestReview.
-type SubmitPullRequestReviewInput struct {
- // The Pull Request Review ID to submit. (Required.)
- PullRequestReviewID ID `json:"pullRequestReviewId"`
- // The event to send to the Pull Request Review. (Required.)
- Event PullRequestReviewEvent `json:"event"`
-
- // The text field to set on the Pull Request Review. (Optional.)
- Body *String `json:"body,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// TeamMemberOrder represents ordering options for team member connections.
-type TeamMemberOrder struct {
- // The field to order team members by. (Required.)
- Field TeamMemberOrderField `json:"field"`
- // The ordering direction. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// TeamOrder represents ways in which team connections can be ordered.
-type TeamOrder struct {
- // The field in which to order nodes by. (Required.)
- Field TeamOrderField `json:"field"`
- // The direction in which to order nodes. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// TeamRepositoryOrder represents ordering options for team repository connections.
-type TeamRepositoryOrder struct {
- // The field to order repositories by. (Required.)
- Field TeamRepositoryOrderField `json:"field"`
- // The ordering direction. (Required.)
- Direction OrderDirection `json:"direction"`
-}
-
-// UnlockLockableInput is an autogenerated input type of UnlockLockable.
-type UnlockLockableInput struct {
- // ID of the issue or pull request to be unlocked. (Required.)
- LockableID ID `json:"lockableId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UnmarkIssueAsDuplicateInput is an autogenerated input type of UnmarkIssueAsDuplicate.
-type UnmarkIssueAsDuplicateInput struct {
- // ID of the issue or pull request currently marked as a duplicate. (Required.)
- DuplicateID ID `json:"duplicateId"`
- // ID of the issue or pull request currently considered canonical/authoritative/original. (Required.)
- CanonicalID ID `json:"canonicalId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UnminimizeCommentInput is an autogenerated input type of UnminimizeComment.
-type UnminimizeCommentInput struct {
- // The Node ID of the subject to modify. (Required.)
- SubjectID ID `json:"subjectId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UnpinIssueInput is an autogenerated input type of UnpinIssue.
-type UnpinIssueInput struct {
- // The ID of the issue to be unpinned. (Required.)
- IssueID ID `json:"issueId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UnresolveReviewThreadInput is an autogenerated input type of UnresolveReviewThread.
-type UnresolveReviewThreadInput struct {
- // The ID of the thread to unresolve. (Required.)
- ThreadID ID `json:"threadId"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UpdateBranchProtectionRuleInput is an autogenerated input type of UpdateBranchProtectionRule.
-type UpdateBranchProtectionRuleInput struct {
- // The global relay id of the branch protection rule to be updated. (Required.)
- BranchProtectionRuleID ID `json:"branchProtectionRuleId"`
-
- // The glob-like pattern used to determine matching branches. (Optional.)
- Pattern *String `json:"pattern,omitempty"`
- // Are approving reviews required to update matching branches. (Optional.)
- RequiresApprovingReviews *Boolean `json:"requiresApprovingReviews,omitempty"`
- // Number of approving reviews required to update matching branches. (Optional.)
- RequiredApprovingReviewCount *Int `json:"requiredApprovingReviewCount,omitempty"`
- // Are commits required to be signed. (Optional.)
- RequiresCommitSignatures *Boolean `json:"requiresCommitSignatures,omitempty"`
- // Can admins overwrite branch protection. (Optional.)
- IsAdminEnforced *Boolean `json:"isAdminEnforced,omitempty"`
- // Are status checks required to update matching branches. (Optional.)
- RequiresStatusChecks *Boolean `json:"requiresStatusChecks,omitempty"`
- // Are branches required to be up to date before merging. (Optional.)
- RequiresStrictStatusChecks *Boolean `json:"requiresStrictStatusChecks,omitempty"`
- // Are reviews from code owners required to update matching branches. (Optional.)
- RequiresCodeOwnerReviews *Boolean `json:"requiresCodeOwnerReviews,omitempty"`
- // Will new commits pushed to matching branches dismiss pull request review approvals. (Optional.)
- DismissesStaleReviews *Boolean `json:"dismissesStaleReviews,omitempty"`
- // Is dismissal of pull request reviews restricted. (Optional.)
- RestrictsReviewDismissals *Boolean `json:"restrictsReviewDismissals,omitempty"`
- // A list of User or Team IDs allowed to dismiss reviews on pull requests targeting matching branches. (Optional.)
- ReviewDismissalActorIDs *[]ID `json:"reviewDismissalActorIds,omitempty"`
- // Is pushing to matching branches restricted. (Optional.)
- RestrictsPushes *Boolean `json:"restrictsPushes,omitempty"`
- // A list of User or Team IDs allowed to push to matching branches. (Optional.)
- PushActorIDs *[]ID `json:"pushActorIds,omitempty"`
- // List of required status check contexts that must pass for commits to be accepted to matching branches. (Optional.)
- RequiredStatusCheckContexts *[]String `json:"requiredStatusCheckContexts,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UpdateIssueCommentInput is an autogenerated input type of UpdateIssueComment.
-type UpdateIssueCommentInput struct {
- // The ID of the IssueComment to modify. (Required.)
- ID ID `json:"id"`
- // The updated text of the comment. (Required.)
- Body String `json:"body"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UpdateIssueInput is an autogenerated input type of UpdateIssue.
-type UpdateIssueInput struct {
- // The ID of the Issue to modify. (Required.)
- ID ID `json:"id"`
-
- // The title for the issue. (Optional.)
- Title *String `json:"title,omitempty"`
- // The body for the issue description. (Optional.)
- Body *String `json:"body,omitempty"`
- // An array of Node IDs of users for this issue. (Optional.)
- AssigneeIDs *[]ID `json:"assigneeIds,omitempty"`
- // The Node ID of the milestone for this issue. (Optional.)
- MilestoneID *ID `json:"milestoneId,omitempty"`
- // An array of Node IDs of labels for this issue. (Optional.)
- LabelIDs *[]ID `json:"labelIds,omitempty"`
- // The desired issue state. (Optional.)
- State *IssueState `json:"state,omitempty"`
- // An array of Node IDs for projects associated with this issue. (Optional.)
- ProjectIDs *[]ID `json:"projectIds,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UpdateProjectCardInput is an autogenerated input type of UpdateProjectCard.
-type UpdateProjectCardInput struct {
- // The ProjectCard ID to update. (Required.)
- ProjectCardID ID `json:"projectCardId"`
-
- // Whether or not the ProjectCard should be archived. (Optional.)
- IsArchived *Boolean `json:"isArchived,omitempty"`
- // The note of ProjectCard. (Optional.)
- Note *String `json:"note,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UpdateProjectColumnInput is an autogenerated input type of UpdateProjectColumn.
-type UpdateProjectColumnInput struct {
- // The ProjectColumn ID to update. (Required.)
- ProjectColumnID ID `json:"projectColumnId"`
- // The name of project column. (Required.)
- Name String `json:"name"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UpdateProjectInput is an autogenerated input type of UpdateProject.
-type UpdateProjectInput struct {
- // The Project ID to update. (Required.)
- ProjectID ID `json:"projectId"`
-
- // The name of project. (Optional.)
- Name *String `json:"name,omitempty"`
- // The description of project. (Optional.)
- Body *String `json:"body,omitempty"`
- // Whether the project is open or closed. (Optional.)
- State *ProjectState `json:"state,omitempty"`
- // Whether the project is public or not. (Optional.)
- Public *Boolean `json:"public,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UpdatePullRequestInput is an autogenerated input type of UpdatePullRequest.
-type UpdatePullRequestInput struct {
- // The Node ID of the pull request. (Required.)
- PullRequestID ID `json:"pullRequestId"`
-
- // The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. (Optional.)
- BaseRefName *String `json:"baseRefName,omitempty"`
- // The title of the pull request. (Optional.)
- Title *String `json:"title,omitempty"`
- // The contents of the pull request. (Optional.)
- Body *String `json:"body,omitempty"`
- // Indicates whether maintainers can modify the pull request. (Optional.)
- MaintainerCanModify *Boolean `json:"maintainerCanModify,omitempty"`
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UpdatePullRequestReviewCommentInput is an autogenerated input type of UpdatePullRequestReviewComment.
-type UpdatePullRequestReviewCommentInput struct {
- // The Node ID of the comment to modify. (Required.)
- PullRequestReviewCommentID ID `json:"pullRequestReviewCommentId"`
- // The text of the comment. (Required.)
- Body String `json:"body"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UpdatePullRequestReviewInput is an autogenerated input type of UpdatePullRequestReview.
-type UpdatePullRequestReviewInput struct {
- // The Node ID of the pull request review to modify. (Required.)
- PullRequestReviewID ID `json:"pullRequestReviewId"`
- // The contents of the pull request review body. (Required.)
- Body String `json:"body"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UpdateSubscriptionInput is an autogenerated input type of UpdateSubscription.
-type UpdateSubscriptionInput struct {
- // The Node ID of the subscribable object to modify. (Required.)
- SubscribableID ID `json:"subscribableId"`
- // The new state of the subscription. (Required.)
- State SubscriptionState `json:"state"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UpdateTopicsInput is an autogenerated input type of UpdateTopics.
-type UpdateTopicsInput struct {
- // The Node ID of the repository. (Required.)
- RepositoryID ID `json:"repositoryId"`
- // An array of topic names. (Required.)
- TopicNames []String `json:"topicNames"`
-
- // A unique identifier for the client performing the mutation. (Optional.)
- ClientMutationID *String `json:"clientMutationId,omitempty"`
-}
-
-// UserStatusOrder represents ordering options for user status connections.
-type UserStatusOrder struct {
- // The field to order user statuses by. (Required.)
- Field UserStatusOrderField `json:"field"`
- // The ordering direction. (Required.)
- Direction OrderDirection `json:"direction"`
-}
diff --git a/vendor/github.com/shurcooL/githubv4/scalar.go b/vendor/github.com/shurcooL/githubv4/scalar.go
deleted file mode 100644
index 56a39530..00000000
--- a/vendor/github.com/shurcooL/githubv4/scalar.go
+++ /dev/null
@@ -1,139 +0,0 @@
-package githubv4
-
-import (
- "crypto/x509"
- "encoding/json"
- "fmt"
- "net/url"
- "time"
-
- "github.com/shurcooL/graphql"
-)
-
-// Note: These custom types are meant to be used in queries for now.
-// But the plan is to switch to using native Go types (string, int, bool, time.Time, etc.).
-// See https://github.com/shurcooL/githubv4/issues/9 for details.
-//
-// These custom types currently provide documentation, and their use
-// is required for sending outbound queries. However, native Go types
-// can be used for unmarshaling. Once https://github.com/shurcooL/githubv4/issues/9
-// is resolved, native Go types can completely replace these.
-
-type (
- // Boolean represents true or false values.
- Boolean graphql.Boolean
-
- // Date is an ISO-8601 encoded date.
- Date struct{ time.Time }
-
- // DateTime is an ISO-8601 encoded UTC date.
- DateTime struct{ time.Time }
-
- // Float represents signed double-precision fractional values as
- // specified by IEEE 754.
- Float graphql.Float
-
- // GitObjectID is a Git object ID. For example,
- // "912ec1990bd09f8fc128c3fa6b59105085aabc03".
- GitObjectID string
-
- // GitTimestamp is an ISO-8601 encoded date.
- // Unlike the DateTime type, GitTimestamp is not converted in UTC.
- GitTimestamp struct{ time.Time }
-
- // HTML is a string containing HTML code.
- HTML string
-
- // ID represents a unique identifier that is Base64 obfuscated. It
- // is often used to refetch an object or as key for a cache. The ID
- // type appears in a JSON response as a String; however, it is not
- // intended to be human-readable. When expected as an input type,
- // any string (such as "VXNlci0xMA==") or integer (such as 4) input
- // value will be accepted as an ID.
- ID graphql.ID
-
- // Int represents non-fractional signed whole numeric values.
- // Int can represent values between -(2^31) and 2^31 - 1.
- Int graphql.Int
-
- // String represents textual data as UTF-8 character sequences.
- // This type is most often used by GraphQL to represent free-form
- // human-readable text.
- String graphql.String
-
- // URI is an RFC 3986, RFC 3987, and RFC 6570 (level 4) compliant URI.
- URI struct{ *url.URL }
-
- // X509Certificate is a valid x509 certificate.
- X509Certificate struct{ *x509.Certificate }
-)
-
-// MarshalJSON implements the json.Marshaler interface.
-// The URI is a quoted string.
-func (u URI) MarshalJSON() ([]byte, error) {
- return json.Marshal(u.String())
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-// The URI is expected to be a quoted string.
-func (u *URI) UnmarshalJSON(data []byte) error {
- // Ignore null, like in the main JSON package.
- if string(data) == "null" {
- return nil
- }
- var s string
- err := json.Unmarshal(data, &s)
- if err != nil {
- return err
- }
- u.URL, err = url.Parse(s)
- return err
-}
-
-// MarshalJSON implements the json.Marshaler interface.
-func (x X509Certificate) MarshalJSON() ([]byte, error) {
- // TODO: Implement.
- return nil, fmt.Errorf("X509Certificate.MarshalJSON: not implemented")
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (x *X509Certificate) UnmarshalJSON(data []byte) error {
- // TODO: Implement.
- return fmt.Errorf("X509Certificate.UnmarshalJSON: not implemented")
-}
-
-// NewBoolean is a helper to make a new *Boolean.
-func NewBoolean(v Boolean) *Boolean { return &v }
-
-// NewDate is a helper to make a new *Date.
-func NewDate(v Date) *Date { return &v }
-
-// NewDateTime is a helper to make a new *DateTime.
-func NewDateTime(v DateTime) *DateTime { return &v }
-
-// NewFloat is a helper to make a new *Float.
-func NewFloat(v Float) *Float { return &v }
-
-// NewGitObjectID is a helper to make a new *GitObjectID.
-func NewGitObjectID(v GitObjectID) *GitObjectID { return &v }
-
-// NewGitTimestamp is a helper to make a new *GitTimestamp.
-func NewGitTimestamp(v GitTimestamp) *GitTimestamp { return &v }
-
-// NewHTML is a helper to make a new *HTML.
-func NewHTML(v HTML) *HTML { return &v }
-
-// NewID is a helper to make a new *ID.
-func NewID(v ID) *ID { return &v }
-
-// NewInt is a helper to make a new *Int.
-func NewInt(v Int) *Int { return &v }
-
-// NewString is a helper to make a new *String.
-func NewString(v String) *String { return &v }
-
-// NewURI is a helper to make a new *URI.
-func NewURI(v URI) *URI { return &v }
-
-// NewX509Certificate is a helper to make a new *X509Certificate.
-func NewX509Certificate(v X509Certificate) *X509Certificate { return &v }
diff --git a/vendor/github.com/shurcooL/go/browser/LICENSE b/vendor/github.com/shurcooL/go/browser/LICENSE
deleted file mode 100644
index 6a66aea5..00000000
--- a/vendor/github.com/shurcooL/go/browser/LICENSE
+++ /dev/null
@@ -1,27 +0,0 @@
-Copyright (c) 2009 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/shurcooL/go/ctxhttp/ctxhttp.go b/vendor/github.com/shurcooL/go/ctxhttp/ctxhttp.go
deleted file mode 100644
index 3cf40a26..00000000
--- a/vendor/github.com/shurcooL/go/ctxhttp/ctxhttp.go
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build go1.7
-
-// Package ctxhttp provides helper functions for performing context-aware HTTP requests.
-//
-// It's a copy of "golang.org/x/net/context/ctxhttp" with pre-1.7 support dropped,
-// and "golang.org/x/net/context" import replaced with "context".
-// It exists temporarily until "golang.org/x/net/context/ctxhttp" is updated,
-// which will happen "in a couple releases" according to https://golang.org/cl/24620.
-package ctxhttp
-
-import (
- "context"
- "io"
- "net/http"
- "net/url"
- "strings"
-)
-
-// Do sends an HTTP request with the provided http.Client and returns
-// an HTTP response.
-//
-// If the client is nil, http.DefaultClient is used.
-//
-// The provided ctx must be non-nil. If it is canceled or times out,
-// ctx.Err() will be returned.
-func Do(ctx context.Context, client *http.Client, req *http.Request) (*http.Response, error) {
- if client == nil {
- client = http.DefaultClient
- }
- resp, err := client.Do(req.WithContext(ctx))
- // If we got an error, and the context has been canceled,
- // the context's error is probably more useful.
- if err != nil {
- select {
- case <-ctx.Done():
- err = ctx.Err()
- default:
- }
- }
- return resp, err
-}
-
-// Get issues a GET request via the Do function.
-func Get(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
- req, err := http.NewRequest("GET", url, nil)
- if err != nil {
- return nil, err
- }
- return Do(ctx, client, req)
-}
-
-// Head issues a HEAD request via the Do function.
-func Head(ctx context.Context, client *http.Client, url string) (*http.Response, error) {
- req, err := http.NewRequest("HEAD", url, nil)
- if err != nil {
- return nil, err
- }
- return Do(ctx, client, req)
-}
-
-// Post issues a POST request via the Do function.
-func Post(ctx context.Context, client *http.Client, url string, bodyType string, body io.Reader) (*http.Response, error) {
- req, err := http.NewRequest("POST", url, body)
- if err != nil {
- return nil, err
- }
- req.Header.Set("Content-Type", bodyType)
- return Do(ctx, client, req)
-}
-
-// PostForm issues a POST request via the Do function.
-func PostForm(ctx context.Context, client *http.Client, url string, data url.Values) (*http.Response, error) {
- return Post(ctx, client, url, "application/x-www-form-urlencoded", strings.NewReader(data.Encode()))
-}
diff --git a/vendor/github.com/shurcooL/graphql/.travis.yml b/vendor/github.com/shurcooL/graphql/.travis.yml
deleted file mode 100644
index 93b1fcdb..00000000
--- a/vendor/github.com/shurcooL/graphql/.travis.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-sudo: false
-language: go
-go:
- - 1.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/shurcooL/graphql/LICENSE b/vendor/github.com/shurcooL/graphql/LICENSE
deleted file mode 100644
index ca4c7764..00000000
--- a/vendor/github.com/shurcooL/graphql/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2017 Dmitri Shuralyov
-
-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/shurcooL/graphql/README.md b/vendor/github.com/shurcooL/graphql/README.md
deleted file mode 100644
index 6fa03bd4..00000000
--- a/vendor/github.com/shurcooL/graphql/README.md
+++ /dev/null
@@ -1,293 +0,0 @@
-graphql
-=======
-
-[![Build Status](https://travis-ci.org/shurcooL/graphql.svg?branch=master)](https://travis-ci.org/shurcooL/graphql) [![GoDoc](https://godoc.org/github.com/shurcooL/graphql?status.svg)](https://godoc.org/github.com/shurcooL/graphql)
-
-Package `graphql` provides a GraphQL client implementation.
-
-For more information, see package [`github.com/shurcooL/githubv4`](https://github.com/shurcooL/githubv4), which is a specialized version targeting GitHub GraphQL API v4. That package is driving the feature development.
-
-**Status:** In active early research and development. The API will change when opportunities for improvement are discovered; it is not yet frozen.
-
-Installation
-------------
-
-`graphql` requires Go version 1.8 or later.
-
-```bash
-go get -u github.com/shurcooL/graphql
-```
-
-Usage
------
-
-Construct a GraphQL client, specifying the GraphQL server URL. Then, you can use it to make GraphQL queries and mutations.
-
-```Go
-client := graphql.NewClient("https://example.com/graphql", nil)
-// Use client...
-```
-
-### Authentication
-
-Some GraphQL servers may require authentication. The `graphql` package does not directly handle authentication. Instead, when creating a new client, you're expected to pass an `http.Client` that performs authentication. The easiest and recommended way to do this is to use the [`golang.org/x/oauth2`](https://golang.org/x/oauth2) package. You'll need an OAuth token with the right scopes. Then:
-
-```Go
-import "golang.org/x/oauth2"
-
-func main() {
- src := oauth2.StaticTokenSource(
- &oauth2.Token{AccessToken: os.Getenv("GRAPHQL_TOKEN")},
- )
- httpClient := oauth2.NewClient(context.Background(), src)
-
- client := graphql.NewClient("https://example.com/graphql", httpClient)
- // Use client...
-```
-
-### Simple Query
-
-To make a GraphQL query, you need to define a corresponding Go type.
-
-For example, to make the following GraphQL query:
-
-```GraphQL
-query {
- me {
- name
- }
-}
-```
-
-You can define this variable:
-
-```Go
-var query struct {
- Me struct {
- Name graphql.String
- }
-}
-```
-
-Then call `client.Query`, passing a pointer to it:
-
-```Go
-err := client.Query(context.Background(), &query, nil)
-if err != nil {
- // Handle error.
-}
-fmt.Println(query.Me.Name)
-
-// Output: Luke Skywalker
-```
-
-### Arguments and Variables
-
-Often, you'll want to specify arguments on some fields. You can use the `graphql` struct field tag for this.
-
-For example, to make the following GraphQL query:
-
-```GraphQL
-{
- human(id: "1000") {
- name
- height(unit: METER)
- }
-}
-```
-
-You can define this variable:
-
-```Go
-var q struct {
- Human struct {
- Name graphql.String
- Height graphql.Float `graphql:"height(unit: METER)"`
- } `graphql:"human(id: \"1000\")"`
-}
-```
-
-Then call `client.Query`:
-
-```Go
-err := client.Query(context.Background(), &q, nil)
-if err != nil {
- // Handle error.
-}
-fmt.Println(q.Human.Name)
-fmt.Println(q.Human.Height)
-
-// Output:
-// Luke Skywalker
-// 1.72
-```
-
-However, that'll only work if the arguments are constant and known in advance. Otherwise, you will need to make use of variables. Replace the constants in the struct field tag with variable names:
-
-```Go
-var q struct {
- Human struct {
- Name graphql.String
- Height graphql.Float `graphql:"height(unit: $unit)"`
- } `graphql:"human(id: $id)"`
-}
-```
-
-Then, define a `variables` map with their values:
-
-```Go
-variables := map[string]interface{}{
- "id": graphql.ID(id),
- "unit": starwars.LengthUnit("METER"),
-}
-```
-
-Finally, call `client.Query` providing `variables`:
-
-```Go
-err := client.Query(context.Background(), &q, variables)
-if err != nil {
- // Handle error.
-}
-```
-
-### Inline Fragments
-
-Some GraphQL queries contain inline fragments. You can use the `graphql` struct field tag to express them.
-
-For example, to make the following GraphQL query:
-
-```GraphQL
-{
- hero(episode: "JEDI") {
- name
- ... on Droid {
- primaryFunction
- }
- ... on Human {
- height
- }
- }
-}
-```
-
-You can define this variable:
-
-```Go
-var q struct {
- Hero struct {
- Name graphql.String
- Droid struct {
- PrimaryFunction graphql.String
- } `graphql:"... on Droid"`
- Human struct {
- Height graphql.Float
- } `graphql:"... on Human"`
- } `graphql:"hero(episode: \"JEDI\")"`
-}
-```
-
-Alternatively, you can define the struct types corresponding to inline fragments, and use them as embedded fields in your query:
-
-```Go
-type (
- DroidFragment struct {
- PrimaryFunction graphql.String
- }
- HumanFragment struct {
- Height graphql.Float
- }
-)
-
-var q struct {
- Hero struct {
- Name graphql.String
- DroidFragment `graphql:"... on Droid"`
- HumanFragment `graphql:"... on Human"`
- } `graphql:"hero(episode: \"JEDI\")"`
-}
-```
-
-Then call `client.Query`:
-
-```Go
-err := client.Query(context.Background(), &q, nil)
-if err != nil {
- // Handle error.
-}
-fmt.Println(q.Hero.Name)
-fmt.Println(q.Hero.PrimaryFunction)
-fmt.Println(q.Hero.Height)
-
-// Output:
-// R2-D2
-// Astromech
-// 0
-```
-
-### Mutations
-
-Mutations often require information that you can only find out by performing a query first. Let's suppose you've already done that.
-
-For example, to make the following GraphQL mutation:
-
-```GraphQL
-mutation($ep: Episode!, $review: ReviewInput!) {
- createReview(episode: $ep, review: $review) {
- stars
- commentary
- }
-}
-variables {
- "ep": "JEDI",
- "review": {
- "stars": 5,
- "commentary": "This is a great movie!"
- }
-}
-```
-
-You can define:
-
-```Go
-var m struct {
- CreateReview struct {
- Stars graphql.Int
- Commentary graphql.String
- } `graphql:"createReview(episode: $ep, review: $review)"`
-}
-variables := map[string]interface{}{
- "ep": starwars.Episode("JEDI"),
- "review": starwars.ReviewInput{
- Stars: graphql.Int(5),
- Commentary: graphql.String("This is a great movie!"),
- },
-}
-```
-
-Then call `client.Mutate`:
-
-```Go
-err := client.Mutate(context.Background(), &m, variables)
-if err != nil {
- // Handle error.
-}
-fmt.Printf("Created a %v star review: %v\n", m.CreateReview.Stars, m.CreateReview.Commentary)
-
-// Output:
-// Created a 5 star review: This is a great movie!
-```
-
-Directories
------------
-
-| Path | Synopsis |
-|----------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|
-| [example/graphqldev](https://godoc.org/github.com/shurcooL/graphql/example/graphqldev) | graphqldev is a test program currently being used for developing graphql package. |
-| [ident](https://godoc.org/github.com/shurcooL/graphql/ident) | Package ident provides functions for parsing and converting identifier names between various naming convention. |
-| [internal/jsonutil](https://godoc.org/github.com/shurcooL/graphql/internal/jsonutil) | Package jsonutil provides a function for decoding JSON into a GraphQL query data structure. |
-
-License
--------
-
-- [MIT License](LICENSE)
diff --git a/vendor/github.com/shurcooL/graphql/doc.go b/vendor/github.com/shurcooL/graphql/doc.go
deleted file mode 100644
index 69ec4e03..00000000
--- a/vendor/github.com/shurcooL/graphql/doc.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// Package graphql provides a GraphQL client implementation.
-//
-// For more information, see package github.com/shurcooL/githubv4,
-// which is a specialized version targeting GitHub GraphQL API v4.
-// That package is driving the feature development.
-//
-// Status: In active early research and development. The API will change when
-// opportunities for improvement are discovered; it is not yet frozen.
-//
-// For now, see README for more details.
-package graphql // import "github.com/shurcooL/graphql"
diff --git a/vendor/github.com/shurcooL/graphql/graphql.go b/vendor/github.com/shurcooL/graphql/graphql.go
deleted file mode 100644
index f2c5b54f..00000000
--- a/vendor/github.com/shurcooL/graphql/graphql.go
+++ /dev/null
@@ -1,119 +0,0 @@
-package graphql
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "fmt"
- "net/http"
-
- "github.com/shurcooL/go/ctxhttp"
- "github.com/shurcooL/graphql/internal/jsonutil"
-)
-
-// Client is a GraphQL client.
-type Client struct {
- url string // GraphQL server URL.
- httpClient *http.Client
-}
-
-// NewClient creates a GraphQL client targeting the specified GraphQL server URL.
-// If httpClient is nil, then http.DefaultClient is used.
-func NewClient(url string, httpClient *http.Client) *Client {
- if httpClient == nil {
- httpClient = http.DefaultClient
- }
- return &Client{
- url: url,
- httpClient: httpClient,
- }
-}
-
-// Query executes a single GraphQL query request,
-// with a query derived from q, populating the response into it.
-// q should be a pointer to struct that corresponds to the GraphQL schema.
-func (c *Client) Query(ctx context.Context, q interface{}, variables map[string]interface{}) error {
- return c.do(ctx, queryOperation, q, variables)
-}
-
-// Mutate executes a single GraphQL mutation request,
-// with a mutation derived from m, populating the response into it.
-// m should be a pointer to struct that corresponds to the GraphQL schema.
-func (c *Client) Mutate(ctx context.Context, m interface{}, variables map[string]interface{}) error {
- return c.do(ctx, mutationOperation, m, variables)
-}
-
-// do executes a single GraphQL operation.
-func (c *Client) do(ctx context.Context, op operationType, v interface{}, variables map[string]interface{}) error {
- var query string
- switch op {
- case queryOperation:
- query = constructQuery(v, variables)
- case mutationOperation:
- query = constructMutation(v, variables)
- }
- in := struct {
- Query string `json:"query"`
- Variables map[string]interface{} `json:"variables,omitempty"`
- }{
- Query: query,
- Variables: variables,
- }
- var buf bytes.Buffer
- err := json.NewEncoder(&buf).Encode(in)
- if err != nil {
- return err
- }
- resp, err := ctxhttp.Post(ctx, c.httpClient, c.url, "application/json", &buf)
- if err != nil {
- return err
- }
- defer resp.Body.Close()
- if resp.StatusCode != http.StatusOK {
- return fmt.Errorf("unexpected status: %v", resp.Status)
- }
- var out struct {
- Data *json.RawMessage
- Errors errors
- //Extensions interface{} // Unused.
- }
- err = json.NewDecoder(resp.Body).Decode(&out)
- if err != nil {
- return err
- }
- if out.Data != nil {
- err := jsonutil.UnmarshalGraphQL(*out.Data, v)
- if err != nil {
- return err
- }
- }
- if len(out.Errors) > 0 {
- return out.Errors
- }
- return nil
-}
-
-// errors represents the "errors" array in a response from a GraphQL server.
-// If returned via error interface, the slice is expected to contain at least 1 element.
-//
-// Specification: https://facebook.github.io/graphql/#sec-Errors.
-type errors []struct {
- Message string
- Locations []struct {
- Line int
- Column int
- }
-}
-
-// Error implements error interface.
-func (e errors) Error() string {
- return e[0].Message
-}
-
-type operationType uint8
-
-const (
- queryOperation operationType = iota
- mutationOperation
- //subscriptionOperation // Unused.
-)
diff --git a/vendor/github.com/shurcooL/graphql/ident/ident.go b/vendor/github.com/shurcooL/graphql/ident/ident.go
deleted file mode 100644
index 29e498ed..00000000
--- a/vendor/github.com/shurcooL/graphql/ident/ident.go
+++ /dev/null
@@ -1,240 +0,0 @@
-// Package ident provides functions for parsing and converting identifier names
-// between various naming convention. It has support for MixedCaps, lowerCamelCase,
-// and SCREAMING_SNAKE_CASE naming conventions.
-package ident
-
-import (
- "strings"
- "unicode"
- "unicode/utf8"
-)
-
-// ParseMixedCaps parses a MixedCaps identifier name.
-//
-// E.g., "ClientMutationID" -> {"Client", "Mutation", "ID"}.
-func ParseMixedCaps(name string) Name {
- var words Name
-
- // Split name at any lower -> Upper or Upper -> Upper,lower transitions.
- // Check each word for initialisms.
- runes := []rune(name)
- w, i := 0, 0 // Index of start of word, scan.
- for i+1 <= len(runes) {
- eow := false // Whether we hit the end of a word.
- if i+1 == len(runes) {
- eow = true
- } else if unicode.IsLower(runes[i]) && unicode.IsUpper(runes[i+1]) {
- // lower -> Upper.
- eow = true
- } else if i+2 < len(runes) && unicode.IsUpper(runes[i]) && unicode.IsUpper(runes[i+1]) && unicode.IsLower(runes[i+2]) {
- // Upper -> Upper,lower. End of acronym, followed by a word.
- eow = true
-
- if string(runes[i:i+3]) == "IDs" { // Special case, plural form of ID initialism.
- eow = false
- }
- }
- i++
- if !eow {
- continue
- }
-
- // [w, i) is a word.
- word := string(runes[w:i])
- if initialism, ok := isInitialism(word); ok {
- words = append(words, initialism)
- } else if i1, i2, ok := isTwoInitialisms(word); ok {
- words = append(words, i1, i2)
- } else {
- words = append(words, word)
- }
- w = i
- }
- return words
-}
-
-// ParseLowerCamelCase parses a lowerCamelCase identifier name.
-//
-// E.g., "clientMutationId" -> {"client", "Mutation", "Id"}.
-func ParseLowerCamelCase(name string) Name {
- var words Name
-
- // Split name at any Upper letters.
- runes := []rune(name)
- w, i := 0, 0 // Index of start of word, scan.
- for i+1 <= len(runes) {
- eow := false // Whether we hit the end of a word.
- if i+1 == len(runes) {
- eow = true
- } else if unicode.IsUpper(runes[i+1]) {
- // Upper letter.
- eow = true
- }
- i++
- if !eow {
- continue
- }
-
- // [w, i) is a word.
- words = append(words, string(runes[w:i]))
- w = i
- }
- return words
-}
-
-// ParseScreamingSnakeCase parses a SCREAMING_SNAKE_CASE identifier name.
-//
-// E.g., "CLIENT_MUTATION_ID" -> {"CLIENT", "MUTATION", "ID"}.
-func ParseScreamingSnakeCase(name string) Name {
- var words Name
-
- // Split name at '_' characters.
- runes := []rune(name)
- w, i := 0, 0 // Index of start of word, scan.
- for i+1 <= len(runes) {
- eow := false // Whether we hit the end of a word.
- if i+1 == len(runes) {
- eow = true
- } else if runes[i+1] == '_' {
- // Underscore.
- eow = true
- }
- i++
- if !eow {
- continue
- }
-
- // [w, i) is a word.
- words = append(words, string(runes[w:i]))
- if i < len(runes) && runes[i] == '_' {
- // Skip underscore.
- i++
- }
- w = i
- }
- return words
-}
-
-// Name is an identifier name, broken up into individual words.
-type Name []string
-
-// ToMixedCaps expresses identifer name in MixedCaps naming convention.
-//
-// E.g., "ClientMutationID".
-func (n Name) ToMixedCaps() string {
- for i, word := range n {
- if strings.EqualFold(word, "IDs") { // Special case, plural form of ID initialism.
- n[i] = "IDs"
- continue
- }
- if initialism, ok := isInitialism(word); ok {
- n[i] = initialism
- continue
- }
- if brand, ok := isBrand(word); ok {
- n[i] = brand
- continue
- }
- r, size := utf8.DecodeRuneInString(word)
- n[i] = string(unicode.ToUpper(r)) + strings.ToLower(word[size:])
- }
- return strings.Join(n, "")
-}
-
-// ToLowerCamelCase expresses identifer name in lowerCamelCase naming convention.
-//
-// E.g., "clientMutationId".
-func (n Name) ToLowerCamelCase() string {
- for i, word := range n {
- if i == 0 {
- n[i] = strings.ToLower(word)
- continue
- }
- r, size := utf8.DecodeRuneInString(word)
- n[i] = string(unicode.ToUpper(r)) + strings.ToLower(word[size:])
- }
- return strings.Join(n, "")
-}
-
-// isInitialism reports whether word is an initialism.
-func isInitialism(word string) (string, bool) {
- initialism := strings.ToUpper(word)
- _, ok := initialisms[initialism]
- return initialism, ok
-}
-
-// isTwoInitialisms reports whether word is two initialisms.
-func isTwoInitialisms(word string) (string, string, bool) {
- word = strings.ToUpper(word)
- for i := 2; i <= len(word)-2; i++ { // Shortest initialism is 2 characters long.
- _, ok1 := initialisms[word[:i]]
- _, ok2 := initialisms[word[i:]]
- if ok1 && ok2 {
- return word[:i], word[i:], true
- }
- }
- return "", "", false
-}
-
-// initialisms is the set of initialisms in the MixedCaps naming convention.
-// 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 initialisms = map[string]struct{}{
- // These are the common initialisms from golint. Keep them in sync
- // with https://gotools.org/github.com/golang/lint#commonInitialisms.
- "ACL": {},
- "API": {},
- "ASCII": {},
- "CPU": {},
- "CSS": {},
- "DNS": {},
- "EOF": {},
- "GUID": {},
- "HTML": {},
- "HTTP": {},
- "HTTPS": {},
- "ID": {},
- "IP": {},
- "JSON": {},
- "LHS": {},
- "QPS": {},
- "RAM": {},
- "RHS": {},
- "RPC": {},
- "SLA": {},
- "SMTP": {},
- "SQL": {},
- "SSH": {},
- "TCP": {},
- "TLS": {},
- "TTL": {},
- "UDP": {},
- "UI": {},
- "UID": {},
- "UUID": {},
- "URI": {},
- "URL": {},
- "UTF8": {},
- "VM": {},
- "XML": {},
- "XMPP": {},
- "XSRF": {},
- "XSS": {},
-
- // Additional common initialisms.
- "RSS": {},
-}
-
-// isBrand reports whether word is a brand.
-func isBrand(word string) (string, bool) {
- brand, ok := brands[strings.ToLower(word)]
- return brand, ok
-}
-
-// brands is the map of brands in the MixedCaps naming convention;
-// see https://dmitri.shuralyov.com/idiomatic-go#for-brands-or-words-with-more-than-1-capital-letter-lowercase-all-letters.
-// Key is the lower case version of the brand, value is the canonical brand spelling.
-// Only add entries that are highly unlikely to be non-brands.
-var brands = map[string]string{
- "github": "GitHub",
-}
diff --git a/vendor/github.com/shurcooL/graphql/internal/jsonutil/graphql.go b/vendor/github.com/shurcooL/graphql/internal/jsonutil/graphql.go
deleted file mode 100644
index 9e75791d..00000000
--- a/vendor/github.com/shurcooL/graphql/internal/jsonutil/graphql.go
+++ /dev/null
@@ -1,308 +0,0 @@
-// Package jsonutil provides a function for decoding JSON
-// into a GraphQL query data structure.
-package jsonutil
-
-import (
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "reflect"
- "strings"
-)
-
-// UnmarshalGraphQL parses the JSON-encoded GraphQL response data and stores
-// the result in the GraphQL query data structure pointed to by v.
-//
-// The implementation is created on top of the JSON tokenizer available
-// in "encoding/json".Decoder.
-func UnmarshalGraphQL(data []byte, v interface{}) error {
- dec := json.NewDecoder(bytes.NewReader(data))
- dec.UseNumber()
- err := (&decoder{tokenizer: dec}).Decode(v)
- if err != nil {
- return err
- }
- tok, err := dec.Token()
- switch err {
- case io.EOF:
- // Expect to get io.EOF. There shouldn't be any more
- // tokens left after we've decoded v successfully.
- return nil
- case nil:
- return fmt.Errorf("invalid token '%v' after top-level value", tok)
- default:
- return err
- }
-}
-
-// decoder is a JSON decoder that performs custom unmarshaling behavior
-// for GraphQL query data structures. It's implemented on top of a JSON tokenizer.
-type decoder struct {
- tokenizer interface {
- Token() (json.Token, error)
- }
-
- // Stack of what part of input JSON we're in the middle of - objects, arrays.
- parseState []json.Delim
-
- // Stacks of values where to unmarshal.
- // The top of each stack is the reflect.Value where to unmarshal next JSON value.
- //
- // The reason there's more than one stack is because we might be unmarshaling
- // a single JSON value into multiple GraphQL fragments or embedded structs, so
- // we keep track of them all.
- vs [][]reflect.Value
-}
-
-// Decode decodes a single JSON value from d.tokenizer into v.
-func (d *decoder) Decode(v interface{}) error {
- rv := reflect.ValueOf(v)
- if rv.Kind() != reflect.Ptr {
- return fmt.Errorf("cannot decode into non-pointer %T", v)
- }
- d.vs = [][]reflect.Value{{rv.Elem()}}
- return d.decode()
-}
-
-// decode decodes a single JSON value from d.tokenizer into d.vs.
-func (d *decoder) decode() error {
- // The loop invariant is that the top of each d.vs stack
- // is where we try to unmarshal the next JSON value we see.
- for len(d.vs) > 0 {
- tok, err := d.tokenizer.Token()
- if err == io.EOF {
- return errors.New("unexpected end of JSON input")
- } else if err != nil {
- return err
- }
-
- switch {
-
- // Are we inside an object and seeing next key (rather than end of object)?
- case d.state() == '{' && tok != json.Delim('}'):
- key, ok := tok.(string)
- if !ok {
- return errors.New("unexpected non-key in JSON input")
- }
- someFieldExist := false
- for i := range d.vs {
- v := d.vs[i][len(d.vs[i])-1]
- if v.Kind() == reflect.Ptr {
- v = v.Elem()
- }
- var f reflect.Value
- if v.Kind() == reflect.Struct {
- f = fieldByGraphQLName(v, key)
- if f.IsValid() {
- someFieldExist = true
- }
- }
- d.vs[i] = append(d.vs[i], f)
- }
- if !someFieldExist {
- return fmt.Errorf("struct field for %s doesn't exist in any of %v places to unmarshal", key, len(d.vs))
- }
-
- // We've just consumed the current token, which was the key.
- // Read the next token, which should be the value, and let the rest of code process it.
- tok, err = d.tokenizer.Token()
- if err == io.EOF {
- return errors.New("unexpected end of JSON input")
- } else if err != nil {
- return err
- }
-
- // Are we inside an array and seeing next value (rather than end of array)?
- case d.state() == '[' && tok != json.Delim(']'):
- someSliceExist := false
- for i := range d.vs {
- v := d.vs[i][len(d.vs[i])-1]
- if v.Kind() == reflect.Ptr {
- v = v.Elem()
- }
- var f reflect.Value
- if v.Kind() == reflect.Slice {
- v.Set(reflect.Append(v, reflect.Zero(v.Type().Elem()))) // v = append(v, T).
- f = v.Index(v.Len() - 1)
- someSliceExist = true
- }
- d.vs[i] = append(d.vs[i], f)
- }
- if !someSliceExist {
- return fmt.Errorf("slice doesn't exist in any of %v places to unmarshal", len(d.vs))
- }
- }
-
- switch tok := tok.(type) {
- case string, json.Number, bool, nil:
- // Value.
-
- for i := range d.vs {
- v := d.vs[i][len(d.vs[i])-1]
- if !v.IsValid() {
- continue
- }
- err := unmarshalValue(tok, v)
- if err != nil {
- return err
- }
- }
- d.popAllVs()
-
- case json.Delim:
- switch tok {
- case '{':
- // Start of object.
-
- d.pushState(tok)
-
- frontier := make([]reflect.Value, len(d.vs)) // Places to look for GraphQL fragments/embedded structs.
- for i := range d.vs {
- v := d.vs[i][len(d.vs[i])-1]
- frontier[i] = v
- // TODO: Do this recursively or not? Add a test case if needed.
- if v.Kind() == reflect.Ptr && v.IsNil() {
- v.Set(reflect.New(v.Type().Elem())) // v = new(T).
- }
- }
- // Find GraphQL fragments/embedded structs recursively, adding to frontier
- // as new ones are discovered and exploring them further.
- for len(frontier) > 0 {
- v := frontier[0]
- frontier = frontier[1:]
- if v.Kind() == reflect.Ptr {
- v = v.Elem()
- }
- if v.Kind() != reflect.Struct {
- continue
- }
- for i := 0; i < v.NumField(); i++ {
- if isGraphQLFragment(v.Type().Field(i)) || v.Type().Field(i).Anonymous {
- // Add GraphQL fragment or embedded struct.
- d.vs = append(d.vs, []reflect.Value{v.Field(i)})
- frontier = append(frontier, v.Field(i))
- }
- }
- }
- case '[':
- // Start of array.
-
- d.pushState(tok)
-
- for i := range d.vs {
- v := d.vs[i][len(d.vs[i])-1]
- // TODO: Confirm this is needed, write a test case.
- //if v.Kind() == reflect.Ptr && v.IsNil() {
- // v.Set(reflect.New(v.Type().Elem())) // v = new(T).
- //}
-
- // Reset slice to empty (in case it had non-zero initial value).
- if v.Kind() == reflect.Ptr {
- v = v.Elem()
- }
- if v.Kind() != reflect.Slice {
- continue
- }
- v.Set(reflect.MakeSlice(v.Type(), 0, 0)) // v = make(T, 0, 0).
- }
- case '}', ']':
- // End of object or array.
- d.popAllVs()
- d.popState()
- default:
- return errors.New("unexpected delimiter in JSON input")
- }
- default:
- return errors.New("unexpected token in JSON input")
- }
- }
- return nil
-}
-
-// pushState pushes a new parse state s onto the stack.
-func (d *decoder) pushState(s json.Delim) {
- d.parseState = append(d.parseState, s)
-}
-
-// popState pops a parse state (already obtained) off the stack.
-// The stack must be non-empty.
-func (d *decoder) popState() {
- d.parseState = d.parseState[:len(d.parseState)-1]
-}
-
-// state reports the parse state on top of stack, or 0 if empty.
-func (d *decoder) state() json.Delim {
- if len(d.parseState) == 0 {
- return 0
- }
- return d.parseState[len(d.parseState)-1]
-}
-
-// popAllVs pops from all d.vs stacks, keeping only non-empty ones.
-func (d *decoder) popAllVs() {
- var nonEmpty [][]reflect.Value
- for i := range d.vs {
- d.vs[i] = d.vs[i][:len(d.vs[i])-1]
- if len(d.vs[i]) > 0 {
- nonEmpty = append(nonEmpty, d.vs[i])
- }
- }
- d.vs = nonEmpty
-}
-
-// fieldByGraphQLName returns a struct field of struct v that matches GraphQL name,
-// or invalid reflect.Value if none found.
-func fieldByGraphQLName(v reflect.Value, name string) reflect.Value {
- for i := 0; i < v.NumField(); i++ {
- if hasGraphQLName(v.Type().Field(i), name) {
- return v.Field(i)
- }
- }
- return reflect.Value{}
-}
-
-// hasGraphQLName reports whether struct field f has GraphQL name.
-func hasGraphQLName(f reflect.StructField, name string) bool {
- value, ok := f.Tag.Lookup("graphql")
- if !ok {
- // TODO: caseconv package is relatively slow. Optimize it, then consider using it here.
- //return caseconv.MixedCapsToLowerCamelCase(f.Name) == name
- return strings.EqualFold(f.Name, name)
- }
- value = strings.TrimSpace(value) // TODO: Parse better.
- if strings.HasPrefix(value, "...") {
- // GraphQL fragment. It doesn't have a name.
- return false
- }
- if i := strings.Index(value, "("); i != -1 {
- value = value[:i]
- }
- if i := strings.Index(value, ":"); i != -1 {
- value = value[:i]
- }
- return strings.TrimSpace(value) == name
-}
-
-// isGraphQLFragment reports whether struct field f is a GraphQL fragment.
-func isGraphQLFragment(f reflect.StructField) bool {
- value, ok := f.Tag.Lookup("graphql")
- if !ok {
- return false
- }
- value = strings.TrimSpace(value) // TODO: Parse better.
- return strings.HasPrefix(value, "...")
-}
-
-// unmarshalValue unmarshals JSON value into v.
-func unmarshalValue(value json.Token, v reflect.Value) error {
- b, err := json.Marshal(value) // TODO: Short-circuit (if profiling says it's worth it).
- if err != nil {
- return err
- }
- if !v.CanAddr() {
- return fmt.Errorf("value %v is not addressable", v)
- }
- return json.Unmarshal(b, v.Addr().Interface())
-}
diff --git a/vendor/github.com/shurcooL/graphql/query.go b/vendor/github.com/shurcooL/graphql/query.go
deleted file mode 100644
index e10b7718..00000000
--- a/vendor/github.com/shurcooL/graphql/query.go
+++ /dev/null
@@ -1,131 +0,0 @@
-package graphql
-
-import (
- "bytes"
- "encoding/json"
- "io"
- "reflect"
- "sort"
-
- "github.com/shurcooL/graphql/ident"
-)
-
-func constructQuery(v interface{}, variables map[string]interface{}) string {
- query := query(v)
- if len(variables) > 0 {
- return "query(" + queryArguments(variables) + ")" + query
- }
- return query
-}
-
-func constructMutation(v interface{}, variables map[string]interface{}) string {
- query := query(v)
- if len(variables) > 0 {
- return "mutation(" + queryArguments(variables) + ")" + query
- }
- return "mutation" + query
-}
-
-// queryArguments constructs a minified arguments string for variables.
-//
-// E.g., map[string]interface{}{"a": Int(123), "b": NewBoolean(true)} -> "$a:Int!$b:Boolean".
-func queryArguments(variables map[string]interface{}) string {
- // Sort keys in order to produce deterministic output for testing purposes.
- // TODO: If tests can be made to work with non-deterministic output, then no need to sort.
- keys := make([]string, 0, len(variables))
- for k := range variables {
- keys = append(keys, k)
- }
- sort.Strings(keys)
-
- var buf bytes.Buffer
- for _, k := range keys {
- io.WriteString(&buf, "$")
- io.WriteString(&buf, k)
- io.WriteString(&buf, ":")
- writeArgumentType(&buf, reflect.TypeOf(variables[k]), true)
- // Don't insert a comma here.
- // Commas in GraphQL are insignificant, and we want minified output.
- // See https://facebook.github.io/graphql/October2016/#sec-Insignificant-Commas.
- }
- return buf.String()
-}
-
-// writeArgumentType writes a minified GraphQL type for t to w.
-// value indicates whether t is a value (required) type or pointer (optional) type.
-// If value is true, then "!" is written at the end of t.
-func writeArgumentType(w io.Writer, t reflect.Type, value bool) {
- if t.Kind() == reflect.Ptr {
- // Pointer is an optional type, so no "!" at the end of the pointer's underlying type.
- writeArgumentType(w, t.Elem(), false)
- return
- }
-
- switch t.Kind() {
- case reflect.Slice, reflect.Array:
- // List. E.g., "[Int]".
- io.WriteString(w, "[")
- writeArgumentType(w, t.Elem(), true)
- io.WriteString(w, "]")
- default:
- // Named type. E.g., "Int".
- name := t.Name()
- if name == "string" { // HACK: Workaround for https://github.com/shurcooL/githubv4/issues/12.
- name = "ID"
- }
- io.WriteString(w, name)
- }
-
- if value {
- // Value is a required type, so add "!" to the end.
- io.WriteString(w, "!")
- }
-}
-
-// query uses writeQuery to recursively construct
-// a minified query string from the provided struct v.
-//
-// E.g., struct{Foo Int, BarBaz *Boolean} -> "{foo,barBaz}".
-func query(v interface{}) string {
- var buf bytes.Buffer
- writeQuery(&buf, reflect.TypeOf(v), false)
- return buf.String()
-}
-
-// writeQuery writes a minified query for t to w.
-// If inline is true, the struct fields of t are inlined into parent struct.
-func writeQuery(w io.Writer, t reflect.Type, inline bool) {
- switch t.Kind() {
- case reflect.Ptr, reflect.Slice:
- writeQuery(w, t.Elem(), false)
- case reflect.Struct:
- // If the type implements json.Unmarshaler, it's a scalar. Don't expand it.
- if reflect.PtrTo(t).Implements(jsonUnmarshaler) {
- return
- }
- if !inline {
- io.WriteString(w, "{")
- }
- for i := 0; i < t.NumField(); i++ {
- if i != 0 {
- io.WriteString(w, ",")
- }
- f := t.Field(i)
- value, ok := f.Tag.Lookup("graphql")
- inlineField := f.Anonymous && !ok
- if !inlineField {
- if ok {
- io.WriteString(w, value)
- } else {
- io.WriteString(w, ident.ParseMixedCaps(f.Name).ToLowerCamelCase())
- }
- }
- writeQuery(w, f.Type, inlineField)
- }
- if !inline {
- io.WriteString(w, "}")
- }
- }
-}
-
-var jsonUnmarshaler = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem()
diff --git a/vendor/github.com/shurcooL/graphql/scalar.go b/vendor/github.com/shurcooL/graphql/scalar.go
deleted file mode 100644
index 0f7ceea5..00000000
--- a/vendor/github.com/shurcooL/graphql/scalar.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package graphql
-
-// Note: These custom types are meant to be used in queries for now.
-// But the plan is to switch to using native Go types (string, int, bool, time.Time, etc.).
-// See https://github.com/shurcooL/githubv4/issues/9 for details.
-//
-// These custom types currently provide documentation, and their use
-// is required for sending outbound queries. However, native Go types
-// can be used for unmarshaling. Once https://github.com/shurcooL/githubv4/issues/9
-// is resolved, native Go types can completely replace these.
-
-type (
- // Boolean represents true or false values.
- Boolean bool
-
- // Float represents signed double-precision fractional values as
- // specified by IEEE 754.
- Float float64
-
- // ID represents a unique identifier that is Base64 obfuscated. It
- // is often used to refetch an object or as key for a cache. The ID
- // type appears in a JSON response as a String; however, it is not
- // intended to be human-readable. When expected as an input type,
- // any string (such as "VXNlci0xMA==") or integer (such as 4) input
- // value will be accepted as an ID.
- ID interface{}
-
- // Int represents non-fractional signed whole numeric values.
- // Int can represent values between -(2^31) and 2^31 - 1.
- Int int32
-
- // String represents textual data as UTF-8 character sequences.
- // This type is most often used by GraphQL to represent free-form
- // human-readable text.
- String string
-)
-
-// NewBoolean is a helper to make a new *Boolean.
-func NewBoolean(v Boolean) *Boolean { return &v }
-
-// NewFloat is a helper to make a new *Float.
-func NewFloat(v Float) *Float { return &v }
-
-// NewID is a helper to make a new *ID.
-func NewID(v ID) *ID { return &v }
-
-// NewInt is a helper to make a new *Int.
-func NewInt(v Int) *Int { return &v }
-
-// NewString is a helper to make a new *String.
-func NewString(v String) *String { return &v }
diff --git a/vendor/github.com/shurcooL/httpfs/filter/filter.go b/vendor/github.com/shurcooL/httpfs/filter/filter.go
deleted file mode 100644
index 6f03e597..00000000
--- a/vendor/github.com/shurcooL/httpfs/filter/filter.go
+++ /dev/null
@@ -1,133 +0,0 @@
-// Package filter offers an http.FileSystem wrapper with the ability to keep or skip files.
-package filter
-
-import (
- "fmt"
- "io"
- "net/http"
- "os"
- pathpkg "path"
- "time"
-)
-
-// Func is a selection function which is provided two arguments,
-// its '/'-separated cleaned rooted absolute path (i.e., it always begins with "/"),
-// and the os.FileInfo of the considered file.
-//
-// The path is cleaned via pathpkg.Clean("/" + path).
-//
-// For example, if the considered file is named "a" and it's inside a directory "dir",
-// then the value of path will be "/dir/a".
-type Func func(path string, fi os.FileInfo) bool
-
-// Keep returns a filesystem that contains only those entries in source for which
-// keep returns true.
-func Keep(source http.FileSystem, keep Func) http.FileSystem {
- return &filterFS{source: source, keep: keep}
-}
-
-// Skip returns a filesystem that contains everything in source, except entries
-// for which skip returns true.
-func Skip(source http.FileSystem, skip Func) http.FileSystem {
- keep := func(path string, fi os.FileInfo) bool {
- return !skip(path, fi)
- }
- return &filterFS{source: source, keep: keep}
-}
-
-type filterFS struct {
- source http.FileSystem
- keep Func // Keep entries that keep returns true for.
-}
-
-func (fs *filterFS) Open(path string) (http.File, error) {
- f, err := fs.source.Open(path)
- if err != nil {
- return nil, err
- }
-
- fi, err := f.Stat()
- if err != nil {
- f.Close()
- return nil, err
- }
-
- if !fs.keep(clean(path), fi) {
- // Skip.
- f.Close()
- return nil, &os.PathError{Op: "open", Path: path, Err: os.ErrNotExist}
- }
-
- if !fi.IsDir() {
- return f, nil
- }
- defer f.Close()
-
- fis, err := f.Readdir(0)
- if err != nil {
- return nil, err
- }
-
- var entries []os.FileInfo
- for _, fi := range fis {
- if !fs.keep(clean(pathpkg.Join(path, fi.Name())), fi) {
- // Skip.
- continue
- }
- entries = append(entries, fi)
- }
-
- return &dir{
- name: fi.Name(),
- entries: entries,
- modTime: fi.ModTime(),
- }, nil
-}
-
-// clean turns a potentially relative path into an absolute one.
-//
-// This is needed to normalize path parameter for selection function.
-func clean(path string) string {
- return pathpkg.Clean("/" + path)
-}
-
-// dir is an opened dir instance.
-type dir struct {
- name string
- modTime time.Time
- entries []os.FileInfo
- pos int // Position within entries for Seek and Readdir.
-}
-
-func (d *dir) Read([]byte) (int, error) {
- return 0, fmt.Errorf("cannot Read from directory %s", d.name)
-}
-func (d *dir) Close() error { return nil }
-func (d *dir) Stat() (os.FileInfo, error) { return d, nil }
-
-func (d *dir) Name() string { return d.name }
-func (d *dir) Size() int64 { return 0 }
-func (d *dir) Mode() os.FileMode { return 0755 | os.ModeDir }
-func (d *dir) ModTime() time.Time { return d.modTime }
-func (d *dir) IsDir() bool { return true }
-func (d *dir) Sys() interface{} { return nil }
-
-func (d *dir) Seek(offset int64, whence int) (int64, error) {
- if offset == 0 && whence == io.SeekStart {
- d.pos = 0
- return 0, nil
- }
- return 0, fmt.Errorf("unsupported Seek in directory %s", d.name)
-}
-
-func (d *dir) Readdir(count int) ([]os.FileInfo, error) {
- if d.pos >= len(d.entries) && count > 0 {
- return nil, io.EOF
- }
- if count <= 0 || count > len(d.entries)-d.pos {
- count = len(d.entries) - d.pos
- }
- e := d.entries[d.pos : d.pos+count]
- d.pos += count
- return e, nil
-}
diff --git a/vendor/github.com/shurcooL/httpfs/filter/filters.go b/vendor/github.com/shurcooL/httpfs/filter/filters.go
deleted file mode 100644
index a20edaf4..00000000
--- a/vendor/github.com/shurcooL/httpfs/filter/filters.go
+++ /dev/null
@@ -1,26 +0,0 @@
-package filter
-
-import (
- "os"
- pathpkg "path"
-)
-
-// FilesWithExtensions returns a filter func that selects files (but not directories)
-// that have any of the given extensions. For example:
-//
-// filter.FilesWithExtensions(".go", ".html")
-//
-// Would select both .go and .html files. It would not select any directories.
-func FilesWithExtensions(exts ...string) Func {
- return func(path string, fi os.FileInfo) bool {
- if fi.IsDir() {
- return false
- }
- for _, ext := range exts {
- if pathpkg.Ext(path) == ext {
- return true
- }
- }
- return false
- }
-}
diff --git a/vendor/github.com/shurcooL/httpfs/vfsutil/file.go b/vendor/github.com/shurcooL/httpfs/vfsutil/file.go
deleted file mode 100644
index 4cb0dada..00000000
--- a/vendor/github.com/shurcooL/httpfs/vfsutil/file.go
+++ /dev/null
@@ -1,21 +0,0 @@
-package vfsutil
-
-import (
- "net/http"
- "os"
-)
-
-// File implements http.FileSystem using the native file system restricted to a
-// specific file served at root.
-//
-// While the FileSystem.Open method takes '/'-separated paths, a File's string
-// value is a filename on the native file system, not a URL, so it is separated
-// by filepath.Separator, which isn't necessarily '/'.
-type File string
-
-func (f File) Open(name string) (http.File, error) {
- if name != "/" {
- return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
- }
- return os.Open(string(f))
-}
diff --git a/vendor/github.com/shurcooL/httpfs/vfsutil/vfsutil.go b/vendor/github.com/shurcooL/httpfs/vfsutil/vfsutil.go
deleted file mode 100644
index df071d11..00000000
--- a/vendor/github.com/shurcooL/httpfs/vfsutil/vfsutil.go
+++ /dev/null
@@ -1,39 +0,0 @@
-// Package vfsutil implements some I/O utility functions for http.FileSystem.
-package vfsutil
-
-import (
- "io/ioutil"
- "net/http"
- "os"
-)
-
-// ReadDir reads the contents of the directory associated with file and
-// returns a slice of FileInfo values in directory order.
-func ReadDir(fs http.FileSystem, name string) ([]os.FileInfo, error) {
- f, err := fs.Open(name)
- if err != nil {
- return nil, err
- }
- defer f.Close()
- return f.Readdir(0)
-}
-
-// Stat returns the FileInfo structure describing file.
-func Stat(fs http.FileSystem, name string) (os.FileInfo, error) {
- f, err := fs.Open(name)
- if err != nil {
- return nil, err
- }
- defer f.Close()
- return f.Stat()
-}
-
-// ReadFile reads the file named by path from fs and returns the contents.
-func ReadFile(fs http.FileSystem, path string) ([]byte, error) {
- rc, err := fs.Open(path)
- if err != nil {
- return nil, err
- }
- defer rc.Close()
- return ioutil.ReadAll(rc)
-}
diff --git a/vendor/github.com/shurcooL/httpfs/vfsutil/walk.go b/vendor/github.com/shurcooL/httpfs/vfsutil/walk.go
deleted file mode 100644
index f256bbec..00000000
--- a/vendor/github.com/shurcooL/httpfs/vfsutil/walk.go
+++ /dev/null
@@ -1,146 +0,0 @@
-package vfsutil
-
-import (
- "io"
- "net/http"
- "os"
- pathpkg "path"
- "path/filepath"
- "sort"
-)
-
-// Walk walks the filesystem rooted at root, calling walkFn for each file or
-// directory in the filesystem, including root. All errors that arise visiting files
-// and directories are filtered by walkFn. The files are walked in lexical
-// order.
-func Walk(fs http.FileSystem, root string, walkFn filepath.WalkFunc) error {
- info, err := Stat(fs, root)
- if err != nil {
- return walkFn(root, nil, err)
- }
- return walk(fs, root, info, walkFn)
-}
-
-// readDirNames reads the directory named by dirname and returns
-// a sorted list of directory entries.
-func readDirNames(fs http.FileSystem, dirname string) ([]string, error) {
- fis, err := ReadDir(fs, dirname)
- if err != nil {
- return nil, err
- }
- names := make([]string, len(fis))
- for i := range fis {
- names[i] = fis[i].Name()
- }
- sort.Strings(names)
- return names, nil
-}
-
-// walk recursively descends path, calling walkFn.
-func walk(fs http.FileSystem, path string, info os.FileInfo, walkFn filepath.WalkFunc) error {
- err := walkFn(path, info, nil)
- if err != nil {
- if info.IsDir() && err == filepath.SkipDir {
- return nil
- }
- return err
- }
-
- if !info.IsDir() {
- return nil
- }
-
- names, err := readDirNames(fs, path)
- if err != nil {
- return walkFn(path, info, err)
- }
-
- for _, name := range names {
- filename := pathpkg.Join(path, name)
- fileInfo, err := Stat(fs, filename)
- if err != nil {
- if err := walkFn(filename, fileInfo, err); err != nil && err != filepath.SkipDir {
- return err
- }
- } else {
- err = walk(fs, filename, fileInfo, walkFn)
- if err != nil {
- if !fileInfo.IsDir() || err != filepath.SkipDir {
- return err
- }
- }
- }
- }
- return nil
-}
-
-// WalkFilesFunc is the type of the function called for each file or directory visited by WalkFiles.
-// It's like filepath.WalkFunc, except it provides an additional ReadSeeker parameter for file being visited.
-type WalkFilesFunc func(path string, info os.FileInfo, rs io.ReadSeeker, err error) error
-
-// WalkFiles walks the filesystem rooted at root, calling walkFn for each file or
-// directory in the filesystem, including root. In addition to FileInfo, it passes an
-// ReadSeeker to walkFn for each file it visits.
-func WalkFiles(fs http.FileSystem, root string, walkFn WalkFilesFunc) error {
- file, info, err := openStat(fs, root)
- if err != nil {
- return walkFn(root, nil, nil, err)
- }
- return walkFiles(fs, root, info, file, walkFn)
-}
-
-// walkFiles recursively descends path, calling walkFn.
-// It closes the input file after it's done with it, so the caller shouldn't.
-func walkFiles(fs http.FileSystem, path string, info os.FileInfo, file http.File, walkFn WalkFilesFunc) error {
- err := walkFn(path, info, file, nil)
- file.Close()
- if err != nil {
- if info.IsDir() && err == filepath.SkipDir {
- return nil
- }
- return err
- }
-
- if !info.IsDir() {
- return nil
- }
-
- names, err := readDirNames(fs, path)
- if err != nil {
- return walkFn(path, info, nil, err)
- }
-
- for _, name := range names {
- filename := pathpkg.Join(path, name)
- file, fileInfo, err := openStat(fs, filename)
- if err != nil {
- if err := walkFn(filename, nil, nil, err); err != nil && err != filepath.SkipDir {
- return err
- }
- } else {
- err = walkFiles(fs, filename, fileInfo, file, walkFn)
- // file is closed by walkFiles, so we don't need to close it here.
- if err != nil {
- if !fileInfo.IsDir() || err != filepath.SkipDir {
- return err
- }
- }
- }
- }
- return nil
-}
-
-// openStat performs Open and Stat and returns results, or first error encountered.
-// The caller is responsible for closing the returned file when done.
-func openStat(fs http.FileSystem, name string) (http.File, os.FileInfo, error) {
- f, err := fs.Open(name)
- if err != nil {
- return nil, nil, err
- }
- fi, err := f.Stat()
- if err != nil {
- f.Close()
- return nil, nil, err
- }
- return f, fi, nil
-}
diff --git a/vendor/github.com/shurcooL/vfsgen/.travis.yml b/vendor/github.com/shurcooL/vfsgen/.travis.yml
deleted file mode 100644
index 93b1fcdb..00000000
--- a/vendor/github.com/shurcooL/vfsgen/.travis.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-sudo: false
-language: go
-go:
- - 1.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/shurcooL/vfsgen/CONTRIBUTING.md b/vendor/github.com/shurcooL/vfsgen/CONTRIBUTING.md
deleted file mode 100644
index 6127ddce..00000000
--- a/vendor/github.com/shurcooL/vfsgen/CONTRIBUTING.md
+++ /dev/null
@@ -1,10 +0,0 @@
-Contributing
-============
-
-vfsgen is open source, thanks for considering contributing!
-
-Please note that vfsgen aims to be simple and minimalistic, with as little to configure as possible. If you'd like to remove or simplify code (while having tests continue to pass), fix bugs, or improve code (e.g., add missing error checking, etc.), PRs and issues are welcome.
-
-However, if you'd like to add new functionality that increases complexity or scope, please make an issue and discuss your proposal first. I'm unlikely to accept such changes outright. It might be that your request is already a part of other similar packages, or it might fit in their scope better. See [Comparison and Alternatives](https://github.com/shurcooL/vfsgen/tree/README-alternatives-and-comparison-section#comparison) sections.
-
-Thank you!
diff --git a/vendor/github.com/shurcooL/vfsgen/LICENSE b/vendor/github.com/shurcooL/vfsgen/LICENSE
deleted file mode 100644
index c35c17af..00000000
--- a/vendor/github.com/shurcooL/vfsgen/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2015 Dmitri Shuralyov
-
-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/shurcooL/vfsgen/README.md b/vendor/github.com/shurcooL/vfsgen/README.md
deleted file mode 100644
index 659a0a03..00000000
--- a/vendor/github.com/shurcooL/vfsgen/README.md
+++ /dev/null
@@ -1,201 +0,0 @@
-vfsgen
-======
-
-[![Build Status](https://travis-ci.org/shurcooL/vfsgen.svg?branch=master)](https://travis-ci.org/shurcooL/vfsgen) [![GoDoc](https://godoc.org/github.com/shurcooL/vfsgen?status.svg)](https://godoc.org/github.com/shurcooL/vfsgen)
-
-Package vfsgen takes an http.FileSystem (likely at `go generate` time) and
-generates Go code that statically implements the provided http.FileSystem.
-
-Features:
-
-- Efficient generated code without unneccessary overhead.
-
-- Uses gzip compression internally (selectively, only for files that compress well).
-
-- Enables direct access to internal gzip compressed bytes via an optional interface.
-
-- Outputs `gofmt`ed Go code.
-
-Installation
-------------
-
-```bash
-go get -u github.com/shurcooL/vfsgen
-```
-
-Usage
------
-
-Package `vfsgen` is a Go code generator library. It has a `Generate` function that takes an input filesystem (as a [`http.FileSystem`](https://godoc.org/net/http#FileSystem) type), and generates a Go code file that statically implements the contents of the input filesystem.
-
-For example, we can use [`http.Dir`](https://godoc.org/net/http#Dir) as a `http.FileSystem` implementation that uses the contents of the `/path/to/assets` directory:
-
-```Go
-var fs http.FileSystem = http.Dir("/path/to/assets")
-```
-
-Now, when you execute the following code:
-
-```Go
-err := vfsgen.Generate(fs, vfsgen.Options{})
-if err != nil {
- log.Fatalln(err)
-}
-```
-
-An assets_vfsdata.go file will be generated in the current directory:
-
-```Go
-// Code generated by vfsgen; DO NOT EDIT.
-
-package main
-
-import ...
-
-// assets statically implements the virtual filesystem provided to vfsgen.Generate.
-var assets http.FileSystem = ...
-```
-
-Then, in your program, you can use `assets` as any other [`http.FileSystem`](https://godoc.org/net/http#FileSystem), for example:
-
-```Go
-file, err := assets.Open("/some/file.txt")
-if err != nil {
- return err
-}
-defer file.Close()
-```
-
-```Go
-http.Handle("/assets/", http.FileServer(assets))
-```
-
-`vfsgen` can be more useful when combined with build tags and go generate directives. This is described below.
-
-### `go generate` Usage
-
-vfsgen is great to use with go generate directives. The code invoking `vfsgen.Generate` can go in an assets_generate.go file, which can then be invoked via "//go:generate go run assets_generate.go". The input virtual filesystem can read directly from disk, or it can be more involved.
-
-By using build tags, you can create a development mode where assets are loaded directly from disk via `http.Dir`, but then statically implemented for final releases.
-
-For example, suppose your source filesystem is defined in a package with import path "example.com/project/data" as:
-
-```Go
-// +build dev
-
-package data
-
-import "net/http"
-
-// Assets contains project assets.
-var Assets http.FileSystem = http.Dir("assets")
-```
-
-When built with the "dev" build tag, accessing `data.Assets` will read from disk directly via `http.Dir`.
-
-A generate helper file assets_generate.go can be invoked via "//go:generate go run -tags=dev assets_generate.go" directive:
-
-```Go
-// +build ignore
-
-package main
-
-import (
- "log"
-
- "example.com/project/data"
- "github.com/shurcooL/vfsgen"
-)
-
-func main() {
- err := vfsgen.Generate(data.Assets, vfsgen.Options{
- PackageName: "data",
- BuildTags: "!dev",
- VariableName: "Assets",
- })
- if err != nil {
- log.Fatalln(err)
- }
-}
-```
-
-Note that "dev" build tag is used to access the source filesystem, and the output file will contain "!dev" build tag. That way, the statically implemented version will be used during normal builds and `go get`, when custom builds tags are not specified.
-
-### `vfsgendev` Usage
-
-`vfsgendev` is a binary that can be used to replace the need for the assets_generate.go file.
-
-Make sure it's installed and available in your PATH.
-
-```bash
-go get -u github.com/shurcooL/vfsgen/cmd/vfsgendev
-```
-
-Then the "//go:generate go run -tags=dev assets_generate.go" directive can be replaced with:
-
-```
-//go:generate vfsgendev -source="example.com/project/data".Assets
-```
-
-vfsgendev accesses the source variable using "dev" build tag, and generates an output file with "!dev" build tag.
-
-### Additional Embedded Information
-
-All compressed files implement [`httpgzip.GzipByter` interface](https://godoc.org/github.com/shurcooL/httpgzip#GzipByter) for efficient direct access to the internal compressed bytes:
-
-```Go
-// GzipByter is implemented by compressed files for
-// efficient direct access to the internal compressed bytes.
-type GzipByter interface {
- // GzipBytes returns gzip compressed contents of the file.
- GzipBytes() []byte
-}
-```
-
-Files that have been determined to not be worth gzip compressing (their compressed size is larger than original) implement [`httpgzip.NotWorthGzipCompressing` interface](https://godoc.org/github.com/shurcooL/httpgzip#NotWorthGzipCompressing):
-
-```Go
-// NotWorthGzipCompressing is implemented by files that were determined
-// not to be worth gzip compressing (the file size did not decrease as a result).
-type NotWorthGzipCompressing interface {
- // NotWorthGzipCompressing is a noop. It's implemented in order to indicate
- // the file is not worth gzip compressing.
- NotWorthGzipCompressing()
-}
-```
-
-Comparison
-----------
-
-vfsgen aims to be conceptually simple to use. The [`http.FileSystem`](https://godoc.org/net/http#FileSystem) abstraction is central to vfsgen. It's used as both input for code generation, and as output in the generated code.
-
-That enables great flexibility through orthogonality, since helpers and wrappers can operate on `http.FileSystem` without knowing about vfsgen. If you want, you can perform pre-processing, minifying assets, merging folders, filtering out files and otherwise modifying input via generic `http.FileSystem` middleware.
-
-It avoids unneccessary overhead by merging what was previously done with two distinct packages into a single package.
-
-It strives to be the best in its class in terms of code quality and efficiency of generated code. However, if your use goals are different, there are other similar packages that may fit your needs better.
-
-### Alternatives
-
-- [`go-bindata`](https://github.com/jteeuwen/go-bindata) - Reads from disk, generates Go code that provides access to data via a [custom API](https://github.com/jteeuwen/go-bindata#accessing-an-asset).
-- [`go-bindata-assetfs`](https://github.com/elazarl/go-bindata-assetfs) - Takes output of go-bindata and provides a wrapper that implements `http.FileSystem` interface (the same as what vfsgen outputs directly).
-- [`becky`](https://github.com/tv42/becky) - Embeds assets as string literals in Go source.
-- [`statik`](https://github.com/rakyll/statik) - Embeds a directory of static files to be accessed via `http.FileSystem` interface (sounds very similar to vfsgen); implementation sourced from [camlistore](https://camlistore.org).
-- [`go.rice`](https://github.com/GeertJohan/go.rice) - Makes working with resources such as HTML, JS, CSS, images and templates very easy.
-- [`esc`](https://github.com/mjibson/esc) - Embeds files into Go programs and provides `http.FileSystem` interfaces to them.
-- [`staticfiles`](https://github.com/bouk/staticfiles) - Allows you to embed a directory of files into your Go binary.
-- [`togo`](https://github.com/flazz/togo) - Generates a Go source file with a `[]byte` var containing the given file's contents.
-- [`fileb0x`](https://github.com/UnnoTed/fileb0x) - Simple customizable tool to embed files in Go.
-- [`embedfiles`](https://github.com/leighmcculloch/embedfiles) - Simple tool for embedding files in Go code as a map.
-- [`packr`](https://github.com/gobuffalo/packr) - Simple solution for bundling static assets inside of Go binaries.
-- [`rsrc`](https://github.com/akavel/rsrc) - Tool for embedding .ico & manifest resources in Go programs for Windows.
-
-Attribution
------------
-
-This package was originally based on the excellent work by [@jteeuwen](https://github.com/jteeuwen) on [`go-bindata`](https://github.com/jteeuwen/go-bindata) and [@elazarl](https://github.com/elazarl) on [`go-bindata-assetfs`](https://github.com/elazarl/go-bindata-assetfs).
-
-License
--------
-
-- [MIT License](LICENSE)
diff --git a/vendor/github.com/shurcooL/vfsgen/commentwriter.go b/vendor/github.com/shurcooL/vfsgen/commentwriter.go
deleted file mode 100644
index b6847f52..00000000
--- a/vendor/github.com/shurcooL/vfsgen/commentwriter.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package vfsgen
-
-import "io"
-
-// commentWriter writes a Go comment to the underlying io.Writer,
-// using line comment form (//).
-type commentWriter struct {
- W io.Writer
- wroteSlashes bool // Wrote "//" at the beginning of the current line.
-}
-
-func (c *commentWriter) Write(p []byte) (int, error) {
- var n int
- for i, b := range p {
- if !c.wroteSlashes {
- s := "//"
- if b != '\n' {
- s = "// "
- }
- if _, err := io.WriteString(c.W, s); err != nil {
- return n, err
- }
- c.wroteSlashes = true
- }
- n0, err := c.W.Write(p[i : i+1])
- n += n0
- if err != nil {
- return n, err
- }
- if b == '\n' {
- c.wroteSlashes = false
- }
- }
- return len(p), nil
-}
-
-func (c *commentWriter) Close() error {
- if !c.wroteSlashes {
- if _, err := io.WriteString(c.W, "//"); err != nil {
- return err
- }
- c.wroteSlashes = true
- }
- return nil
-}
diff --git a/vendor/github.com/shurcooL/vfsgen/doc.go b/vendor/github.com/shurcooL/vfsgen/doc.go
deleted file mode 100644
index 46f28504..00000000
--- a/vendor/github.com/shurcooL/vfsgen/doc.go
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-Package vfsgen takes an http.FileSystem (likely at `go generate` time) and
-generates Go code that statically implements the provided http.FileSystem.
-
-Features:
-
-- Efficient generated code without unneccessary overhead.
-
-- Uses gzip compression internally (selectively, only for files that compress well).
-
-- Enables direct access to internal gzip compressed bytes via an optional interface.
-
-- Outputs `gofmt`ed Go code.
-*/
-package vfsgen
diff --git a/vendor/github.com/shurcooL/vfsgen/generator.go b/vendor/github.com/shurcooL/vfsgen/generator.go
deleted file mode 100644
index 5782693e..00000000
--- a/vendor/github.com/shurcooL/vfsgen/generator.go
+++ /dev/null
@@ -1,485 +0,0 @@
-package vfsgen
-
-import (
- "bytes"
- "compress/gzip"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "os"
- pathpkg "path"
- "sort"
- "strconv"
- "text/template"
- "time"
-
- "github.com/shurcooL/httpfs/vfsutil"
-)
-
-// Generate Go code that statically implements input filesystem,
-// write the output to a file specified in opt.
-func Generate(input http.FileSystem, opt Options) error {
- opt.fillMissing()
-
- // Use an in-memory buffer to generate the entire output.
- buf := new(bytes.Buffer)
-
- err := t.ExecuteTemplate(buf, "Header", opt)
- if err != nil {
- return err
- }
-
- var toc toc
- err = findAndWriteFiles(buf, input, &toc)
- if err != nil {
- return err
- }
-
- err = t.ExecuteTemplate(buf, "DirEntries", toc.dirs)
- if err != nil {
- return err
- }
-
- err = t.ExecuteTemplate(buf, "Trailer", toc)
- if err != nil {
- return err
- }
-
- // Write output file (all at once).
- fmt.Println("writing", opt.Filename)
- err = ioutil.WriteFile(opt.Filename, buf.Bytes(), 0644)
- return err
-}
-
-type toc struct {
- dirs []*dirInfo
-
- HasCompressedFile bool // There's at least one compressedFile.
- HasFile bool // There's at least one uncompressed file.
-}
-
-// fileInfo is a definition of a file.
-type fileInfo struct {
- Path string
- Name string
- ModTime time.Time
- UncompressedSize int64
-}
-
-// dirInfo is a definition of a directory.
-type dirInfo struct {
- Path string
- Name string
- ModTime time.Time
- Entries []string
-}
-
-// findAndWriteFiles recursively finds all the file paths in the given directory tree.
-// They are added to the given map as keys. Values will be safe function names
-// for each file, which will be used when generating the output code.
-func findAndWriteFiles(buf *bytes.Buffer, fs http.FileSystem, toc *toc) error {
- walkFn := func(path string, fi os.FileInfo, r io.ReadSeeker, err error) error {
- if err != nil {
- // Consider all errors reading the input filesystem as fatal.
- return err
- }
-
- switch fi.IsDir() {
- case false:
- file := &fileInfo{
- Path: path,
- Name: pathpkg.Base(path),
- ModTime: fi.ModTime().UTC(),
- UncompressedSize: fi.Size(),
- }
-
- marker := buf.Len()
-
- // Write CompressedFileInfo.
- err = writeCompressedFileInfo(buf, file, r)
- switch err {
- default:
- return err
- case nil:
- toc.HasCompressedFile = true
- // If compressed file is not smaller than original, revert and write original file.
- case errCompressedNotSmaller:
- _, err = r.Seek(0, io.SeekStart)
- if err != nil {
- return err
- }
-
- buf.Truncate(marker)
-
- // Write FileInfo.
- err = writeFileInfo(buf, file, r)
- if err != nil {
- return err
- }
- toc.HasFile = true
- }
- case true:
- entries, err := readDirPaths(fs, path)
- if err != nil {
- return err
- }
-
- dir := &dirInfo{
- Path: path,
- Name: pathpkg.Base(path),
- ModTime: fi.ModTime().UTC(),
- Entries: entries,
- }
-
- toc.dirs = append(toc.dirs, dir)
-
- // Write DirInfo.
- err = t.ExecuteTemplate(buf, "DirInfo", dir)
- if err != nil {
- return err
- }
- }
-
- return nil
- }
-
- err := vfsutil.WalkFiles(fs, "/", walkFn)
- return err
-}
-
-// readDirPaths reads the directory named by dirname and returns
-// a sorted list of directory paths.
-func readDirPaths(fs http.FileSystem, dirname string) ([]string, error) {
- fis, err := vfsutil.ReadDir(fs, dirname)
- if err != nil {
- return nil, err
- }
- paths := make([]string, len(fis))
- for i := range fis {
- paths[i] = pathpkg.Join(dirname, fis[i].Name())
- }
- sort.Strings(paths)
- return paths, nil
-}
-
-// writeCompressedFileInfo writes CompressedFileInfo.
-// It returns errCompressedNotSmaller if compressed file is not smaller than original.
-func writeCompressedFileInfo(w io.Writer, file *fileInfo, r io.Reader) error {
- err := t.ExecuteTemplate(w, "CompressedFileInfo-Before", file)
- if err != nil {
- return err
- }
- sw := &stringWriter{Writer: w}
- gw := gzip.NewWriter(sw)
- _, err = io.Copy(gw, r)
- if err != nil {
- return err
- }
- err = gw.Close()
- if err != nil {
- return err
- }
- if sw.N >= file.UncompressedSize {
- return errCompressedNotSmaller
- }
- err = t.ExecuteTemplate(w, "CompressedFileInfo-After", file)
- return err
-}
-
-var errCompressedNotSmaller = errors.New("compressed file is not smaller than original")
-
-// Write FileInfo.
-func writeFileInfo(w io.Writer, file *fileInfo, r io.Reader) error {
- err := t.ExecuteTemplate(w, "FileInfo-Before", file)
- if err != nil {
- return err
- }
- sw := &stringWriter{Writer: w}
- _, err = io.Copy(sw, r)
- if err != nil {
- return err
- }
- err = t.ExecuteTemplate(w, "FileInfo-After", file)
- return err
-}
-
-var t = template.Must(template.New("").Funcs(template.FuncMap{
- "quote": strconv.Quote,
- "comment": func(s string) (string, error) {
- var buf bytes.Buffer
- cw := &commentWriter{W: &buf}
- _, err := io.WriteString(cw, s)
- if err != nil {
- return "", err
- }
- err = cw.Close()
- return buf.String(), err
- },
-}).Parse(`{{define "Header"}}// Code generated by vfsgen; DO NOT EDIT.
-
-{{with .BuildTags}}// +build {{.}}
-
-{{end}}package {{.PackageName}}
-
-import (
- "bytes"
- "compress/gzip"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "os"
- pathpkg "path"
- "time"
-)
-
-{{comment .VariableComment}}
-var {{.VariableName}} = func() http.FileSystem {
- fs := vfsgen۰FS{
-{{end}}
-
-
-
-{{define "CompressedFileInfo-Before"}} {{quote .Path}}: &vfsgen۰CompressedFileInfo{
- name: {{quote .Name}},
- modTime: {{template "Time" .ModTime}},
- uncompressedSize: {{.UncompressedSize}},
-{{/* This blank line separating compressedContent is neccessary to prevent potential gofmt issues. See issue #19. */}}
- compressedContent: []byte("{{end}}{{define "CompressedFileInfo-After"}}"),
- },
-{{end}}
-
-
-
-{{define "FileInfo-Before"}} {{quote .Path}}: &vfsgen۰FileInfo{
- name: {{quote .Name}},
- modTime: {{template "Time" .ModTime}},
- content: []byte("{{end}}{{define "FileInfo-After"}}"),
- },
-{{end}}
-
-
-
-{{define "DirInfo"}} {{quote .Path}}: &vfsgen۰DirInfo{
- name: {{quote .Name}},
- modTime: {{template "Time" .ModTime}},
- },
-{{end}}
-
-
-
-{{define "DirEntries"}} }
-{{range .}}{{if .Entries}} fs[{{quote .Path}}].(*vfsgen۰DirInfo).entries = []os.FileInfo{{"{"}}{{range .Entries}}
- fs[{{quote .}}].(os.FileInfo),{{end}}
- }
-{{end}}{{end}}
- return fs
-}()
-{{end}}
-
-
-
-{{define "Trailer"}}
-type vfsgen۰FS map[string]interface{}
-
-func (fs vfsgen۰FS) Open(path string) (http.File, error) {
- path = pathpkg.Clean("/" + path)
- f, ok := fs[path]
- if !ok {
- return nil, &os.PathError{Op: "open", Path: path, Err: os.ErrNotExist}
- }
-
- switch f := f.(type) {{"{"}}{{if .HasCompressedFile}}
- case *vfsgen۰CompressedFileInfo:
- gr, err := gzip.NewReader(bytes.NewReader(f.compressedContent))
- if err != nil {
- // This should never happen because we generate the gzip bytes such that they are always valid.
- panic("unexpected error reading own gzip compressed bytes: " + err.Error())
- }
- return &vfsgen۰CompressedFile{
- vfsgen۰CompressedFileInfo: f,
- gr: gr,
- }, nil{{end}}{{if .HasFile}}
- case *vfsgen۰FileInfo:
- return &vfsgen۰File{
- vfsgen۰FileInfo: f,
- Reader: bytes.NewReader(f.content),
- }, nil{{end}}
- case *vfsgen۰DirInfo:
- return &vfsgen۰Dir{
- vfsgen۰DirInfo: f,
- }, nil
- default:
- // This should never happen because we generate only the above types.
- panic(fmt.Sprintf("unexpected type %T", f))
- }
-}
-{{if .HasCompressedFile}}
-// vfsgen۰CompressedFileInfo is a static definition of a gzip compressed file.
-type vfsgen۰CompressedFileInfo struct {
- name string
- modTime time.Time
- compressedContent []byte
- uncompressedSize int64
-}
-
-func (f *vfsgen۰CompressedFileInfo) Readdir(count int) ([]os.FileInfo, error) {
- return nil, fmt.Errorf("cannot Readdir from file %s", f.name)
-}
-func (f *vfsgen۰CompressedFileInfo) Stat() (os.FileInfo, error) { return f, nil }
-
-func (f *vfsgen۰CompressedFileInfo) GzipBytes() []byte {
- return f.compressedContent
-}
-
-func (f *vfsgen۰CompressedFileInfo) Name() string { return f.name }
-func (f *vfsgen۰CompressedFileInfo) Size() int64 { return f.uncompressedSize }
-func (f *vfsgen۰CompressedFileInfo) Mode() os.FileMode { return 0444 }
-func (f *vfsgen۰CompressedFileInfo) ModTime() time.Time { return f.modTime }
-func (f *vfsgen۰CompressedFileInfo) IsDir() bool { return false }
-func (f *vfsgen۰CompressedFileInfo) Sys() interface{} { return nil }
-
-// vfsgen۰CompressedFile is an opened compressedFile instance.
-type vfsgen۰CompressedFile struct {
- *vfsgen۰CompressedFileInfo
- gr *gzip.Reader
- grPos int64 // Actual gr uncompressed position.
- seekPos int64 // Seek uncompressed position.
-}
-
-func (f *vfsgen۰CompressedFile) Read(p []byte) (n int, err error) {
- if f.grPos > f.seekPos {
- // Rewind to beginning.
- err = f.gr.Reset(bytes.NewReader(f.compressedContent))
- if err != nil {
- return 0, err
- }
- f.grPos = 0
- }
- if f.grPos < f.seekPos {
- // Fast-forward.
- _, err = io.CopyN(ioutil.Discard, f.gr, f.seekPos-f.grPos)
- if err != nil {
- return 0, err
- }
- f.grPos = f.seekPos
- }
- n, err = f.gr.Read(p)
- f.grPos += int64(n)
- f.seekPos = f.grPos
- return n, err
-}
-func (f *vfsgen۰CompressedFile) Seek(offset int64, whence int) (int64, error) {
- switch whence {
- case io.SeekStart:
- f.seekPos = 0 + offset
- case io.SeekCurrent:
- f.seekPos += offset
- case io.SeekEnd:
- f.seekPos = f.uncompressedSize + offset
- default:
- panic(fmt.Errorf("invalid whence value: %v", whence))
- }
- return f.seekPos, nil
-}
-func (f *vfsgen۰CompressedFile) Close() error {
- return f.gr.Close()
-}
-{{else}}
-// We already imported "compress/gzip" and "io/ioutil", but ended up not using them. Avoid unused import error.
-var _ = gzip.Reader{}
-var _ = ioutil.Discard
-{{end}}{{if .HasFile}}
-// vfsgen۰FileInfo is a static definition of an uncompressed file (because it's not worth gzip compressing).
-type vfsgen۰FileInfo struct {
- name string
- modTime time.Time
- content []byte
-}
-
-func (f *vfsgen۰FileInfo) Readdir(count int) ([]os.FileInfo, error) {
- return nil, fmt.Errorf("cannot Readdir from file %s", f.name)
-}
-func (f *vfsgen۰FileInfo) Stat() (os.FileInfo, error) { return f, nil }
-
-func (f *vfsgen۰FileInfo) NotWorthGzipCompressing() {}
-
-func (f *vfsgen۰FileInfo) Name() string { return f.name }
-func (f *vfsgen۰FileInfo) Size() int64 { return int64(len(f.content)) }
-func (f *vfsgen۰FileInfo) Mode() os.FileMode { return 0444 }
-func (f *vfsgen۰FileInfo) ModTime() time.Time { return f.modTime }
-func (f *vfsgen۰FileInfo) IsDir() bool { return false }
-func (f *vfsgen۰FileInfo) Sys() interface{} { return nil }
-
-// vfsgen۰File is an opened file instance.
-type vfsgen۰File struct {
- *vfsgen۰FileInfo
- *bytes.Reader
-}
-
-func (f *vfsgen۰File) Close() error {
- return nil
-}
-{{else if not .HasCompressedFile}}
-// We already imported "bytes", but ended up not using it. Avoid unused import error.
-var _ = bytes.Reader{}
-{{end}}
-// vfsgen۰DirInfo is a static definition of a directory.
-type vfsgen۰DirInfo struct {
- name string
- modTime time.Time
- entries []os.FileInfo
-}
-
-func (d *vfsgen۰DirInfo) Read([]byte) (int, error) {
- return 0, fmt.Errorf("cannot Read from directory %s", d.name)
-}
-func (d *vfsgen۰DirInfo) Close() error { return nil }
-func (d *vfsgen۰DirInfo) Stat() (os.FileInfo, error) { return d, nil }
-
-func (d *vfsgen۰DirInfo) Name() string { return d.name }
-func (d *vfsgen۰DirInfo) Size() int64 { return 0 }
-func (d *vfsgen۰DirInfo) Mode() os.FileMode { return 0755 | os.ModeDir }
-func (d *vfsgen۰DirInfo) ModTime() time.Time { return d.modTime }
-func (d *vfsgen۰DirInfo) IsDir() bool { return true }
-func (d *vfsgen۰DirInfo) Sys() interface{} { return nil }
-
-// vfsgen۰Dir is an opened dir instance.
-type vfsgen۰Dir struct {
- *vfsgen۰DirInfo
- pos int // Position within entries for Seek and Readdir.
-}
-
-func (d *vfsgen۰Dir) Seek(offset int64, whence int) (int64, error) {
- if offset == 0 && whence == io.SeekStart {
- d.pos = 0
- return 0, nil
- }
- return 0, fmt.Errorf("unsupported Seek in directory %s", d.name)
-}
-
-func (d *vfsgen۰Dir) Readdir(count int) ([]os.FileInfo, error) {
- if d.pos >= len(d.entries) && count > 0 {
- return nil, io.EOF
- }
- if count <= 0 || count > len(d.entries)-d.pos {
- count = len(d.entries) - d.pos
- }
- e := d.entries[d.pos : d.pos+count]
- d.pos += count
- return e, nil
-}
-{{end}}
-
-
-
-{{define "Time"}}
-{{- if .IsZero -}}
- time.Time{}
-{{- else -}}
- time.Date({{.Year}}, {{printf "%d" .Month}}, {{.Day}}, {{.Hour}}, {{.Minute}}, {{.Second}}, {{.Nanosecond}}, time.UTC)
-{{- end -}}
-{{end}}
-`))
diff --git a/vendor/github.com/shurcooL/vfsgen/options.go b/vendor/github.com/shurcooL/vfsgen/options.go
deleted file mode 100644
index d10d348e..00000000
--- a/vendor/github.com/shurcooL/vfsgen/options.go
+++ /dev/null
@@ -1,45 +0,0 @@
-package vfsgen
-
-import (
- "fmt"
- "strings"
-)
-
-// Options for vfsgen code generation.
-type Options struct {
- // Filename of the generated Go code output (including extension).
- // If left empty, it defaults to "{{toLower .VariableName}}_vfsdata.go".
- Filename string
-
- // PackageName is the name of the package in the generated code.
- // If left empty, it defaults to "main".
- PackageName string
-
- // BuildTags are the optional build tags in the generated code.
- // The build tags syntax is specified by the go tool.
- BuildTags string
-
- // VariableName is the name of the http.FileSystem variable in the generated code.
- // If left empty, it defaults to "assets".
- VariableName string
-
- // VariableComment is the comment of the http.FileSystem variable in the generated code.
- // If left empty, it defaults to "{{.VariableName}} statically implements the virtual filesystem provided to vfsgen.".
- VariableComment string
-}
-
-// fillMissing sets default values for mandatory options that are left empty.
-func (opt *Options) fillMissing() {
- if opt.PackageName == "" {
- opt.PackageName = "main"
- }
- if opt.VariableName == "" {
- opt.VariableName = "assets"
- }
- if opt.Filename == "" {
- opt.Filename = fmt.Sprintf("%s_vfsdata.go", strings.ToLower(opt.VariableName))
- }
- if opt.VariableComment == "" {
- opt.VariableComment = fmt.Sprintf("%s statically implements the virtual filesystem provided to vfsgen.", opt.VariableName)
- }
-}
diff --git a/vendor/github.com/shurcooL/vfsgen/stringwriter.go b/vendor/github.com/shurcooL/vfsgen/stringwriter.go
deleted file mode 100644
index a781efdc..00000000
--- a/vendor/github.com/shurcooL/vfsgen/stringwriter.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package vfsgen
-
-import (
- "io"
-)
-
-// stringWriter writes given bytes to underlying io.Writer as a Go interpreted string literal value,
-// not including double quotes. It tracks the total number of bytes written.
-type stringWriter struct {
- io.Writer
- N int64 // Total bytes written.
-}
-
-func (sw *stringWriter) Write(p []byte) (n int, err error) {
- const hex = "0123456789abcdef"
- buf := []byte{'\\', 'x', 0, 0}
- for _, b := range p {
- buf[2], buf[3] = hex[b/16], hex[b%16]
- _, err = sw.Writer.Write(buf)
- if err != nil {
- return n, err
- }
- n++
- sw.N++
- }
- return n, nil
-}
diff --git a/vendor/github.com/skratchdot/open-golang/LICENSE-MIT b/vendor/github.com/skratchdot/open-golang/LICENSE-MIT
deleted file mode 100644
index afd04c82..00000000
--- a/vendor/github.com/skratchdot/open-golang/LICENSE-MIT
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2013 skratchdot
-
-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/skratchdot/open-golang/open/exec.go b/vendor/github.com/skratchdot/open-golang/open/exec.go
deleted file mode 100644
index 1b0e7136..00000000
--- a/vendor/github.com/skratchdot/open-golang/open/exec.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build !windows,!darwin
-
-package open
-
-import (
- "os/exec"
-)
-
-// http://sources.debian.net/src/xdg-utils/1.1.0~rc1%2Bgit20111210-7.1/scripts/xdg-open/
-// http://sources.debian.net/src/xdg-utils/1.1.0~rc1%2Bgit20111210-7.1/scripts/xdg-mime/
-
-func open(input string) *exec.Cmd {
- return exec.Command("xdg-open", input)
-}
-
-func openWith(input string, appName string) *exec.Cmd {
- return exec.Command(appName, input)
-}
diff --git a/vendor/github.com/skratchdot/open-golang/open/exec_darwin.go b/vendor/github.com/skratchdot/open-golang/open/exec_darwin.go
deleted file mode 100644
index 16160e6f..00000000
--- a/vendor/github.com/skratchdot/open-golang/open/exec_darwin.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build darwin
-
-package open
-
-import (
- "os/exec"
-)
-
-func open(input string) *exec.Cmd {
- return exec.Command("open", input)
-}
-
-func openWith(input string, appName string) *exec.Cmd {
- return exec.Command("open", "-a", appName, input)
-}
diff --git a/vendor/github.com/skratchdot/open-golang/open/exec_windows.go b/vendor/github.com/skratchdot/open-golang/open/exec_windows.go
deleted file mode 100644
index 6e46c005..00000000
--- a/vendor/github.com/skratchdot/open-golang/open/exec_windows.go
+++ /dev/null
@@ -1,33 +0,0 @@
-// +build windows
-
-package open
-
-import (
- "os"
- "os/exec"
- "path/filepath"
- "strings"
- // "syscall"
-)
-
-var (
- cmd = "url.dll,FileProtocolHandler"
- runDll32 = filepath.Join(os.Getenv("SYSTEMROOT"), "System32", "rundll32.exe")
-)
-
-func cleaninput(input string) string {
- r := strings.NewReplacer("&", "^&")
- return r.Replace(input)
-}
-
-func open(input string) *exec.Cmd {
- cmd := exec.Command(runDll32, cmd, input)
- //cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
- return cmd
-}
-
-func openWith(input string, appName string) *exec.Cmd {
- cmd := exec.Command("cmd", "/C", "start", "", appName, cleaninput(input))
- //cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
- return cmd
-}
diff --git a/vendor/github.com/skratchdot/open-golang/open/open.go b/vendor/github.com/skratchdot/open-golang/open/open.go
deleted file mode 100644
index b1f648ff..00000000
--- a/vendor/github.com/skratchdot/open-golang/open/open.go
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-
- Open a file, directory, or URI using the OS's default
- application for that object type. Optionally, you can
- specify an application to use.
-
- This is a proxy for the following commands:
-
- OSX: "open"
- Windows: "start"
- Linux/Other: "xdg-open"
-
- This is a golang port of the node.js module: https://github.com/pwnall/node-open
-
-*/
-package open
-
-/*
- Open a file, directory, or URI using the OS's default
- application for that object type. Wait for the open
- command to complete.
-*/
-func Run(input string) error {
- return open(input).Run()
-}
-
-/*
- Open a file, directory, or URI using the OS's default
- application for that object type. Don't wait for the
- open command to complete.
-*/
-func Start(input string) error {
- return open(input).Start()
-}
-
-/*
- Open a file, directory, or URI using the specified application.
- Wait for the open command to complete.
-*/
-func RunWith(input string, appName string) error {
- return openWith(input, appName).Run()
-}
-
-/*
- Open a file, directory, or URI using the specified application.
- Don't wait for the open command to complete.
-*/
-func StartWith(input string, appName string) error {
- return openWith(input, appName).Start()
-}
diff --git a/vendor/github.com/spf13/cobra/.gitignore b/vendor/github.com/spf13/cobra/.gitignore
deleted file mode 100644
index 3b053c59..00000000
--- a/vendor/github.com/spf13/cobra/.gitignore
+++ /dev/null
@@ -1,38 +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
-
-# Vim files https://github.com/github/gitignore/blob/master/Global/Vim.gitignore
-# swap
-[._]*.s[a-w][a-z]
-[._]s[a-w][a-z]
-# session
-Session.vim
-# temporary
-.netrwhist
-*~
-# auto-generated tag files
-tags
-
-*.exe
-
-cobra.test
-
-.idea/*
diff --git a/vendor/github.com/spf13/cobra/.mailmap b/vendor/github.com/spf13/cobra/.mailmap
deleted file mode 100644
index 94ec5306..00000000
--- a/vendor/github.com/spf13/cobra/.mailmap
+++ /dev/null
@@ -1,3 +0,0 @@
-Steve Francia <steve.francia@gmail.com>
-Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
-Fabiano Franz <ffranz@redhat.com> <contact@fabianofranz.com>
diff --git a/vendor/github.com/spf13/cobra/.travis.yml b/vendor/github.com/spf13/cobra/.travis.yml
deleted file mode 100644
index 38b85f49..00000000
--- a/vendor/github.com/spf13/cobra/.travis.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-language: go
-
-stages:
- - diff
- - test
-
-go:
- - 1.10.x
- - 1.11.x
- - 1.12.x
- - tip
-
-matrix:
- allow_failures:
- - go: tip
- include:
- - stage: diff
- go: 1.12.x
- script: diff -u <(echo -n) <(gofmt -d -s .)
-
-before_install:
- - mkdir -p bin
- - curl -Lso bin/shellcheck https://github.com/caarlos0/shellcheck-docker/releases/download/v0.6.0/shellcheck
- - chmod +x bin/shellcheck
- - go get -u github.com/kyoh86/richgo
-script:
- - PATH=$PATH:$PWD/bin richgo test -v ./...
- - go build
- - if [ -z $NOVET ]; then
- diff -u <(echo -n) <(go vet . 2>&1 | grep -vE 'ExampleCommand|bash_completions.*Fprint');
- fi
diff --git a/vendor/github.com/spf13/cobra/LICENSE.txt b/vendor/github.com/spf13/cobra/LICENSE.txt
deleted file mode 100644
index 298f0e26..00000000
--- a/vendor/github.com/spf13/cobra/LICENSE.txt
+++ /dev/null
@@ -1,174 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
diff --git a/vendor/github.com/spf13/cobra/README.md b/vendor/github.com/spf13/cobra/README.md
deleted file mode 100644
index 60c5a425..00000000
--- a/vendor/github.com/spf13/cobra/README.md
+++ /dev/null
@@ -1,741 +0,0 @@
-![cobra logo](https://cloud.githubusercontent.com/assets/173412/10886352/ad566232-814f-11e5-9cd0-aa101788c117.png)
-
-Cobra is both a library for creating powerful modern CLI applications as well as a program to generate applications and command files.
-
-Many of the most widely used Go projects are built using Cobra, such as:
-[Kubernetes](http://kubernetes.io/),
-[Hugo](http://gohugo.io),
-[rkt](https://github.com/coreos/rkt),
-[etcd](https://github.com/coreos/etcd),
-[Moby (former Docker)](https://github.com/moby/moby),
-[Docker (distribution)](https://github.com/docker/distribution),
-[OpenShift](https://www.openshift.com/),
-[Delve](https://github.com/derekparker/delve),
-[GopherJS](http://www.gopherjs.org/),
-[CockroachDB](http://www.cockroachlabs.com/),
-[Bleve](http://www.blevesearch.com/),
-[ProjectAtomic (enterprise)](http://www.projectatomic.io/),
-[Giant Swarm's gsctl](https://github.com/giantswarm/gsctl),
-[Nanobox](https://github.com/nanobox-io/nanobox)/[Nanopack](https://github.com/nanopack),
-[rclone](http://rclone.org/),
-[nehm](https://github.com/bogem/nehm),
-[Pouch](https://github.com/alibaba/pouch),
-[Istio](https://istio.io),
-[Prototool](https://github.com/uber/prototool),
-[mattermost-server](https://github.com/mattermost/mattermost-server),
-[Gardener](https://github.com/gardener/gardenctl),
-etc.
-
-[![Build Status](https://travis-ci.org/spf13/cobra.svg "Travis CI status")](https://travis-ci.org/spf13/cobra)
-[![CircleCI status](https://circleci.com/gh/spf13/cobra.png?circle-token=:circle-token "CircleCI status")](https://circleci.com/gh/spf13/cobra)
-[![GoDoc](https://godoc.org/github.com/spf13/cobra?status.svg)](https://godoc.org/github.com/spf13/cobra)
-
-# Table of Contents
-
-- [Overview](#overview)
-- [Concepts](#concepts)
- * [Commands](#commands)
- * [Flags](#flags)
-- [Installing](#installing)
-- [Getting Started](#getting-started)
- * [Using the Cobra Generator](#using-the-cobra-generator)
- * [Using the Cobra Library](#using-the-cobra-library)
- * [Working with Flags](#working-with-flags)
- * [Positional and Custom Arguments](#positional-and-custom-arguments)
- * [Example](#example)
- * [Help Command](#help-command)
- * [Usage Message](#usage-message)
- * [PreRun and PostRun Hooks](#prerun-and-postrun-hooks)
- * [Suggestions when "unknown command" happens](#suggestions-when-unknown-command-happens)
- * [Generating documentation for your command](#generating-documentation-for-your-command)
- * [Generating bash completions](#generating-bash-completions)
- * [Generating zsh completions](#generating-zsh-completions)
-- [Contributing](#contributing)
-- [License](#license)
-
-# Overview
-
-Cobra is a library providing a simple interface to create powerful modern CLI
-interfaces similar to git & go tools.
-
-Cobra is also an application that will generate your application scaffolding to rapidly
-develop a Cobra-based application.
-
-Cobra provides:
-* Easy subcommand-based CLIs: `app server`, `app fetch`, etc.
-* Fully POSIX-compliant flags (including short & long versions)
-* Nested subcommands
-* Global, local and cascading flags
-* Easy generation of applications & commands with `cobra init appname` & `cobra add cmdname`
-* Intelligent suggestions (`app srver`... did you mean `app server`?)
-* Automatic help generation for commands and flags
-* Automatic help flag recognition of `-h`, `--help`, etc.
-* Automatically generated bash autocomplete for your application
-* Automatically generated man pages for your application
-* Command aliases so you can change things without breaking them
-* The flexibility to define your own help, usage, etc.
-* Optional tight integration with [viper](http://github.com/spf13/viper) for 12-factor apps
-
-# Concepts
-
-Cobra is built on a structure of commands, arguments & flags.
-
-**Commands** represent actions, **Args** are things and **Flags** are modifiers for those actions.
-
-The best applications will read like sentences when used. Users will know how
-to use the application because they will natively understand how to use it.
-
-The pattern to follow is
-`APPNAME VERB NOUN --ADJECTIVE.`
- or
-`APPNAME COMMAND ARG --FLAG`
-
-A few good real world examples may better illustrate this point.
-
-In the following example, 'server' is a command, and 'port' is a flag:
-
- hugo server --port=1313
-
-In this command we are telling Git to clone the url bare.
-
- git clone URL --bare
-
-## Commands
-
-Command is the central point of the application. Each interaction that
-the application supports will be contained in a Command. A command can
-have children commands and optionally run an action.
-
-In the example above, 'server' is the command.
-
-[More about cobra.Command](https://godoc.org/github.com/spf13/cobra#Command)
-
-## Flags
-
-A flag is a way to modify the behavior of a command. Cobra supports
-fully POSIX-compliant flags as well as the Go [flag package](https://golang.org/pkg/flag/).
-A Cobra command can define flags that persist through to children commands
-and flags that are only available to that command.
-
-In the example above, 'port' is the flag.
-
-Flag functionality is provided by the [pflag
-library](https://github.com/spf13/pflag), a fork of the flag standard library
-which maintains the same interface while adding POSIX compliance.
-
-# Installing
-Using Cobra is easy. First, use `go get` to install the latest version
-of the library. This command will install the `cobra` generator executable
-along with the library and its dependencies:
-
- go get -u github.com/spf13/cobra/cobra
-
-Next, include Cobra in your application:
-
-```go
-import "github.com/spf13/cobra"
-```
-
-# Getting Started
-
-While you are welcome to provide your own organization, typically a Cobra-based
-application will follow the following organizational structure:
-
-```
- ▾ appName/
- ▾ cmd/
- add.go
- your.go
- commands.go
- here.go
- main.go
-```
-
-In a Cobra app, typically the main.go file is very bare. It serves one purpose: initializing Cobra.
-
-```go
-package main
-
-import (
- "{pathToYourApp}/cmd"
-)
-
-func main() {
- cmd.Execute()
-}
-```
-
-## Using the Cobra Generator
-
-Cobra provides its own program that will create your application and add any
-commands you want. It's the easiest way to incorporate Cobra into your application.
-
-[Here](https://github.com/spf13/cobra/blob/master/cobra/README.md) you can find more information about it.
-
-## Using the Cobra Library
-
-To manually implement Cobra you need to create a bare main.go file and a rootCmd file.
-You will optionally provide additional commands as you see fit.
-
-### Create rootCmd
-
-Cobra doesn't require any special constructors. Simply create your commands.
-
-Ideally you place this in app/cmd/root.go:
-
-```go
-var rootCmd = &cobra.Command{
- Use: "hugo",
- Short: "Hugo is a very fast static site generator",
- Long: `A Fast and Flexible Static Site Generator built with
- love by spf13 and friends in Go.
- Complete documentation is available at http://hugo.spf13.com`,
- Run: func(cmd *cobra.Command, args []string) {
- // Do Stuff Here
- },
-}
-
-func Execute() {
- if err := rootCmd.Execute(); err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
-}
-```
-
-You will additionally define flags and handle configuration in your init() function.
-
-For example cmd/root.go:
-
-```go
-import (
- "fmt"
- "os"
-
- homedir "github.com/mitchellh/go-homedir"
- "github.com/spf13/cobra"
- "github.com/spf13/viper"
-)
-
-func init() {
- cobra.OnInitialize(initConfig)
- rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cobra.yaml)")
- rootCmd.PersistentFlags().StringVarP(&projectBase, "projectbase", "b", "", "base project directory eg. github.com/spf13/")
- rootCmd.PersistentFlags().StringP("author", "a", "YOUR NAME", "Author name for copyright attribution")
- rootCmd.PersistentFlags().StringVarP(&userLicense, "license", "l", "", "Name of license for the project (can provide `licensetext` in config)")
- rootCmd.PersistentFlags().Bool("viper", true, "Use Viper for configuration")
- viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author"))
- viper.BindPFlag("projectbase", rootCmd.PersistentFlags().Lookup("projectbase"))
- viper.BindPFlag("useViper", rootCmd.PersistentFlags().Lookup("viper"))
- viper.SetDefault("author", "NAME HERE <EMAIL ADDRESS>")
- viper.SetDefault("license", "apache")
-}
-
-func initConfig() {
- // Don't forget to read config either from cfgFile or from home directory!
- if cfgFile != "" {
- // Use config file from the flag.
- viper.SetConfigFile(cfgFile)
- } else {
- // Find home directory.
- home, err := homedir.Dir()
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
-
- // Search config in home directory with name ".cobra" (without extension).
- viper.AddConfigPath(home)
- viper.SetConfigName(".cobra")
- }
-
- if err := viper.ReadInConfig(); err != nil {
- fmt.Println("Can't read config:", err)
- os.Exit(1)
- }
-}
-```
-
-### Create your main.go
-
-With the root command you need to have your main function execute it.
-Execute should be run on the root for clarity, though it can be called on any command.
-
-In a Cobra app, typically the main.go file is very bare. It serves, one purpose, to initialize Cobra.
-
-```go
-package main
-
-import (
- "{pathToYourApp}/cmd"
-)
-
-func main() {
- cmd.Execute()
-}
-```
-
-### Create additional commands
-
-Additional commands can be defined and typically are each given their own file
-inside of the cmd/ directory.
-
-If you wanted to create a version command you would create cmd/version.go and
-populate it with the following:
-
-```go
-package cmd
-
-import (
- "fmt"
-
- "github.com/spf13/cobra"
-)
-
-func init() {
- rootCmd.AddCommand(versionCmd)
-}
-
-var versionCmd = &cobra.Command{
- Use: "version",
- Short: "Print the version number of Hugo",
- Long: `All software has versions. This is Hugo's`,
- Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("Hugo Static Site Generator v0.9 -- HEAD")
- },
-}
-```
-
-## Working with Flags
-
-Flags provide modifiers to control how the action command operates.
-
-### Assign flags to a command
-
-Since the flags are defined and used in different locations, we need to
-define a variable outside with the correct scope to assign the flag to
-work with.
-
-```go
-var Verbose bool
-var Source string
-```
-
-There are two different approaches to assign a flag.
-
-### Persistent Flags
-
-A flag can be 'persistent' meaning that this flag will be available to the
-command it's assigned to as well as every command under that command. For
-global flags, assign a flag as a persistent flag on the root.
-
-```go
-rootCmd.PersistentFlags().BoolVarP(&Verbose, "verbose", "v", false, "verbose output")
-```
-
-### Local Flags
-
-A flag can also be assigned locally which will only apply to that specific command.
-
-```go
-localCmd.Flags().StringVarP(&Source, "source", "s", "", "Source directory to read from")
-```
-
-### Local Flag on Parent Commands
-
-By default Cobra only parses local flags on the target command, any local flags on
-parent commands are ignored. By enabling `Command.TraverseChildren` Cobra will
-parse local flags on each command before executing the target command.
-
-```go
-command := cobra.Command{
- Use: "print [OPTIONS] [COMMANDS]",
- TraverseChildren: true,
-}
-```
-
-### Bind Flags with Config
-
-You can also bind your flags with [viper](https://github.com/spf13/viper):
-```go
-var author string
-
-func init() {
- rootCmd.PersistentFlags().StringVar(&author, "author", "YOUR NAME", "Author name for copyright attribution")
- viper.BindPFlag("author", rootCmd.PersistentFlags().Lookup("author"))
-}
-```
-
-In this example the persistent flag `author` is bound with `viper`.
-**Note**, that the variable `author` will not be set to the value from config,
-when the `--author` flag is not provided by user.
-
-More in [viper documentation](https://github.com/spf13/viper#working-with-flags).
-
-### Required flags
-
-Flags are optional by default. If instead you wish your command to report an error
-when a flag has not been set, mark it as required:
-```go
-rootCmd.Flags().StringVarP(&Region, "region", "r", "", "AWS region (required)")
-rootCmd.MarkFlagRequired("region")
-```
-
-## Positional and Custom Arguments
-
-Validation of positional arguments can be specified using the `Args` field
-of `Command`.
-
-The following validators are built in:
-
-- `NoArgs` - the command will report an error if there are any positional args.
-- `ArbitraryArgs` - the command will accept any args.
-- `OnlyValidArgs` - the command will report an error if there are any positional args that are not in the `ValidArgs` field of `Command`.
-- `MinimumNArgs(int)` - the command will report an error if there are not at least N positional args.
-- `MaximumNArgs(int)` - the command will report an error if there are more than N positional args.
-- `ExactArgs(int)` - the command will report an error if there are not exactly N positional args.
-- `ExactValidArgs(int)` - the command will report an error if there are not exactly N positional args OR if there are any positional args that are not in the `ValidArgs` field of `Command`
-- `RangeArgs(min, max)` - the command will report an error if the number of args is not between the minimum and maximum number of expected args.
-
-An example of setting the custom validator:
-
-```go
-var cmd = &cobra.Command{
- Short: "hello",
- Args: func(cmd *cobra.Command, args []string) error {
- if len(args) < 1 {
- return errors.New("requires a color argument")
- }
- if myapp.IsValidColor(args[0]) {
- return nil
- }
- return fmt.Errorf("invalid color specified: %s", args[0])
- },
- Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("Hello, World!")
- },
-}
-```
-
-## Example
-
-In the example below, we have defined three commands. Two are at the top level
-and one (cmdTimes) is a child of one of the top commands. In this case the root
-is not executable meaning that a subcommand is required. This is accomplished
-by not providing a 'Run' for the 'rootCmd'.
-
-We have only defined one flag for a single command.
-
-More documentation about flags is available at https://github.com/spf13/pflag
-
-```go
-package main
-
-import (
- "fmt"
- "strings"
-
- "github.com/spf13/cobra"
-)
-
-func main() {
- var echoTimes int
-
- var cmdPrint = &cobra.Command{
- Use: "print [string to print]",
- Short: "Print anything to the screen",
- Long: `print is for printing anything back to the screen.
-For many years people have printed back to the screen.`,
- Args: cobra.MinimumNArgs(1),
- Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("Print: " + strings.Join(args, " "))
- },
- }
-
- var cmdEcho = &cobra.Command{
- Use: "echo [string to echo]",
- Short: "Echo anything to the screen",
- Long: `echo is for echoing anything back.
-Echo works a lot like print, except it has a child command.`,
- Args: cobra.MinimumNArgs(1),
- Run: func(cmd *cobra.Command, args []string) {
- fmt.Println("Print: " + strings.Join(args, " "))
- },
- }
-
- var cmdTimes = &cobra.Command{
- Use: "times [string to echo]",
- Short: "Echo anything to the screen more times",
- Long: `echo things multiple times back to the user by providing
-a count and a string.`,
- Args: cobra.MinimumNArgs(1),
- Run: func(cmd *cobra.Command, args []string) {
- for i := 0; i < echoTimes; i++ {
- fmt.Println("Echo: " + strings.Join(args, " "))
- }
- },
- }
-
- cmdTimes.Flags().IntVarP(&echoTimes, "times", "t", 1, "times to echo the input")
-
- var rootCmd = &cobra.Command{Use: "app"}
- rootCmd.AddCommand(cmdPrint, cmdEcho)
- cmdEcho.AddCommand(cmdTimes)
- rootCmd.Execute()
-}
-```
-
-For a more complete example of a larger application, please checkout [Hugo](http://gohugo.io/).
-
-## Help Command
-
-Cobra automatically adds a help command to your application when you have subcommands.
-This will be called when a user runs 'app help'. Additionally, help will also
-support all other commands as input. Say, for instance, you have a command called
-'create' without any additional configuration; Cobra will work when 'app help
-create' is called. Every command will automatically have the '--help' flag added.
-
-### Example
-
-The following output is automatically generated by Cobra. Nothing beyond the
-command and flag definitions are needed.
-
- $ cobra help
-
- Cobra is a CLI library for Go that empowers applications.
- This application is a tool to generate the needed files
- to quickly create a Cobra application.
-
- Usage:
- cobra [command]
-
- Available Commands:
- add Add a command to a Cobra Application
- help Help about any command
- init Initialize a Cobra Application
-
- Flags:
- -a, --author string author name for copyright attribution (default "YOUR NAME")
- --config string config file (default is $HOME/.cobra.yaml)
- -h, --help help for cobra
- -l, --license string name of license for the project
- --viper use Viper for configuration (default true)
-
- Use "cobra [command] --help" for more information about a command.
-
-
-Help is just a command like any other. There is no special logic or behavior
-around it. In fact, you can provide your own if you want.
-
-### Defining your own help
-
-You can provide your own Help command or your own template for the default command to use
-with following functions:
-
-```go
-cmd.SetHelpCommand(cmd *Command)
-cmd.SetHelpFunc(f func(*Command, []string))
-cmd.SetHelpTemplate(s string)
-```
-
-The latter two will also apply to any children commands.
-
-## Usage Message
-
-When the user provides an invalid flag or invalid command, Cobra responds by
-showing the user the 'usage'.
-
-### Example
-You may recognize this from the help above. That's because the default help
-embeds the usage as part of its output.
-
- $ cobra --invalid
- Error: unknown flag: --invalid
- Usage:
- cobra [command]
-
- Available Commands:
- add Add a command to a Cobra Application
- help Help about any command
- init Initialize a Cobra Application
-
- Flags:
- -a, --author string author name for copyright attribution (default "YOUR NAME")
- --config string config file (default is $HOME/.cobra.yaml)
- -h, --help help for cobra
- -l, --license string name of license for the project
- --viper use Viper for configuration (default true)
-
- Use "cobra [command] --help" for more information about a command.
-
-### Defining your own usage
-You can provide your own usage function or template for Cobra to use.
-Like help, the function and template are overridable through public methods:
-
-```go
-cmd.SetUsageFunc(f func(*Command) error)
-cmd.SetUsageTemplate(s string)
-```
-
-## Version Flag
-
-Cobra adds a top-level '--version' flag if the Version field is set on the root command.
-Running an application with the '--version' flag will print the version to stdout using
-the version template. The template can be customized using the
-`cmd.SetVersionTemplate(s string)` function.
-
-## PreRun and PostRun Hooks
-
-It is possible to run functions before or after the main `Run` function of your command. The `PersistentPreRun` and `PreRun` functions will be executed before `Run`. `PersistentPostRun` and `PostRun` will be executed after `Run`. The `Persistent*Run` functions will be inherited by children if they do not declare their own. These functions are run in the following order:
-
-- `PersistentPreRun`
-- `PreRun`
-- `Run`
-- `PostRun`
-- `PersistentPostRun`
-
-An example of two commands which use all of these features is below. When the subcommand is executed, it will run the root command's `PersistentPreRun` but not the root command's `PersistentPostRun`:
-
-```go
-package main
-
-import (
- "fmt"
-
- "github.com/spf13/cobra"
-)
-
-func main() {
-
- var rootCmd = &cobra.Command{
- Use: "root [sub]",
- Short: "My root command",
- PersistentPreRun: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside rootCmd PersistentPreRun with args: %v\n", args)
- },
- PreRun: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside rootCmd PreRun with args: %v\n", args)
- },
- Run: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside rootCmd Run with args: %v\n", args)
- },
- PostRun: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside rootCmd PostRun with args: %v\n", args)
- },
- PersistentPostRun: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside rootCmd PersistentPostRun with args: %v\n", args)
- },
- }
-
- var subCmd = &cobra.Command{
- Use: "sub [no options!]",
- Short: "My subcommand",
- PreRun: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside subCmd PreRun with args: %v\n", args)
- },
- Run: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside subCmd Run with args: %v\n", args)
- },
- PostRun: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside subCmd PostRun with args: %v\n", args)
- },
- PersistentPostRun: func(cmd *cobra.Command, args []string) {
- fmt.Printf("Inside subCmd PersistentPostRun with args: %v\n", args)
- },
- }
-
- rootCmd.AddCommand(subCmd)
-
- rootCmd.SetArgs([]string{""})
- rootCmd.Execute()
- fmt.Println()
- rootCmd.SetArgs([]string{"sub", "arg1", "arg2"})
- rootCmd.Execute()
-}
-```
-
-Output:
-```
-Inside rootCmd PersistentPreRun with args: []
-Inside rootCmd PreRun with args: []
-Inside rootCmd Run with args: []
-Inside rootCmd PostRun with args: []
-Inside rootCmd PersistentPostRun with args: []
-
-Inside rootCmd PersistentPreRun with args: [arg1 arg2]
-Inside subCmd PreRun with args: [arg1 arg2]
-Inside subCmd Run with args: [arg1 arg2]
-Inside subCmd PostRun with args: [arg1 arg2]
-Inside subCmd PersistentPostRun with args: [arg1 arg2]
-```
-
-## Suggestions when "unknown command" happens
-
-Cobra will print automatic suggestions when "unknown command" errors happen. This allows Cobra to behave similarly to the `git` command when a typo happens. For example:
-
-```
-$ hugo srever
-Error: unknown command "srever" for "hugo"
-
-Did you mean this?
- server
-
-Run 'hugo --help' for usage.
-```
-
-Suggestions are automatic based on every subcommand registered and use an implementation of [Levenshtein distance](http://en.wikipedia.org/wiki/Levenshtein_distance). Every registered command that matches a minimum distance of 2 (ignoring case) will be displayed as a suggestion.
-
-If you need to disable suggestions or tweak the string distance in your command, use:
-
-```go
-command.DisableSuggestions = true
-```
-
-or
-
-```go
-command.SuggestionsMinimumDistance = 1
-```
-
-You can also explicitly set names for which a given command will be suggested using the `SuggestFor` attribute. This allows suggestions for strings that are not close in terms of string distance, but makes sense in your set of commands and for some which you don't want aliases. Example:
-
-```
-$ kubectl remove
-Error: unknown command "remove" for "kubectl"
-
-Did you mean this?
- delete
-
-Run 'kubectl help' for usage.
-```
-
-## Generating documentation for your command
-
-Cobra can generate documentation based on subcommands, flags, etc. in the following formats:
-
-- [Markdown](doc/md_docs.md)
-- [ReStructured Text](doc/rest_docs.md)
-- [Man Page](doc/man_docs.md)
-
-## Generating bash completions
-
-Cobra can generate a bash-completion file. If you add more information to your command, these completions can be amazingly powerful and flexible. Read more about it in [Bash Completions](bash_completions.md).
-
-## Generating zsh completions
-
-Cobra can generate zsh-completion file. Read more about it in
-[Zsh Completions](zsh_completions.md).
-
-# Contributing
-
-1. Fork it
-2. Download your fork to your PC (`git clone https://github.com/your_username/cobra && cd cobra`)
-3. Create your feature branch (`git checkout -b my-new-feature`)
-4. Make changes and add them (`git add .`)
-5. Commit your changes (`git commit -m 'Add some feature'`)
-6. Push to the branch (`git push origin my-new-feature`)
-7. Create new pull request
-
-# License
-
-Cobra is released under the Apache 2.0 license. See [LICENSE.txt](https://github.com/spf13/cobra/blob/master/LICENSE.txt)
diff --git a/vendor/github.com/spf13/cobra/args.go b/vendor/github.com/spf13/cobra/args.go
deleted file mode 100644
index c4d820b8..00000000
--- a/vendor/github.com/spf13/cobra/args.go
+++ /dev/null
@@ -1,101 +0,0 @@
-package cobra
-
-import (
- "fmt"
-)
-
-type PositionalArgs func(cmd *Command, args []string) error
-
-// Legacy arg validation has the following behaviour:
-// - root commands with no subcommands can take arbitrary arguments
-// - root commands with subcommands will do subcommand validity checking
-// - subcommands will always accept arbitrary arguments
-func legacyArgs(cmd *Command, args []string) error {
- // no subcommand, always take args
- if !cmd.HasSubCommands() {
- return nil
- }
-
- // root command with subcommands, do subcommand checking.
- if !cmd.HasParent() && len(args) > 0 {
- return fmt.Errorf("unknown command %q for %q%s", args[0], cmd.CommandPath(), cmd.findSuggestions(args[0]))
- }
- return nil
-}
-
-// NoArgs returns an error if any args are included.
-func NoArgs(cmd *Command, args []string) error {
- if len(args) > 0 {
- return fmt.Errorf("unknown command %q for %q", args[0], cmd.CommandPath())
- }
- return nil
-}
-
-// OnlyValidArgs returns an error if any args are not in the list of ValidArgs.
-func OnlyValidArgs(cmd *Command, args []string) error {
- if len(cmd.ValidArgs) > 0 {
- for _, v := range args {
- if !stringInSlice(v, cmd.ValidArgs) {
- return fmt.Errorf("invalid argument %q for %q%s", v, cmd.CommandPath(), cmd.findSuggestions(args[0]))
- }
- }
- }
- return nil
-}
-
-// ArbitraryArgs never returns an error.
-func ArbitraryArgs(cmd *Command, args []string) error {
- return nil
-}
-
-// MinimumNArgs returns an error if there is not at least N args.
-func MinimumNArgs(n int) PositionalArgs {
- return func(cmd *Command, args []string) error {
- if len(args) < n {
- return fmt.Errorf("requires at least %d arg(s), only received %d", n, len(args))
- }
- return nil
- }
-}
-
-// MaximumNArgs returns an error if there are more than N args.
-func MaximumNArgs(n int) PositionalArgs {
- return func(cmd *Command, args []string) error {
- if len(args) > n {
- return fmt.Errorf("accepts at most %d arg(s), received %d", n, len(args))
- }
- return nil
- }
-}
-
-// ExactArgs returns an error if there are not exactly n args.
-func ExactArgs(n int) PositionalArgs {
- return func(cmd *Command, args []string) error {
- if len(args) != n {
- return fmt.Errorf("accepts %d arg(s), received %d", n, len(args))
- }
- return nil
- }
-}
-
-// ExactValidArgs returns an error if
-// there are not exactly N positional args OR
-// there are any positional args that are not in the `ValidArgs` field of `Command`
-func ExactValidArgs(n int) PositionalArgs {
- return func(cmd *Command, args []string) error {
- if err := ExactArgs(n)(cmd, args); err != nil {
- return err
- }
- return OnlyValidArgs(cmd, args)
- }
-}
-
-// RangeArgs returns an error if the number of args is not within the expected range.
-func RangeArgs(min int, max int) PositionalArgs {
- return func(cmd *Command, args []string) error {
- if len(args) < min || len(args) > max {
- return fmt.Errorf("accepts between %d and %d arg(s), received %d", min, max, len(args))
- }
- return nil
- }
-}
diff --git a/vendor/github.com/spf13/cobra/bash_completions.go b/vendor/github.com/spf13/cobra/bash_completions.go
deleted file mode 100644
index 57bb8e1b..00000000
--- a/vendor/github.com/spf13/cobra/bash_completions.go
+++ /dev/null
@@ -1,547 +0,0 @@
-package cobra
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
- "sort"
- "strings"
-
- "github.com/spf13/pflag"
-)
-
-// Annotations for Bash completion.
-const (
- BashCompFilenameExt = "cobra_annotation_bash_completion_filename_extensions"
- BashCompCustom = "cobra_annotation_bash_completion_custom"
- BashCompOneRequiredFlag = "cobra_annotation_bash_completion_one_required_flag"
- BashCompSubdirsInDir = "cobra_annotation_bash_completion_subdirs_in_dir"
-)
-
-func writePreamble(buf *bytes.Buffer, name string) {
- buf.WriteString(fmt.Sprintf("# bash completion for %-36s -*- shell-script -*-\n", name))
- buf.WriteString(fmt.Sprintf(`
-__%[1]s_debug()
-{
- if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then
- echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
- fi
-}
-
-# Homebrew on Macs have version 1.3 of bash-completion which doesn't include
-# _init_completion. This is a very minimal version of that function.
-__%[1]s_init_completion()
-{
- COMPREPLY=()
- _get_comp_words_by_ref "$@" cur prev words cword
-}
-
-__%[1]s_index_of_word()
-{
- local w word=$1
- shift
- index=0
- for w in "$@"; do
- [[ $w = "$word" ]] && return
- index=$((index+1))
- done
- index=-1
-}
-
-__%[1]s_contains_word()
-{
- local w word=$1; shift
- for w in "$@"; do
- [[ $w = "$word" ]] && return
- done
- return 1
-}
-
-__%[1]s_handle_reply()
-{
- __%[1]s_debug "${FUNCNAME[0]}"
- case $cur in
- -*)
- if [[ $(type -t compopt) = "builtin" ]]; then
- compopt -o nospace
- fi
- local allflags
- if [ ${#must_have_one_flag[@]} -ne 0 ]; then
- allflags=("${must_have_one_flag[@]}")
- else
- allflags=("${flags[*]} ${two_word_flags[*]}")
- fi
- COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") )
- if [[ $(type -t compopt) = "builtin" ]]; then
- [[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace
- fi
-
- # complete after --flag=abc
- if [[ $cur == *=* ]]; then
- if [[ $(type -t compopt) = "builtin" ]]; then
- compopt +o nospace
- fi
-
- local index flag
- flag="${cur%%=*}"
- __%[1]s_index_of_word "${flag}" "${flags_with_completion[@]}"
- COMPREPLY=()
- if [[ ${index} -ge 0 ]]; then
- PREFIX=""
- cur="${cur#*=}"
- ${flags_completion[${index}]}
- if [ -n "${ZSH_VERSION}" ]; then
- # zsh completion needs --flag= prefix
- eval "COMPREPLY=( \"\${COMPREPLY[@]/#/${flag}=}\" )"
- fi
- fi
- fi
- return 0;
- ;;
- esac
-
- # check if we are handling a flag with special work handling
- local index
- __%[1]s_index_of_word "${prev}" "${flags_with_completion[@]}"
- if [[ ${index} -ge 0 ]]; then
- ${flags_completion[${index}]}
- return
- fi
-
- # we are parsing a flag and don't have a special handler, no completion
- if [[ ${cur} != "${words[cword]}" ]]; then
- return
- fi
-
- local completions
- completions=("${commands[@]}")
- if [[ ${#must_have_one_noun[@]} -ne 0 ]]; then
- completions=("${must_have_one_noun[@]}")
- fi
- if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
- completions+=("${must_have_one_flag[@]}")
- fi
- COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") )
-
- if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then
- COMPREPLY=( $(compgen -W "${noun_aliases[*]}" -- "$cur") )
- fi
-
- if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
- if declare -F __%[1]s_custom_func >/dev/null; then
- # try command name qualified custom func
- __%[1]s_custom_func
- else
- # otherwise fall back to unqualified for compatibility
- declare -F __custom_func >/dev/null && __custom_func
- fi
- fi
-
- # available in bash-completion >= 2, not always present on macOS
- if declare -F __ltrim_colon_completions >/dev/null; then
- __ltrim_colon_completions "$cur"
- fi
-
- # If there is only 1 completion and it is a flag with an = it will be completed
- # but we don't want a space after the =
- if [[ "${#COMPREPLY[@]}" -eq "1" ]] && [[ $(type -t compopt) = "builtin" ]] && [[ "${COMPREPLY[0]}" == --*= ]]; then
- compopt -o nospace
- fi
-}
-
-# The arguments should be in the form "ext1|ext2|extn"
-__%[1]s_handle_filename_extension_flag()
-{
- local ext="$1"
- _filedir "@(${ext})"
-}
-
-__%[1]s_handle_subdirs_in_dir_flag()
-{
- local dir="$1"
- pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1
-}
-
-__%[1]s_handle_flag()
-{
- __%[1]s_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
-
- # if a command required a flag, and we found it, unset must_have_one_flag()
- local flagname=${words[c]}
- local flagvalue
- # if the word contained an =
- if [[ ${words[c]} == *"="* ]]; then
- flagvalue=${flagname#*=} # take in as flagvalue after the =
- flagname=${flagname%%=*} # strip everything after the =
- flagname="${flagname}=" # but put the = back
- fi
- __%[1]s_debug "${FUNCNAME[0]}: looking for ${flagname}"
- if __%[1]s_contains_word "${flagname}" "${must_have_one_flag[@]}"; then
- must_have_one_flag=()
- fi
-
- # if you set a flag which only applies to this command, don't show subcommands
- if __%[1]s_contains_word "${flagname}" "${local_nonpersistent_flags[@]}"; then
- commands=()
- fi
-
- # keep flag value with flagname as flaghash
- # flaghash variable is an associative array which is only supported in bash > 3.
- if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then
- if [ -n "${flagvalue}" ] ; then
- flaghash[${flagname}]=${flagvalue}
- elif [ -n "${words[ $((c+1)) ]}" ] ; then
- flaghash[${flagname}]=${words[ $((c+1)) ]}
- else
- flaghash[${flagname}]="true" # pad "true" for bool flag
- fi
- fi
-
- # skip the argument to a two word flag
- if [[ ${words[c]} != *"="* ]] && __%[1]s_contains_word "${words[c]}" "${two_word_flags[@]}"; then
- __%[1]s_debug "${FUNCNAME[0]}: found a flag ${words[c]}, skip the next argument"
- c=$((c+1))
- # if we are looking for a flags value, don't show commands
- if [[ $c -eq $cword ]]; then
- commands=()
- fi
- fi
-
- c=$((c+1))
-
-}
-
-__%[1]s_handle_noun()
-{
- __%[1]s_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
-
- if __%[1]s_contains_word "${words[c]}" "${must_have_one_noun[@]}"; then
- must_have_one_noun=()
- elif __%[1]s_contains_word "${words[c]}" "${noun_aliases[@]}"; then
- must_have_one_noun=()
- fi
-
- nouns+=("${words[c]}")
- c=$((c+1))
-}
-
-__%[1]s_handle_command()
-{
- __%[1]s_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
-
- local next_command
- if [[ -n ${last_command} ]]; then
- next_command="_${last_command}_${words[c]//:/__}"
- else
- if [[ $c -eq 0 ]]; then
- next_command="_%[1]s_root_command"
- else
- next_command="_${words[c]//:/__}"
- fi
- fi
- c=$((c+1))
- __%[1]s_debug "${FUNCNAME[0]}: looking for ${next_command}"
- declare -F "$next_command" >/dev/null && $next_command
-}
-
-__%[1]s_handle_word()
-{
- if [[ $c -ge $cword ]]; then
- __%[1]s_handle_reply
- return
- fi
- __%[1]s_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
- if [[ "${words[c]}" == -* ]]; then
- __%[1]s_handle_flag
- elif __%[1]s_contains_word "${words[c]}" "${commands[@]}"; then
- __%[1]s_handle_command
- elif [[ $c -eq 0 ]]; then
- __%[1]s_handle_command
- elif __%[1]s_contains_word "${words[c]}" "${command_aliases[@]}"; then
- # aliashash variable is an associative array which is only supported in bash > 3.
- if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then
- words[c]=${aliashash[${words[c]}]}
- __%[1]s_handle_command
- else
- __%[1]s_handle_noun
- fi
- else
- __%[1]s_handle_noun
- fi
- __%[1]s_handle_word
-}
-
-`, name))
-}
-
-func writePostscript(buf *bytes.Buffer, name string) {
- name = strings.Replace(name, ":", "__", -1)
- buf.WriteString(fmt.Sprintf("__start_%s()\n", name))
- buf.WriteString(fmt.Sprintf(`{
- local cur prev words cword
- declare -A flaghash 2>/dev/null || :
- declare -A aliashash 2>/dev/null || :
- if declare -F _init_completion >/dev/null 2>&1; then
- _init_completion -s || return
- else
- __%[1]s_init_completion -n "=" || return
- fi
-
- local c=0
- local flags=()
- local two_word_flags=()
- local local_nonpersistent_flags=()
- local flags_with_completion=()
- local flags_completion=()
- local commands=("%[1]s")
- local must_have_one_flag=()
- local must_have_one_noun=()
- local last_command
- local nouns=()
-
- __%[1]s_handle_word
-}
-
-`, name))
- buf.WriteString(fmt.Sprintf(`if [[ $(type -t compopt) = "builtin" ]]; then
- complete -o default -F __start_%s %s
-else
- complete -o default -o nospace -F __start_%s %s
-fi
-
-`, name, name, name, name))
- buf.WriteString("# ex: ts=4 sw=4 et filetype=sh\n")
-}
-
-func writeCommands(buf *bytes.Buffer, cmd *Command) {
- buf.WriteString(" commands=()\n")
- for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() || c == cmd.helpCommand {
- continue
- }
- buf.WriteString(fmt.Sprintf(" commands+=(%q)\n", c.Name()))
- writeCmdAliases(buf, c)
- }
- buf.WriteString("\n")
-}
-
-func writeFlagHandler(buf *bytes.Buffer, name string, annotations map[string][]string, cmd *Command) {
- for key, value := range annotations {
- switch key {
- case BashCompFilenameExt:
- buf.WriteString(fmt.Sprintf(" flags_with_completion+=(%q)\n", name))
-
- var ext string
- if len(value) > 0 {
- ext = fmt.Sprintf("__%s_handle_filename_extension_flag ", cmd.Root().Name()) + strings.Join(value, "|")
- } else {
- ext = "_filedir"
- }
- buf.WriteString(fmt.Sprintf(" flags_completion+=(%q)\n", ext))
- case BashCompCustom:
- buf.WriteString(fmt.Sprintf(" flags_with_completion+=(%q)\n", name))
- if len(value) > 0 {
- handlers := strings.Join(value, "; ")
- buf.WriteString(fmt.Sprintf(" flags_completion+=(%q)\n", handlers))
- } else {
- buf.WriteString(" flags_completion+=(:)\n")
- }
- case BashCompSubdirsInDir:
- buf.WriteString(fmt.Sprintf(" flags_with_completion+=(%q)\n", name))
-
- var ext string
- if len(value) == 1 {
- ext = fmt.Sprintf("__%s_handle_subdirs_in_dir_flag ", cmd.Root().Name()) + value[0]
- } else {
- ext = "_filedir -d"
- }
- buf.WriteString(fmt.Sprintf(" flags_completion+=(%q)\n", ext))
- }
- }
-}
-
-func writeShortFlag(buf *bytes.Buffer, flag *pflag.Flag, cmd *Command) {
- name := flag.Shorthand
- format := " "
- if len(flag.NoOptDefVal) == 0 {
- format += "two_word_"
- }
- format += "flags+=(\"-%s\")\n"
- buf.WriteString(fmt.Sprintf(format, name))
- writeFlagHandler(buf, "-"+name, flag.Annotations, cmd)
-}
-
-func writeFlag(buf *bytes.Buffer, flag *pflag.Flag, cmd *Command) {
- name := flag.Name
- format := " flags+=(\"--%s"
- if len(flag.NoOptDefVal) == 0 {
- format += "="
- }
- format += "\")\n"
- buf.WriteString(fmt.Sprintf(format, name))
- if len(flag.NoOptDefVal) == 0 {
- format = " two_word_flags+=(\"--%s\")\n"
- buf.WriteString(fmt.Sprintf(format, name))
- }
- writeFlagHandler(buf, "--"+name, flag.Annotations, cmd)
-}
-
-func writeLocalNonPersistentFlag(buf *bytes.Buffer, flag *pflag.Flag) {
- name := flag.Name
- format := " local_nonpersistent_flags+=(\"--%s"
- if len(flag.NoOptDefVal) == 0 {
- format += "="
- }
- format += "\")\n"
- buf.WriteString(fmt.Sprintf(format, name))
-}
-
-func writeFlags(buf *bytes.Buffer, cmd *Command) {
- buf.WriteString(` flags=()
- two_word_flags=()
- local_nonpersistent_flags=()
- flags_with_completion=()
- flags_completion=()
-
-`)
- localNonPersistentFlags := cmd.LocalNonPersistentFlags()
- cmd.NonInheritedFlags().VisitAll(func(flag *pflag.Flag) {
- if nonCompletableFlag(flag) {
- return
- }
- writeFlag(buf, flag, cmd)
- if len(flag.Shorthand) > 0 {
- writeShortFlag(buf, flag, cmd)
- }
- if localNonPersistentFlags.Lookup(flag.Name) != nil {
- writeLocalNonPersistentFlag(buf, flag)
- }
- })
- cmd.InheritedFlags().VisitAll(func(flag *pflag.Flag) {
- if nonCompletableFlag(flag) {
- return
- }
- writeFlag(buf, flag, cmd)
- if len(flag.Shorthand) > 0 {
- writeShortFlag(buf, flag, cmd)
- }
- })
-
- buf.WriteString("\n")
-}
-
-func writeRequiredFlag(buf *bytes.Buffer, cmd *Command) {
- buf.WriteString(" must_have_one_flag=()\n")
- flags := cmd.NonInheritedFlags()
- flags.VisitAll(func(flag *pflag.Flag) {
- if nonCompletableFlag(flag) {
- return
- }
- for key := range flag.Annotations {
- switch key {
- case BashCompOneRequiredFlag:
- format := " must_have_one_flag+=(\"--%s"
- if flag.Value.Type() != "bool" {
- format += "="
- }
- format += "\")\n"
- buf.WriteString(fmt.Sprintf(format, flag.Name))
-
- if len(flag.Shorthand) > 0 {
- buf.WriteString(fmt.Sprintf(" must_have_one_flag+=(\"-%s\")\n", flag.Shorthand))
- }
- }
- }
- })
-}
-
-func writeRequiredNouns(buf *bytes.Buffer, cmd *Command) {
- buf.WriteString(" must_have_one_noun=()\n")
- sort.Sort(sort.StringSlice(cmd.ValidArgs))
- for _, value := range cmd.ValidArgs {
- buf.WriteString(fmt.Sprintf(" must_have_one_noun+=(%q)\n", value))
- }
-}
-
-func writeCmdAliases(buf *bytes.Buffer, cmd *Command) {
- if len(cmd.Aliases) == 0 {
- return
- }
-
- sort.Sort(sort.StringSlice(cmd.Aliases))
-
- buf.WriteString(fmt.Sprint(` if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then`, "\n"))
- for _, value := range cmd.Aliases {
- buf.WriteString(fmt.Sprintf(" command_aliases+=(%q)\n", value))
- buf.WriteString(fmt.Sprintf(" aliashash[%q]=%q\n", value, cmd.Name()))
- }
- buf.WriteString(` fi`)
- buf.WriteString("\n")
-}
-func writeArgAliases(buf *bytes.Buffer, cmd *Command) {
- buf.WriteString(" noun_aliases=()\n")
- sort.Sort(sort.StringSlice(cmd.ArgAliases))
- for _, value := range cmd.ArgAliases {
- buf.WriteString(fmt.Sprintf(" noun_aliases+=(%q)\n", value))
- }
-}
-
-func gen(buf *bytes.Buffer, cmd *Command) {
- for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() || c == cmd.helpCommand {
- continue
- }
- gen(buf, c)
- }
- commandName := cmd.CommandPath()
- commandName = strings.Replace(commandName, " ", "_", -1)
- commandName = strings.Replace(commandName, ":", "__", -1)
-
- if cmd.Root() == cmd {
- buf.WriteString(fmt.Sprintf("_%s_root_command()\n{\n", commandName))
- } else {
- buf.WriteString(fmt.Sprintf("_%s()\n{\n", commandName))
- }
-
- buf.WriteString(fmt.Sprintf(" last_command=%q\n", commandName))
- buf.WriteString("\n")
- buf.WriteString(" command_aliases=()\n")
- buf.WriteString("\n")
-
- writeCommands(buf, cmd)
- writeFlags(buf, cmd)
- writeRequiredFlag(buf, cmd)
- writeRequiredNouns(buf, cmd)
- writeArgAliases(buf, cmd)
- buf.WriteString("}\n\n")
-}
-
-// GenBashCompletion generates bash completion file and writes to the passed writer.
-func (c *Command) GenBashCompletion(w io.Writer) error {
- buf := new(bytes.Buffer)
- writePreamble(buf, c.Name())
- if len(c.BashCompletionFunction) > 0 {
- buf.WriteString(c.BashCompletionFunction + "\n")
- }
- gen(buf, c)
- writePostscript(buf, c.Name())
-
- _, err := buf.WriteTo(w)
- return err
-}
-
-func nonCompletableFlag(flag *pflag.Flag) bool {
- return flag.Hidden || len(flag.Deprecated) > 0
-}
-
-// GenBashCompletionFile generates bash completion file.
-func (c *Command) GenBashCompletionFile(filename string) error {
- outFile, err := os.Create(filename)
- if err != nil {
- return err
- }
- defer outFile.Close()
-
- return c.GenBashCompletion(outFile)
-}
diff --git a/vendor/github.com/spf13/cobra/bash_completions.md b/vendor/github.com/spf13/cobra/bash_completions.md
deleted file mode 100644
index 4ac61ee1..00000000
--- a/vendor/github.com/spf13/cobra/bash_completions.md
+++ /dev/null
@@ -1,256 +0,0 @@
-# Generating Bash Completions For Your Own cobra.Command
-
-If you are using the generator you can create a completion command by running
-
-```bash
-cobra add completion
-```
-
-Update the help text show how to install the bash_completion Linux show here [Kubectl docs show mac options](https://kubernetes.io/docs/tasks/tools/install-kubectl/#enabling-shell-autocompletion)
-
-Writing the shell script to stdout allows the most flexible use.
-
-```go
-// completionCmd represents the completion command
-var completionCmd = &cobra.Command{
- Use: "completion",
- Short: "Generates bash completion scripts",
- Long: `To load completion run
-
-. <(bitbucket completion)
-
-To configure your bash shell to load completions for each session add to your bashrc
-
-# ~/.bashrc or ~/.profile
-. <(bitbucket completion)
-`,
- Run: func(cmd *cobra.Command, args []string) {
- rootCmd.GenBashCompletion(os.Stdout);
- },
-}
-```
-
-**Note:** The cobra generator may include messages printed to stdout for example if the config file is loaded, this will break the auto complete script
-
-
-## Example from kubectl
-
-Generating bash completions from a cobra command is incredibly easy. An actual program which does so for the kubernetes kubectl binary is as follows:
-
-```go
-package main
-
-import (
- "io/ioutil"
- "os"
-
- "k8s.io/kubernetes/pkg/kubectl/cmd"
- "k8s.io/kubernetes/pkg/kubectl/cmd/util"
-)
-
-func main() {
- kubectl := cmd.NewKubectlCommand(util.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard)
- kubectl.GenBashCompletionFile("out.sh")
-}
-```
-
-`out.sh` will get you completions of subcommands and flags. Copy it to `/etc/bash_completion.d/` as described [here](https://debian-administration.org/article/316/An_introduction_to_bash_completion_part_1) and reset your terminal to use autocompletion. If you make additional annotations to your code, you can get even more intelligent and flexible behavior.
-
-## Creating your own custom functions
-
-Some more actual code that works in kubernetes:
-
-```bash
-const (
- bash_completion_func = `__kubectl_parse_get()
-{
- local kubectl_output out
- if kubectl_output=$(kubectl get --no-headers "$1" 2>/dev/null); then
- out=($(echo "${kubectl_output}" | awk '{print $1}'))
- COMPREPLY=( $( compgen -W "${out[*]}" -- "$cur" ) )
- fi
-}
-
-__kubectl_get_resource()
-{
- if [[ ${#nouns[@]} -eq 0 ]]; then
- return 1
- fi
- __kubectl_parse_get ${nouns[${#nouns[@]} -1]}
- if [[ $? -eq 0 ]]; then
- return 0
- fi
-}
-
-__kubectl_custom_func() {
- case ${last_command} in
- kubectl_get | kubectl_describe | kubectl_delete | kubectl_stop)
- __kubectl_get_resource
- return
- ;;
- *)
- ;;
- esac
-}
-`)
-```
-
-And then I set that in my command definition:
-
-```go
-cmds := &cobra.Command{
- Use: "kubectl",
- Short: "kubectl controls the Kubernetes cluster manager",
- Long: `kubectl controls the Kubernetes cluster manager.
-
-Find more information at https://github.com/GoogleCloudPlatform/kubernetes.`,
- Run: runHelp,
- BashCompletionFunction: bash_completion_func,
-}
-```
-
-The `BashCompletionFunction` option is really only valid/useful on the root command. Doing the above will cause `__kubectl_custom_func()` (`__<command-use>_custom_func()`) to be called when the built in processor was unable to find a solution. In the case of kubernetes a valid command might look something like `kubectl get pod [mypod]`. If you type `kubectl get pod [tab][tab]` the `__kubectl_customc_func()` will run because the cobra.Command only understood "kubectl" and "get." `__kubectl_custom_func()` will see that the cobra.Command is "kubectl_get" and will thus call another helper `__kubectl_get_resource()`. `__kubectl_get_resource` will look at the 'nouns' collected. In our example the only noun will be `pod`. So it will call `__kubectl_parse_get pod`. `__kubectl_parse_get` will actually call out to kubernetes and get any pods. It will then set `COMPREPLY` to valid pods!
-
-## Have the completions code complete your 'nouns'
-
-In the above example "pod" was assumed to already be typed. But if you want `kubectl get [tab][tab]` to show a list of valid "nouns" you have to set them. Simplified code from `kubectl get` looks like:
-
-```go
-validArgs []string = { "pod", "node", "service", "replicationcontroller" }
-
-cmd := &cobra.Command{
- Use: "get [(-o|--output=)json|yaml|template|...] (RESOURCE [NAME] | RESOURCE/NAME ...)",
- Short: "Display one or many resources",
- Long: get_long,
- Example: get_example,
- Run: func(cmd *cobra.Command, args []string) {
- err := RunGet(f, out, cmd, args)
- util.CheckErr(err)
- },
- ValidArgs: validArgs,
-}
-```
-
-Notice we put the "ValidArgs" on the "get" subcommand. Doing so will give results like
-
-```bash
-# kubectl get [tab][tab]
-node pod replicationcontroller service
-```
-
-## Plural form and shortcuts for nouns
-
-If your nouns have a number of aliases, you can define them alongside `ValidArgs` using `ArgAliases`:
-
-```go
-argAliases []string = { "pods", "nodes", "services", "svc", "replicationcontrollers", "rc" }
-
-cmd := &cobra.Command{
- ...
- ValidArgs: validArgs,
- ArgAliases: argAliases
-}
-```
-
-The aliases are not shown to the user on tab completion, but they are accepted as valid nouns by
-the completion algorithm if entered manually, e.g. in:
-
-```bash
-# kubectl get rc [tab][tab]
-backend frontend database
-```
-
-Note that without declaring `rc` as an alias, the completion algorithm would show the list of nouns
-in this example again instead of the replication controllers.
-
-## Mark flags as required
-
-Most of the time completions will only show subcommands. But if a flag is required to make a subcommand work, you probably want it to show up when the user types [tab][tab]. Marking a flag as 'Required' is incredibly easy.
-
-```go
-cmd.MarkFlagRequired("pod")
-cmd.MarkFlagRequired("container")
-```
-
-and you'll get something like
-
-```bash
-# kubectl exec [tab][tab][tab]
--c --container= -p --pod=
-```
-
-# Specify valid filename extensions for flags that take a filename
-
-In this example we use --filename= and expect to get a json or yaml file as the argument. To make this easier we annotate the --filename flag with valid filename extensions.
-
-```go
- annotations := []string{"json", "yaml", "yml"}
- annotation := make(map[string][]string)
- annotation[cobra.BashCompFilenameExt] = annotations
-
- flag := &pflag.Flag{
- Name: "filename",
- Shorthand: "f",
- Usage: usage,
- Value: value,
- DefValue: value.String(),
- Annotations: annotation,
- }
- cmd.Flags().AddFlag(flag)
-```
-
-Now when you run a command with this filename flag you'll get something like
-
-```bash
-# kubectl create -f
-test/ example/ rpmbuild/
-hello.yml test.json
-```
-
-So while there are many other files in the CWD it only shows me subdirs and those with valid extensions.
-
-# Specify custom flag completion
-
-Similar to the filename completion and filtering using cobra.BashCompFilenameExt, you can specify
-a custom flag completion function with cobra.BashCompCustom:
-
-```go
- annotation := make(map[string][]string)
- annotation[cobra.BashCompCustom] = []string{"__kubectl_get_namespaces"}
-
- flag := &pflag.Flag{
- Name: "namespace",
- Usage: usage,
- Annotations: annotation,
- }
- cmd.Flags().AddFlag(flag)
-```
-
-In addition add the `__handle_namespace_flag` implementation in the `BashCompletionFunction`
-value, e.g.:
-
-```bash
-__kubectl_get_namespaces()
-{
- local template
- template="{{ range .items }}{{ .metadata.name }} {{ end }}"
- local kubectl_out
- if kubectl_out=$(kubectl get -o template --template="${template}" namespace 2>/dev/null); then
- COMPREPLY=( $( compgen -W "${kubectl_out}[*]" -- "$cur" ) )
- fi
-}
-```
-# Using bash aliases for commands
-
-You can also configure the `bash aliases` for the commands and they will also support completions.
-
-```bash
-alias aliasname=origcommand
-complete -o default -F __start_origcommand aliasname
-
-# and now when you run `aliasname` completion will make
-# suggestions as it did for `origcommand`.
-
-$) aliasname <tab><tab>
-completion firstcommand secondcommand
-```
diff --git a/vendor/github.com/spf13/cobra/cobra.go b/vendor/github.com/spf13/cobra/cobra.go
deleted file mode 100644
index 6505c070..00000000
--- a/vendor/github.com/spf13/cobra/cobra.go
+++ /dev/null
@@ -1,207 +0,0 @@
-// Copyright © 2013 Steve Francia <spf@spf13.com>.
-//
-// 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.
-
-// Commands similar to git, go tools and other modern CLI tools
-// inspired by go, go-Commander, gh and subcommand
-
-package cobra
-
-import (
- "fmt"
- "io"
- "reflect"
- "strconv"
- "strings"
- "text/template"
- "time"
- "unicode"
-)
-
-var templateFuncs = template.FuncMap{
- "trim": strings.TrimSpace,
- "trimRightSpace": trimRightSpace,
- "trimTrailingWhitespaces": trimRightSpace,
- "appendIfNotPresent": appendIfNotPresent,
- "rpad": rpad,
- "gt": Gt,
- "eq": Eq,
-}
-
-var initializers []func()
-
-// EnablePrefixMatching allows to set automatic prefix matching. Automatic prefix matching can be a dangerous thing
-// to automatically enable in CLI tools.
-// Set this to true to enable it.
-var EnablePrefixMatching = false
-
-// EnableCommandSorting controls sorting of the slice of commands, which is turned on by default.
-// To disable sorting, set it to false.
-var EnableCommandSorting = true
-
-// MousetrapHelpText enables an information splash screen on Windows
-// if the CLI is started from explorer.exe.
-// To disable the mousetrap, just set this variable to blank string ("").
-// Works only on Microsoft Windows.
-var MousetrapHelpText string = `This is a command line tool.
-
-You need to open cmd.exe and run it from there.
-`
-
-// MousetrapDisplayDuration controls how long the MousetrapHelpText message is displayed on Windows
-// if the CLI is started from explorer.exe. Set to 0 to wait for the return key to be pressed.
-// To disable the mousetrap, just set MousetrapHelpText to blank string ("").
-// Works only on Microsoft Windows.
-var MousetrapDisplayDuration time.Duration = 5 * time.Second
-
-// AddTemplateFunc adds a template function that's available to Usage and Help
-// template generation.
-func AddTemplateFunc(name string, tmplFunc interface{}) {
- templateFuncs[name] = tmplFunc
-}
-
-// AddTemplateFuncs adds multiple template functions that are available to Usage and
-// Help template generation.
-func AddTemplateFuncs(tmplFuncs template.FuncMap) {
- for k, v := range tmplFuncs {
- templateFuncs[k] = v
- }
-}
-
-// OnInitialize sets the passed functions to be run when each command's
-// Execute method is called.
-func OnInitialize(y ...func()) {
- initializers = append(initializers, y...)
-}
-
-// FIXME Gt is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra.
-
-// Gt takes two types and checks whether the first type is greater than the second. In case of types Arrays, Chans,
-// Maps and Slices, Gt will compare their lengths. Ints are compared directly while strings are first parsed as
-// ints and then compared.
-func Gt(a interface{}, b interface{}) bool {
- var left, right int64
- av := reflect.ValueOf(a)
-
- switch av.Kind() {
- case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
- left = int64(av.Len())
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- left = av.Int()
- case reflect.String:
- left, _ = strconv.ParseInt(av.String(), 10, 64)
- }
-
- bv := reflect.ValueOf(b)
-
- switch bv.Kind() {
- case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
- right = int64(bv.Len())
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- right = bv.Int()
- case reflect.String:
- right, _ = strconv.ParseInt(bv.String(), 10, 64)
- }
-
- return left > right
-}
-
-// FIXME Eq is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra.
-
-// Eq takes two types and checks whether they are equal. Supported types are int and string. Unsupported types will panic.
-func Eq(a interface{}, b interface{}) bool {
- av := reflect.ValueOf(a)
- bv := reflect.ValueOf(b)
-
- switch av.Kind() {
- case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
- panic("Eq called on unsupported type")
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return av.Int() == bv.Int()
- case reflect.String:
- return av.String() == bv.String()
- }
- return false
-}
-
-func trimRightSpace(s string) string {
- return strings.TrimRightFunc(s, unicode.IsSpace)
-}
-
-// FIXME appendIfNotPresent is unused by cobra and should be removed in a version 2. It exists only for compatibility with users of cobra.
-
-// appendIfNotPresent will append stringToAppend to the end of s, but only if it's not yet present in s.
-func appendIfNotPresent(s, stringToAppend string) string {
- if strings.Contains(s, stringToAppend) {
- return s
- }
- return s + " " + stringToAppend
-}
-
-// rpad adds padding to the right of a string.
-func rpad(s string, padding int) string {
- template := fmt.Sprintf("%%-%ds", padding)
- return fmt.Sprintf(template, s)
-}
-
-// tmpl executes the given template text on data, writing the result to w.
-func tmpl(w io.Writer, text string, data interface{}) error {
- t := template.New("top")
- t.Funcs(templateFuncs)
- template.Must(t.Parse(text))
- return t.Execute(w, data)
-}
-
-// ld compares two strings and returns the levenshtein distance between them.
-func ld(s, t string, ignoreCase bool) int {
- if ignoreCase {
- s = strings.ToLower(s)
- t = strings.ToLower(t)
- }
- d := make([][]int, len(s)+1)
- for i := range d {
- d[i] = make([]int, len(t)+1)
- }
- for i := range d {
- d[i][0] = i
- }
- for j := range d[0] {
- d[0][j] = j
- }
- for j := 1; j <= len(t); j++ {
- for i := 1; i <= len(s); i++ {
- if s[i-1] == t[j-1] {
- d[i][j] = d[i-1][j-1]
- } else {
- min := d[i-1][j]
- if d[i][j-1] < min {
- min = d[i][j-1]
- }
- if d[i-1][j-1] < min {
- min = d[i-1][j-1]
- }
- d[i][j] = min + 1
- }
- }
-
- }
- return d[len(s)][len(t)]
-}
-
-func stringInSlice(a string, list []string) bool {
- for _, b := range list {
- if b == a {
- return true
- }
- }
- return false
-}
diff --git a/vendor/github.com/spf13/cobra/cobra/cmd/testdata/LICENSE.golden b/vendor/github.com/spf13/cobra/cobra/cmd/testdata/LICENSE.golden
deleted file mode 100644
index d6456956..00000000
--- a/vendor/github.com/spf13/cobra/cobra/cmd/testdata/LICENSE.golden
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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/spf13/cobra/command.go b/vendor/github.com/spf13/cobra/command.go
deleted file mode 100644
index c7e89830..00000000
--- a/vendor/github.com/spf13/cobra/command.go
+++ /dev/null
@@ -1,1594 +0,0 @@
-// Copyright © 2013 Steve Francia <spf@spf13.com>.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package cobra is a commander providing a simple interface to create powerful modern CLI interfaces.
-// In addition to providing an interface, Cobra simultaneously provides a controller to organize your application code.
-package cobra
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
- "path/filepath"
- "sort"
- "strings"
-
- flag "github.com/spf13/pflag"
-)
-
-// FParseErrWhitelist configures Flag parse errors to be ignored
-type FParseErrWhitelist flag.ParseErrorsWhitelist
-
-// Command is just that, a command for your application.
-// E.g. 'go run ...' - 'run' is the command. Cobra requires
-// you to define the usage and description as part of your command
-// definition to ensure usability.
-type Command struct {
- // Use is the one-line usage message.
- Use string
-
- // Aliases is an array of aliases that can be used instead of the first word in Use.
- Aliases []string
-
- // SuggestFor is an array of command names for which this command will be suggested -
- // similar to aliases but only suggests.
- SuggestFor []string
-
- // Short is the short description shown in the 'help' output.
- Short string
-
- // Long is the long message shown in the 'help <this-command>' output.
- Long string
-
- // Example is examples of how to use the command.
- Example string
-
- // ValidArgs is list of all valid non-flag arguments that are accepted in bash completions
- ValidArgs []string
-
- // Expected arguments
- Args PositionalArgs
-
- // ArgAliases is List of aliases for ValidArgs.
- // These are not suggested to the user in the bash completion,
- // but accepted if entered manually.
- ArgAliases []string
-
- // BashCompletionFunction is custom functions used by the bash autocompletion generator.
- BashCompletionFunction string
-
- // Deprecated defines, if this command is deprecated and should print this string when used.
- Deprecated string
-
- // Hidden defines, if this command is hidden and should NOT show up in the list of available commands.
- Hidden bool
-
- // Annotations are key/value pairs that can be used by applications to identify or
- // group commands.
- Annotations map[string]string
-
- // Version defines the version for this command. If this value is non-empty and the command does not
- // define a "version" flag, a "version" boolean flag will be added to the command and, if specified,
- // will print content of the "Version" variable.
- Version string
-
- // The *Run functions are executed in the following order:
- // * PersistentPreRun()
- // * PreRun()
- // * Run()
- // * PostRun()
- // * PersistentPostRun()
- // All functions get the same args, the arguments after the command name.
- //
- // PersistentPreRun: children of this command will inherit and execute.
- PersistentPreRun func(cmd *Command, args []string)
- // PersistentPreRunE: PersistentPreRun but returns an error.
- PersistentPreRunE func(cmd *Command, args []string) error
- // PreRun: children of this command will not inherit.
- PreRun func(cmd *Command, args []string)
- // PreRunE: PreRun but returns an error.
- PreRunE func(cmd *Command, args []string) error
- // Run: Typically the actual work function. Most commands will only implement this.
- Run func(cmd *Command, args []string)
- // RunE: Run but returns an error.
- RunE func(cmd *Command, args []string) error
- // PostRun: run after the Run command.
- PostRun func(cmd *Command, args []string)
- // PostRunE: PostRun but returns an error.
- PostRunE func(cmd *Command, args []string) error
- // PersistentPostRun: children of this command will inherit and execute after PostRun.
- PersistentPostRun func(cmd *Command, args []string)
- // PersistentPostRunE: PersistentPostRun but returns an error.
- PersistentPostRunE func(cmd *Command, args []string) error
-
- // SilenceErrors is an option to quiet errors down stream.
- SilenceErrors bool
-
- // SilenceUsage is an option to silence usage when an error occurs.
- SilenceUsage bool
-
- // DisableFlagParsing disables the flag parsing.
- // If this is true all flags will be passed to the command as arguments.
- DisableFlagParsing bool
-
- // DisableAutoGenTag defines, if gen tag ("Auto generated by spf13/cobra...")
- // will be printed by generating docs for this command.
- DisableAutoGenTag bool
-
- // DisableFlagsInUseLine will disable the addition of [flags] to the usage
- // line of a command when printing help or generating docs
- DisableFlagsInUseLine bool
-
- // DisableSuggestions disables the suggestions based on Levenshtein distance
- // that go along with 'unknown command' messages.
- DisableSuggestions bool
- // SuggestionsMinimumDistance defines minimum levenshtein distance to display suggestions.
- // Must be > 0.
- SuggestionsMinimumDistance int
-
- // TraverseChildren parses flags on all parents before executing child command.
- TraverseChildren bool
-
- //FParseErrWhitelist flag parse errors to be ignored
- FParseErrWhitelist FParseErrWhitelist
-
- // commands is the list of commands supported by this program.
- commands []*Command
- // parent is a parent command for this command.
- parent *Command
- // Max lengths of commands' string lengths for use in padding.
- commandsMaxUseLen int
- commandsMaxCommandPathLen int
- commandsMaxNameLen int
- // commandsAreSorted defines, if command slice are sorted or not.
- commandsAreSorted bool
- // commandCalledAs is the name or alias value used to call this command.
- commandCalledAs struct {
- name string
- called bool
- }
-
- // args is actual args parsed from flags.
- args []string
- // flagErrorBuf contains all error messages from pflag.
- flagErrorBuf *bytes.Buffer
- // flags is full set of flags.
- flags *flag.FlagSet
- // pflags contains persistent flags.
- pflags *flag.FlagSet
- // lflags contains local flags.
- lflags *flag.FlagSet
- // iflags contains inherited flags.
- iflags *flag.FlagSet
- // parentsPflags is all persistent flags of cmd's parents.
- parentsPflags *flag.FlagSet
- // globNormFunc is the global normalization function
- // that we can use on every pflag set and children commands
- globNormFunc func(f *flag.FlagSet, name string) flag.NormalizedName
-
- // usageFunc is usage func defined by user.
- usageFunc func(*Command) error
- // usageTemplate is usage template defined by user.
- usageTemplate string
- // flagErrorFunc is func defined by user and it's called when the parsing of
- // flags returns an error.
- flagErrorFunc func(*Command, error) error
- // helpTemplate is help template defined by user.
- helpTemplate string
- // helpFunc is help func defined by user.
- helpFunc func(*Command, []string)
- // helpCommand is command with usage 'help'. If it's not defined by user,
- // cobra uses default help command.
- helpCommand *Command
- // versionTemplate is the version template defined by user.
- versionTemplate string
-
- // inReader is a reader defined by the user that replaces stdin
- inReader io.Reader
- // outWriter is a writer defined by the user that replaces stdout
- outWriter io.Writer
- // errWriter is a writer defined by the user that replaces stderr
- errWriter io.Writer
-}
-
-// SetArgs sets arguments for the command. It is set to os.Args[1:] by default, if desired, can be overridden
-// particularly useful when testing.
-func (c *Command) SetArgs(a []string) {
- c.args = a
-}
-
-// SetOutput sets the destination for usage and error messages.
-// If output is nil, os.Stderr is used.
-// Deprecated: Use SetOut and/or SetErr instead
-func (c *Command) SetOutput(output io.Writer) {
- c.outWriter = output
- c.errWriter = output
-}
-
-// SetOut sets the destination for usage messages.
-// If newOut is nil, os.Stdout is used.
-func (c *Command) SetOut(newOut io.Writer) {
- c.outWriter = newOut
-}
-
-// SetErr sets the destination for error messages.
-// If newErr is nil, os.Stderr is used.
-func (c *Command) SetErr(newErr io.Writer) {
- c.errWriter = newErr
-}
-
-// SetOut sets the source for input data
-// If newIn is nil, os.Stdin is used.
-func (c *Command) SetIn(newIn io.Reader) {
- c.inReader = newIn
-}
-
-// SetUsageFunc sets usage function. Usage can be defined by application.
-func (c *Command) SetUsageFunc(f func(*Command) error) {
- c.usageFunc = f
-}
-
-// SetUsageTemplate sets usage template. Can be defined by Application.
-func (c *Command) SetUsageTemplate(s string) {
- c.usageTemplate = s
-}
-
-// SetFlagErrorFunc sets a function to generate an error when flag parsing
-// fails.
-func (c *Command) SetFlagErrorFunc(f func(*Command, error) error) {
- c.flagErrorFunc = f
-}
-
-// SetHelpFunc sets help function. Can be defined by Application.
-func (c *Command) SetHelpFunc(f func(*Command, []string)) {
- c.helpFunc = f
-}
-
-// SetHelpCommand sets help command.
-func (c *Command) SetHelpCommand(cmd *Command) {
- c.helpCommand = cmd
-}
-
-// SetHelpTemplate sets help template to be used. Application can use it to set custom template.
-func (c *Command) SetHelpTemplate(s string) {
- c.helpTemplate = s
-}
-
-// SetVersionTemplate sets version template to be used. Application can use it to set custom template.
-func (c *Command) SetVersionTemplate(s string) {
- c.versionTemplate = s
-}
-
-// SetGlobalNormalizationFunc sets a normalization function to all flag sets and also to child commands.
-// The user should not have a cyclic dependency on commands.
-func (c *Command) SetGlobalNormalizationFunc(n func(f *flag.FlagSet, name string) flag.NormalizedName) {
- c.Flags().SetNormalizeFunc(n)
- c.PersistentFlags().SetNormalizeFunc(n)
- c.globNormFunc = n
-
- for _, command := range c.commands {
- command.SetGlobalNormalizationFunc(n)
- }
-}
-
-// OutOrStdout returns output to stdout.
-func (c *Command) OutOrStdout() io.Writer {
- return c.getOut(os.Stdout)
-}
-
-// OutOrStderr returns output to stderr
-func (c *Command) OutOrStderr() io.Writer {
- return c.getOut(os.Stderr)
-}
-
-// ErrOrStderr returns output to stderr
-func (c *Command) ErrOrStderr() io.Writer {
- return c.getErr(os.Stderr)
-}
-
-// ErrOrStderr returns output to stderr
-func (c *Command) InOrStdin() io.Reader {
- return c.getIn(os.Stdin)
-}
-
-func (c *Command) getOut(def io.Writer) io.Writer {
- if c.outWriter != nil {
- return c.outWriter
- }
- if c.HasParent() {
- return c.parent.getOut(def)
- }
- return def
-}
-
-func (c *Command) getErr(def io.Writer) io.Writer {
- if c.errWriter != nil {
- return c.errWriter
- }
- if c.HasParent() {
- return c.parent.getErr(def)
- }
- return def
-}
-
-func (c *Command) getIn(def io.Reader) io.Reader {
- if c.inReader != nil {
- return c.inReader
- }
- if c.HasParent() {
- return c.parent.getIn(def)
- }
- return def
-}
-
-// UsageFunc returns either the function set by SetUsageFunc for this command
-// or a parent, or it returns a default usage function.
-func (c *Command) UsageFunc() (f func(*Command) error) {
- if c.usageFunc != nil {
- return c.usageFunc
- }
- if c.HasParent() {
- return c.Parent().UsageFunc()
- }
- return func(c *Command) error {
- c.mergePersistentFlags()
- err := tmpl(c.OutOrStderr(), c.UsageTemplate(), c)
- if err != nil {
- c.Println(err)
- }
- return err
- }
-}
-
-// Usage puts out the usage for the command.
-// Used when a user provides invalid input.
-// Can be defined by user by overriding UsageFunc.
-func (c *Command) Usage() error {
- return c.UsageFunc()(c)
-}
-
-// HelpFunc returns either the function set by SetHelpFunc for this command
-// or a parent, or it returns a function with default help behavior.
-func (c *Command) HelpFunc() func(*Command, []string) {
- if c.helpFunc != nil {
- return c.helpFunc
- }
- if c.HasParent() {
- return c.Parent().HelpFunc()
- }
- return func(c *Command, a []string) {
- c.mergePersistentFlags()
- err := tmpl(c.OutOrStdout(), c.HelpTemplate(), c)
- if err != nil {
- c.Println(err)
- }
- }
-}
-
-// Help puts out the help for the command.
-// Used when a user calls help [command].
-// Can be defined by user by overriding HelpFunc.
-func (c *Command) Help() error {
- c.HelpFunc()(c, []string{})
- return nil
-}
-
-// UsageString returns usage string.
-func (c *Command) UsageString() string {
- // Storing normal writers
- tmpOutput := c.outWriter
- tmpErr := c.errWriter
-
- bb := new(bytes.Buffer)
- c.outWriter = bb
- c.errWriter = bb
-
- c.Usage()
-
- // Setting things back to normal
- c.outWriter = tmpOutput
- c.errWriter = tmpErr
-
- return bb.String()
-}
-
-// FlagErrorFunc returns either the function set by SetFlagErrorFunc for this
-// command or a parent, or it returns a function which returns the original
-// error.
-func (c *Command) FlagErrorFunc() (f func(*Command, error) error) {
- if c.flagErrorFunc != nil {
- return c.flagErrorFunc
- }
-
- if c.HasParent() {
- return c.parent.FlagErrorFunc()
- }
- return func(c *Command, err error) error {
- return err
- }
-}
-
-var minUsagePadding = 25
-
-// UsagePadding return padding for the usage.
-func (c *Command) UsagePadding() int {
- if c.parent == nil || minUsagePadding > c.parent.commandsMaxUseLen {
- return minUsagePadding
- }
- return c.parent.commandsMaxUseLen
-}
-
-var minCommandPathPadding = 11
-
-// CommandPathPadding return padding for the command path.
-func (c *Command) CommandPathPadding() int {
- if c.parent == nil || minCommandPathPadding > c.parent.commandsMaxCommandPathLen {
- return minCommandPathPadding
- }
- return c.parent.commandsMaxCommandPathLen
-}
-
-var minNamePadding = 11
-
-// NamePadding returns padding for the name.
-func (c *Command) NamePadding() int {
- if c.parent == nil || minNamePadding > c.parent.commandsMaxNameLen {
- return minNamePadding
- }
- return c.parent.commandsMaxNameLen
-}
-
-// UsageTemplate returns usage template for the command.
-func (c *Command) UsageTemplate() string {
- if c.usageTemplate != "" {
- return c.usageTemplate
- }
-
- if c.HasParent() {
- return c.parent.UsageTemplate()
- }
- return `Usage:{{if .Runnable}}
- {{.UseLine}}{{end}}{{if .HasAvailableSubCommands}}
- {{.CommandPath}} [command]{{end}}{{if gt (len .Aliases) 0}}
-
-Aliases:
- {{.NameAndAliases}}{{end}}{{if .HasExample}}
-
-Examples:
-{{.Example}}{{end}}{{if .HasAvailableSubCommands}}
-
-Available Commands:{{range .Commands}}{{if (or .IsAvailableCommand (eq .Name "help"))}}
- {{rpad .Name .NamePadding }} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableLocalFlags}}
-
-Flags:
-{{.LocalFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasAvailableInheritedFlags}}
-
-Global Flags:
-{{.InheritedFlags.FlagUsages | trimTrailingWhitespaces}}{{end}}{{if .HasHelpSubCommands}}
-
-Additional help topics:{{range .Commands}}{{if .IsAdditionalHelpTopicCommand}}
- {{rpad .CommandPath .CommandPathPadding}} {{.Short}}{{end}}{{end}}{{end}}{{if .HasAvailableSubCommands}}
-
-Use "{{.CommandPath}} [command] --help" for more information about a command.{{end}}
-`
-}
-
-// HelpTemplate return help template for the command.
-func (c *Command) HelpTemplate() string {
- if c.helpTemplate != "" {
- return c.helpTemplate
- }
-
- if c.HasParent() {
- return c.parent.HelpTemplate()
- }
- return `{{with (or .Long .Short)}}{{. | trimTrailingWhitespaces}}
-
-{{end}}{{if or .Runnable .HasSubCommands}}{{.UsageString}}{{end}}`
-}
-
-// VersionTemplate return version template for the command.
-func (c *Command) VersionTemplate() string {
- if c.versionTemplate != "" {
- return c.versionTemplate
- }
-
- if c.HasParent() {
- return c.parent.VersionTemplate()
- }
- return `{{with .Name}}{{printf "%s " .}}{{end}}{{printf "version %s" .Version}}
-`
-}
-
-func hasNoOptDefVal(name string, fs *flag.FlagSet) bool {
- flag := fs.Lookup(name)
- if flag == nil {
- return false
- }
- return flag.NoOptDefVal != ""
-}
-
-func shortHasNoOptDefVal(name string, fs *flag.FlagSet) bool {
- if len(name) == 0 {
- return false
- }
-
- flag := fs.ShorthandLookup(name[:1])
- if flag == nil {
- return false
- }
- return flag.NoOptDefVal != ""
-}
-
-func stripFlags(args []string, c *Command) []string {
- if len(args) == 0 {
- return args
- }
- c.mergePersistentFlags()
-
- commands := []string{}
- flags := c.Flags()
-
-Loop:
- for len(args) > 0 {
- s := args[0]
- args = args[1:]
- switch {
- case s == "--":
- // "--" terminates the flags
- break Loop
- case strings.HasPrefix(s, "--") && !strings.Contains(s, "=") && !hasNoOptDefVal(s[2:], flags):
- // If '--flag arg' then
- // delete arg from args.
- fallthrough // (do the same as below)
- case strings.HasPrefix(s, "-") && !strings.Contains(s, "=") && len(s) == 2 && !shortHasNoOptDefVal(s[1:], flags):
- // If '-f arg' then
- // delete 'arg' from args or break the loop if len(args) <= 1.
- if len(args) <= 1 {
- break Loop
- } else {
- args = args[1:]
- continue
- }
- case s != "" && !strings.HasPrefix(s, "-"):
- commands = append(commands, s)
- }
- }
-
- return commands
-}
-
-// argsMinusFirstX removes only the first x from args. Otherwise, commands that look like
-// openshift admin policy add-role-to-user admin my-user, lose the admin argument (arg[4]).
-func argsMinusFirstX(args []string, x string) []string {
- for i, y := range args {
- if x == y {
- ret := []string{}
- ret = append(ret, args[:i]...)
- ret = append(ret, args[i+1:]...)
- return ret
- }
- }
- return args
-}
-
-func isFlagArg(arg string) bool {
- return ((len(arg) >= 3 && arg[1] == '-') ||
- (len(arg) >= 2 && arg[0] == '-' && arg[1] != '-'))
-}
-
-// Find the target command given the args and command tree
-// Meant to be run on the highest node. Only searches down.
-func (c *Command) Find(args []string) (*Command, []string, error) {
- var innerfind func(*Command, []string) (*Command, []string)
-
- innerfind = func(c *Command, innerArgs []string) (*Command, []string) {
- argsWOflags := stripFlags(innerArgs, c)
- if len(argsWOflags) == 0 {
- return c, innerArgs
- }
- nextSubCmd := argsWOflags[0]
-
- cmd := c.findNext(nextSubCmd)
- if cmd != nil {
- return innerfind(cmd, argsMinusFirstX(innerArgs, nextSubCmd))
- }
- return c, innerArgs
- }
-
- commandFound, a := innerfind(c, args)
- if commandFound.Args == nil {
- return commandFound, a, legacyArgs(commandFound, stripFlags(a, commandFound))
- }
- return commandFound, a, nil
-}
-
-func (c *Command) findSuggestions(arg string) string {
- if c.DisableSuggestions {
- return ""
- }
- if c.SuggestionsMinimumDistance <= 0 {
- c.SuggestionsMinimumDistance = 2
- }
- suggestionsString := ""
- if suggestions := c.SuggestionsFor(arg); len(suggestions) > 0 {
- suggestionsString += "\n\nDid you mean this?\n"
- for _, s := range suggestions {
- suggestionsString += fmt.Sprintf("\t%v\n", s)
- }
- }
- return suggestionsString
-}
-
-func (c *Command) findNext(next string) *Command {
- matches := make([]*Command, 0)
- for _, cmd := range c.commands {
- if cmd.Name() == next || cmd.HasAlias(next) {
- cmd.commandCalledAs.name = next
- return cmd
- }
- if EnablePrefixMatching && cmd.hasNameOrAliasPrefix(next) {
- matches = append(matches, cmd)
- }
- }
-
- if len(matches) == 1 {
- return matches[0]
- }
-
- return nil
-}
-
-// Traverse the command tree to find the command, and parse args for
-// each parent.
-func (c *Command) Traverse(args []string) (*Command, []string, error) {
- flags := []string{}
- inFlag := false
-
- for i, arg := range args {
- switch {
- // A long flag with a space separated value
- case strings.HasPrefix(arg, "--") && !strings.Contains(arg, "="):
- // TODO: this isn't quite right, we should really check ahead for 'true' or 'false'
- inFlag = !hasNoOptDefVal(arg[2:], c.Flags())
- flags = append(flags, arg)
- continue
- // A short flag with a space separated value
- case strings.HasPrefix(arg, "-") && !strings.Contains(arg, "=") && len(arg) == 2 && !shortHasNoOptDefVal(arg[1:], c.Flags()):
- inFlag = true
- flags = append(flags, arg)
- continue
- // The value for a flag
- case inFlag:
- inFlag = false
- flags = append(flags, arg)
- continue
- // A flag without a value, or with an `=` separated value
- case isFlagArg(arg):
- flags = append(flags, arg)
- continue
- }
-
- cmd := c.findNext(arg)
- if cmd == nil {
- return c, args, nil
- }
-
- if err := c.ParseFlags(flags); err != nil {
- return nil, args, err
- }
- return cmd.Traverse(args[i+1:])
- }
- return c, args, nil
-}
-
-// SuggestionsFor provides suggestions for the typedName.
-func (c *Command) SuggestionsFor(typedName string) []string {
- suggestions := []string{}
- for _, cmd := range c.commands {
- if cmd.IsAvailableCommand() {
- levenshteinDistance := ld(typedName, cmd.Name(), true)
- suggestByLevenshtein := levenshteinDistance <= c.SuggestionsMinimumDistance
- suggestByPrefix := strings.HasPrefix(strings.ToLower(cmd.Name()), strings.ToLower(typedName))
- if suggestByLevenshtein || suggestByPrefix {
- suggestions = append(suggestions, cmd.Name())
- }
- for _, explicitSuggestion := range cmd.SuggestFor {
- if strings.EqualFold(typedName, explicitSuggestion) {
- suggestions = append(suggestions, cmd.Name())
- }
- }
- }
- }
- return suggestions
-}
-
-// VisitParents visits all parents of the command and invokes fn on each parent.
-func (c *Command) VisitParents(fn func(*Command)) {
- if c.HasParent() {
- fn(c.Parent())
- c.Parent().VisitParents(fn)
- }
-}
-
-// Root finds root command.
-func (c *Command) Root() *Command {
- if c.HasParent() {
- return c.Parent().Root()
- }
- return c
-}
-
-// ArgsLenAtDash will return the length of c.Flags().Args at the moment
-// when a -- was found during args parsing.
-func (c *Command) ArgsLenAtDash() int {
- return c.Flags().ArgsLenAtDash()
-}
-
-func (c *Command) execute(a []string) (err error) {
- if c == nil {
- return fmt.Errorf("Called Execute() on a nil Command")
- }
-
- if len(c.Deprecated) > 0 {
- c.Printf("Command %q is deprecated, %s\n", c.Name(), c.Deprecated)
- }
-
- // initialize help and version flag at the last point possible to allow for user
- // overriding
- c.InitDefaultHelpFlag()
- c.InitDefaultVersionFlag()
-
- err = c.ParseFlags(a)
- if err != nil {
- return c.FlagErrorFunc()(c, err)
- }
-
- // If help is called, regardless of other flags, return we want help.
- // Also say we need help if the command isn't runnable.
- helpVal, err := c.Flags().GetBool("help")
- if err != nil {
- // should be impossible to get here as we always declare a help
- // flag in InitDefaultHelpFlag()
- c.Println("\"help\" flag declared as non-bool. Please correct your code")
- return err
- }
-
- if helpVal {
- return flag.ErrHelp
- }
-
- // for back-compat, only add version flag behavior if version is defined
- if c.Version != "" {
- versionVal, err := c.Flags().GetBool("version")
- if err != nil {
- c.Println("\"version\" flag declared as non-bool. Please correct your code")
- return err
- }
- if versionVal {
- err := tmpl(c.OutOrStdout(), c.VersionTemplate(), c)
- if err != nil {
- c.Println(err)
- }
- return err
- }
- }
-
- if !c.Runnable() {
- return flag.ErrHelp
- }
-
- c.preRun()
-
- argWoFlags := c.Flags().Args()
- if c.DisableFlagParsing {
- argWoFlags = a
- }
-
- if err := c.ValidateArgs(argWoFlags); err != nil {
- return err
- }
-
- for p := c; p != nil; p = p.Parent() {
- if p.PersistentPreRunE != nil {
- if err := p.PersistentPreRunE(c, argWoFlags); err != nil {
- return err
- }
- break
- } else if p.PersistentPreRun != nil {
- p.PersistentPreRun(c, argWoFlags)
- break
- }
- }
- if c.PreRunE != nil {
- if err := c.PreRunE(c, argWoFlags); err != nil {
- return err
- }
- } else if c.PreRun != nil {
- c.PreRun(c, argWoFlags)
- }
-
- if err := c.validateRequiredFlags(); err != nil {
- return err
- }
- if c.RunE != nil {
- if err := c.RunE(c, argWoFlags); err != nil {
- return err
- }
- } else {
- c.Run(c, argWoFlags)
- }
- if c.PostRunE != nil {
- if err := c.PostRunE(c, argWoFlags); err != nil {
- return err
- }
- } else if c.PostRun != nil {
- c.PostRun(c, argWoFlags)
- }
- for p := c; p != nil; p = p.Parent() {
- if p.PersistentPostRunE != nil {
- if err := p.PersistentPostRunE(c, argWoFlags); err != nil {
- return err
- }
- break
- } else if p.PersistentPostRun != nil {
- p.PersistentPostRun(c, argWoFlags)
- break
- }
- }
-
- return nil
-}
-
-func (c *Command) preRun() {
- for _, x := range initializers {
- x()
- }
-}
-
-// Execute uses the args (os.Args[1:] by default)
-// and run through the command tree finding appropriate matches
-// for commands and then corresponding flags.
-func (c *Command) Execute() error {
- _, err := c.ExecuteC()
- return err
-}
-
-// ExecuteC executes the command.
-func (c *Command) ExecuteC() (cmd *Command, err error) {
- // Regardless of what command execute is called on, run on Root only
- if c.HasParent() {
- return c.Root().ExecuteC()
- }
-
- // windows hook
- if preExecHookFn != nil {
- preExecHookFn(c)
- }
-
- // initialize help as the last point possible to allow for user
- // overriding
- c.InitDefaultHelpCmd()
-
- args := c.args
-
- // Workaround FAIL with "go test -v" or "cobra.test -test.v", see #155
- if c.args == nil && filepath.Base(os.Args[0]) != "cobra.test" {
- args = os.Args[1:]
- }
-
- var flags []string
- if c.TraverseChildren {
- cmd, flags, err = c.Traverse(args)
- } else {
- cmd, flags, err = c.Find(args)
- }
- if err != nil {
- // If found parse to a subcommand and then failed, talk about the subcommand
- if cmd != nil {
- c = cmd
- }
- if !c.SilenceErrors {
- c.Println("Error:", err.Error())
- c.Printf("Run '%v --help' for usage.\n", c.CommandPath())
- }
- return c, err
- }
-
- cmd.commandCalledAs.called = true
- if cmd.commandCalledAs.name == "" {
- cmd.commandCalledAs.name = cmd.Name()
- }
-
- err = cmd.execute(flags)
- if err != nil {
- // Always show help if requested, even if SilenceErrors is in
- // effect
- if err == flag.ErrHelp {
- cmd.HelpFunc()(cmd, args)
- return cmd, nil
- }
-
- // If root command has SilentErrors flagged,
- // all subcommands should respect it
- if !cmd.SilenceErrors && !c.SilenceErrors {
- c.Println("Error:", err.Error())
- }
-
- // If root command has SilentUsage flagged,
- // all subcommands should respect it
- if !cmd.SilenceUsage && !c.SilenceUsage {
- c.Println(cmd.UsageString())
- }
- }
- return cmd, err
-}
-
-func (c *Command) ValidateArgs(args []string) error {
- if c.Args == nil {
- return nil
- }
- return c.Args(c, args)
-}
-
-func (c *Command) validateRequiredFlags() error {
- flags := c.Flags()
- missingFlagNames := []string{}
- flags.VisitAll(func(pflag *flag.Flag) {
- requiredAnnotation, found := pflag.Annotations[BashCompOneRequiredFlag]
- if !found {
- return
- }
- if (requiredAnnotation[0] == "true") && !pflag.Changed {
- missingFlagNames = append(missingFlagNames, pflag.Name)
- }
- })
-
- if len(missingFlagNames) > 0 {
- return fmt.Errorf(`required flag(s) "%s" not set`, strings.Join(missingFlagNames, `", "`))
- }
- return nil
-}
-
-// InitDefaultHelpFlag adds default help flag to c.
-// It is called automatically by executing the c or by calling help and usage.
-// If c already has help flag, it will do nothing.
-func (c *Command) InitDefaultHelpFlag() {
- c.mergePersistentFlags()
- if c.Flags().Lookup("help") == nil {
- usage := "help for "
- if c.Name() == "" {
- usage += "this command"
- } else {
- usage += c.Name()
- }
- c.Flags().BoolP("help", "h", false, usage)
- }
-}
-
-// InitDefaultVersionFlag adds default version flag to c.
-// It is called automatically by executing the c.
-// If c already has a version flag, it will do nothing.
-// If c.Version is empty, it will do nothing.
-func (c *Command) InitDefaultVersionFlag() {
- if c.Version == "" {
- return
- }
-
- c.mergePersistentFlags()
- if c.Flags().Lookup("version") == nil {
- usage := "version for "
- if c.Name() == "" {
- usage += "this command"
- } else {
- usage += c.Name()
- }
- c.Flags().Bool("version", false, usage)
- }
-}
-
-// InitDefaultHelpCmd adds default help command to c.
-// It is called automatically by executing the c or by calling help and usage.
-// If c already has help command or c has no subcommands, it will do nothing.
-func (c *Command) InitDefaultHelpCmd() {
- if !c.HasSubCommands() {
- return
- }
-
- if c.helpCommand == nil {
- c.helpCommand = &Command{
- Use: "help [command]",
- Short: "Help about any command",
- Long: `Help provides help for any command in the application.
-Simply type ` + c.Name() + ` help [path to command] for full details.`,
-
- Run: func(c *Command, args []string) {
- cmd, _, e := c.Root().Find(args)
- if cmd == nil || e != nil {
- c.Printf("Unknown help topic %#q\n", args)
- c.Root().Usage()
- } else {
- cmd.InitDefaultHelpFlag() // make possible 'help' flag to be shown
- cmd.Help()
- }
- },
- }
- }
- c.RemoveCommand(c.helpCommand)
- c.AddCommand(c.helpCommand)
-}
-
-// ResetCommands delete parent, subcommand and help command from c.
-func (c *Command) ResetCommands() {
- c.parent = nil
- c.commands = nil
- c.helpCommand = nil
- c.parentsPflags = nil
-}
-
-// Sorts commands by their names.
-type commandSorterByName []*Command
-
-func (c commandSorterByName) Len() int { return len(c) }
-func (c commandSorterByName) Swap(i, j int) { c[i], c[j] = c[j], c[i] }
-func (c commandSorterByName) Less(i, j int) bool { return c[i].Name() < c[j].Name() }
-
-// Commands returns a sorted slice of child commands.
-func (c *Command) Commands() []*Command {
- // do not sort commands if it already sorted or sorting was disabled
- if EnableCommandSorting && !c.commandsAreSorted {
- sort.Sort(commandSorterByName(c.commands))
- c.commandsAreSorted = true
- }
- return c.commands
-}
-
-// AddCommand adds one or more commands to this parent command.
-func (c *Command) AddCommand(cmds ...*Command) {
- for i, x := range cmds {
- if cmds[i] == c {
- panic("Command can't be a child of itself")
- }
- cmds[i].parent = c
- // update max lengths
- usageLen := len(x.Use)
- if usageLen > c.commandsMaxUseLen {
- c.commandsMaxUseLen = usageLen
- }
- commandPathLen := len(x.CommandPath())
- if commandPathLen > c.commandsMaxCommandPathLen {
- c.commandsMaxCommandPathLen = commandPathLen
- }
- nameLen := len(x.Name())
- if nameLen > c.commandsMaxNameLen {
- c.commandsMaxNameLen = nameLen
- }
- // If global normalization function exists, update all children
- if c.globNormFunc != nil {
- x.SetGlobalNormalizationFunc(c.globNormFunc)
- }
- c.commands = append(c.commands, x)
- c.commandsAreSorted = false
- }
-}
-
-// RemoveCommand removes one or more commands from a parent command.
-func (c *Command) RemoveCommand(cmds ...*Command) {
- commands := []*Command{}
-main:
- for _, command := range c.commands {
- for _, cmd := range cmds {
- if command == cmd {
- command.parent = nil
- continue main
- }
- }
- commands = append(commands, command)
- }
- c.commands = commands
- // recompute all lengths
- c.commandsMaxUseLen = 0
- c.commandsMaxCommandPathLen = 0
- c.commandsMaxNameLen = 0
- for _, command := range c.commands {
- usageLen := len(command.Use)
- if usageLen > c.commandsMaxUseLen {
- c.commandsMaxUseLen = usageLen
- }
- commandPathLen := len(command.CommandPath())
- if commandPathLen > c.commandsMaxCommandPathLen {
- c.commandsMaxCommandPathLen = commandPathLen
- }
- nameLen := len(command.Name())
- if nameLen > c.commandsMaxNameLen {
- c.commandsMaxNameLen = nameLen
- }
- }
-}
-
-// Print is a convenience method to Print to the defined output, fallback to Stderr if not set.
-func (c *Command) Print(i ...interface{}) {
- fmt.Fprint(c.OutOrStderr(), i...)
-}
-
-// Println is a convenience method to Println to the defined output, fallback to Stderr if not set.
-func (c *Command) Println(i ...interface{}) {
- c.Print(fmt.Sprintln(i...))
-}
-
-// Printf is a convenience method to Printf to the defined output, fallback to Stderr if not set.
-func (c *Command) Printf(format string, i ...interface{}) {
- c.Print(fmt.Sprintf(format, i...))
-}
-
-// PrintErr is a convenience method to Print to the defined Err output, fallback to Stderr if not set.
-func (c *Command) PrintErr(i ...interface{}) {
- fmt.Fprint(c.ErrOrStderr(), i...)
-}
-
-// PrintErrln is a convenience method to Println to the defined Err output, fallback to Stderr if not set.
-func (c *Command) PrintErrln(i ...interface{}) {
- c.Print(fmt.Sprintln(i...))
-}
-
-// PrintErrf is a convenience method to Printf to the defined Err output, fallback to Stderr if not set.
-func (c *Command) PrintErrf(format string, i ...interface{}) {
- c.Print(fmt.Sprintf(format, i...))
-}
-
-// CommandPath returns the full path to this command.
-func (c *Command) CommandPath() string {
- if c.HasParent() {
- return c.Parent().CommandPath() + " " + c.Name()
- }
- return c.Name()
-}
-
-// UseLine puts out the full usage for a given command (including parents).
-func (c *Command) UseLine() string {
- var useline string
- if c.HasParent() {
- useline = c.parent.CommandPath() + " " + c.Use
- } else {
- useline = c.Use
- }
- if c.DisableFlagsInUseLine {
- return useline
- }
- if c.HasAvailableFlags() && !strings.Contains(useline, "[flags]") {
- useline += " [flags]"
- }
- return useline
-}
-
-// DebugFlags used to determine which flags have been assigned to which commands
-// and which persist.
-func (c *Command) DebugFlags() {
- c.Println("DebugFlags called on", c.Name())
- var debugflags func(*Command)
-
- debugflags = func(x *Command) {
- if x.HasFlags() || x.HasPersistentFlags() {
- c.Println(x.Name())
- }
- if x.HasFlags() {
- x.flags.VisitAll(func(f *flag.Flag) {
- if x.HasPersistentFlags() && x.persistentFlag(f.Name) != nil {
- c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [LP]")
- } else {
- c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [L]")
- }
- })
- }
- if x.HasPersistentFlags() {
- x.pflags.VisitAll(func(f *flag.Flag) {
- if x.HasFlags() {
- if x.flags.Lookup(f.Name) == nil {
- c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [P]")
- }
- } else {
- c.Println(" -"+f.Shorthand+",", "--"+f.Name, "["+f.DefValue+"]", "", f.Value, " [P]")
- }
- })
- }
- c.Println(x.flagErrorBuf)
- if x.HasSubCommands() {
- for _, y := range x.commands {
- debugflags(y)
- }
- }
- }
-
- debugflags(c)
-}
-
-// Name returns the command's name: the first word in the use line.
-func (c *Command) Name() string {
- name := c.Use
- i := strings.Index(name, " ")
- if i >= 0 {
- name = name[:i]
- }
- return name
-}
-
-// HasAlias determines if a given string is an alias of the command.
-func (c *Command) HasAlias(s string) bool {
- for _, a := range c.Aliases {
- if a == s {
- return true
- }
- }
- return false
-}
-
-// CalledAs returns the command name or alias that was used to invoke
-// this command or an empty string if the command has not been called.
-func (c *Command) CalledAs() string {
- if c.commandCalledAs.called {
- return c.commandCalledAs.name
- }
- return ""
-}
-
-// hasNameOrAliasPrefix returns true if the Name or any of aliases start
-// with prefix
-func (c *Command) hasNameOrAliasPrefix(prefix string) bool {
- if strings.HasPrefix(c.Name(), prefix) {
- c.commandCalledAs.name = c.Name()
- return true
- }
- for _, alias := range c.Aliases {
- if strings.HasPrefix(alias, prefix) {
- c.commandCalledAs.name = alias
- return true
- }
- }
- return false
-}
-
-// NameAndAliases returns a list of the command name and all aliases
-func (c *Command) NameAndAliases() string {
- return strings.Join(append([]string{c.Name()}, c.Aliases...), ", ")
-}
-
-// HasExample determines if the command has example.
-func (c *Command) HasExample() bool {
- return len(c.Example) > 0
-}
-
-// Runnable determines if the command is itself runnable.
-func (c *Command) Runnable() bool {
- return c.Run != nil || c.RunE != nil
-}
-
-// HasSubCommands determines if the command has children commands.
-func (c *Command) HasSubCommands() bool {
- return len(c.commands) > 0
-}
-
-// IsAvailableCommand determines if a command is available as a non-help command
-// (this includes all non deprecated/hidden commands).
-func (c *Command) IsAvailableCommand() bool {
- if len(c.Deprecated) != 0 || c.Hidden {
- return false
- }
-
- if c.HasParent() && c.Parent().helpCommand == c {
- return false
- }
-
- if c.Runnable() || c.HasAvailableSubCommands() {
- return true
- }
-
- return false
-}
-
-// IsAdditionalHelpTopicCommand determines if a command is an additional
-// help topic command; additional help topic command is determined by the
-// fact that it is NOT runnable/hidden/deprecated, and has no sub commands that
-// are runnable/hidden/deprecated.
-// Concrete example: https://github.com/spf13/cobra/issues/393#issuecomment-282741924.
-func (c *Command) IsAdditionalHelpTopicCommand() bool {
- // if a command is runnable, deprecated, or hidden it is not a 'help' command
- if c.Runnable() || len(c.Deprecated) != 0 || c.Hidden {
- return false
- }
-
- // if any non-help sub commands are found, the command is not a 'help' command
- for _, sub := range c.commands {
- if !sub.IsAdditionalHelpTopicCommand() {
- return false
- }
- }
-
- // the command either has no sub commands, or no non-help sub commands
- return true
-}
-
-// HasHelpSubCommands determines if a command has any available 'help' sub commands
-// that need to be shown in the usage/help default template under 'additional help
-// topics'.
-func (c *Command) HasHelpSubCommands() bool {
- // return true on the first found available 'help' sub command
- for _, sub := range c.commands {
- if sub.IsAdditionalHelpTopicCommand() {
- return true
- }
- }
-
- // the command either has no sub commands, or no available 'help' sub commands
- return false
-}
-
-// HasAvailableSubCommands determines if a command has available sub commands that
-// need to be shown in the usage/help default template under 'available commands'.
-func (c *Command) HasAvailableSubCommands() bool {
- // return true on the first found available (non deprecated/help/hidden)
- // sub command
- for _, sub := range c.commands {
- if sub.IsAvailableCommand() {
- return true
- }
- }
-
- // the command either has no sub commands, or no available (non deprecated/help/hidden)
- // sub commands
- return false
-}
-
-// HasParent determines if the command is a child command.
-func (c *Command) HasParent() bool {
- return c.parent != nil
-}
-
-// GlobalNormalizationFunc returns the global normalization function or nil if it doesn't exist.
-func (c *Command) GlobalNormalizationFunc() func(f *flag.FlagSet, name string) flag.NormalizedName {
- return c.globNormFunc
-}
-
-// Flags returns the complete FlagSet that applies
-// to this command (local and persistent declared here and by all parents).
-func (c *Command) Flags() *flag.FlagSet {
- if c.flags == nil {
- c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- if c.flagErrorBuf == nil {
- c.flagErrorBuf = new(bytes.Buffer)
- }
- c.flags.SetOutput(c.flagErrorBuf)
- }
-
- return c.flags
-}
-
-// LocalNonPersistentFlags are flags specific to this command which will NOT persist to subcommands.
-func (c *Command) LocalNonPersistentFlags() *flag.FlagSet {
- persistentFlags := c.PersistentFlags()
-
- out := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- c.LocalFlags().VisitAll(func(f *flag.Flag) {
- if persistentFlags.Lookup(f.Name) == nil {
- out.AddFlag(f)
- }
- })
- return out
-}
-
-// LocalFlags returns the local FlagSet specifically set in the current command.
-func (c *Command) LocalFlags() *flag.FlagSet {
- c.mergePersistentFlags()
-
- if c.lflags == nil {
- c.lflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- if c.flagErrorBuf == nil {
- c.flagErrorBuf = new(bytes.Buffer)
- }
- c.lflags.SetOutput(c.flagErrorBuf)
- }
- c.lflags.SortFlags = c.Flags().SortFlags
- if c.globNormFunc != nil {
- c.lflags.SetNormalizeFunc(c.globNormFunc)
- }
-
- addToLocal := func(f *flag.Flag) {
- if c.lflags.Lookup(f.Name) == nil && c.parentsPflags.Lookup(f.Name) == nil {
- c.lflags.AddFlag(f)
- }
- }
- c.Flags().VisitAll(addToLocal)
- c.PersistentFlags().VisitAll(addToLocal)
- return c.lflags
-}
-
-// InheritedFlags returns all flags which were inherited from parent commands.
-func (c *Command) InheritedFlags() *flag.FlagSet {
- c.mergePersistentFlags()
-
- if c.iflags == nil {
- c.iflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- if c.flagErrorBuf == nil {
- c.flagErrorBuf = new(bytes.Buffer)
- }
- c.iflags.SetOutput(c.flagErrorBuf)
- }
-
- local := c.LocalFlags()
- if c.globNormFunc != nil {
- c.iflags.SetNormalizeFunc(c.globNormFunc)
- }
-
- c.parentsPflags.VisitAll(func(f *flag.Flag) {
- if c.iflags.Lookup(f.Name) == nil && local.Lookup(f.Name) == nil {
- c.iflags.AddFlag(f)
- }
- })
- return c.iflags
-}
-
-// NonInheritedFlags returns all flags which were not inherited from parent commands.
-func (c *Command) NonInheritedFlags() *flag.FlagSet {
- return c.LocalFlags()
-}
-
-// PersistentFlags returns the persistent FlagSet specifically set in the current command.
-func (c *Command) PersistentFlags() *flag.FlagSet {
- if c.pflags == nil {
- c.pflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- if c.flagErrorBuf == nil {
- c.flagErrorBuf = new(bytes.Buffer)
- }
- c.pflags.SetOutput(c.flagErrorBuf)
- }
- return c.pflags
-}
-
-// ResetFlags deletes all flags from command.
-func (c *Command) ResetFlags() {
- c.flagErrorBuf = new(bytes.Buffer)
- c.flagErrorBuf.Reset()
- c.flags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- c.flags.SetOutput(c.flagErrorBuf)
- c.pflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- c.pflags.SetOutput(c.flagErrorBuf)
-
- c.lflags = nil
- c.iflags = nil
- c.parentsPflags = nil
-}
-
-// HasFlags checks if the command contains any flags (local plus persistent from the entire structure).
-func (c *Command) HasFlags() bool {
- return c.Flags().HasFlags()
-}
-
-// HasPersistentFlags checks if the command contains persistent flags.
-func (c *Command) HasPersistentFlags() bool {
- return c.PersistentFlags().HasFlags()
-}
-
-// HasLocalFlags checks if the command has flags specifically declared locally.
-func (c *Command) HasLocalFlags() bool {
- return c.LocalFlags().HasFlags()
-}
-
-// HasInheritedFlags checks if the command has flags inherited from its parent command.
-func (c *Command) HasInheritedFlags() bool {
- return c.InheritedFlags().HasFlags()
-}
-
-// HasAvailableFlags checks if the command contains any flags (local plus persistent from the entire
-// structure) which are not hidden or deprecated.
-func (c *Command) HasAvailableFlags() bool {
- return c.Flags().HasAvailableFlags()
-}
-
-// HasAvailablePersistentFlags checks if the command contains persistent flags which are not hidden or deprecated.
-func (c *Command) HasAvailablePersistentFlags() bool {
- return c.PersistentFlags().HasAvailableFlags()
-}
-
-// HasAvailableLocalFlags checks if the command has flags specifically declared locally which are not hidden
-// or deprecated.
-func (c *Command) HasAvailableLocalFlags() bool {
- return c.LocalFlags().HasAvailableFlags()
-}
-
-// HasAvailableInheritedFlags checks if the command has flags inherited from its parent command which are
-// not hidden or deprecated.
-func (c *Command) HasAvailableInheritedFlags() bool {
- return c.InheritedFlags().HasAvailableFlags()
-}
-
-// Flag climbs up the command tree looking for matching flag.
-func (c *Command) Flag(name string) (flag *flag.Flag) {
- flag = c.Flags().Lookup(name)
-
- if flag == nil {
- flag = c.persistentFlag(name)
- }
-
- return
-}
-
-// Recursively find matching persistent flag.
-func (c *Command) persistentFlag(name string) (flag *flag.Flag) {
- if c.HasPersistentFlags() {
- flag = c.PersistentFlags().Lookup(name)
- }
-
- if flag == nil {
- c.updateParentsPflags()
- flag = c.parentsPflags.Lookup(name)
- }
- return
-}
-
-// ParseFlags parses persistent flag tree and local flags.
-func (c *Command) ParseFlags(args []string) error {
- if c.DisableFlagParsing {
- return nil
- }
-
- if c.flagErrorBuf == nil {
- c.flagErrorBuf = new(bytes.Buffer)
- }
- beforeErrorBufLen := c.flagErrorBuf.Len()
- c.mergePersistentFlags()
-
- //do it here after merging all flags and just before parse
- c.Flags().ParseErrorsWhitelist = flag.ParseErrorsWhitelist(c.FParseErrWhitelist)
-
- err := c.Flags().Parse(args)
- // Print warnings if they occurred (e.g. deprecated flag messages).
- if c.flagErrorBuf.Len()-beforeErrorBufLen > 0 && err == nil {
- c.Print(c.flagErrorBuf.String())
- }
-
- return err
-}
-
-// Parent returns a commands parent command.
-func (c *Command) Parent() *Command {
- return c.parent
-}
-
-// mergePersistentFlags merges c.PersistentFlags() to c.Flags()
-// and adds missing persistent flags of all parents.
-func (c *Command) mergePersistentFlags() {
- c.updateParentsPflags()
- c.Flags().AddFlagSet(c.PersistentFlags())
- c.Flags().AddFlagSet(c.parentsPflags)
-}
-
-// updateParentsPflags updates c.parentsPflags by adding
-// new persistent flags of all parents.
-// If c.parentsPflags == nil, it makes new.
-func (c *Command) updateParentsPflags() {
- if c.parentsPflags == nil {
- c.parentsPflags = flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- c.parentsPflags.SetOutput(c.flagErrorBuf)
- c.parentsPflags.SortFlags = false
- }
-
- if c.globNormFunc != nil {
- c.parentsPflags.SetNormalizeFunc(c.globNormFunc)
- }
-
- c.Root().PersistentFlags().AddFlagSet(flag.CommandLine)
-
- c.VisitParents(func(parent *Command) {
- c.parentsPflags.AddFlagSet(parent.PersistentFlags())
- })
-}
diff --git a/vendor/github.com/spf13/cobra/command_notwin.go b/vendor/github.com/spf13/cobra/command_notwin.go
deleted file mode 100644
index 6159c1cc..00000000
--- a/vendor/github.com/spf13/cobra/command_notwin.go
+++ /dev/null
@@ -1,5 +0,0 @@
-// +build !windows
-
-package cobra
-
-var preExecHookFn func(*Command)
diff --git a/vendor/github.com/spf13/cobra/command_win.go b/vendor/github.com/spf13/cobra/command_win.go
deleted file mode 100644
index 8768b173..00000000
--- a/vendor/github.com/spf13/cobra/command_win.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// +build windows
-
-package cobra
-
-import (
- "fmt"
- "os"
- "time"
-
- "github.com/inconshreveable/mousetrap"
-)
-
-var preExecHookFn = preExecHook
-
-func preExecHook(c *Command) {
- if MousetrapHelpText != "" && mousetrap.StartedByExplorer() {
- c.Print(MousetrapHelpText)
- if MousetrapDisplayDuration > 0 {
- time.Sleep(MousetrapDisplayDuration)
- } else {
- c.Println("Press return to continue...")
- fmt.Scanln()
- }
- os.Exit(1)
- }
-}
diff --git a/vendor/github.com/spf13/cobra/doc/man_docs.go b/vendor/github.com/spf13/cobra/doc/man_docs.go
deleted file mode 100644
index 4a062339..00000000
--- a/vendor/github.com/spf13/cobra/doc/man_docs.go
+++ /dev/null
@@ -1,247 +0,0 @@
-// Copyright 2015 Red Hat Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package doc
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
- "path/filepath"
- "sort"
- "strconv"
- "strings"
- "time"
-
- "github.com/cpuguy83/go-md2man/md2man"
- "github.com/spf13/cobra"
- "github.com/spf13/pflag"
-)
-
-// GenManTree will generate a man page for this command and all descendants
-// in the directory given. The header may be nil. This function may not work
-// correctly if your command names have `-` in them. If you have `cmd` with two
-// subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third`
-// it is undefined which help output will be in the file `cmd-sub-third.1`.
-func GenManTree(cmd *cobra.Command, header *GenManHeader, dir string) error {
- return GenManTreeFromOpts(cmd, GenManTreeOptions{
- Header: header,
- Path: dir,
- CommandSeparator: "-",
- })
-}
-
-// GenManTreeFromOpts generates a man page for the command and all descendants.
-// The pages are written to the opts.Path directory.
-func GenManTreeFromOpts(cmd *cobra.Command, opts GenManTreeOptions) error {
- header := opts.Header
- if header == nil {
- header = &GenManHeader{}
- }
- for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
- continue
- }
- if err := GenManTreeFromOpts(c, opts); err != nil {
- return err
- }
- }
- section := "1"
- if header.Section != "" {
- section = header.Section
- }
-
- separator := "_"
- if opts.CommandSeparator != "" {
- separator = opts.CommandSeparator
- }
- basename := strings.Replace(cmd.CommandPath(), " ", separator, -1)
- filename := filepath.Join(opts.Path, basename+"."+section)
- f, err := os.Create(filename)
- if err != nil {
- return err
- }
- defer f.Close()
-
- headerCopy := *header
- return GenMan(cmd, &headerCopy, f)
-}
-
-// GenManTreeOptions is the options for generating the man pages.
-// Used only in GenManTreeFromOpts.
-type GenManTreeOptions struct {
- Header *GenManHeader
- Path string
- CommandSeparator string
-}
-
-// GenManHeader is a lot like the .TH header at the start of man pages. These
-// include the title, section, date, source, and manual. We will use the
-// current time if Date is unset and will use "Auto generated by spf13/cobra"
-// if the Source is unset.
-type GenManHeader struct {
- Title string
- Section string
- Date *time.Time
- date string
- Source string
- Manual string
-}
-
-// GenMan will generate a man page for the given command and write it to
-// w. The header argument may be nil, however obviously w may not.
-func GenMan(cmd *cobra.Command, header *GenManHeader, w io.Writer) error {
- if header == nil {
- header = &GenManHeader{}
- }
- if err := fillHeader(header, cmd.CommandPath()); err != nil {
- return err
- }
-
- b := genMan(cmd, header)
- _, err := w.Write(md2man.Render(b))
- return err
-}
-
-func fillHeader(header *GenManHeader, name string) error {
- if header.Title == "" {
- header.Title = strings.ToUpper(strings.Replace(name, " ", "\\-", -1))
- }
- if header.Section == "" {
- header.Section = "1"
- }
- if header.Date == nil {
- now := time.Now()
- if epoch := os.Getenv("SOURCE_DATE_EPOCH"); epoch != "" {
- unixEpoch, err := strconv.ParseInt(epoch, 10, 64)
- if err != nil {
- return fmt.Errorf("invalid SOURCE_DATE_EPOCH: %v", err)
- }
- now = time.Unix(unixEpoch, 0)
- }
- header.Date = &now
- }
- header.date = (*header.Date).Format("Jan 2006")
- if header.Source == "" {
- header.Source = "Auto generated by spf13/cobra"
- }
- return nil
-}
-
-func manPreamble(buf *bytes.Buffer, header *GenManHeader, cmd *cobra.Command, dashedName string) {
- description := cmd.Long
- if len(description) == 0 {
- description = cmd.Short
- }
-
- buf.WriteString(fmt.Sprintf(`%% %s(%s)%s
-%% %s
-%% %s
-# NAME
-`, header.Title, header.Section, header.date, header.Source, header.Manual))
- buf.WriteString(fmt.Sprintf("%s \\- %s\n\n", dashedName, cmd.Short))
- buf.WriteString("# SYNOPSIS\n")
- buf.WriteString(fmt.Sprintf("**%s**\n\n", cmd.UseLine()))
- buf.WriteString("# DESCRIPTION\n")
- buf.WriteString(description + "\n\n")
-}
-
-func manPrintFlags(buf *bytes.Buffer, flags *pflag.FlagSet) {
- flags.VisitAll(func(flag *pflag.Flag) {
- if len(flag.Deprecated) > 0 || flag.Hidden {
- return
- }
- format := ""
- if len(flag.Shorthand) > 0 && len(flag.ShorthandDeprecated) == 0 {
- format = fmt.Sprintf("**-%s**, **--%s**", flag.Shorthand, flag.Name)
- } else {
- format = fmt.Sprintf("**--%s**", flag.Name)
- }
- if len(flag.NoOptDefVal) > 0 {
- format += "["
- }
- if flag.Value.Type() == "string" {
- // put quotes on the value
- format += "=%q"
- } else {
- format += "=%s"
- }
- if len(flag.NoOptDefVal) > 0 {
- format += "]"
- }
- format += "\n\t%s\n\n"
- buf.WriteString(fmt.Sprintf(format, flag.DefValue, flag.Usage))
- })
-}
-
-func manPrintOptions(buf *bytes.Buffer, command *cobra.Command) {
- flags := command.NonInheritedFlags()
- if flags.HasAvailableFlags() {
- buf.WriteString("# OPTIONS\n")
- manPrintFlags(buf, flags)
- buf.WriteString("\n")
- }
- flags = command.InheritedFlags()
- if flags.HasAvailableFlags() {
- buf.WriteString("# OPTIONS INHERITED FROM PARENT COMMANDS\n")
- manPrintFlags(buf, flags)
- buf.WriteString("\n")
- }
-}
-
-func genMan(cmd *cobra.Command, header *GenManHeader) []byte {
- cmd.InitDefaultHelpCmd()
- cmd.InitDefaultHelpFlag()
-
- // something like `rootcmd-subcmd1-subcmd2`
- dashCommandName := strings.Replace(cmd.CommandPath(), " ", "-", -1)
-
- buf := new(bytes.Buffer)
-
- manPreamble(buf, header, cmd, dashCommandName)
- manPrintOptions(buf, cmd)
- if len(cmd.Example) > 0 {
- buf.WriteString("# EXAMPLE\n")
- buf.WriteString(fmt.Sprintf("```\n%s\n```\n", cmd.Example))
- }
- if hasSeeAlso(cmd) {
- buf.WriteString("# SEE ALSO\n")
- seealsos := make([]string, 0)
- if cmd.HasParent() {
- parentPath := cmd.Parent().CommandPath()
- dashParentPath := strings.Replace(parentPath, " ", "-", -1)
- seealso := fmt.Sprintf("**%s(%s)**", dashParentPath, header.Section)
- seealsos = append(seealsos, seealso)
- cmd.VisitParents(func(c *cobra.Command) {
- if c.DisableAutoGenTag {
- cmd.DisableAutoGenTag = c.DisableAutoGenTag
- }
- })
- }
- children := cmd.Commands()
- sort.Sort(byName(children))
- for _, c := range children {
- if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
- continue
- }
- seealso := fmt.Sprintf("**%s-%s(%s)**", dashCommandName, c.Name(), header.Section)
- seealsos = append(seealsos, seealso)
- }
- buf.WriteString(strings.Join(seealsos, ", ") + "\n")
- }
- if !cmd.DisableAutoGenTag {
- buf.WriteString(fmt.Sprintf("# HISTORY\n%s Auto generated by spf13/cobra\n", header.Date.Format("2-Jan-2006")))
- }
- return buf.Bytes()
-}
diff --git a/vendor/github.com/spf13/cobra/doc/man_docs.md b/vendor/github.com/spf13/cobra/doc/man_docs.md
deleted file mode 100644
index 3709160f..00000000
--- a/vendor/github.com/spf13/cobra/doc/man_docs.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# Generating Man Pages For Your Own cobra.Command
-
-Generating man pages from a cobra command is incredibly easy. An example is as follows:
-
-```go
-package main
-
-import (
- "log"
-
- "github.com/spf13/cobra"
- "github.com/spf13/cobra/doc"
-)
-
-func main() {
- cmd := &cobra.Command{
- Use: "test",
- Short: "my test program",
- }
- header := &doc.GenManHeader{
- Title: "MINE",
- Section: "3",
- }
- err := doc.GenManTree(cmd, header, "/tmp")
- if err != nil {
- log.Fatal(err)
- }
-}
-```
-
-That will get you a man page `/tmp/test.3`
diff --git a/vendor/github.com/spf13/cobra/doc/md_docs.go b/vendor/github.com/spf13/cobra/doc/md_docs.go
deleted file mode 100644
index d76f6d5e..00000000
--- a/vendor/github.com/spf13/cobra/doc/md_docs.go
+++ /dev/null
@@ -1,159 +0,0 @@
-//Copyright 2015 Red Hat Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package doc
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
- "path/filepath"
- "sort"
- "strings"
- "time"
-
- "github.com/spf13/cobra"
-)
-
-func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
- flags := cmd.NonInheritedFlags()
- flags.SetOutput(buf)
- if flags.HasAvailableFlags() {
- buf.WriteString("### Options\n\n```\n")
- flags.PrintDefaults()
- buf.WriteString("```\n\n")
- }
-
- parentFlags := cmd.InheritedFlags()
- parentFlags.SetOutput(buf)
- if parentFlags.HasAvailableFlags() {
- buf.WriteString("### Options inherited from parent commands\n\n```\n")
- parentFlags.PrintDefaults()
- buf.WriteString("```\n\n")
- }
- return nil
-}
-
-// GenMarkdown creates markdown output.
-func GenMarkdown(cmd *cobra.Command, w io.Writer) error {
- return GenMarkdownCustom(cmd, w, func(s string) string { return s })
-}
-
-// GenMarkdownCustom creates custom markdown output.
-func GenMarkdownCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error {
- cmd.InitDefaultHelpCmd()
- cmd.InitDefaultHelpFlag()
-
- buf := new(bytes.Buffer)
- name := cmd.CommandPath()
-
- short := cmd.Short
- long := cmd.Long
- if len(long) == 0 {
- long = short
- }
-
- buf.WriteString("## " + name + "\n\n")
- buf.WriteString(short + "\n\n")
- buf.WriteString("### Synopsis\n\n")
- buf.WriteString(long + "\n\n")
-
- if cmd.Runnable() {
- buf.WriteString(fmt.Sprintf("```\n%s\n```\n\n", cmd.UseLine()))
- }
-
- if len(cmd.Example) > 0 {
- buf.WriteString("### Examples\n\n")
- buf.WriteString(fmt.Sprintf("```\n%s\n```\n\n", cmd.Example))
- }
-
- if err := printOptions(buf, cmd, name); err != nil {
- return err
- }
- if hasSeeAlso(cmd) {
- buf.WriteString("### SEE ALSO\n\n")
- if cmd.HasParent() {
- parent := cmd.Parent()
- pname := parent.CommandPath()
- link := pname + ".md"
- link = strings.Replace(link, " ", "_", -1)
- buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", pname, linkHandler(link), parent.Short))
- cmd.VisitParents(func(c *cobra.Command) {
- if c.DisableAutoGenTag {
- cmd.DisableAutoGenTag = c.DisableAutoGenTag
- }
- })
- }
-
- children := cmd.Commands()
- sort.Sort(byName(children))
-
- for _, child := range children {
- if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() {
- continue
- }
- cname := name + " " + child.Name()
- link := cname + ".md"
- link = strings.Replace(link, " ", "_", -1)
- buf.WriteString(fmt.Sprintf("* [%s](%s)\t - %s\n", cname, linkHandler(link), child.Short))
- }
- buf.WriteString("\n")
- }
- if !cmd.DisableAutoGenTag {
- buf.WriteString("###### Auto generated by spf13/cobra on " + time.Now().Format("2-Jan-2006") + "\n")
- }
- _, err := buf.WriteTo(w)
- return err
-}
-
-// GenMarkdownTree will generate a markdown page for this command and all
-// descendants in the directory given. The header may be nil.
-// This function may not work correctly if your command names have `-` in them.
-// If you have `cmd` with two subcmds, `sub` and `sub-third`,
-// and `sub` has a subcommand called `third`, it is undefined which
-// help output will be in the file `cmd-sub-third.1`.
-func GenMarkdownTree(cmd *cobra.Command, dir string) error {
- identity := func(s string) string { return s }
- emptyStr := func(s string) string { return "" }
- return GenMarkdownTreeCustom(cmd, dir, emptyStr, identity)
-}
-
-// GenMarkdownTreeCustom is the the same as GenMarkdownTree, but
-// with custom filePrepender and linkHandler.
-func GenMarkdownTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHandler func(string) string) error {
- for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
- continue
- }
- if err := GenMarkdownTreeCustom(c, dir, filePrepender, linkHandler); err != nil {
- return err
- }
- }
-
- basename := strings.Replace(cmd.CommandPath(), " ", "_", -1) + ".md"
- filename := filepath.Join(dir, basename)
- f, err := os.Create(filename)
- if err != nil {
- return err
- }
- defer f.Close()
-
- if _, err := io.WriteString(f, filePrepender(filename)); err != nil {
- return err
- }
- if err := GenMarkdownCustom(cmd, f, linkHandler); err != nil {
- return err
- }
- return nil
-}
diff --git a/vendor/github.com/spf13/cobra/doc/md_docs.md b/vendor/github.com/spf13/cobra/doc/md_docs.md
deleted file mode 100644
index 56ce9fe8..00000000
--- a/vendor/github.com/spf13/cobra/doc/md_docs.md
+++ /dev/null
@@ -1,115 +0,0 @@
-# Generating Markdown Docs For Your Own cobra.Command
-
-Generating man pages from a cobra command is incredibly easy. An example is as follows:
-
-```go
-package main
-
-import (
- "log"
-
- "github.com/spf13/cobra"
- "github.com/spf13/cobra/doc"
-)
-
-func main() {
- cmd := &cobra.Command{
- Use: "test",
- Short: "my test program",
- }
- err := doc.GenMarkdownTree(cmd, "/tmp")
- if err != nil {
- log.Fatal(err)
- }
-}
-```
-
-That will get you a Markdown document `/tmp/test.md`
-
-## Generate markdown docs for the entire command tree
-
-This program can actually generate docs for the kubectl command in the kubernetes project
-
-```go
-package main
-
-import (
- "log"
- "io/ioutil"
- "os"
-
- "k8s.io/kubernetes/pkg/kubectl/cmd"
- cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
-
- "github.com/spf13/cobra/doc"
-)
-
-func main() {
- kubectl := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard)
- err := doc.GenMarkdownTree(kubectl, "./")
- if err != nil {
- log.Fatal(err)
- }
-}
-```
-
-This will generate a whole series of files, one for each command in the tree, in the directory specified (in this case "./")
-
-## Generate markdown docs for a single command
-
-You may wish to have more control over the output, or only generate for a single command, instead of the entire command tree. If this is the case you may prefer to `GenMarkdown` instead of `GenMarkdownTree`
-
-```go
- out := new(bytes.Buffer)
- err := doc.GenMarkdown(cmd, out)
- if err != nil {
- log.Fatal(err)
- }
-```
-
-This will write the markdown doc for ONLY "cmd" into the out, buffer.
-
-## Customize the output
-
-Both `GenMarkdown` and `GenMarkdownTree` have alternate versions with callbacks to get some control of the output:
-
-```go
-func GenMarkdownTreeCustom(cmd *Command, dir string, filePrepender, linkHandler func(string) string) error {
- //...
-}
-```
-
-```go
-func GenMarkdownCustom(cmd *Command, out *bytes.Buffer, linkHandler func(string) string) error {
- //...
-}
-```
-
-The `filePrepender` will prepend the return value given the full filepath to the rendered Markdown file. A common use case is to add front matter to use the generated documentation with [Hugo](http://gohugo.io/):
-
-```go
-const fmTemplate = `---
-date: %s
-title: "%s"
-slug: %s
-url: %s
----
-`
-
-filePrepender := func(filename string) string {
- now := time.Now().Format(time.RFC3339)
- name := filepath.Base(filename)
- base := strings.TrimSuffix(name, path.Ext(name))
- url := "/commands/" + strings.ToLower(base) + "/"
- return fmt.Sprintf(fmTemplate, now, strings.Replace(base, "_", " ", -1), base, url)
-}
-```
-
-The `linkHandler` can be used to customize the rendered internal links to the commands, given a filename:
-
-```go
-linkHandler := func(name string) string {
- base := strings.TrimSuffix(name, path.Ext(name))
- return "/commands/" + strings.ToLower(base) + "/"
-}
-```
diff --git a/vendor/github.com/spf13/cobra/doc/rest_docs.go b/vendor/github.com/spf13/cobra/doc/rest_docs.go
deleted file mode 100644
index 051d8dc8..00000000
--- a/vendor/github.com/spf13/cobra/doc/rest_docs.go
+++ /dev/null
@@ -1,185 +0,0 @@
-//Copyright 2015 Red Hat Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package doc
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
- "path/filepath"
- "sort"
- "strings"
- "time"
-
- "github.com/spf13/cobra"
-)
-
-func printOptionsReST(buf *bytes.Buffer, cmd *cobra.Command, name string) error {
- flags := cmd.NonInheritedFlags()
- flags.SetOutput(buf)
- if flags.HasAvailableFlags() {
- buf.WriteString("Options\n")
- buf.WriteString("~~~~~~~\n\n::\n\n")
- flags.PrintDefaults()
- buf.WriteString("\n")
- }
-
- parentFlags := cmd.InheritedFlags()
- parentFlags.SetOutput(buf)
- if parentFlags.HasAvailableFlags() {
- buf.WriteString("Options inherited from parent commands\n")
- buf.WriteString("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n::\n\n")
- parentFlags.PrintDefaults()
- buf.WriteString("\n")
- }
- return nil
-}
-
-// linkHandler for default ReST hyperlink markup
-func defaultLinkHandler(name, ref string) string {
- return fmt.Sprintf("`%s <%s.rst>`_", name, ref)
-}
-
-// GenReST creates reStructured Text output.
-func GenReST(cmd *cobra.Command, w io.Writer) error {
- return GenReSTCustom(cmd, w, defaultLinkHandler)
-}
-
-// GenReSTCustom creates custom reStructured Text output.
-func GenReSTCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string, string) string) error {
- cmd.InitDefaultHelpCmd()
- cmd.InitDefaultHelpFlag()
-
- buf := new(bytes.Buffer)
- name := cmd.CommandPath()
-
- short := cmd.Short
- long := cmd.Long
- if len(long) == 0 {
- long = short
- }
- ref := strings.Replace(name, " ", "_", -1)
-
- buf.WriteString(".. _" + ref + ":\n\n")
- buf.WriteString(name + "\n")
- buf.WriteString(strings.Repeat("-", len(name)) + "\n\n")
- buf.WriteString(short + "\n\n")
- buf.WriteString("Synopsis\n")
- buf.WriteString("~~~~~~~~\n\n")
- buf.WriteString("\n" + long + "\n\n")
-
- if cmd.Runnable() {
- buf.WriteString(fmt.Sprintf("::\n\n %s\n\n", cmd.UseLine()))
- }
-
- if len(cmd.Example) > 0 {
- buf.WriteString("Examples\n")
- buf.WriteString("~~~~~~~~\n\n")
- buf.WriteString(fmt.Sprintf("::\n\n%s\n\n", indentString(cmd.Example, " ")))
- }
-
- if err := printOptionsReST(buf, cmd, name); err != nil {
- return err
- }
- if hasSeeAlso(cmd) {
- buf.WriteString("SEE ALSO\n")
- buf.WriteString("~~~~~~~~\n\n")
- if cmd.HasParent() {
- parent := cmd.Parent()
- pname := parent.CommandPath()
- ref = strings.Replace(pname, " ", "_", -1)
- buf.WriteString(fmt.Sprintf("* %s \t - %s\n", linkHandler(pname, ref), parent.Short))
- cmd.VisitParents(func(c *cobra.Command) {
- if c.DisableAutoGenTag {
- cmd.DisableAutoGenTag = c.DisableAutoGenTag
- }
- })
- }
-
- children := cmd.Commands()
- sort.Sort(byName(children))
-
- for _, child := range children {
- if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() {
- continue
- }
- cname := name + " " + child.Name()
- ref = strings.Replace(cname, " ", "_", -1)
- buf.WriteString(fmt.Sprintf("* %s \t - %s\n", linkHandler(cname, ref), child.Short))
- }
- buf.WriteString("\n")
- }
- if !cmd.DisableAutoGenTag {
- buf.WriteString("*Auto generated by spf13/cobra on " + time.Now().Format("2-Jan-2006") + "*\n")
- }
- _, err := buf.WriteTo(w)
- return err
-}
-
-// GenReSTTree will generate a ReST page for this command and all
-// descendants in the directory given.
-// This function may not work correctly if your command names have `-` in them.
-// If you have `cmd` with two subcmds, `sub` and `sub-third`,
-// and `sub` has a subcommand called `third`, it is undefined which
-// help output will be in the file `cmd-sub-third.1`.
-func GenReSTTree(cmd *cobra.Command, dir string) error {
- emptyStr := func(s string) string { return "" }
- return GenReSTTreeCustom(cmd, dir, emptyStr, defaultLinkHandler)
-}
-
-// GenReSTTreeCustom is the the same as GenReSTTree, but
-// with custom filePrepender and linkHandler.
-func GenReSTTreeCustom(cmd *cobra.Command, dir string, filePrepender func(string) string, linkHandler func(string, string) string) error {
- for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
- continue
- }
- if err := GenReSTTreeCustom(c, dir, filePrepender, linkHandler); err != nil {
- return err
- }
- }
-
- basename := strings.Replace(cmd.CommandPath(), " ", "_", -1) + ".rst"
- filename := filepath.Join(dir, basename)
- f, err := os.Create(filename)
- if err != nil {
- return err
- }
- defer f.Close()
-
- if _, err := io.WriteString(f, filePrepender(filename)); err != nil {
- return err
- }
- if err := GenReSTCustom(cmd, f, linkHandler); err != nil {
- return err
- }
- return nil
-}
-
-// adapted from: https://github.com/kr/text/blob/main/indent.go
-func indentString(s, p string) string {
- var res []byte
- b := []byte(s)
- prefix := []byte(p)
- bol := true
- for _, c := range b {
- if bol && c != '\n' {
- res = append(res, prefix...)
- }
- res = append(res, c)
- bol = c == '\n'
- }
- return string(res)
-}
diff --git a/vendor/github.com/spf13/cobra/doc/rest_docs.md b/vendor/github.com/spf13/cobra/doc/rest_docs.md
deleted file mode 100644
index 6098430e..00000000
--- a/vendor/github.com/spf13/cobra/doc/rest_docs.md
+++ /dev/null
@@ -1,114 +0,0 @@
-# Generating ReStructured Text Docs For Your Own cobra.Command
-
-Generating ReST pages from a cobra command is incredibly easy. An example is as follows:
-
-```go
-package main
-
-import (
- "log"
-
- "github.com/spf13/cobra"
- "github.com/spf13/cobra/doc"
-)
-
-func main() {
- cmd := &cobra.Command{
- Use: "test",
- Short: "my test program",
- }
- err := doc.GenReSTTree(cmd, "/tmp")
- if err != nil {
- log.Fatal(err)
- }
-}
-```
-
-That will get you a ReST document `/tmp/test.rst`
-
-## Generate ReST docs for the entire command tree
-
-This program can actually generate docs for the kubectl command in the kubernetes project
-
-```go
-package main
-
-import (
- "log"
- "io/ioutil"
- "os"
-
- "k8s.io/kubernetes/pkg/kubectl/cmd"
- cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
-
- "github.com/spf13/cobra/doc"
-)
-
-func main() {
- kubectl := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard)
- err := doc.GenReSTTree(kubectl, "./")
- if err != nil {
- log.Fatal(err)
- }
-}
-```
-
-This will generate a whole series of files, one for each command in the tree, in the directory specified (in this case "./")
-
-## Generate ReST docs for a single command
-
-You may wish to have more control over the output, or only generate for a single command, instead of the entire command tree. If this is the case you may prefer to `GenReST` instead of `GenReSTTree`
-
-```go
- out := new(bytes.Buffer)
- err := doc.GenReST(cmd, out)
- if err != nil {
- log.Fatal(err)
- }
-```
-
-This will write the ReST doc for ONLY "cmd" into the out, buffer.
-
-## Customize the output
-
-Both `GenReST` and `GenReSTTree` have alternate versions with callbacks to get some control of the output:
-
-```go
-func GenReSTTreeCustom(cmd *Command, dir string, filePrepender func(string) string, linkHandler func(string, string) string) error {
- //...
-}
-```
-
-```go
-func GenReSTCustom(cmd *Command, out *bytes.Buffer, linkHandler func(string, string) string) error {
- //...
-}
-```
-
-The `filePrepender` will prepend the return value given the full filepath to the rendered ReST file. A common use case is to add front matter to use the generated documentation with [Hugo](http://gohugo.io/):
-
-```go
-const fmTemplate = `---
-date: %s
-title: "%s"
-slug: %s
-url: %s
----
-`
-filePrepender := func(filename string) string {
- now := time.Now().Format(time.RFC3339)
- name := filepath.Base(filename)
- base := strings.TrimSuffix(name, path.Ext(name))
- url := "/commands/" + strings.ToLower(base) + "/"
- return fmt.Sprintf(fmTemplate, now, strings.Replace(base, "_", " ", -1), base, url)
-}
-```
-
-The `linkHandler` can be used to customize the rendered links to the commands, given a command name and reference. This is useful while converting rst to html or while generating documentation with tools like Sphinx where `:ref:` is used:
-
-```go
-// Sphinx cross-referencing format
-linkHandler := func(name, ref string) string {
- return fmt.Sprintf(":ref:`%s <%s>`", name, ref)
-}
-```
diff --git a/vendor/github.com/spf13/cobra/doc/util.go b/vendor/github.com/spf13/cobra/doc/util.go
deleted file mode 100644
index 8d3dbece..00000000
--- a/vendor/github.com/spf13/cobra/doc/util.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2015 Red Hat Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package doc
-
-import (
- "strings"
-
- "github.com/spf13/cobra"
-)
-
-// Test to see if we have a reason to print See Also information in docs
-// Basically this is a test for a parent commend or a subcommand which is
-// both not deprecated and not the autogenerated help command.
-func hasSeeAlso(cmd *cobra.Command) bool {
- if cmd.HasParent() {
- return true
- }
- for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
- continue
- }
- return true
- }
- return false
-}
-
-// Temporary workaround for yaml lib generating incorrect yaml with long strings
-// that do not contain \n.
-func forceMultiLine(s string) string {
- if len(s) > 60 && !strings.Contains(s, "\n") {
- s = s + "\n"
- }
- return s
-}
-
-type byName []*cobra.Command
-
-func (s byName) Len() int { return len(s) }
-func (s byName) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
-func (s byName) Less(i, j int) bool { return s[i].Name() < s[j].Name() }
diff --git a/vendor/github.com/spf13/cobra/doc/yaml_docs.go b/vendor/github.com/spf13/cobra/doc/yaml_docs.go
deleted file mode 100644
index ea00af07..00000000
--- a/vendor/github.com/spf13/cobra/doc/yaml_docs.go
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright 2016 French Ben. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package doc
-
-import (
- "fmt"
- "io"
- "os"
- "path/filepath"
- "sort"
- "strings"
-
- "github.com/spf13/cobra"
- "github.com/spf13/pflag"
- "gopkg.in/yaml.v2"
-)
-
-type cmdOption struct {
- Name string
- Shorthand string `yaml:",omitempty"`
- DefaultValue string `yaml:"default_value,omitempty"`
- Usage string `yaml:",omitempty"`
-}
-
-type cmdDoc struct {
- Name string
- Synopsis string `yaml:",omitempty"`
- Description string `yaml:",omitempty"`
- Options []cmdOption `yaml:",omitempty"`
- InheritedOptions []cmdOption `yaml:"inherited_options,omitempty"`
- Example string `yaml:",omitempty"`
- SeeAlso []string `yaml:"see_also,omitempty"`
-}
-
-// GenYamlTree creates yaml structured ref files for this command and all descendants
-// in the directory given. This function may not work
-// correctly if your command names have `-` in them. If you have `cmd` with two
-// subcmds, `sub` and `sub-third`, and `sub` has a subcommand called `third`
-// it is undefined which help output will be in the file `cmd-sub-third.1`.
-func GenYamlTree(cmd *cobra.Command, dir string) error {
- identity := func(s string) string { return s }
- emptyStr := func(s string) string { return "" }
- return GenYamlTreeCustom(cmd, dir, emptyStr, identity)
-}
-
-// GenYamlTreeCustom creates yaml structured ref files.
-func GenYamlTreeCustom(cmd *cobra.Command, dir string, filePrepender, linkHandler func(string) string) error {
- for _, c := range cmd.Commands() {
- if !c.IsAvailableCommand() || c.IsAdditionalHelpTopicCommand() {
- continue
- }
- if err := GenYamlTreeCustom(c, dir, filePrepender, linkHandler); err != nil {
- return err
- }
- }
-
- basename := strings.Replace(cmd.CommandPath(), " ", "_", -1) + ".yaml"
- filename := filepath.Join(dir, basename)
- f, err := os.Create(filename)
- if err != nil {
- return err
- }
- defer f.Close()
-
- if _, err := io.WriteString(f, filePrepender(filename)); err != nil {
- return err
- }
- if err := GenYamlCustom(cmd, f, linkHandler); err != nil {
- return err
- }
- return nil
-}
-
-// GenYaml creates yaml output.
-func GenYaml(cmd *cobra.Command, w io.Writer) error {
- return GenYamlCustom(cmd, w, func(s string) string { return s })
-}
-
-// GenYamlCustom creates custom yaml output.
-func GenYamlCustom(cmd *cobra.Command, w io.Writer, linkHandler func(string) string) error {
- cmd.InitDefaultHelpCmd()
- cmd.InitDefaultHelpFlag()
-
- yamlDoc := cmdDoc{}
- yamlDoc.Name = cmd.CommandPath()
-
- yamlDoc.Synopsis = forceMultiLine(cmd.Short)
- yamlDoc.Description = forceMultiLine(cmd.Long)
-
- if len(cmd.Example) > 0 {
- yamlDoc.Example = cmd.Example
- }
-
- flags := cmd.NonInheritedFlags()
- if flags.HasFlags() {
- yamlDoc.Options = genFlagResult(flags)
- }
- flags = cmd.InheritedFlags()
- if flags.HasFlags() {
- yamlDoc.InheritedOptions = genFlagResult(flags)
- }
-
- if hasSeeAlso(cmd) {
- result := []string{}
- if cmd.HasParent() {
- parent := cmd.Parent()
- result = append(result, parent.CommandPath()+" - "+parent.Short)
- }
- children := cmd.Commands()
- sort.Sort(byName(children))
- for _, child := range children {
- if !child.IsAvailableCommand() || child.IsAdditionalHelpTopicCommand() {
- continue
- }
- result = append(result, child.Name()+" - "+child.Short)
- }
- yamlDoc.SeeAlso = result
- }
-
- final, err := yaml.Marshal(&yamlDoc)
- if err != nil {
- fmt.Println(err)
- os.Exit(1)
- }
-
- if _, err := w.Write(final); err != nil {
- return err
- }
- return nil
-}
-
-func genFlagResult(flags *pflag.FlagSet) []cmdOption {
- var result []cmdOption
-
- flags.VisitAll(func(flag *pflag.Flag) {
- // Todo, when we mark a shorthand is deprecated, but specify an empty message.
- // The flag.ShorthandDeprecated is empty as the shorthand is deprecated.
- // Using len(flag.ShorthandDeprecated) > 0 can't handle this, others are ok.
- if !(len(flag.ShorthandDeprecated) > 0) && len(flag.Shorthand) > 0 {
- opt := cmdOption{
- flag.Name,
- flag.Shorthand,
- flag.DefValue,
- forceMultiLine(flag.Usage),
- }
- result = append(result, opt)
- } else {
- opt := cmdOption{
- Name: flag.Name,
- DefaultValue: forceMultiLine(flag.DefValue),
- Usage: forceMultiLine(flag.Usage),
- }
- result = append(result, opt)
- }
- })
-
- return result
-}
diff --git a/vendor/github.com/spf13/cobra/doc/yaml_docs.md b/vendor/github.com/spf13/cobra/doc/yaml_docs.md
deleted file mode 100644
index 1a9b7c6a..00000000
--- a/vendor/github.com/spf13/cobra/doc/yaml_docs.md
+++ /dev/null
@@ -1,112 +0,0 @@
-# Generating Yaml Docs For Your Own cobra.Command
-
-Generating yaml files from a cobra command is incredibly easy. An example is as follows:
-
-```go
-package main
-
-import (
- "log"
-
- "github.com/spf13/cobra"
- "github.com/spf13/cobra/doc"
-)
-
-func main() {
- cmd := &cobra.Command{
- Use: "test",
- Short: "my test program",
- }
- err := doc.GenYamlTree(cmd, "/tmp")
- if err != nil {
- log.Fatal(err)
- }
-}
-```
-
-That will get you a Yaml document `/tmp/test.yaml`
-
-## Generate yaml docs for the entire command tree
-
-This program can actually generate docs for the kubectl command in the kubernetes project
-
-```go
-package main
-
-import (
- "io/ioutil"
- "log"
- "os"
-
- "k8s.io/kubernetes/pkg/kubectl/cmd"
- cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
-
- "github.com/spf13/cobra/doc"
-)
-
-func main() {
- kubectl := cmd.NewKubectlCommand(cmdutil.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard)
- err := doc.GenYamlTree(kubectl, "./")
- if err != nil {
- log.Fatal(err)
- }
-}
-```
-
-This will generate a whole series of files, one for each command in the tree, in the directory specified (in this case "./")
-
-## Generate yaml docs for a single command
-
-You may wish to have more control over the output, or only generate for a single command, instead of the entire command tree. If this is the case you may prefer to `GenYaml` instead of `GenYamlTree`
-
-```go
- out := new(bytes.Buffer)
- doc.GenYaml(cmd, out)
-```
-
-This will write the yaml doc for ONLY "cmd" into the out, buffer.
-
-## Customize the output
-
-Both `GenYaml` and `GenYamlTree` have alternate versions with callbacks to get some control of the output:
-
-```go
-func GenYamlTreeCustom(cmd *Command, dir string, filePrepender, linkHandler func(string) string) error {
- //...
-}
-```
-
-```go
-func GenYamlCustom(cmd *Command, out *bytes.Buffer, linkHandler func(string) string) error {
- //...
-}
-```
-
-The `filePrepender` will prepend the return value given the full filepath to the rendered Yaml file. A common use case is to add front matter to use the generated documentation with [Hugo](http://gohugo.io/):
-
-```go
-const fmTemplate = `---
-date: %s
-title: "%s"
-slug: %s
-url: %s
----
-`
-
-filePrepender := func(filename string) string {
- now := time.Now().Format(time.RFC3339)
- name := filepath.Base(filename)
- base := strings.TrimSuffix(name, path.Ext(name))
- url := "/commands/" + strings.ToLower(base) + "/"
- return fmt.Sprintf(fmTemplate, now, strings.Replace(base, "_", " ", -1), base, url)
-}
-```
-
-The `linkHandler` can be used to customize the rendered internal links to the commands, given a filename:
-
-```go
-linkHandler := func(name string) string {
- base := strings.TrimSuffix(name, path.Ext(name))
- return "/commands/" + strings.ToLower(base) + "/"
-}
-```
diff --git a/vendor/github.com/spf13/cobra/go.mod b/vendor/github.com/spf13/cobra/go.mod
deleted file mode 100644
index 9a9eb65a..00000000
--- a/vendor/github.com/spf13/cobra/go.mod
+++ /dev/null
@@ -1,13 +0,0 @@
-module github.com/spf13/cobra
-
-go 1.12
-
-require (
- github.com/BurntSushi/toml v0.3.1 // indirect
- github.com/cpuguy83/go-md2man v1.0.10
- github.com/inconshreveable/mousetrap v1.0.0
- github.com/mitchellh/go-homedir v1.1.0
- github.com/spf13/pflag v1.0.3
- github.com/spf13/viper v1.3.2
- gopkg.in/yaml.v2 v2.2.2
-)
diff --git a/vendor/github.com/spf13/cobra/go.sum b/vendor/github.com/spf13/cobra/go.sum
deleted file mode 100644
index 9761f4d0..00000000
--- a/vendor/github.com/spf13/cobra/go.sum
+++ /dev/null
@@ -1,51 +0,0 @@
-github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
-github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
-github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
-github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
-github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk=
-github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
-github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk=
-github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
-github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
-github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
-github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
-github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
-github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
-github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
-github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
-github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY=
-github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
-github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
-github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
-github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
-github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
-github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
-github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
-github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
-github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo=
-github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
-github.com/spf13/afero v1.1.2 h1:m8/z1t7/fwjysjQRYbP0RD+bUIF/8tJwPdEZsI83ACI=
-github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
-github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=
-github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
-github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk=
-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 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M=
-github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
-github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
-github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
-github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
-github.com/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/sys v0.0.0-20181205085412-a5c9d58dba9a h1:1n5lsVfiQW3yfsRGu98756EH1YthsFqr/5mxHduZW2A=
-golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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=
diff --git a/vendor/github.com/spf13/cobra/powershell_completions.go b/vendor/github.com/spf13/cobra/powershell_completions.go
deleted file mode 100644
index 756c61b9..00000000
--- a/vendor/github.com/spf13/cobra/powershell_completions.go
+++ /dev/null
@@ -1,100 +0,0 @@
-// PowerShell completions are based on the amazing work from clap:
-// https://github.com/clap-rs/clap/blob/3294d18efe5f264d12c9035f404c7d189d4824e1/src/completions/powershell.rs
-//
-// The generated scripts require PowerShell v5.0+ (which comes Windows 10, but
-// can be downloaded separately for windows 7 or 8.1).
-
-package cobra
-
-import (
- "bytes"
- "fmt"
- "io"
- "os"
- "strings"
-
- "github.com/spf13/pflag"
-)
-
-var powerShellCompletionTemplate = `using namespace System.Management.Automation
-using namespace System.Management.Automation.Language
-Register-ArgumentCompleter -Native -CommandName '%s' -ScriptBlock {
- param($wordToComplete, $commandAst, $cursorPosition)
- $commandElements = $commandAst.CommandElements
- $command = @(
- '%s'
- for ($i = 1; $i -lt $commandElements.Count; $i++) {
- $element = $commandElements[$i]
- if ($element -isnot [StringConstantExpressionAst] -or
- $element.StringConstantType -ne [StringConstantType]::BareWord -or
- $element.Value.StartsWith('-')) {
- break
- }
- $element.Value
- }
- ) -join ';'
- $completions = @(switch ($command) {%s
- })
- $completions.Where{ $_.CompletionText -like "$wordToComplete*" } |
- Sort-Object -Property ListItemText
-}`
-
-func generatePowerShellSubcommandCases(out io.Writer, cmd *Command, previousCommandName string) {
- var cmdName string
- if previousCommandName == "" {
- cmdName = cmd.Name()
- } else {
- cmdName = fmt.Sprintf("%s;%s", previousCommandName, cmd.Name())
- }
-
- fmt.Fprintf(out, "\n '%s' {", cmdName)
-
- cmd.Flags().VisitAll(func(flag *pflag.Flag) {
- if nonCompletableFlag(flag) {
- return
- }
- usage := escapeStringForPowerShell(flag.Usage)
- if len(flag.Shorthand) > 0 {
- fmt.Fprintf(out, "\n [CompletionResult]::new('-%s', '%s', [CompletionResultType]::ParameterName, '%s')", flag.Shorthand, flag.Shorthand, usage)
- }
- fmt.Fprintf(out, "\n [CompletionResult]::new('--%s', '%s', [CompletionResultType]::ParameterName, '%s')", flag.Name, flag.Name, usage)
- })
-
- for _, subCmd := range cmd.Commands() {
- usage := escapeStringForPowerShell(subCmd.Short)
- fmt.Fprintf(out, "\n [CompletionResult]::new('%s', '%s', [CompletionResultType]::ParameterValue, '%s')", subCmd.Name(), subCmd.Name(), usage)
- }
-
- fmt.Fprint(out, "\n break\n }")
-
- for _, subCmd := range cmd.Commands() {
- generatePowerShellSubcommandCases(out, subCmd, cmdName)
- }
-}
-
-func escapeStringForPowerShell(s string) string {
- return strings.Replace(s, "'", "''", -1)
-}
-
-// GenPowerShellCompletion generates PowerShell completion file and writes to the passed writer.
-func (c *Command) GenPowerShellCompletion(w io.Writer) error {
- buf := new(bytes.Buffer)
-
- var subCommandCases bytes.Buffer
- generatePowerShellSubcommandCases(&subCommandCases, c, "")
- fmt.Fprintf(buf, powerShellCompletionTemplate, c.Name(), c.Name(), subCommandCases.String())
-
- _, err := buf.WriteTo(w)
- return err
-}
-
-// GenPowerShellCompletionFile generates PowerShell completion file.
-func (c *Command) GenPowerShellCompletionFile(filename string) error {
- outFile, err := os.Create(filename)
- if err != nil {
- return err
- }
- defer outFile.Close()
-
- return c.GenPowerShellCompletion(outFile)
-}
diff --git a/vendor/github.com/spf13/cobra/powershell_completions.md b/vendor/github.com/spf13/cobra/powershell_completions.md
deleted file mode 100644
index afed8024..00000000
--- a/vendor/github.com/spf13/cobra/powershell_completions.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# Generating PowerShell Completions For Your Own cobra.Command
-
-Cobra can generate PowerShell completion scripts. Users need PowerShell version 5.0 or above, which comes with Windows 10 and can be downloaded separately for Windows 7 or 8.1. They can then write the completions to a file and source this file from their PowerShell profile, which is referenced by the `$Profile` environment variable. See `Get-Help about_Profiles` for more info about PowerShell profiles.
-
-# What's supported
-
-- Completion for subcommands using their `.Short` description
-- Completion for non-hidden flags using their `.Name` and `.Shorthand`
-
-# What's not yet supported
-
-- Command aliases
-- Required, filename or custom flags (they will work like normal flags)
-- Custom completion scripts
diff --git a/vendor/github.com/spf13/cobra/shell_completions.go b/vendor/github.com/spf13/cobra/shell_completions.go
deleted file mode 100644
index ba0af9cb..00000000
--- a/vendor/github.com/spf13/cobra/shell_completions.go
+++ /dev/null
@@ -1,85 +0,0 @@
-package cobra
-
-import (
- "github.com/spf13/pflag"
-)
-
-// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag if it exists,
-// and causes your command to report an error if invoked without the flag.
-func (c *Command) MarkFlagRequired(name string) error {
- return MarkFlagRequired(c.Flags(), name)
-}
-
-// MarkPersistentFlagRequired adds the BashCompOneRequiredFlag annotation to the named persistent flag if it exists,
-// and causes your command to report an error if invoked without the flag.
-func (c *Command) MarkPersistentFlagRequired(name string) error {
- return MarkFlagRequired(c.PersistentFlags(), name)
-}
-
-// MarkFlagRequired adds the BashCompOneRequiredFlag annotation to the named flag if it exists,
-// and causes your command to report an error if invoked without the flag.
-func MarkFlagRequired(flags *pflag.FlagSet, name string) error {
- return flags.SetAnnotation(name, BashCompOneRequiredFlag, []string{"true"})
-}
-
-// MarkFlagFilename adds the BashCompFilenameExt annotation to the named flag, if it exists.
-// Generated bash autocompletion will select filenames for the flag, limiting to named extensions if provided.
-func (c *Command) MarkFlagFilename(name string, extensions ...string) error {
- return MarkFlagFilename(c.Flags(), name, extensions...)
-}
-
-// MarkFlagCustom adds the BashCompCustom annotation to the named flag, if it exists.
-// Generated bash autocompletion will call the bash function f for the flag.
-func (c *Command) MarkFlagCustom(name string, f string) error {
- return MarkFlagCustom(c.Flags(), name, f)
-}
-
-// MarkPersistentFlagFilename instructs the various shell completion
-// implementations to limit completions for this persistent flag to the
-// specified extensions (patterns).
-//
-// Shell Completion compatibility matrix: bash, zsh
-func (c *Command) MarkPersistentFlagFilename(name string, extensions ...string) error {
- return MarkFlagFilename(c.PersistentFlags(), name, extensions...)
-}
-
-// MarkFlagFilename instructs the various shell completion implementations to
-// limit completions for this flag to the specified extensions (patterns).
-//
-// Shell Completion compatibility matrix: bash, zsh
-func MarkFlagFilename(flags *pflag.FlagSet, name string, extensions ...string) error {
- return flags.SetAnnotation(name, BashCompFilenameExt, extensions)
-}
-
-// MarkFlagCustom instructs the various shell completion implementations to
-// limit completions for this flag to the specified extensions (patterns).
-//
-// Shell Completion compatibility matrix: bash, zsh
-func MarkFlagCustom(flags *pflag.FlagSet, name string, f string) error {
- return flags.SetAnnotation(name, BashCompCustom, []string{f})
-}
-
-// MarkFlagDirname instructs the various shell completion implementations to
-// complete only directories with this named flag.
-//
-// Shell Completion compatibility matrix: zsh
-func (c *Command) MarkFlagDirname(name string) error {
- return MarkFlagDirname(c.Flags(), name)
-}
-
-// MarkPersistentFlagDirname instructs the various shell completion
-// implementations to complete only directories with this persistent named flag.
-//
-// Shell Completion compatibility matrix: zsh
-func (c *Command) MarkPersistentFlagDirname(name string) error {
- return MarkFlagDirname(c.PersistentFlags(), name)
-}
-
-// MarkFlagDirname instructs the various shell completion implementations to
-// complete only directories with this specified flag.
-//
-// Shell Completion compatibility matrix: zsh
-func MarkFlagDirname(flags *pflag.FlagSet, name string) error {
- zshPattern := "-(/)"
- return flags.SetAnnotation(name, zshCompDirname, []string{zshPattern})
-}
diff --git a/vendor/github.com/spf13/cobra/zsh_completions.go b/vendor/github.com/spf13/cobra/zsh_completions.go
deleted file mode 100644
index 12755482..00000000
--- a/vendor/github.com/spf13/cobra/zsh_completions.go
+++ /dev/null
@@ -1,336 +0,0 @@
-package cobra
-
-import (
- "encoding/json"
- "fmt"
- "io"
- "os"
- "sort"
- "strings"
- "text/template"
-
- "github.com/spf13/pflag"
-)
-
-const (
- zshCompArgumentAnnotation = "cobra_annotations_zsh_completion_argument_annotation"
- zshCompArgumentFilenameComp = "cobra_annotations_zsh_completion_argument_file_completion"
- zshCompArgumentWordComp = "cobra_annotations_zsh_completion_argument_word_completion"
- zshCompDirname = "cobra_annotations_zsh_dirname"
-)
-
-var (
- zshCompFuncMap = template.FuncMap{
- "genZshFuncName": zshCompGenFuncName,
- "extractFlags": zshCompExtractFlag,
- "genFlagEntryForZshArguments": zshCompGenFlagEntryForArguments,
- "extractArgsCompletions": zshCompExtractArgumentCompletionHintsForRendering,
- }
- zshCompletionText = `
-{{/* should accept Command (that contains subcommands) as parameter */}}
-{{define "argumentsC" -}}
-{{ $cmdPath := genZshFuncName .}}
-function {{$cmdPath}} {
- local -a commands
-
- _arguments -C \{{- range extractFlags .}}
- {{genFlagEntryForZshArguments .}} \{{- end}}
- "1: :->cmnds" \
- "*::arg:->args"
-
- case $state in
- cmnds)
- commands=({{range .Commands}}{{if not .Hidden}}
- "{{.Name}}:{{.Short}}"{{end}}{{end}}
- )
- _describe "command" commands
- ;;
- esac
-
- case "$words[1]" in {{- range .Commands}}{{if not .Hidden}}
- {{.Name}})
- {{$cmdPath}}_{{.Name}}
- ;;{{end}}{{end}}
- esac
-}
-{{range .Commands}}{{if not .Hidden}}
-{{template "selectCmdTemplate" .}}
-{{- end}}{{end}}
-{{- end}}
-
-{{/* should accept Command without subcommands as parameter */}}
-{{define "arguments" -}}
-function {{genZshFuncName .}} {
-{{" _arguments"}}{{range extractFlags .}} \
- {{genFlagEntryForZshArguments . -}}
-{{end}}{{range extractArgsCompletions .}} \
- {{.}}{{end}}
-}
-{{end}}
-
-{{/* dispatcher for commands with or without subcommands */}}
-{{define "selectCmdTemplate" -}}
-{{if .Hidden}}{{/* ignore hidden*/}}{{else -}}
-{{if .Commands}}{{template "argumentsC" .}}{{else}}{{template "arguments" .}}{{end}}
-{{- end}}
-{{- end}}
-
-{{/* template entry point */}}
-{{define "Main" -}}
-#compdef _{{.Name}} {{.Name}}
-
-{{template "selectCmdTemplate" .}}
-{{end}}
-`
-)
-
-// zshCompArgsAnnotation is used to encode/decode zsh completion for
-// arguments to/from Command.Annotations.
-type zshCompArgsAnnotation map[int]zshCompArgHint
-
-type zshCompArgHint struct {
- // Indicates the type of the completion to use. One of:
- // zshCompArgumentFilenameComp or zshCompArgumentWordComp
- Tipe string `json:"type"`
-
- // A value for the type above (globs for file completion or words)
- Options []string `json:"options"`
-}
-
-// GenZshCompletionFile generates zsh completion file.
-func (c *Command) GenZshCompletionFile(filename string) error {
- outFile, err := os.Create(filename)
- if err != nil {
- return err
- }
- defer outFile.Close()
-
- return c.GenZshCompletion(outFile)
-}
-
-// GenZshCompletion generates a zsh completion file and writes to the passed
-// writer. The completion always run on the root command regardless of the
-// command it was called from.
-func (c *Command) GenZshCompletion(w io.Writer) error {
- tmpl, err := template.New("Main").Funcs(zshCompFuncMap).Parse(zshCompletionText)
- if err != nil {
- return fmt.Errorf("error creating zsh completion template: %v", err)
- }
- return tmpl.Execute(w, c.Root())
-}
-
-// MarkZshCompPositionalArgumentFile marks the specified argument (first
-// argument is 1) as completed by file selection. patterns (e.g. "*.txt") are
-// optional - if not provided the completion will search for all files.
-func (c *Command) MarkZshCompPositionalArgumentFile(argPosition int, patterns ...string) error {
- if argPosition < 1 {
- return fmt.Errorf("Invalid argument position (%d)", argPosition)
- }
- annotation, err := c.zshCompGetArgsAnnotations()
- if err != nil {
- return err
- }
- if c.zshcompArgsAnnotationnIsDuplicatePosition(annotation, argPosition) {
- return fmt.Errorf("Duplicate annotation for positional argument at index %d", argPosition)
- }
- annotation[argPosition] = zshCompArgHint{
- Tipe: zshCompArgumentFilenameComp,
- Options: patterns,
- }
- return c.zshCompSetArgsAnnotations(annotation)
-}
-
-// MarkZshCompPositionalArgumentWords marks the specified positional argument
-// (first argument is 1) as completed by the provided words. At east one word
-// must be provided, spaces within words will be offered completion with
-// "word\ word".
-func (c *Command) MarkZshCompPositionalArgumentWords(argPosition int, words ...string) error {
- if argPosition < 1 {
- return fmt.Errorf("Invalid argument position (%d)", argPosition)
- }
- if len(words) == 0 {
- return fmt.Errorf("Trying to set empty word list for positional argument %d", argPosition)
- }
- annotation, err := c.zshCompGetArgsAnnotations()
- if err != nil {
- return err
- }
- if c.zshcompArgsAnnotationnIsDuplicatePosition(annotation, argPosition) {
- return fmt.Errorf("Duplicate annotation for positional argument at index %d", argPosition)
- }
- annotation[argPosition] = zshCompArgHint{
- Tipe: zshCompArgumentWordComp,
- Options: words,
- }
- return c.zshCompSetArgsAnnotations(annotation)
-}
-
-func zshCompExtractArgumentCompletionHintsForRendering(c *Command) ([]string, error) {
- var result []string
- annotation, err := c.zshCompGetArgsAnnotations()
- if err != nil {
- return nil, err
- }
- for k, v := range annotation {
- s, err := zshCompRenderZshCompArgHint(k, v)
- if err != nil {
- return nil, err
- }
- result = append(result, s)
- }
- if len(c.ValidArgs) > 0 {
- if _, positionOneExists := annotation[1]; !positionOneExists {
- s, err := zshCompRenderZshCompArgHint(1, zshCompArgHint{
- Tipe: zshCompArgumentWordComp,
- Options: c.ValidArgs,
- })
- if err != nil {
- return nil, err
- }
- result = append(result, s)
- }
- }
- sort.Strings(result)
- return result, nil
-}
-
-func zshCompRenderZshCompArgHint(i int, z zshCompArgHint) (string, error) {
- switch t := z.Tipe; t {
- case zshCompArgumentFilenameComp:
- var globs []string
- for _, g := range z.Options {
- globs = append(globs, fmt.Sprintf(`-g "%s"`, g))
- }
- return fmt.Sprintf(`'%d: :_files %s'`, i, strings.Join(globs, " ")), nil
- case zshCompArgumentWordComp:
- var words []string
- for _, w := range z.Options {
- words = append(words, fmt.Sprintf("%q", w))
- }
- return fmt.Sprintf(`'%d: :(%s)'`, i, strings.Join(words, " ")), nil
- default:
- return "", fmt.Errorf("Invalid zsh argument completion annotation: %s", t)
- }
-}
-
-func (c *Command) zshcompArgsAnnotationnIsDuplicatePosition(annotation zshCompArgsAnnotation, position int) bool {
- _, dup := annotation[position]
- return dup
-}
-
-func (c *Command) zshCompGetArgsAnnotations() (zshCompArgsAnnotation, error) {
- annotation := make(zshCompArgsAnnotation)
- annotationString, ok := c.Annotations[zshCompArgumentAnnotation]
- if !ok {
- return annotation, nil
- }
- err := json.Unmarshal([]byte(annotationString), &annotation)
- if err != nil {
- return annotation, fmt.Errorf("Error unmarshaling zsh argument annotation: %v", err)
- }
- return annotation, nil
-}
-
-func (c *Command) zshCompSetArgsAnnotations(annotation zshCompArgsAnnotation) error {
- jsn, err := json.Marshal(annotation)
- if err != nil {
- return fmt.Errorf("Error marshaling zsh argument annotation: %v", err)
- }
- if c.Annotations == nil {
- c.Annotations = make(map[string]string)
- }
- c.Annotations[zshCompArgumentAnnotation] = string(jsn)
- return nil
-}
-
-func zshCompGenFuncName(c *Command) string {
- if c.HasParent() {
- return zshCompGenFuncName(c.Parent()) + "_" + c.Name()
- }
- return "_" + c.Name()
-}
-
-func zshCompExtractFlag(c *Command) []*pflag.Flag {
- var flags []*pflag.Flag
- c.LocalFlags().VisitAll(func(f *pflag.Flag) {
- if !f.Hidden {
- flags = append(flags, f)
- }
- })
- c.InheritedFlags().VisitAll(func(f *pflag.Flag) {
- if !f.Hidden {
- flags = append(flags, f)
- }
- })
- return flags
-}
-
-// zshCompGenFlagEntryForArguments returns an entry that matches _arguments
-// zsh-completion parameters. It's too complicated to generate in a template.
-func zshCompGenFlagEntryForArguments(f *pflag.Flag) string {
- if f.Name == "" || f.Shorthand == "" {
- return zshCompGenFlagEntryForSingleOptionFlag(f)
- }
- return zshCompGenFlagEntryForMultiOptionFlag(f)
-}
-
-func zshCompGenFlagEntryForSingleOptionFlag(f *pflag.Flag) string {
- var option, multiMark, extras string
-
- if zshCompFlagCouldBeSpecifiedMoreThenOnce(f) {
- multiMark = "*"
- }
-
- option = "--" + f.Name
- if option == "--" {
- option = "-" + f.Shorthand
- }
- extras = zshCompGenFlagEntryExtras(f)
-
- return fmt.Sprintf(`'%s%s[%s]%s'`, multiMark, option, zshCompQuoteFlagDescription(f.Usage), extras)
-}
-
-func zshCompGenFlagEntryForMultiOptionFlag(f *pflag.Flag) string {
- var options, parenMultiMark, curlyMultiMark, extras string
-
- if zshCompFlagCouldBeSpecifiedMoreThenOnce(f) {
- parenMultiMark = "*"
- curlyMultiMark = "\\*"
- }
-
- options = fmt.Sprintf(`'(%s-%s %s--%s)'{%s-%s,%s--%s}`,
- parenMultiMark, f.Shorthand, parenMultiMark, f.Name, curlyMultiMark, f.Shorthand, curlyMultiMark, f.Name)
- extras = zshCompGenFlagEntryExtras(f)
-
- return fmt.Sprintf(`%s'[%s]%s'`, options, zshCompQuoteFlagDescription(f.Usage), extras)
-}
-
-func zshCompGenFlagEntryExtras(f *pflag.Flag) string {
- if f.NoOptDefVal != "" {
- return ""
- }
-
- extras := ":" // allow options for flag (even without assistance)
- for key, values := range f.Annotations {
- switch key {
- case zshCompDirname:
- extras = fmt.Sprintf(":filename:_files -g %q", values[0])
- case BashCompFilenameExt:
- extras = ":filename:_files"
- for _, pattern := range values {
- extras = extras + fmt.Sprintf(` -g "%s"`, pattern)
- }
- }
- }
-
- return extras
-}
-
-func zshCompFlagCouldBeSpecifiedMoreThenOnce(f *pflag.Flag) bool {
- return strings.Contains(f.Value.Type(), "Slice") ||
- strings.Contains(f.Value.Type(), "Array")
-}
-
-func zshCompQuoteFlagDescription(s string) string {
- return strings.Replace(s, "'", `'\''`, -1)
-}
diff --git a/vendor/github.com/spf13/cobra/zsh_completions.md b/vendor/github.com/spf13/cobra/zsh_completions.md
deleted file mode 100644
index df9c2eac..00000000
--- a/vendor/github.com/spf13/cobra/zsh_completions.md
+++ /dev/null
@@ -1,39 +0,0 @@
-## Generating Zsh Completion for your cobra.Command
-
-Cobra supports native Zsh completion generated from the root `cobra.Command`.
-The generated completion script should be put somewhere in your `$fpath` named
-`_<YOUR COMMAND>`.
-
-### What's Supported
-
-* Completion for all non-hidden subcommands using their `.Short` description.
-* Completion for all non-hidden flags using the following rules:
- * Filename completion works by marking the flag with `cmd.MarkFlagFilename...`
- family of commands.
- * The requirement for argument to the flag is decided by the `.NoOptDefVal`
- flag value - if it's empty then completion will expect an argument.
- * Flags of one of the various `*Array` and `*Slice` types supports multiple
- specifications (with or without argument depending on the specific type).
-* Completion of positional arguments using the following rules:
- * Argument position for all options below starts at `1`. If argument position
- `0` is requested it will raise an error.
- * Use `command.MarkZshCompPositionalArgumentFile` to complete filenames. Glob
- patterns (e.g. `"*.log"`) are optional - if not specified it will offer to
- complete all file types.
- * Use `command.MarkZshCompPositionalArgumentWords` to offer specific words for
- completion. At least one word is required.
- * It's possible to specify completion for some arguments and leave some
- unspecified (e.g. offer words for second argument but nothing for first
- argument). This will cause no completion for first argument but words
- completion for second argument.
- * If no argument completion was specified for 1st argument (but optionally was
- specified for 2nd) and the command has `ValidArgs` it will be used as
- completion options for 1st argument.
- * Argument completions only offered for commands with no subcommands.
-
-### What's not yet Supported
-
-* Custom completion scripts are not supported yet (We should probably create zsh
- specific one, doesn't make sense to re-use the bash one as the functions will
- be different).
-* Whatever other feature you're looking for and doesn't exist :)
diff --git a/vendor/github.com/spf13/pflag/.gitignore b/vendor/github.com/spf13/pflag/.gitignore
deleted file mode 100644
index c3da2901..00000000
--- a/vendor/github.com/spf13/pflag/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.idea/*
-
diff --git a/vendor/github.com/spf13/pflag/.travis.yml b/vendor/github.com/spf13/pflag/.travis.yml
deleted file mode 100644
index f8a63b30..00000000
--- a/vendor/github.com/spf13/pflag/.travis.yml
+++ /dev/null
@@ -1,21 +0,0 @@
-sudo: false
-
-language: go
-
-go:
- - 1.7.3
- - 1.8.1
- - tip
-
-matrix:
- allow_failures:
- - go: tip
-
-install:
- - go get github.com/golang/lint/golint
- - export PATH=$GOPATH/bin:$PATH
- - go install ./...
-
-script:
- - verify/all.sh -v
- - go test ./...
diff --git a/vendor/github.com/spf13/pflag/LICENSE b/vendor/github.com/spf13/pflag/LICENSE
deleted file mode 100644
index 63ed1cfe..00000000
--- a/vendor/github.com/spf13/pflag/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-Copyright (c) 2012 Alex Ogier. All rights reserved.
-Copyright (c) 2012 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/spf13/pflag/README.md b/vendor/github.com/spf13/pflag/README.md
deleted file mode 100644
index b052414d..00000000
--- a/vendor/github.com/spf13/pflag/README.md
+++ /dev/null
@@ -1,296 +0,0 @@
-[![Build Status](https://travis-ci.org/spf13/pflag.svg?branch=master)](https://travis-ci.org/spf13/pflag)
-[![Go Report Card](https://goreportcard.com/badge/github.com/spf13/pflag)](https://goreportcard.com/report/github.com/spf13/pflag)
-[![GoDoc](https://godoc.org/github.com/spf13/pflag?status.svg)](https://godoc.org/github.com/spf13/pflag)
-
-## Description
-
-pflag is a drop-in replacement for Go's flag package, implementing
-POSIX/GNU-style --flags.
-
-pflag is compatible with the [GNU extensions to the POSIX recommendations
-for command-line options][1]. For a more precise description, see the
-"Command-line flag syntax" section below.
-
-[1]: http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
-
-pflag is available under the same style of BSD license as the Go language,
-which can be found in the LICENSE file.
-
-## Installation
-
-pflag is available using the standard `go get` command.
-
-Install by running:
-
- go get github.com/spf13/pflag
-
-Run tests by running:
-
- go test github.com/spf13/pflag
-
-## Usage
-
-pflag is a drop-in replacement of Go's native flag package. If you import
-pflag under the name "flag" then all code should continue to function
-with no changes.
-
-``` go
-import flag "github.com/spf13/pflag"
-```
-
-There is one exception to this: if you directly instantiate the Flag struct
-there is one more field "Shorthand" that you will need to set.
-Most code never instantiates this struct directly, and instead uses
-functions such as String(), BoolVar(), and Var(), and is therefore
-unaffected.
-
-Define flags using flag.String(), Bool(), Int(), etc.
-
-This declares an integer flag, -flagname, stored in the pointer ip, with type *int.
-
-``` go
-var ip *int = flag.Int("flagname", 1234, "help message for flagname")
-```
-
-If you like, you can bind the flag to a variable using the Var() functions.
-
-``` go
-var flagvar int
-func init() {
- flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname")
-}
-```
-
-Or you can create custom flags that satisfy the Value interface (with
-pointer receivers) and couple them to flag parsing by
-
-``` go
-flag.Var(&flagVal, "name", "help message for flagname")
-```
-
-For such flags, the default value is just the initial value of the variable.
-
-After all flags are defined, call
-
-``` go
-flag.Parse()
-```
-
-to parse the command line into the defined flags.
-
-Flags may then be used directly. If you're using the flags themselves,
-they are all pointers; if you bind to variables, they're values.
-
-``` go
-fmt.Println("ip has value ", *ip)
-fmt.Println("flagvar has value ", flagvar)
-```
-
-There are helpers function to get values later if you have the FlagSet but
-it was difficult to keep up with all of the flag pointers in your code.
-If you have a pflag.FlagSet with a flag called 'flagname' of type int you
-can use GetInt() to get the int value. But notice that 'flagname' must exist
-and it must be an int. GetString("flagname") will fail.
-
-``` go
-i, err := flagset.GetInt("flagname")
-```
-
-After parsing, the arguments after the flag are available as the
-slice flag.Args() or individually as flag.Arg(i).
-The arguments are indexed from 0 through flag.NArg()-1.
-
-The pflag package also defines some new functions that are not in flag,
-that give one-letter shorthands for flags. You can use these by appending
-'P' to the name of any function that defines a flag.
-
-``` go
-var ip = flag.IntP("flagname", "f", 1234, "help message")
-var flagvar bool
-func init() {
- flag.BoolVarP(&flagvar, "boolname", "b", true, "help message")
-}
-flag.VarP(&flagVal, "varname", "v", "help message")
-```
-
-Shorthand letters can be used with single dashes on the command line.
-Boolean shorthand flags can be combined with other shorthand flags.
-
-The default set of command-line flags is controlled by
-top-level functions. The FlagSet type allows one to define
-independent sets of flags, such as to implement subcommands
-in a command-line interface. The methods of FlagSet are
-analogous to the top-level functions for the command-line
-flag set.
-
-## Setting no option default values for flags
-
-After you create a flag it is possible to set the pflag.NoOptDefVal for
-the given flag. Doing this changes the meaning of the flag slightly. If
-a flag has a NoOptDefVal and the flag is set on the command line without
-an option the flag will be set to the NoOptDefVal. For example given:
-
-``` go
-var ip = flag.IntP("flagname", "f", 1234, "help message")
-flag.Lookup("flagname").NoOptDefVal = "4321"
-```
-
-Would result in something like
-
-| Parsed Arguments | Resulting Value |
-| ------------- | ------------- |
-| --flagname=1357 | ip=1357 |
-| --flagname | ip=4321 |
-| [nothing] | ip=1234 |
-
-## Command line flag syntax
-
-```
---flag // boolean flags, or flags with no option default values
---flag x // only on flags without a default value
---flag=x
-```
-
-Unlike the flag package, a single dash before an option means something
-different than a double dash. Single dashes signify a series of shorthand
-letters for flags. All but the last shorthand letter must be boolean flags
-or a flag with a default value
-
-```
-// boolean or flags where the 'no option default value' is set
--f
--f=true
--abc
-but
--b true is INVALID
-
-// non-boolean and flags without a 'no option default value'
--n 1234
--n=1234
--n1234
-
-// mixed
--abcs "hello"
--absd="hello"
--abcs1234
-```
-
-Flag parsing stops after the terminator "--". Unlike the flag package,
-flags can be interspersed with arguments anywhere on the command line
-before this terminator.
-
-Integer flags accept 1234, 0664, 0x1234 and may be negative.
-Boolean flags (in their long form) accept 1, 0, t, f, true, false,
-TRUE, FALSE, True, False.
-Duration flags accept any input valid for time.ParseDuration.
-
-## Mutating or "Normalizing" Flag names
-
-It is possible to set a custom flag name 'normalization function.' It allows flag names to be mutated both when created in the code and when used on the command line to some 'normalized' form. The 'normalized' form is used for comparison. Two examples of using the custom normalization func follow.
-
-**Example #1**: You want -, _, and . in flags to compare the same. aka --my-flag == --my_flag == --my.flag
-
-``` go
-func wordSepNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {
- from := []string{"-", "_"}
- to := "."
- for _, sep := range from {
- name = strings.Replace(name, sep, to, -1)
- }
- return pflag.NormalizedName(name)
-}
-
-myFlagSet.SetNormalizeFunc(wordSepNormalizeFunc)
-```
-
-**Example #2**: You want to alias two flags. aka --old-flag-name == --new-flag-name
-
-``` go
-func aliasNormalizeFunc(f *pflag.FlagSet, name string) pflag.NormalizedName {
- switch name {
- case "old-flag-name":
- name = "new-flag-name"
- break
- }
- return pflag.NormalizedName(name)
-}
-
-myFlagSet.SetNormalizeFunc(aliasNormalizeFunc)
-```
-
-## Deprecating a flag or its shorthand
-It is possible to deprecate a flag, or just its shorthand. Deprecating a flag/shorthand hides it from help text and prints a usage message when the deprecated flag/shorthand is used.
-
-**Example #1**: You want to deprecate a flag named "badflag" as well as inform the users what flag they should use instead.
-```go
-// deprecate a flag by specifying its name and a usage message
-flags.MarkDeprecated("badflag", "please use --good-flag instead")
-```
-This hides "badflag" from help text, and prints `Flag --badflag has been deprecated, please use --good-flag instead` when "badflag" is used.
-
-**Example #2**: You want to keep a flag name "noshorthandflag" but deprecate its shortname "n".
-```go
-// deprecate a flag shorthand by specifying its flag name and a usage message
-flags.MarkShorthandDeprecated("noshorthandflag", "please use --noshorthandflag only")
-```
-This hides the shortname "n" from help text, and prints `Flag shorthand -n has been deprecated, please use --noshorthandflag only` when the shorthand "n" is used.
-
-Note that usage message is essential here, and it should not be empty.
-
-## Hidden flags
-It is possible to mark a flag as hidden, meaning it will still function as normal, however will not show up in usage/help text.
-
-**Example**: You have a flag named "secretFlag" that you need for internal use only and don't want it showing up in help text, or for its usage text to be available.
-```go
-// hide a flag by specifying its name
-flags.MarkHidden("secretFlag")
-```
-
-## Disable sorting of flags
-`pflag` allows you to disable sorting of flags for help and usage message.
-
-**Example**:
-```go
-flags.BoolP("verbose", "v", false, "verbose output")
-flags.String("coolflag", "yeaah", "it's really cool flag")
-flags.Int("usefulflag", 777, "sometimes it's very useful")
-flags.SortFlags = false
-flags.PrintDefaults()
-```
-**Output**:
-```
- -v, --verbose verbose output
- --coolflag string it's really cool flag (default "yeaah")
- --usefulflag int sometimes it's very useful (default 777)
-```
-
-
-## Supporting Go flags when using pflag
-In order to support flags defined using Go's `flag` package, they must be added to the `pflag` flagset. This is usually necessary
-to support flags defined by third-party dependencies (e.g. `golang/glog`).
-
-**Example**: You want to add the Go flags to the `CommandLine` flagset
-```go
-import (
- goflag "flag"
- flag "github.com/spf13/pflag"
-)
-
-var ip *int = flag.Int("flagname", 1234, "help message for flagname")
-
-func main() {
- flag.CommandLine.AddGoFlagSet(goflag.CommandLine)
- flag.Parse()
-}
-```
-
-## More info
-
-You can see the full reference documentation of the pflag package
-[at godoc.org][3], or through go's standard documentation system by
-running `godoc -http=:6060` and browsing to
-[http://localhost:6060/pkg/github.com/spf13/pflag][2] after
-installation.
-
-[2]: http://localhost:6060/pkg/github.com/spf13/pflag
-[3]: http://godoc.org/github.com/spf13/pflag
diff --git a/vendor/github.com/spf13/pflag/bool.go b/vendor/github.com/spf13/pflag/bool.go
deleted file mode 100644
index c4c5c0bf..00000000
--- a/vendor/github.com/spf13/pflag/bool.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package pflag
-
-import "strconv"
-
-// optional interface to indicate boolean flags that can be
-// supplied without "=value" text
-type boolFlag interface {
- Value
- IsBoolFlag() bool
-}
-
-// -- bool Value
-type boolValue bool
-
-func newBoolValue(val bool, p *bool) *boolValue {
- *p = val
- return (*boolValue)(p)
-}
-
-func (b *boolValue) Set(s string) error {
- v, err := strconv.ParseBool(s)
- *b = boolValue(v)
- return err
-}
-
-func (b *boolValue) Type() string {
- return "bool"
-}
-
-func (b *boolValue) String() string { return strconv.FormatBool(bool(*b)) }
-
-func (b *boolValue) IsBoolFlag() bool { return true }
-
-func boolConv(sval string) (interface{}, error) {
- return strconv.ParseBool(sval)
-}
-
-// GetBool return the bool value of a flag with the given name
-func (f *FlagSet) GetBool(name string) (bool, error) {
- val, err := f.getFlagType(name, "bool", boolConv)
- if err != nil {
- return false, err
- }
- return val.(bool), nil
-}
-
-// BoolVar defines a bool flag with specified name, default value, and usage string.
-// The argument p points to a bool variable in which to store the value of the flag.
-func (f *FlagSet) BoolVar(p *bool, name string, value bool, usage string) {
- f.BoolVarP(p, name, "", value, usage)
-}
-
-// BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BoolVarP(p *bool, name, shorthand string, value bool, usage string) {
- flag := f.VarPF(newBoolValue(value, p), name, shorthand, usage)
- flag.NoOptDefVal = "true"
-}
-
-// BoolVar defines a bool flag with specified name, default value, and usage string.
-// The argument p points to a bool variable in which to store the value of the flag.
-func BoolVar(p *bool, name string, value bool, usage string) {
- BoolVarP(p, name, "", value, usage)
-}
-
-// BoolVarP is like BoolVar, but accepts a shorthand letter that can be used after a single dash.
-func BoolVarP(p *bool, name, shorthand string, value bool, usage string) {
- flag := CommandLine.VarPF(newBoolValue(value, p), name, shorthand, usage)
- flag.NoOptDefVal = "true"
-}
-
-// Bool defines a bool flag with specified name, default value, and usage string.
-// The return value is the address of a bool variable that stores the value of the flag.
-func (f *FlagSet) Bool(name string, value bool, usage string) *bool {
- return f.BoolP(name, "", value, usage)
-}
-
-// BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BoolP(name, shorthand string, value bool, usage string) *bool {
- p := new(bool)
- f.BoolVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Bool defines a bool flag with specified name, default value, and usage string.
-// The return value is the address of a bool variable that stores the value of the flag.
-func Bool(name string, value bool, usage string) *bool {
- return BoolP(name, "", value, usage)
-}
-
-// BoolP is like Bool, but accepts a shorthand letter that can be used after a single dash.
-func BoolP(name, shorthand string, value bool, usage string) *bool {
- b := CommandLine.BoolP(name, shorthand, value, usage)
- return b
-}
diff --git a/vendor/github.com/spf13/pflag/bool_slice.go b/vendor/github.com/spf13/pflag/bool_slice.go
deleted file mode 100644
index 5af02f1a..00000000
--- a/vendor/github.com/spf13/pflag/bool_slice.go
+++ /dev/null
@@ -1,147 +0,0 @@
-package pflag
-
-import (
- "io"
- "strconv"
- "strings"
-)
-
-// -- boolSlice Value
-type boolSliceValue struct {
- value *[]bool
- changed bool
-}
-
-func newBoolSliceValue(val []bool, p *[]bool) *boolSliceValue {
- bsv := new(boolSliceValue)
- bsv.value = p
- *bsv.value = val
- return bsv
-}
-
-// Set converts, and assigns, the comma-separated boolean argument string representation as the []bool value of this flag.
-// If Set is called on a flag that already has a []bool assigned, the newly converted values will be appended.
-func (s *boolSliceValue) Set(val string) error {
-
- // remove all quote characters
- rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "")
-
- // read flag arguments with CSV parser
- boolStrSlice, err := readAsCSV(rmQuote.Replace(val))
- if err != nil && err != io.EOF {
- return err
- }
-
- // parse boolean values into slice
- out := make([]bool, 0, len(boolStrSlice))
- for _, boolStr := range boolStrSlice {
- b, err := strconv.ParseBool(strings.TrimSpace(boolStr))
- if err != nil {
- return err
- }
- out = append(out, b)
- }
-
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
-
- s.changed = true
-
- return nil
-}
-
-// Type returns a string that uniquely represents this flag's type.
-func (s *boolSliceValue) Type() string {
- return "boolSlice"
-}
-
-// String defines a "native" format for this boolean slice flag value.
-func (s *boolSliceValue) String() string {
-
- boolStrSlice := make([]string, len(*s.value))
- for i, b := range *s.value {
- boolStrSlice[i] = strconv.FormatBool(b)
- }
-
- out, _ := writeAsCSV(boolStrSlice)
-
- return "[" + out + "]"
-}
-
-func boolSliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []bool{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]bool, len(ss))
- for i, t := range ss {
- var err error
- out[i], err = strconv.ParseBool(t)
- if err != nil {
- return nil, err
- }
- }
- return out, nil
-}
-
-// GetBoolSlice returns the []bool value of a flag with the given name.
-func (f *FlagSet) GetBoolSlice(name string) ([]bool, error) {
- val, err := f.getFlagType(name, "boolSlice", boolSliceConv)
- if err != nil {
- return []bool{}, err
- }
- return val.([]bool), nil
-}
-
-// BoolSliceVar defines a boolSlice flag with specified name, default value, and usage string.
-// The argument p points to a []bool variable in which to store the value of the flag.
-func (f *FlagSet) BoolSliceVar(p *[]bool, name string, value []bool, usage string) {
- f.VarP(newBoolSliceValue(value, p), name, "", usage)
-}
-
-// BoolSliceVarP is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BoolSliceVarP(p *[]bool, name, shorthand string, value []bool, usage string) {
- f.VarP(newBoolSliceValue(value, p), name, shorthand, usage)
-}
-
-// BoolSliceVar defines a []bool flag with specified name, default value, and usage string.
-// The argument p points to a []bool variable in which to store the value of the flag.
-func BoolSliceVar(p *[]bool, name string, value []bool, usage string) {
- CommandLine.VarP(newBoolSliceValue(value, p), name, "", usage)
-}
-
-// BoolSliceVarP is like BoolSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func BoolSliceVarP(p *[]bool, name, shorthand string, value []bool, usage string) {
- CommandLine.VarP(newBoolSliceValue(value, p), name, shorthand, usage)
-}
-
-// BoolSlice defines a []bool flag with specified name, default value, and usage string.
-// The return value is the address of a []bool variable that stores the value of the flag.
-func (f *FlagSet) BoolSlice(name string, value []bool, usage string) *[]bool {
- p := []bool{}
- f.BoolSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// BoolSliceP is like BoolSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BoolSliceP(name, shorthand string, value []bool, usage string) *[]bool {
- p := []bool{}
- f.BoolSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// BoolSlice defines a []bool flag with specified name, default value, and usage string.
-// The return value is the address of a []bool variable that stores the value of the flag.
-func BoolSlice(name string, value []bool, usage string) *[]bool {
- return CommandLine.BoolSliceP(name, "", value, usage)
-}
-
-// BoolSliceP is like BoolSlice, but accepts a shorthand letter that can be used after a single dash.
-func BoolSliceP(name, shorthand string, value []bool, usage string) *[]bool {
- return CommandLine.BoolSliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/bytes.go b/vendor/github.com/spf13/pflag/bytes.go
deleted file mode 100644
index 12c58db9..00000000
--- a/vendor/github.com/spf13/pflag/bytes.go
+++ /dev/null
@@ -1,105 +0,0 @@
-package pflag
-
-import (
- "encoding/hex"
- "fmt"
- "strings"
-)
-
-// BytesHex adapts []byte for use as a flag. Value of flag is HEX encoded
-type bytesHexValue []byte
-
-func (bytesHex bytesHexValue) String() string {
- return fmt.Sprintf("%X", []byte(bytesHex))
-}
-
-func (bytesHex *bytesHexValue) Set(value string) error {
- bin, err := hex.DecodeString(strings.TrimSpace(value))
-
- if err != nil {
- return err
- }
-
- *bytesHex = bin
-
- return nil
-}
-
-func (*bytesHexValue) Type() string {
- return "bytesHex"
-}
-
-func newBytesHexValue(val []byte, p *[]byte) *bytesHexValue {
- *p = val
- return (*bytesHexValue)(p)
-}
-
-func bytesHexConv(sval string) (interface{}, error) {
-
- bin, err := hex.DecodeString(sval)
-
- if err == nil {
- return bin, nil
- }
-
- return nil, fmt.Errorf("invalid string being converted to Bytes: %s %s", sval, err)
-}
-
-// GetBytesHex return the []byte value of a flag with the given name
-func (f *FlagSet) GetBytesHex(name string) ([]byte, error) {
- val, err := f.getFlagType(name, "bytesHex", bytesHexConv)
-
- if err != nil {
- return []byte{}, err
- }
-
- return val.([]byte), nil
-}
-
-// BytesHexVar defines an []byte flag with specified name, default value, and usage string.
-// The argument p points to an []byte variable in which to store the value of the flag.
-func (f *FlagSet) BytesHexVar(p *[]byte, name string, value []byte, usage string) {
- f.VarP(newBytesHexValue(value, p), name, "", usage)
-}
-
-// BytesHexVarP is like BytesHexVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BytesHexVarP(p *[]byte, name, shorthand string, value []byte, usage string) {
- f.VarP(newBytesHexValue(value, p), name, shorthand, usage)
-}
-
-// BytesHexVar defines an []byte flag with specified name, default value, and usage string.
-// The argument p points to an []byte variable in which to store the value of the flag.
-func BytesHexVar(p *[]byte, name string, value []byte, usage string) {
- CommandLine.VarP(newBytesHexValue(value, p), name, "", usage)
-}
-
-// BytesHexVarP is like BytesHexVar, but accepts a shorthand letter that can be used after a single dash.
-func BytesHexVarP(p *[]byte, name, shorthand string, value []byte, usage string) {
- CommandLine.VarP(newBytesHexValue(value, p), name, shorthand, usage)
-}
-
-// BytesHex defines an []byte flag with specified name, default value, and usage string.
-// The return value is the address of an []byte variable that stores the value of the flag.
-func (f *FlagSet) BytesHex(name string, value []byte, usage string) *[]byte {
- p := new([]byte)
- f.BytesHexVarP(p, name, "", value, usage)
- return p
-}
-
-// BytesHexP is like BytesHex, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) BytesHexP(name, shorthand string, value []byte, usage string) *[]byte {
- p := new([]byte)
- f.BytesHexVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// BytesHex defines an []byte flag with specified name, default value, and usage string.
-// The return value is the address of an []byte variable that stores the value of the flag.
-func BytesHex(name string, value []byte, usage string) *[]byte {
- return CommandLine.BytesHexP(name, "", value, usage)
-}
-
-// BytesHexP is like BytesHex, but accepts a shorthand letter that can be used after a single dash.
-func BytesHexP(name, shorthand string, value []byte, usage string) *[]byte {
- return CommandLine.BytesHexP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/count.go b/vendor/github.com/spf13/pflag/count.go
deleted file mode 100644
index aa126e44..00000000
--- a/vendor/github.com/spf13/pflag/count.go
+++ /dev/null
@@ -1,96 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- count Value
-type countValue int
-
-func newCountValue(val int, p *int) *countValue {
- *p = val
- return (*countValue)(p)
-}
-
-func (i *countValue) Set(s string) error {
- // "+1" means that no specific value was passed, so increment
- if s == "+1" {
- *i = countValue(*i + 1)
- return nil
- }
- v, err := strconv.ParseInt(s, 0, 0)
- *i = countValue(v)
- return err
-}
-
-func (i *countValue) Type() string {
- return "count"
-}
-
-func (i *countValue) String() string { return strconv.Itoa(int(*i)) }
-
-func countConv(sval string) (interface{}, error) {
- i, err := strconv.Atoi(sval)
- if err != nil {
- return nil, err
- }
- return i, nil
-}
-
-// GetCount return the int value of a flag with the given name
-func (f *FlagSet) GetCount(name string) (int, error) {
- val, err := f.getFlagType(name, "count", countConv)
- if err != nil {
- return 0, err
- }
- return val.(int), nil
-}
-
-// CountVar defines a count flag with specified name, default value, and usage string.
-// The argument p points to an int variable in which to store the value of the flag.
-// A count flag will add 1 to its value evey time it is found on the command line
-func (f *FlagSet) CountVar(p *int, name string, usage string) {
- f.CountVarP(p, name, "", usage)
-}
-
-// CountVarP is like CountVar only take a shorthand for the flag name.
-func (f *FlagSet) CountVarP(p *int, name, shorthand string, usage string) {
- flag := f.VarPF(newCountValue(0, p), name, shorthand, usage)
- flag.NoOptDefVal = "+1"
-}
-
-// CountVar like CountVar only the flag is placed on the CommandLine instead of a given flag set
-func CountVar(p *int, name string, usage string) {
- CommandLine.CountVar(p, name, usage)
-}
-
-// CountVarP is like CountVar only take a shorthand for the flag name.
-func CountVarP(p *int, name, shorthand string, usage string) {
- CommandLine.CountVarP(p, name, shorthand, usage)
-}
-
-// Count defines a count flag with specified name, default value, and usage string.
-// The return value is the address of an int variable that stores the value of the flag.
-// A count flag will add 1 to its value evey time it is found on the command line
-func (f *FlagSet) Count(name string, usage string) *int {
- p := new(int)
- f.CountVarP(p, name, "", usage)
- return p
-}
-
-// CountP is like Count only takes a shorthand for the flag name.
-func (f *FlagSet) CountP(name, shorthand string, usage string) *int {
- p := new(int)
- f.CountVarP(p, name, shorthand, usage)
- return p
-}
-
-// Count defines a count flag with specified name, default value, and usage string.
-// The return value is the address of an int variable that stores the value of the flag.
-// A count flag will add 1 to its value evey time it is found on the command line
-func Count(name string, usage string) *int {
- return CommandLine.CountP(name, "", usage)
-}
-
-// CountP is like Count only takes a shorthand for the flag name.
-func CountP(name, shorthand string, usage string) *int {
- return CommandLine.CountP(name, shorthand, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/duration.go b/vendor/github.com/spf13/pflag/duration.go
deleted file mode 100644
index e9debef8..00000000
--- a/vendor/github.com/spf13/pflag/duration.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package pflag
-
-import (
- "time"
-)
-
-// -- time.Duration Value
-type durationValue time.Duration
-
-func newDurationValue(val time.Duration, p *time.Duration) *durationValue {
- *p = val
- return (*durationValue)(p)
-}
-
-func (d *durationValue) Set(s string) error {
- v, err := time.ParseDuration(s)
- *d = durationValue(v)
- return err
-}
-
-func (d *durationValue) Type() string {
- return "duration"
-}
-
-func (d *durationValue) String() string { return (*time.Duration)(d).String() }
-
-func durationConv(sval string) (interface{}, error) {
- return time.ParseDuration(sval)
-}
-
-// GetDuration return the duration value of a flag with the given name
-func (f *FlagSet) GetDuration(name string) (time.Duration, error) {
- val, err := f.getFlagType(name, "duration", durationConv)
- if err != nil {
- return 0, err
- }
- return val.(time.Duration), nil
-}
-
-// DurationVar defines a time.Duration flag with specified name, default value, and usage string.
-// The argument p points to a time.Duration variable in which to store the value of the flag.
-func (f *FlagSet) DurationVar(p *time.Duration, name string, value time.Duration, usage string) {
- f.VarP(newDurationValue(value, p), name, "", usage)
-}
-
-// DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) DurationVarP(p *time.Duration, name, shorthand string, value time.Duration, usage string) {
- f.VarP(newDurationValue(value, p), name, shorthand, usage)
-}
-
-// DurationVar defines a time.Duration flag with specified name, default value, and usage string.
-// The argument p points to a time.Duration variable in which to store the value of the flag.
-func DurationVar(p *time.Duration, name string, value time.Duration, usage string) {
- CommandLine.VarP(newDurationValue(value, p), name, "", usage)
-}
-
-// DurationVarP is like DurationVar, but accepts a shorthand letter that can be used after a single dash.
-func DurationVarP(p *time.Duration, name, shorthand string, value time.Duration, usage string) {
- CommandLine.VarP(newDurationValue(value, p), name, shorthand, usage)
-}
-
-// Duration defines a time.Duration flag with specified name, default value, and usage string.
-// The return value is the address of a time.Duration variable that stores the value of the flag.
-func (f *FlagSet) Duration(name string, value time.Duration, usage string) *time.Duration {
- p := new(time.Duration)
- f.DurationVarP(p, name, "", value, usage)
- return p
-}
-
-// DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration {
- p := new(time.Duration)
- f.DurationVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Duration defines a time.Duration flag with specified name, default value, and usage string.
-// The return value is the address of a time.Duration variable that stores the value of the flag.
-func Duration(name string, value time.Duration, usage string) *time.Duration {
- return CommandLine.DurationP(name, "", value, usage)
-}
-
-// DurationP is like Duration, but accepts a shorthand letter that can be used after a single dash.
-func DurationP(name, shorthand string, value time.Duration, usage string) *time.Duration {
- return CommandLine.DurationP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/duration_slice.go b/vendor/github.com/spf13/pflag/duration_slice.go
deleted file mode 100644
index 52c6b6dc..00000000
--- a/vendor/github.com/spf13/pflag/duration_slice.go
+++ /dev/null
@@ -1,128 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "strings"
- "time"
-)
-
-// -- durationSlice Value
-type durationSliceValue struct {
- value *[]time.Duration
- changed bool
-}
-
-func newDurationSliceValue(val []time.Duration, p *[]time.Duration) *durationSliceValue {
- dsv := new(durationSliceValue)
- dsv.value = p
- *dsv.value = val
- return dsv
-}
-
-func (s *durationSliceValue) Set(val string) error {
- ss := strings.Split(val, ",")
- out := make([]time.Duration, len(ss))
- for i, d := range ss {
- var err error
- out[i], err = time.ParseDuration(d)
- if err != nil {
- return err
- }
-
- }
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
- s.changed = true
- return nil
-}
-
-func (s *durationSliceValue) Type() string {
- return "durationSlice"
-}
-
-func (s *durationSliceValue) String() string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = fmt.Sprintf("%s", d)
- }
- return "[" + strings.Join(out, ",") + "]"
-}
-
-func durationSliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []time.Duration{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]time.Duration, len(ss))
- for i, d := range ss {
- var err error
- out[i], err = time.ParseDuration(d)
- if err != nil {
- return nil, err
- }
-
- }
- return out, nil
-}
-
-// GetDurationSlice returns the []time.Duration value of a flag with the given name
-func (f *FlagSet) GetDurationSlice(name string) ([]time.Duration, error) {
- val, err := f.getFlagType(name, "durationSlice", durationSliceConv)
- if err != nil {
- return []time.Duration{}, err
- }
- return val.([]time.Duration), nil
-}
-
-// DurationSliceVar defines a durationSlice flag with specified name, default value, and usage string.
-// The argument p points to a []time.Duration variable in which to store the value of the flag.
-func (f *FlagSet) DurationSliceVar(p *[]time.Duration, name string, value []time.Duration, usage string) {
- f.VarP(newDurationSliceValue(value, p), name, "", usage)
-}
-
-// DurationSliceVarP is like DurationSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) DurationSliceVarP(p *[]time.Duration, name, shorthand string, value []time.Duration, usage string) {
- f.VarP(newDurationSliceValue(value, p), name, shorthand, usage)
-}
-
-// DurationSliceVar defines a duration[] flag with specified name, default value, and usage string.
-// The argument p points to a duration[] variable in which to store the value of the flag.
-func DurationSliceVar(p *[]time.Duration, name string, value []time.Duration, usage string) {
- CommandLine.VarP(newDurationSliceValue(value, p), name, "", usage)
-}
-
-// DurationSliceVarP is like DurationSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func DurationSliceVarP(p *[]time.Duration, name, shorthand string, value []time.Duration, usage string) {
- CommandLine.VarP(newDurationSliceValue(value, p), name, shorthand, usage)
-}
-
-// DurationSlice defines a []time.Duration flag with specified name, default value, and usage string.
-// The return value is the address of a []time.Duration variable that stores the value of the flag.
-func (f *FlagSet) DurationSlice(name string, value []time.Duration, usage string) *[]time.Duration {
- p := []time.Duration{}
- f.DurationSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// DurationSliceP is like DurationSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) DurationSliceP(name, shorthand string, value []time.Duration, usage string) *[]time.Duration {
- p := []time.Duration{}
- f.DurationSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// DurationSlice defines a []time.Duration flag with specified name, default value, and usage string.
-// The return value is the address of a []time.Duration variable that stores the value of the flag.
-func DurationSlice(name string, value []time.Duration, usage string) *[]time.Duration {
- return CommandLine.DurationSliceP(name, "", value, usage)
-}
-
-// DurationSliceP is like DurationSlice, but accepts a shorthand letter that can be used after a single dash.
-func DurationSliceP(name, shorthand string, value []time.Duration, usage string) *[]time.Duration {
- return CommandLine.DurationSliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/flag.go b/vendor/github.com/spf13/pflag/flag.go
deleted file mode 100644
index 5eadc84e..00000000
--- a/vendor/github.com/spf13/pflag/flag.go
+++ /dev/null
@@ -1,1223 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-/*
-Package pflag is a drop-in replacement for Go's flag package, implementing
-POSIX/GNU-style --flags.
-
-pflag is compatible with the GNU extensions to the POSIX recommendations
-for command-line options. See
-http://www.gnu.org/software/libc/manual/html_node/Argument-Syntax.html
-
-Usage:
-
-pflag is a drop-in replacement of Go's native flag package. If you import
-pflag under the name "flag" then all code should continue to function
-with no changes.
-
- import flag "github.com/spf13/pflag"
-
-There is one exception to this: if you directly instantiate the Flag struct
-there is one more field "Shorthand" that you will need to set.
-Most code never instantiates this struct directly, and instead uses
-functions such as String(), BoolVar(), and Var(), and is therefore
-unaffected.
-
-Define flags using flag.String(), Bool(), Int(), etc.
-
-This declares an integer flag, -flagname, stored in the pointer ip, with type *int.
- var ip = flag.Int("flagname", 1234, "help message for flagname")
-If you like, you can bind the flag to a variable using the Var() functions.
- var flagvar int
- func init() {
- flag.IntVar(&flagvar, "flagname", 1234, "help message for flagname")
- }
-Or you can create custom flags that satisfy the Value interface (with
-pointer receivers) and couple them to flag parsing by
- flag.Var(&flagVal, "name", "help message for flagname")
-For such flags, the default value is just the initial value of the variable.
-
-After all flags are defined, call
- flag.Parse()
-to parse the command line into the defined flags.
-
-Flags may then be used directly. If you're using the flags themselves,
-they are all pointers; if you bind to variables, they're values.
- fmt.Println("ip has value ", *ip)
- fmt.Println("flagvar has value ", flagvar)
-
-After parsing, the arguments after the flag are available as the
-slice flag.Args() or individually as flag.Arg(i).
-The arguments are indexed from 0 through flag.NArg()-1.
-
-The pflag package also defines some new functions that are not in flag,
-that give one-letter shorthands for flags. You can use these by appending
-'P' to the name of any function that defines a flag.
- var ip = flag.IntP("flagname", "f", 1234, "help message")
- var flagvar bool
- func init() {
- flag.BoolVarP("boolname", "b", true, "help message")
- }
- flag.VarP(&flagVar, "varname", "v", 1234, "help message")
-Shorthand letters can be used with single dashes on the command line.
-Boolean shorthand flags can be combined with other shorthand flags.
-
-Command line flag syntax:
- --flag // boolean flags only
- --flag=x
-
-Unlike the flag package, a single dash before an option means something
-different than a double dash. Single dashes signify a series of shorthand
-letters for flags. All but the last shorthand letter must be boolean flags.
- // boolean flags
- -f
- -abc
- // non-boolean flags
- -n 1234
- -Ifile
- // mixed
- -abcs "hello"
- -abcn1234
-
-Flag parsing stops after the terminator "--". Unlike the flag package,
-flags can be interspersed with arguments anywhere on the command line
-before this terminator.
-
-Integer flags accept 1234, 0664, 0x1234 and may be negative.
-Boolean flags (in their long form) accept 1, 0, t, f, true, false,
-TRUE, FALSE, True, False.
-Duration flags accept any input valid for time.ParseDuration.
-
-The default set of command-line flags is controlled by
-top-level functions. The FlagSet type allows one to define
-independent sets of flags, such as to implement subcommands
-in a command-line interface. The methods of FlagSet are
-analogous to the top-level functions for the command-line
-flag set.
-*/
-package pflag
-
-import (
- "bytes"
- "errors"
- goflag "flag"
- "fmt"
- "io"
- "os"
- "sort"
- "strings"
-)
-
-// ErrHelp is the error returned if the flag -help is invoked but no such flag is defined.
-var ErrHelp = errors.New("pflag: help requested")
-
-// ErrorHandling defines how to handle flag parsing errors.
-type ErrorHandling int
-
-const (
- // ContinueOnError will return an err from Parse() if an error is found
- ContinueOnError ErrorHandling = iota
- // ExitOnError will call os.Exit(2) if an error is found when parsing
- ExitOnError
- // PanicOnError will panic() if an error is found when parsing flags
- PanicOnError
-)
-
-// ParseErrorsWhitelist defines the parsing errors that can be ignored
-type ParseErrorsWhitelist struct {
- // UnknownFlags will ignore unknown flags errors and continue parsing rest of the flags
- UnknownFlags bool
-}
-
-// NormalizedName is a flag name that has been normalized according to rules
-// for the FlagSet (e.g. making '-' and '_' equivalent).
-type NormalizedName string
-
-// A FlagSet represents a set of defined flags.
-type FlagSet struct {
- // Usage is the function called when an error occurs while parsing flags.
- // The field is a function (not a method) that may be changed to point to
- // a custom error handler.
- Usage func()
-
- // SortFlags is used to indicate, if user wants to have sorted flags in
- // help/usage messages.
- SortFlags bool
-
- // ParseErrorsWhitelist is used to configure a whitelist of errors
- ParseErrorsWhitelist ParseErrorsWhitelist
-
- name string
- parsed bool
- actual map[NormalizedName]*Flag
- orderedActual []*Flag
- sortedActual []*Flag
- formal map[NormalizedName]*Flag
- orderedFormal []*Flag
- sortedFormal []*Flag
- shorthands map[byte]*Flag
- args []string // arguments after flags
- argsLenAtDash int // len(args) when a '--' was located when parsing, or -1 if no --
- errorHandling ErrorHandling
- output io.Writer // nil means stderr; use out() accessor
- interspersed bool // allow interspersed option/non-option args
- normalizeNameFunc func(f *FlagSet, name string) NormalizedName
-
- addedGoFlagSets []*goflag.FlagSet
-}
-
-// A Flag represents the state of a flag.
-type Flag struct {
- Name string // name as it appears on command line
- Shorthand string // one-letter abbreviated flag
- Usage string // help message
- Value Value // value as set
- DefValue string // default value (as text); for usage message
- Changed bool // If the user set the value (or if left to default)
- NoOptDefVal string // default value (as text); if the flag is on the command line without any options
- Deprecated string // If this flag is deprecated, this string is the new or now thing to use
- Hidden bool // used by cobra.Command to allow flags to be hidden from help/usage text
- ShorthandDeprecated string // If the shorthand of this flag is deprecated, this string is the new or now thing to use
- Annotations map[string][]string // used by cobra.Command bash autocomple code
-}
-
-// Value is the interface to the dynamic value stored in a flag.
-// (The default value is represented as a string.)
-type Value interface {
- String() string
- Set(string) error
- Type() string
-}
-
-// sortFlags returns the flags as a slice in lexicographical sorted order.
-func sortFlags(flags map[NormalizedName]*Flag) []*Flag {
- list := make(sort.StringSlice, len(flags))
- i := 0
- for k := range flags {
- list[i] = string(k)
- i++
- }
- list.Sort()
- result := make([]*Flag, len(list))
- for i, name := range list {
- result[i] = flags[NormalizedName(name)]
- }
- return result
-}
-
-// SetNormalizeFunc allows you to add a function which can translate flag names.
-// Flags added to the FlagSet will be translated and then when anything tries to
-// look up the flag that will also be translated. So it would be possible to create
-// a flag named "getURL" and have it translated to "geturl". A user could then pass
-// "--getUrl" which may also be translated to "geturl" and everything will work.
-func (f *FlagSet) SetNormalizeFunc(n func(f *FlagSet, name string) NormalizedName) {
- f.normalizeNameFunc = n
- f.sortedFormal = f.sortedFormal[:0]
- for fname, flag := range f.formal {
- nname := f.normalizeFlagName(flag.Name)
- if fname == nname {
- continue
- }
- flag.Name = string(nname)
- delete(f.formal, fname)
- f.formal[nname] = flag
- if _, set := f.actual[fname]; set {
- delete(f.actual, fname)
- f.actual[nname] = flag
- }
- }
-}
-
-// GetNormalizeFunc returns the previously set NormalizeFunc of a function which
-// does no translation, if not set previously.
-func (f *FlagSet) GetNormalizeFunc() func(f *FlagSet, name string) NormalizedName {
- if f.normalizeNameFunc != nil {
- return f.normalizeNameFunc
- }
- return func(f *FlagSet, name string) NormalizedName { return NormalizedName(name) }
-}
-
-func (f *FlagSet) normalizeFlagName(name string) NormalizedName {
- n := f.GetNormalizeFunc()
- return n(f, name)
-}
-
-func (f *FlagSet) out() io.Writer {
- if f.output == nil {
- return os.Stderr
- }
- return f.output
-}
-
-// SetOutput sets the destination for usage and error messages.
-// If output is nil, os.Stderr is used.
-func (f *FlagSet) SetOutput(output io.Writer) {
- f.output = output
-}
-
-// VisitAll visits the flags in lexicographical order or
-// in primordial order if f.SortFlags is false, calling fn for each.
-// It visits all flags, even those not set.
-func (f *FlagSet) VisitAll(fn func(*Flag)) {
- if len(f.formal) == 0 {
- return
- }
-
- var flags []*Flag
- if f.SortFlags {
- if len(f.formal) != len(f.sortedFormal) {
- f.sortedFormal = sortFlags(f.formal)
- }
- flags = f.sortedFormal
- } else {
- flags = f.orderedFormal
- }
-
- for _, flag := range flags {
- fn(flag)
- }
-}
-
-// HasFlags returns a bool to indicate if the FlagSet has any flags defined.
-func (f *FlagSet) HasFlags() bool {
- return len(f.formal) > 0
-}
-
-// HasAvailableFlags returns a bool to indicate if the FlagSet has any flags
-// that are not hidden.
-func (f *FlagSet) HasAvailableFlags() bool {
- for _, flag := range f.formal {
- if !flag.Hidden {
- return true
- }
- }
- return false
-}
-
-// VisitAll visits the command-line flags in lexicographical order or
-// in primordial order if f.SortFlags is false, calling fn for each.
-// It visits all flags, even those not set.
-func VisitAll(fn func(*Flag)) {
- CommandLine.VisitAll(fn)
-}
-
-// Visit visits the flags in lexicographical order or
-// in primordial order if f.SortFlags is false, calling fn for each.
-// It visits only those flags that have been set.
-func (f *FlagSet) Visit(fn func(*Flag)) {
- if len(f.actual) == 0 {
- return
- }
-
- var flags []*Flag
- if f.SortFlags {
- if len(f.actual) != len(f.sortedActual) {
- f.sortedActual = sortFlags(f.actual)
- }
- flags = f.sortedActual
- } else {
- flags = f.orderedActual
- }
-
- for _, flag := range flags {
- fn(flag)
- }
-}
-
-// Visit visits the command-line flags in lexicographical order or
-// in primordial order if f.SortFlags is false, calling fn for each.
-// It visits only those flags that have been set.
-func Visit(fn func(*Flag)) {
- CommandLine.Visit(fn)
-}
-
-// Lookup returns the Flag structure of the named flag, returning nil if none exists.
-func (f *FlagSet) Lookup(name string) *Flag {
- return f.lookup(f.normalizeFlagName(name))
-}
-
-// ShorthandLookup returns the Flag structure of the short handed flag,
-// returning nil if none exists.
-// It panics, if len(name) > 1.
-func (f *FlagSet) ShorthandLookup(name string) *Flag {
- if name == "" {
- return nil
- }
- if len(name) > 1 {
- msg := fmt.Sprintf("can not look up shorthand which is more than one ASCII character: %q", name)
- fmt.Fprintf(f.out(), msg)
- panic(msg)
- }
- c := name[0]
- return f.shorthands[c]
-}
-
-// lookup returns the Flag structure of the named flag, returning nil if none exists.
-func (f *FlagSet) lookup(name NormalizedName) *Flag {
- return f.formal[name]
-}
-
-// func to return a given type for a given flag name
-func (f *FlagSet) getFlagType(name string, ftype string, convFunc func(sval string) (interface{}, error)) (interface{}, error) {
- flag := f.Lookup(name)
- if flag == nil {
- err := fmt.Errorf("flag accessed but not defined: %s", name)
- return nil, err
- }
-
- if flag.Value.Type() != ftype {
- err := fmt.Errorf("trying to get %s value of flag of type %s", ftype, flag.Value.Type())
- return nil, err
- }
-
- sval := flag.Value.String()
- result, err := convFunc(sval)
- if err != nil {
- return nil, err
- }
- return result, nil
-}
-
-// ArgsLenAtDash will return the length of f.Args at the moment when a -- was
-// found during arg parsing. This allows your program to know which args were
-// before the -- and which came after.
-func (f *FlagSet) ArgsLenAtDash() int {
- return f.argsLenAtDash
-}
-
-// MarkDeprecated indicated that a flag is deprecated in your program. It will
-// continue to function but will not show up in help or usage messages. Using
-// this flag will also print the given usageMessage.
-func (f *FlagSet) MarkDeprecated(name string, usageMessage string) error {
- flag := f.Lookup(name)
- if flag == nil {
- return fmt.Errorf("flag %q does not exist", name)
- }
- if usageMessage == "" {
- return fmt.Errorf("deprecated message for flag %q must be set", name)
- }
- flag.Deprecated = usageMessage
- flag.Hidden = true
- return nil
-}
-
-// MarkShorthandDeprecated will mark the shorthand of a flag deprecated in your
-// program. It will continue to function but will not show up in help or usage
-// messages. Using this flag will also print the given usageMessage.
-func (f *FlagSet) MarkShorthandDeprecated(name string, usageMessage string) error {
- flag := f.Lookup(name)
- if flag == nil {
- return fmt.Errorf("flag %q does not exist", name)
- }
- if usageMessage == "" {
- return fmt.Errorf("deprecated message for flag %q must be set", name)
- }
- flag.ShorthandDeprecated = usageMessage
- return nil
-}
-
-// MarkHidden sets a flag to 'hidden' in your program. It will continue to
-// function but will not show up in help or usage messages.
-func (f *FlagSet) MarkHidden(name string) error {
- flag := f.Lookup(name)
- if flag == nil {
- return fmt.Errorf("flag %q does not exist", name)
- }
- flag.Hidden = true
- return nil
-}
-
-// Lookup returns the Flag structure of the named command-line flag,
-// returning nil if none exists.
-func Lookup(name string) *Flag {
- return CommandLine.Lookup(name)
-}
-
-// ShorthandLookup returns the Flag structure of the short handed flag,
-// returning nil if none exists.
-func ShorthandLookup(name string) *Flag {
- return CommandLine.ShorthandLookup(name)
-}
-
-// Set sets the value of the named flag.
-func (f *FlagSet) Set(name, value string) error {
- normalName := f.normalizeFlagName(name)
- flag, ok := f.formal[normalName]
- if !ok {
- return fmt.Errorf("no such flag -%v", name)
- }
-
- err := flag.Value.Set(value)
- if err != nil {
- var flagName string
- if flag.Shorthand != "" && flag.ShorthandDeprecated == "" {
- flagName = fmt.Sprintf("-%s, --%s", flag.Shorthand, flag.Name)
- } else {
- flagName = fmt.Sprintf("--%s", flag.Name)
- }
- return fmt.Errorf("invalid argument %q for %q flag: %v", value, flagName, err)
- }
-
- if !flag.Changed {
- if f.actual == nil {
- f.actual = make(map[NormalizedName]*Flag)
- }
- f.actual[normalName] = flag
- f.orderedActual = append(f.orderedActual, flag)
-
- flag.Changed = true
- }
-
- if flag.Deprecated != "" {
- fmt.Fprintf(f.out(), "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated)
- }
- return nil
-}
-
-// SetAnnotation allows one to set arbitrary annotations on a flag in the FlagSet.
-// This is sometimes used by spf13/cobra programs which want to generate additional
-// bash completion information.
-func (f *FlagSet) SetAnnotation(name, key string, values []string) error {
- normalName := f.normalizeFlagName(name)
- flag, ok := f.formal[normalName]
- if !ok {
- return fmt.Errorf("no such flag -%v", name)
- }
- if flag.Annotations == nil {
- flag.Annotations = map[string][]string{}
- }
- flag.Annotations[key] = values
- return nil
-}
-
-// Changed returns true if the flag was explicitly set during Parse() and false
-// otherwise
-func (f *FlagSet) Changed(name string) bool {
- flag := f.Lookup(name)
- // If a flag doesn't exist, it wasn't changed....
- if flag == nil {
- return false
- }
- return flag.Changed
-}
-
-// Set sets the value of the named command-line flag.
-func Set(name, value string) error {
- return CommandLine.Set(name, value)
-}
-
-// PrintDefaults prints, to standard error unless configured
-// otherwise, the default values of all defined flags in the set.
-func (f *FlagSet) PrintDefaults() {
- usages := f.FlagUsages()
- fmt.Fprint(f.out(), usages)
-}
-
-// defaultIsZeroValue returns true if the default value for this flag represents
-// a zero value.
-func (f *Flag) defaultIsZeroValue() bool {
- switch f.Value.(type) {
- case boolFlag:
- return f.DefValue == "false"
- case *durationValue:
- // Beginning in Go 1.7, duration zero values are "0s"
- return f.DefValue == "0" || f.DefValue == "0s"
- case *intValue, *int8Value, *int32Value, *int64Value, *uintValue, *uint8Value, *uint16Value, *uint32Value, *uint64Value, *countValue, *float32Value, *float64Value:
- return f.DefValue == "0"
- case *stringValue:
- return f.DefValue == ""
- case *ipValue, *ipMaskValue, *ipNetValue:
- return f.DefValue == "<nil>"
- case *intSliceValue, *stringSliceValue, *stringArrayValue:
- return f.DefValue == "[]"
- default:
- switch f.Value.String() {
- case "false":
- return true
- case "<nil>":
- return true
- case "":
- return true
- case "0":
- return true
- }
- return false
- }
-}
-
-// UnquoteUsage extracts a back-quoted name from the usage
-// string for a flag and returns it and the un-quoted usage.
-// Given "a `name` to show" it returns ("name", "a name to show").
-// If there are no back quotes, the name is an educated guess of the
-// type of the flag's value, or the empty string if the flag is boolean.
-func UnquoteUsage(flag *Flag) (name string, usage string) {
- // Look for a back-quoted name, but avoid the strings package.
- usage = flag.Usage
- for i := 0; i < len(usage); i++ {
- if usage[i] == '`' {
- for j := i + 1; j < len(usage); j++ {
- if usage[j] == '`' {
- name = usage[i+1 : j]
- usage = usage[:i] + name + usage[j+1:]
- return name, usage
- }
- }
- break // Only one back quote; use type name.
- }
- }
-
- name = flag.Value.Type()
- switch name {
- case "bool":
- name = ""
- case "float64":
- name = "float"
- case "int64":
- name = "int"
- case "uint64":
- name = "uint"
- case "stringSlice":
- name = "strings"
- case "intSlice":
- name = "ints"
- case "uintSlice":
- name = "uints"
- case "boolSlice":
- name = "bools"
- }
-
- return
-}
-
-// Splits the string `s` on whitespace into an initial substring up to
-// `i` runes in length and the remainder. Will go `slop` over `i` if
-// that encompasses the entire string (which allows the caller to
-// avoid short orphan words on the final line).
-func wrapN(i, slop int, s string) (string, string) {
- if i+slop > len(s) {
- return s, ""
- }
-
- w := strings.LastIndexAny(s[:i], " \t\n")
- if w <= 0 {
- return s, ""
- }
- nlPos := strings.LastIndex(s[:i], "\n")
- if nlPos > 0 && nlPos < w {
- return s[:nlPos], s[nlPos+1:]
- }
- return s[:w], s[w+1:]
-}
-
-// Wraps the string `s` to a maximum width `w` with leading indent
-// `i`. The first line is not indented (this is assumed to be done by
-// caller). Pass `w` == 0 to do no wrapping
-func wrap(i, w int, s string) string {
- if w == 0 {
- return strings.Replace(s, "\n", "\n"+strings.Repeat(" ", i), -1)
- }
-
- // space between indent i and end of line width w into which
- // we should wrap the text.
- wrap := w - i
-
- var r, l string
-
- // Not enough space for sensible wrapping. Wrap as a block on
- // the next line instead.
- if wrap < 24 {
- i = 16
- wrap = w - i
- r += "\n" + strings.Repeat(" ", i)
- }
- // If still not enough space then don't even try to wrap.
- if wrap < 24 {
- return strings.Replace(s, "\n", r, -1)
- }
-
- // Try to avoid short orphan words on the final line, by
- // allowing wrapN to go a bit over if that would fit in the
- // remainder of the line.
- slop := 5
- wrap = wrap - slop
-
- // Handle first line, which is indented by the caller (or the
- // special case above)
- l, s = wrapN(wrap, slop, s)
- r = r + strings.Replace(l, "\n", "\n"+strings.Repeat(" ", i), -1)
-
- // Now wrap the rest
- for s != "" {
- var t string
-
- t, s = wrapN(wrap, slop, s)
- r = r + "\n" + strings.Repeat(" ", i) + strings.Replace(t, "\n", "\n"+strings.Repeat(" ", i), -1)
- }
-
- return r
-
-}
-
-// FlagUsagesWrapped returns a string containing the usage information
-// for all flags in the FlagSet. Wrapped to `cols` columns (0 for no
-// wrapping)
-func (f *FlagSet) FlagUsagesWrapped(cols int) string {
- buf := new(bytes.Buffer)
-
- lines := make([]string, 0, len(f.formal))
-
- maxlen := 0
- f.VisitAll(func(flag *Flag) {
- if flag.Hidden {
- return
- }
-
- line := ""
- if flag.Shorthand != "" && flag.ShorthandDeprecated == "" {
- line = fmt.Sprintf(" -%s, --%s", flag.Shorthand, flag.Name)
- } else {
- line = fmt.Sprintf(" --%s", flag.Name)
- }
-
- varname, usage := UnquoteUsage(flag)
- if varname != "" {
- line += " " + varname
- }
- if flag.NoOptDefVal != "" {
- switch flag.Value.Type() {
- case "string":
- line += fmt.Sprintf("[=\"%s\"]", flag.NoOptDefVal)
- case "bool":
- if flag.NoOptDefVal != "true" {
- line += fmt.Sprintf("[=%s]", flag.NoOptDefVal)
- }
- case "count":
- if flag.NoOptDefVal != "+1" {
- line += fmt.Sprintf("[=%s]", flag.NoOptDefVal)
- }
- default:
- line += fmt.Sprintf("[=%s]", flag.NoOptDefVal)
- }
- }
-
- // This special character will be replaced with spacing once the
- // correct alignment is calculated
- line += "\x00"
- if len(line) > maxlen {
- maxlen = len(line)
- }
-
- line += usage
- if !flag.defaultIsZeroValue() {
- if flag.Value.Type() == "string" {
- line += fmt.Sprintf(" (default %q)", flag.DefValue)
- } else {
- line += fmt.Sprintf(" (default %s)", flag.DefValue)
- }
- }
- if len(flag.Deprecated) != 0 {
- line += fmt.Sprintf(" (DEPRECATED: %s)", flag.Deprecated)
- }
-
- lines = append(lines, line)
- })
-
- for _, line := range lines {
- sidx := strings.Index(line, "\x00")
- spacing := strings.Repeat(" ", maxlen-sidx)
- // maxlen + 2 comes from + 1 for the \x00 and + 1 for the (deliberate) off-by-one in maxlen-sidx
- fmt.Fprintln(buf, line[:sidx], spacing, wrap(maxlen+2, cols, line[sidx+1:]))
- }
-
- return buf.String()
-}
-
-// FlagUsages returns a string containing the usage information for all flags in
-// the FlagSet
-func (f *FlagSet) FlagUsages() string {
- return f.FlagUsagesWrapped(0)
-}
-
-// PrintDefaults prints to standard error the default values of all defined command-line flags.
-func PrintDefaults() {
- CommandLine.PrintDefaults()
-}
-
-// defaultUsage is the default function to print a usage message.
-func defaultUsage(f *FlagSet) {
- fmt.Fprintf(f.out(), "Usage of %s:\n", f.name)
- f.PrintDefaults()
-}
-
-// NOTE: Usage is not just defaultUsage(CommandLine)
-// because it serves (via godoc flag Usage) as the example
-// for how to write your own usage function.
-
-// Usage prints to standard error a usage message documenting all defined command-line flags.
-// The function is a variable that may be changed to point to a custom function.
-// By default it prints a simple header and calls PrintDefaults; for details about the
-// format of the output and how to control it, see the documentation for PrintDefaults.
-var Usage = func() {
- fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
- PrintDefaults()
-}
-
-// NFlag returns the number of flags that have been set.
-func (f *FlagSet) NFlag() int { return len(f.actual) }
-
-// NFlag returns the number of command-line flags that have been set.
-func NFlag() int { return len(CommandLine.actual) }
-
-// Arg returns the i'th argument. Arg(0) is the first remaining argument
-// after flags have been processed.
-func (f *FlagSet) Arg(i int) string {
- if i < 0 || i >= len(f.args) {
- return ""
- }
- return f.args[i]
-}
-
-// Arg returns the i'th command-line argument. Arg(0) is the first remaining argument
-// after flags have been processed.
-func Arg(i int) string {
- return CommandLine.Arg(i)
-}
-
-// NArg is the number of arguments remaining after flags have been processed.
-func (f *FlagSet) NArg() int { return len(f.args) }
-
-// NArg is the number of arguments remaining after flags have been processed.
-func NArg() int { return len(CommandLine.args) }
-
-// Args returns the non-flag arguments.
-func (f *FlagSet) Args() []string { return f.args }
-
-// Args returns the non-flag command-line arguments.
-func Args() []string { return CommandLine.args }
-
-// Var defines a flag with the specified name and usage string. The type and
-// value of the flag are represented by the first argument, of type Value, which
-// typically holds a user-defined implementation of Value. For instance, the
-// caller could create a flag that turns a comma-separated string into a slice
-// of strings by giving the slice the methods of Value; in particular, Set would
-// decompose the comma-separated string into the slice.
-func (f *FlagSet) Var(value Value, name string, usage string) {
- f.VarP(value, name, "", usage)
-}
-
-// VarPF is like VarP, but returns the flag created
-func (f *FlagSet) VarPF(value Value, name, shorthand, usage string) *Flag {
- // Remember the default value as a string; it won't change.
- flag := &Flag{
- Name: name,
- Shorthand: shorthand,
- Usage: usage,
- Value: value,
- DefValue: value.String(),
- }
- f.AddFlag(flag)
- return flag
-}
-
-// VarP is like Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) VarP(value Value, name, shorthand, usage string) {
- f.VarPF(value, name, shorthand, usage)
-}
-
-// AddFlag will add the flag to the FlagSet
-func (f *FlagSet) AddFlag(flag *Flag) {
- normalizedFlagName := f.normalizeFlagName(flag.Name)
-
- _, alreadyThere := f.formal[normalizedFlagName]
- if alreadyThere {
- msg := fmt.Sprintf("%s flag redefined: %s", f.name, flag.Name)
- fmt.Fprintln(f.out(), msg)
- panic(msg) // Happens only if flags are declared with identical names
- }
- if f.formal == nil {
- f.formal = make(map[NormalizedName]*Flag)
- }
-
- flag.Name = string(normalizedFlagName)
- f.formal[normalizedFlagName] = flag
- f.orderedFormal = append(f.orderedFormal, flag)
-
- if flag.Shorthand == "" {
- return
- }
- if len(flag.Shorthand) > 1 {
- msg := fmt.Sprintf("%q shorthand is more than one ASCII character", flag.Shorthand)
- fmt.Fprintf(f.out(), msg)
- panic(msg)
- }
- if f.shorthands == nil {
- f.shorthands = make(map[byte]*Flag)
- }
- c := flag.Shorthand[0]
- used, alreadyThere := f.shorthands[c]
- if alreadyThere {
- msg := fmt.Sprintf("unable to redefine %q shorthand in %q flagset: it's already used for %q flag", c, f.name, used.Name)
- fmt.Fprintf(f.out(), msg)
- panic(msg)
- }
- f.shorthands[c] = flag
-}
-
-// AddFlagSet adds one FlagSet to another. If a flag is already present in f
-// the flag from newSet will be ignored.
-func (f *FlagSet) AddFlagSet(newSet *FlagSet) {
- if newSet == nil {
- return
- }
- newSet.VisitAll(func(flag *Flag) {
- if f.Lookup(flag.Name) == nil {
- f.AddFlag(flag)
- }
- })
-}
-
-// Var defines a flag with the specified name and usage string. The type and
-// value of the flag are represented by the first argument, of type Value, which
-// typically holds a user-defined implementation of Value. For instance, the
-// caller could create a flag that turns a comma-separated string into a slice
-// of strings by giving the slice the methods of Value; in particular, Set would
-// decompose the comma-separated string into the slice.
-func Var(value Value, name string, usage string) {
- CommandLine.VarP(value, name, "", usage)
-}
-
-// VarP is like Var, but accepts a shorthand letter that can be used after a single dash.
-func VarP(value Value, name, shorthand, usage string) {
- CommandLine.VarP(value, name, shorthand, usage)
-}
-
-// failf prints to standard error a formatted error and usage message and
-// returns the error.
-func (f *FlagSet) failf(format string, a ...interface{}) error {
- err := fmt.Errorf(format, a...)
- if f.errorHandling != ContinueOnError {
- fmt.Fprintln(f.out(), err)
- f.usage()
- }
- return err
-}
-
-// usage calls the Usage method for the flag set, or the usage function if
-// the flag set is CommandLine.
-func (f *FlagSet) usage() {
- if f == CommandLine {
- Usage()
- } else if f.Usage == nil {
- defaultUsage(f)
- } else {
- f.Usage()
- }
-}
-
-//--unknown (args will be empty)
-//--unknown --next-flag ... (args will be --next-flag ...)
-//--unknown arg ... (args will be arg ...)
-func stripUnknownFlagValue(args []string) []string {
- if len(args) == 0 {
- //--unknown
- return args
- }
-
- first := args[0]
- if first[0] == '-' {
- //--unknown --next-flag ...
- return args
- }
-
- //--unknown arg ... (args will be arg ...)
- return args[1:]
-}
-
-func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) {
- a = args
- name := s[2:]
- if len(name) == 0 || name[0] == '-' || name[0] == '=' {
- err = f.failf("bad flag syntax: %s", s)
- return
- }
-
- split := strings.SplitN(name, "=", 2)
- name = split[0]
- flag, exists := f.formal[f.normalizeFlagName(name)]
-
- if !exists {
- switch {
- case name == "help":
- f.usage()
- return a, ErrHelp
- case f.ParseErrorsWhitelist.UnknownFlags:
- // --unknown=unknownval arg ...
- // we do not want to lose arg in this case
- if len(split) >= 2 {
- return a, nil
- }
-
- return stripUnknownFlagValue(a), nil
- default:
- err = f.failf("unknown flag: --%s", name)
- return
- }
- }
-
- var value string
- if len(split) == 2 {
- // '--flag=arg'
- value = split[1]
- } else if flag.NoOptDefVal != "" {
- // '--flag' (arg was optional)
- value = flag.NoOptDefVal
- } else if len(a) > 0 {
- // '--flag arg'
- value = a[0]
- a = a[1:]
- } else {
- // '--flag' (arg was required)
- err = f.failf("flag needs an argument: %s", s)
- return
- }
-
- err = fn(flag, value)
- if err != nil {
- f.failf(err.Error())
- }
- return
-}
-
-func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parseFunc) (outShorts string, outArgs []string, err error) {
- if strings.HasPrefix(shorthands, "test.") {
- return
- }
-
- outArgs = args
- outShorts = shorthands[1:]
- c := shorthands[0]
-
- flag, exists := f.shorthands[c]
- if !exists {
- switch {
- case c == 'h':
- f.usage()
- err = ErrHelp
- return
- case f.ParseErrorsWhitelist.UnknownFlags:
- // '-f=arg arg ...'
- // we do not want to lose arg in this case
- if len(shorthands) > 2 && shorthands[1] == '=' {
- outShorts = ""
- return
- }
-
- outArgs = stripUnknownFlagValue(outArgs)
- return
- default:
- err = f.failf("unknown shorthand flag: %q in -%s", c, shorthands)
- return
- }
- }
-
- var value string
- if len(shorthands) > 2 && shorthands[1] == '=' {
- // '-f=arg'
- value = shorthands[2:]
- outShorts = ""
- } else if flag.NoOptDefVal != "" {
- // '-f' (arg was optional)
- value = flag.NoOptDefVal
- } else if len(shorthands) > 1 {
- // '-farg'
- value = shorthands[1:]
- outShorts = ""
- } else if len(args) > 0 {
- // '-f arg'
- value = args[0]
- outArgs = args[1:]
- } else {
- // '-f' (arg was required)
- err = f.failf("flag needs an argument: %q in -%s", c, shorthands)
- return
- }
-
- if flag.ShorthandDeprecated != "" {
- fmt.Fprintf(f.out(), "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated)
- }
-
- err = fn(flag, value)
- if err != nil {
- f.failf(err.Error())
- }
- return
-}
-
-func (f *FlagSet) parseShortArg(s string, args []string, fn parseFunc) (a []string, err error) {
- a = args
- shorthands := s[1:]
-
- // "shorthands" can be a series of shorthand letters of flags (e.g. "-vvv").
- for len(shorthands) > 0 {
- shorthands, a, err = f.parseSingleShortArg(shorthands, args, fn)
- if err != nil {
- return
- }
- }
-
- return
-}
-
-func (f *FlagSet) parseArgs(args []string, fn parseFunc) (err error) {
- for len(args) > 0 {
- s := args[0]
- args = args[1:]
- if len(s) == 0 || s[0] != '-' || len(s) == 1 {
- if !f.interspersed {
- f.args = append(f.args, s)
- f.args = append(f.args, args...)
- return nil
- }
- f.args = append(f.args, s)
- continue
- }
-
- if s[1] == '-' {
- if len(s) == 2 { // "--" terminates the flags
- f.argsLenAtDash = len(f.args)
- f.args = append(f.args, args...)
- break
- }
- args, err = f.parseLongArg(s, args, fn)
- } else {
- args, err = f.parseShortArg(s, args, fn)
- }
- if err != nil {
- return
- }
- }
- return
-}
-
-// Parse parses flag definitions from the argument list, which should not
-// include the command name. Must be called after all flags in the FlagSet
-// are defined and before flags are accessed by the program.
-// The return value will be ErrHelp if -help was set but not defined.
-func (f *FlagSet) Parse(arguments []string) error {
- if f.addedGoFlagSets != nil {
- for _, goFlagSet := range f.addedGoFlagSets {
- goFlagSet.Parse(nil)
- }
- }
- f.parsed = true
-
- if len(arguments) < 0 {
- return nil
- }
-
- f.args = make([]string, 0, len(arguments))
-
- set := func(flag *Flag, value string) error {
- return f.Set(flag.Name, value)
- }
-
- err := f.parseArgs(arguments, set)
- if err != nil {
- switch f.errorHandling {
- case ContinueOnError:
- return err
- case ExitOnError:
- fmt.Println(err)
- os.Exit(2)
- case PanicOnError:
- panic(err)
- }
- }
- return nil
-}
-
-type parseFunc func(flag *Flag, value string) error
-
-// ParseAll parses flag definitions from the argument list, which should not
-// include the command name. The arguments for fn are flag and value. Must be
-// called after all flags in the FlagSet are defined and before flags are
-// accessed by the program. The return value will be ErrHelp if -help was set
-// but not defined.
-func (f *FlagSet) ParseAll(arguments []string, fn func(flag *Flag, value string) error) error {
- f.parsed = true
- f.args = make([]string, 0, len(arguments))
-
- err := f.parseArgs(arguments, fn)
- if err != nil {
- switch f.errorHandling {
- case ContinueOnError:
- return err
- case ExitOnError:
- os.Exit(2)
- case PanicOnError:
- panic(err)
- }
- }
- return nil
-}
-
-// Parsed reports whether f.Parse has been called.
-func (f *FlagSet) Parsed() bool {
- return f.parsed
-}
-
-// Parse parses the command-line flags from os.Args[1:]. Must be called
-// after all flags are defined and before flags are accessed by the program.
-func Parse() {
- // Ignore errors; CommandLine is set for ExitOnError.
- CommandLine.Parse(os.Args[1:])
-}
-
-// ParseAll parses the command-line flags from os.Args[1:] and called fn for each.
-// The arguments for fn are flag and value. Must be called after all flags are
-// defined and before flags are accessed by the program.
-func ParseAll(fn func(flag *Flag, value string) error) {
- // Ignore errors; CommandLine is set for ExitOnError.
- CommandLine.ParseAll(os.Args[1:], fn)
-}
-
-// SetInterspersed sets whether to support interspersed option/non-option arguments.
-func SetInterspersed(interspersed bool) {
- CommandLine.SetInterspersed(interspersed)
-}
-
-// Parsed returns true if the command-line flags have been parsed.
-func Parsed() bool {
- return CommandLine.Parsed()
-}
-
-// CommandLine is the default set of command-line flags, parsed from os.Args.
-var CommandLine = NewFlagSet(os.Args[0], ExitOnError)
-
-// NewFlagSet returns a new, empty flag set with the specified name,
-// error handling property and SortFlags set to true.
-func NewFlagSet(name string, errorHandling ErrorHandling) *FlagSet {
- f := &FlagSet{
- name: name,
- errorHandling: errorHandling,
- argsLenAtDash: -1,
- interspersed: true,
- SortFlags: true,
- }
- return f
-}
-
-// SetInterspersed sets whether to support interspersed option/non-option arguments.
-func (f *FlagSet) SetInterspersed(interspersed bool) {
- f.interspersed = interspersed
-}
-
-// Init sets the name and error handling property for a flag set.
-// By default, the zero FlagSet uses an empty name and the
-// ContinueOnError error handling policy.
-func (f *FlagSet) Init(name string, errorHandling ErrorHandling) {
- f.name = name
- f.errorHandling = errorHandling
- f.argsLenAtDash = -1
-}
diff --git a/vendor/github.com/spf13/pflag/float32.go b/vendor/github.com/spf13/pflag/float32.go
deleted file mode 100644
index a243f81f..00000000
--- a/vendor/github.com/spf13/pflag/float32.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- float32 Value
-type float32Value float32
-
-func newFloat32Value(val float32, p *float32) *float32Value {
- *p = val
- return (*float32Value)(p)
-}
-
-func (f *float32Value) Set(s string) error {
- v, err := strconv.ParseFloat(s, 32)
- *f = float32Value(v)
- return err
-}
-
-func (f *float32Value) Type() string {
- return "float32"
-}
-
-func (f *float32Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 32) }
-
-func float32Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseFloat(sval, 32)
- if err != nil {
- return 0, err
- }
- return float32(v), nil
-}
-
-// GetFloat32 return the float32 value of a flag with the given name
-func (f *FlagSet) GetFloat32(name string) (float32, error) {
- val, err := f.getFlagType(name, "float32", float32Conv)
- if err != nil {
- return 0, err
- }
- return val.(float32), nil
-}
-
-// Float32Var defines a float32 flag with specified name, default value, and usage string.
-// The argument p points to a float32 variable in which to store the value of the flag.
-func (f *FlagSet) Float32Var(p *float32, name string, value float32, usage string) {
- f.VarP(newFloat32Value(value, p), name, "", usage)
-}
-
-// Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float32VarP(p *float32, name, shorthand string, value float32, usage string) {
- f.VarP(newFloat32Value(value, p), name, shorthand, usage)
-}
-
-// Float32Var defines a float32 flag with specified name, default value, and usage string.
-// The argument p points to a float32 variable in which to store the value of the flag.
-func Float32Var(p *float32, name string, value float32, usage string) {
- CommandLine.VarP(newFloat32Value(value, p), name, "", usage)
-}
-
-// Float32VarP is like Float32Var, but accepts a shorthand letter that can be used after a single dash.
-func Float32VarP(p *float32, name, shorthand string, value float32, usage string) {
- CommandLine.VarP(newFloat32Value(value, p), name, shorthand, usage)
-}
-
-// Float32 defines a float32 flag with specified name, default value, and usage string.
-// The return value is the address of a float32 variable that stores the value of the flag.
-func (f *FlagSet) Float32(name string, value float32, usage string) *float32 {
- p := new(float32)
- f.Float32VarP(p, name, "", value, usage)
- return p
-}
-
-// Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float32P(name, shorthand string, value float32, usage string) *float32 {
- p := new(float32)
- f.Float32VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Float32 defines a float32 flag with specified name, default value, and usage string.
-// The return value is the address of a float32 variable that stores the value of the flag.
-func Float32(name string, value float32, usage string) *float32 {
- return CommandLine.Float32P(name, "", value, usage)
-}
-
-// Float32P is like Float32, but accepts a shorthand letter that can be used after a single dash.
-func Float32P(name, shorthand string, value float32, usage string) *float32 {
- return CommandLine.Float32P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/float64.go b/vendor/github.com/spf13/pflag/float64.go
deleted file mode 100644
index 04b5492a..00000000
--- a/vendor/github.com/spf13/pflag/float64.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- float64 Value
-type float64Value float64
-
-func newFloat64Value(val float64, p *float64) *float64Value {
- *p = val
- return (*float64Value)(p)
-}
-
-func (f *float64Value) Set(s string) error {
- v, err := strconv.ParseFloat(s, 64)
- *f = float64Value(v)
- return err
-}
-
-func (f *float64Value) Type() string {
- return "float64"
-}
-
-func (f *float64Value) String() string { return strconv.FormatFloat(float64(*f), 'g', -1, 64) }
-
-func float64Conv(sval string) (interface{}, error) {
- return strconv.ParseFloat(sval, 64)
-}
-
-// GetFloat64 return the float64 value of a flag with the given name
-func (f *FlagSet) GetFloat64(name string) (float64, error) {
- val, err := f.getFlagType(name, "float64", float64Conv)
- if err != nil {
- return 0, err
- }
- return val.(float64), nil
-}
-
-// Float64Var defines a float64 flag with specified name, default value, and usage string.
-// The argument p points to a float64 variable in which to store the value of the flag.
-func (f *FlagSet) Float64Var(p *float64, name string, value float64, usage string) {
- f.VarP(newFloat64Value(value, p), name, "", usage)
-}
-
-// Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float64VarP(p *float64, name, shorthand string, value float64, usage string) {
- f.VarP(newFloat64Value(value, p), name, shorthand, usage)
-}
-
-// Float64Var defines a float64 flag with specified name, default value, and usage string.
-// The argument p points to a float64 variable in which to store the value of the flag.
-func Float64Var(p *float64, name string, value float64, usage string) {
- CommandLine.VarP(newFloat64Value(value, p), name, "", usage)
-}
-
-// Float64VarP is like Float64Var, but accepts a shorthand letter that can be used after a single dash.
-func Float64VarP(p *float64, name, shorthand string, value float64, usage string) {
- CommandLine.VarP(newFloat64Value(value, p), name, shorthand, usage)
-}
-
-// Float64 defines a float64 flag with specified name, default value, and usage string.
-// The return value is the address of a float64 variable that stores the value of the flag.
-func (f *FlagSet) Float64(name string, value float64, usage string) *float64 {
- p := new(float64)
- f.Float64VarP(p, name, "", value, usage)
- return p
-}
-
-// Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Float64P(name, shorthand string, value float64, usage string) *float64 {
- p := new(float64)
- f.Float64VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Float64 defines a float64 flag with specified name, default value, and usage string.
-// The return value is the address of a float64 variable that stores the value of the flag.
-func Float64(name string, value float64, usage string) *float64 {
- return CommandLine.Float64P(name, "", value, usage)
-}
-
-// Float64P is like Float64, but accepts a shorthand letter that can be used after a single dash.
-func Float64P(name, shorthand string, value float64, usage string) *float64 {
- return CommandLine.Float64P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/golangflag.go b/vendor/github.com/spf13/pflag/golangflag.go
deleted file mode 100644
index d3dd72b7..00000000
--- a/vendor/github.com/spf13/pflag/golangflag.go
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package pflag
-
-import (
- goflag "flag"
- "reflect"
- "strings"
-)
-
-// flagValueWrapper implements pflag.Value around a flag.Value. The main
-// difference here is the addition of the Type method that returns a string
-// name of the type. As this is generally unknown, we approximate that with
-// reflection.
-type flagValueWrapper struct {
- inner goflag.Value
- flagType string
-}
-
-// We are just copying the boolFlag interface out of goflag as that is what
-// they use to decide if a flag should get "true" when no arg is given.
-type goBoolFlag interface {
- goflag.Value
- IsBoolFlag() bool
-}
-
-func wrapFlagValue(v goflag.Value) Value {
- // If the flag.Value happens to also be a pflag.Value, just use it directly.
- if pv, ok := v.(Value); ok {
- return pv
- }
-
- pv := &flagValueWrapper{
- inner: v,
- }
-
- t := reflect.TypeOf(v)
- if t.Kind() == reflect.Interface || t.Kind() == reflect.Ptr {
- t = t.Elem()
- }
-
- pv.flagType = strings.TrimSuffix(t.Name(), "Value")
- return pv
-}
-
-func (v *flagValueWrapper) String() string {
- return v.inner.String()
-}
-
-func (v *flagValueWrapper) Set(s string) error {
- return v.inner.Set(s)
-}
-
-func (v *flagValueWrapper) Type() string {
- return v.flagType
-}
-
-// PFlagFromGoFlag will return a *pflag.Flag given a *flag.Flag
-// If the *flag.Flag.Name was a single character (ex: `v`) it will be accessiblei
-// with both `-v` and `--v` in flags. If the golang flag was more than a single
-// character (ex: `verbose`) it will only be accessible via `--verbose`
-func PFlagFromGoFlag(goflag *goflag.Flag) *Flag {
- // Remember the default value as a string; it won't change.
- flag := &Flag{
- Name: goflag.Name,
- Usage: goflag.Usage,
- Value: wrapFlagValue(goflag.Value),
- // Looks like golang flags don't set DefValue correctly :-(
- //DefValue: goflag.DefValue,
- DefValue: goflag.Value.String(),
- }
- // Ex: if the golang flag was -v, allow both -v and --v to work
- if len(flag.Name) == 1 {
- flag.Shorthand = flag.Name
- }
- if fv, ok := goflag.Value.(goBoolFlag); ok && fv.IsBoolFlag() {
- flag.NoOptDefVal = "true"
- }
- return flag
-}
-
-// AddGoFlag will add the given *flag.Flag to the pflag.FlagSet
-func (f *FlagSet) AddGoFlag(goflag *goflag.Flag) {
- if f.Lookup(goflag.Name) != nil {
- return
- }
- newflag := PFlagFromGoFlag(goflag)
- f.AddFlag(newflag)
-}
-
-// AddGoFlagSet will add the given *flag.FlagSet to the pflag.FlagSet
-func (f *FlagSet) AddGoFlagSet(newSet *goflag.FlagSet) {
- if newSet == nil {
- return
- }
- newSet.VisitAll(func(goflag *goflag.Flag) {
- f.AddGoFlag(goflag)
- })
- if f.addedGoFlagSets == nil {
- f.addedGoFlagSets = make([]*goflag.FlagSet, 0)
- }
- f.addedGoFlagSets = append(f.addedGoFlagSets, newSet)
-}
diff --git a/vendor/github.com/spf13/pflag/int.go b/vendor/github.com/spf13/pflag/int.go
deleted file mode 100644
index 1474b89d..00000000
--- a/vendor/github.com/spf13/pflag/int.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- int Value
-type intValue int
-
-func newIntValue(val int, p *int) *intValue {
- *p = val
- return (*intValue)(p)
-}
-
-func (i *intValue) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 64)
- *i = intValue(v)
- return err
-}
-
-func (i *intValue) Type() string {
- return "int"
-}
-
-func (i *intValue) String() string { return strconv.Itoa(int(*i)) }
-
-func intConv(sval string) (interface{}, error) {
- return strconv.Atoi(sval)
-}
-
-// GetInt return the int value of a flag with the given name
-func (f *FlagSet) GetInt(name string) (int, error) {
- val, err := f.getFlagType(name, "int", intConv)
- if err != nil {
- return 0, err
- }
- return val.(int), nil
-}
-
-// IntVar defines an int flag with specified name, default value, and usage string.
-// The argument p points to an int variable in which to store the value of the flag.
-func (f *FlagSet) IntVar(p *int, name string, value int, usage string) {
- f.VarP(newIntValue(value, p), name, "", usage)
-}
-
-// IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IntVarP(p *int, name, shorthand string, value int, usage string) {
- f.VarP(newIntValue(value, p), name, shorthand, usage)
-}
-
-// IntVar defines an int flag with specified name, default value, and usage string.
-// The argument p points to an int variable in which to store the value of the flag.
-func IntVar(p *int, name string, value int, usage string) {
- CommandLine.VarP(newIntValue(value, p), name, "", usage)
-}
-
-// IntVarP is like IntVar, but accepts a shorthand letter that can be used after a single dash.
-func IntVarP(p *int, name, shorthand string, value int, usage string) {
- CommandLine.VarP(newIntValue(value, p), name, shorthand, usage)
-}
-
-// Int defines an int flag with specified name, default value, and usage string.
-// The return value is the address of an int variable that stores the value of the flag.
-func (f *FlagSet) Int(name string, value int, usage string) *int {
- p := new(int)
- f.IntVarP(p, name, "", value, usage)
- return p
-}
-
-// IntP is like Int, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IntP(name, shorthand string, value int, usage string) *int {
- p := new(int)
- f.IntVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Int defines an int flag with specified name, default value, and usage string.
-// The return value is the address of an int variable that stores the value of the flag.
-func Int(name string, value int, usage string) *int {
- return CommandLine.IntP(name, "", value, usage)
-}
-
-// IntP is like Int, but accepts a shorthand letter that can be used after a single dash.
-func IntP(name, shorthand string, value int, usage string) *int {
- return CommandLine.IntP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/int16.go b/vendor/github.com/spf13/pflag/int16.go
deleted file mode 100644
index f1a01d05..00000000
--- a/vendor/github.com/spf13/pflag/int16.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- int16 Value
-type int16Value int16
-
-func newInt16Value(val int16, p *int16) *int16Value {
- *p = val
- return (*int16Value)(p)
-}
-
-func (i *int16Value) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 16)
- *i = int16Value(v)
- return err
-}
-
-func (i *int16Value) Type() string {
- return "int16"
-}
-
-func (i *int16Value) String() string { return strconv.FormatInt(int64(*i), 10) }
-
-func int16Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseInt(sval, 0, 16)
- if err != nil {
- return 0, err
- }
- return int16(v), nil
-}
-
-// GetInt16 returns the int16 value of a flag with the given name
-func (f *FlagSet) GetInt16(name string) (int16, error) {
- val, err := f.getFlagType(name, "int16", int16Conv)
- if err != nil {
- return 0, err
- }
- return val.(int16), nil
-}
-
-// Int16Var defines an int16 flag with specified name, default value, and usage string.
-// The argument p points to an int16 variable in which to store the value of the flag.
-func (f *FlagSet) Int16Var(p *int16, name string, value int16, usage string) {
- f.VarP(newInt16Value(value, p), name, "", usage)
-}
-
-// Int16VarP is like Int16Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int16VarP(p *int16, name, shorthand string, value int16, usage string) {
- f.VarP(newInt16Value(value, p), name, shorthand, usage)
-}
-
-// Int16Var defines an int16 flag with specified name, default value, and usage string.
-// The argument p points to an int16 variable in which to store the value of the flag.
-func Int16Var(p *int16, name string, value int16, usage string) {
- CommandLine.VarP(newInt16Value(value, p), name, "", usage)
-}
-
-// Int16VarP is like Int16Var, but accepts a shorthand letter that can be used after a single dash.
-func Int16VarP(p *int16, name, shorthand string, value int16, usage string) {
- CommandLine.VarP(newInt16Value(value, p), name, shorthand, usage)
-}
-
-// Int16 defines an int16 flag with specified name, default value, and usage string.
-// The return value is the address of an int16 variable that stores the value of the flag.
-func (f *FlagSet) Int16(name string, value int16, usage string) *int16 {
- p := new(int16)
- f.Int16VarP(p, name, "", value, usage)
- return p
-}
-
-// Int16P is like Int16, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int16P(name, shorthand string, value int16, usage string) *int16 {
- p := new(int16)
- f.Int16VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Int16 defines an int16 flag with specified name, default value, and usage string.
-// The return value is the address of an int16 variable that stores the value of the flag.
-func Int16(name string, value int16, usage string) *int16 {
- return CommandLine.Int16P(name, "", value, usage)
-}
-
-// Int16P is like Int16, but accepts a shorthand letter that can be used after a single dash.
-func Int16P(name, shorthand string, value int16, usage string) *int16 {
- return CommandLine.Int16P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/int32.go b/vendor/github.com/spf13/pflag/int32.go
deleted file mode 100644
index 9b95944f..00000000
--- a/vendor/github.com/spf13/pflag/int32.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- int32 Value
-type int32Value int32
-
-func newInt32Value(val int32, p *int32) *int32Value {
- *p = val
- return (*int32Value)(p)
-}
-
-func (i *int32Value) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 32)
- *i = int32Value(v)
- return err
-}
-
-func (i *int32Value) Type() string {
- return "int32"
-}
-
-func (i *int32Value) String() string { return strconv.FormatInt(int64(*i), 10) }
-
-func int32Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseInt(sval, 0, 32)
- if err != nil {
- return 0, err
- }
- return int32(v), nil
-}
-
-// GetInt32 return the int32 value of a flag with the given name
-func (f *FlagSet) GetInt32(name string) (int32, error) {
- val, err := f.getFlagType(name, "int32", int32Conv)
- if err != nil {
- return 0, err
- }
- return val.(int32), nil
-}
-
-// Int32Var defines an int32 flag with specified name, default value, and usage string.
-// The argument p points to an int32 variable in which to store the value of the flag.
-func (f *FlagSet) Int32Var(p *int32, name string, value int32, usage string) {
- f.VarP(newInt32Value(value, p), name, "", usage)
-}
-
-// Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int32VarP(p *int32, name, shorthand string, value int32, usage string) {
- f.VarP(newInt32Value(value, p), name, shorthand, usage)
-}
-
-// Int32Var defines an int32 flag with specified name, default value, and usage string.
-// The argument p points to an int32 variable in which to store the value of the flag.
-func Int32Var(p *int32, name string, value int32, usage string) {
- CommandLine.VarP(newInt32Value(value, p), name, "", usage)
-}
-
-// Int32VarP is like Int32Var, but accepts a shorthand letter that can be used after a single dash.
-func Int32VarP(p *int32, name, shorthand string, value int32, usage string) {
- CommandLine.VarP(newInt32Value(value, p), name, shorthand, usage)
-}
-
-// Int32 defines an int32 flag with specified name, default value, and usage string.
-// The return value is the address of an int32 variable that stores the value of the flag.
-func (f *FlagSet) Int32(name string, value int32, usage string) *int32 {
- p := new(int32)
- f.Int32VarP(p, name, "", value, usage)
- return p
-}
-
-// Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int32P(name, shorthand string, value int32, usage string) *int32 {
- p := new(int32)
- f.Int32VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Int32 defines an int32 flag with specified name, default value, and usage string.
-// The return value is the address of an int32 variable that stores the value of the flag.
-func Int32(name string, value int32, usage string) *int32 {
- return CommandLine.Int32P(name, "", value, usage)
-}
-
-// Int32P is like Int32, but accepts a shorthand letter that can be used after a single dash.
-func Int32P(name, shorthand string, value int32, usage string) *int32 {
- return CommandLine.Int32P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/int64.go b/vendor/github.com/spf13/pflag/int64.go
deleted file mode 100644
index 0026d781..00000000
--- a/vendor/github.com/spf13/pflag/int64.go
+++ /dev/null
@@ -1,84 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- int64 Value
-type int64Value int64
-
-func newInt64Value(val int64, p *int64) *int64Value {
- *p = val
- return (*int64Value)(p)
-}
-
-func (i *int64Value) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 64)
- *i = int64Value(v)
- return err
-}
-
-func (i *int64Value) Type() string {
- return "int64"
-}
-
-func (i *int64Value) String() string { return strconv.FormatInt(int64(*i), 10) }
-
-func int64Conv(sval string) (interface{}, error) {
- return strconv.ParseInt(sval, 0, 64)
-}
-
-// GetInt64 return the int64 value of a flag with the given name
-func (f *FlagSet) GetInt64(name string) (int64, error) {
- val, err := f.getFlagType(name, "int64", int64Conv)
- if err != nil {
- return 0, err
- }
- return val.(int64), nil
-}
-
-// Int64Var defines an int64 flag with specified name, default value, and usage string.
-// The argument p points to an int64 variable in which to store the value of the flag.
-func (f *FlagSet) Int64Var(p *int64, name string, value int64, usage string) {
- f.VarP(newInt64Value(value, p), name, "", usage)
-}
-
-// Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int64VarP(p *int64, name, shorthand string, value int64, usage string) {
- f.VarP(newInt64Value(value, p), name, shorthand, usage)
-}
-
-// Int64Var defines an int64 flag with specified name, default value, and usage string.
-// The argument p points to an int64 variable in which to store the value of the flag.
-func Int64Var(p *int64, name string, value int64, usage string) {
- CommandLine.VarP(newInt64Value(value, p), name, "", usage)
-}
-
-// Int64VarP is like Int64Var, but accepts a shorthand letter that can be used after a single dash.
-func Int64VarP(p *int64, name, shorthand string, value int64, usage string) {
- CommandLine.VarP(newInt64Value(value, p), name, shorthand, usage)
-}
-
-// Int64 defines an int64 flag with specified name, default value, and usage string.
-// The return value is the address of an int64 variable that stores the value of the flag.
-func (f *FlagSet) Int64(name string, value int64, usage string) *int64 {
- p := new(int64)
- f.Int64VarP(p, name, "", value, usage)
- return p
-}
-
-// Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int64P(name, shorthand string, value int64, usage string) *int64 {
- p := new(int64)
- f.Int64VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Int64 defines an int64 flag with specified name, default value, and usage string.
-// The return value is the address of an int64 variable that stores the value of the flag.
-func Int64(name string, value int64, usage string) *int64 {
- return CommandLine.Int64P(name, "", value, usage)
-}
-
-// Int64P is like Int64, but accepts a shorthand letter that can be used after a single dash.
-func Int64P(name, shorthand string, value int64, usage string) *int64 {
- return CommandLine.Int64P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/int8.go b/vendor/github.com/spf13/pflag/int8.go
deleted file mode 100644
index 4da92228..00000000
--- a/vendor/github.com/spf13/pflag/int8.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- int8 Value
-type int8Value int8
-
-func newInt8Value(val int8, p *int8) *int8Value {
- *p = val
- return (*int8Value)(p)
-}
-
-func (i *int8Value) Set(s string) error {
- v, err := strconv.ParseInt(s, 0, 8)
- *i = int8Value(v)
- return err
-}
-
-func (i *int8Value) Type() string {
- return "int8"
-}
-
-func (i *int8Value) String() string { return strconv.FormatInt(int64(*i), 10) }
-
-func int8Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseInt(sval, 0, 8)
- if err != nil {
- return 0, err
- }
- return int8(v), nil
-}
-
-// GetInt8 return the int8 value of a flag with the given name
-func (f *FlagSet) GetInt8(name string) (int8, error) {
- val, err := f.getFlagType(name, "int8", int8Conv)
- if err != nil {
- return 0, err
- }
- return val.(int8), nil
-}
-
-// Int8Var defines an int8 flag with specified name, default value, and usage string.
-// The argument p points to an int8 variable in which to store the value of the flag.
-func (f *FlagSet) Int8Var(p *int8, name string, value int8, usage string) {
- f.VarP(newInt8Value(value, p), name, "", usage)
-}
-
-// Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int8VarP(p *int8, name, shorthand string, value int8, usage string) {
- f.VarP(newInt8Value(value, p), name, shorthand, usage)
-}
-
-// Int8Var defines an int8 flag with specified name, default value, and usage string.
-// The argument p points to an int8 variable in which to store the value of the flag.
-func Int8Var(p *int8, name string, value int8, usage string) {
- CommandLine.VarP(newInt8Value(value, p), name, "", usage)
-}
-
-// Int8VarP is like Int8Var, but accepts a shorthand letter that can be used after a single dash.
-func Int8VarP(p *int8, name, shorthand string, value int8, usage string) {
- CommandLine.VarP(newInt8Value(value, p), name, shorthand, usage)
-}
-
-// Int8 defines an int8 flag with specified name, default value, and usage string.
-// The return value is the address of an int8 variable that stores the value of the flag.
-func (f *FlagSet) Int8(name string, value int8, usage string) *int8 {
- p := new(int8)
- f.Int8VarP(p, name, "", value, usage)
- return p
-}
-
-// Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Int8P(name, shorthand string, value int8, usage string) *int8 {
- p := new(int8)
- f.Int8VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Int8 defines an int8 flag with specified name, default value, and usage string.
-// The return value is the address of an int8 variable that stores the value of the flag.
-func Int8(name string, value int8, usage string) *int8 {
- return CommandLine.Int8P(name, "", value, usage)
-}
-
-// Int8P is like Int8, but accepts a shorthand letter that can be used after a single dash.
-func Int8P(name, shorthand string, value int8, usage string) *int8 {
- return CommandLine.Int8P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/int_slice.go b/vendor/github.com/spf13/pflag/int_slice.go
deleted file mode 100644
index 1e7c9edd..00000000
--- a/vendor/github.com/spf13/pflag/int_slice.go
+++ /dev/null
@@ -1,128 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-// -- intSlice Value
-type intSliceValue struct {
- value *[]int
- changed bool
-}
-
-func newIntSliceValue(val []int, p *[]int) *intSliceValue {
- isv := new(intSliceValue)
- isv.value = p
- *isv.value = val
- return isv
-}
-
-func (s *intSliceValue) Set(val string) error {
- ss := strings.Split(val, ",")
- out := make([]int, len(ss))
- for i, d := range ss {
- var err error
- out[i], err = strconv.Atoi(d)
- if err != nil {
- return err
- }
-
- }
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
- s.changed = true
- return nil
-}
-
-func (s *intSliceValue) Type() string {
- return "intSlice"
-}
-
-func (s *intSliceValue) String() string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = fmt.Sprintf("%d", d)
- }
- return "[" + strings.Join(out, ",") + "]"
-}
-
-func intSliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []int{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]int, len(ss))
- for i, d := range ss {
- var err error
- out[i], err = strconv.Atoi(d)
- if err != nil {
- return nil, err
- }
-
- }
- return out, nil
-}
-
-// GetIntSlice return the []int value of a flag with the given name
-func (f *FlagSet) GetIntSlice(name string) ([]int, error) {
- val, err := f.getFlagType(name, "intSlice", intSliceConv)
- if err != nil {
- return []int{}, err
- }
- return val.([]int), nil
-}
-
-// IntSliceVar defines a intSlice flag with specified name, default value, and usage string.
-// The argument p points to a []int variable in which to store the value of the flag.
-func (f *FlagSet) IntSliceVar(p *[]int, name string, value []int, usage string) {
- f.VarP(newIntSliceValue(value, p), name, "", usage)
-}
-
-// IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IntSliceVarP(p *[]int, name, shorthand string, value []int, usage string) {
- f.VarP(newIntSliceValue(value, p), name, shorthand, usage)
-}
-
-// IntSliceVar defines a int[] flag with specified name, default value, and usage string.
-// The argument p points to a int[] variable in which to store the value of the flag.
-func IntSliceVar(p *[]int, name string, value []int, usage string) {
- CommandLine.VarP(newIntSliceValue(value, p), name, "", usage)
-}
-
-// IntSliceVarP is like IntSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func IntSliceVarP(p *[]int, name, shorthand string, value []int, usage string) {
- CommandLine.VarP(newIntSliceValue(value, p), name, shorthand, usage)
-}
-
-// IntSlice defines a []int flag with specified name, default value, and usage string.
-// The return value is the address of a []int variable that stores the value of the flag.
-func (f *FlagSet) IntSlice(name string, value []int, usage string) *[]int {
- p := []int{}
- f.IntSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IntSliceP(name, shorthand string, value []int, usage string) *[]int {
- p := []int{}
- f.IntSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// IntSlice defines a []int flag with specified name, default value, and usage string.
-// The return value is the address of a []int variable that stores the value of the flag.
-func IntSlice(name string, value []int, usage string) *[]int {
- return CommandLine.IntSliceP(name, "", value, usage)
-}
-
-// IntSliceP is like IntSlice, but accepts a shorthand letter that can be used after a single dash.
-func IntSliceP(name, shorthand string, value []int, usage string) *[]int {
- return CommandLine.IntSliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/ip.go b/vendor/github.com/spf13/pflag/ip.go
deleted file mode 100644
index 3d414ba6..00000000
--- a/vendor/github.com/spf13/pflag/ip.go
+++ /dev/null
@@ -1,94 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "net"
- "strings"
-)
-
-// -- net.IP value
-type ipValue net.IP
-
-func newIPValue(val net.IP, p *net.IP) *ipValue {
- *p = val
- return (*ipValue)(p)
-}
-
-func (i *ipValue) String() string { return net.IP(*i).String() }
-func (i *ipValue) Set(s string) error {
- ip := net.ParseIP(strings.TrimSpace(s))
- if ip == nil {
- return fmt.Errorf("failed to parse IP: %q", s)
- }
- *i = ipValue(ip)
- return nil
-}
-
-func (i *ipValue) Type() string {
- return "ip"
-}
-
-func ipConv(sval string) (interface{}, error) {
- ip := net.ParseIP(sval)
- if ip != nil {
- return ip, nil
- }
- return nil, fmt.Errorf("invalid string being converted to IP address: %s", sval)
-}
-
-// GetIP return the net.IP value of a flag with the given name
-func (f *FlagSet) GetIP(name string) (net.IP, error) {
- val, err := f.getFlagType(name, "ip", ipConv)
- if err != nil {
- return nil, err
- }
- return val.(net.IP), nil
-}
-
-// IPVar defines an net.IP flag with specified name, default value, and usage string.
-// The argument p points to an net.IP variable in which to store the value of the flag.
-func (f *FlagSet) IPVar(p *net.IP, name string, value net.IP, usage string) {
- f.VarP(newIPValue(value, p), name, "", usage)
-}
-
-// IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPVarP(p *net.IP, name, shorthand string, value net.IP, usage string) {
- f.VarP(newIPValue(value, p), name, shorthand, usage)
-}
-
-// IPVar defines an net.IP flag with specified name, default value, and usage string.
-// The argument p points to an net.IP variable in which to store the value of the flag.
-func IPVar(p *net.IP, name string, value net.IP, usage string) {
- CommandLine.VarP(newIPValue(value, p), name, "", usage)
-}
-
-// IPVarP is like IPVar, but accepts a shorthand letter that can be used after a single dash.
-func IPVarP(p *net.IP, name, shorthand string, value net.IP, usage string) {
- CommandLine.VarP(newIPValue(value, p), name, shorthand, usage)
-}
-
-// IP defines an net.IP flag with specified name, default value, and usage string.
-// The return value is the address of an net.IP variable that stores the value of the flag.
-func (f *FlagSet) IP(name string, value net.IP, usage string) *net.IP {
- p := new(net.IP)
- f.IPVarP(p, name, "", value, usage)
- return p
-}
-
-// IPP is like IP, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPP(name, shorthand string, value net.IP, usage string) *net.IP {
- p := new(net.IP)
- f.IPVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// IP defines an net.IP flag with specified name, default value, and usage string.
-// The return value is the address of an net.IP variable that stores the value of the flag.
-func IP(name string, value net.IP, usage string) *net.IP {
- return CommandLine.IPP(name, "", value, usage)
-}
-
-// IPP is like IP, but accepts a shorthand letter that can be used after a single dash.
-func IPP(name, shorthand string, value net.IP, usage string) *net.IP {
- return CommandLine.IPP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/ip_slice.go b/vendor/github.com/spf13/pflag/ip_slice.go
deleted file mode 100644
index 7dd196fe..00000000
--- a/vendor/github.com/spf13/pflag/ip_slice.go
+++ /dev/null
@@ -1,148 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "io"
- "net"
- "strings"
-)
-
-// -- ipSlice Value
-type ipSliceValue struct {
- value *[]net.IP
- changed bool
-}
-
-func newIPSliceValue(val []net.IP, p *[]net.IP) *ipSliceValue {
- ipsv := new(ipSliceValue)
- ipsv.value = p
- *ipsv.value = val
- return ipsv
-}
-
-// Set converts, and assigns, the comma-separated IP argument string representation as the []net.IP value of this flag.
-// If Set is called on a flag that already has a []net.IP assigned, the newly converted values will be appended.
-func (s *ipSliceValue) Set(val string) error {
-
- // remove all quote characters
- rmQuote := strings.NewReplacer(`"`, "", `'`, "", "`", "")
-
- // read flag arguments with CSV parser
- ipStrSlice, err := readAsCSV(rmQuote.Replace(val))
- if err != nil && err != io.EOF {
- return err
- }
-
- // parse ip values into slice
- out := make([]net.IP, 0, len(ipStrSlice))
- for _, ipStr := range ipStrSlice {
- ip := net.ParseIP(strings.TrimSpace(ipStr))
- if ip == nil {
- return fmt.Errorf("invalid string being converted to IP address: %s", ipStr)
- }
- out = append(out, ip)
- }
-
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
-
- s.changed = true
-
- return nil
-}
-
-// Type returns a string that uniquely represents this flag's type.
-func (s *ipSliceValue) Type() string {
- return "ipSlice"
-}
-
-// String defines a "native" format for this net.IP slice flag value.
-func (s *ipSliceValue) String() string {
-
- ipStrSlice := make([]string, len(*s.value))
- for i, ip := range *s.value {
- ipStrSlice[i] = ip.String()
- }
-
- out, _ := writeAsCSV(ipStrSlice)
-
- return "[" + out + "]"
-}
-
-func ipSliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Emtpy string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []net.IP{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]net.IP, len(ss))
- for i, sval := range ss {
- ip := net.ParseIP(strings.TrimSpace(sval))
- if ip == nil {
- return nil, fmt.Errorf("invalid string being converted to IP address: %s", sval)
- }
- out[i] = ip
- }
- return out, nil
-}
-
-// GetIPSlice returns the []net.IP value of a flag with the given name
-func (f *FlagSet) GetIPSlice(name string) ([]net.IP, error) {
- val, err := f.getFlagType(name, "ipSlice", ipSliceConv)
- if err != nil {
- return []net.IP{}, err
- }
- return val.([]net.IP), nil
-}
-
-// IPSliceVar defines a ipSlice flag with specified name, default value, and usage string.
-// The argument p points to a []net.IP variable in which to store the value of the flag.
-func (f *FlagSet) IPSliceVar(p *[]net.IP, name string, value []net.IP, usage string) {
- f.VarP(newIPSliceValue(value, p), name, "", usage)
-}
-
-// IPSliceVarP is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPSliceVarP(p *[]net.IP, name, shorthand string, value []net.IP, usage string) {
- f.VarP(newIPSliceValue(value, p), name, shorthand, usage)
-}
-
-// IPSliceVar defines a []net.IP flag with specified name, default value, and usage string.
-// The argument p points to a []net.IP variable in which to store the value of the flag.
-func IPSliceVar(p *[]net.IP, name string, value []net.IP, usage string) {
- CommandLine.VarP(newIPSliceValue(value, p), name, "", usage)
-}
-
-// IPSliceVarP is like IPSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func IPSliceVarP(p *[]net.IP, name, shorthand string, value []net.IP, usage string) {
- CommandLine.VarP(newIPSliceValue(value, p), name, shorthand, usage)
-}
-
-// IPSlice defines a []net.IP flag with specified name, default value, and usage string.
-// The return value is the address of a []net.IP variable that stores the value of that flag.
-func (f *FlagSet) IPSlice(name string, value []net.IP, usage string) *[]net.IP {
- p := []net.IP{}
- f.IPSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// IPSliceP is like IPSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPSliceP(name, shorthand string, value []net.IP, usage string) *[]net.IP {
- p := []net.IP{}
- f.IPSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// IPSlice defines a []net.IP flag with specified name, default value, and usage string.
-// The return value is the address of a []net.IP variable that stores the value of the flag.
-func IPSlice(name string, value []net.IP, usage string) *[]net.IP {
- return CommandLine.IPSliceP(name, "", value, usage)
-}
-
-// IPSliceP is like IPSlice, but accepts a shorthand letter that can be used after a single dash.
-func IPSliceP(name, shorthand string, value []net.IP, usage string) *[]net.IP {
- return CommandLine.IPSliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/ipmask.go b/vendor/github.com/spf13/pflag/ipmask.go
deleted file mode 100644
index 5bd44bd2..00000000
--- a/vendor/github.com/spf13/pflag/ipmask.go
+++ /dev/null
@@ -1,122 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "net"
- "strconv"
-)
-
-// -- net.IPMask value
-type ipMaskValue net.IPMask
-
-func newIPMaskValue(val net.IPMask, p *net.IPMask) *ipMaskValue {
- *p = val
- return (*ipMaskValue)(p)
-}
-
-func (i *ipMaskValue) String() string { return net.IPMask(*i).String() }
-func (i *ipMaskValue) Set(s string) error {
- ip := ParseIPv4Mask(s)
- if ip == nil {
- return fmt.Errorf("failed to parse IP mask: %q", s)
- }
- *i = ipMaskValue(ip)
- return nil
-}
-
-func (i *ipMaskValue) Type() string {
- return "ipMask"
-}
-
-// ParseIPv4Mask written in IP form (e.g. 255.255.255.0).
-// This function should really belong to the net package.
-func ParseIPv4Mask(s string) net.IPMask {
- mask := net.ParseIP(s)
- if mask == nil {
- if len(s) != 8 {
- return nil
- }
- // net.IPMask.String() actually outputs things like ffffff00
- // so write a horrible parser for that as well :-(
- m := []int{}
- for i := 0; i < 4; i++ {
- b := "0x" + s[2*i:2*i+2]
- d, err := strconv.ParseInt(b, 0, 0)
- if err != nil {
- return nil
- }
- m = append(m, int(d))
- }
- s := fmt.Sprintf("%d.%d.%d.%d", m[0], m[1], m[2], m[3])
- mask = net.ParseIP(s)
- if mask == nil {
- return nil
- }
- }
- return net.IPv4Mask(mask[12], mask[13], mask[14], mask[15])
-}
-
-func parseIPv4Mask(sval string) (interface{}, error) {
- mask := ParseIPv4Mask(sval)
- if mask == nil {
- return nil, fmt.Errorf("unable to parse %s as net.IPMask", sval)
- }
- return mask, nil
-}
-
-// GetIPv4Mask return the net.IPv4Mask value of a flag with the given name
-func (f *FlagSet) GetIPv4Mask(name string) (net.IPMask, error) {
- val, err := f.getFlagType(name, "ipMask", parseIPv4Mask)
- if err != nil {
- return nil, err
- }
- return val.(net.IPMask), nil
-}
-
-// IPMaskVar defines an net.IPMask flag with specified name, default value, and usage string.
-// The argument p points to an net.IPMask variable in which to store the value of the flag.
-func (f *FlagSet) IPMaskVar(p *net.IPMask, name string, value net.IPMask, usage string) {
- f.VarP(newIPMaskValue(value, p), name, "", usage)
-}
-
-// IPMaskVarP is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPMaskVarP(p *net.IPMask, name, shorthand string, value net.IPMask, usage string) {
- f.VarP(newIPMaskValue(value, p), name, shorthand, usage)
-}
-
-// IPMaskVar defines an net.IPMask flag with specified name, default value, and usage string.
-// The argument p points to an net.IPMask variable in which to store the value of the flag.
-func IPMaskVar(p *net.IPMask, name string, value net.IPMask, usage string) {
- CommandLine.VarP(newIPMaskValue(value, p), name, "", usage)
-}
-
-// IPMaskVarP is like IPMaskVar, but accepts a shorthand letter that can be used after a single dash.
-func IPMaskVarP(p *net.IPMask, name, shorthand string, value net.IPMask, usage string) {
- CommandLine.VarP(newIPMaskValue(value, p), name, shorthand, usage)
-}
-
-// IPMask defines an net.IPMask flag with specified name, default value, and usage string.
-// The return value is the address of an net.IPMask variable that stores the value of the flag.
-func (f *FlagSet) IPMask(name string, value net.IPMask, usage string) *net.IPMask {
- p := new(net.IPMask)
- f.IPMaskVarP(p, name, "", value, usage)
- return p
-}
-
-// IPMaskP is like IPMask, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPMaskP(name, shorthand string, value net.IPMask, usage string) *net.IPMask {
- p := new(net.IPMask)
- f.IPMaskVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// IPMask defines an net.IPMask flag with specified name, default value, and usage string.
-// The return value is the address of an net.IPMask variable that stores the value of the flag.
-func IPMask(name string, value net.IPMask, usage string) *net.IPMask {
- return CommandLine.IPMaskP(name, "", value, usage)
-}
-
-// IPMaskP is like IP, but accepts a shorthand letter that can be used after a single dash.
-func IPMaskP(name, shorthand string, value net.IPMask, usage string) *net.IPMask {
- return CommandLine.IPMaskP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/ipnet.go b/vendor/github.com/spf13/pflag/ipnet.go
deleted file mode 100644
index e2c1b8bc..00000000
--- a/vendor/github.com/spf13/pflag/ipnet.go
+++ /dev/null
@@ -1,98 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "net"
- "strings"
-)
-
-// IPNet adapts net.IPNet for use as a flag.
-type ipNetValue net.IPNet
-
-func (ipnet ipNetValue) String() string {
- n := net.IPNet(ipnet)
- return n.String()
-}
-
-func (ipnet *ipNetValue) Set(value string) error {
- _, n, err := net.ParseCIDR(strings.TrimSpace(value))
- if err != nil {
- return err
- }
- *ipnet = ipNetValue(*n)
- return nil
-}
-
-func (*ipNetValue) Type() string {
- return "ipNet"
-}
-
-func newIPNetValue(val net.IPNet, p *net.IPNet) *ipNetValue {
- *p = val
- return (*ipNetValue)(p)
-}
-
-func ipNetConv(sval string) (interface{}, error) {
- _, n, err := net.ParseCIDR(strings.TrimSpace(sval))
- if err == nil {
- return *n, nil
- }
- return nil, fmt.Errorf("invalid string being converted to IPNet: %s", sval)
-}
-
-// GetIPNet return the net.IPNet value of a flag with the given name
-func (f *FlagSet) GetIPNet(name string) (net.IPNet, error) {
- val, err := f.getFlagType(name, "ipNet", ipNetConv)
- if err != nil {
- return net.IPNet{}, err
- }
- return val.(net.IPNet), nil
-}
-
-// IPNetVar defines an net.IPNet flag with specified name, default value, and usage string.
-// The argument p points to an net.IPNet variable in which to store the value of the flag.
-func (f *FlagSet) IPNetVar(p *net.IPNet, name string, value net.IPNet, usage string) {
- f.VarP(newIPNetValue(value, p), name, "", usage)
-}
-
-// IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPNetVarP(p *net.IPNet, name, shorthand string, value net.IPNet, usage string) {
- f.VarP(newIPNetValue(value, p), name, shorthand, usage)
-}
-
-// IPNetVar defines an net.IPNet flag with specified name, default value, and usage string.
-// The argument p points to an net.IPNet variable in which to store the value of the flag.
-func IPNetVar(p *net.IPNet, name string, value net.IPNet, usage string) {
- CommandLine.VarP(newIPNetValue(value, p), name, "", usage)
-}
-
-// IPNetVarP is like IPNetVar, but accepts a shorthand letter that can be used after a single dash.
-func IPNetVarP(p *net.IPNet, name, shorthand string, value net.IPNet, usage string) {
- CommandLine.VarP(newIPNetValue(value, p), name, shorthand, usage)
-}
-
-// IPNet defines an net.IPNet flag with specified name, default value, and usage string.
-// The return value is the address of an net.IPNet variable that stores the value of the flag.
-func (f *FlagSet) IPNet(name string, value net.IPNet, usage string) *net.IPNet {
- p := new(net.IPNet)
- f.IPNetVarP(p, name, "", value, usage)
- return p
-}
-
-// IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) IPNetP(name, shorthand string, value net.IPNet, usage string) *net.IPNet {
- p := new(net.IPNet)
- f.IPNetVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// IPNet defines an net.IPNet flag with specified name, default value, and usage string.
-// The return value is the address of an net.IPNet variable that stores the value of the flag.
-func IPNet(name string, value net.IPNet, usage string) *net.IPNet {
- return CommandLine.IPNetP(name, "", value, usage)
-}
-
-// IPNetP is like IPNet, but accepts a shorthand letter that can be used after a single dash.
-func IPNetP(name, shorthand string, value net.IPNet, usage string) *net.IPNet {
- return CommandLine.IPNetP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/string.go b/vendor/github.com/spf13/pflag/string.go
deleted file mode 100644
index 04e0a26f..00000000
--- a/vendor/github.com/spf13/pflag/string.go
+++ /dev/null
@@ -1,80 +0,0 @@
-package pflag
-
-// -- string Value
-type stringValue string
-
-func newStringValue(val string, p *string) *stringValue {
- *p = val
- return (*stringValue)(p)
-}
-
-func (s *stringValue) Set(val string) error {
- *s = stringValue(val)
- return nil
-}
-func (s *stringValue) Type() string {
- return "string"
-}
-
-func (s *stringValue) String() string { return string(*s) }
-
-func stringConv(sval string) (interface{}, error) {
- return sval, nil
-}
-
-// GetString return the string value of a flag with the given name
-func (f *FlagSet) GetString(name string) (string, error) {
- val, err := f.getFlagType(name, "string", stringConv)
- if err != nil {
- return "", err
- }
- return val.(string), nil
-}
-
-// StringVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a string variable in which to store the value of the flag.
-func (f *FlagSet) StringVar(p *string, name string, value string, usage string) {
- f.VarP(newStringValue(value, p), name, "", usage)
-}
-
-// StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringVarP(p *string, name, shorthand string, value string, usage string) {
- f.VarP(newStringValue(value, p), name, shorthand, usage)
-}
-
-// StringVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a string variable in which to store the value of the flag.
-func StringVar(p *string, name string, value string, usage string) {
- CommandLine.VarP(newStringValue(value, p), name, "", usage)
-}
-
-// StringVarP is like StringVar, but accepts a shorthand letter that can be used after a single dash.
-func StringVarP(p *string, name, shorthand string, value string, usage string) {
- CommandLine.VarP(newStringValue(value, p), name, shorthand, usage)
-}
-
-// String defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a string variable that stores the value of the flag.
-func (f *FlagSet) String(name string, value string, usage string) *string {
- p := new(string)
- f.StringVarP(p, name, "", value, usage)
- return p
-}
-
-// StringP is like String, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringP(name, shorthand string, value string, usage string) *string {
- p := new(string)
- f.StringVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// String defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a string variable that stores the value of the flag.
-func String(name string, value string, usage string) *string {
- return CommandLine.StringP(name, "", value, usage)
-}
-
-// StringP is like String, but accepts a shorthand letter that can be used after a single dash.
-func StringP(name, shorthand string, value string, usage string) *string {
- return CommandLine.StringP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/string_array.go b/vendor/github.com/spf13/pflag/string_array.go
deleted file mode 100644
index fa7bc601..00000000
--- a/vendor/github.com/spf13/pflag/string_array.go
+++ /dev/null
@@ -1,103 +0,0 @@
-package pflag
-
-// -- stringArray Value
-type stringArrayValue struct {
- value *[]string
- changed bool
-}
-
-func newStringArrayValue(val []string, p *[]string) *stringArrayValue {
- ssv := new(stringArrayValue)
- ssv.value = p
- *ssv.value = val
- return ssv
-}
-
-func (s *stringArrayValue) Set(val string) error {
- if !s.changed {
- *s.value = []string{val}
- s.changed = true
- } else {
- *s.value = append(*s.value, val)
- }
- return nil
-}
-
-func (s *stringArrayValue) Type() string {
- return "stringArray"
-}
-
-func (s *stringArrayValue) String() string {
- str, _ := writeAsCSV(*s.value)
- return "[" + str + "]"
-}
-
-func stringArrayConv(sval string) (interface{}, error) {
- sval = sval[1 : len(sval)-1]
- // An empty string would cause a array with one (empty) string
- if len(sval) == 0 {
- return []string{}, nil
- }
- return readAsCSV(sval)
-}
-
-// GetStringArray return the []string value of a flag with the given name
-func (f *FlagSet) GetStringArray(name string) ([]string, error) {
- val, err := f.getFlagType(name, "stringArray", stringArrayConv)
- if err != nil {
- return []string{}, err
- }
- return val.([]string), nil
-}
-
-// StringArrayVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a []string variable in which to store the values of the multiple flags.
-// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
-func (f *FlagSet) StringArrayVar(p *[]string, name string, value []string, usage string) {
- f.VarP(newStringArrayValue(value, p), name, "", usage)
-}
-
-// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) {
- f.VarP(newStringArrayValue(value, p), name, shorthand, usage)
-}
-
-// StringArrayVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a []string variable in which to store the value of the flag.
-// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
-func StringArrayVar(p *[]string, name string, value []string, usage string) {
- CommandLine.VarP(newStringArrayValue(value, p), name, "", usage)
-}
-
-// StringArrayVarP is like StringArrayVar, but accepts a shorthand letter that can be used after a single dash.
-func StringArrayVarP(p *[]string, name, shorthand string, value []string, usage string) {
- CommandLine.VarP(newStringArrayValue(value, p), name, shorthand, usage)
-}
-
-// StringArray defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a []string variable that stores the value of the flag.
-// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
-func (f *FlagSet) StringArray(name string, value []string, usage string) *[]string {
- p := []string{}
- f.StringArrayVarP(&p, name, "", value, usage)
- return &p
-}
-
-// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringArrayP(name, shorthand string, value []string, usage string) *[]string {
- p := []string{}
- f.StringArrayVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// StringArray defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a []string variable that stores the value of the flag.
-// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
-func StringArray(name string, value []string, usage string) *[]string {
- return CommandLine.StringArrayP(name, "", value, usage)
-}
-
-// StringArrayP is like StringArray, but accepts a shorthand letter that can be used after a single dash.
-func StringArrayP(name, shorthand string, value []string, usage string) *[]string {
- return CommandLine.StringArrayP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/string_slice.go b/vendor/github.com/spf13/pflag/string_slice.go
deleted file mode 100644
index 0cd3ccc0..00000000
--- a/vendor/github.com/spf13/pflag/string_slice.go
+++ /dev/null
@@ -1,149 +0,0 @@
-package pflag
-
-import (
- "bytes"
- "encoding/csv"
- "strings"
-)
-
-// -- stringSlice Value
-type stringSliceValue struct {
- value *[]string
- changed bool
-}
-
-func newStringSliceValue(val []string, p *[]string) *stringSliceValue {
- ssv := new(stringSliceValue)
- ssv.value = p
- *ssv.value = val
- return ssv
-}
-
-func readAsCSV(val string) ([]string, error) {
- if val == "" {
- return []string{}, nil
- }
- stringReader := strings.NewReader(val)
- csvReader := csv.NewReader(stringReader)
- return csvReader.Read()
-}
-
-func writeAsCSV(vals []string) (string, error) {
- b := &bytes.Buffer{}
- w := csv.NewWriter(b)
- err := w.Write(vals)
- if err != nil {
- return "", err
- }
- w.Flush()
- return strings.TrimSuffix(b.String(), "\n"), nil
-}
-
-func (s *stringSliceValue) Set(val string) error {
- v, err := readAsCSV(val)
- if err != nil {
- return err
- }
- if !s.changed {
- *s.value = v
- } else {
- *s.value = append(*s.value, v...)
- }
- s.changed = true
- return nil
-}
-
-func (s *stringSliceValue) Type() string {
- return "stringSlice"
-}
-
-func (s *stringSliceValue) String() string {
- str, _ := writeAsCSV(*s.value)
- return "[" + str + "]"
-}
-
-func stringSliceConv(sval string) (interface{}, error) {
- sval = sval[1 : len(sval)-1]
- // An empty string would cause a slice with one (empty) string
- if len(sval) == 0 {
- return []string{}, nil
- }
- return readAsCSV(sval)
-}
-
-// GetStringSlice return the []string value of a flag with the given name
-func (f *FlagSet) GetStringSlice(name string) ([]string, error) {
- val, err := f.getFlagType(name, "stringSlice", stringSliceConv)
- if err != nil {
- return []string{}, err
- }
- return val.([]string), nil
-}
-
-// StringSliceVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a []string variable in which to store the value of the flag.
-// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
-// For example:
-// --ss="v1,v2" -ss="v3"
-// will result in
-// []string{"v1", "v2", "v3"}
-func (f *FlagSet) StringSliceVar(p *[]string, name string, value []string, usage string) {
- f.VarP(newStringSliceValue(value, p), name, "", usage)
-}
-
-// StringSliceVarP is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringSliceVarP(p *[]string, name, shorthand string, value []string, usage string) {
- f.VarP(newStringSliceValue(value, p), name, shorthand, usage)
-}
-
-// StringSliceVar defines a string flag with specified name, default value, and usage string.
-// The argument p points to a []string variable in which to store the value of the flag.
-// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
-// For example:
-// --ss="v1,v2" -ss="v3"
-// will result in
-// []string{"v1", "v2", "v3"}
-func StringSliceVar(p *[]string, name string, value []string, usage string) {
- CommandLine.VarP(newStringSliceValue(value, p), name, "", usage)
-}
-
-// StringSliceVarP is like StringSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func StringSliceVarP(p *[]string, name, shorthand string, value []string, usage string) {
- CommandLine.VarP(newStringSliceValue(value, p), name, shorthand, usage)
-}
-
-// StringSlice defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a []string variable that stores the value of the flag.
-// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
-// For example:
-// --ss="v1,v2" -ss="v3"
-// will result in
-// []string{"v1", "v2", "v3"}
-func (f *FlagSet) StringSlice(name string, value []string, usage string) *[]string {
- p := []string{}
- f.StringSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// StringSliceP is like StringSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) StringSliceP(name, shorthand string, value []string, usage string) *[]string {
- p := []string{}
- f.StringSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// StringSlice defines a string flag with specified name, default value, and usage string.
-// The return value is the address of a []string variable that stores the value of the flag.
-// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
-// For example:
-// --ss="v1,v2" -ss="v3"
-// will result in
-// []string{"v1", "v2", "v3"}
-func StringSlice(name string, value []string, usage string) *[]string {
- return CommandLine.StringSliceP(name, "", value, usage)
-}
-
-// StringSliceP is like StringSlice, but accepts a shorthand letter that can be used after a single dash.
-func StringSliceP(name, shorthand string, value []string, usage string) *[]string {
- return CommandLine.StringSliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/uint.go b/vendor/github.com/spf13/pflag/uint.go
deleted file mode 100644
index dcbc2b75..00000000
--- a/vendor/github.com/spf13/pflag/uint.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint Value
-type uintValue uint
-
-func newUintValue(val uint, p *uint) *uintValue {
- *p = val
- return (*uintValue)(p)
-}
-
-func (i *uintValue) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 64)
- *i = uintValue(v)
- return err
-}
-
-func (i *uintValue) Type() string {
- return "uint"
-}
-
-func (i *uintValue) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uintConv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 0)
- if err != nil {
- return 0, err
- }
- return uint(v), nil
-}
-
-// GetUint return the uint value of a flag with the given name
-func (f *FlagSet) GetUint(name string) (uint, error) {
- val, err := f.getFlagType(name, "uint", uintConv)
- if err != nil {
- return 0, err
- }
- return val.(uint), nil
-}
-
-// UintVar defines a uint flag with specified name, default value, and usage string.
-// The argument p points to a uint variable in which to store the value of the flag.
-func (f *FlagSet) UintVar(p *uint, name string, value uint, usage string) {
- f.VarP(newUintValue(value, p), name, "", usage)
-}
-
-// UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) UintVarP(p *uint, name, shorthand string, value uint, usage string) {
- f.VarP(newUintValue(value, p), name, shorthand, usage)
-}
-
-// UintVar defines a uint flag with specified name, default value, and usage string.
-// The argument p points to a uint variable in which to store the value of the flag.
-func UintVar(p *uint, name string, value uint, usage string) {
- CommandLine.VarP(newUintValue(value, p), name, "", usage)
-}
-
-// UintVarP is like UintVar, but accepts a shorthand letter that can be used after a single dash.
-func UintVarP(p *uint, name, shorthand string, value uint, usage string) {
- CommandLine.VarP(newUintValue(value, p), name, shorthand, usage)
-}
-
-// Uint defines a uint flag with specified name, default value, and usage string.
-// The return value is the address of a uint variable that stores the value of the flag.
-func (f *FlagSet) Uint(name string, value uint, usage string) *uint {
- p := new(uint)
- f.UintVarP(p, name, "", value, usage)
- return p
-}
-
-// UintP is like Uint, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) UintP(name, shorthand string, value uint, usage string) *uint {
- p := new(uint)
- f.UintVarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint defines a uint flag with specified name, default value, and usage string.
-// The return value is the address of a uint variable that stores the value of the flag.
-func Uint(name string, value uint, usage string) *uint {
- return CommandLine.UintP(name, "", value, usage)
-}
-
-// UintP is like Uint, but accepts a shorthand letter that can be used after a single dash.
-func UintP(name, shorthand string, value uint, usage string) *uint {
- return CommandLine.UintP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/uint16.go b/vendor/github.com/spf13/pflag/uint16.go
deleted file mode 100644
index 7e9914ed..00000000
--- a/vendor/github.com/spf13/pflag/uint16.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint16 value
-type uint16Value uint16
-
-func newUint16Value(val uint16, p *uint16) *uint16Value {
- *p = val
- return (*uint16Value)(p)
-}
-
-func (i *uint16Value) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 16)
- *i = uint16Value(v)
- return err
-}
-
-func (i *uint16Value) Type() string {
- return "uint16"
-}
-
-func (i *uint16Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uint16Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 16)
- if err != nil {
- return 0, err
- }
- return uint16(v), nil
-}
-
-// GetUint16 return the uint16 value of a flag with the given name
-func (f *FlagSet) GetUint16(name string) (uint16, error) {
- val, err := f.getFlagType(name, "uint16", uint16Conv)
- if err != nil {
- return 0, err
- }
- return val.(uint16), nil
-}
-
-// Uint16Var defines a uint flag with specified name, default value, and usage string.
-// The argument p points to a uint variable in which to store the value of the flag.
-func (f *FlagSet) Uint16Var(p *uint16, name string, value uint16, usage string) {
- f.VarP(newUint16Value(value, p), name, "", usage)
-}
-
-// Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) {
- f.VarP(newUint16Value(value, p), name, shorthand, usage)
-}
-
-// Uint16Var defines a uint flag with specified name, default value, and usage string.
-// The argument p points to a uint variable in which to store the value of the flag.
-func Uint16Var(p *uint16, name string, value uint16, usage string) {
- CommandLine.VarP(newUint16Value(value, p), name, "", usage)
-}
-
-// Uint16VarP is like Uint16Var, but accepts a shorthand letter that can be used after a single dash.
-func Uint16VarP(p *uint16, name, shorthand string, value uint16, usage string) {
- CommandLine.VarP(newUint16Value(value, p), name, shorthand, usage)
-}
-
-// Uint16 defines a uint flag with specified name, default value, and usage string.
-// The return value is the address of a uint variable that stores the value of the flag.
-func (f *FlagSet) Uint16(name string, value uint16, usage string) *uint16 {
- p := new(uint16)
- f.Uint16VarP(p, name, "", value, usage)
- return p
-}
-
-// Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint16P(name, shorthand string, value uint16, usage string) *uint16 {
- p := new(uint16)
- f.Uint16VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint16 defines a uint flag with specified name, default value, and usage string.
-// The return value is the address of a uint variable that stores the value of the flag.
-func Uint16(name string, value uint16, usage string) *uint16 {
- return CommandLine.Uint16P(name, "", value, usage)
-}
-
-// Uint16P is like Uint16, but accepts a shorthand letter that can be used after a single dash.
-func Uint16P(name, shorthand string, value uint16, usage string) *uint16 {
- return CommandLine.Uint16P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/uint32.go b/vendor/github.com/spf13/pflag/uint32.go
deleted file mode 100644
index d8024539..00000000
--- a/vendor/github.com/spf13/pflag/uint32.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint32 value
-type uint32Value uint32
-
-func newUint32Value(val uint32, p *uint32) *uint32Value {
- *p = val
- return (*uint32Value)(p)
-}
-
-func (i *uint32Value) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 32)
- *i = uint32Value(v)
- return err
-}
-
-func (i *uint32Value) Type() string {
- return "uint32"
-}
-
-func (i *uint32Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uint32Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 32)
- if err != nil {
- return 0, err
- }
- return uint32(v), nil
-}
-
-// GetUint32 return the uint32 value of a flag with the given name
-func (f *FlagSet) GetUint32(name string) (uint32, error) {
- val, err := f.getFlagType(name, "uint32", uint32Conv)
- if err != nil {
- return 0, err
- }
- return val.(uint32), nil
-}
-
-// Uint32Var defines a uint32 flag with specified name, default value, and usage string.
-// The argument p points to a uint32 variable in which to store the value of the flag.
-func (f *FlagSet) Uint32Var(p *uint32, name string, value uint32, usage string) {
- f.VarP(newUint32Value(value, p), name, "", usage)
-}
-
-// Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint32VarP(p *uint32, name, shorthand string, value uint32, usage string) {
- f.VarP(newUint32Value(value, p), name, shorthand, usage)
-}
-
-// Uint32Var defines a uint32 flag with specified name, default value, and usage string.
-// The argument p points to a uint32 variable in which to store the value of the flag.
-func Uint32Var(p *uint32, name string, value uint32, usage string) {
- CommandLine.VarP(newUint32Value(value, p), name, "", usage)
-}
-
-// Uint32VarP is like Uint32Var, but accepts a shorthand letter that can be used after a single dash.
-func Uint32VarP(p *uint32, name, shorthand string, value uint32, usage string) {
- CommandLine.VarP(newUint32Value(value, p), name, shorthand, usage)
-}
-
-// Uint32 defines a uint32 flag with specified name, default value, and usage string.
-// The return value is the address of a uint32 variable that stores the value of the flag.
-func (f *FlagSet) Uint32(name string, value uint32, usage string) *uint32 {
- p := new(uint32)
- f.Uint32VarP(p, name, "", value, usage)
- return p
-}
-
-// Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint32P(name, shorthand string, value uint32, usage string) *uint32 {
- p := new(uint32)
- f.Uint32VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint32 defines a uint32 flag with specified name, default value, and usage string.
-// The return value is the address of a uint32 variable that stores the value of the flag.
-func Uint32(name string, value uint32, usage string) *uint32 {
- return CommandLine.Uint32P(name, "", value, usage)
-}
-
-// Uint32P is like Uint32, but accepts a shorthand letter that can be used after a single dash.
-func Uint32P(name, shorthand string, value uint32, usage string) *uint32 {
- return CommandLine.Uint32P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/uint64.go b/vendor/github.com/spf13/pflag/uint64.go
deleted file mode 100644
index f62240f2..00000000
--- a/vendor/github.com/spf13/pflag/uint64.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint64 Value
-type uint64Value uint64
-
-func newUint64Value(val uint64, p *uint64) *uint64Value {
- *p = val
- return (*uint64Value)(p)
-}
-
-func (i *uint64Value) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 64)
- *i = uint64Value(v)
- return err
-}
-
-func (i *uint64Value) Type() string {
- return "uint64"
-}
-
-func (i *uint64Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uint64Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 64)
- if err != nil {
- return 0, err
- }
- return uint64(v), nil
-}
-
-// GetUint64 return the uint64 value of a flag with the given name
-func (f *FlagSet) GetUint64(name string) (uint64, error) {
- val, err := f.getFlagType(name, "uint64", uint64Conv)
- if err != nil {
- return 0, err
- }
- return val.(uint64), nil
-}
-
-// Uint64Var defines a uint64 flag with specified name, default value, and usage string.
-// The argument p points to a uint64 variable in which to store the value of the flag.
-func (f *FlagSet) Uint64Var(p *uint64, name string, value uint64, usage string) {
- f.VarP(newUint64Value(value, p), name, "", usage)
-}
-
-// Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint64VarP(p *uint64, name, shorthand string, value uint64, usage string) {
- f.VarP(newUint64Value(value, p), name, shorthand, usage)
-}
-
-// Uint64Var defines a uint64 flag with specified name, default value, and usage string.
-// The argument p points to a uint64 variable in which to store the value of the flag.
-func Uint64Var(p *uint64, name string, value uint64, usage string) {
- CommandLine.VarP(newUint64Value(value, p), name, "", usage)
-}
-
-// Uint64VarP is like Uint64Var, but accepts a shorthand letter that can be used after a single dash.
-func Uint64VarP(p *uint64, name, shorthand string, value uint64, usage string) {
- CommandLine.VarP(newUint64Value(value, p), name, shorthand, usage)
-}
-
-// Uint64 defines a uint64 flag with specified name, default value, and usage string.
-// The return value is the address of a uint64 variable that stores the value of the flag.
-func (f *FlagSet) Uint64(name string, value uint64, usage string) *uint64 {
- p := new(uint64)
- f.Uint64VarP(p, name, "", value, usage)
- return p
-}
-
-// Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint64P(name, shorthand string, value uint64, usage string) *uint64 {
- p := new(uint64)
- f.Uint64VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint64 defines a uint64 flag with specified name, default value, and usage string.
-// The return value is the address of a uint64 variable that stores the value of the flag.
-func Uint64(name string, value uint64, usage string) *uint64 {
- return CommandLine.Uint64P(name, "", value, usage)
-}
-
-// Uint64P is like Uint64, but accepts a shorthand letter that can be used after a single dash.
-func Uint64P(name, shorthand string, value uint64, usage string) *uint64 {
- return CommandLine.Uint64P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/uint8.go b/vendor/github.com/spf13/pflag/uint8.go
deleted file mode 100644
index bb0e83c1..00000000
--- a/vendor/github.com/spf13/pflag/uint8.go
+++ /dev/null
@@ -1,88 +0,0 @@
-package pflag
-
-import "strconv"
-
-// -- uint8 Value
-type uint8Value uint8
-
-func newUint8Value(val uint8, p *uint8) *uint8Value {
- *p = val
- return (*uint8Value)(p)
-}
-
-func (i *uint8Value) Set(s string) error {
- v, err := strconv.ParseUint(s, 0, 8)
- *i = uint8Value(v)
- return err
-}
-
-func (i *uint8Value) Type() string {
- return "uint8"
-}
-
-func (i *uint8Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
-
-func uint8Conv(sval string) (interface{}, error) {
- v, err := strconv.ParseUint(sval, 0, 8)
- if err != nil {
- return 0, err
- }
- return uint8(v), nil
-}
-
-// GetUint8 return the uint8 value of a flag with the given name
-func (f *FlagSet) GetUint8(name string) (uint8, error) {
- val, err := f.getFlagType(name, "uint8", uint8Conv)
- if err != nil {
- return 0, err
- }
- return val.(uint8), nil
-}
-
-// Uint8Var defines a uint8 flag with specified name, default value, and usage string.
-// The argument p points to a uint8 variable in which to store the value of the flag.
-func (f *FlagSet) Uint8Var(p *uint8, name string, value uint8, usage string) {
- f.VarP(newUint8Value(value, p), name, "", usage)
-}
-
-// Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint8VarP(p *uint8, name, shorthand string, value uint8, usage string) {
- f.VarP(newUint8Value(value, p), name, shorthand, usage)
-}
-
-// Uint8Var defines a uint8 flag with specified name, default value, and usage string.
-// The argument p points to a uint8 variable in which to store the value of the flag.
-func Uint8Var(p *uint8, name string, value uint8, usage string) {
- CommandLine.VarP(newUint8Value(value, p), name, "", usage)
-}
-
-// Uint8VarP is like Uint8Var, but accepts a shorthand letter that can be used after a single dash.
-func Uint8VarP(p *uint8, name, shorthand string, value uint8, usage string) {
- CommandLine.VarP(newUint8Value(value, p), name, shorthand, usage)
-}
-
-// Uint8 defines a uint8 flag with specified name, default value, and usage string.
-// The return value is the address of a uint8 variable that stores the value of the flag.
-func (f *FlagSet) Uint8(name string, value uint8, usage string) *uint8 {
- p := new(uint8)
- f.Uint8VarP(p, name, "", value, usage)
- return p
-}
-
-// Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) Uint8P(name, shorthand string, value uint8, usage string) *uint8 {
- p := new(uint8)
- f.Uint8VarP(p, name, shorthand, value, usage)
- return p
-}
-
-// Uint8 defines a uint8 flag with specified name, default value, and usage string.
-// The return value is the address of a uint8 variable that stores the value of the flag.
-func Uint8(name string, value uint8, usage string) *uint8 {
- return CommandLine.Uint8P(name, "", value, usage)
-}
-
-// Uint8P is like Uint8, but accepts a shorthand letter that can be used after a single dash.
-func Uint8P(name, shorthand string, value uint8, usage string) *uint8 {
- return CommandLine.Uint8P(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/spf13/pflag/uint_slice.go b/vendor/github.com/spf13/pflag/uint_slice.go
deleted file mode 100644
index edd94c60..00000000
--- a/vendor/github.com/spf13/pflag/uint_slice.go
+++ /dev/null
@@ -1,126 +0,0 @@
-package pflag
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-// -- uintSlice Value
-type uintSliceValue struct {
- value *[]uint
- changed bool
-}
-
-func newUintSliceValue(val []uint, p *[]uint) *uintSliceValue {
- uisv := new(uintSliceValue)
- uisv.value = p
- *uisv.value = val
- return uisv
-}
-
-func (s *uintSliceValue) Set(val string) error {
- ss := strings.Split(val, ",")
- out := make([]uint, len(ss))
- for i, d := range ss {
- u, err := strconv.ParseUint(d, 10, 0)
- if err != nil {
- return err
- }
- out[i] = uint(u)
- }
- if !s.changed {
- *s.value = out
- } else {
- *s.value = append(*s.value, out...)
- }
- s.changed = true
- return nil
-}
-
-func (s *uintSliceValue) Type() string {
- return "uintSlice"
-}
-
-func (s *uintSliceValue) String() string {
- out := make([]string, len(*s.value))
- for i, d := range *s.value {
- out[i] = fmt.Sprintf("%d", d)
- }
- return "[" + strings.Join(out, ",") + "]"
-}
-
-func uintSliceConv(val string) (interface{}, error) {
- val = strings.Trim(val, "[]")
- // Empty string would cause a slice with one (empty) entry
- if len(val) == 0 {
- return []uint{}, nil
- }
- ss := strings.Split(val, ",")
- out := make([]uint, len(ss))
- for i, d := range ss {
- u, err := strconv.ParseUint(d, 10, 0)
- if err != nil {
- return nil, err
- }
- out[i] = uint(u)
- }
- return out, nil
-}
-
-// GetUintSlice returns the []uint value of a flag with the given name.
-func (f *FlagSet) GetUintSlice(name string) ([]uint, error) {
- val, err := f.getFlagType(name, "uintSlice", uintSliceConv)
- if err != nil {
- return []uint{}, err
- }
- return val.([]uint), nil
-}
-
-// UintSliceVar defines a uintSlice flag with specified name, default value, and usage string.
-// The argument p points to a []uint variable in which to store the value of the flag.
-func (f *FlagSet) UintSliceVar(p *[]uint, name string, value []uint, usage string) {
- f.VarP(newUintSliceValue(value, p), name, "", usage)
-}
-
-// UintSliceVarP is like UintSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) UintSliceVarP(p *[]uint, name, shorthand string, value []uint, usage string) {
- f.VarP(newUintSliceValue(value, p), name, shorthand, usage)
-}
-
-// UintSliceVar defines a uint[] flag with specified name, default value, and usage string.
-// The argument p points to a uint[] variable in which to store the value of the flag.
-func UintSliceVar(p *[]uint, name string, value []uint, usage string) {
- CommandLine.VarP(newUintSliceValue(value, p), name, "", usage)
-}
-
-// UintSliceVarP is like the UintSliceVar, but accepts a shorthand letter that can be used after a single dash.
-func UintSliceVarP(p *[]uint, name, shorthand string, value []uint, usage string) {
- CommandLine.VarP(newUintSliceValue(value, p), name, shorthand, usage)
-}
-
-// UintSlice defines a []uint flag with specified name, default value, and usage string.
-// The return value is the address of a []uint variable that stores the value of the flag.
-func (f *FlagSet) UintSlice(name string, value []uint, usage string) *[]uint {
- p := []uint{}
- f.UintSliceVarP(&p, name, "", value, usage)
- return &p
-}
-
-// UintSliceP is like UintSlice, but accepts a shorthand letter that can be used after a single dash.
-func (f *FlagSet) UintSliceP(name, shorthand string, value []uint, usage string) *[]uint {
- p := []uint{}
- f.UintSliceVarP(&p, name, shorthand, value, usage)
- return &p
-}
-
-// UintSlice defines a []uint flag with specified name, default value, and usage string.
-// The return value is the address of a []uint variable that stores the value of the flag.
-func UintSlice(name string, value []uint, usage string) *[]uint {
- return CommandLine.UintSliceP(name, "", value, usage)
-}
-
-// UintSliceP is like UintSlice, but accepts a shorthand letter that can be used after a single dash.
-func UintSliceP(name, shorthand string, value []uint, usage string) *[]uint {
- return CommandLine.UintSliceP(name, shorthand, value, usage)
-}
diff --git a/vendor/github.com/stretchr/testify/LICENSE b/vendor/github.com/stretchr/testify/LICENSE
deleted file mode 100644
index 473b670a..00000000
--- a/vendor/github.com/stretchr/testify/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell
-
-Please consider promoting this project if you find it useful.
-
-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/stretchr/testify/assert/assertion_format.go b/vendor/github.com/stretchr/testify/assert/assertion_format.go
deleted file mode 100644
index aa1c2b95..00000000
--- a/vendor/github.com/stretchr/testify/assert/assertion_format.go
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
-* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen
-* THIS FILE MUST NOT BE EDITED BY HAND
- */
-
-package assert
-
-import (
- http "net/http"
- url "net/url"
- time "time"
-)
-
-// Conditionf uses a Comparison to assert a complex condition.
-func Conditionf(t TestingT, comp Comparison, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Condition(t, comp, append([]interface{}{msg}, args...)...)
-}
-
-// Containsf asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted")
-// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
-// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
-func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Contains(t, s, contains, append([]interface{}{msg}, args...)...)
-}
-
-// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
-func DirExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return DirExists(t, path, append([]interface{}{msg}, args...)...)
-}
-
-// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
-func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return ElementsMatch(t, listA, listB, append([]interface{}{msg}, args...)...)
-}
-
-// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// assert.Emptyf(t, obj, "error message %s", "formatted")
-func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Empty(t, object, append([]interface{}{msg}, args...)...)
-}
-
-// Equalf asserts that two objects are equal.
-//
-// assert.Equalf(t, 123, 123, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Equal(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted")
-func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return EqualError(t, theError, errString, append([]interface{}{msg}, args...)...)
-}
-
-// EqualValuesf asserts that two objects are equal or convertable to the same types
-// and equal.
-//
-// assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123))
-func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return EqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// Errorf asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if assert.Errorf(t, err, "error message %s", "formatted") {
-// assert.Equal(t, expectedErrorf, err)
-// }
-func Errorf(t TestingT, err error, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Error(t, err, append([]interface{}{msg}, args...)...)
-}
-
-// Exactlyf asserts that two objects are equal in value and type.
-//
-// assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123))
-func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Exactly(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// Failf reports a failure through
-func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Fail(t, failureMessage, append([]interface{}{msg}, args...)...)
-}
-
-// FailNowf fails test
-func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return FailNow(t, failureMessage, append([]interface{}{msg}, args...)...)
-}
-
-// Falsef asserts that the specified value is false.
-//
-// assert.Falsef(t, myBool, "error message %s", "formatted")
-func Falsef(t TestingT, value bool, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return False(t, value, append([]interface{}{msg}, args...)...)
-}
-
-// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
-func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return FileExists(t, path, append([]interface{}{msg}, args...)...)
-}
-
-// HTTPBodyContainsf asserts that a specified handler returns a
-// body that contains a string.
-//
-// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return HTTPBodyContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)
-}
-
-// HTTPBodyNotContainsf asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return HTTPBodyNotContains(t, handler, method, url, values, str, append([]interface{}{msg}, args...)...)
-}
-
-// HTTPErrorf asserts that a specified handler returns an error status code.
-//
-// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
-func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return HTTPError(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
-}
-
-// HTTPRedirectf asserts that a specified handler returns a redirect status code.
-//
-// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
-func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return HTTPRedirect(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
-}
-
-// HTTPSuccessf asserts that a specified handler returns a success status code.
-//
-// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return HTTPSuccess(t, handler, method, url, values, append([]interface{}{msg}, args...)...)
-}
-
-// Implementsf asserts that an object is implemented by the specified interface.
-//
-// assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
-func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Implements(t, interfaceObject, object, append([]interface{}{msg}, args...)...)
-}
-
-// InDeltaf asserts that the two numerals are within delta of each other.
-//
-// assert.InDeltaf(t, math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
-func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return InDelta(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
-}
-
-// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return InDeltaMapValues(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
-}
-
-// InDeltaSlicef is the same as InDelta, except it compares two slices.
-func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return InDeltaSlice(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
-}
-
-// InEpsilonf asserts that expected and actual have a relative error less than epsilon
-func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return InEpsilon(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
-}
-
-// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
-func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
-}
-
-// IsTypef asserts that the specified objects are of the same type.
-func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return IsType(t, expectedType, object, append([]interface{}{msg}, args...)...)
-}
-
-// JSONEqf asserts that two JSON strings are equivalent.
-//
-// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
-func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return JSONEq(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// Lenf asserts that the specified object has specific length.
-// Lenf also fails if the object has a type that len() not accept.
-//
-// assert.Lenf(t, mySlice, 3, "error message %s", "formatted")
-func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Len(t, object, length, append([]interface{}{msg}, args...)...)
-}
-
-// Nilf asserts that the specified object is nil.
-//
-// assert.Nilf(t, err, "error message %s", "formatted")
-func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Nil(t, object, append([]interface{}{msg}, args...)...)
-}
-
-// NoErrorf asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if assert.NoErrorf(t, err, "error message %s", "formatted") {
-// assert.Equal(t, expectedObj, actualObj)
-// }
-func NoErrorf(t TestingT, err error, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NoError(t, err, append([]interface{}{msg}, args...)...)
-}
-
-// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
-// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
-// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
-func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotContains(t, s, contains, append([]interface{}{msg}, args...)...)
-}
-
-// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if assert.NotEmptyf(t, obj, "error message %s", "formatted") {
-// assert.Equal(t, "two", obj[1])
-// }
-func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotEmpty(t, object, append([]interface{}{msg}, args...)...)
-}
-
-// NotEqualf asserts that the specified values are NOT equal.
-//
-// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotEqual(t, expected, actual, append([]interface{}{msg}, args...)...)
-}
-
-// NotNilf asserts that the specified object is not nil.
-//
-// assert.NotNilf(t, err, "error message %s", "formatted")
-func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotNil(t, object, append([]interface{}{msg}, args...)...)
-}
-
-// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
-func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotPanics(t, f, append([]interface{}{msg}, args...)...)
-}
-
-// NotRegexpf asserts that a specified regexp does not match a string.
-//
-// assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
-// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
-func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotRegexp(t, rx, str, append([]interface{}{msg}, args...)...)
-}
-
-// NotSubsetf asserts that the specified list(array, slice...) contains not all
-// elements given in the specified subset(array, slice...).
-//
-// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
-func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotSubset(t, list, subset, append([]interface{}{msg}, args...)...)
-}
-
-// NotZerof asserts that i is not the zero value for its type.
-func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return NotZero(t, i, append([]interface{}{msg}, args...)...)
-}
-
-// Panicsf asserts that the code inside the specified PanicTestFunc panics.
-//
-// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
-func Panicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Panics(t, f, append([]interface{}{msg}, args...)...)
-}
-
-// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
-func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...)
-}
-
-// Regexpf asserts that a specified regexp matches a string.
-//
-// assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
-// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
-func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Regexp(t, rx, str, append([]interface{}{msg}, args...)...)
-}
-
-// Subsetf asserts that the specified list(array, slice...) contains all
-// elements given in the specified subset(array, slice...).
-//
-// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
-func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Subset(t, list, subset, append([]interface{}{msg}, args...)...)
-}
-
-// Truef asserts that the specified value is true.
-//
-// assert.Truef(t, myBool, "error message %s", "formatted")
-func Truef(t TestingT, value bool, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return True(t, value, append([]interface{}{msg}, args...)...)
-}
-
-// WithinDurationf asserts that the two times are within duration delta of each other.
-//
-// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
-func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return WithinDuration(t, expected, actual, delta, append([]interface{}{msg}, args...)...)
-}
-
-// Zerof asserts that i is the zero value for its type.
-func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- return Zero(t, i, append([]interface{}{msg}, args...)...)
-}
diff --git a/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl
deleted file mode 100644
index d2bb0b81..00000000
--- a/vendor/github.com/stretchr/testify/assert/assertion_format.go.tmpl
+++ /dev/null
@@ -1,5 +0,0 @@
-{{.CommentFormat}}
-func {{.DocInfo.Name}}f(t TestingT, {{.ParamsFormat}}) bool {
- if h, ok := t.(tHelper); ok { h.Helper() }
- return {{.DocInfo.Name}}(t, {{.ForwardedParamsFormat}})
-}
diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go
deleted file mode 100644
index de39f794..00000000
--- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go
+++ /dev/null
@@ -1,956 +0,0 @@
-/*
-* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen
-* THIS FILE MUST NOT BE EDITED BY HAND
- */
-
-package assert
-
-import (
- http "net/http"
- url "net/url"
- time "time"
-)
-
-// Condition uses a Comparison to assert a complex condition.
-func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Condition(a.t, comp, msgAndArgs...)
-}
-
-// Conditionf uses a Comparison to assert a complex condition.
-func (a *Assertions) Conditionf(comp Comparison, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Conditionf(a.t, comp, msg, args...)
-}
-
-// Contains asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// a.Contains("Hello World", "World")
-// a.Contains(["Hello", "World"], "World")
-// a.Contains({"Hello": "World"}, "Hello")
-func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Contains(a.t, s, contains, msgAndArgs...)
-}
-
-// Containsf asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// a.Containsf("Hello World", "World", "error message %s", "formatted")
-// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted")
-// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted")
-func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Containsf(a.t, s, contains, msg, args...)
-}
-
-// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
-func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return DirExists(a.t, path, msgAndArgs...)
-}
-
-// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
-func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return DirExistsf(a.t, path, msg, args...)
-}
-
-// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2])
-func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return ElementsMatch(a.t, listA, listB, msgAndArgs...)
-}
-
-// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
-func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return ElementsMatchf(a.t, listA, listB, msg, args...)
-}
-
-// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// a.Empty(obj)
-func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Empty(a.t, object, msgAndArgs...)
-}
-
-// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// a.Emptyf(obj, "error message %s", "formatted")
-func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Emptyf(a.t, object, msg, args...)
-}
-
-// Equal asserts that two objects are equal.
-//
-// a.Equal(123, 123)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Equal(a.t, expected, actual, msgAndArgs...)
-}
-
-// EqualError asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// a.EqualError(err, expectedErrorString)
-func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return EqualError(a.t, theError, errString, msgAndArgs...)
-}
-
-// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted")
-func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return EqualErrorf(a.t, theError, errString, msg, args...)
-}
-
-// EqualValues asserts that two objects are equal or convertable to the same types
-// and equal.
-//
-// a.EqualValues(uint32(123), int32(123))
-func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return EqualValues(a.t, expected, actual, msgAndArgs...)
-}
-
-// EqualValuesf asserts that two objects are equal or convertable to the same types
-// and equal.
-//
-// a.EqualValuesf(uint32(123, "error message %s", "formatted"), int32(123))
-func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return EqualValuesf(a.t, expected, actual, msg, args...)
-}
-
-// Equalf asserts that two objects are equal.
-//
-// a.Equalf(123, 123, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Equalf(a.t, expected, actual, msg, args...)
-}
-
-// Error asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.Error(err) {
-// assert.Equal(t, expectedError, err)
-// }
-func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Error(a.t, err, msgAndArgs...)
-}
-
-// Errorf asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.Errorf(err, "error message %s", "formatted") {
-// assert.Equal(t, expectedErrorf, err)
-// }
-func (a *Assertions) Errorf(err error, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Errorf(a.t, err, msg, args...)
-}
-
-// Exactly asserts that two objects are equal in value and type.
-//
-// a.Exactly(int32(123), int64(123))
-func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Exactly(a.t, expected, actual, msgAndArgs...)
-}
-
-// Exactlyf asserts that two objects are equal in value and type.
-//
-// a.Exactlyf(int32(123, "error message %s", "formatted"), int64(123))
-func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Exactlyf(a.t, expected, actual, msg, args...)
-}
-
-// Fail reports a failure through
-func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Fail(a.t, failureMessage, msgAndArgs...)
-}
-
-// FailNow fails test
-func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return FailNow(a.t, failureMessage, msgAndArgs...)
-}
-
-// FailNowf fails test
-func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return FailNowf(a.t, failureMessage, msg, args...)
-}
-
-// Failf reports a failure through
-func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Failf(a.t, failureMessage, msg, args...)
-}
-
-// False asserts that the specified value is false.
-//
-// a.False(myBool)
-func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return False(a.t, value, msgAndArgs...)
-}
-
-// Falsef asserts that the specified value is false.
-//
-// a.Falsef(myBool, "error message %s", "formatted")
-func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Falsef(a.t, value, msg, args...)
-}
-
-// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
-func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return FileExists(a.t, path, msgAndArgs...)
-}
-
-// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
-func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return FileExistsf(a.t, path, msg, args...)
-}
-
-// HTTPBodyContains asserts that a specified handler returns a
-// body that contains a string.
-//
-// a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...)
-}
-
-// HTTPBodyContainsf asserts that a specified handler returns a
-// body that contains a string.
-//
-// a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...)
-}
-
-// HTTPBodyNotContains asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...)
-}
-
-// HTTPBodyNotContainsf asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...)
-}
-
-// HTTPError asserts that a specified handler returns an error status code.
-//
-// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPError(a.t, handler, method, url, values, msgAndArgs...)
-}
-
-// HTTPErrorf asserts that a specified handler returns an error status code.
-//
-// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
-func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPErrorf(a.t, handler, method, url, values, msg, args...)
-}
-
-// HTTPRedirect asserts that a specified handler returns a redirect status code.
-//
-// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...)
-}
-
-// HTTPRedirectf asserts that a specified handler returns a redirect status code.
-//
-// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
-func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPRedirectf(a.t, handler, method, url, values, msg, args...)
-}
-
-// HTTPSuccess asserts that a specified handler returns a success status code.
-//
-// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)
-}
-
-// HTTPSuccessf asserts that a specified handler returns a success status code.
-//
-// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return HTTPSuccessf(a.t, handler, method, url, values, msg, args...)
-}
-
-// Implements asserts that an object is implemented by the specified interface.
-//
-// a.Implements((*MyInterface)(nil), new(MyObject))
-func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Implements(a.t, interfaceObject, object, msgAndArgs...)
-}
-
-// Implementsf asserts that an object is implemented by the specified interface.
-//
-// a.Implementsf((*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
-func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Implementsf(a.t, interfaceObject, object, msg, args...)
-}
-
-// InDelta asserts that the two numerals are within delta of each other.
-//
-// a.InDelta(math.Pi, (22 / 7.0), 0.01)
-func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InDelta(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...)
-}
-
-// InDeltaSlice is the same as InDelta, except it compares two slices.
-func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// InDeltaSlicef is the same as InDelta, except it compares two slices.
-func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InDeltaSlicef(a.t, expected, actual, delta, msg, args...)
-}
-
-// InDeltaf asserts that the two numerals are within delta of each other.
-//
-// a.InDeltaf(math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
-func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InDeltaf(a.t, expected, actual, delta, msg, args...)
-}
-
-// InEpsilon asserts that expected and actual have a relative error less than epsilon
-func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)
-}
-
-// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
-func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)
-}
-
-// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
-func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)
-}
-
-// InEpsilonf asserts that expected and actual have a relative error less than epsilon
-func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return InEpsilonf(a.t, expected, actual, epsilon, msg, args...)
-}
-
-// IsType asserts that the specified objects are of the same type.
-func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return IsType(a.t, expectedType, object, msgAndArgs...)
-}
-
-// IsTypef asserts that the specified objects are of the same type.
-func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return IsTypef(a.t, expectedType, object, msg, args...)
-}
-
-// JSONEq asserts that two JSON strings are equivalent.
-//
-// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
-func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return JSONEq(a.t, expected, actual, msgAndArgs...)
-}
-
-// JSONEqf asserts that two JSON strings are equivalent.
-//
-// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
-func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return JSONEqf(a.t, expected, actual, msg, args...)
-}
-
-// Len asserts that the specified object has specific length.
-// Len also fails if the object has a type that len() not accept.
-//
-// a.Len(mySlice, 3)
-func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Len(a.t, object, length, msgAndArgs...)
-}
-
-// Lenf asserts that the specified object has specific length.
-// Lenf also fails if the object has a type that len() not accept.
-//
-// a.Lenf(mySlice, 3, "error message %s", "formatted")
-func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Lenf(a.t, object, length, msg, args...)
-}
-
-// Nil asserts that the specified object is nil.
-//
-// a.Nil(err)
-func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Nil(a.t, object, msgAndArgs...)
-}
-
-// Nilf asserts that the specified object is nil.
-//
-// a.Nilf(err, "error message %s", "formatted")
-func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Nilf(a.t, object, msg, args...)
-}
-
-// NoError asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.NoError(err) {
-// assert.Equal(t, expectedObj, actualObj)
-// }
-func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NoError(a.t, err, msgAndArgs...)
-}
-
-// NoErrorf asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.NoErrorf(err, "error message %s", "formatted") {
-// assert.Equal(t, expectedObj, actualObj)
-// }
-func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NoErrorf(a.t, err, msg, args...)
-}
-
-// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// a.NotContains("Hello World", "Earth")
-// a.NotContains(["Hello", "World"], "Earth")
-// a.NotContains({"Hello": "World"}, "Earth")
-func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotContains(a.t, s, contains, msgAndArgs...)
-}
-
-// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted")
-// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted")
-// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted")
-func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotContainsf(a.t, s, contains, msg, args...)
-}
-
-// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if a.NotEmpty(obj) {
-// assert.Equal(t, "two", obj[1])
-// }
-func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotEmpty(a.t, object, msgAndArgs...)
-}
-
-// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if a.NotEmptyf(obj, "error message %s", "formatted") {
-// assert.Equal(t, "two", obj[1])
-// }
-func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotEmptyf(a.t, object, msg, args...)
-}
-
-// NotEqual asserts that the specified values are NOT equal.
-//
-// a.NotEqual(obj1, obj2)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotEqual(a.t, expected, actual, msgAndArgs...)
-}
-
-// NotEqualf asserts that the specified values are NOT equal.
-//
-// a.NotEqualf(obj1, obj2, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotEqualf(a.t, expected, actual, msg, args...)
-}
-
-// NotNil asserts that the specified object is not nil.
-//
-// a.NotNil(err)
-func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotNil(a.t, object, msgAndArgs...)
-}
-
-// NotNilf asserts that the specified object is not nil.
-//
-// a.NotNilf(err, "error message %s", "formatted")
-func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotNilf(a.t, object, msg, args...)
-}
-
-// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// a.NotPanics(func(){ RemainCalm() })
-func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotPanics(a.t, f, msgAndArgs...)
-}
-
-// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
-func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotPanicsf(a.t, f, msg, args...)
-}
-
-// NotRegexp asserts that a specified regexp does not match a string.
-//
-// a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
-// a.NotRegexp("^start", "it's not starting")
-func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotRegexp(a.t, rx, str, msgAndArgs...)
-}
-
-// NotRegexpf asserts that a specified regexp does not match a string.
-//
-// a.NotRegexpf(regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
-// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
-func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotRegexpf(a.t, rx, str, msg, args...)
-}
-
-// NotSubset asserts that the specified list(array, slice...) contains not all
-// elements given in the specified subset(array, slice...).
-//
-// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
-func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotSubset(a.t, list, subset, msgAndArgs...)
-}
-
-// NotSubsetf asserts that the specified list(array, slice...) contains not all
-// elements given in the specified subset(array, slice...).
-//
-// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
-func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotSubsetf(a.t, list, subset, msg, args...)
-}
-
-// NotZero asserts that i is not the zero value for its type.
-func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotZero(a.t, i, msgAndArgs...)
-}
-
-// NotZerof asserts that i is not the zero value for its type.
-func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return NotZerof(a.t, i, msg, args...)
-}
-
-// Panics asserts that the code inside the specified PanicTestFunc panics.
-//
-// a.Panics(func(){ GoCrazy() })
-func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Panics(a.t, f, msgAndArgs...)
-}
-
-// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// a.PanicsWithValue("crazy error", func(){ GoCrazy() })
-func (a *Assertions) PanicsWithValue(expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return PanicsWithValue(a.t, expected, f, msgAndArgs...)
-}
-
-// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
-func (a *Assertions) PanicsWithValuef(expected interface{}, f PanicTestFunc, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return PanicsWithValuef(a.t, expected, f, msg, args...)
-}
-
-// Panicsf asserts that the code inside the specified PanicTestFunc panics.
-//
-// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted")
-func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Panicsf(a.t, f, msg, args...)
-}
-
-// Regexp asserts that a specified regexp matches a string.
-//
-// a.Regexp(regexp.MustCompile("start"), "it's starting")
-// a.Regexp("start...$", "it's not starting")
-func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Regexp(a.t, rx, str, msgAndArgs...)
-}
-
-// Regexpf asserts that a specified regexp matches a string.
-//
-// a.Regexpf(regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
-// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
-func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Regexpf(a.t, rx, str, msg, args...)
-}
-
-// Subset asserts that the specified list(array, slice...) contains all
-// elements given in the specified subset(array, slice...).
-//
-// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
-func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Subset(a.t, list, subset, msgAndArgs...)
-}
-
-// Subsetf asserts that the specified list(array, slice...) contains all
-// elements given in the specified subset(array, slice...).
-//
-// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
-func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Subsetf(a.t, list, subset, msg, args...)
-}
-
-// True asserts that the specified value is true.
-//
-// a.True(myBool)
-func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return True(a.t, value, msgAndArgs...)
-}
-
-// Truef asserts that the specified value is true.
-//
-// a.Truef(myBool, "error message %s", "formatted")
-func (a *Assertions) Truef(value bool, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Truef(a.t, value, msg, args...)
-}
-
-// WithinDuration asserts that the two times are within duration delta of each other.
-//
-// a.WithinDuration(time.Now(), time.Now(), 10*time.Second)
-func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return WithinDuration(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// WithinDurationf asserts that the two times are within duration delta of each other.
-//
-// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
-func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return WithinDurationf(a.t, expected, actual, delta, msg, args...)
-}
-
-// Zero asserts that i is the zero value for its type.
-func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Zero(a.t, i, msgAndArgs...)
-}
-
-// Zerof asserts that i is the zero value for its type.
-func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) bool {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- return Zerof(a.t, i, msg, args...)
-}
diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl
deleted file mode 100644
index 188bb9e1..00000000
--- a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl
+++ /dev/null
@@ -1,5 +0,0 @@
-{{.CommentWithoutT "a"}}
-func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool {
- if h, ok := a.t.(tHelper); ok { h.Helper() }
- return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}})
-}
diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go
deleted file mode 100644
index 5bdec56c..00000000
--- a/vendor/github.com/stretchr/testify/assert/assertions.go
+++ /dev/null
@@ -1,1394 +0,0 @@
-package assert
-
-import (
- "bufio"
- "bytes"
- "encoding/json"
- "errors"
- "fmt"
- "math"
- "os"
- "reflect"
- "regexp"
- "runtime"
- "strings"
- "time"
- "unicode"
- "unicode/utf8"
-
- "github.com/davecgh/go-spew/spew"
- "github.com/pmezard/go-difflib/difflib"
-)
-
-//go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_format.go.tmpl
-
-// TestingT is an interface wrapper around *testing.T
-type TestingT interface {
- Errorf(format string, args ...interface{})
-}
-
-// ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful
-// for table driven tests.
-type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{}) bool
-
-// ValueAssertionFunc is a common function prototype when validating a single value. Can be useful
-// for table driven tests.
-type ValueAssertionFunc func(TestingT, interface{}, ...interface{}) bool
-
-// BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful
-// for table driven tests.
-type BoolAssertionFunc func(TestingT, bool, ...interface{}) bool
-
-// ValuesAssertionFunc is a common function prototype when validating an error value. Can be useful
-// for table driven tests.
-type ErrorAssertionFunc func(TestingT, error, ...interface{}) bool
-
-// Comparison a custom function that returns true on success and false on failure
-type Comparison func() (success bool)
-
-/*
- Helper functions
-*/
-
-// ObjectsAreEqual determines if two objects are considered equal.
-//
-// This function does no assertion of any kind.
-func ObjectsAreEqual(expected, actual interface{}) bool {
- if expected == nil || actual == nil {
- return expected == actual
- }
-
- exp, ok := expected.([]byte)
- if !ok {
- return reflect.DeepEqual(expected, actual)
- }
-
- act, ok := actual.([]byte)
- if !ok {
- return false
- }
- if exp == nil || act == nil {
- return exp == nil && act == nil
- }
- return bytes.Equal(exp, act)
-}
-
-// ObjectsAreEqualValues gets whether two objects are equal, or if their
-// values are equal.
-func ObjectsAreEqualValues(expected, actual interface{}) bool {
- if ObjectsAreEqual(expected, actual) {
- return true
- }
-
- actualType := reflect.TypeOf(actual)
- if actualType == nil {
- return false
- }
- expectedValue := reflect.ValueOf(expected)
- if expectedValue.IsValid() && expectedValue.Type().ConvertibleTo(actualType) {
- // Attempt comparison after type conversion
- return reflect.DeepEqual(expectedValue.Convert(actualType).Interface(), actual)
- }
-
- return false
-}
-
-/* CallerInfo is necessary because the assert functions use the testing object
-internally, causing it to print the file:line of the assert method, rather than where
-the problem actually occurred in calling code.*/
-
-// CallerInfo returns an array of strings containing the file and line number
-// of each stack frame leading from the current test to the assert call that
-// failed.
-func CallerInfo() []string {
-
- pc := uintptr(0)
- file := ""
- line := 0
- ok := false
- name := ""
-
- callers := []string{}
- for i := 0; ; i++ {
- pc, file, line, ok = runtime.Caller(i)
- if !ok {
- // The breaks below failed to terminate the loop, and we ran off the
- // end of the call stack.
- break
- }
-
- // This is a huge edge case, but it will panic if this is the case, see #180
- if file == "<autogenerated>" {
- break
- }
-
- f := runtime.FuncForPC(pc)
- if f == nil {
- break
- }
- name = f.Name()
-
- // testing.tRunner is the standard library function that calls
- // tests. Subtests are called directly by tRunner, without going through
- // the Test/Benchmark/Example function that contains the t.Run calls, so
- // with subtests we should break when we hit tRunner, without adding it
- // to the list of callers.
- if name == "testing.tRunner" {
- break
- }
-
- parts := strings.Split(file, "/")
- file = parts[len(parts)-1]
- if len(parts) > 1 {
- dir := parts[len(parts)-2]
- if (dir != "assert" && dir != "mock" && dir != "require") || file == "mock_test.go" {
- callers = append(callers, fmt.Sprintf("%s:%d", file, line))
- }
- }
-
- // Drop the package
- segments := strings.Split(name, ".")
- name = segments[len(segments)-1]
- if isTest(name, "Test") ||
- isTest(name, "Benchmark") ||
- isTest(name, "Example") {
- break
- }
- }
-
- return callers
-}
-
-// Stolen from the `go test` tool.
-// isTest tells whether name looks like a test (or benchmark, according to prefix).
-// It is a Test (say) if there is a character after Test that is not a lower-case letter.
-// We don't want TesticularCancer.
-func isTest(name, prefix string) bool {
- if !strings.HasPrefix(name, prefix) {
- return false
- }
- if len(name) == len(prefix) { // "Test" is ok
- return true
- }
- rune, _ := utf8.DecodeRuneInString(name[len(prefix):])
- return !unicode.IsLower(rune)
-}
-
-func messageFromMsgAndArgs(msgAndArgs ...interface{}) string {
- if len(msgAndArgs) == 0 || msgAndArgs == nil {
- return ""
- }
- if len(msgAndArgs) == 1 {
- return msgAndArgs[0].(string)
- }
- if len(msgAndArgs) > 1 {
- return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...)
- }
- return ""
-}
-
-// Aligns the provided message so that all lines after the first line start at the same location as the first line.
-// Assumes that the first line starts at the correct location (after carriage return, tab, label, spacer and tab).
-// The longestLabelLen parameter specifies the length of the longest label in the output (required becaues this is the
-// basis on which the alignment occurs).
-func indentMessageLines(message string, longestLabelLen int) string {
- outBuf := new(bytes.Buffer)
-
- for i, scanner := 0, bufio.NewScanner(strings.NewReader(message)); scanner.Scan(); i++ {
- // no need to align first line because it starts at the correct location (after the label)
- if i != 0 {
- // append alignLen+1 spaces to align with "{{longestLabel}}:" before adding tab
- outBuf.WriteString("\n\t" + strings.Repeat(" ", longestLabelLen+1) + "\t")
- }
- outBuf.WriteString(scanner.Text())
- }
-
- return outBuf.String()
-}
-
-type failNower interface {
- FailNow()
-}
-
-// FailNow fails test
-func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- Fail(t, failureMessage, msgAndArgs...)
-
- // We cannot extend TestingT with FailNow() and
- // maintain backwards compatibility, so we fallback
- // to panicking when FailNow is not available in
- // TestingT.
- // See issue #263
-
- if t, ok := t.(failNower); ok {
- t.FailNow()
- } else {
- panic("test failed and t is missing `FailNow()`")
- }
- return false
-}
-
-// Fail reports a failure through
-func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- content := []labeledContent{
- {"Error Trace", strings.Join(CallerInfo(), "\n\t\t\t")},
- {"Error", failureMessage},
- }
-
- // Add test name if the Go version supports it
- if n, ok := t.(interface {
- Name() string
- }); ok {
- content = append(content, labeledContent{"Test", n.Name()})
- }
-
- message := messageFromMsgAndArgs(msgAndArgs...)
- if len(message) > 0 {
- content = append(content, labeledContent{"Messages", message})
- }
-
- t.Errorf("\n%s", ""+labeledOutput(content...))
-
- return false
-}
-
-type labeledContent struct {
- label string
- content string
-}
-
-// labeledOutput returns a string consisting of the provided labeledContent. Each labeled output is appended in the following manner:
-//
-// \t{{label}}:{{align_spaces}}\t{{content}}\n
-//
-// The initial carriage return is required to undo/erase any padding added by testing.T.Errorf. The "\t{{label}}:" is for the label.
-// If a label is shorter than the longest label provided, padding spaces are added to make all the labels match in length. Once this
-// alignment is achieved, "\t{{content}}\n" is added for the output.
-//
-// If the content of the labeledOutput contains line breaks, the subsequent lines are aligned so that they start at the same location as the first line.
-func labeledOutput(content ...labeledContent) string {
- longestLabel := 0
- for _, v := range content {
- if len(v.label) > longestLabel {
- longestLabel = len(v.label)
- }
- }
- var output string
- for _, v := range content {
- output += "\t" + v.label + ":" + strings.Repeat(" ", longestLabel-len(v.label)) + "\t" + indentMessageLines(v.content, longestLabel) + "\n"
- }
- return output
-}
-
-// Implements asserts that an object is implemented by the specified interface.
-//
-// assert.Implements(t, (*MyInterface)(nil), new(MyObject))
-func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- interfaceType := reflect.TypeOf(interfaceObject).Elem()
-
- if object == nil {
- return Fail(t, fmt.Sprintf("Cannot check if nil implements %v", interfaceType), msgAndArgs...)
- }
- if !reflect.TypeOf(object).Implements(interfaceType) {
- return Fail(t, fmt.Sprintf("%T must implement %v", object, interfaceType), msgAndArgs...)
- }
-
- return true
-}
-
-// IsType asserts that the specified objects are of the same type.
-func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- if !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) {
- return Fail(t, fmt.Sprintf("Object expected to be of type %v, but was %v", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...)
- }
-
- return true
-}
-
-// Equal asserts that two objects are equal.
-//
-// assert.Equal(t, 123, 123)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if err := validateEqualArgs(expected, actual); err != nil {
- return Fail(t, fmt.Sprintf("Invalid operation: %#v == %#v (%s)",
- expected, actual, err), msgAndArgs...)
- }
-
- if !ObjectsAreEqual(expected, actual) {
- diff := diff(expected, actual)
- expected, actual = formatUnequalValues(expected, actual)
- return Fail(t, fmt.Sprintf("Not equal: \n"+
- "expected: %s\n"+
- "actual : %s%s", expected, actual, diff), msgAndArgs...)
- }
-
- return true
-
-}
-
-// formatUnequalValues takes two values of arbitrary types and returns string
-// representations appropriate to be presented to the user.
-//
-// If the values are not of like type, the returned strings will be prefixed
-// with the type name, and the value will be enclosed in parenthesis similar
-// to a type conversion in the Go grammar.
-func formatUnequalValues(expected, actual interface{}) (e string, a string) {
- if reflect.TypeOf(expected) != reflect.TypeOf(actual) {
- return fmt.Sprintf("%T(%#v)", expected, expected),
- fmt.Sprintf("%T(%#v)", actual, actual)
- }
-
- return fmt.Sprintf("%#v", expected),
- fmt.Sprintf("%#v", actual)
-}
-
-// EqualValues asserts that two objects are equal or convertable to the same types
-// and equal.
-//
-// assert.EqualValues(t, uint32(123), int32(123))
-func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- if !ObjectsAreEqualValues(expected, actual) {
- diff := diff(expected, actual)
- expected, actual = formatUnequalValues(expected, actual)
- return Fail(t, fmt.Sprintf("Not equal: \n"+
- "expected: %s\n"+
- "actual : %s%s", expected, actual, diff), msgAndArgs...)
- }
-
- return true
-
-}
-
-// Exactly asserts that two objects are equal in value and type.
-//
-// assert.Exactly(t, int32(123), int64(123))
-func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- aType := reflect.TypeOf(expected)
- bType := reflect.TypeOf(actual)
-
- if aType != bType {
- return Fail(t, fmt.Sprintf("Types expected to match exactly\n\t%v != %v", aType, bType), msgAndArgs...)
- }
-
- return Equal(t, expected, actual, msgAndArgs...)
-
-}
-
-// NotNil asserts that the specified object is not nil.
-//
-// assert.NotNil(t, err)
-func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if !isNil(object) {
- return true
- }
- return Fail(t, "Expected value not to be nil.", msgAndArgs...)
-}
-
-// isNil checks if a specified object is nil or not, without Failing.
-func isNil(object interface{}) bool {
- if object == nil {
- return true
- }
-
- value := reflect.ValueOf(object)
- kind := value.Kind()
- if kind >= reflect.Chan && kind <= reflect.Slice && value.IsNil() {
- return true
- }
-
- return false
-}
-
-// Nil asserts that the specified object is nil.
-//
-// assert.Nil(t, err)
-func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if isNil(object) {
- return true
- }
- return Fail(t, fmt.Sprintf("Expected nil, but got: %#v", object), msgAndArgs...)
-}
-
-// isEmpty gets whether the specified object is considered empty or not.
-func isEmpty(object interface{}) bool {
-
- // get nil case out of the way
- if object == nil {
- return true
- }
-
- objValue := reflect.ValueOf(object)
-
- switch objValue.Kind() {
- // collection types are empty when they have no element
- case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice:
- return objValue.Len() == 0
- // pointers are empty if nil or if the value they point to is empty
- case reflect.Ptr:
- if objValue.IsNil() {
- return true
- }
- deref := objValue.Elem().Interface()
- return isEmpty(deref)
- // for all other types, compare against the zero value
- default:
- zero := reflect.Zero(objValue.Type())
- return reflect.DeepEqual(object, zero.Interface())
- }
-}
-
-// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// assert.Empty(t, obj)
-func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- pass := isEmpty(object)
- if !pass {
- Fail(t, fmt.Sprintf("Should be empty, but was %v", object), msgAndArgs...)
- }
-
- return pass
-
-}
-
-// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if assert.NotEmpty(t, obj) {
-// assert.Equal(t, "two", obj[1])
-// }
-func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- pass := !isEmpty(object)
- if !pass {
- Fail(t, fmt.Sprintf("Should NOT be empty, but was %v", object), msgAndArgs...)
- }
-
- return pass
-
-}
-
-// getLen try to get length of object.
-// return (false, 0) if impossible.
-func getLen(x interface{}) (ok bool, length int) {
- v := reflect.ValueOf(x)
- defer func() {
- if e := recover(); e != nil {
- ok = false
- }
- }()
- return true, v.Len()
-}
-
-// Len asserts that the specified object has specific length.
-// Len also fails if the object has a type that len() not accept.
-//
-// assert.Len(t, mySlice, 3)
-func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- ok, l := getLen(object)
- if !ok {
- return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", object), msgAndArgs...)
- }
-
- if l != length {
- return Fail(t, fmt.Sprintf("\"%s\" should have %d item(s), but has %d", object, length, l), msgAndArgs...)
- }
- return true
-}
-
-// True asserts that the specified value is true.
-//
-// assert.True(t, myBool)
-func True(t TestingT, value bool, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if h, ok := t.(interface {
- Helper()
- }); ok {
- h.Helper()
- }
-
- if value != true {
- return Fail(t, "Should be true", msgAndArgs...)
- }
-
- return true
-
-}
-
-// False asserts that the specified value is false.
-//
-// assert.False(t, myBool)
-func False(t TestingT, value bool, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- if value != false {
- return Fail(t, "Should be false", msgAndArgs...)
- }
-
- return true
-
-}
-
-// NotEqual asserts that the specified values are NOT equal.
-//
-// assert.NotEqual(t, obj1, obj2)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if err := validateEqualArgs(expected, actual); err != nil {
- return Fail(t, fmt.Sprintf("Invalid operation: %#v != %#v (%s)",
- expected, actual, err), msgAndArgs...)
- }
-
- if ObjectsAreEqual(expected, actual) {
- return Fail(t, fmt.Sprintf("Should not be: %#v\n", actual), msgAndArgs...)
- }
-
- return true
-
-}
-
-// containsElement try loop over the list check if the list includes the element.
-// return (false, false) if impossible.
-// return (true, false) if element was not found.
-// return (true, true) if element was found.
-func includeElement(list interface{}, element interface{}) (ok, found bool) {
-
- listValue := reflect.ValueOf(list)
- elementValue := reflect.ValueOf(element)
- defer func() {
- if e := recover(); e != nil {
- ok = false
- found = false
- }
- }()
-
- if reflect.TypeOf(list).Kind() == reflect.String {
- return true, strings.Contains(listValue.String(), elementValue.String())
- }
-
- if reflect.TypeOf(list).Kind() == reflect.Map {
- mapKeys := listValue.MapKeys()
- for i := 0; i < len(mapKeys); i++ {
- if ObjectsAreEqual(mapKeys[i].Interface(), element) {
- return true, true
- }
- }
- return true, false
- }
-
- for i := 0; i < listValue.Len(); i++ {
- if ObjectsAreEqual(listValue.Index(i).Interface(), element) {
- return true, true
- }
- }
- return true, false
-
-}
-
-// Contains asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// assert.Contains(t, "Hello World", "World")
-// assert.Contains(t, ["Hello", "World"], "World")
-// assert.Contains(t, {"Hello": "World"}, "Hello")
-func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- ok, found := includeElement(s, contains)
- if !ok {
- return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", s), msgAndArgs...)
- }
- if !found {
- return Fail(t, fmt.Sprintf("\"%s\" does not contain \"%s\"", s, contains), msgAndArgs...)
- }
-
- return true
-
-}
-
-// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// assert.NotContains(t, "Hello World", "Earth")
-// assert.NotContains(t, ["Hello", "World"], "Earth")
-// assert.NotContains(t, {"Hello": "World"}, "Earth")
-func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- ok, found := includeElement(s, contains)
- if !ok {
- return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", s), msgAndArgs...)
- }
- if found {
- return Fail(t, fmt.Sprintf("\"%s\" should not contain \"%s\"", s, contains), msgAndArgs...)
- }
-
- return true
-
-}
-
-// Subset asserts that the specified list(array, slice...) contains all
-// elements given in the specified subset(array, slice...).
-//
-// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
-func Subset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if subset == nil {
- return true // we consider nil to be equal to the nil set
- }
-
- subsetValue := reflect.ValueOf(subset)
- defer func() {
- if e := recover(); e != nil {
- ok = false
- }
- }()
-
- listKind := reflect.TypeOf(list).Kind()
- subsetKind := reflect.TypeOf(subset).Kind()
-
- if listKind != reflect.Array && listKind != reflect.Slice {
- return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...)
- }
-
- if subsetKind != reflect.Array && subsetKind != reflect.Slice {
- return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...)
- }
-
- for i := 0; i < subsetValue.Len(); i++ {
- element := subsetValue.Index(i).Interface()
- ok, found := includeElement(list, element)
- if !ok {
- return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...)
- }
- if !found {
- return Fail(t, fmt.Sprintf("\"%s\" does not contain \"%s\"", list, element), msgAndArgs...)
- }
- }
-
- return true
-}
-
-// NotSubset asserts that the specified list(array, slice...) contains not all
-// elements given in the specified subset(array, slice...).
-//
-// assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
-func NotSubset(t TestingT, list, subset interface{}, msgAndArgs ...interface{}) (ok bool) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if subset == nil {
- return Fail(t, fmt.Sprintf("nil is the empty set which is a subset of every set"), msgAndArgs...)
- }
-
- subsetValue := reflect.ValueOf(subset)
- defer func() {
- if e := recover(); e != nil {
- ok = false
- }
- }()
-
- listKind := reflect.TypeOf(list).Kind()
- subsetKind := reflect.TypeOf(subset).Kind()
-
- if listKind != reflect.Array && listKind != reflect.Slice {
- return Fail(t, fmt.Sprintf("%q has an unsupported type %s", list, listKind), msgAndArgs...)
- }
-
- if subsetKind != reflect.Array && subsetKind != reflect.Slice {
- return Fail(t, fmt.Sprintf("%q has an unsupported type %s", subset, subsetKind), msgAndArgs...)
- }
-
- for i := 0; i < subsetValue.Len(); i++ {
- element := subsetValue.Index(i).Interface()
- ok, found := includeElement(list, element)
- if !ok {
- return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", list), msgAndArgs...)
- }
- if !found {
- return true
- }
- }
-
- return Fail(t, fmt.Sprintf("%q is a subset of %q", subset, list), msgAndArgs...)
-}
-
-// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2])
-func ElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if isEmpty(listA) && isEmpty(listB) {
- return true
- }
-
- aKind := reflect.TypeOf(listA).Kind()
- bKind := reflect.TypeOf(listB).Kind()
-
- if aKind != reflect.Array && aKind != reflect.Slice {
- return Fail(t, fmt.Sprintf("%q has an unsupported type %s", listA, aKind), msgAndArgs...)
- }
-
- if bKind != reflect.Array && bKind != reflect.Slice {
- return Fail(t, fmt.Sprintf("%q has an unsupported type %s", listB, bKind), msgAndArgs...)
- }
-
- aValue := reflect.ValueOf(listA)
- bValue := reflect.ValueOf(listB)
-
- aLen := aValue.Len()
- bLen := bValue.Len()
-
- if aLen != bLen {
- return Fail(t, fmt.Sprintf("lengths don't match: %d != %d", aLen, bLen), msgAndArgs...)
- }
-
- // Mark indexes in bValue that we already used
- visited := make([]bool, bLen)
- for i := 0; i < aLen; i++ {
- element := aValue.Index(i).Interface()
- found := false
- for j := 0; j < bLen; j++ {
- if visited[j] {
- continue
- }
- if ObjectsAreEqual(bValue.Index(j).Interface(), element) {
- visited[j] = true
- found = true
- break
- }
- }
- if !found {
- return Fail(t, fmt.Sprintf("element %s appears more times in %s than in %s", element, aValue, bValue), msgAndArgs...)
- }
- }
-
- return true
-}
-
-// Condition uses a Comparison to assert a complex condition.
-func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- result := comp()
- if !result {
- Fail(t, "Condition failed!", msgAndArgs...)
- }
- return result
-}
-
-// PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics
-// methods, and represents a simple func that takes no arguments, and returns nothing.
-type PanicTestFunc func()
-
-// didPanic returns true if the function passed to it panics. Otherwise, it returns false.
-func didPanic(f PanicTestFunc) (bool, interface{}) {
-
- didPanic := false
- var message interface{}
- func() {
-
- defer func() {
- if message = recover(); message != nil {
- didPanic = true
- }
- }()
-
- // call the target function
- f()
-
- }()
-
- return didPanic, message
-
-}
-
-// Panics asserts that the code inside the specified PanicTestFunc panics.
-//
-// assert.Panics(t, func(){ GoCrazy() })
-func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- if funcDidPanic, panicValue := didPanic(f); !funcDidPanic {
- return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...)
- }
-
- return true
-}
-
-// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() })
-func PanicsWithValue(t TestingT, expected interface{}, f PanicTestFunc, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- funcDidPanic, panicValue := didPanic(f)
- if !funcDidPanic {
- return Fail(t, fmt.Sprintf("func %#v should panic\n\tPanic value:\t%#v", f, panicValue), msgAndArgs...)
- }
- if panicValue != expected {
- return Fail(t, fmt.Sprintf("func %#v should panic with value:\t%#v\n\tPanic value:\t%#v", f, expected, panicValue), msgAndArgs...)
- }
-
- return true
-}
-
-// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// assert.NotPanics(t, func(){ RemainCalm() })
-func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- if funcDidPanic, panicValue := didPanic(f); funcDidPanic {
- return Fail(t, fmt.Sprintf("func %#v should not panic\n\tPanic value:\t%v", f, panicValue), msgAndArgs...)
- }
-
- return true
-}
-
-// WithinDuration asserts that the two times are within duration delta of each other.
-//
-// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
-func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- dt := expected.Sub(actual)
- if dt < -delta || dt > delta {
- return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...)
- }
-
- return true
-}
-
-func toFloat(x interface{}) (float64, bool) {
- var xf float64
- xok := true
-
- switch xn := x.(type) {
- case uint8:
- xf = float64(xn)
- case uint16:
- xf = float64(xn)
- case uint32:
- xf = float64(xn)
- case uint64:
- xf = float64(xn)
- case int:
- xf = float64(xn)
- case int8:
- xf = float64(xn)
- case int16:
- xf = float64(xn)
- case int32:
- xf = float64(xn)
- case int64:
- xf = float64(xn)
- case float32:
- xf = float64(xn)
- case float64:
- xf = float64(xn)
- case time.Duration:
- xf = float64(xn)
- default:
- xok = false
- }
-
- return xf, xok
-}
-
-// InDelta asserts that the two numerals are within delta of each other.
-//
-// assert.InDelta(t, math.Pi, (22 / 7.0), 0.01)
-func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- af, aok := toFloat(expected)
- bf, bok := toFloat(actual)
-
- if !aok || !bok {
- return Fail(t, fmt.Sprintf("Parameters must be numerical"), msgAndArgs...)
- }
-
- if math.IsNaN(af) {
- return Fail(t, fmt.Sprintf("Expected must not be NaN"), msgAndArgs...)
- }
-
- if math.IsNaN(bf) {
- return Fail(t, fmt.Sprintf("Expected %v with delta %v, but was NaN", expected, delta), msgAndArgs...)
- }
-
- dt := af - bf
- if dt < -delta || dt > delta {
- return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...)
- }
-
- return true
-}
-
-// InDeltaSlice is the same as InDelta, except it compares two slices.
-func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if expected == nil || actual == nil ||
- reflect.TypeOf(actual).Kind() != reflect.Slice ||
- reflect.TypeOf(expected).Kind() != reflect.Slice {
- return Fail(t, fmt.Sprintf("Parameters must be slice"), msgAndArgs...)
- }
-
- actualSlice := reflect.ValueOf(actual)
- expectedSlice := reflect.ValueOf(expected)
-
- for i := 0; i < actualSlice.Len(); i++ {
- result := InDelta(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), delta, msgAndArgs...)
- if !result {
- return result
- }
- }
-
- return true
-}
-
-// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func InDeltaMapValues(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if expected == nil || actual == nil ||
- reflect.TypeOf(actual).Kind() != reflect.Map ||
- reflect.TypeOf(expected).Kind() != reflect.Map {
- return Fail(t, "Arguments must be maps", msgAndArgs...)
- }
-
- expectedMap := reflect.ValueOf(expected)
- actualMap := reflect.ValueOf(actual)
-
- if expectedMap.Len() != actualMap.Len() {
- return Fail(t, "Arguments must have the same number of keys", msgAndArgs...)
- }
-
- for _, k := range expectedMap.MapKeys() {
- ev := expectedMap.MapIndex(k)
- av := actualMap.MapIndex(k)
-
- if !ev.IsValid() {
- return Fail(t, fmt.Sprintf("missing key %q in expected map", k), msgAndArgs...)
- }
-
- if !av.IsValid() {
- return Fail(t, fmt.Sprintf("missing key %q in actual map", k), msgAndArgs...)
- }
-
- if !InDelta(
- t,
- ev.Interface(),
- av.Interface(),
- delta,
- msgAndArgs...,
- ) {
- return false
- }
- }
-
- return true
-}
-
-func calcRelativeError(expected, actual interface{}) (float64, error) {
- af, aok := toFloat(expected)
- if !aok {
- return 0, fmt.Errorf("expected value %q cannot be converted to float", expected)
- }
- if af == 0 {
- return 0, fmt.Errorf("expected value must have a value other than zero to calculate the relative error")
- }
- bf, bok := toFloat(actual)
- if !bok {
- return 0, fmt.Errorf("actual value %q cannot be converted to float", actual)
- }
-
- return math.Abs(af-bf) / math.Abs(af), nil
-}
-
-// InEpsilon asserts that expected and actual have a relative error less than epsilon
-func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- actualEpsilon, err := calcRelativeError(expected, actual)
- if err != nil {
- return Fail(t, err.Error(), msgAndArgs...)
- }
- if actualEpsilon > epsilon {
- return Fail(t, fmt.Sprintf("Relative error is too high: %#v (expected)\n"+
- " < %#v (actual)", epsilon, actualEpsilon), msgAndArgs...)
- }
-
- return true
-}
-
-// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
-func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if expected == nil || actual == nil ||
- reflect.TypeOf(actual).Kind() != reflect.Slice ||
- reflect.TypeOf(expected).Kind() != reflect.Slice {
- return Fail(t, fmt.Sprintf("Parameters must be slice"), msgAndArgs...)
- }
-
- actualSlice := reflect.ValueOf(actual)
- expectedSlice := reflect.ValueOf(expected)
-
- for i := 0; i < actualSlice.Len(); i++ {
- result := InEpsilon(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), epsilon)
- if !result {
- return result
- }
- }
-
- return true
-}
-
-/*
- Errors
-*/
-
-// NoError asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if assert.NoError(t, err) {
-// assert.Equal(t, expectedObj, actualObj)
-// }
-func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if err != nil {
- return Fail(t, fmt.Sprintf("Received unexpected error:\n%+v", err), msgAndArgs...)
- }
-
- return true
-}
-
-// Error asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if assert.Error(t, err) {
-// assert.Equal(t, expectedError, err)
-// }
-func Error(t TestingT, err error, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- if err == nil {
- return Fail(t, "An error is expected but got nil.", msgAndArgs...)
- }
-
- return true
-}
-
-// EqualError asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// assert.EqualError(t, err, expectedErrorString)
-func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if !Error(t, theError, msgAndArgs...) {
- return false
- }
- expected := errString
- actual := theError.Error()
- // don't need to use deep equals here, we know they are both strings
- if expected != actual {
- return Fail(t, fmt.Sprintf("Error message not equal:\n"+
- "expected: %q\n"+
- "actual : %q", expected, actual), msgAndArgs...)
- }
- return true
-}
-
-// matchRegexp return true if a specified regexp matches a string.
-func matchRegexp(rx interface{}, str interface{}) bool {
-
- var r *regexp.Regexp
- if rr, ok := rx.(*regexp.Regexp); ok {
- r = rr
- } else {
- r = regexp.MustCompile(fmt.Sprint(rx))
- }
-
- return (r.FindStringIndex(fmt.Sprint(str)) != nil)
-
-}
-
-// Regexp asserts that a specified regexp matches a string.
-//
-// assert.Regexp(t, regexp.MustCompile("start"), "it's starting")
-// assert.Regexp(t, "start...$", "it's not starting")
-func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
-
- match := matchRegexp(rx, str)
-
- if !match {
- Fail(t, fmt.Sprintf("Expect \"%v\" to match \"%v\"", str, rx), msgAndArgs...)
- }
-
- return match
-}
-
-// NotRegexp asserts that a specified regexp does not match a string.
-//
-// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
-// assert.NotRegexp(t, "^start", "it's not starting")
-func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- match := matchRegexp(rx, str)
-
- if match {
- Fail(t, fmt.Sprintf("Expect \"%v\" to NOT match \"%v\"", str, rx), msgAndArgs...)
- }
-
- return !match
-
-}
-
-// Zero asserts that i is the zero value for its type.
-func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if i != nil && !reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) {
- return Fail(t, fmt.Sprintf("Should be zero, but was %v", i), msgAndArgs...)
- }
- return true
-}
-
-// NotZero asserts that i is not the zero value for its type.
-func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- if i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) {
- return Fail(t, fmt.Sprintf("Should not be zero, but was %v", i), msgAndArgs...)
- }
- return true
-}
-
-// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
-func FileExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- info, err := os.Lstat(path)
- if err != nil {
- if os.IsNotExist(err) {
- return Fail(t, fmt.Sprintf("unable to find file %q", path), msgAndArgs...)
- }
- return Fail(t, fmt.Sprintf("error when running os.Lstat(%q): %s", path, err), msgAndArgs...)
- }
- if info.IsDir() {
- return Fail(t, fmt.Sprintf("%q is a directory", path), msgAndArgs...)
- }
- return true
-}
-
-// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
-func DirExists(t TestingT, path string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- info, err := os.Lstat(path)
- if err != nil {
- if os.IsNotExist(err) {
- return Fail(t, fmt.Sprintf("unable to find file %q", path), msgAndArgs...)
- }
- return Fail(t, fmt.Sprintf("error when running os.Lstat(%q): %s", path, err), msgAndArgs...)
- }
- if !info.IsDir() {
- return Fail(t, fmt.Sprintf("%q is a file", path), msgAndArgs...)
- }
- return true
-}
-
-// JSONEq asserts that two JSON strings are equivalent.
-//
-// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
-func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- var expectedJSONAsInterface, actualJSONAsInterface interface{}
-
- if err := json.Unmarshal([]byte(expected), &expectedJSONAsInterface); err != nil {
- return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid json.\nJSON parsing error: '%s'", expected, err.Error()), msgAndArgs...)
- }
-
- if err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil {
- return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid json.\nJSON parsing error: '%s'", actual, err.Error()), msgAndArgs...)
- }
-
- return Equal(t, expectedJSONAsInterface, actualJSONAsInterface, msgAndArgs...)
-}
-
-func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) {
- t := reflect.TypeOf(v)
- k := t.Kind()
-
- if k == reflect.Ptr {
- t = t.Elem()
- k = t.Kind()
- }
- return t, k
-}
-
-// diff returns a diff of both values as long as both are of the same type and
-// are a struct, map, slice or array. Otherwise it returns an empty string.
-func diff(expected interface{}, actual interface{}) string {
- if expected == nil || actual == nil {
- return ""
- }
-
- et, ek := typeAndKind(expected)
- at, _ := typeAndKind(actual)
-
- if et != at {
- return ""
- }
-
- if ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array && ek != reflect.String {
- return ""
- }
-
- var e, a string
- if ek != reflect.String {
- e = spewConfig.Sdump(expected)
- a = spewConfig.Sdump(actual)
- } else {
- e = expected.(string)
- a = actual.(string)
- }
-
- diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{
- A: difflib.SplitLines(e),
- B: difflib.SplitLines(a),
- FromFile: "Expected",
- FromDate: "",
- ToFile: "Actual",
- ToDate: "",
- Context: 1,
- })
-
- return "\n\nDiff:\n" + diff
-}
-
-// validateEqualArgs checks whether provided arguments can be safely used in the
-// Equal/NotEqual functions.
-func validateEqualArgs(expected, actual interface{}) error {
- if isFunction(expected) || isFunction(actual) {
- return errors.New("cannot take func type as argument")
- }
- return nil
-}
-
-func isFunction(arg interface{}) bool {
- if arg == nil {
- return false
- }
- return reflect.TypeOf(arg).Kind() == reflect.Func
-}
-
-var spewConfig = spew.ConfigState{
- Indent: " ",
- DisablePointerAddresses: true,
- DisableCapacities: true,
- SortKeys: true,
-}
-
-type tHelper interface {
- Helper()
-}
diff --git a/vendor/github.com/stretchr/testify/assert/doc.go b/vendor/github.com/stretchr/testify/assert/doc.go
deleted file mode 100644
index c9dccc4d..00000000
--- a/vendor/github.com/stretchr/testify/assert/doc.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Package assert provides a set of comprehensive testing tools for use with the normal Go testing system.
-//
-// Example Usage
-//
-// The following is a complete example using assert in a standard test function:
-// import (
-// "testing"
-// "github.com/stretchr/testify/assert"
-// )
-//
-// func TestSomething(t *testing.T) {
-//
-// var a string = "Hello"
-// var b string = "Hello"
-//
-// assert.Equal(t, a, b, "The two words should be the same.")
-//
-// }
-//
-// if you assert many times, use the format below:
-//
-// import (
-// "testing"
-// "github.com/stretchr/testify/assert"
-// )
-//
-// func TestSomething(t *testing.T) {
-// assert := assert.New(t)
-//
-// var a string = "Hello"
-// var b string = "Hello"
-//
-// assert.Equal(a, b, "The two words should be the same.")
-// }
-//
-// Assertions
-//
-// Assertions allow you to easily write test code, and are global funcs in the `assert` package.
-// All assertion functions take, as the first argument, the `*testing.T` object provided by the
-// testing framework. This allows the assertion funcs to write the failings and other details to
-// the correct place.
-//
-// Every assertion function also takes an optional string message as the final argument,
-// allowing custom error messages to be appended to the message the assertion method outputs.
-package assert
diff --git a/vendor/github.com/stretchr/testify/assert/errors.go b/vendor/github.com/stretchr/testify/assert/errors.go
deleted file mode 100644
index ac9dc9d1..00000000
--- a/vendor/github.com/stretchr/testify/assert/errors.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package assert
-
-import (
- "errors"
-)
-
-// AnError is an error instance useful for testing. If the code does not care
-// about error specifics, and only needs to return the error for example, this
-// error should be used to make the test code more readable.
-var AnError = errors.New("assert.AnError general error for testing")
diff --git a/vendor/github.com/stretchr/testify/assert/forward_assertions.go b/vendor/github.com/stretchr/testify/assert/forward_assertions.go
deleted file mode 100644
index 9ad56851..00000000
--- a/vendor/github.com/stretchr/testify/assert/forward_assertions.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package assert
-
-// Assertions provides assertion methods around the
-// TestingT interface.
-type Assertions struct {
- t TestingT
-}
-
-// New makes a new Assertions object for the specified TestingT.
-func New(t TestingT) *Assertions {
- return &Assertions{
- t: t,
- }
-}
-
-//go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl -include-format-funcs
diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go
deleted file mode 100644
index df46fa77..00000000
--- a/vendor/github.com/stretchr/testify/assert/http_assertions.go
+++ /dev/null
@@ -1,143 +0,0 @@
-package assert
-
-import (
- "fmt"
- "net/http"
- "net/http/httptest"
- "net/url"
- "strings"
-)
-
-// httpCode is a helper that returns HTTP code of the response. It returns -1 and
-// an error if building a new request fails.
-func httpCode(handler http.HandlerFunc, method, url string, values url.Values) (int, error) {
- w := httptest.NewRecorder()
- req, err := http.NewRequest(method, url, nil)
- if err != nil {
- return -1, err
- }
- req.URL.RawQuery = values.Encode()
- handler(w, req)
- return w.Code, nil
-}
-
-// HTTPSuccess asserts that a specified handler returns a success status code.
-//
-// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- code, err := httpCode(handler, method, url, values)
- if err != nil {
- Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err))
- return false
- }
-
- isSuccessCode := code >= http.StatusOK && code <= http.StatusPartialContent
- if !isSuccessCode {
- Fail(t, fmt.Sprintf("Expected HTTP success status code for %q but received %d", url+"?"+values.Encode(), code))
- }
-
- return isSuccessCode
-}
-
-// HTTPRedirect asserts that a specified handler returns a redirect status code.
-//
-// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- code, err := httpCode(handler, method, url, values)
- if err != nil {
- Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err))
- return false
- }
-
- isRedirectCode := code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect
- if !isRedirectCode {
- Fail(t, fmt.Sprintf("Expected HTTP redirect status code for %q but received %d", url+"?"+values.Encode(), code))
- }
-
- return isRedirectCode
-}
-
-// HTTPError asserts that a specified handler returns an error status code.
-//
-// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- code, err := httpCode(handler, method, url, values)
- if err != nil {
- Fail(t, fmt.Sprintf("Failed to build test request, got error: %s", err))
- return false
- }
-
- isErrorCode := code >= http.StatusBadRequest
- if !isErrorCode {
- Fail(t, fmt.Sprintf("Expected HTTP error status code for %q but received %d", url+"?"+values.Encode(), code))
- }
-
- return isErrorCode
-}
-
-// HTTPBody is a helper that returns HTTP body of the response. It returns
-// empty string if building a new request fails.
-func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string {
- w := httptest.NewRecorder()
- req, err := http.NewRequest(method, url+"?"+values.Encode(), nil)
- if err != nil {
- return ""
- }
- handler(w, req)
- return w.Body.String()
-}
-
-// HTTPBodyContains asserts that a specified handler returns a
-// body that contains a string.
-//
-// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- body := HTTPBody(handler, method, url, values)
-
- contains := strings.Contains(body, fmt.Sprint(str))
- if !contains {
- Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body))
- }
-
- return contains
-}
-
-// HTTPBodyNotContains asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// assert.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) bool {
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- body := HTTPBody(handler, method, url, values)
-
- contains := strings.Contains(body, fmt.Sprint(str))
- if contains {
- Fail(t, fmt.Sprintf("Expected response body for \"%s\" to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body))
- }
-
- return !contains
-}
diff --git a/vendor/github.com/stretchr/testify/require/doc.go b/vendor/github.com/stretchr/testify/require/doc.go
deleted file mode 100644
index 169de392..00000000
--- a/vendor/github.com/stretchr/testify/require/doc.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// Package require implements the same assertions as the `assert` package but
-// stops test execution when a test fails.
-//
-// Example Usage
-//
-// The following is a complete example using require in a standard test function:
-// import (
-// "testing"
-// "github.com/stretchr/testify/require"
-// )
-//
-// func TestSomething(t *testing.T) {
-//
-// var a string = "Hello"
-// var b string = "Hello"
-//
-// require.Equal(t, a, b, "The two words should be the same.")
-//
-// }
-//
-// Assertions
-//
-// The `require` package have same global functions as in the `assert` package,
-// but instead of returning a boolean result they call `t.FailNow()`.
-//
-// Every assertion function also takes an optional string message as the final argument,
-// allowing custom error messages to be appended to the message the assertion method outputs.
-package require
diff --git a/vendor/github.com/stretchr/testify/require/forward_requirements.go b/vendor/github.com/stretchr/testify/require/forward_requirements.go
deleted file mode 100644
index ac71d405..00000000
--- a/vendor/github.com/stretchr/testify/require/forward_requirements.go
+++ /dev/null
@@ -1,16 +0,0 @@
-package require
-
-// Assertions provides assertion methods around the
-// TestingT interface.
-type Assertions struct {
- t TestingT
-}
-
-// New makes a new Assertions object for the specified TestingT.
-func New(t TestingT) *Assertions {
- return &Assertions{
- t: t,
- }
-}
-
-//go:generate go run ../_codegen/main.go -output-package=require -template=require_forward.go.tmpl -include-format-funcs
diff --git a/vendor/github.com/stretchr/testify/require/require.go b/vendor/github.com/stretchr/testify/require/require.go
deleted file mode 100644
index 535f2934..00000000
--- a/vendor/github.com/stretchr/testify/require/require.go
+++ /dev/null
@@ -1,1227 +0,0 @@
-/*
-* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen
-* THIS FILE MUST NOT BE EDITED BY HAND
- */
-
-package require
-
-import (
- assert "github.com/stretchr/testify/assert"
- http "net/http"
- url "net/url"
- time "time"
-)
-
-// Condition uses a Comparison to assert a complex condition.
-func Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) {
- if assert.Condition(t, comp, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Conditionf uses a Comparison to assert a complex condition.
-func Conditionf(t TestingT, comp assert.Comparison, msg string, args ...interface{}) {
- if assert.Conditionf(t, comp, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Contains asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// assert.Contains(t, "Hello World", "World")
-// assert.Contains(t, ["Hello", "World"], "World")
-// assert.Contains(t, {"Hello": "World"}, "Hello")
-func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
- if assert.Contains(t, s, contains, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Containsf asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// assert.Containsf(t, "Hello World", "World", "error message %s", "formatted")
-// assert.Containsf(t, ["Hello", "World"], "World", "error message %s", "formatted")
-// assert.Containsf(t, {"Hello": "World"}, "Hello", "error message %s", "formatted")
-func Containsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {
- if assert.Containsf(t, s, contains, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
-func DirExists(t TestingT, path string, msgAndArgs ...interface{}) {
- if assert.DirExists(t, path, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
-func DirExistsf(t TestingT, path string, msg string, args ...interface{}) {
- if assert.DirExistsf(t, path, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// assert.ElementsMatch(t, [1, 3, 2, 3], [1, 3, 3, 2])
-func ElementsMatch(t TestingT, listA interface{}, listB interface{}, msgAndArgs ...interface{}) {
- if assert.ElementsMatch(t, listA, listB, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// assert.ElementsMatchf(t, [1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
-func ElementsMatchf(t TestingT, listA interface{}, listB interface{}, msg string, args ...interface{}) {
- if assert.ElementsMatchf(t, listA, listB, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// assert.Empty(t, obj)
-func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
- if assert.Empty(t, object, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// assert.Emptyf(t, obj, "error message %s", "formatted")
-func Emptyf(t TestingT, object interface{}, msg string, args ...interface{}) {
- if assert.Emptyf(t, object, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Equal asserts that two objects are equal.
-//
-// assert.Equal(t, 123, 123)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if assert.Equal(t, expected, actual, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// EqualError asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// assert.EqualError(t, err, expectedErrorString)
-func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) {
- if assert.EqualError(t, theError, errString, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// assert.EqualErrorf(t, err, expectedErrorString, "error message %s", "formatted")
-func EqualErrorf(t TestingT, theError error, errString string, msg string, args ...interface{}) {
- if assert.EqualErrorf(t, theError, errString, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// EqualValues asserts that two objects are equal or convertable to the same types
-// and equal.
-//
-// assert.EqualValues(t, uint32(123), int32(123))
-func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if assert.EqualValues(t, expected, actual, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// EqualValuesf asserts that two objects are equal or convertable to the same types
-// and equal.
-//
-// assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123))
-func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if assert.EqualValuesf(t, expected, actual, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Equalf asserts that two objects are equal.
-//
-// assert.Equalf(t, 123, 123, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func Equalf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if assert.Equalf(t, expected, actual, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Error asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if assert.Error(t, err) {
-// assert.Equal(t, expectedError, err)
-// }
-func Error(t TestingT, err error, msgAndArgs ...interface{}) {
- if assert.Error(t, err, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Errorf asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if assert.Errorf(t, err, "error message %s", "formatted") {
-// assert.Equal(t, expectedErrorf, err)
-// }
-func Errorf(t TestingT, err error, msg string, args ...interface{}) {
- if assert.Errorf(t, err, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Exactly asserts that two objects are equal in value and type.
-//
-// assert.Exactly(t, int32(123), int64(123))
-func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if assert.Exactly(t, expected, actual, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Exactlyf asserts that two objects are equal in value and type.
-//
-// assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123))
-func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if assert.Exactlyf(t, expected, actual, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Fail reports a failure through
-func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
- if assert.Fail(t, failureMessage, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// FailNow fails test
-func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) {
- if assert.FailNow(t, failureMessage, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// FailNowf fails test
-func FailNowf(t TestingT, failureMessage string, msg string, args ...interface{}) {
- if assert.FailNowf(t, failureMessage, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Failf reports a failure through
-func Failf(t TestingT, failureMessage string, msg string, args ...interface{}) {
- if assert.Failf(t, failureMessage, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// False asserts that the specified value is false.
-//
-// assert.False(t, myBool)
-func False(t TestingT, value bool, msgAndArgs ...interface{}) {
- if assert.False(t, value, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Falsef asserts that the specified value is false.
-//
-// assert.Falsef(t, myBool, "error message %s", "formatted")
-func Falsef(t TestingT, value bool, msg string, args ...interface{}) {
- if assert.Falsef(t, value, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
-func FileExists(t TestingT, path string, msgAndArgs ...interface{}) {
- if assert.FileExists(t, path, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
-func FileExistsf(t TestingT, path string, msg string, args ...interface{}) {
- if assert.FileExistsf(t, path, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// HTTPBodyContains asserts that a specified handler returns a
-// body that contains a string.
-//
-// assert.HTTPBodyContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
- if assert.HTTPBodyContains(t, handler, method, url, values, str, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// HTTPBodyContainsf asserts that a specified handler returns a
-// body that contains a string.
-//
-// assert.HTTPBodyContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
- if assert.HTTPBodyContainsf(t, handler, method, url, values, str, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// HTTPBodyNotContains asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// assert.HTTPBodyNotContains(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
- if assert.HTTPBodyNotContains(t, handler, method, url, values, str, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// HTTPBodyNotContainsf asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// assert.HTTPBodyNotContainsf(t, myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
- if assert.HTTPBodyNotContainsf(t, handler, method, url, values, str, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// HTTPError asserts that a specified handler returns an error status code.
-//
-// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
- if assert.HTTPError(t, handler, method, url, values, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// HTTPErrorf asserts that a specified handler returns an error status code.
-//
-// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
-func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
- if assert.HTTPErrorf(t, handler, method, url, values, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// HTTPRedirect asserts that a specified handler returns a redirect status code.
-//
-// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
- if assert.HTTPRedirect(t, handler, method, url, values, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// HTTPRedirectf asserts that a specified handler returns a redirect status code.
-//
-// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
-func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
- if assert.HTTPRedirectf(t, handler, method, url, values, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// HTTPSuccess asserts that a specified handler returns a success status code.
-//
-// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil)
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
- if assert.HTTPSuccess(t, handler, method, url, values, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// HTTPSuccessf asserts that a specified handler returns a success status code.
-//
-// assert.HTTPSuccessf(t, myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
- if assert.HTTPSuccessf(t, handler, method, url, values, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Implements asserts that an object is implemented by the specified interface.
-//
-// assert.Implements(t, (*MyInterface)(nil), new(MyObject))
-func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
- if assert.Implements(t, interfaceObject, object, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Implementsf asserts that an object is implemented by the specified interface.
-//
-// assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
-func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
- if assert.Implementsf(t, interfaceObject, object, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// InDelta asserts that the two numerals are within delta of each other.
-//
-// assert.InDelta(t, math.Pi, (22 / 7.0), 0.01)
-func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
- if assert.InDelta(t, expected, actual, delta, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func InDeltaMapValues(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
- if assert.InDeltaMapValues(t, expected, actual, delta, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func InDeltaMapValuesf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
- if assert.InDeltaMapValuesf(t, expected, actual, delta, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// InDeltaSlice is the same as InDelta, except it compares two slices.
-func InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
- if assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// InDeltaSlicef is the same as InDelta, except it compares two slices.
-func InDeltaSlicef(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
- if assert.InDeltaSlicef(t, expected, actual, delta, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// InDeltaf asserts that the two numerals are within delta of each other.
-//
-// assert.InDeltaf(t, math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
-func InDeltaf(t TestingT, expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
- if assert.InDeltaf(t, expected, actual, delta, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// InEpsilon asserts that expected and actual have a relative error less than epsilon
-func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
- if assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
-func InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
- if assert.InEpsilonSlice(t, expected, actual, epsilon, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
-func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
- if assert.InEpsilonSlicef(t, expected, actual, epsilon, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// InEpsilonf asserts that expected and actual have a relative error less than epsilon
-func InEpsilonf(t TestingT, expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
- if assert.InEpsilonf(t, expected, actual, epsilon, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// IsType asserts that the specified objects are of the same type.
-func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {
- if assert.IsType(t, expectedType, object, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// IsTypef asserts that the specified objects are of the same type.
-func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) {
- if assert.IsTypef(t, expectedType, object, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// JSONEq asserts that two JSON strings are equivalent.
-//
-// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
-func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) {
- if assert.JSONEq(t, expected, actual, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// JSONEqf asserts that two JSON strings are equivalent.
-//
-// assert.JSONEqf(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
-func JSONEqf(t TestingT, expected string, actual string, msg string, args ...interface{}) {
- if assert.JSONEqf(t, expected, actual, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Len asserts that the specified object has specific length.
-// Len also fails if the object has a type that len() not accept.
-//
-// assert.Len(t, mySlice, 3)
-func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) {
- if assert.Len(t, object, length, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Lenf asserts that the specified object has specific length.
-// Lenf also fails if the object has a type that len() not accept.
-//
-// assert.Lenf(t, mySlice, 3, "error message %s", "formatted")
-func Lenf(t TestingT, object interface{}, length int, msg string, args ...interface{}) {
- if assert.Lenf(t, object, length, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Nil asserts that the specified object is nil.
-//
-// assert.Nil(t, err)
-func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
- if assert.Nil(t, object, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Nilf asserts that the specified object is nil.
-//
-// assert.Nilf(t, err, "error message %s", "formatted")
-func Nilf(t TestingT, object interface{}, msg string, args ...interface{}) {
- if assert.Nilf(t, object, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NoError asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if assert.NoError(t, err) {
-// assert.Equal(t, expectedObj, actualObj)
-// }
-func NoError(t TestingT, err error, msgAndArgs ...interface{}) {
- if assert.NoError(t, err, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NoErrorf asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if assert.NoErrorf(t, err, "error message %s", "formatted") {
-// assert.Equal(t, expectedObj, actualObj)
-// }
-func NoErrorf(t TestingT, err error, msg string, args ...interface{}) {
- if assert.NoErrorf(t, err, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// assert.NotContains(t, "Hello World", "Earth")
-// assert.NotContains(t, ["Hello", "World"], "Earth")
-// assert.NotContains(t, {"Hello": "World"}, "Earth")
-func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) {
- if assert.NotContains(t, s, contains, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// assert.NotContainsf(t, "Hello World", "Earth", "error message %s", "formatted")
-// assert.NotContainsf(t, ["Hello", "World"], "Earth", "error message %s", "formatted")
-// assert.NotContainsf(t, {"Hello": "World"}, "Earth", "error message %s", "formatted")
-func NotContainsf(t TestingT, s interface{}, contains interface{}, msg string, args ...interface{}) {
- if assert.NotContainsf(t, s, contains, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if assert.NotEmpty(t, obj) {
-// assert.Equal(t, "two", obj[1])
-// }
-func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) {
- if assert.NotEmpty(t, object, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if assert.NotEmptyf(t, obj, "error message %s", "formatted") {
-// assert.Equal(t, "two", obj[1])
-// }
-func NotEmptyf(t TestingT, object interface{}, msg string, args ...interface{}) {
- if assert.NotEmptyf(t, object, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotEqual asserts that the specified values are NOT equal.
-//
-// assert.NotEqual(t, obj1, obj2)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if assert.NotEqual(t, expected, actual, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotEqualf asserts that the specified values are NOT equal.
-//
-// assert.NotEqualf(t, obj1, obj2, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func NotEqualf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if assert.NotEqualf(t, expected, actual, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotNil asserts that the specified object is not nil.
-//
-// assert.NotNil(t, err)
-func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) {
- if assert.NotNil(t, object, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotNilf asserts that the specified object is not nil.
-//
-// assert.NotNilf(t, err, "error message %s", "formatted")
-func NotNilf(t TestingT, object interface{}, msg string, args ...interface{}) {
- if assert.NotNilf(t, object, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// assert.NotPanics(t, func(){ RemainCalm() })
-func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
- if assert.NotPanics(t, f, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// assert.NotPanicsf(t, func(){ RemainCalm() }, "error message %s", "formatted")
-func NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {
- if assert.NotPanicsf(t, f, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotRegexp asserts that a specified regexp does not match a string.
-//
-// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
-// assert.NotRegexp(t, "^start", "it's not starting")
-func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
- if assert.NotRegexp(t, rx, str, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotRegexpf asserts that a specified regexp does not match a string.
-//
-// assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
-// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
-func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
- if assert.NotRegexpf(t, rx, str, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotSubset asserts that the specified list(array, slice...) contains not all
-// elements given in the specified subset(array, slice...).
-//
-// assert.NotSubset(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
-func NotSubset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {
- if assert.NotSubset(t, list, subset, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotSubsetf asserts that the specified list(array, slice...) contains not all
-// elements given in the specified subset(array, slice...).
-//
-// assert.NotSubsetf(t, [1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
-func NotSubsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {
- if assert.NotSubsetf(t, list, subset, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotZero asserts that i is not the zero value for its type.
-func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) {
- if assert.NotZero(t, i, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// NotZerof asserts that i is not the zero value for its type.
-func NotZerof(t TestingT, i interface{}, msg string, args ...interface{}) {
- if assert.NotZerof(t, i, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Panics asserts that the code inside the specified PanicTestFunc panics.
-//
-// assert.Panics(t, func(){ GoCrazy() })
-func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
- if assert.Panics(t, f, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// assert.PanicsWithValue(t, "crazy error", func(){ GoCrazy() })
-func PanicsWithValue(t TestingT, expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
- if assert.PanicsWithValue(t, expected, f, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// assert.PanicsWithValuef(t, "crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
-func PanicsWithValuef(t TestingT, expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {
- if assert.PanicsWithValuef(t, expected, f, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Panicsf asserts that the code inside the specified PanicTestFunc panics.
-//
-// assert.Panicsf(t, func(){ GoCrazy() }, "error message %s", "formatted")
-func Panicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interface{}) {
- if assert.Panicsf(t, f, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Regexp asserts that a specified regexp matches a string.
-//
-// assert.Regexp(t, regexp.MustCompile("start"), "it's starting")
-// assert.Regexp(t, "start...$", "it's not starting")
-func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
- if assert.Regexp(t, rx, str, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Regexpf asserts that a specified regexp matches a string.
-//
-// assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
-// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
-func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
- if assert.Regexpf(t, rx, str, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Subset asserts that the specified list(array, slice...) contains all
-// elements given in the specified subset(array, slice...).
-//
-// assert.Subset(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
-func Subset(t TestingT, list interface{}, subset interface{}, msgAndArgs ...interface{}) {
- if assert.Subset(t, list, subset, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Subsetf asserts that the specified list(array, slice...) contains all
-// elements given in the specified subset(array, slice...).
-//
-// assert.Subsetf(t, [1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
-func Subsetf(t TestingT, list interface{}, subset interface{}, msg string, args ...interface{}) {
- if assert.Subsetf(t, list, subset, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// True asserts that the specified value is true.
-//
-// assert.True(t, myBool)
-func True(t TestingT, value bool, msgAndArgs ...interface{}) {
- if assert.True(t, value, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Truef asserts that the specified value is true.
-//
-// assert.Truef(t, myBool, "error message %s", "formatted")
-func Truef(t TestingT, value bool, msg string, args ...interface{}) {
- if assert.Truef(t, value, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// WithinDuration asserts that the two times are within duration delta of each other.
-//
-// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second)
-func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {
- if assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// WithinDurationf asserts that the two times are within duration delta of each other.
-//
-// assert.WithinDurationf(t, time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
-func WithinDurationf(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {
- if assert.WithinDurationf(t, expected, actual, delta, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Zero asserts that i is the zero value for its type.
-func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) {
- if assert.Zero(t, i, msgAndArgs...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
-
-// Zerof asserts that i is the zero value for its type.
-func Zerof(t TestingT, i interface{}, msg string, args ...interface{}) {
- if assert.Zerof(t, i, msg, args...) {
- return
- }
- if h, ok := t.(tHelper); ok {
- h.Helper()
- }
- t.FailNow()
-}
diff --git a/vendor/github.com/stretchr/testify/require/require.go.tmpl b/vendor/github.com/stretchr/testify/require/require.go.tmpl
deleted file mode 100644
index 6ffc751b..00000000
--- a/vendor/github.com/stretchr/testify/require/require.go.tmpl
+++ /dev/null
@@ -1,6 +0,0 @@
-{{.Comment}}
-func {{.DocInfo.Name}}(t TestingT, {{.Params}}) {
- if assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) { return }
- if h, ok := t.(tHelper); ok { h.Helper() }
- t.FailNow()
-}
diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go b/vendor/github.com/stretchr/testify/require/require_forward.go
deleted file mode 100644
index 9fe41dbd..00000000
--- a/vendor/github.com/stretchr/testify/require/require_forward.go
+++ /dev/null
@@ -1,957 +0,0 @@
-/*
-* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen
-* THIS FILE MUST NOT BE EDITED BY HAND
- */
-
-package require
-
-import (
- assert "github.com/stretchr/testify/assert"
- http "net/http"
- url "net/url"
- time "time"
-)
-
-// Condition uses a Comparison to assert a complex condition.
-func (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Condition(a.t, comp, msgAndArgs...)
-}
-
-// Conditionf uses a Comparison to assert a complex condition.
-func (a *Assertions) Conditionf(comp assert.Comparison, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Conditionf(a.t, comp, msg, args...)
-}
-
-// Contains asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// a.Contains("Hello World", "World")
-// a.Contains(["Hello", "World"], "World")
-// a.Contains({"Hello": "World"}, "Hello")
-func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Contains(a.t, s, contains, msgAndArgs...)
-}
-
-// Containsf asserts that the specified string, list(array, slice...) or map contains the
-// specified substring or element.
-//
-// a.Containsf("Hello World", "World", "error message %s", "formatted")
-// a.Containsf(["Hello", "World"], "World", "error message %s", "formatted")
-// a.Containsf({"Hello": "World"}, "Hello", "error message %s", "formatted")
-func (a *Assertions) Containsf(s interface{}, contains interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Containsf(a.t, s, contains, msg, args...)
-}
-
-// DirExists checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
-func (a *Assertions) DirExists(path string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- DirExists(a.t, path, msgAndArgs...)
-}
-
-// DirExistsf checks whether a directory exists in the given path. It also fails if the path is a file rather a directory or there is an error checking whether it exists.
-func (a *Assertions) DirExistsf(path string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- DirExistsf(a.t, path, msg, args...)
-}
-
-// ElementsMatch asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// a.ElementsMatch([1, 3, 2, 3], [1, 3, 3, 2])
-func (a *Assertions) ElementsMatch(listA interface{}, listB interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- ElementsMatch(a.t, listA, listB, msgAndArgs...)
-}
-
-// ElementsMatchf asserts that the specified listA(array, slice...) is equal to specified
-// listB(array, slice...) ignoring the order of the elements. If there are duplicate elements,
-// the number of appearances of each of them in both lists should match.
-//
-// a.ElementsMatchf([1, 3, 2, 3], [1, 3, 3, 2], "error message %s", "formatted")
-func (a *Assertions) ElementsMatchf(listA interface{}, listB interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- ElementsMatchf(a.t, listA, listB, msg, args...)
-}
-
-// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// a.Empty(obj)
-func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Empty(a.t, object, msgAndArgs...)
-}
-
-// Emptyf asserts that the specified object is empty. I.e. nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// a.Emptyf(obj, "error message %s", "formatted")
-func (a *Assertions) Emptyf(object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Emptyf(a.t, object, msg, args...)
-}
-
-// Equal asserts that two objects are equal.
-//
-// a.Equal(123, 123)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Equal(a.t, expected, actual, msgAndArgs...)
-}
-
-// EqualError asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// a.EqualError(err, expectedErrorString)
-func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- EqualError(a.t, theError, errString, msgAndArgs...)
-}
-
-// EqualErrorf asserts that a function returned an error (i.e. not `nil`)
-// and that it is equal to the provided error.
-//
-// actualObj, err := SomeFunction()
-// a.EqualErrorf(err, expectedErrorString, "error message %s", "formatted")
-func (a *Assertions) EqualErrorf(theError error, errString string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- EqualErrorf(a.t, theError, errString, msg, args...)
-}
-
-// EqualValues asserts that two objects are equal or convertable to the same types
-// and equal.
-//
-// a.EqualValues(uint32(123), int32(123))
-func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- EqualValues(a.t, expected, actual, msgAndArgs...)
-}
-
-// EqualValuesf asserts that two objects are equal or convertable to the same types
-// and equal.
-//
-// a.EqualValuesf(uint32(123, "error message %s", "formatted"), int32(123))
-func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- EqualValuesf(a.t, expected, actual, msg, args...)
-}
-
-// Equalf asserts that two objects are equal.
-//
-// a.Equalf(123, 123, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses). Function equality
-// cannot be determined and will always fail.
-func (a *Assertions) Equalf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Equalf(a.t, expected, actual, msg, args...)
-}
-
-// Error asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.Error(err) {
-// assert.Equal(t, expectedError, err)
-// }
-func (a *Assertions) Error(err error, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Error(a.t, err, msgAndArgs...)
-}
-
-// Errorf asserts that a function returned an error (i.e. not `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.Errorf(err, "error message %s", "formatted") {
-// assert.Equal(t, expectedErrorf, err)
-// }
-func (a *Assertions) Errorf(err error, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Errorf(a.t, err, msg, args...)
-}
-
-// Exactly asserts that two objects are equal in value and type.
-//
-// a.Exactly(int32(123), int64(123))
-func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Exactly(a.t, expected, actual, msgAndArgs...)
-}
-
-// Exactlyf asserts that two objects are equal in value and type.
-//
-// a.Exactlyf(int32(123, "error message %s", "formatted"), int64(123))
-func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Exactlyf(a.t, expected, actual, msg, args...)
-}
-
-// Fail reports a failure through
-func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Fail(a.t, failureMessage, msgAndArgs...)
-}
-
-// FailNow fails test
-func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- FailNow(a.t, failureMessage, msgAndArgs...)
-}
-
-// FailNowf fails test
-func (a *Assertions) FailNowf(failureMessage string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- FailNowf(a.t, failureMessage, msg, args...)
-}
-
-// Failf reports a failure through
-func (a *Assertions) Failf(failureMessage string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Failf(a.t, failureMessage, msg, args...)
-}
-
-// False asserts that the specified value is false.
-//
-// a.False(myBool)
-func (a *Assertions) False(value bool, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- False(a.t, value, msgAndArgs...)
-}
-
-// Falsef asserts that the specified value is false.
-//
-// a.Falsef(myBool, "error message %s", "formatted")
-func (a *Assertions) Falsef(value bool, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Falsef(a.t, value, msg, args...)
-}
-
-// FileExists checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
-func (a *Assertions) FileExists(path string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- FileExists(a.t, path, msgAndArgs...)
-}
-
-// FileExistsf checks whether a file exists in the given path. It also fails if the path points to a directory or there is an error when trying to check the file.
-func (a *Assertions) FileExistsf(path string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- FileExistsf(a.t, path, msg, args...)
-}
-
-// HTTPBodyContains asserts that a specified handler returns a
-// body that contains a string.
-//
-// a.HTTPBodyContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPBodyContains(a.t, handler, method, url, values, str, msgAndArgs...)
-}
-
-// HTTPBodyContainsf asserts that a specified handler returns a
-// body that contains a string.
-//
-// a.HTTPBodyContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPBodyContainsf(a.t, handler, method, url, values, str, msg, args...)
-}
-
-// HTTPBodyNotContains asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// a.HTTPBodyNotContains(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPBodyNotContains(a.t, handler, method, url, values, str, msgAndArgs...)
-}
-
-// HTTPBodyNotContainsf asserts that a specified handler returns a
-// body that does not contain a string.
-//
-// a.HTTPBodyNotContainsf(myHandler, "GET", "www.google.com", nil, "I'm Feeling Lucky", "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPBodyNotContainsf(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPBodyNotContainsf(a.t, handler, method, url, values, str, msg, args...)
-}
-
-// HTTPError asserts that a specified handler returns an error status code.
-//
-// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPError(a.t, handler, method, url, values, msgAndArgs...)
-}
-
-// HTTPErrorf asserts that a specified handler returns an error status code.
-//
-// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
-func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPErrorf(a.t, handler, method, url, values, msg, args...)
-}
-
-// HTTPRedirect asserts that a specified handler returns a redirect status code.
-//
-// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPRedirect(a.t, handler, method, url, values, msgAndArgs...)
-}
-
-// HTTPRedirectf asserts that a specified handler returns a redirect status code.
-//
-// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
-//
-// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
-func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPRedirectf(a.t, handler, method, url, values, msg, args...)
-}
-
-// HTTPSuccess asserts that a specified handler returns a success status code.
-//
-// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil)
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPSuccess(a.t, handler, method, url, values, msgAndArgs...)
-}
-
-// HTTPSuccessf asserts that a specified handler returns a success status code.
-//
-// a.HTTPSuccessf(myHandler, "POST", "http://www.google.com", nil, "error message %s", "formatted")
-//
-// Returns whether the assertion was successful (true) or not (false).
-func (a *Assertions) HTTPSuccessf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- HTTPSuccessf(a.t, handler, method, url, values, msg, args...)
-}
-
-// Implements asserts that an object is implemented by the specified interface.
-//
-// a.Implements((*MyInterface)(nil), new(MyObject))
-func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Implements(a.t, interfaceObject, object, msgAndArgs...)
-}
-
-// Implementsf asserts that an object is implemented by the specified interface.
-//
-// a.Implementsf((*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
-func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Implementsf(a.t, interfaceObject, object, msg, args...)
-}
-
-// InDelta asserts that the two numerals are within delta of each other.
-//
-// a.InDelta(math.Pi, (22 / 7.0), 0.01)
-func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InDelta(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// InDeltaMapValues is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func (a *Assertions) InDeltaMapValues(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InDeltaMapValues(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// InDeltaMapValuesf is the same as InDelta, but it compares all values between two maps. Both maps must have exactly the same keys.
-func (a *Assertions) InDeltaMapValuesf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InDeltaMapValuesf(a.t, expected, actual, delta, msg, args...)
-}
-
-// InDeltaSlice is the same as InDelta, except it compares two slices.
-func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// InDeltaSlicef is the same as InDelta, except it compares two slices.
-func (a *Assertions) InDeltaSlicef(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InDeltaSlicef(a.t, expected, actual, delta, msg, args...)
-}
-
-// InDeltaf asserts that the two numerals are within delta of each other.
-//
-// a.InDeltaf(math.Pi, (22 / 7.0, "error message %s", "formatted"), 0.01)
-func (a *Assertions) InDeltaf(expected interface{}, actual interface{}, delta float64, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InDeltaf(a.t, expected, actual, delta, msg, args...)
-}
-
-// InEpsilon asserts that expected and actual have a relative error less than epsilon
-func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...)
-}
-
-// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices.
-func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InEpsilonSlice(a.t, expected, actual, epsilon, msgAndArgs...)
-}
-
-// InEpsilonSlicef is the same as InEpsilon, except it compares each value from two slices.
-func (a *Assertions) InEpsilonSlicef(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InEpsilonSlicef(a.t, expected, actual, epsilon, msg, args...)
-}
-
-// InEpsilonf asserts that expected and actual have a relative error less than epsilon
-func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilon float64, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- InEpsilonf(a.t, expected, actual, epsilon, msg, args...)
-}
-
-// IsType asserts that the specified objects are of the same type.
-func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- IsType(a.t, expectedType, object, msgAndArgs...)
-}
-
-// IsTypef asserts that the specified objects are of the same type.
-func (a *Assertions) IsTypef(expectedType interface{}, object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- IsTypef(a.t, expectedType, object, msg, args...)
-}
-
-// JSONEq asserts that two JSON strings are equivalent.
-//
-// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
-func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- JSONEq(a.t, expected, actual, msgAndArgs...)
-}
-
-// JSONEqf asserts that two JSON strings are equivalent.
-//
-// a.JSONEqf(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`, "error message %s", "formatted")
-func (a *Assertions) JSONEqf(expected string, actual string, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- JSONEqf(a.t, expected, actual, msg, args...)
-}
-
-// Len asserts that the specified object has specific length.
-// Len also fails if the object has a type that len() not accept.
-//
-// a.Len(mySlice, 3)
-func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Len(a.t, object, length, msgAndArgs...)
-}
-
-// Lenf asserts that the specified object has specific length.
-// Lenf also fails if the object has a type that len() not accept.
-//
-// a.Lenf(mySlice, 3, "error message %s", "formatted")
-func (a *Assertions) Lenf(object interface{}, length int, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Lenf(a.t, object, length, msg, args...)
-}
-
-// Nil asserts that the specified object is nil.
-//
-// a.Nil(err)
-func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Nil(a.t, object, msgAndArgs...)
-}
-
-// Nilf asserts that the specified object is nil.
-//
-// a.Nilf(err, "error message %s", "formatted")
-func (a *Assertions) Nilf(object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Nilf(a.t, object, msg, args...)
-}
-
-// NoError asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.NoError(err) {
-// assert.Equal(t, expectedObj, actualObj)
-// }
-func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NoError(a.t, err, msgAndArgs...)
-}
-
-// NoErrorf asserts that a function returned no error (i.e. `nil`).
-//
-// actualObj, err := SomeFunction()
-// if a.NoErrorf(err, "error message %s", "formatted") {
-// assert.Equal(t, expectedObj, actualObj)
-// }
-func (a *Assertions) NoErrorf(err error, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NoErrorf(a.t, err, msg, args...)
-}
-
-// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// a.NotContains("Hello World", "Earth")
-// a.NotContains(["Hello", "World"], "Earth")
-// a.NotContains({"Hello": "World"}, "Earth")
-func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotContains(a.t, s, contains, msgAndArgs...)
-}
-
-// NotContainsf asserts that the specified string, list(array, slice...) or map does NOT contain the
-// specified substring or element.
-//
-// a.NotContainsf("Hello World", "Earth", "error message %s", "formatted")
-// a.NotContainsf(["Hello", "World"], "Earth", "error message %s", "formatted")
-// a.NotContainsf({"Hello": "World"}, "Earth", "error message %s", "formatted")
-func (a *Assertions) NotContainsf(s interface{}, contains interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotContainsf(a.t, s, contains, msg, args...)
-}
-
-// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if a.NotEmpty(obj) {
-// assert.Equal(t, "two", obj[1])
-// }
-func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotEmpty(a.t, object, msgAndArgs...)
-}
-
-// NotEmptyf asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either
-// a slice or a channel with len == 0.
-//
-// if a.NotEmptyf(obj, "error message %s", "formatted") {
-// assert.Equal(t, "two", obj[1])
-// }
-func (a *Assertions) NotEmptyf(object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotEmptyf(a.t, object, msg, args...)
-}
-
-// NotEqual asserts that the specified values are NOT equal.
-//
-// a.NotEqual(obj1, obj2)
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotEqual(a.t, expected, actual, msgAndArgs...)
-}
-
-// NotEqualf asserts that the specified values are NOT equal.
-//
-// a.NotEqualf(obj1, obj2, "error message %s", "formatted")
-//
-// Pointer variable equality is determined based on the equality of the
-// referenced values (as opposed to the memory addresses).
-func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotEqualf(a.t, expected, actual, msg, args...)
-}
-
-// NotNil asserts that the specified object is not nil.
-//
-// a.NotNil(err)
-func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotNil(a.t, object, msgAndArgs...)
-}
-
-// NotNilf asserts that the specified object is not nil.
-//
-// a.NotNilf(err, "error message %s", "formatted")
-func (a *Assertions) NotNilf(object interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotNilf(a.t, object, msg, args...)
-}
-
-// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// a.NotPanics(func(){ RemainCalm() })
-func (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotPanics(a.t, f, msgAndArgs...)
-}
-
-// NotPanicsf asserts that the code inside the specified PanicTestFunc does NOT panic.
-//
-// a.NotPanicsf(func(){ RemainCalm() }, "error message %s", "formatted")
-func (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotPanicsf(a.t, f, msg, args...)
-}
-
-// NotRegexp asserts that a specified regexp does not match a string.
-//
-// a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
-// a.NotRegexp("^start", "it's not starting")
-func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotRegexp(a.t, rx, str, msgAndArgs...)
-}
-
-// NotRegexpf asserts that a specified regexp does not match a string.
-//
-// a.NotRegexpf(regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
-// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
-func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotRegexpf(a.t, rx, str, msg, args...)
-}
-
-// NotSubset asserts that the specified list(array, slice...) contains not all
-// elements given in the specified subset(array, slice...).
-//
-// a.NotSubset([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]")
-func (a *Assertions) NotSubset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotSubset(a.t, list, subset, msgAndArgs...)
-}
-
-// NotSubsetf asserts that the specified list(array, slice...) contains not all
-// elements given in the specified subset(array, slice...).
-//
-// a.NotSubsetf([1, 3, 4], [1, 2], "But [1, 3, 4] does not contain [1, 2]", "error message %s", "formatted")
-func (a *Assertions) NotSubsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotSubsetf(a.t, list, subset, msg, args...)
-}
-
-// NotZero asserts that i is not the zero value for its type.
-func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotZero(a.t, i, msgAndArgs...)
-}
-
-// NotZerof asserts that i is not the zero value for its type.
-func (a *Assertions) NotZerof(i interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- NotZerof(a.t, i, msg, args...)
-}
-
-// Panics asserts that the code inside the specified PanicTestFunc panics.
-//
-// a.Panics(func(){ GoCrazy() })
-func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Panics(a.t, f, msgAndArgs...)
-}
-
-// PanicsWithValue asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// a.PanicsWithValue("crazy error", func(){ GoCrazy() })
-func (a *Assertions) PanicsWithValue(expected interface{}, f assert.PanicTestFunc, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- PanicsWithValue(a.t, expected, f, msgAndArgs...)
-}
-
-// PanicsWithValuef asserts that the code inside the specified PanicTestFunc panics, and that
-// the recovered panic value equals the expected panic value.
-//
-// a.PanicsWithValuef("crazy error", func(){ GoCrazy() }, "error message %s", "formatted")
-func (a *Assertions) PanicsWithValuef(expected interface{}, f assert.PanicTestFunc, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- PanicsWithValuef(a.t, expected, f, msg, args...)
-}
-
-// Panicsf asserts that the code inside the specified PanicTestFunc panics.
-//
-// a.Panicsf(func(){ GoCrazy() }, "error message %s", "formatted")
-func (a *Assertions) Panicsf(f assert.PanicTestFunc, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Panicsf(a.t, f, msg, args...)
-}
-
-// Regexp asserts that a specified regexp matches a string.
-//
-// a.Regexp(regexp.MustCompile("start"), "it's starting")
-// a.Regexp("start...$", "it's not starting")
-func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Regexp(a.t, rx, str, msgAndArgs...)
-}
-
-// Regexpf asserts that a specified regexp matches a string.
-//
-// a.Regexpf(regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
-// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
-func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Regexpf(a.t, rx, str, msg, args...)
-}
-
-// Subset asserts that the specified list(array, slice...) contains all
-// elements given in the specified subset(array, slice...).
-//
-// a.Subset([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]")
-func (a *Assertions) Subset(list interface{}, subset interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Subset(a.t, list, subset, msgAndArgs...)
-}
-
-// Subsetf asserts that the specified list(array, slice...) contains all
-// elements given in the specified subset(array, slice...).
-//
-// a.Subsetf([1, 2, 3], [1, 2], "But [1, 2, 3] does contain [1, 2]", "error message %s", "formatted")
-func (a *Assertions) Subsetf(list interface{}, subset interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Subsetf(a.t, list, subset, msg, args...)
-}
-
-// True asserts that the specified value is true.
-//
-// a.True(myBool)
-func (a *Assertions) True(value bool, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- True(a.t, value, msgAndArgs...)
-}
-
-// Truef asserts that the specified value is true.
-//
-// a.Truef(myBool, "error message %s", "formatted")
-func (a *Assertions) Truef(value bool, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Truef(a.t, value, msg, args...)
-}
-
-// WithinDuration asserts that the two times are within duration delta of each other.
-//
-// a.WithinDuration(time.Now(), time.Now(), 10*time.Second)
-func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- WithinDuration(a.t, expected, actual, delta, msgAndArgs...)
-}
-
-// WithinDurationf asserts that the two times are within duration delta of each other.
-//
-// a.WithinDurationf(time.Now(), time.Now(), 10*time.Second, "error message %s", "formatted")
-func (a *Assertions) WithinDurationf(expected time.Time, actual time.Time, delta time.Duration, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- WithinDurationf(a.t, expected, actual, delta, msg, args...)
-}
-
-// Zero asserts that i is the zero value for its type.
-func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Zero(a.t, i, msgAndArgs...)
-}
-
-// Zerof asserts that i is the zero value for its type.
-func (a *Assertions) Zerof(i interface{}, msg string, args ...interface{}) {
- if h, ok := a.t.(tHelper); ok {
- h.Helper()
- }
- Zerof(a.t, i, msg, args...)
-}
diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl b/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl
deleted file mode 100644
index 54124df1..00000000
--- a/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl
+++ /dev/null
@@ -1,5 +0,0 @@
-{{.CommentWithoutT "a"}}
-func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) {
- if h, ok := a.t.(tHelper); ok { h.Helper() }
- {{.DocInfo.Name}}(a.t, {{.ForwardedParams}})
-}
diff --git a/vendor/github.com/stretchr/testify/require/requirements.go b/vendor/github.com/stretchr/testify/require/requirements.go
deleted file mode 100644
index 690583a8..00000000
--- a/vendor/github.com/stretchr/testify/require/requirements.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package require
-
-// TestingT is an interface wrapper around *testing.T
-type TestingT interface {
- Errorf(format string, args ...interface{})
- FailNow()
-}
-
-type tHelper interface {
- Helper()
-}
-
-// ComparisonAssertionFunc is a common function prototype when comparing two values. Can be useful
-// for table driven tests.
-type ComparisonAssertionFunc func(TestingT, interface{}, interface{}, ...interface{})
-
-// ValueAssertionFunc is a common function prototype when validating a single value. Can be useful
-// for table driven tests.
-type ValueAssertionFunc func(TestingT, interface{}, ...interface{})
-
-// BoolAssertionFunc is a common function prototype when validating a bool value. Can be useful
-// for table driven tests.
-type BoolAssertionFunc func(TestingT, bool, ...interface{})
-
-// ValuesAssertionFunc is a common function prototype when validating an error value. Can be useful
-// for table driven tests.
-type ErrorAssertionFunc func(TestingT, error, ...interface{})
-
-//go:generate go run ../_codegen/main.go -output-package=require -template=require.go.tmpl -include-format-funcs
diff --git a/vendor/github.com/theckman/goconstraint/LICENSE b/vendor/github.com/theckman/goconstraint/LICENSE
deleted file mode 100644
index 9403d859..00000000
--- a/vendor/github.com/theckman/goconstraint/LICENSE
+++ /dev/null
@@ -1,9 +0,0 @@
-This package is released under two software licenses (MIT | Public Domain):
-
-* The `scripts/` directory is released under the MIT License. This license can
- be found in the `LICENSES` directory as mit.txt [1].
-* All other files are released to the Public Domain using The Unlicense . This
- license can be found in the `LICENSES` directory as unlicense.txt [2].
-
-[1] https://github.com/theckman/goconstraint/blob/master/LICENSES/mit.txt
-[2] https://github.com/theckman/goconstraint/blob/master/LICENSES/unlicense.txt
diff --git a/vendor/github.com/theckman/goconstraint/LICENSES/unlicense.txt b/vendor/github.com/theckman/goconstraint/LICENSES/unlicense.txt
deleted file mode 100644
index fdddb29a..00000000
--- a/vendor/github.com/theckman/goconstraint/LICENSES/unlicense.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-This is free and unencumbered software released into the public domain.
-
-Anyone is free to copy, modify, publish, use, compile, sell, or
-distribute this software, either in source code form or as a compiled
-binary, for any purpose, commercial or non-commercial, and by any
-means.
-
-In jurisdictions that recognize copyright laws, the author or authors
-of this software dedicate any and all copyright interest in the
-software to the public domain. We make this dedication for the benefit
-of the public at large and to the detriment of our heirs and
-successors. We intend this dedication to be an overt act of
-relinquishment in perpetuity of all present and future rights to this
-software under copyright law.
-
-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 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.
-
-For more information, please refer to <https://unlicense.org>
diff --git a/vendor/github.com/theckman/goconstraint/go1.10/gte/constraint.go b/vendor/github.com/theckman/goconstraint/go1.10/gte/constraint.go
deleted file mode 100644
index 33dc1161..00000000
--- a/vendor/github.com/theckman/goconstraint/go1.10/gte/constraint.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// The contents of this file has been released in to the Public Domain.
-
-// Package gtego110 should only be used as a blank import. If imported, it
-// will only compile if the Go runtime version is >= 1.10.
-package gtego110
-
-// This will fail to compile if the Go runtime version isn't >= 1.10.
-var _ = __SOFTWARE_REQUIRES_GO_VERSION_1_10__
diff --git a/vendor/github.com/theckman/goconstraint/go1.10/gte/go110.go b/vendor/github.com/theckman/goconstraint/go1.10/gte/go110.go
deleted file mode 100644
index 5d586ff9..00000000
--- a/vendor/github.com/theckman/goconstraint/go1.10/gte/go110.go
+++ /dev/null
@@ -1,7 +0,0 @@
-// The contents of this file has been released in to the Public Domain.
-
-// +build go1.10
-
-package gtego110
-
-const __SOFTWARE_REQUIRES_GO_VERSION_1_10__ = uint8(0)
diff --git a/vendor/github.com/vektah/gqlgen/LICENSE b/vendor/github.com/vektah/gqlgen/LICENSE
deleted file mode 100644
index 18e1b249..00000000
--- a/vendor/github.com/vektah/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/vektah/gqlgen/client/client.go b/vendor/github.com/vektah/gqlgen/client/client.go
deleted file mode 100644
index 1d482700..00000000
--- a/vendor/github.com/vektah/gqlgen/client/client.go
+++ /dev/null
@@ -1,141 +0,0 @@
-// client is used internally for testing. See readme for alternatives
-package client
-
-import (
- "bytes"
- "encoding/json"
- "fmt"
- "io/ioutil"
- "net/http"
-
- "github.com/mitchellh/mapstructure"
-)
-
-// Client for graphql requests
-type Client struct {
- url string
- client *http.Client
-}
-
-// New creates a graphql client
-func New(url string, client ...*http.Client) *Client {
- p := &Client{
- url: url,
- }
-
- if len(client) > 0 {
- p.client = client[0]
- } else {
- p.client = http.DefaultClient
- }
- return p
-}
-
-type Request struct {
- Query string `json:"query"`
- Variables map[string]interface{} `json:"variables,omitempty"`
- OperationName string `json:"operationName,omitempty"`
-}
-
-type Option func(r *Request)
-
-func Var(name string, value interface{}) Option {
- return func(r *Request) {
- if r.Variables == nil {
- r.Variables = map[string]interface{}{}
- }
-
- r.Variables[name] = value
- }
-}
-
-func Operation(name string) Option {
- return func(r *Request) {
- r.OperationName = name
- }
-}
-
-func (p *Client) MustPost(query string, response interface{}, options ...Option) {
- if err := p.Post(query, response, options...); err != nil {
- panic(err)
- }
-}
-
-func (p *Client) mkRequest(query string, options ...Option) Request {
- r := Request{
- Query: query,
- }
-
- for _, option := range options {
- option(&r)
- }
-
- return r
-}
-
-func (p *Client) Post(query string, response interface{}, options ...Option) (resperr error) {
- r := p.mkRequest(query, options...)
- requestBody, err := json.Marshal(r)
- if err != nil {
- return fmt.Errorf("encode: %s", err.Error())
- }
-
- rawResponse, err := p.client.Post(p.url, "application/json", bytes.NewBuffer(requestBody))
- if err != nil {
- return fmt.Errorf("post: %s", err.Error())
- }
- defer func() {
- _ = rawResponse.Body.Close()
- }()
-
- if rawResponse.StatusCode >= http.StatusBadRequest {
- responseBody, _ := ioutil.ReadAll(rawResponse.Body)
- return fmt.Errorf("http %d: %s", rawResponse.StatusCode, responseBody)
- }
-
- responseBody, err := ioutil.ReadAll(rawResponse.Body)
- if err != nil {
- return fmt.Errorf("read: %s", err.Error())
- }
-
- // decode it into map string first, let mapstructure do the final decode
- // because it can be much stricter about unknown fields.
- respDataRaw := struct {
- Data interface{}
- Errors json.RawMessage
- }{}
- err = json.Unmarshal(responseBody, &respDataRaw)
- if err != nil {
- return fmt.Errorf("decode: %s", err.Error())
- }
-
- // we want to unpack even if there is an error, so we can see partial responses
- unpackErr := unpack(respDataRaw.Data, response)
-
- if respDataRaw.Errors != nil {
- return RawJsonError{respDataRaw.Errors}
- }
- return unpackErr
-}
-
-type RawJsonError struct {
- json.RawMessage
-}
-
-func (r RawJsonError) Error() string {
- return string(r.RawMessage)
-}
-
-func unpack(data interface{}, into interface{}) error {
- d, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
- Result: into,
- TagName: "json",
- ErrorUnused: true,
- ZeroFields: true,
- })
- if err != nil {
- return fmt.Errorf("mapstructure: %s", err.Error())
- }
-
- return d.Decode(data)
-}
diff --git a/vendor/github.com/vektah/gqlgen/client/readme.md b/vendor/github.com/vektah/gqlgen/client/readme.md
deleted file mode 100644
index 755a1433..00000000
--- a/vendor/github.com/vektah/gqlgen/client/readme.md
+++ /dev/null
@@ -1,5 +0,0 @@
-This client is used internally for testing. I wanted a simple graphql client sent user specified queries.
-
-You might want to look at:
- - https://github.com/shurcooL/graphql: Uses reflection to build queries from structs.
- - https://github.com/machinebox/graphql: Probably would have been a perfect fit, but it uses form encoding instead of json...
diff --git a/vendor/github.com/vektah/gqlgen/client/websocket.go b/vendor/github.com/vektah/gqlgen/client/websocket.go
deleted file mode 100644
index bd92e3c0..00000000
--- a/vendor/github.com/vektah/gqlgen/client/websocket.go
+++ /dev/null
@@ -1,103 +0,0 @@
-package client
-
-import (
- "encoding/json"
- "fmt"
- "strings"
-
- "github.com/gorilla/websocket"
- "github.com/vektah/gqlparser/gqlerror"
-)
-
-const (
- connectionInitMsg = "connection_init" // Client -> Server
- startMsg = "start" // Client -> Server
- connectionAckMsg = "connection_ack" // Server -> Client
- dataMsg = "data" // Server -> Client
- errorMsg = "error" // Server -> Client
-)
-
-type operationMessage struct {
- Payload json.RawMessage `json:"payload,omitempty"`
- ID string `json:"id,omitempty"`
- Type string `json:"type"`
-}
-
-type Subscription struct {
- Close func() error
- Next func(response interface{}) error
-}
-
-func errorSubscription(err error) *Subscription {
- return &Subscription{
- Close: func() error { return nil },
- Next: func(response interface{}) error {
- return err
- },
- }
-}
-
-func (p *Client) Websocket(query string, options ...Option) *Subscription {
- r := p.mkRequest(query, options...)
- requestBody, err := json.Marshal(r)
- if err != nil {
- return errorSubscription(fmt.Errorf("encode: %s", err.Error()))
- }
-
- url := strings.Replace(p.url, "http://", "ws://", -1)
- url = strings.Replace(url, "https://", "wss://", -1)
-
- c, _, err := websocket.DefaultDialer.Dial(url, nil)
- if err != nil {
- return errorSubscription(fmt.Errorf("dial: %s", err.Error()))
- }
-
- if err = c.WriteJSON(operationMessage{Type: connectionInitMsg}); err != nil {
- return errorSubscription(fmt.Errorf("init: %s", err.Error()))
- }
-
- var ack operationMessage
- if err = c.ReadJSON(&ack); err != nil {
- return errorSubscription(fmt.Errorf("ack: %s", err.Error()))
- }
- if ack.Type != connectionAckMsg {
- return errorSubscription(fmt.Errorf("expected ack message, got %#v", ack))
- }
-
- if err = c.WriteJSON(operationMessage{Type: startMsg, ID: "1", Payload: requestBody}); err != nil {
- return errorSubscription(fmt.Errorf("start: %s", err.Error()))
- }
-
- return &Subscription{
- Close: c.Close,
- Next: func(response interface{}) error {
- var op operationMessage
- c.ReadJSON(&op)
- if op.Type != dataMsg {
- if op.Type == errorMsg {
- return fmt.Errorf(string(op.Payload))
- } else {
- return fmt.Errorf("expected data message, got %#v", op)
- }
- }
-
- respDataRaw := map[string]interface{}{}
- err = json.Unmarshal(op.Payload, &respDataRaw)
- if err != nil {
- return fmt.Errorf("decode: %s", err.Error())
- }
-
- if respDataRaw["errors"] != nil {
- var errs []*gqlerror.Error
- if err = unpack(respDataRaw["errors"], &errs); err != nil {
- return err
- }
- if len(errs) > 0 {
- return fmt.Errorf("errors: %s", errs)
- }
- }
-
- return unpack(respDataRaw["data"], response)
- },
- }
-}
diff --git a/vendor/github.com/vektah/gqlparser/.gitignore b/vendor/github.com/vektah/gqlparser/.gitignore
deleted file mode 100644
index 877392a7..00000000
--- a/vendor/github.com/vektah/gqlparser/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-/vendor
-/validator/imported/node_modules
-/validator/imported/graphql-js
-
-.idea/
diff --git a/vendor/github.com/vektah/gqlparser/.gometalinter.json b/vendor/github.com/vektah/gqlparser/.gometalinter.json
deleted file mode 100644
index e4e00223..00000000
--- a/vendor/github.com/vektah/gqlparser/.gometalinter.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "sort": ["path"],
- "Deadline": "5m",
- "Linters": {
- "errcheck": {
- "Command": "errcheck -abspath -ignore '[rR]ead|[wW]rite|Close'",
- "Pattern": "PATH:LINE:COL:MESSAGE",
- "InstallFrom": "github.com/kisielk/errcheck",
- "PartitionStrategy": "packages"
- }
- },
- "Disable": ["golint","gocyclo", "goconst", "gas", "interfacer", "vet","gosec"]
-}
diff --git a/vendor/github.com/vektah/gqlparser/LICENSE b/vendor/github.com/vektah/gqlparser/LICENSE
deleted file mode 100644
index 1221b9d3..00000000
--- a/vendor/github.com/vektah/gqlparser/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. \ No newline at end of file
diff --git a/vendor/github.com/vektah/gqlparser/ast/argmap.go b/vendor/github.com/vektah/gqlparser/ast/argmap.go
deleted file mode 100644
index 43f6a3d6..00000000
--- a/vendor/github.com/vektah/gqlparser/ast/argmap.go
+++ /dev/null
@@ -1,37 +0,0 @@
-package ast
-
-func arg2map(defs ArgumentDefinitionList, args ArgumentList, vars map[string]interface{}) map[string]interface{} {
- result := map[string]interface{}{}
- var err error
-
- for _, argDef := range defs {
- var val interface{}
- var hasValue bool
-
- if argValue := args.ForName(argDef.Name); argValue != nil {
- if argValue.Value.Kind == Variable {
- val, hasValue = vars[argValue.Value.Raw]
- } else {
- val, err = argValue.Value.Value(vars)
- if err != nil {
- panic(err)
- }
- hasValue = true
- }
- }
-
- if !hasValue && argDef.DefaultValue != nil {
- val, err = argDef.DefaultValue.Value(vars)
- if err != nil {
- panic(err)
- }
- hasValue = true
- }
-
- if hasValue {
- result[argDef.Name] = val
- }
- }
-
- return result
-}
diff --git a/vendor/github.com/vektah/gqlparser/ast/collections.go b/vendor/github.com/vektah/gqlparser/ast/collections.go
deleted file mode 100644
index 6bf67297..00000000
--- a/vendor/github.com/vektah/gqlparser/ast/collections.go
+++ /dev/null
@@ -1,138 +0,0 @@
-package ast
-
-type FieldList []*FieldDefinition
-
-func (l FieldList) ForName(name string) *FieldDefinition {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type EnumValueList []*EnumValueDefinition
-
-func (l EnumValueList) ForName(name string) *EnumValueDefinition {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type DirectiveList []*Directive
-
-func (l DirectiveList) ForName(name string) *Directive {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type OperationList []*OperationDefinition
-
-func (l OperationList) ForName(name string) *OperationDefinition {
- if name == "" && len(l) == 1 {
- return l[0]
- }
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type FragmentDefinitionList []*FragmentDefinition
-
-func (l FragmentDefinitionList) ForName(name string) *FragmentDefinition {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type VariableDefinitionList []*VariableDefinition
-
-func (l VariableDefinitionList) ForName(name string) *VariableDefinition {
- for _, it := range l {
- if it.Variable == name {
- return it
- }
- }
- return nil
-}
-
-type ArgumentList []*Argument
-
-func (l ArgumentList) ForName(name string) *Argument {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type ArgumentDefinitionList []*ArgumentDefinition
-
-func (l ArgumentDefinitionList) ForName(name string) *ArgumentDefinition {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type SchemaDefinitionList []*SchemaDefinition
-
-type DirectiveDefinitionList []*DirectiveDefinition
-
-func (l DirectiveDefinitionList) ForName(name string) *DirectiveDefinition {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type DefinitionList []*Definition
-
-func (l DefinitionList) ForName(name string) *Definition {
- for _, it := range l {
- if it.Name == name {
- return it
- }
- }
- return nil
-}
-
-type OperationTypeDefinitionList []*OperationTypeDefinition
-
-func (l OperationTypeDefinitionList) ForType(name string) *OperationTypeDefinition {
- for _, it := range l {
- if it.Type == name {
- return it
- }
- }
- return nil
-}
-
-type ChildValueList []*ChildValue
-
-func (v ChildValueList) ForName(name string) *Value {
- for _, f := range v {
- if f.Name == name {
- return f.Value
- }
- }
- return nil
-}
diff --git a/vendor/github.com/vektah/gqlparser/ast/definition.go b/vendor/github.com/vektah/gqlparser/ast/definition.go
deleted file mode 100644
index f5c8ea37..00000000
--- a/vendor/github.com/vektah/gqlparser/ast/definition.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package ast
-
-type DefinitionKind string
-
-const (
- Scalar DefinitionKind = "SCALAR"
- Object DefinitionKind = "OBJECT"
- Interface DefinitionKind = "INTERFACE"
- Union DefinitionKind = "UNION"
- Enum DefinitionKind = "ENUM"
- InputObject DefinitionKind = "INPUT_OBJECT"
-)
-
-// ObjectDefinition is the core type definition object, it includes all of the definable types
-// but does *not* cover schema or directives.
-//
-// @vektah: Javascript implementation has different types for all of these, but they are
-// more similar than different and don't define any behaviour. I think this style of
-// "some hot" struct works better, at least for go.
-//
-// Type extensions are also represented by this same struct.
-type Definition struct {
- Kind DefinitionKind
- Description string
- Name string
- Directives DirectiveList
- Interfaces []string // object and input object
- Fields FieldList // object and input object
- Types []string // union
- EnumValues EnumValueList // enum
-
- Position *Position `dump:"-"`
- BuiltIn bool `dump:"-"`
-}
-
-func (d *Definition) IsLeafType() bool {
- return d.Kind == Enum || d.Kind == Scalar
-}
-
-func (d *Definition) IsAbstractType() bool {
- return d.Kind == Interface || d.Kind == Union
-}
-
-func (d *Definition) IsCompositeType() bool {
- return d.Kind == Object || d.Kind == Interface || d.Kind == Union
-}
-
-func (d *Definition) IsInputType() bool {
- return d.Kind == Scalar || d.Kind == Enum || d.Kind == InputObject
-}
-
-func (d *Definition) OneOf(types ...string) bool {
- for _, t := range types {
- if d.Name == t {
- return true
- }
- }
- return false
-}
-
-type FieldDefinition struct {
- Description string
- Name string
- Arguments ArgumentDefinitionList // only for objects
- DefaultValue *Value // only for input objects
- Type *Type
- Directives DirectiveList
- Position *Position `dump:"-"`
-}
-
-type ArgumentDefinition struct {
- Description string
- Name string
- DefaultValue *Value
- Type *Type
- Directives DirectiveList
- Position *Position `dump:"-"`
-}
-
-type EnumValueDefinition struct {
- Description string
- Name string
- Directives DirectiveList
- Position *Position `dump:"-"`
-}
-
-type DirectiveDefinition struct {
- Description string
- Name string
- Arguments ArgumentDefinitionList
- Locations []DirectiveLocation
- Position *Position `dump:"-"`
-}
diff --git a/vendor/github.com/vektah/gqlparser/ast/directive.go b/vendor/github.com/vektah/gqlparser/ast/directive.go
deleted file mode 100644
index 9b07c92a..00000000
--- a/vendor/github.com/vektah/gqlparser/ast/directive.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package ast
-
-type DirectiveLocation string
-
-const (
- // Executable
- LocationQuery DirectiveLocation = `QUERY`
- LocationMutation DirectiveLocation = `MUTATION`
- LocationSubscription DirectiveLocation = `SUBSCRIPTION`
- LocationField DirectiveLocation = `FIELD`
- LocationFragmentDefinition DirectiveLocation = `FRAGMENT_DEFINITION`
- LocationFragmentSpread DirectiveLocation = `FRAGMENT_SPREAD`
- LocationInlineFragment DirectiveLocation = `INLINE_FRAGMENT`
-
- // Type System
- LocationSchema DirectiveLocation = `SCHEMA`
- LocationScalar DirectiveLocation = `SCALAR`
- LocationObject DirectiveLocation = `OBJECT`
- LocationFieldDefinition DirectiveLocation = `FIELD_DEFINITION`
- LocationArgumentDefinition DirectiveLocation = `ARGUMENT_DEFINITION`
- LocationInterface DirectiveLocation = `INTERFACE`
- LocationUnion DirectiveLocation = `UNION`
- LocationEnum DirectiveLocation = `ENUM`
- LocationEnumValue DirectiveLocation = `ENUM_VALUE`
- LocationInputObject DirectiveLocation = `INPUT_OBJECT`
- LocationInputFieldDefinition DirectiveLocation = `INPUT_FIELD_DEFINITION`
-)
-
-type Directive struct {
- Name string
- Arguments ArgumentList
- Position *Position `dump:"-"`
-
- // Requires validation
- ParentDefinition *Definition
- Definition *DirectiveDefinition
- Location DirectiveLocation
-}
-
-func (d *Directive) ArgumentMap(vars map[string]interface{}) map[string]interface{} {
- return arg2map(d.Definition.Arguments, d.Arguments, vars)
-}
diff --git a/vendor/github.com/vektah/gqlparser/ast/document.go b/vendor/github.com/vektah/gqlparser/ast/document.go
deleted file mode 100644
index 4672d0c0..00000000
--- a/vendor/github.com/vektah/gqlparser/ast/document.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package ast
-
-type QueryDocument struct {
- Operations OperationList
- Fragments FragmentDefinitionList
- Position *Position `dump:"-"`
-}
-
-type SchemaDocument struct {
- Schema SchemaDefinitionList
- SchemaExtension SchemaDefinitionList
- Directives DirectiveDefinitionList
- Definitions DefinitionList
- Extensions DefinitionList
- Position *Position `dump:"-"`
-}
-
-func (d *SchemaDocument) Merge(other *SchemaDocument) {
- d.Schema = append(d.Schema, other.Schema...)
- d.SchemaExtension = append(d.SchemaExtension, other.SchemaExtension...)
- d.Directives = append(d.Directives, other.Directives...)
- d.Definitions = append(d.Definitions, other.Definitions...)
- d.Extensions = append(d.Extensions, other.Extensions...)
-}
-
-type Schema struct {
- Query *Definition
- Mutation *Definition
- Subscription *Definition
-
- Types map[string]*Definition
- Directives map[string]*DirectiveDefinition
-
- PossibleTypes map[string][]*Definition
- Implements map[string][]*Definition
-}
-
-func (s *Schema) AddPossibleType(name string, def *Definition) {
- s.PossibleTypes[name] = append(s.PossibleTypes[name], def)
-}
-
-// GetPossibleTypes will enumerate all the definitions for a given interface or union
-func (s *Schema) GetPossibleTypes(def *Definition) []*Definition {
- return s.PossibleTypes[def.Name]
-}
-
-func (s *Schema) AddImplements(name string, iface *Definition) {
- s.Implements[name] = append(s.Implements[name], iface)
-}
-
-// GetImplements returns all the interface and union definitions that the given definition satisfies
-func (s *Schema) GetImplements(def *Definition) []*Definition {
- return s.Implements[def.Name]
-}
-
-type SchemaDefinition struct {
- Description string
- Directives DirectiveList
- OperationTypes OperationTypeDefinitionList
- Position *Position `dump:"-"`
-}
-
-type OperationTypeDefinition struct {
- Operation Operation
- Type string
- Position *Position `dump:"-"`
-}
diff --git a/vendor/github.com/vektah/gqlparser/ast/dumper.go b/vendor/github.com/vektah/gqlparser/ast/dumper.go
deleted file mode 100644
index dbb7a7ef..00000000
--- a/vendor/github.com/vektah/gqlparser/ast/dumper.go
+++ /dev/null
@@ -1,159 +0,0 @@
-package ast
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "strconv"
- "strings"
-)
-
-// Dump turns ast into a stable string format for assertions in tests
-func Dump(i interface{}) string {
- v := reflect.ValueOf(i)
-
- d := dumper{Buffer: &bytes.Buffer{}}
- d.dump(v)
-
- return d.String()
-}
-
-type dumper struct {
- *bytes.Buffer
- indent int
-}
-
-type Dumpable interface {
- Dump() string
-}
-
-func (d *dumper) dump(v reflect.Value) {
- if dumpable, isDumpable := v.Interface().(Dumpable); isDumpable {
- d.WriteString(dumpable.Dump())
- return
- }
- switch v.Kind() {
- case reflect.Bool:
- if v.Bool() {
- d.WriteString("true")
- } else {
- d.WriteString("false")
- }
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- d.WriteString(fmt.Sprintf("%d", v.Int()))
-
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
- d.WriteString(fmt.Sprintf("%d", v.Uint()))
-
- case reflect.Float32, reflect.Float64:
- d.WriteString(fmt.Sprintf("%.2f", v.Float()))
-
- case reflect.String:
- if v.Type().Name() != "string" {
- d.WriteString(v.Type().Name() + "(" + strconv.Quote(v.String()) + ")")
- } else {
- d.WriteString(strconv.Quote(v.String()))
- }
-
- case reflect.Array, reflect.Slice:
- d.dumpArray(v)
-
- case reflect.Interface, reflect.Ptr:
- d.dumpPtr(v)
-
- case reflect.Struct:
- d.dumpStruct(v)
-
- default:
- panic(fmt.Errorf("unsupported kind: %s\n buf: %s", v.Kind().String(), d.String()))
- }
-}
-
-func (d *dumper) writeIndent() {
- d.Buffer.WriteString(strings.Repeat(" ", d.indent))
-}
-
-func (d *dumper) nl() {
- d.Buffer.WriteByte('\n')
- d.writeIndent()
-}
-
-func typeName(t reflect.Type) string {
- if t.Kind() == reflect.Ptr {
- return typeName(t.Elem())
- }
- return t.Name()
-}
-
-func (d *dumper) dumpArray(v reflect.Value) {
- d.WriteString("[" + typeName(v.Type().Elem()) + "]")
-
- for i := 0; i < v.Len(); i++ {
- d.nl()
- d.WriteString("- ")
- d.indent++
- d.dump(v.Index(i))
- d.indent--
- }
-}
-
-func (d *dumper) dumpStruct(v reflect.Value) {
- d.WriteString("<" + v.Type().Name() + ">")
- d.indent++
-
- typ := v.Type()
- for i := 0; i < v.NumField(); i++ {
- f := v.Field(i)
- if typ.Field(i).Tag.Get("dump") == "-" {
- continue
- }
-
- if isZero(f) {
- continue
- }
- d.nl()
- d.WriteString(typ.Field(i).Name)
- d.WriteString(": ")
- d.dump(v.Field(i))
- }
-
- d.indent--
-}
-
-func isZero(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.Ptr, reflect.Interface:
- return v.IsNil()
- case reflect.Func, reflect.Map:
- return v.IsNil()
-
- case reflect.Array, reflect.Slice:
- if v.IsNil() {
- return true
- }
- z := true
- for i := 0; i < v.Len(); i++ {
- z = z && isZero(v.Index(i))
- }
- return z
- case reflect.Struct:
- z := true
- for i := 0; i < v.NumField(); i++ {
- z = z && isZero(v.Field(i))
- }
- return z
- case reflect.String:
- return v.String() == ""
- }
-
- // Compare other types directly:
- return reflect.DeepEqual(v.Interface(), reflect.Zero(v.Type()))
-}
-
-func (d *dumper) dumpPtr(v reflect.Value) {
- if v.IsNil() {
- d.WriteString("nil")
- return
- }
- d.dump(v.Elem())
-}
diff --git a/vendor/github.com/vektah/gqlparser/ast/fragment.go b/vendor/github.com/vektah/gqlparser/ast/fragment.go
deleted file mode 100644
index 57ab56c7..00000000
--- a/vendor/github.com/vektah/gqlparser/ast/fragment.go
+++ /dev/null
@@ -1,38 +0,0 @@
-package ast
-
-type FragmentSpread struct {
- Name string
- Directives DirectiveList
-
- // Require validation
- ObjectDefinition *Definition
- Definition *FragmentDefinition
-
- Position *Position `dump:"-"`
-}
-
-type InlineFragment struct {
- TypeCondition string
- Directives DirectiveList
- SelectionSet SelectionSet
-
- // Require validation
- ObjectDefinition *Definition
-
- Position *Position `dump:"-"`
-}
-
-type FragmentDefinition struct {
- Name string
- // Note: fragment variable definitions are experimental and may be changed
- // or removed in the future.
- VariableDefinition VariableDefinitionList
- TypeCondition string
- Directives DirectiveList
- SelectionSet SelectionSet
-
- // Require validation
- Definition *Definition
-
- Position *Position `dump:"-"`
-}
diff --git a/vendor/github.com/vektah/gqlparser/ast/operation.go b/vendor/github.com/vektah/gqlparser/ast/operation.go
deleted file mode 100644
index 03e916a0..00000000
--- a/vendor/github.com/vektah/gqlparser/ast/operation.go
+++ /dev/null
@@ -1,29 +0,0 @@
-package ast
-
-type Operation string
-
-const (
- Query Operation = "query"
- Mutation Operation = "mutation"
- Subscription Operation = "subscription"
-)
-
-type OperationDefinition struct {
- Operation Operation
- Name string
- VariableDefinitions VariableDefinitionList
- Directives DirectiveList
- SelectionSet SelectionSet
- Position *Position `dump:"-"`
-}
-
-type VariableDefinition struct {
- Variable string
- Type *Type
- DefaultValue *Value
- Position *Position `dump:"-"`
-
- // Requires validation
- Definition *Definition
- Used bool `dump:"-"`
-}
diff --git a/vendor/github.com/vektah/gqlparser/ast/selection.go b/vendor/github.com/vektah/gqlparser/ast/selection.go
deleted file mode 100644
index 159db844..00000000
--- a/vendor/github.com/vektah/gqlparser/ast/selection.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package ast
-
-type SelectionSet []Selection
-
-type Selection interface {
- isSelection()
- GetPosition() *Position
-}
-
-func (*Field) isSelection() {}
-func (*FragmentSpread) isSelection() {}
-func (*InlineFragment) isSelection() {}
-
-func (s *Field) GetPosition() *Position { return s.Position }
-func (s *FragmentSpread) GetPosition() *Position { return s.Position }
-func (s *InlineFragment) GetPosition() *Position { return s.Position }
-
-type Field struct {
- Alias string
- Name string
- Arguments ArgumentList
- Directives DirectiveList
- SelectionSet SelectionSet
- Position *Position `dump:"-"`
-
- // Require validation
- Definition *FieldDefinition
- ObjectDefinition *Definition
-}
-
-type Argument struct {
- Name string
- Value *Value
- Position *Position `dump:"-"`
-}
-
-func (f *Field) ArgumentMap(vars map[string]interface{}) map[string]interface{} {
- return arg2map(f.Definition.Arguments, f.Arguments, vars)
-}
diff --git a/vendor/github.com/vektah/gqlparser/ast/source.go b/vendor/github.com/vektah/gqlparser/ast/source.go
deleted file mode 100644
index acb07ba6..00000000
--- a/vendor/github.com/vektah/gqlparser/ast/source.go
+++ /dev/null
@@ -1,15 +0,0 @@
-package ast
-
-type Source struct {
- Name string
- Input string
- BuiltIn bool
-}
-
-type Position struct {
- Start int // The starting position, in runes, of this token in the input.
- End int // The end position, in runes, of this token in the input.
- Line int // The line number at the start of this item.
- Column int // The line number at the start of this item.
- Src *Source // The source document this token belongs to
-}
diff --git a/vendor/github.com/vektah/gqlparser/ast/type.go b/vendor/github.com/vektah/gqlparser/ast/type.go
deleted file mode 100644
index 9577fdb4..00000000
--- a/vendor/github.com/vektah/gqlparser/ast/type.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package ast
-
-func NonNullNamedType(named string, pos *Position) *Type {
- return &Type{NamedType: named, NonNull: true, Position: pos}
-}
-
-func NamedType(named string, pos *Position) *Type {
- return &Type{NamedType: named, NonNull: false, Position: pos}
-}
-
-func NonNullListType(elem *Type, pos *Position) *Type {
- return &Type{Elem: elem, NonNull: true, Position: pos}
-}
-
-func ListType(elem *Type, pos *Position) *Type {
- return &Type{Elem: elem, NonNull: false, Position: pos}
-}
-
-type Type struct {
- NamedType string
- Elem *Type
- NonNull bool
- Position *Position `dump:"-"`
-}
-
-func (t *Type) Name() string {
- if t.NamedType != "" {
- return t.NamedType
- }
-
- return t.Elem.Name()
-}
-
-func (t *Type) String() string {
- nn := ""
- if t.NonNull {
- nn = "!"
- }
- if t.NamedType != "" {
- return t.NamedType + nn
- }
-
- return "[" + t.Elem.String() + "]" + nn
-}
-
-func (t *Type) IsCompatible(other *Type) bool {
- if t.NamedType != other.NamedType {
- return false
- }
-
- if t.Elem != nil && other.Elem == nil {
- return false
- }
-
- if t.Elem != nil && !t.Elem.IsCompatible(other.Elem) {
- return false
- }
-
- if other.NonNull {
- return t.NonNull
- }
-
- return true
-}
-
-func (v *Type) Dump() string {
- return v.String()
-}
diff --git a/vendor/github.com/vektah/gqlparser/ast/value.go b/vendor/github.com/vektah/gqlparser/ast/value.go
deleted file mode 100644
index c25ef150..00000000
--- a/vendor/github.com/vektah/gqlparser/ast/value.go
+++ /dev/null
@@ -1,120 +0,0 @@
-package ast
-
-import (
- "fmt"
- "strconv"
- "strings"
-)
-
-type ValueKind int
-
-const (
- Variable ValueKind = iota
- IntValue
- FloatValue
- StringValue
- BlockValue
- BooleanValue
- NullValue
- EnumValue
- ListValue
- ObjectValue
-)
-
-type Value struct {
- Raw string
- Children ChildValueList
- Kind ValueKind
- Position *Position `dump:"-"`
-
- // Require validation
- Definition *Definition
- VariableDefinition *VariableDefinition
- ExpectedType *Type
-}
-
-type ChildValue struct {
- Name string
- Value *Value
- Position *Position `dump:"-"`
-}
-
-func (v *Value) Value(vars map[string]interface{}) (interface{}, error) {
- if v == nil {
- return nil, nil
- }
- switch v.Kind {
- case Variable:
- if value, ok := vars[v.Raw]; ok {
- return value, nil
- }
- if v.VariableDefinition != nil && v.VariableDefinition.DefaultValue != nil {
- return v.VariableDefinition.DefaultValue.Value(vars)
- }
- return nil, nil
- case IntValue:
- return strconv.ParseInt(v.Raw, 10, 64)
- case FloatValue:
- return strconv.ParseFloat(v.Raw, 64)
- case StringValue, BlockValue, EnumValue:
- return v.Raw, nil
- case BooleanValue:
- return strconv.ParseBool(v.Raw)
- case NullValue:
- return nil, nil
- case ListValue:
- var val []interface{}
- for _, elem := range v.Children {
- elemVal, err := elem.Value.Value(vars)
- if err != nil {
- return val, err
- }
- val = append(val, elemVal)
- }
- return val, nil
- case ObjectValue:
- val := map[string]interface{}{}
- for _, elem := range v.Children {
- elemVal, err := elem.Value.Value(vars)
- if err != nil {
- return val, err
- }
- val[elem.Name] = elemVal
- }
- return val, nil
- default:
- panic(fmt.Errorf("unknown value kind %d", v.Kind))
- }
-}
-
-func (v *Value) String() string {
- if v == nil {
- return "<nil>"
- }
- switch v.Kind {
- case Variable:
- return "$" + v.Raw
- case IntValue, FloatValue, EnumValue, BooleanValue, NullValue:
- return v.Raw
- case StringValue, BlockValue:
- return strconv.Quote(v.Raw)
- case ListValue:
- var val []string
- for _, elem := range v.Children {
- val = append(val, elem.Value.String())
- }
- return "[" + strings.Join(val, ",") + "]"
- case ObjectValue:
- var val []string
- for _, elem := range v.Children {
- val = append(val, elem.Name+":"+elem.Value.String())
- }
- return "{" + strings.Join(val, ",") + "}"
- default:
- panic(fmt.Errorf("unknown value kind %d", v.Kind))
- }
-}
-
-func (v *Value) Dump() string {
- return v.String()
-}
diff --git a/vendor/github.com/vektah/gqlparser/gqlerror/error.go b/vendor/github.com/vektah/gqlparser/gqlerror/error.go
deleted file mode 100644
index c4c0847a..00000000
--- a/vendor/github.com/vektah/gqlparser/gqlerror/error.go
+++ /dev/null
@@ -1,133 +0,0 @@
-package gqlerror
-
-import (
- "bytes"
- "fmt"
- "strconv"
-
- "github.com/vektah/gqlparser/ast"
-)
-
-// Error is the standard graphql error type described in https://facebook.github.io/graphql/draft/#sec-Errors
-type Error struct {
- Message string `json:"message"`
- Path []interface{} `json:"path,omitempty"`
- Locations []Location `json:"locations,omitempty"`
- Extensions map[string]interface{} `json:"extensions,omitempty"`
- Rule string `json:"-"`
-}
-
-func (err *Error) SetFile(file string) {
- if file == "" {
- return
- }
- if err.Extensions == nil {
- err.Extensions = map[string]interface{}{}
- }
-
- err.Extensions["file"] = file
-}
-
-type Location struct {
- Line int `json:"line,omitempty"`
- Column int `json:"column,omitempty"`
-}
-
-type List []*Error
-
-func (err *Error) Error() string {
- var res bytes.Buffer
- if err == nil {
- return ""
- }
- filename, _ := err.Extensions["file"].(string)
- if filename == "" {
- filename = "input"
- }
- res.WriteString(filename)
-
- if len(err.Locations) > 0 {
- res.WriteByte(':')
- res.WriteString(strconv.Itoa(err.Locations[0].Line))
- }
-
- res.WriteString(": ")
- if ps := err.pathString(); ps != "" {
- res.WriteString(ps)
- res.WriteByte(' ')
- }
-
- res.WriteString(err.Message)
-
- return res.String()
-}
-
-func (err Error) pathString() string {
- var str bytes.Buffer
- for i, v := range err.Path {
-
- switch v := v.(type) {
- case int, int64:
- str.WriteString(fmt.Sprintf("[%d]", v))
- default:
- if i != 0 {
- str.WriteByte('.')
- }
- str.WriteString(fmt.Sprint(v))
- }
- }
- return str.String()
-}
-
-func (errs List) Error() string {
- var buf bytes.Buffer
- for _, err := range errs {
- buf.WriteString(err.Error())
- buf.WriteByte('\n')
- }
- return buf.String()
-}
-
-func WrapPath(path []interface{}, err error) *Error {
- return &Error{
- Message: err.Error(),
- Path: path,
- }
-}
-
-func Errorf(message string, args ...interface{}) *Error {
- return &Error{
- Message: fmt.Sprintf(message, args...),
- }
-}
-
-func ErrorPathf(path []interface{}, message string, args ...interface{}) *Error {
- return &Error{
- Message: fmt.Sprintf(message, args...),
- Path: path,
- }
-}
-
-func ErrorPosf(pos *ast.Position, message string, args ...interface{}) *Error {
- return ErrorLocf(
- pos.Src.Name,
- pos.Line,
- pos.Column,
- message,
- args...,
- )
-}
-
-func ErrorLocf(file string, line int, col int, message string, args ...interface{}) *Error {
- var extensions map[string]interface{}
- if file != "" {
- extensions = map[string]interface{}{"file": file}
- }
- return &Error{
- Message: fmt.Sprintf(message, args...),
- Extensions: extensions,
- Locations: []Location{
- {Line: line, Column: col},
- },
- }
-}
diff --git a/vendor/github.com/vektah/gqlparser/gqlparser.go b/vendor/github.com/vektah/gqlparser/gqlparser.go
deleted file mode 100644
index 71e46407..00000000
--- a/vendor/github.com/vektah/gqlparser/gqlparser.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package gqlparser
-
-import (
- "github.com/vektah/gqlparser/ast"
- "github.com/vektah/gqlparser/gqlerror"
- "github.com/vektah/gqlparser/parser"
- "github.com/vektah/gqlparser/validator"
- _ "github.com/vektah/gqlparser/validator/rules"
-)
-
-func LoadSchema(str ...*ast.Source) (*ast.Schema, *gqlerror.Error) {
- return validator.LoadSchema(append([]*ast.Source{validator.Prelude}, str...)...)
-}
-
-func MustLoadSchema(str ...*ast.Source) *ast.Schema {
- s, err := validator.LoadSchema(append([]*ast.Source{validator.Prelude}, str...)...)
- if err != nil {
- panic(err)
- }
- return s
-}
-
-func LoadQuery(schema *ast.Schema, str string) (*ast.QueryDocument, gqlerror.List) {
- query, err := parser.ParseQuery(&ast.Source{Input: str})
- if err != nil {
- return nil, gqlerror.List{err}
- }
- errs := validator.Validate(schema, query)
- if errs != nil {
- return nil, errs
- }
-
- return query, nil
-}
-
-func MustLoadQuery(schema *ast.Schema, str string) *ast.QueryDocument {
- q, err := LoadQuery(schema, str)
- if err != nil {
- panic(err)
- }
- return q
-}
diff --git a/vendor/github.com/vektah/gqlparser/lexer/blockstring.go b/vendor/github.com/vektah/gqlparser/lexer/blockstring.go
deleted file mode 100644
index 4065a610..00000000
--- a/vendor/github.com/vektah/gqlparser/lexer/blockstring.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package lexer
-
-import (
- "math"
- "strings"
-)
-
-// blockStringValue produces the value of a block string from its parsed raw value, similar to
-// Coffeescript's block string, Python's docstring trim or Ruby's strip_heredoc.
-//
-// This implements the GraphQL spec's BlockStringValue() static algorithm.
-func blockStringValue(raw string) string {
- lines := strings.Split(raw, "\n")
-
- commonIndent := math.MaxInt32
- for _, line := range lines {
- indent := leadingWhitespace(line)
- if indent < len(line) && indent < commonIndent {
- commonIndent = indent
- if commonIndent == 0 {
- break
- }
- }
- }
-
- if commonIndent != math.MaxInt32 && len(lines) > 0 {
- for i := 1; i < len(lines); i++ {
- if len(lines[i]) < commonIndent {
- lines[i] = ""
- } else {
- lines[i] = lines[i][commonIndent:]
- }
- }
- }
-
- start := 0
- end := len(lines)
-
- for start < end && leadingWhitespace(lines[start]) == math.MaxInt32 {
- start++
- }
-
- for start < end && leadingWhitespace(lines[end-1]) == math.MaxInt32 {
- end--
- }
-
- return strings.Join(lines[start:end], "\n")
-}
-
-func leadingWhitespace(str string) int {
- for i, r := range str {
- if r != ' ' && r != '\t' {
- return i
- }
- }
- // this line is made up entirely of whitespace, its leading whitespace doesnt count.
- return math.MaxInt32
-}
diff --git a/vendor/github.com/vektah/gqlparser/lexer/lexer.go b/vendor/github.com/vektah/gqlparser/lexer/lexer.go
deleted file mode 100644
index 89687857..00000000
--- a/vendor/github.com/vektah/gqlparser/lexer/lexer.go
+++ /dev/null
@@ -1,510 +0,0 @@
-package lexer
-
-import (
- "bytes"
- "unicode/utf8"
-
- "github.com/vektah/gqlparser/ast"
- "github.com/vektah/gqlparser/gqlerror"
-)
-
-// Lexer turns graphql request and schema strings into tokens
-type Lexer struct {
- *ast.Source
- // An offset into the string in bytes
- start int
- // An offset into the string in runes
- startRunes int
- // An offset into the string in bytes
- end int
- // An offset into the string in runes
- endRunes int
- // the current line number
- line int
- // An offset into the string in rune
- lineStartRunes int
-}
-
-func New(src *ast.Source) Lexer {
- return Lexer{
- Source: src,
- line: 1,
- }
-}
-
-// take one rune from input and advance end
-func (s *Lexer) peek() (rune, int) {
- return utf8.DecodeRuneInString(s.Input[s.end:])
-}
-
-func (s *Lexer) makeToken(kind Type) (Token, *gqlerror.Error) {
- return s.makeValueToken(kind, s.Input[s.start:s.end])
-}
-
-func (s *Lexer) makeValueToken(kind Type, value string) (Token, *gqlerror.Error) {
- return Token{
- Kind: kind,
- Value: value,
- Pos: ast.Position{
- Start: s.startRunes,
- End: s.endRunes,
- Line: s.line,
- Column: s.startRunes - s.lineStartRunes + 1,
- Src: s.Source,
- },
- }, nil
-}
-
-func (s *Lexer) makeError(format string, args ...interface{}) (Token, *gqlerror.Error) {
- column := s.endRunes - s.lineStartRunes + 1
- return Token{
- Kind: Invalid,
- Pos: ast.Position{
- Start: s.startRunes,
- End: s.endRunes,
- Line: s.line,
- Column: column,
- Src: s.Source,
- },
- }, gqlerror.ErrorLocf(s.Source.Name, s.line, column, format, args...)
-}
-
-// ReadToken gets the next token from the source starting at the given position.
-//
-// This skips over whitespace and comments until it finds the next lexable
-// token, then lexes punctuators immediately or calls the appropriate helper
-// function for more complicated tokens.
-func (s *Lexer) ReadToken() (token Token, err *gqlerror.Error) {
-
- s.ws()
- s.start = s.end
- s.startRunes = s.endRunes
-
- if s.end >= len(s.Input) {
- return s.makeToken(EOF)
- }
- r := s.Input[s.start]
- s.end++
- s.endRunes++
- switch r {
- case '!':
- return s.makeValueToken(Bang, "")
-
- case '$':
- return s.makeValueToken(Dollar, "")
- case '&':
- return s.makeValueToken(Amp, "")
- case '(':
- return s.makeValueToken(ParenL, "")
- case ')':
- return s.makeValueToken(ParenR, "")
- case '.':
- if len(s.Input) > s.start+2 && s.Input[s.start:s.start+3] == "..." {
- s.end += 2
- s.endRunes += 2
- return s.makeValueToken(Spread, "")
- }
- case ':':
- return s.makeValueToken(Colon, "")
- case '=':
- return s.makeValueToken(Equals, "")
- case '@':
- return s.makeValueToken(At, "")
- case '[':
- return s.makeValueToken(BracketL, "")
- case ']':
- return s.makeValueToken(BracketR, "")
- case '{':
- return s.makeValueToken(BraceL, "")
- case '}':
- return s.makeValueToken(BraceR, "")
- case '|':
- return s.makeValueToken(Pipe, "")
- case '#':
- s.readComment()
- return s.ReadToken()
-
- case '_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z':
- return s.readName()
-
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return s.readNumber()
-
- case '"':
- if len(s.Input) > s.start+2 && s.Input[s.start:s.start+3] == `"""` {
- return s.readBlockString()
- }
-
- return s.readString()
- }
-
- s.end--
- s.endRunes--
-
- if r < 0x0020 && r != 0x0009 && r != 0x000a && r != 0x000d {
- return s.makeError(`Cannot contain the invalid character "\u%04d"`, r)
- }
-
- if r == '\'' {
- return s.makeError(`Unexpected single quote character ('), did you mean to use a double quote (")?`)
- }
-
- return s.makeError(`Cannot parse the unexpected character "%s".`, string(r))
-}
-
-// ws reads from body starting at startPosition until it finds a non-whitespace
-// or commented character, and updates the token end to include all whitespace
-func (s *Lexer) ws() {
- for s.end < len(s.Input) {
- switch s.Input[s.end] {
- case '\t', ' ', ',':
- s.end++
- s.endRunes++
- case '\n':
- s.end++
- s.endRunes++
- s.line++
- s.lineStartRunes = s.endRunes
- case '\r':
- s.end++
- s.endRunes++
- s.line++
- s.lineStartRunes = s.endRunes
- // skip the following newline if its there
- if s.end < len(s.Input) && s.Input[s.end] == '\n' {
- s.end++
- s.endRunes++
- }
- // byte order mark, given ws is hot path we aren't relying on the unicode package here.
- case 0xef:
- if s.end+2 < len(s.Input) && s.Input[s.end+1] == 0xBB && s.Input[s.end+2] == 0xBF {
- s.end += 3
- s.endRunes++
- } else {
- return
- }
- default:
- return
- }
- }
-}
-
-// readComment from the input
-//
-// #[\u0009\u0020-\uFFFF]*
-func (s *Lexer) readComment() (Token, *gqlerror.Error) {
- for s.end < len(s.Input) {
- r, w := s.peek()
-
- // SourceCharacter but not LineTerminator
- if r > 0x001f || r == '\t' {
- s.end += w
- s.endRunes++
- } else {
- break
- }
- }
-
- return s.makeToken(Comment)
-}
-
-// readNumber from the input, either a float
-// or an int depending on whether a decimal point appears.
-//
-// Int: -?(0|[1-9][0-9]*)
-// Float: -?(0|[1-9][0-9]*)(\.[0-9]+)?((E|e)(+|-)?[0-9]+)?
-func (s *Lexer) readNumber() (Token, *gqlerror.Error) {
- float := false
-
- // backup to the first digit
- s.end--
- s.endRunes--
-
- s.acceptByte('-')
-
- if s.acceptByte('0') {
- if consumed := s.acceptDigits(); consumed != 0 {
- s.end -= consumed
- s.endRunes -= consumed
- return s.makeError("Invalid number, unexpected digit after 0: %s.", s.describeNext())
- }
- } else {
- if consumed := s.acceptDigits(); consumed == 0 {
- return s.makeError("Invalid number, expected digit but got: %s.", s.describeNext())
- }
- }
-
- if s.acceptByte('.') {
- float = true
-
- if consumed := s.acceptDigits(); consumed == 0 {
- return s.makeError("Invalid number, expected digit but got: %s.", s.describeNext())
- }
- }
-
- if s.acceptByte('e', 'E') {
- float = true
-
- s.acceptByte('-', '+')
-
- if consumed := s.acceptDigits(); consumed == 0 {
- return s.makeError("Invalid number, expected digit but got: %s.", s.describeNext())
- }
- }
-
- if float {
- return s.makeToken(Float)
- } else {
- return s.makeToken(Int)
- }
-}
-
-// acceptByte if it matches any of given bytes, returning true if it found anything
-func (s *Lexer) acceptByte(bytes ...uint8) bool {
- if s.end >= len(s.Input) {
- return false
- }
-
- for _, accepted := range bytes {
- if s.Input[s.end] == accepted {
- s.end++
- s.endRunes++
- return true
- }
- }
- return false
-}
-
-// acceptDigits from the input, returning the number of digits it found
-func (s *Lexer) acceptDigits() int {
- consumed := 0
- for s.end < len(s.Input) && s.Input[s.end] >= '0' && s.Input[s.end] <= '9' {
- s.end++
- s.endRunes++
- consumed++
- }
-
- return consumed
-}
-
-// describeNext peeks at the input and returns a human readable string. This should will alloc
-// and should only be used in errors
-func (s *Lexer) describeNext() string {
- if s.end < len(s.Input) {
- return `"` + string(s.Input[s.end]) + `"`
- }
- return "<EOF>"
-}
-
-// readString from the input
-//
-// "([^"\\\u000A\u000D]|(\\(u[0-9a-fA-F]{4}|["\\/bfnrt])))*"
-func (s *Lexer) readString() (Token, *gqlerror.Error) {
- inputLen := len(s.Input)
-
- // this buffer is lazily created only if there are escape characters.
- var buf *bytes.Buffer
-
- // skip the opening quote
- s.start++
- s.startRunes++
-
- for s.end < inputLen {
- r := s.Input[s.end]
- if r == '\n' || r == '\r' {
- break
- }
- if r < 0x0020 && r != '\t' {
- return s.makeError(`Invalid character within String: "\u%04d".`, r)
- }
- switch r {
- default:
- var char = rune(r)
- var w = 1
-
- // skip unicode overhead if we are in the ascii range
- if r >= 127 {
- char, w = utf8.DecodeRuneInString(s.Input[s.end:])
- }
- s.end += w
- s.endRunes++
-
- if buf != nil {
- buf.WriteRune(char)
- }
-
- case '"':
- t, err := s.makeToken(String)
- // the token should not include the quotes in its value, but should cover them in its position
- t.Pos.Start--
- t.Pos.End++
-
- if buf != nil {
- t.Value = buf.String()
- }
-
- // skip the close quote
- s.end++
- s.endRunes++
-
- return t, err
-
- case '\\':
- if s.end+1 >= inputLen {
- s.end++
- s.endRunes++
- return s.makeError(`Invalid character escape sequence.`)
- }
-
- if buf == nil {
- buf = bytes.NewBufferString(s.Input[s.start:s.end])
- }
-
- escape := s.Input[s.end+1]
-
- if escape == 'u' {
- if s.end+6 >= inputLen {
- s.end++
- s.endRunes++
- return s.makeError("Invalid character escape sequence: \\%s.", s.Input[s.end:])
- }
-
- r, ok := unhex(s.Input[s.end+2 : s.end+6])
- if !ok {
- s.end++
- s.endRunes++
- return s.makeError("Invalid character escape sequence: \\%s.", s.Input[s.end:s.end+5])
- }
- buf.WriteRune(r)
- s.end += 6
- s.endRunes += 6
- } else {
- switch escape {
- case '"', '/', '\\':
- buf.WriteByte(escape)
- case 'b':
- buf.WriteByte('\b')
- case 'f':
- buf.WriteByte('\f')
- case 'n':
- buf.WriteByte('\n')
- case 'r':
- buf.WriteByte('\r')
- case 't':
- buf.WriteByte('\t')
- default:
- s.end += 1
- s.endRunes += 1
- return s.makeError("Invalid character escape sequence: \\%s.", string(escape))
- }
- s.end += 2
- s.endRunes += 2
- }
- }
- }
-
- return s.makeError("Unterminated string.")
-}
-
-// readBlockString from the input
-//
-// """("?"?(\\"""|\\(?!=""")|[^"\\]))*"""
-func (s *Lexer) readBlockString() (Token, *gqlerror.Error) {
- inputLen := len(s.Input)
-
- var buf bytes.Buffer
-
- // skip the opening quote
- s.start += 3
- s.startRunes += 3
- s.end += 2
- s.endRunes += 2
-
- for s.end < inputLen {
- r := s.Input[s.end]
-
- // Closing triple quote (""")
- if r == '"' && s.end+3 <= inputLen && s.Input[s.end:s.end+3] == `"""` {
- t, err := s.makeValueToken(BlockString, blockStringValue(buf.String()))
-
- // the token should not include the quotes in its value, but should cover them in its position
- t.Pos.Start -= 3
- t.Pos.End += 3
-
- // skip the close quote
- s.end += 3
- s.endRunes += 3
-
- return t, err
- }
-
- // SourceCharacter
- if r < 0x0020 && r != '\t' && r != '\n' && r != '\r' {
- return s.makeError(`Invalid character within String: "\u%04d".`, r)
- }
-
- if r == '\\' && s.end+4 <= inputLen && s.Input[s.end:s.end+4] == `\"""` {
- buf.WriteString(`"""`)
- s.end += 4
- s.endRunes += 4
- } else if r == '\r' {
- if s.end+1 < inputLen && s.Input[s.end+1] == '\n' {
- s.end++
- s.endRunes++
- }
-
- buf.WriteByte('\n')
- s.end++
- s.endRunes++
- } else {
- var char = rune(r)
- var w = 1
-
- // skip unicode overhead if we are in the ascii range
- if r >= 127 {
- char, w = utf8.DecodeRuneInString(s.Input[s.end:])
- }
- s.end += w
- s.endRunes++
- buf.WriteRune(char)
- }
- }
-
- return s.makeError("Unterminated string.")
-}
-
-func unhex(b string) (v rune, ok bool) {
- for _, c := range b {
- v <<= 4
- switch {
- case '0' <= c && c <= '9':
- v |= c - '0'
- case 'a' <= c && c <= 'f':
- v |= c - 'a' + 10
- case 'A' <= c && c <= 'F':
- v |= c - 'A' + 10
- default:
- return 0, false
- }
- }
-
- return v, true
-}
-
-// readName from the input
-//
-// [_A-Za-z][_0-9A-Za-z]*
-func (s *Lexer) readName() (Token, *gqlerror.Error) {
- for s.end < len(s.Input) {
- r, w := s.peek()
-
- if (r >= '0' && r <= '9') || (r >= 'A' && r <= 'Z') || (r >= 'a' && r <= 'z') || r == '_' {
- s.end += w
- s.endRunes++
- } else {
- break
- }
- }
-
- return s.makeToken(Name)
-}
diff --git a/vendor/github.com/vektah/gqlparser/lexer/lexer_test.yml b/vendor/github.com/vektah/gqlparser/lexer/lexer_test.yml
deleted file mode 100644
index e2c26696..00000000
--- a/vendor/github.com/vektah/gqlparser/lexer/lexer_test.yml
+++ /dev/null
@@ -1,672 +0,0 @@
-encoding:
- - name: disallows uncommon control characters
- input: "\u0007"
- error:
- message: 'Cannot contain the invalid character "\u0007"'
- locations: [{line: 1, column: 1}]
-
- - name: accepts BOM header
- input: "\uFEFF foo"
- tokens:
- -
- kind: NAME
- start: 2
- end: 5
- value: 'foo'
-
-simple tokens:
- - name: records line and column
- input: "\n \r\n \r foo\n"
- tokens:
- -
- kind: NAME
- start: 8
- end: 11
- line: 4
- column: 3
- value: 'foo'
-
- - name: skips whitespace
- input: "\n\n foo\n\n\n"
- tokens:
- -
- kind: NAME
- start: 6
- end: 9
- value: 'foo'
-
- - name: skips comments
- input: "\n #comment\n foo#comment\n"
- tokens:
- -
- kind: NAME
- start: 18
- end: 21
- value: 'foo'
-
- - name: skips commas
- input: ",,,foo,,,"
- tokens:
- -
- kind: NAME
- start: 3
- end: 6
- value: 'foo'
-
- - name: errors respect whitespace
- input: "\n\n ?\n\n\n"
- error:
- message: 'Cannot parse the unexpected character "?".'
- locations: [{line: 3, column: 5}]
- string: |
- Syntax Error: Cannot parse the unexpected character "?".
- GraphQL request (3:5)
- 2:
- 3: ?
- ^
- 4:
-
- - name: lex reports useful information for dashes in names
- input: "a-b"
- error:
- message: 'Invalid number, expected digit but got: "b".'
- locations: [{ line: 1, column: 3 }]
- tokens:
- -
- kind: Name
- start: 0
- end: 1
- value: a
-
-lexes strings:
- - name: basic
- input: '"simple"'
- tokens:
- -
- kind: STRING
- start: 0
- end: 8
- value: 'simple'
-
- - name: whitespace
- input: '" white space "'
- tokens:
- -
- kind: STRING
- start: 0
- end: 15
- value: ' white space '
-
- - name: quote
- input: '"quote \""'
- tokens:
- -
- kind: STRING
- start: 0
- end: 10
- value: 'quote "'
-
- - name: escaped
- input: '"escaped \n\r\b\t\f"'
- tokens:
- -
- kind: STRING
- start: 0
- end: 20
- value: "escaped \n\r\b\t\f"
-
- - name: slashes
- input: '"slashes \\ \/"'
- tokens:
- -
- kind: STRING
- start: 0
- end: 15
- value: 'slashes \ /'
-
- - name: unicode
- input: '"unicode \u1234\u5678\u90AB\uCDEF"'
- tokens:
- -
- kind: STRING
- start: 0
- end: 34
- value: "unicode \u1234\u5678\u90AB\uCDEF"
-
-lex reports useful string errors:
- - name: unterminated
- input: '"'
- error:
- message: "Unterminated string."
- locations: [{ line: 1, column: 2 }]
-
- - name: no end quote
- input: '"no end quote'
- error:
- message: 'Unterminated string.'
- locations: [{ line: 1, column: 14 }]
-
- - name: single quotes
- input: "'single quotes'"
- error:
- message: "Unexpected single quote character ('), did you mean to use a double quote (\")?"
- locations: [{ line: 1, column: 1 }]
-
- - name: control characters
- input: "\"contains unescaped \u0007 control char\""
- error:
- message: 'Invalid character within String: "\u0007".'
- locations: [{ line: 1, column: 21 }]
-
- - name: null byte
- input: "\"null-byte is not \u0000 end of file\""
- error:
- message: 'Invalid character within String: "\u0000".'
- locations: [{ line: 1, column: 19 }]
-
- - name: unterminated newline
- input: "\"multi\nline\""
- error:
- message: 'Unterminated string.'
- locations: [{line: 1, column: 7 }]
-
- - name: unterminated carriage return
- input: "\"multi\rline\""
- error:
- message: 'Unterminated string.'
- locations: [{ line: 1, column: 7 }]
-
- - name: bad escape character
- input: '"bad \z esc"'
- error:
- message: 'Invalid character escape sequence: \z.'
- locations: [{ line: 1, column: 7 }]
-
- - name: hex escape sequence
- input: '"bad \x esc"'
- error:
- message: 'Invalid character escape sequence: \x.'
- locations: [{ line: 1, column: 7 }]
-
- - name: short escape sequence
- input: '"bad \u1 esc"'
- error:
- message: 'Invalid character escape sequence: \u1 es.'
- locations: [{ line: 1, column: 7 }]
-
- - name: invalid escape sequence 1
- input: '"bad \u0XX1 esc"'
- error:
- message: 'Invalid character escape sequence: \u0XX1.'
- locations: [{ line: 1, column: 7 }]
-
- - name: invalid escape sequence 2
- input: '"bad \uXXXX esc"'
- error:
- message: 'Invalid character escape sequence: \uXXXX.'
- locations: [{ line: 1, column: 7 }]
-
- - name: invalid escape sequence 3
- input: '"bad \uFXXX esc"'
- error:
- message: 'Invalid character escape sequence: \uFXXX.'
- locations: [{ line: 1, column: 7 }]
-
- - name: invalid character escape sequence
- input: '"bad \uXXXF esc"'
- error:
- message: 'Invalid character escape sequence: \uXXXF.'
- locations: [{ line: 1, column: 7 }]
-
-lexes block strings:
- - name: simple
- input: '"""simple"""'
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 12
- value: 'simple'
-
- - name: white space
- input: '""" white space """'
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 19
- value: ' white space '
-
- - name: contains quote
- input: '"""contains " quote"""'
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 22
- value: 'contains " quote'
-
- - name: contains triplequote
- input: "\"\"\"contains \\\"\"\" triplequote\"\"\""
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 31
- value: 'contains """ triplequote'
-
- - name: multi line
- input: "\"\"\"multi\nline\"\"\""
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 16
- value: "multi\nline"
-
- - name: multi line normalized
- input: "\"\"\"multi\rline\r\nnormalized\"\"\""
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 28
- value: "multi\nline\nnormalized"
-
- - name: unescaped
- input: '"""unescaped \n\r\b\t\f\u1234"""'
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 32
- value: 'unescaped \n\r\b\t\f\u1234'
-
- - name: slashes
- input: '"""slashes \\ \/"""'
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 19
- value: 'slashes \\ \/'
-
- - name: multiple lines
- input: |
- """
-
- spans
- multiple
- lines
-
- """
- tokens:
- -
- kind: BLOCK_STRING
- start: 0
- end: 36
- value: "spans\n multiple\n lines"
-
-lex reports useful block string errors:
- - name: unterminated string
- input: '"""'
- error:
- message: "Unterminated string."
- locations: [{ line: 1, column: 4 }]
-
- - name: unescaped control characters
- input: "\"\"\"contains unescaped \u0007 control char\"\"\""
- error:
- message: 'Invalid character within String: "\u0007".'
- locations: [{ line: 1, column: 23 }]
-
- - name: null byte
- input: "\"\"\"null-byte is not \u0000 end of file\"\"\""
- error:
- message: 'Invalid character within String: "\u0000".'
- locations: [{ line: 1, column: 21 }]
-
-lexes numbers:
- - name: integer
- input: "4"
- tokens:
- -
- kind: INT
- start: 0
- end: 1
- value: '4'
-
- - name: float
- input: "4.123"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 5
- value: '4.123'
-
- - name: negative
- input: "-4"
- tokens:
- -
- kind: INT
- start: 0
- end: 2
- value: '-4'
-
- - name: nine
- input: "9"
- tokens:
- -
- kind: INT
- start: 0
- end: 1
- value: '9'
-
- - name: zero
- input: "0"
- tokens:
- -
- kind: INT
- start: 0
- end: 1
- value: '0'
-
- - name: negative float
- input: "-4.123"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 6
- value: '-4.123'
-
- - name: float leading zero
- input: "0.123"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 5
- value: '0.123'
-
- - name: exponent whole
- input: "123e4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 5
- value: '123e4'
-
- - name: exponent uppercase
- input: "123E4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 5
- value: '123E4'
-
- - name: exponent negative power
- input: "123e-4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 6
- value: '123e-4'
-
- - name: exponent positive power
- input: "123e+4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 6
- value: '123e+4'
-
- - name: exponent negative base
- input: "-1.123e4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 8
- value: '-1.123e4'
-
- - name: exponent negative base upper
- input: "-1.123E4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 8
- value: '-1.123E4'
-
- - name: exponent negative base negative power
- input: "-1.123e-4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 9
- value: '-1.123e-4'
-
- - name: exponent negative base positive power
- input: "-1.123e+4"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 9
- value: '-1.123e+4'
-
- - name: exponent negative base large power
- input: "-1.123e4567"
- tokens:
- -
- kind: FLOAT
- start: 0
- end: 11
- value: '-1.123e4567'
-
-lex reports useful number errors:
- - name: zero
- input: "00"
- error:
- message: 'Invalid number, unexpected digit after 0: "0".'
- locations: [{ line: 1, column: 2 }]
-
- - name: positive
- input: "+1"
- error:
- message: 'Cannot parse the unexpected character "+".'
- locations: [{ line: 1, column: 1 }]
-
- - name: trailing dot
- input: "1."
- error:
- message: 'Invalid number, expected digit but got: <EOF>.'
- locations: [{ line: 1, column: 3 }]
-
- - name: traililng dot exponent
- input: "1.e1"
- error:
- message: 'Invalid number, expected digit but got: "e".'
- locations: [{ line: 1, column: 3 }]
-
- - name: missing leading zero
- input: ".123"
- error:
- message: 'Cannot parse the unexpected character ".".'
- locations: [{ line: 1, column: 1 }]
-
- - name: characters
- input: "1.A"
- error:
- message: 'Invalid number, expected digit but got: "A".'
- locations: [{ line: 1, column: 3 }]
-
- - name: negative characters
- input: "-A"
- error:
- message: 'Invalid number, expected digit but got: "A".'
- locations: [{ line: 1, column: 2 }]
-
- - name: missing exponent
- input: '1.0e'
- error:
- message: 'Invalid number, expected digit but got: <EOF>.'
- locations: [{ line: 1, column: 5 }]
-
- - name: character exponent
- input: "1.0eA"
- error:
- message: 'Invalid number, expected digit but got: "A".'
- locations: [{ line: 1, column: 5 }]
-
-lexes punctuation:
- - name: bang
- input: "!"
- tokens:
- -
- kind: BANG
- start: 0
- end: 1
- value: undefined
-
- - name: dollar
- input: "$"
- tokens:
- -
- kind: DOLLAR
- start: 0
- end: 1
- value: undefined
-
- - name: open paren
- input: "("
- tokens:
- -
- kind: PAREN_L
- start: 0
- end: 1
- value: undefined
-
- - name: close paren
- input: ")"
- tokens:
- -
- kind: PAREN_R
- start: 0
- end: 1
- value: undefined
-
- - name: spread
- input: "..."
- tokens:
- -
- kind: SPREAD
- start: 0
- end: 3
- value: undefined
-
- - name: colon
- input: ":"
- tokens:
- -
- kind: COLON
- start: 0
- end: 1
- value: undefined
-
- - name: equals
- input: "="
- tokens:
- -
- kind: EQUALS
- start: 0
- end: 1
- value: undefined
-
- - name: at
- input: "@"
- tokens:
- -
- kind: AT
- start: 0
- end: 1
- value: undefined
-
- - name: open bracket
- input: "["
- tokens:
- -
- kind: BRACKET_L
- start: 0
- end: 1
- value: undefined
-
- - name: close bracket
- input: "]"
- tokens:
- -
- kind: BRACKET_R
- start: 0
- end: 1
- value: undefined
-
- - name: open brace
- input: "{"
- tokens:
- -
- kind: BRACE_L
- start: 0
- end: 1
- value: undefined
-
- - name: close brace
- input: "}"
- tokens:
- -
- kind: BRACE_R
- start: 0
- end: 1
- value: undefined
-
- - name: pipe
- input: "|"
- tokens:
- -
- kind: PIPE
- start: 0
- end: 1
- value: undefined
-
-lex reports useful unknown character error:
- - name: not a spread
- input: ".."
- error:
- message: 'Cannot parse the unexpected character ".".'
- locations: [{ line: 1, column: 1 }]
-
- - name: question mark
- input: "?"
- error:
- message: 'Cannot parse the unexpected character "?".'
- message: 'Cannot parse the unexpected character "?".'
- locations: [{ line: 1, column: 1 }]
-
- - name: unicode 203
- input: "\u203B"
- error:
- message: 'Cannot parse the unexpected character "â".'
- locations: [{ line: 1, column: 1 }]
-
- - name: unicode 200
- input: "\u200b"
- error:
- message: 'Cannot parse the unexpected character "â".'
- locations: [{ line: 1, column: 1 }]
-
diff --git a/vendor/github.com/vektah/gqlparser/lexer/token.go b/vendor/github.com/vektah/gqlparser/lexer/token.go
deleted file mode 100644
index aef8b729..00000000
--- a/vendor/github.com/vektah/gqlparser/lexer/token.go
+++ /dev/null
@@ -1,148 +0,0 @@
-package lexer
-
-import (
- "strconv"
-
- "github.com/vektah/gqlparser/ast"
-)
-
-const (
- Invalid Type = iota
- EOF
- Bang
- Dollar
- Amp
- ParenL
- ParenR
- Spread
- Colon
- Equals
- At
- BracketL
- BracketR
- BraceL
- BraceR
- Pipe
- Name
- Int
- Float
- String
- BlockString
- Comment
-)
-
-func (t Type) Name() string {
- switch t {
- case Invalid:
- return "Invalid"
- case EOF:
- return "EOF"
- case Bang:
- return "Bang"
- case Dollar:
- return "Dollar"
- case Amp:
- return "Amp"
- case ParenL:
- return "ParenL"
- case ParenR:
- return "ParenR"
- case Spread:
- return "Spread"
- case Colon:
- return "Colon"
- case Equals:
- return "Equals"
- case At:
- return "At"
- case BracketL:
- return "BracketL"
- case BracketR:
- return "BracketR"
- case BraceL:
- return "BraceL"
- case BraceR:
- return "BraceR"
- case Pipe:
- return "Pipe"
- case Name:
- return "Name"
- case Int:
- return "Int"
- case Float:
- return "Float"
- case String:
- return "String"
- case BlockString:
- return "BlockString"
- case Comment:
- return "Comment"
- }
- return "Unknown " + strconv.Itoa(int(t))
-}
-
-func (t Type) String() string {
- switch t {
- case Invalid:
- return "<Invalid>"
- case EOF:
- return "<EOF>"
- case Bang:
- return "!"
- case Dollar:
- return "$"
- case Amp:
- return "&"
- case ParenL:
- return "("
- case ParenR:
- return ")"
- case Spread:
- return "..."
- case Colon:
- return ":"
- case Equals:
- return "="
- case At:
- return "@"
- case BracketL:
- return "["
- case BracketR:
- return "]"
- case BraceL:
- return "{"
- case BraceR:
- return "}"
- case Pipe:
- return "|"
- case Name:
- return "Name"
- case Int:
- return "Int"
- case Float:
- return "Float"
- case String:
- return "String"
- case BlockString:
- return "BlockString"
- case Comment:
- return "Comment"
- }
- return "Unknown " + strconv.Itoa(int(t))
-}
-
-// Kind represents a type of token. The types are predefined as constants.
-type Type int
-
-type Token struct {
- Kind Type // The token type.
- Value string // The literal value consumed.
- Pos ast.Position // The file and line this token was read from
-}
-
-func (t Token) String() string {
- if t.Value != "" {
- return t.Kind.String() + " " + strconv.Quote(t.Value)
- }
- return t.Kind.String()
-}
diff --git a/vendor/github.com/vektah/gqlparser/parser/parser.go b/vendor/github.com/vektah/gqlparser/parser/parser.go
deleted file mode 100644
index 96e98402..00000000
--- a/vendor/github.com/vektah/gqlparser/parser/parser.go
+++ /dev/null
@@ -1,136 +0,0 @@
-package parser
-
-import (
- "strconv"
-
- "github.com/vektah/gqlparser/ast"
- "github.com/vektah/gqlparser/gqlerror"
- "github.com/vektah/gqlparser/lexer"
-)
-
-type parser struct {
- lexer lexer.Lexer
- err *gqlerror.Error
-
- peeked bool
- peekToken lexer.Token
- peekError *gqlerror.Error
-
- prev lexer.Token
-}
-
-func (p *parser) peekPos() *ast.Position {
- if p.err != nil {
- return nil
- }
-
- peek := p.peek()
- return &peek.Pos
-}
-
-func (p *parser) peek() lexer.Token {
- if p.err != nil {
- return p.prev
- }
-
- if !p.peeked {
- p.peekToken, p.peekError = p.lexer.ReadToken()
- p.peeked = true
- }
-
- return p.peekToken
-}
-
-func (p *parser) error(tok lexer.Token, format string, args ...interface{}) {
- if p.err != nil {
- return
- }
- p.err = gqlerror.ErrorLocf(tok.Pos.Src.Name, tok.Pos.Line, tok.Pos.Column, format, args...)
-}
-
-func (p *parser) next() lexer.Token {
- if p.err != nil {
- return p.prev
- }
- if p.peeked {
- p.peeked = false
- p.prev, p.err = p.peekToken, p.peekError
- } else {
- p.prev, p.err = p.lexer.ReadToken()
- }
- return p.prev
-}
-
-func (p *parser) expectKeyword(value string) lexer.Token {
- tok := p.peek()
- if tok.Kind == lexer.Name && tok.Value == value {
- return p.next()
- }
-
- p.error(tok, "Expected %s, found %s", strconv.Quote(value), tok.String())
- return tok
-}
-
-func (p *parser) expect(kind lexer.Type) lexer.Token {
- tok := p.peek()
- if tok.Kind == kind {
- return p.next()
- }
-
- p.error(tok, "Expected %s, found %s", kind, tok.Kind.String())
- return tok
-}
-
-func (p *parser) skip(kind lexer.Type) bool {
- if p.err != nil {
- return false
- }
-
- tok := p.peek()
-
- if tok.Kind != kind {
- return false
- }
- p.next()
- return true
-}
-
-func (p *parser) unexpectedError() {
- p.unexpectedToken(p.peek())
-}
-
-func (p *parser) unexpectedToken(tok lexer.Token) {
- p.error(tok, "Unexpected %s", tok.String())
-}
-
-func (p *parser) many(start lexer.Type, end lexer.Type, cb func()) {
- hasDef := p.skip(start)
- if !hasDef {
- return
- }
-
- for p.peek().Kind != end && p.err == nil {
- cb()
- }
- p.next()
-}
-
-func (p *parser) some(start lexer.Type, end lexer.Type, cb func()) {
- hasDef := p.skip(start)
- if !hasDef {
- return
- }
-
- called := false
- for p.peek().Kind != end && p.err == nil {
- called = true
- cb()
- }
-
- if !called {
- p.error(p.peek(), "expected at least one definition, found %s", p.peek().Kind.String())
- return
- }
-
- p.next()
-}
diff --git a/vendor/github.com/vektah/gqlparser/parser/query.go b/vendor/github.com/vektah/gqlparser/parser/query.go
deleted file mode 100644
index 89e1e2e3..00000000
--- a/vendor/github.com/vektah/gqlparser/parser/query.go
+++ /dev/null
@@ -1,348 +0,0 @@
-package parser
-
-import (
- "github.com/vektah/gqlparser/gqlerror"
- "github.com/vektah/gqlparser/lexer"
-
- . "github.com/vektah/gqlparser/ast"
-)
-
-func ParseQuery(source *Source) (*QueryDocument, *gqlerror.Error) {
- p := parser{
- lexer: lexer.New(source),
- }
- return p.parseQueryDocument(), p.err
-}
-
-func (p *parser) parseQueryDocument() *QueryDocument {
- var doc QueryDocument
- for p.peek().Kind != lexer.EOF {
- if p.err != nil {
- return &doc
- }
- doc.Position = p.peekPos()
- switch p.peek().Kind {
- case lexer.Name:
- switch p.peek().Value {
- case "query", "mutation", "subscription":
- doc.Operations = append(doc.Operations, p.parseOperationDefinition())
- case "fragment":
- doc.Fragments = append(doc.Fragments, p.parseFragmentDefinition())
- default:
- p.unexpectedError()
- }
- case lexer.BraceL:
- doc.Operations = append(doc.Operations, p.parseOperationDefinition())
- default:
- p.unexpectedError()
- }
- }
-
- return &doc
-}
-
-func (p *parser) parseOperationDefinition() *OperationDefinition {
- if p.peek().Kind == lexer.BraceL {
- return &OperationDefinition{
- Position: p.peekPos(),
- Operation: Query,
- SelectionSet: p.parseRequiredSelectionSet(),
- }
- }
-
- var od OperationDefinition
- od.Position = p.peekPos()
- od.Operation = p.parseOperationType()
-
- if p.peek().Kind == lexer.Name {
- od.Name = p.next().Value
- }
-
- od.VariableDefinitions = p.parseVariableDefinitions()
- od.Directives = p.parseDirectives(false)
- od.SelectionSet = p.parseRequiredSelectionSet()
-
- return &od
-}
-
-func (p *parser) parseOperationType() Operation {
- tok := p.next()
- switch tok.Value {
- case "query":
- return Query
- case "mutation":
- return Mutation
- case "subscription":
- return Subscription
- }
- p.unexpectedToken(tok)
- return ""
-}
-
-func (p *parser) parseVariableDefinitions() VariableDefinitionList {
- var defs []*VariableDefinition
- p.many(lexer.ParenL, lexer.ParenR, func() {
- defs = append(defs, p.parseVariableDefinition())
- })
-
- return defs
-}
-
-func (p *parser) parseVariableDefinition() *VariableDefinition {
- var def VariableDefinition
- def.Position = p.peekPos()
- def.Variable = p.parseVariable()
-
- p.expect(lexer.Colon)
-
- def.Type = p.parseTypeReference()
-
- if p.skip(lexer.Equals) {
- def.DefaultValue = p.parseValueLiteral(true)
- }
-
- return &def
-}
-
-func (p *parser) parseVariable() string {
- p.expect(lexer.Dollar)
- return p.parseName()
-}
-
-func (p *parser) parseOptionalSelectionSet() SelectionSet {
- var selections []Selection
- p.some(lexer.BraceL, lexer.BraceR, func() {
- selections = append(selections, p.parseSelection())
- })
-
- return SelectionSet(selections)
-}
-
-func (p *parser) parseRequiredSelectionSet() SelectionSet {
- if p.peek().Kind != lexer.BraceL {
- p.error(p.peek(), "Expected %s, found %s", lexer.BraceL, p.peek().Kind.String())
- return nil
- }
-
- var selections []Selection
- p.some(lexer.BraceL, lexer.BraceR, func() {
- selections = append(selections, p.parseSelection())
- })
-
- return SelectionSet(selections)
-}
-
-func (p *parser) parseSelection() Selection {
- if p.peek().Kind == lexer.Spread {
- return p.parseFragment()
- }
- return p.parseField()
-}
-
-func (p *parser) parseField() *Field {
- var field Field
- field.Position = p.peekPos()
- field.Alias = p.parseName()
-
- if p.skip(lexer.Colon) {
- field.Name = p.parseName()
- } else {
- field.Name = field.Alias
- }
-
- field.Arguments = p.parseArguments(false)
- field.Directives = p.parseDirectives(false)
- if p.peek().Kind == lexer.BraceL {
- field.SelectionSet = p.parseOptionalSelectionSet()
- }
-
- return &field
-}
-
-func (p *parser) parseArguments(isConst bool) ArgumentList {
- var arguments ArgumentList
- p.many(lexer.ParenL, lexer.ParenR, func() {
- arguments = append(arguments, p.parseArgument(isConst))
- })
-
- return arguments
-}
-
-func (p *parser) parseArgument(isConst bool) *Argument {
- arg := Argument{}
- arg.Position = p.peekPos()
- arg.Name = p.parseName()
- p.expect(lexer.Colon)
-
- arg.Value = p.parseValueLiteral(isConst)
- return &arg
-}
-
-func (p *parser) parseFragment() Selection {
- p.expect(lexer.Spread)
-
- if peek := p.peek(); peek.Kind == lexer.Name && peek.Value != "on" {
- return &FragmentSpread{
- Position: p.peekPos(),
- Name: p.parseFragmentName(),
- Directives: p.parseDirectives(false),
- }
- }
-
- var def InlineFragment
- def.Position = p.peekPos()
- if p.peek().Value == "on" {
- p.next() // "on"
-
- def.TypeCondition = p.parseName()
- }
-
- def.Directives = p.parseDirectives(false)
- def.SelectionSet = p.parseRequiredSelectionSet()
- return &def
-}
-
-func (p *parser) parseFragmentDefinition() *FragmentDefinition {
- var def FragmentDefinition
- def.Position = p.peekPos()
- p.expectKeyword("fragment")
-
- def.Name = p.parseFragmentName()
- def.VariableDefinition = p.parseVariableDefinitions()
-
- p.expectKeyword("on")
-
- def.TypeCondition = p.parseName()
- def.Directives = p.parseDirectives(false)
- def.SelectionSet = p.parseRequiredSelectionSet()
- return &def
-}
-
-func (p *parser) parseFragmentName() string {
- if p.peek().Value == "on" {
- p.unexpectedError()
- return ""
- }
-
- return p.parseName()
-}
-
-func (p *parser) parseValueLiteral(isConst bool) *Value {
- token := p.peek()
-
- var kind ValueKind
- switch token.Kind {
- case lexer.BracketL:
- return p.parseList(isConst)
- case lexer.BraceL:
- return p.parseObject(isConst)
- case lexer.Dollar:
- if isConst {
- p.unexpectedError()
- return nil
- }
- return &Value{Position: &token.Pos, Raw: p.parseVariable(), Kind: Variable}
- case lexer.Int:
- kind = IntValue
- case lexer.Float:
- kind = FloatValue
- case lexer.String:
- kind = StringValue
- case lexer.BlockString:
- kind = BlockValue
- case lexer.Name:
- switch token.Value {
- case "true", "false":
- kind = BooleanValue
- case "null":
- kind = NullValue
- default:
- kind = EnumValue
- }
- default:
- p.unexpectedError()
- return nil
- }
-
- p.next()
-
- return &Value{Position: &token.Pos, Raw: token.Value, Kind: kind}
-}
-
-func (p *parser) parseList(isConst bool) *Value {
- var values ChildValueList
- pos := p.peekPos()
- p.many(lexer.BracketL, lexer.BracketR, func() {
- values = append(values, &ChildValue{Value: p.parseValueLiteral(isConst)})
- })
-
- return &Value{Children: values, Kind: ListValue, Position: pos}
-}
-
-func (p *parser) parseObject(isConst bool) *Value {
- var fields ChildValueList
- pos := p.peekPos()
- p.many(lexer.BraceL, lexer.BraceR, func() {
- fields = append(fields, p.parseObjectField(isConst))
- })
-
- return &Value{Children: fields, Kind: ObjectValue, Position: pos}
-}
-
-func (p *parser) parseObjectField(isConst bool) *ChildValue {
- field := ChildValue{}
- field.Position = p.peekPos()
- field.Name = p.parseName()
-
- p.expect(lexer.Colon)
-
- field.Value = p.parseValueLiteral(isConst)
- return &field
-}
-
-func (p *parser) parseDirectives(isConst bool) []*Directive {
- var directives []*Directive
-
- for p.peek().Kind == lexer.At {
- if p.err != nil {
- break
- }
- directives = append(directives, p.parseDirective(isConst))
- }
- return directives
-}
-
-func (p *parser) parseDirective(isConst bool) *Directive {
- p.expect(lexer.At)
-
- return &Directive{
- Position: p.peekPos(),
- Name: p.parseName(),
- Arguments: p.parseArguments(isConst),
- }
-}
-
-func (p *parser) parseTypeReference() *Type {
- var typ Type
-
- if p.skip(lexer.BracketL) {
- typ.Position = p.peekPos()
- typ.Elem = p.parseTypeReference()
- p.expect(lexer.BracketR)
- } else {
- typ.Position = p.peekPos()
- typ.NamedType = p.parseName()
- }
-
- if p.skip(lexer.Bang) {
- typ.Position = p.peekPos()
- typ.NonNull = true
- }
- return &typ
-}
-
-func (p *parser) parseName() string {
- token := p.expect(lexer.Name)
-
- return token.Value
-}
diff --git a/vendor/github.com/vektah/gqlparser/parser/query_test.yml b/vendor/github.com/vektah/gqlparser/parser/query_test.yml
deleted file mode 100644
index 902bb15f..00000000
--- a/vendor/github.com/vektah/gqlparser/parser/query_test.yml
+++ /dev/null
@@ -1,520 +0,0 @@
-parser provides useful errors:
- - name: unclosed paren
- input: '{'
- error:
- message: "Expected Name, found <EOF>"
- locations: [{line: 1, column: 2}]
-
- - name: missing on in fragment
- input: |
- { ...MissingOn }
- fragment MissingOn Type
- error:
- message: 'Expected "on", found Name "Type"'
- locations: [{ line: 2, column: 20 }]
-
- - name: missing name after alias
- input: '{ field: {} }'
- error:
- message: "Expected Name, found {"
- locations: [{ line: 1, column: 10 }]
-
- - name: not an operation
- input: 'notanoperation Foo { field }'
- error:
- message: 'Unexpected Name "notanoperation"'
- locations: [{ line: 1, column: 1 }]
-
- - name: a wild splat appears
- input: '...'
- error:
- message: 'Unexpected ...'
- locations: [{ line: 1, column: 1}]
-
-variables:
- - name: are allowed in args
- input: '{ field(complex: { a: { b: [ $var ] } }) }'
-
- - name: are not allowed in default args
- input: 'query Foo($x: Complex = { a: { b: [ $var ] } }) { field }'
- error:
- message: 'Unexpected $'
- locations: [{ line: 1, column: 37 }]
-
-fragments:
- - name: can not be named 'on'
- input: 'fragment on on on { on }'
- error:
- message: 'Unexpected Name "on"'
- locations: [{ line: 1, column: 10 }]
-
- - name: can not spread fragments called 'on'
- input: '{ ...on }'
- error:
- message: 'Expected Name, found }'
- locations: [{ line: 1, column: 9 }]
-
-encoding:
- - name: multibyte characters are supported
- input: |
- # This comment has a ਊ multi-byte character.
- { field(arg: "Has a ਊ multi-byte character.") }
- ast: |
- <QueryDocument>
- Operations: [OperationDefinition]
- - <OperationDefinition>
- Operation: Operation("query")
- SelectionSet: [Selection]
- - <Field>
- Alias: "field"
- Name: "field"
- Arguments: [Argument]
- - <Argument>
- Name: "arg"
- Value: "Has a ਊ multi-byte character."
-
-keywords are allowed anywhere a name is:
- - name: on
- input: |
- query on {
- ... a
- ... on on { field }
- }
- fragment a on Type {
- on(on: $on)
- @on(on: on)
- }
-
- - name: subscription
- input: |
- query subscription {
- ... subscription
- ... on subscription { field }
- }
- fragment subscription on Type {
- subscription(subscription: $subscription)
- @subscription(subscription: subscription)
- }
-
- - name: true
- input: |
- query true {
- ... true
- ... on true { field }
- }
- fragment true on Type {
- true(true: $true)
- @true(true: true)
- }
-
-operations:
- - name: anonymous mutation
- input: 'mutation { mutationField }'
-
- - name: named mutation
- input: 'mutation Foo { mutationField }'
-
- - name: anonymous subscription
- input: 'subscription { subscriptionField }'
-
- - name: named subscription
- input: 'subscription Foo { subscriptionField }'
-
-
-ast:
- - name: simple query
- input: |
- {
- node(id: 4) {
- id,
- name
- }
- }
- ast: |
- <QueryDocument>
- Operations: [OperationDefinition]
- - <OperationDefinition>
- Operation: Operation("query")
- SelectionSet: [Selection]
- - <Field>
- Alias: "node"
- Name: "node"
- Arguments: [Argument]
- - <Argument>
- Name: "id"
- Value: 4
- SelectionSet: [Selection]
- - <Field>
- Alias: "id"
- Name: "id"
- - <Field>
- Alias: "name"
- Name: "name"
-
- - name: nameless query with no variables
- input: |
- query {
- node {
- id
- }
- }
- ast: |
- <QueryDocument>
- Operations: [OperationDefinition]
- - <OperationDefinition>
- Operation: Operation("query")
- SelectionSet: [Selection]
- - <Field>
- Alias: "node"
- Name: "node"
- SelectionSet: [Selection]
- - <Field>
- Alias: "id"
- Name: "id"
-
- - name: fragment defined variables
- input: 'fragment a($v: Boolean = false) on t { f(v: $v) }'
- ast: |
- <QueryDocument>
- Fragments: [FragmentDefinition]
- - <FragmentDefinition>
- Name: "a"
- VariableDefinition: [VariableDefinition]
- - <VariableDefinition>
- Variable: "v"
- Type: Boolean
- DefaultValue: false
- TypeCondition: "t"
- SelectionSet: [Selection]
- - <Field>
- Alias: "f"
- Name: "f"
- Arguments: [Argument]
- - <Argument>
- Name: "v"
- Value: $v
-
-
-values:
- - name: null
- input: '{ f(id: null) }'
- ast: |
- <QueryDocument>
- Operations: [OperationDefinition]
- - <OperationDefinition>
- Operation: Operation("query")
- SelectionSet: [Selection]
- - <Field>
- Alias: "f"
- Name: "f"
- Arguments: [Argument]
- - <Argument>
- Name: "id"
- Value: null
-
- - name: strings
- input: '{ f(long: """long""", short: "short") } '
- ast: |
- <QueryDocument>
- Operations: [OperationDefinition]
- - <OperationDefinition>
- Operation: Operation("query")
- SelectionSet: [Selection]
- - <Field>
- Alias: "f"
- Name: "f"
- Arguments: [Argument]
- - <Argument>
- Name: "long"
- Value: "long"
- - <Argument>
- Name: "short"
- Value: "short"
-
- - name: list
- input: '{ f(id: [1,2]) }'
- ast: |
- <QueryDocument>
- Operations: [OperationDefinition]
- - <OperationDefinition>
- Operation: Operation("query")
- SelectionSet: [Selection]
- - <Field>
- Alias: "f"
- Name: "f"
- Arguments: [Argument]
- - <Argument>
- Name: "id"
- Value: [1,2]
-
-types:
- - name: common types
- input: 'query ($string: String, $int: Int, $arr: [Arr], $notnull: [Arr!]!) { f }'
- ast: |
- <QueryDocument>
- Operations: [OperationDefinition]
- - <OperationDefinition>
- Operation: Operation("query")
- VariableDefinitions: [VariableDefinition]
- - <VariableDefinition>
- Variable: "string"
- Type: String
- - <VariableDefinition>
- Variable: "int"
- Type: Int
- - <VariableDefinition>
- Variable: "arr"
- Type: [Arr]
- - <VariableDefinition>
- Variable: "notnull"
- Type: [Arr!]!
- SelectionSet: [Selection]
- - <Field>
- Alias: "f"
- Name: "f"
-
-large queries:
- - name: kitchen sink
- input: |
- # Copyright (c) 2015-present, Facebook, Inc.
- #
- # This source code is licensed under the MIT license found in the
- # LICENSE file in the root directory of this source tree.
-
- query queryName($foo: ComplexType, $site: Site = MOBILE) {
- whoever123is: node(id: [123, 456]) {
- id ,
- ... on User @defer {
- field2 {
- id ,
- alias: field1(first:10, after:$foo,) @include(if: $foo) {
- id,
- ...frag
- }
- }
- }
- ... @skip(unless: $foo) {
- id
- }
- ... {
- id
- }
- }
- }
-
- mutation likeStory {
- like(story: 123) @defer {
- story {
- id
- }
- }
- }
-
- subscription StoryLikeSubscription($input: StoryLikeSubscribeInput) {
- storyLikeSubscribe(input: $input) {
- story {
- likers {
- count
- }
- likeSentence {
- text
- }
- }
- }
- }
-
- fragment frag on Friend {
- foo(size: $size, bar: $b, obj: {key: "value", block: """
- block string uses \"""
- """})
- }
-
- {
- unnamed(truthy: true, falsey: false, nullish: null),
- query
- }
- ast: |
- <QueryDocument>
- Operations: [OperationDefinition]
- - <OperationDefinition>
- Operation: Operation("query")
- Name: "queryName"
- VariableDefinitions: [VariableDefinition]
- - <VariableDefinition>
- Variable: "foo"
- Type: ComplexType
- - <VariableDefinition>
- Variable: "site"
- Type: Site
- DefaultValue: MOBILE
- SelectionSet: [Selection]
- - <Field>
- Alias: "whoever123is"
- Name: "node"
- Arguments: [Argument]
- - <Argument>
- Name: "id"
- Value: [123,456]
- SelectionSet: [Selection]
- - <Field>
- Alias: "id"
- Name: "id"
- - <InlineFragment>
- TypeCondition: "User"
- Directives: [Directive]
- - <Directive>
- Name: "defer"
- SelectionSet: [Selection]
- - <Field>
- Alias: "field2"
- Name: "field2"
- SelectionSet: [Selection]
- - <Field>
- Alias: "id"
- Name: "id"
- - <Field>
- Alias: "alias"
- Name: "field1"
- Arguments: [Argument]
- - <Argument>
- Name: "first"
- Value: 10
- - <Argument>
- Name: "after"
- Value: $foo
- Directives: [Directive]
- - <Directive>
- Name: "include"
- Arguments: [Argument]
- - <Argument>
- Name: "if"
- Value: $foo
- SelectionSet: [Selection]
- - <Field>
- Alias: "id"
- Name: "id"
- - <FragmentSpread>
- Name: "frag"
- - <InlineFragment>
- Directives: [Directive]
- - <Directive>
- Name: "skip"
- Arguments: [Argument]
- - <Argument>
- Name: "unless"
- Value: $foo
- SelectionSet: [Selection]
- - <Field>
- Alias: "id"
- Name: "id"
- - <InlineFragment>
- SelectionSet: [Selection]
- - <Field>
- Alias: "id"
- Name: "id"
- - <OperationDefinition>
- Operation: Operation("mutation")
- Name: "likeStory"
- SelectionSet: [Selection]
- - <Field>
- Alias: "like"
- Name: "like"
- Arguments: [Argument]
- - <Argument>
- Name: "story"
- Value: 123
- Directives: [Directive]
- - <Directive>
- Name: "defer"
- SelectionSet: [Selection]
- - <Field>
- Alias: "story"
- Name: "story"
- SelectionSet: [Selection]
- - <Field>
- Alias: "id"
- Name: "id"
- - <OperationDefinition>
- Operation: Operation("subscription")
- Name: "StoryLikeSubscription"
- VariableDefinitions: [VariableDefinition]
- - <VariableDefinition>
- Variable: "input"
- Type: StoryLikeSubscribeInput
- SelectionSet: [Selection]
- - <Field>
- Alias: "storyLikeSubscribe"
- Name: "storyLikeSubscribe"
- Arguments: [Argument]
- - <Argument>
- Name: "input"
- Value: $input
- SelectionSet: [Selection]
- - <Field>
- Alias: "story"
- Name: "story"
- SelectionSet: [Selection]
- - <Field>
- Alias: "likers"
- Name: "likers"
- SelectionSet: [Selection]
- - <Field>
- Alias: "count"
- Name: "count"
- - <Field>
- Alias: "likeSentence"
- Name: "likeSentence"
- SelectionSet: [Selection]
- - <Field>
- Alias: "text"
- Name: "text"
- - <OperationDefinition>
- Operation: Operation("query")
- SelectionSet: [Selection]
- - <Field>
- Alias: "unnamed"
- Name: "unnamed"
- Arguments: [Argument]
- - <Argument>
- Name: "truthy"
- Value: true
- - <Argument>
- Name: "falsey"
- Value: false
- - <Argument>
- Name: "nullish"
- Value: null
- - <Field>
- Alias: "query"
- Name: "query"
- Fragments: [FragmentDefinition]
- - <FragmentDefinition>
- Name: "frag"
- TypeCondition: "Friend"
- SelectionSet: [Selection]
- - <Field>
- Alias: "foo"
- Name: "foo"
- Arguments: [Argument]
- - <Argument>
- Name: "size"
- Value: $size
- - <Argument>
- Name: "bar"
- Value: $b
- - <Argument>
- Name: "obj"
- Value: {key:"value",block:"block string uses \"\"\""}
-
-fuzzer:
-- name: 01
- input: '{__typename{...}}'
- error:
- message: 'Expected {, found }'
- locations: [{ line: 1, column: 16 }]
-
-- name: 02
- input: '{...{__typename{...{}}}}'
- error:
- message: 'expected at least one definition, found }'
- locations: [{ line: 1, column: 21 }]
diff --git a/vendor/github.com/vektah/gqlparser/parser/schema.go b/vendor/github.com/vektah/gqlparser/parser/schema.go
deleted file mode 100644
index 5689e433..00000000
--- a/vendor/github.com/vektah/gqlparser/parser/schema.go
+++ /dev/null
@@ -1,527 +0,0 @@
-package parser
-
-import (
- . "github.com/vektah/gqlparser/ast"
- "github.com/vektah/gqlparser/gqlerror"
- "github.com/vektah/gqlparser/lexer"
-)
-
-func ParseSchema(source *Source) (*SchemaDocument, *gqlerror.Error) {
- p := parser{
- lexer: lexer.New(source),
- }
- ast, err := p.parseSchemaDocument(), p.err
- if err != nil {
- return nil, err
- }
-
- for _, def := range ast.Definitions {
- def.BuiltIn = source.BuiltIn
- }
- for _, def := range ast.Extensions {
- def.BuiltIn = source.BuiltIn
- }
-
- return ast, nil
-}
-
-func ParseSchemas(inputs ...*Source) (*SchemaDocument, *gqlerror.Error) {
- ast := &SchemaDocument{}
- for _, input := range inputs {
- inputAst, err := ParseSchema(input)
- if err != nil {
- return nil, err
- }
- ast.Merge(inputAst)
- }
- return ast, nil
-}
-
-func (p *parser) parseSchemaDocument() *SchemaDocument {
- var doc SchemaDocument
- doc.Position = p.peekPos()
- for p.peek().Kind != lexer.EOF {
- if p.err != nil {
- return nil
- }
-
- var description string
- if p.peek().Kind == lexer.BlockString || p.peek().Kind == lexer.String {
- description = p.parseDescription()
- }
-
- if p.peek().Kind != lexer.Name {
- p.unexpectedError()
- break
- }
-
- switch p.peek().Value {
- case "scalar", "type", "interface", "union", "enum", "input":
- doc.Definitions = append(doc.Definitions, p.parseTypeSystemDefinition(description))
- case "schema":
- doc.Schema = append(doc.Schema, p.parseSchemaDefinition(description))
- case "directive":
- doc.Directives = append(doc.Directives, p.parseDirectiveDefinition(description))
- case "extend":
- if description != "" {
- p.unexpectedToken(p.prev)
- }
- p.parseTypeSystemExtension(&doc)
- default:
- p.unexpectedError()
- return nil
- }
- }
-
- return &doc
-}
-
-func (p *parser) parseDescription() string {
- token := p.peek()
-
- if token.Kind != lexer.BlockString && token.Kind != lexer.String {
- return ""
- }
-
- return p.next().Value
-}
-
-func (p *parser) parseTypeSystemDefinition(description string) *Definition {
- tok := p.peek()
- if tok.Kind != lexer.Name {
- p.unexpectedError()
- return nil
- }
-
- switch tok.Value {
- case "scalar":
- return p.parseScalarTypeDefinition(description)
- case "type":
- return p.parseObjectTypeDefinition(description)
- case "interface":
- return p.parseInterfaceTypeDefinition(description)
- case "union":
- return p.parseUnionTypeDefinition(description)
- case "enum":
- return p.parseEnumTypeDefinition(description)
- case "input":
- return p.parseInputObjectTypeDefinition(description)
- default:
- p.unexpectedError()
- return nil
- }
-}
-
-func (p *parser) parseSchemaDefinition(description string) *SchemaDefinition {
- p.expectKeyword("schema")
-
- def := SchemaDefinition{Description: description}
- def.Position = p.peekPos()
- def.Description = description
- def.Directives = p.parseDirectives(true)
-
- p.some(lexer.BraceL, lexer.BraceR, func() {
- def.OperationTypes = append(def.OperationTypes, p.parseOperationTypeDefinition())
- })
- return &def
-}
-
-func (p *parser) parseOperationTypeDefinition() *OperationTypeDefinition {
- var op OperationTypeDefinition
- op.Position = p.peekPos()
- op.Operation = p.parseOperationType()
- p.expect(lexer.Colon)
- op.Type = p.parseName()
- return &op
-}
-
-func (p *parser) parseScalarTypeDefinition(description string) *Definition {
- p.expectKeyword("scalar")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Scalar
- def.Description = description
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- return &def
-}
-
-func (p *parser) parseObjectTypeDefinition(description string) *Definition {
- p.expectKeyword("type")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Object
- def.Description = description
- def.Name = p.parseName()
- def.Interfaces = p.parseImplementsInterfaces()
- def.Directives = p.parseDirectives(true)
- def.Fields = p.parseFieldsDefinition()
- return &def
-}
-
-func (p *parser) parseImplementsInterfaces() []string {
- var types []string
- if p.peek().Value == "implements" {
- p.next()
- // optional leading ampersand
- p.skip(lexer.Amp)
-
- types = append(types, p.parseName())
- for p.skip(lexer.Amp) && p.err == nil {
- types = append(types, p.parseName())
- }
- }
- return types
-}
-
-func (p *parser) parseFieldsDefinition() FieldList {
- var defs FieldList
- p.some(lexer.BraceL, lexer.BraceR, func() {
- defs = append(defs, p.parseFieldDefinition())
- })
- return defs
-}
-
-func (p *parser) parseFieldDefinition() *FieldDefinition {
- var def FieldDefinition
- def.Position = p.peekPos()
- def.Description = p.parseDescription()
- def.Name = p.parseName()
- def.Arguments = p.parseArgumentDefs()
- p.expect(lexer.Colon)
- def.Type = p.parseTypeReference()
- def.Directives = p.parseDirectives(true)
-
- return &def
-}
-
-func (p *parser) parseArgumentDefs() ArgumentDefinitionList {
- var args ArgumentDefinitionList
- p.some(lexer.ParenL, lexer.ParenR, func() {
- args = append(args, p.parseArgumentDef())
- })
- return args
-}
-
-func (p *parser) parseArgumentDef() *ArgumentDefinition {
- var def ArgumentDefinition
- def.Position = p.peekPos()
- def.Description = p.parseDescription()
- def.Name = p.parseName()
- p.expect(lexer.Colon)
- def.Type = p.parseTypeReference()
- if p.skip(lexer.Equals) {
- def.DefaultValue = p.parseValueLiteral(true)
- }
- def.Directives = p.parseDirectives(true)
- return &def
-}
-
-func (p *parser) parseInputValueDef() *FieldDefinition {
- var def FieldDefinition
- def.Position = p.peekPos()
- def.Description = p.parseDescription()
- def.Name = p.parseName()
- p.expect(lexer.Colon)
- def.Type = p.parseTypeReference()
- if p.skip(lexer.Equals) {
- def.DefaultValue = p.parseValueLiteral(true)
- }
- def.Directives = p.parseDirectives(true)
- return &def
-}
-
-func (p *parser) parseInterfaceTypeDefinition(description string) *Definition {
- p.expectKeyword("interface")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Interface
- def.Description = description
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- def.Fields = p.parseFieldsDefinition()
- return &def
-}
-
-func (p *parser) parseUnionTypeDefinition(description string) *Definition {
- p.expectKeyword("union")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Union
- def.Description = description
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- def.Types = p.parseUnionMemberTypes()
- return &def
-}
-
-func (p *parser) parseUnionMemberTypes() []string {
- var types []string
- if p.skip(lexer.Equals) {
- // optional leading pipe
- p.skip(lexer.Pipe)
-
- types = append(types, p.parseName())
- for p.skip(lexer.Pipe) && p.err == nil {
- types = append(types, p.parseName())
- }
- }
- return types
-}
-
-func (p *parser) parseEnumTypeDefinition(description string) *Definition {
- p.expectKeyword("enum")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Enum
- def.Description = description
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- def.EnumValues = p.parseEnumValuesDefinition()
- return &def
-}
-
-func (p *parser) parseEnumValuesDefinition() EnumValueList {
- var values EnumValueList
- p.some(lexer.BraceL, lexer.BraceR, func() {
- values = append(values, p.parseEnumValueDefinition())
- })
- return values
-}
-
-func (p *parser) parseEnumValueDefinition() *EnumValueDefinition {
- return &EnumValueDefinition{
- Position: p.peekPos(),
- Description: p.parseDescription(),
- Name: p.parseName(),
- Directives: p.parseDirectives(true),
- }
-}
-
-func (p *parser) parseInputObjectTypeDefinition(description string) *Definition {
- p.expectKeyword("input")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = InputObject
- def.Description = description
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- def.Fields = p.parseInputFieldsDefinition()
- return &def
-}
-
-func (p *parser) parseInputFieldsDefinition() FieldList {
- var values FieldList
- p.some(lexer.BraceL, lexer.BraceR, func() {
- values = append(values, p.parseInputValueDef())
- })
- return values
-}
-
-func (p *parser) parseTypeSystemExtension(doc *SchemaDocument) {
- p.expectKeyword("extend")
-
- switch p.peek().Value {
- case "schema":
- doc.SchemaExtension = append(doc.SchemaExtension, p.parseSchemaExtension())
- case "scalar":
- doc.Extensions = append(doc.Extensions, p.parseScalarTypeExtension())
- case "type":
- doc.Extensions = append(doc.Extensions, p.parseObjectTypeExtension())
- case "interface":
- doc.Extensions = append(doc.Extensions, p.parseInterfaceTypeExtension())
- case "union":
- doc.Extensions = append(doc.Extensions, p.parseUnionTypeExtension())
- case "enum":
- doc.Extensions = append(doc.Extensions, p.parseEnumTypeExtension())
- case "input":
- doc.Extensions = append(doc.Extensions, p.parseInputObjectTypeExtension())
- default:
- p.unexpectedError()
- }
-}
-
-func (p *parser) parseSchemaExtension() *SchemaDefinition {
- p.expectKeyword("schema")
-
- var def SchemaDefinition
- def.Position = p.peekPos()
- def.Directives = p.parseDirectives(true)
- p.some(lexer.BraceL, lexer.BraceR, func() {
- def.OperationTypes = append(def.OperationTypes, p.parseOperationTypeDefinition())
- })
- if len(def.Directives) == 0 && len(def.OperationTypes) == 0 {
- p.unexpectedError()
- }
- return &def
-}
-
-func (p *parser) parseScalarTypeExtension() *Definition {
- p.expectKeyword("scalar")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Scalar
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- if len(def.Directives) == 0 {
- p.unexpectedError()
- }
- return &def
-}
-
-func (p *parser) parseObjectTypeExtension() *Definition {
- p.expectKeyword("type")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Object
- def.Name = p.parseName()
- def.Interfaces = p.parseImplementsInterfaces()
- def.Directives = p.parseDirectives(true)
- def.Fields = p.parseFieldsDefinition()
- if len(def.Interfaces) == 0 && len(def.Directives) == 0 && len(def.Fields) == 0 {
- p.unexpectedError()
- }
- return &def
-}
-
-func (p *parser) parseInterfaceTypeExtension() *Definition {
- p.expectKeyword("interface")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Interface
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- def.Fields = p.parseFieldsDefinition()
- if len(def.Directives) == 0 && len(def.Fields) == 0 {
- p.unexpectedError()
- }
- return &def
-}
-
-func (p *parser) parseUnionTypeExtension() *Definition {
- p.expectKeyword("union")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Union
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- def.Types = p.parseUnionMemberTypes()
-
- if len(def.Directives) == 0 && len(def.Types) == 0 {
- p.unexpectedError()
- }
- return &def
-}
-
-func (p *parser) parseEnumTypeExtension() *Definition {
- p.expectKeyword("enum")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = Enum
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(true)
- def.EnumValues = p.parseEnumValuesDefinition()
- if len(def.Directives) == 0 && len(def.EnumValues) == 0 {
- p.unexpectedError()
- }
- return &def
-}
-
-func (p *parser) parseInputObjectTypeExtension() *Definition {
- p.expectKeyword("input")
-
- var def Definition
- def.Position = p.peekPos()
- def.Kind = InputObject
- def.Name = p.parseName()
- def.Directives = p.parseDirectives(false)
- def.Fields = p.parseInputFieldsDefinition()
- if len(def.Directives) == 0 && len(def.Fields) == 0 {
- p.unexpectedError()
- }
- return &def
-}
-
-func (p *parser) parseDirectiveDefinition(description string) *DirectiveDefinition {
- p.expectKeyword("directive")
- p.expect(lexer.At)
-
- var def DirectiveDefinition
- def.Position = p.peekPos()
- def.Description = description
- def.Name = p.parseName()
- def.Arguments = p.parseArgumentDefs()
-
- p.expectKeyword("on")
- def.Locations = p.parseDirectiveLocations()
- return &def
-}
-
-func (p *parser) parseDirectiveLocations() []DirectiveLocation {
- p.skip(lexer.Pipe)
-
- locations := []DirectiveLocation{p.parseDirectiveLocation()}
-
- for p.skip(lexer.Pipe) && p.err == nil {
- locations = append(locations, p.parseDirectiveLocation())
- }
-
- return locations
-}
-
-func (p *parser) parseDirectiveLocation() DirectiveLocation {
- name := p.expect(lexer.Name)
-
- switch name.Value {
- case `QUERY`:
- return LocationQuery
- case `MUTATION`:
- return LocationMutation
- case `SUBSCRIPTION`:
- return LocationSubscription
- case `FIELD`:
- return LocationField
- case `FRAGMENT_DEFINITION`:
- return LocationFragmentDefinition
- case `FRAGMENT_SPREAD`:
- return LocationFragmentSpread
- case `INLINE_FRAGMENT`:
- return LocationInlineFragment
- case `SCHEMA`:
- return LocationSchema
- case `SCALAR`:
- return LocationScalar
- case `OBJECT`:
- return LocationObject
- case `FIELD_DEFINITION`:
- return LocationFieldDefinition
- case `ARGUMENT_DEFINITION`:
- return LocationArgumentDefinition
- case `INTERFACE`:
- return LocationInterface
- case `UNION`:
- return LocationUnion
- case `ENUM`:
- return LocationEnum
- case `ENUM_VALUE`:
- return LocationEnumValue
- case `INPUT_OBJECT`:
- return LocationInputObject
- case `INPUT_FIELD_DEFINITION`:
- return LocationInputFieldDefinition
- }
-
- p.unexpectedToken(name)
- return ""
-}
diff --git a/vendor/github.com/vektah/gqlparser/parser/schema_test.yml b/vendor/github.com/vektah/gqlparser/parser/schema_test.yml
deleted file mode 100644
index 394bd363..00000000
--- a/vendor/github.com/vektah/gqlparser/parser/schema_test.yml
+++ /dev/null
@@ -1,540 +0,0 @@
-object types:
- - name: simple
- input: |
- type Hello {
- world: String
- }
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Fields: [FieldDefinition]
- - <FieldDefinition>
- Name: "world"
- Type: String
-
- - name: with description
- input: |
- "Description"
- type Hello {
- world: String
- }
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Description: "Description"
- Name: "Hello"
- Fields: [FieldDefinition]
- - <FieldDefinition>
- Name: "world"
- Type: String
-
- - name: with block description
- input: |
- """
- Description
- """
- # Even with comments between them
- type Hello {
- world: String
- }
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Description: "Description"
- Name: "Hello"
- Fields: [FieldDefinition]
- - <FieldDefinition>
- Name: "world"
- Type: String
- - name: with field arg
- input: |
- type Hello {
- world(flag: Boolean): String
- }
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Fields: [FieldDefinition]
- - <FieldDefinition>
- Name: "world"
- Arguments: [ArgumentDefinition]
- - <ArgumentDefinition>
- Name: "flag"
- Type: Boolean
- Type: String
-
- - name: with field arg and default value
- input: |
- type Hello {
- world(flag: Boolean = true): String
- }
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Fields: [FieldDefinition]
- - <FieldDefinition>
- Name: "world"
- Arguments: [ArgumentDefinition]
- - <ArgumentDefinition>
- Name: "flag"
- DefaultValue: true
- Type: Boolean
- Type: String
-
- - name: with field list arg
- input: |
- type Hello {
- world(things: [String]): String
- }
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Fields: [FieldDefinition]
- - <FieldDefinition>
- Name: "world"
- Arguments: [ArgumentDefinition]
- - <ArgumentDefinition>
- Name: "things"
- Type: [String]
- Type: String
-
- - name: with two args
- input: |
- type Hello {
- world(argOne: Boolean, argTwo: Int): String
- }
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Fields: [FieldDefinition]
- - <FieldDefinition>
- Name: "world"
- Arguments: [ArgumentDefinition]
- - <ArgumentDefinition>
- Name: "argOne"
- Type: Boolean
- - <ArgumentDefinition>
- Name: "argTwo"
- Type: Int
- Type: String
- - name: must define one or more fields
- input: |
- type Hello {}
- error:
- message: "expected at least one definition, found }"
- locations: [{ line: 1, column: 13 }]
-
-type extensions:
- - name: Object extension
- input: |
- extend type Hello {
- world: String
- }
- ast: |
- <SchemaDocument>
- Extensions: [Definition]
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Fields: [FieldDefinition]
- - <FieldDefinition>
- Name: "world"
- Type: String
-
- - name: without any fields
- input: "extend type Hello implements Greeting"
- ast: |
- <SchemaDocument>
- Extensions: [Definition]
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Interfaces: [string]
- - "Greeting"
-
- - name: without fields twice
- input: |
- extend type Hello implements Greeting
- extend type Hello implements SecondGreeting
- ast: |
- <SchemaDocument>
- Extensions: [Definition]
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Interfaces: [string]
- - "Greeting"
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Interfaces: [string]
- - "SecondGreeting"
-
- - name: without anything errors
- input: "extend type Hello"
- error:
- message: "Unexpected <EOF>"
- locations: [{ line: 1, column: 18 }]
-
- - name: can have descriptions # hmm, this might not be spec compliant...
- input: |
- "Description"
- extend type Hello {
- world: String
- }
- error:
- message: 'Unexpected String "Description"'
- locations: [{ line: 1, column: 2 }]
-
- - name: can not have descriptions on types
- input: |
- extend "Description" type Hello {
- world: String
- }
- error:
- message: Unexpected String "Description"
- locations: [{ line: 1, column: 9 }]
-
-schema definition:
- - name: simple
- input: |
- schema {
- query: Query
- }
- ast: |
- <SchemaDocument>
- Schema: [SchemaDefinition]
- - <SchemaDefinition>
- OperationTypes: [OperationTypeDefinition]
- - <OperationTypeDefinition>
- Operation: Operation("query")
- Type: "Query"
-
-schema extensions:
- - name: simple
- input: |
- extend schema {
- mutation: Mutation
- }
- ast: |
- <SchemaDocument>
- SchemaExtension: [SchemaDefinition]
- - <SchemaDefinition>
- OperationTypes: [OperationTypeDefinition]
- - <OperationTypeDefinition>
- Operation: Operation("mutation")
- Type: "Mutation"
-
- - name: directive only
- input: "extend schema @directive"
- ast: |
- <SchemaDocument>
- SchemaExtension: [SchemaDefinition]
- - <SchemaDefinition>
- Directives: [Directive]
- - <Directive>
- Name: "directive"
-
- - name: without anything errors
- input: "extend schema"
- error:
- message: "Unexpected <EOF>"
- locations: [{ line: 1, column: 14}]
-
-type extensions:
- - name: all can have directives
- input: |
- extend scalar Foo @deprecated
- extend type Foo @deprecated
- extend interface Foo @deprecated
- extend union Foo @deprecated
- extend enum Foo @deprecated
- extend input Foo @deprecated
- ast: |
- <SchemaDocument>
- Extensions: [Definition]
- - <Definition>
- Kind: DefinitionKind("SCALAR")
- Name: "Foo"
- Directives: [Directive]
- - <Directive>
- Name: "deprecated"
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Name: "Foo"
- Directives: [Directive]
- - <Directive>
- Name: "deprecated"
- - <Definition>
- Kind: DefinitionKind("INTERFACE")
- Name: "Foo"
- Directives: [Directive]
- - <Directive>
- Name: "deprecated"
- - <Definition>
- Kind: DefinitionKind("UNION")
- Name: "Foo"
- Directives: [Directive]
- - <Directive>
- Name: "deprecated"
- - <Definition>
- Kind: DefinitionKind("ENUM")
- Name: "Foo"
- Directives: [Directive]
- - <Directive>
- Name: "deprecated"
- - <Definition>
- Kind: DefinitionKind("INPUT_OBJECT")
- Name: "Foo"
- Directives: [Directive]
- - <Directive>
- Name: "deprecated"
-
-
-inheritance:
- - name: single
- input: "type Hello implements World { field: String }"
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Interfaces: [string]
- - "World"
- Fields: [FieldDefinition]
- - <FieldDefinition>
- Name: "field"
- Type: String
-
- - name: multi
- input: "type Hello implements Wo & rld { field: String }"
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Interfaces: [string]
- - "Wo"
- - "rld"
- Fields: [FieldDefinition]
- - <FieldDefinition>
- Name: "field"
- Type: String
-
- - name: multi with leading amp
- input: "type Hello implements & Wo & rld { field: String }"
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("OBJECT")
- Name: "Hello"
- Interfaces: [string]
- - "Wo"
- - "rld"
- Fields: [FieldDefinition]
- - <FieldDefinition>
- Name: "field"
- Type: String
-
-enums:
- - name: single value
- input: "enum Hello { WORLD }"
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("ENUM")
- Name: "Hello"
- EnumValues: [EnumValueDefinition]
- - <EnumValueDefinition>
- Name: "WORLD"
-
- - name: double value
- input: "enum Hello { WO, RLD }"
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("ENUM")
- Name: "Hello"
- EnumValues: [EnumValueDefinition]
- - <EnumValueDefinition>
- Name: "WO"
- - <EnumValueDefinition>
- Name: "RLD"
- - name: must define one or more unique enum values
- input: |
- enum Hello {}
- error:
- message: "expected at least one definition, found }"
- locations: [{ line: 1, column: 13 }]
-
-interface:
- - name: simple
- input: |
- interface Hello {
- world: String
- }
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("INTERFACE")
- Name: "Hello"
- Fields: [FieldDefinition]
- - <FieldDefinition>
- Name: "world"
- Type: String
- - name: must define one or more fields
- input: |
- interface Hello {}
- error:
- message: "expected at least one definition, found }"
- locations: [{ line: 1, column: 18 }]
-
-unions:
- - name: simple
- input: "union Hello = World"
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("UNION")
- Name: "Hello"
- Types: [string]
- - "World"
-
- - name: with two types
- input: "union Hello = Wo | Rld"
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("UNION")
- Name: "Hello"
- Types: [string]
- - "Wo"
- - "Rld"
-
- - name: with leading pipe
- input: "union Hello = | Wo | Rld"
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("UNION")
- Name: "Hello"
- Types: [string]
- - "Wo"
- - "Rld"
-
- - name: cant be empty
- input: "union Hello = || Wo | Rld"
- error:
- message: "Expected Name, found |"
- locations: [{ line: 1, column: 16 }]
-
- - name: cant double pipe
- input: "union Hello = Wo || Rld"
- error:
- message: "Expected Name, found |"
- locations: [{ line: 1, column: 19 }]
-
- - name: cant have trailing pipe
- input: "union Hello = | Wo | Rld |"
- error:
- message: "Expected Name, found <EOF>"
- locations: [{ line: 1, column: 27 }]
-
-scalar:
- - name: simple
- input: "scalar Hello"
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("SCALAR")
- Name: "Hello"
-
-input object:
- - name: simple
- input: |
- input Hello {
- world: String
- }
- ast: |
- <SchemaDocument>
- Definitions: [Definition]
- - <Definition>
- Kind: DefinitionKind("INPUT_OBJECT")
- Name: "Hello"
- Fields: [FieldDefinition]
- - <FieldDefinition>
- Name: "world"
- Type: String
-
- - name: can not have args
- input: |
- input Hello {
- world(foo: Int): String
- }
- error:
- message: "Expected :, found ("
- locations: [{ line: 2, column: 8 }]
- - name: must define one or more input fields
- input: |
- input Hello {}
- error:
- message: "expected at least one definition, found }"
- locations: [{ line: 1, column: 14 }]
-
-directives:
- - name: simple
- input: directive @foo on FIELD
- ast: |
- <SchemaDocument>
- Directives: [DirectiveDefinition]
- - <DirectiveDefinition>
- Name: "foo"
- Locations: [DirectiveLocation]
- - DirectiveLocation("FIELD")
-
- - name: invalid location
- input: "directive @foo on FIELD | INCORRECT_LOCATION"
- error:
- message: 'Unexpected Name "INCORRECT_LOCATION"'
- locations: [{ line: 1, column: 27 }]
-
-fuzzer:
- - name: 1
- input: "type o{d(g:["
- error:
- message: 'Expected Name, found <EOF>'
- locations: [{ line: 1, column: 13 }]
- - name: 2
- input: "\"\"\"\r"
- error:
- message: 'Unexpected <Invalid>'
- locations: [{ line: 1, column: 5 }]
diff --git a/vendor/github.com/vektah/gqlparser/readme.md b/vendor/github.com/vektah/gqlparser/readme.md
deleted file mode 100644
index 976d202b..00000000
--- a/vendor/github.com/vektah/gqlparser/readme.md
+++ /dev/null
@@ -1,17 +0,0 @@
-gqlparser [![CircleCI](https://badgen.net/circleci/github/vektah/gqlparser/master)](https://circleci.com/gh/vektah/gqlparser) [![Go Report Card](https://goreportcard.com/badge/github.com/vektah/gqlparser)](https://goreportcard.com/report/github.com/vektah/gqlparser) [![Coverage Status](https://badgen.net/coveralls/c/github/vektah/gqlparser)](https://coveralls.io/github/vektah/gqlparser?branch=master)
-===
-
-This is a parser for graphql, written to mirror the graphql-js reference implementation as closely while remaining idiomatic and easy to use.
-
-spec target: June 2018 (Schema definition language, block strings as descriptions, error paths & extension)
-
-This parser is used by [gqlgen](https://github.com/99designs/gqlgen), and it should be reasonablly stable.
-
-Guiding principles:
-
- - maintainability: It should be easy to stay up to date with the spec
- - well tested: It shouldnt need a graphql server to validate itself. Changes to this repo should be self contained.
- - server agnostic: It should be usable by any of the graphql server implementations, and any graphql client tooling.
- - idiomatic & stable api: It should follow go best practices, especially around forwards compatibility.
- - fast: Where it doesnt impact on the above it should be fast. Avoid unnecessary allocs in hot paths.
- - close to reference: Where it doesnt impact on the above, it should stay close to the [graphql/graphql-js](github.com/graphql/graphql-js) reference implementation.
diff --git a/vendor/github.com/vektah/gqlparser/validator/error.go b/vendor/github.com/vektah/gqlparser/validator/error.go
deleted file mode 100644
index f354dee5..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/error.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package validator
-
-import (
- "fmt"
-
- "github.com/vektah/gqlparser/ast"
- "github.com/vektah/gqlparser/gqlerror"
-)
-
-type ErrorOption func(err *gqlerror.Error)
-
-func Message(msg string, args ...interface{}) ErrorOption {
- return func(err *gqlerror.Error) {
- err.Message += fmt.Sprintf(msg, args...)
- }
-}
-
-func At(position *ast.Position) ErrorOption {
- return func(err *gqlerror.Error) {
- if position == nil {
- return
- }
- err.Locations = append(err.Locations, gqlerror.Location{
- Line: position.Line,
- Column: position.Column,
- })
- if position.Src.Name != "" {
- err.SetFile(position.Src.Name)
- }
- }
-}
-
-func SuggestListQuoted(prefix string, typed string, suggestions []string) ErrorOption {
- suggested := SuggestionList(typed, suggestions)
- return func(err *gqlerror.Error) {
- if len(suggested) > 0 {
- err.Message += " " + prefix + " " + QuotedOrList(suggested...) + "?"
- }
- }
-}
-
-func SuggestListUnquoted(prefix string, typed string, suggestions []string) ErrorOption {
- suggested := SuggestionList(typed, suggestions)
- return func(err *gqlerror.Error) {
- if len(suggested) > 0 {
- err.Message += " " + prefix + " " + OrList(suggested...) + "?"
- }
- }
-}
-
-func Suggestf(suggestion string, args ...interface{}) ErrorOption {
- return func(err *gqlerror.Error) {
- err.Message += " Did you mean " + fmt.Sprintf(suggestion, args...) + "?"
- }
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/imported/LICENSE b/vendor/github.com/vektah/gqlparser/validator/imported/LICENSE
deleted file mode 100644
index fce4519e..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/imported/LICENSE
+++ /dev/null
@@ -1,33 +0,0 @@
-The files in this testdata directory are derived from the graphql-js project:
-https://github.com/graphql/graphql-js
-
-BSD License
-
-For GraphQL software
-
-Copyright (c) 2015, Facebook, Inc. 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 Facebook 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. \ No newline at end of file
diff --git a/vendor/github.com/vektah/gqlparser/validator/messaging.go b/vendor/github.com/vektah/gqlparser/validator/messaging.go
deleted file mode 100644
index f1ab5873..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/messaging.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package validator
-
-import "bytes"
-
-// Given [ A, B, C ] return '"A", "B", or "C"'.
-func QuotedOrList(items ...string) string {
- itemsQuoted := make([]string, len(items))
- for i, item := range items {
- itemsQuoted[i] = `"` + item + `"`
- }
- return OrList(itemsQuoted...)
-}
-
-// Given [ A, B, C ] return 'A, B, or C'.
-func OrList(items ...string) string {
- var buf bytes.Buffer
-
- if len(items) > 5 {
- items = items[:5]
- }
- if len(items) == 2 {
- buf.WriteString(items[0])
- buf.WriteString(" or ")
- buf.WriteString(items[1])
- return buf.String()
- }
-
- for i, item := range items {
- if i != 0 {
- if i == len(items)-1 {
- buf.WriteString(", or ")
- } else {
- buf.WriteString(", ")
- }
- }
- buf.WriteString(item)
- }
- return buf.String()
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/prelude.go b/vendor/github.com/vektah/gqlparser/validator/prelude.go
deleted file mode 100644
index c7a4d35b..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/prelude.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package validator
-
-import "github.com/vektah/gqlparser/ast"
-
-var Prelude = &ast.Source{
- Name: "prelude.graphql",
- Input: "# This file defines all the implicitly declared types that are required by the graphql spec. It is implicitly included by calls to LoadSchema\n\n# The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.\nscalar Int\n\n# The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).\nscalar Float\n\n# The `String`scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.\nscalar String\n\n# The `Boolean` scalar type represents ` + \"`\" + `true` + \"`\" + ` or ` + \"`\" + `false` + \"`\" + `.\nscalar Boolean\n\n# The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as \"4\") or integer (such as 4) input value will be accepted as an ID.\nscalar ID\n\n# The @include directive may be provided for fields, fragment spreads, and inline fragments, and allows for conditional inclusion during execution as described by the if argument.\ndirective @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT\n\n# The @skip directive may be provided for fields, fragment spreads, and inline fragments, and allows for conditional exclusion during execution as described by the if argument.\ndirective @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT\n\n# The @deprecated directive is used within the type system definition language to indicate deprecated portions of a GraphQL service’s schema, such as deprecated fields on a type or deprecated enum values.\ndirective @deprecated(reason: String = \"No longer supported\") on FIELD_DEFINITION | ENUM_VALUE\n\ntype __Schema {\n types: [__Type!]!\n queryType: __Type!\n mutationType: __Type\n subscriptionType: __Type\n directives: [__Directive!]!\n}\n\ntype __Type {\n kind: __TypeKind!\n name: String\n description: String\n\n # OBJECT and INTERFACE only\n fields(includeDeprecated: Boolean = false): [__Field!]\n\n # OBJECT only\n interfaces: [__Type!]\n\n # INTERFACE and UNION only\n possibleTypes: [__Type!]\n\n # ENUM only\n enumValues(includeDeprecated: Boolean = false): [__EnumValue!]\n\n # INPUT_OBJECT only\n inputFields: [__InputValue!]\n\n # NON_NULL and LIST only\n ofType: __Type\n}\n\ntype __Field {\n name: String!\n description: String\n args: [__InputValue!]!\n type: __Type!\n isDeprecated: Boolean!\n deprecationReason: String\n}\n\ntype __InputValue {\n name: String!\n description: String\n type: __Type!\n defaultValue: String\n}\n\ntype __EnumValue {\n name: String!\n description: String\n isDeprecated: Boolean!\n deprecationReason: String\n}\n\nenum __TypeKind {\n SCALAR\n OBJECT\n INTERFACE\n UNION\n ENUM\n INPUT_OBJECT\n LIST\n NON_NULL\n}\n\ntype __Directive {\n name: String!\n description: String\n locations: [__DirectiveLocation!]!\n args: [__InputValue!]!\n}\n\nenum __DirectiveLocation {\n QUERY\n MUTATION\n SUBSCRIPTION\n FIELD\n FRAGMENT_DEFINITION\n FRAGMENT_SPREAD\n INLINE_FRAGMENT\n SCHEMA\n SCALAR\n OBJECT\n FIELD_DEFINITION\n ARGUMENT_DEFINITION\n INTERFACE\n UNION\n ENUM\n ENUM_VALUE\n INPUT_OBJECT\n INPUT_FIELD_DEFINITION\n}\n",
- BuiltIn: true,
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/prelude.graphql b/vendor/github.com/vektah/gqlparser/validator/prelude.graphql
deleted file mode 100644
index 2c7f7c02..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/prelude.graphql
+++ /dev/null
@@ -1,119 +0,0 @@
-# This file defines all the implicitly declared types that are required by the graphql spec. It is implicitly included by calls to LoadSchema
-
-# The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.
-scalar Int
-
-# The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).
-scalar Float
-
-# The `String`scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.
-scalar String
-
-# The `Boolean` scalar type represents ` + "`" + `true` + "`" + ` or ` + "`" + `false` + "`" + `.
-scalar Boolean
-
-# The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as "4") or integer (such as 4) input value will be accepted as an ID.
-scalar ID
-
-# The @include directive may be provided for fields, fragment spreads, and inline fragments, and allows for conditional inclusion during execution as described by the if argument.
-directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
-
-# The @skip directive may be provided for fields, fragment spreads, and inline fragments, and allows for conditional exclusion during execution as described by the if argument.
-directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
-
-# The @deprecated directive is used within the type system definition language to indicate deprecated portions of a GraphQL service’s schema, such as deprecated fields on a type or deprecated enum values.
-directive @deprecated(reason: String = "No longer supported") on FIELD_DEFINITION | ENUM_VALUE
-
-type __Schema {
- types: [__Type!]!
- queryType: __Type!
- mutationType: __Type
- subscriptionType: __Type
- directives: [__Directive!]!
-}
-
-type __Type {
- kind: __TypeKind!
- name: String
- description: String
-
- # OBJECT and INTERFACE only
- fields(includeDeprecated: Boolean = false): [__Field!]
-
- # OBJECT only
- interfaces: [__Type!]
-
- # INTERFACE and UNION only
- possibleTypes: [__Type!]
-
- # ENUM only
- enumValues(includeDeprecated: Boolean = false): [__EnumValue!]
-
- # INPUT_OBJECT only
- inputFields: [__InputValue!]
-
- # NON_NULL and LIST only
- ofType: __Type
-}
-
-type __Field {
- name: String!
- description: String
- args: [__InputValue!]!
- type: __Type!
- isDeprecated: Boolean!
- deprecationReason: String
-}
-
-type __InputValue {
- name: String!
- description: String
- type: __Type!
- defaultValue: String
-}
-
-type __EnumValue {
- name: String!
- description: String
- isDeprecated: Boolean!
- deprecationReason: String
-}
-
-enum __TypeKind {
- SCALAR
- OBJECT
- INTERFACE
- UNION
- ENUM
- INPUT_OBJECT
- LIST
- NON_NULL
-}
-
-type __Directive {
- name: String!
- description: String
- locations: [__DirectiveLocation!]!
- args: [__InputValue!]!
-}
-
-enum __DirectiveLocation {
- QUERY
- MUTATION
- SUBSCRIPTION
- FIELD
- FRAGMENT_DEFINITION
- FRAGMENT_SPREAD
- INLINE_FRAGMENT
- SCHEMA
- SCALAR
- OBJECT
- FIELD_DEFINITION
- ARGUMENT_DEFINITION
- INTERFACE
- UNION
- ENUM
- ENUM_VALUE
- INPUT_OBJECT
- INPUT_FIELD_DEFINITION
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/fields_on_correct_type.go b/vendor/github.com/vektah/gqlparser/validator/rules/fields_on_correct_type.go
deleted file mode 100644
index 69148d52..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/fields_on_correct_type.go
+++ /dev/null
@@ -1,86 +0,0 @@
-package validator
-
-import (
- "fmt"
- "sort"
-
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("FieldsOnCorrectType", func(observers *Events, addError AddErrFunc) {
- observers.OnField(func(walker *Walker, field *ast.Field) {
- if field.ObjectDefinition == nil || field.Definition != nil {
- return
- }
-
- message := fmt.Sprintf(`Cannot query field "%s" on type "%s".`, field.Name, field.ObjectDefinition.Name)
-
- if suggestedTypeNames := getSuggestedTypeNames(walker, field.ObjectDefinition, field.Name); suggestedTypeNames != nil {
- message += " Did you mean to use an inline fragment on " + QuotedOrList(suggestedTypeNames...) + "?"
- } else if suggestedFieldNames := getSuggestedFieldNames(field.ObjectDefinition, field.Name); suggestedFieldNames != nil {
- message += " Did you mean " + QuotedOrList(suggestedFieldNames...) + "?"
- }
-
- addError(
- Message(message),
- At(field.Position),
- )
- })
- })
-}
-
-// Go through all of the implementations of type, as well as the interfaces
-// that they implement. If any of those types include the provided field,
-// suggest them, sorted by how often the type is referenced, starting
-// with Interfaces.
-func getSuggestedTypeNames(walker *Walker, parent *ast.Definition, name string) []string {
- if !parent.IsAbstractType() {
- return nil
- }
-
- var suggestedObjectTypes []string
- var suggestedInterfaceTypes []string
- interfaceUsageCount := map[string]int{}
-
- for _, possibleType := range walker.Schema.GetPossibleTypes(parent) {
- field := possibleType.Fields.ForName(name)
- if field == nil {
- continue
- }
-
- suggestedObjectTypes = append(suggestedObjectTypes, possibleType.Name)
-
- for _, possibleInterface := range possibleType.Interfaces {
- interfaceField := walker.Schema.Types[possibleInterface]
- if interfaceField != nil && interfaceField.Fields.ForName(name) != nil {
- if interfaceUsageCount[possibleInterface] == 0 {
- suggestedInterfaceTypes = append(suggestedInterfaceTypes, possibleInterface)
- }
- interfaceUsageCount[possibleInterface]++
- }
- }
- }
-
- sort.SliceStable(suggestedInterfaceTypes, func(i, j int) bool {
- return interfaceUsageCount[suggestedInterfaceTypes[i]] > interfaceUsageCount[suggestedInterfaceTypes[j]]
- })
-
- return append(suggestedInterfaceTypes, suggestedObjectTypes...)
-}
-
-// For the field name provided, determine if there are any similar field names
-// that may be the result of a typo.
-func getSuggestedFieldNames(parent *ast.Definition, name string) []string {
- if parent.Kind != ast.Object && parent.Kind != ast.Interface {
- return nil
- }
-
- var possibleFieldNames []string
- for _, field := range parent.Fields {
- possibleFieldNames = append(possibleFieldNames, field.Name)
- }
-
- return SuggestionList(name, possibleFieldNames)
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/fragments_on_composite_types.go b/vendor/github.com/vektah/gqlparser/validator/rules/fragments_on_composite_types.go
deleted file mode 100644
index a4a48246..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/fragments_on_composite_types.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package validator
-
-import (
- "fmt"
-
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("FragmentsOnCompositeTypes", func(observers *Events, addError AddErrFunc) {
- observers.OnInlineFragment(func(walker *Walker, inlineFragment *ast.InlineFragment) {
- fragmentType := walker.Schema.Types[inlineFragment.TypeCondition]
- if fragmentType == nil || fragmentType.IsCompositeType() {
- return
- }
-
- message := fmt.Sprintf(`Fragment cannot condition on non composite type "%s".`, inlineFragment.TypeCondition)
-
- addError(
- Message(message),
- At(inlineFragment.Position),
- )
- })
-
- observers.OnFragment(func(walker *Walker, fragment *ast.FragmentDefinition) {
- if fragment.Definition == nil || fragment.TypeCondition == "" || fragment.Definition.IsCompositeType() {
- return
- }
-
- message := fmt.Sprintf(`Fragment "%s" cannot condition on non composite type "%s".`, fragment.Name, fragment.TypeCondition)
-
- addError(
- Message(message),
- At(fragment.Position),
- )
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/known_argument_names.go b/vendor/github.com/vektah/gqlparser/validator/rules/known_argument_names.go
deleted file mode 100644
index 1a46431d..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/known_argument_names.go
+++ /dev/null
@@ -1,57 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("KnownArgumentNames", func(observers *Events, addError AddErrFunc) {
- // A GraphQL field is only valid if all supplied arguments are defined by that field.
- observers.OnField(func(walker *Walker, field *ast.Field) {
- if field.Definition == nil || field.ObjectDefinition == nil {
- return
- }
- for _, arg := range field.Arguments {
- def := field.Definition.Arguments.ForName(arg.Name)
- if def != nil {
- continue
- }
-
- var suggestions []string
- for _, argDef := range field.Definition.Arguments {
- suggestions = append(suggestions, argDef.Name)
- }
-
- addError(
- Message(`Unknown argument "%s" on field "%s" of type "%s".`, arg.Name, field.Name, field.ObjectDefinition.Name),
- SuggestListQuoted("Did you mean", arg.Name, suggestions),
- At(field.Position),
- )
- }
- })
-
- observers.OnDirective(func(walker *Walker, directive *ast.Directive) {
- if directive.Definition == nil {
- return
- }
- for _, arg := range directive.Arguments {
- def := directive.Definition.Arguments.ForName(arg.Name)
- if def != nil {
- continue
- }
-
- var suggestions []string
- for _, argDef := range directive.Definition.Arguments {
- suggestions = append(suggestions, argDef.Name)
- }
-
- addError(
- Message(`Unknown argument "%s" on directive "@%s".`, arg.Name, directive.Name),
- SuggestListQuoted("Did you mean", arg.Name, suggestions),
- At(directive.Position),
- )
- }
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/known_directives.go b/vendor/github.com/vektah/gqlparser/validator/rules/known_directives.go
deleted file mode 100644
index dc4353ef..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/known_directives.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("KnownDirectives", func(observers *Events, addError AddErrFunc) {
- observers.OnDirective(func(walker *Walker, directive *ast.Directive) {
- if directive.Definition == nil {
- addError(
- Message(`Unknown directive "%s".`, directive.Name),
- At(directive.Position),
- )
- return
- }
-
- for _, loc := range directive.Definition.Locations {
- if loc == directive.Location {
- return
- }
- }
-
- addError(
- Message(`Directive "%s" may not be used on %s.`, directive.Name, directive.Location),
- At(directive.Position),
- )
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/known_fragment_names.go b/vendor/github.com/vektah/gqlparser/validator/rules/known_fragment_names.go
deleted file mode 100644
index ec91588c..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/known_fragment_names.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("KnownFragmentNames", func(observers *Events, addError AddErrFunc) {
- observers.OnFragmentSpread(func(walker *Walker, fragmentSpread *ast.FragmentSpread) {
- if fragmentSpread.Definition == nil {
- addError(
- Message(`Unknown fragment "%s".`, fragmentSpread.Name),
- At(fragmentSpread.Position),
- )
- }
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/known_type_names.go b/vendor/github.com/vektah/gqlparser/validator/rules/known_type_names.go
deleted file mode 100644
index 223086b3..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/known_type_names.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("KnownTypeNames", func(observers *Events, addError AddErrFunc) {
- observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) {
- for _, vdef := range operation.VariableDefinitions {
- typeName := vdef.Type.Name()
- def := walker.Schema.Types[typeName]
- if def != nil {
- continue
- }
-
- addError(
- Message(`Unknown type "%s".`, typeName),
- At(operation.Position),
- )
- }
- })
-
- observers.OnInlineFragment(func(walker *Walker, inlineFragment *ast.InlineFragment) {
- typedName := inlineFragment.TypeCondition
- if typedName == "" {
- return
- }
-
- def := walker.Schema.Types[typedName]
- if def != nil {
- return
- }
-
- addError(
- Message(`Unknown type "%s".`, typedName),
- At(inlineFragment.Position),
- )
- })
-
- observers.OnFragment(func(walker *Walker, fragment *ast.FragmentDefinition) {
- typeName := fragment.TypeCondition
- def := walker.Schema.Types[typeName]
- if def != nil {
- return
- }
-
- var possibleTypes []string
- for _, t := range walker.Schema.Types {
- possibleTypes = append(possibleTypes, t.Name)
- }
-
- addError(
- Message(`Unknown type "%s".`, typeName),
- SuggestListQuoted("Did you mean", typeName, possibleTypes),
- At(fragment.Position),
- )
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/lone_anonymous_operation.go b/vendor/github.com/vektah/gqlparser/validator/rules/lone_anonymous_operation.go
deleted file mode 100644
index dd232142..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/lone_anonymous_operation.go
+++ /dev/null
@@ -1,19 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("LoneAnonymousOperation", func(observers *Events, addError AddErrFunc) {
- observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) {
- if operation.Name == "" && len(walker.Document.Operations) > 1 {
- addError(
- Message(`This anonymous operation must be the only defined operation.`),
- At(operation.Position),
- )
- }
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/no_fragment_cycles.go b/vendor/github.com/vektah/gqlparser/validator/rules/no_fragment_cycles.go
deleted file mode 100644
index 7511529b..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/no_fragment_cycles.go
+++ /dev/null
@@ -1,93 +0,0 @@
-package validator
-
-import (
- "fmt"
- "strings"
-
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("NoFragmentCycles", func(observers *Events, addError AddErrFunc) {
- visitedFrags := make(map[string]bool)
-
- observers.OnFragment(func(walker *Walker, fragment *ast.FragmentDefinition) {
- var spreadPath []*ast.FragmentSpread
- spreadPathIndexByName := make(map[string]int)
-
- var recursive func(fragment *ast.FragmentDefinition)
- recursive = func(fragment *ast.FragmentDefinition) {
- if visitedFrags[fragment.Name] {
- return
- }
-
- visitedFrags[fragment.Name] = true
-
- spreadNodes := getFragmentSpreads(fragment.SelectionSet)
- if len(spreadNodes) == 0 {
- return
- }
- spreadPathIndexByName[fragment.Name] = len(spreadPath)
-
- for _, spreadNode := range spreadNodes {
- spreadName := spreadNode.Name
-
- cycleIndex, ok := spreadPathIndexByName[spreadName]
-
- spreadPath = append(spreadPath, spreadNode)
- if !ok {
- spreadFragment := walker.Document.Fragments.ForName(spreadName)
- if spreadFragment != nil {
- recursive(spreadFragment)
- }
- } else {
- cyclePath := spreadPath[cycleIndex : len(spreadPath)-1]
- var fragmentNames []string
- for _, fs := range cyclePath {
- fragmentNames = append(fragmentNames, fs.Name)
- }
- var via string
- if len(fragmentNames) != 0 {
- via = fmt.Sprintf(" via %s", strings.Join(fragmentNames, ", "))
- }
- addError(
- Message(`Cannot spread fragment "%s" within itself%s.`, spreadName, via),
- At(spreadNode.Position),
- )
- }
-
- spreadPath = spreadPath[:len(spreadPath)-1]
- }
-
- delete(spreadPathIndexByName, fragment.Name)
- }
-
- recursive(fragment)
- })
- })
-}
-
-func getFragmentSpreads(node ast.SelectionSet) []*ast.FragmentSpread {
- var spreads []*ast.FragmentSpread
-
- setsToVisit := []ast.SelectionSet{node}
-
- for len(setsToVisit) != 0 {
- set := setsToVisit[len(setsToVisit)-1]
- setsToVisit = setsToVisit[:len(setsToVisit)-1]
-
- for _, selection := range set {
- switch selection := selection.(type) {
- case *ast.FragmentSpread:
- spreads = append(spreads, selection)
- case *ast.Field:
- setsToVisit = append(setsToVisit, selection.SelectionSet)
- case *ast.InlineFragment:
- setsToVisit = append(setsToVisit, selection.SelectionSet)
- }
- }
- }
-
- return spreads
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/no_undefined_variables.go b/vendor/github.com/vektah/gqlparser/validator/rules/no_undefined_variables.go
deleted file mode 100644
index 505206be..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/no_undefined_variables.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("NoUndefinedVariables", func(observers *Events, addError AddErrFunc) {
- observers.OnValue(func(walker *Walker, value *ast.Value) {
- if walker.CurrentOperation == nil || value.Kind != ast.Variable || value.VariableDefinition != nil {
- return
- }
-
- if walker.CurrentOperation.Name != "" {
- addError(
- Message(`Variable "%s" is not defined by operation "%s".`, value, walker.CurrentOperation.Name),
- At(walker.CurrentOperation.Position),
- )
- } else {
- addError(
- Message(`Variable "%s" is not defined.`, value),
- At(value.Position),
- )
- }
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/no_unused_fragments.go b/vendor/github.com/vektah/gqlparser/validator/rules/no_unused_fragments.go
deleted file mode 100644
index 4aa835f5..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/no_unused_fragments.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("NoUnusedFragments", func(observers *Events, addError AddErrFunc) {
-
- inFragmentDefinition := false
- fragmentNameUsed := make(map[string]bool)
-
- observers.OnFragmentSpread(func(walker *Walker, fragmentSpread *ast.FragmentSpread) {
- if !inFragmentDefinition {
- fragmentNameUsed[fragmentSpread.Name] = true
- }
- })
-
- observers.OnFragment(func(walker *Walker, fragment *ast.FragmentDefinition) {
- inFragmentDefinition = true
- if !fragmentNameUsed[fragment.Name] {
- addError(
- Message(`Fragment "%s" is never used.`, fragment.Name),
- At(fragment.Position),
- )
- }
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/no_unused_variables.go b/vendor/github.com/vektah/gqlparser/validator/rules/no_unused_variables.go
deleted file mode 100644
index 28cf7736..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/no_unused_variables.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("NoUnusedVariables", func(observers *Events, addError AddErrFunc) {
- observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) {
- for _, varDef := range operation.VariableDefinitions {
- if varDef.Used {
- continue
- }
-
- if operation.Name != "" {
- addError(
- Message(`Variable "$%s" is never used in operation "%s".`, varDef.Variable, operation.Name),
- At(varDef.Position),
- )
- } else {
- addError(
- Message(`Variable "$%s" is never used.`, varDef.Variable),
- At(varDef.Position),
- )
- }
- }
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/overlapping_fields_can_be_merged.go b/vendor/github.com/vektah/gqlparser/validator/rules/overlapping_fields_can_be_merged.go
deleted file mode 100644
index bb2f1831..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/overlapping_fields_can_be_merged.go
+++ /dev/null
@@ -1,557 +0,0 @@
-package validator
-
-import (
- "bytes"
- "fmt"
- "reflect"
-
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
-
- AddRule("OverlappingFieldsCanBeMerged", func(observers *Events, addError AddErrFunc) {
- /**
- * Algorithm:
- *
- * Conflicts occur when two fields exist in a query which will produce the same
- * response name, but represent differing values, thus creating a conflict.
- * The algorithm below finds all conflicts via making a series of comparisons
- * between fields. In order to compare as few fields as possible, this makes
- * a series of comparisons "within" sets of fields and "between" sets of fields.
- *
- * Given any selection set, a collection produces both a set of fields by
- * also including all inline fragments, as well as a list of fragments
- * referenced by fragment spreads.
- *
- * A) Each selection set represented in the document first compares "within" its
- * collected set of fields, finding any conflicts between every pair of
- * overlapping fields.
- * Note: This is the *only time* that a the fields "within" a set are compared
- * to each other. After this only fields "between" sets are compared.
- *
- * B) Also, if any fragment is referenced in a selection set, then a
- * comparison is made "between" the original set of fields and the
- * referenced fragment.
- *
- * C) Also, if multiple fragments are referenced, then comparisons
- * are made "between" each referenced fragment.
- *
- * D) When comparing "between" a set of fields and a referenced fragment, first
- * a comparison is made between each field in the original set of fields and
- * each field in the the referenced set of fields.
- *
- * E) Also, if any fragment is referenced in the referenced selection set,
- * then a comparison is made "between" the original set of fields and the
- * referenced fragment (recursively referring to step D).
- *
- * F) When comparing "between" two fragments, first a comparison is made between
- * each field in the first referenced set of fields and each field in the the
- * second referenced set of fields.
- *
- * G) Also, any fragments referenced by the first must be compared to the
- * second, and any fragments referenced by the second must be compared to the
- * first (recursively referring to step F).
- *
- * H) When comparing two fields, if both have selection sets, then a comparison
- * is made "between" both selection sets, first comparing the set of fields in
- * the first selection set with the set of fields in the second.
- *
- * I) Also, if any fragment is referenced in either selection set, then a
- * comparison is made "between" the other set of fields and the
- * referenced fragment.
- *
- * J) Also, if two fragments are referenced in both selection sets, then a
- * comparison is made "between" the two fragments.
- *
- */
-
- m := &overlappingFieldsCanBeMergedManager{
- comparedFragmentPairs: pairSet{data: make(map[string]map[string]bool)},
- }
-
- observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) {
- m.walker = walker
- conflicts := m.findConflictsWithinSelectionSet(operation.SelectionSet)
- for _, conflict := range conflicts {
- conflict.addFieldsConflictMessage(addError)
- }
- })
- observers.OnField(func(walker *Walker, field *ast.Field) {
- if walker.CurrentOperation == nil {
- // When checking both Operation and Fragment, errors are duplicated when processing FragmentDefinition referenced from Operation
- return
- }
- m.walker = walker
- conflicts := m.findConflictsWithinSelectionSet(field.SelectionSet)
- for _, conflict := range conflicts {
- conflict.addFieldsConflictMessage(addError)
- }
- })
- observers.OnInlineFragment(func(walker *Walker, inlineFragment *ast.InlineFragment) {
- m.walker = walker
- conflicts := m.findConflictsWithinSelectionSet(inlineFragment.SelectionSet)
- for _, conflict := range conflicts {
- conflict.addFieldsConflictMessage(addError)
- }
- })
- observers.OnFragment(func(walker *Walker, fragment *ast.FragmentDefinition) {
- m.walker = walker
- conflicts := m.findConflictsWithinSelectionSet(fragment.SelectionSet)
- for _, conflict := range conflicts {
- conflict.addFieldsConflictMessage(addError)
- }
- })
- })
-}
-
-type pairSet struct {
- data map[string]map[string]bool
-}
-
-func (pairSet *pairSet) Add(a *ast.FragmentSpread, b *ast.FragmentSpread, areMutuallyExclusive bool) {
- add := func(a *ast.FragmentSpread, b *ast.FragmentSpread) {
- m := pairSet.data[a.Name]
- if m == nil {
- m = make(map[string]bool)
- pairSet.data[a.Name] = m
- }
- m[b.Name] = areMutuallyExclusive
- }
- add(a, b)
- add(b, a)
-}
-
-func (pairSet *pairSet) Has(a *ast.FragmentSpread, b *ast.FragmentSpread, areMutuallyExclusive bool) bool {
- am, ok := pairSet.data[a.Name]
- if !ok {
- return false
- }
- result, ok := am[b.Name]
- if !ok {
- return false
- }
-
- // areMutuallyExclusive being false is a superset of being true,
- // hence if we want to know if this PairSet "has" these two with no
- // exclusivity, we have to ensure it was added as such.
- if !areMutuallyExclusive {
- return !result
- }
-
- return true
-}
-
-type sequentialFieldsMap struct {
- // We can't use map[string][]*ast.Field. because map is not stable...
- seq []string
- data map[string][]*ast.Field
-}
-
-type fieldIterateEntry struct {
- ResponseName string
- Fields []*ast.Field
-}
-
-func (m *sequentialFieldsMap) Push(responseName string, field *ast.Field) {
- fields, ok := m.data[responseName]
- if !ok {
- m.seq = append(m.seq, responseName)
- }
- fields = append(fields, field)
- m.data[responseName] = fields
-}
-
-func (m *sequentialFieldsMap) Get(responseName string) ([]*ast.Field, bool) {
- fields, ok := m.data[responseName]
- return fields, ok
-}
-
-func (m *sequentialFieldsMap) Iterator() [][]*ast.Field {
- fieldsList := make([][]*ast.Field, 0, len(m.seq))
- for _, responseName := range m.seq {
- fields := m.data[responseName]
- fieldsList = append(fieldsList, fields)
- }
- return fieldsList
-}
-
-func (m *sequentialFieldsMap) KeyValueIterator() []*fieldIterateEntry {
- fieldEntriesList := make([]*fieldIterateEntry, 0, len(m.seq))
- for _, responseName := range m.seq {
- fields := m.data[responseName]
- fieldEntriesList = append(fieldEntriesList, &fieldIterateEntry{
- ResponseName: responseName,
- Fields: fields,
- })
- }
- return fieldEntriesList
-}
-
-type conflictMessageContainer struct {
- Conflicts []*ConflictMessage
-}
-
-type ConflictMessage struct {
- Message string
- ResponseName string
- Names []string
- SubMessage []*ConflictMessage
- Position *ast.Position
-}
-
-func (m *ConflictMessage) String(buf *bytes.Buffer) {
- if len(m.SubMessage) == 0 {
- buf.WriteString(m.Message)
- return
- }
-
- for idx, subMessage := range m.SubMessage {
- buf.WriteString(`subfields "`)
- buf.WriteString(subMessage.ResponseName)
- buf.WriteString(`" conflict because `)
- subMessage.String(buf)
- if idx != len(m.SubMessage)-1 {
- buf.WriteString(" and ")
- }
- }
-}
-
-func (m *ConflictMessage) addFieldsConflictMessage(addError AddErrFunc) {
- var buf bytes.Buffer
- m.String(&buf)
- addError(
- Message(`Fields "%s" conflict because %s. Use different aliases on the fields to fetch both if this was intentional.`, m.ResponseName, buf.String()),
- At(m.Position),
- )
-}
-
-type overlappingFieldsCanBeMergedManager struct {
- walker *Walker
-
- // per walker
- comparedFragmentPairs pairSet
- // cachedFieldsAndFragmentNames interface{}
-
- // per selectionSet
- comparedFragments map[string]bool
-}
-
-func (m *overlappingFieldsCanBeMergedManager) findConflictsWithinSelectionSet(selectionSet ast.SelectionSet) []*ConflictMessage {
- if len(selectionSet) == 0 {
- return nil
- }
-
- fieldsMap, fragmentSpreads := getFieldsAndFragmentNames(selectionSet)
-
- var conflicts conflictMessageContainer
-
- // (A) Find find all conflicts "within" the fieldMap of this selection set.
- // Note: this is the *only place* `collectConflictsWithin` is called.
- m.collectConflictsWithin(&conflicts, fieldsMap)
-
- m.comparedFragments = make(map[string]bool)
- for idx, fragmentSpreadA := range fragmentSpreads {
- // (B) Then collect conflicts between these fieldMap and those represented by
- // each spread fragment name found.
- m.collectConflictsBetweenFieldsAndFragment(&conflicts, false, fieldsMap, fragmentSpreadA)
-
- for _, fragmentSpreadB := range fragmentSpreads[idx+1:] {
- // (C) Then compare this fragment with all other fragments found in this
- // selection set to collect conflicts between fragments spread together.
- // This compares each item in the list of fragment names to every other
- // item in that same list (except for itself).
- m.collectConflictsBetweenFragments(&conflicts, false, fragmentSpreadA, fragmentSpreadB)
- }
- }
-
- return conflicts.Conflicts
-}
-
-func (m *overlappingFieldsCanBeMergedManager) collectConflictsBetweenFieldsAndFragment(conflicts *conflictMessageContainer, areMutuallyExclusive bool, fieldsMap *sequentialFieldsMap, fragmentSpread *ast.FragmentSpread) {
- if m.comparedFragments[fragmentSpread.Name] {
- return
- }
- m.comparedFragments[fragmentSpread.Name] = true
-
- if fragmentSpread.Definition == nil {
- return
- }
-
- fieldsMapB, fragmentSpreads := getFieldsAndFragmentNames(fragmentSpread.Definition.SelectionSet)
-
- // Do not compare a fragment's fieldMap to itself.
- if reflect.DeepEqual(fieldsMap, fieldsMapB) {
- return
- }
-
- // (D) First collect any conflicts between the provided collection of fields
- // and the collection of fields represented by the given fragment.
- m.collectConflictsBetween(conflicts, areMutuallyExclusive, fieldsMap, fieldsMapB)
-
- // (E) Then collect any conflicts between the provided collection of fields
- // and any fragment names found in the given fragment.
- baseFragmentSpread := fragmentSpread
- for _, fragmentSpread := range fragmentSpreads {
- if fragmentSpread.Name == baseFragmentSpread.Name {
- continue
- }
- m.collectConflictsBetweenFieldsAndFragment(conflicts, areMutuallyExclusive, fieldsMap, fragmentSpread)
- }
-}
-
-func (m *overlappingFieldsCanBeMergedManager) collectConflictsBetweenFragments(conflicts *conflictMessageContainer, areMutuallyExclusive bool, fragmentSpreadA *ast.FragmentSpread, fragmentSpreadB *ast.FragmentSpread) {
-
- var check func(fragmentSpreadA *ast.FragmentSpread, fragmentSpreadB *ast.FragmentSpread)
- check = func(fragmentSpreadA *ast.FragmentSpread, fragmentSpreadB *ast.FragmentSpread) {
-
- if fragmentSpreadA.Name == fragmentSpreadB.Name {
- return
- }
-
- if m.comparedFragmentPairs.Has(fragmentSpreadA, fragmentSpreadB, areMutuallyExclusive) {
- return
- }
- m.comparedFragmentPairs.Add(fragmentSpreadA, fragmentSpreadB, areMutuallyExclusive)
-
- if fragmentSpreadA.Definition == nil {
- return
- }
- if fragmentSpreadB.Definition == nil {
- return
- }
-
- fieldsMapA, fragmentSpreadsA := getFieldsAndFragmentNames(fragmentSpreadA.Definition.SelectionSet)
- fieldsMapB, fragmentSpreadsB := getFieldsAndFragmentNames(fragmentSpreadB.Definition.SelectionSet)
-
- // (F) First, collect all conflicts between these two collections of fields
- // (not including any nested fragments).
- m.collectConflictsBetween(conflicts, areMutuallyExclusive, fieldsMapA, fieldsMapB)
-
- // (G) Then collect conflicts between the first fragment and any nested
- // fragments spread in the second fragment.
- for _, fragmentSpread := range fragmentSpreadsB {
- check(fragmentSpreadA, fragmentSpread)
- }
- // (G) Then collect conflicts between the second fragment and any nested
- // fragments spread in the first fragment.
- for _, fragmentSpread := range fragmentSpreadsA {
- check(fragmentSpread, fragmentSpreadB)
- }
- }
-
- check(fragmentSpreadA, fragmentSpreadB)
-}
-
-func (m *overlappingFieldsCanBeMergedManager) findConflictsBetweenSubSelectionSets(areMutuallyExclusive bool, selectionSetA ast.SelectionSet, selectionSetB ast.SelectionSet) *conflictMessageContainer {
- var conflicts conflictMessageContainer
-
- fieldsMapA, fragmentSpreadsA := getFieldsAndFragmentNames(selectionSetA)
- fieldsMapB, fragmentSpreadsB := getFieldsAndFragmentNames(selectionSetB)
-
- // (H) First, collect all conflicts between these two collections of field.
- m.collectConflictsBetween(&conflicts, areMutuallyExclusive, fieldsMapA, fieldsMapB)
-
- // (I) Then collect conflicts between the first collection of fields and
- // those referenced by each fragment name associated with the second.
- for _, fragmentSpread := range fragmentSpreadsB {
- m.comparedFragments = make(map[string]bool)
- m.collectConflictsBetweenFieldsAndFragment(&conflicts, areMutuallyExclusive, fieldsMapA, fragmentSpread)
- }
-
- // (I) Then collect conflicts between the second collection of fields and
- // those referenced by each fragment name associated with the first.
- for _, fragmentSpread := range fragmentSpreadsA {
- m.comparedFragments = make(map[string]bool)
- m.collectConflictsBetweenFieldsAndFragment(&conflicts, areMutuallyExclusive, fieldsMapB, fragmentSpread)
- }
-
- // (J) Also collect conflicts between any fragment names by the first and
- // fragment names by the second. This compares each item in the first set of
- // names to each item in the second set of names.
- for _, fragmentSpreadA := range fragmentSpreadsA {
- for _, fragmentSpreadB := range fragmentSpreadsB {
- m.collectConflictsBetweenFragments(&conflicts, areMutuallyExclusive, fragmentSpreadA, fragmentSpreadB)
- }
- }
-
- if len(conflicts.Conflicts) == 0 {
- return nil
- }
-
- return &conflicts
-}
-
-func (m *overlappingFieldsCanBeMergedManager) collectConflictsWithin(conflicts *conflictMessageContainer, fieldsMap *sequentialFieldsMap) {
- for _, fields := range fieldsMap.Iterator() {
- for idx, fieldA := range fields {
- for _, fieldB := range fields[idx+1:] {
- conflict := m.findConflict(false, fieldA, fieldB)
- if conflict != nil {
- conflicts.Conflicts = append(conflicts.Conflicts, conflict)
- }
- }
- }
- }
-}
-
-func (m *overlappingFieldsCanBeMergedManager) collectConflictsBetween(conflicts *conflictMessageContainer, parentFieldsAreMutuallyExclusive bool, fieldsMapA *sequentialFieldsMap, fieldsMapB *sequentialFieldsMap) {
- for _, fieldsEntryA := range fieldsMapA.KeyValueIterator() {
- fieldsB, ok := fieldsMapB.Get(fieldsEntryA.ResponseName)
- if !ok {
- continue
- }
- for _, fieldA := range fieldsEntryA.Fields {
- for _, fieldB := range fieldsB {
- conflict := m.findConflict(parentFieldsAreMutuallyExclusive, fieldA, fieldB)
- if conflict != nil {
- conflicts.Conflicts = append(conflicts.Conflicts, conflict)
- }
- }
- }
- }
-}
-
-func (m *overlappingFieldsCanBeMergedManager) findConflict(parentFieldsAreMutuallyExclusive bool, fieldA *ast.Field, fieldB *ast.Field) *ConflictMessage {
- if fieldA.Definition == nil || fieldA.ObjectDefinition == nil || fieldB.Definition == nil || fieldB.ObjectDefinition == nil {
- return nil
- }
-
- areMutuallyExclusive := parentFieldsAreMutuallyExclusive
- if !areMutuallyExclusive {
- tmp := fieldA.ObjectDefinition.Name != fieldB.ObjectDefinition.Name
- tmp = tmp && fieldA.ObjectDefinition.Kind == ast.Object
- tmp = tmp && fieldB.ObjectDefinition.Kind == ast.Object
- areMutuallyExclusive = tmp
- }
-
- fieldNameA := fieldA.Name
- if fieldA.Alias != "" {
- fieldNameA = fieldA.Alias
- }
-
- if !areMutuallyExclusive {
- // Two aliases must refer to the same field.
- if fieldA.Name != fieldB.Name {
- return &ConflictMessage{
- ResponseName: fieldNameA,
- Message: fmt.Sprintf(`%s and %s are different fields`, fieldA.Name, fieldB.Name),
- Position: fieldB.Position,
- }
- }
-
- // Two field calls must have the same arguments.
- if !sameArguments(fieldA.Arguments, fieldB.Arguments) {
- return &ConflictMessage{
- ResponseName: fieldNameA,
- Message: "they have differing arguments",
- Position: fieldB.Position,
- }
- }
- }
-
- if doTypesConflict(m.walker, fieldA.Definition.Type, fieldB.Definition.Type) {
- return &ConflictMessage{
- ResponseName: fieldNameA,
- Message: fmt.Sprintf(`they return conflicting types %s and %s`, fieldA.Definition.Type.String(), fieldB.Definition.Type.String()),
- Position: fieldB.Position,
- }
- }
-
- // Collect and compare sub-fields. Use the same "visited fragment names" list
- // for both collections so fields in a fragment reference are never
- // compared to themselves.
- conflicts := m.findConflictsBetweenSubSelectionSets(areMutuallyExclusive, fieldA.SelectionSet, fieldB.SelectionSet)
- if conflicts == nil {
- return nil
- }
- return &ConflictMessage{
- ResponseName: fieldNameA,
- SubMessage: conflicts.Conflicts,
- Position: fieldB.Position,
- }
-}
-
-func sameArguments(args1 []*ast.Argument, args2 []*ast.Argument) bool {
- if len(args1) != len(args2) {
- return false
- }
- for _, arg1 := range args1 {
- for _, arg2 := range args2 {
- if arg1.Name != arg2.Name {
- return false
- }
- if !sameValue(arg1.Value, arg2.Value) {
- return false
- }
- }
- }
- return true
-}
-
-func sameValue(value1 *ast.Value, value2 *ast.Value) bool {
- if value1.Kind != value2.Kind {
- return false
- }
- if value1.Raw != value2.Raw {
- return false
- }
- return true
-}
-
-func doTypesConflict(walker *Walker, type1 *ast.Type, type2 *ast.Type) bool {
- if type1.Elem != nil {
- if type2.Elem != nil {
- return doTypesConflict(walker, type1.Elem, type2.Elem)
- }
- return true
- }
- if type2.Elem != nil {
- return true
- }
- if type1.NonNull && !type2.NonNull {
- return true
- }
- if !type1.NonNull && type2.NonNull {
- return true
- }
-
- t1 := walker.Schema.Types[type1.NamedType]
- t2 := walker.Schema.Types[type2.NamedType]
- if (t1.Kind == ast.Scalar || t1.Kind == ast.Enum) && (t2.Kind == ast.Scalar || t2.Kind == ast.Enum) {
- return t1.Name != t2.Name
- }
-
- return false
-}
-
-func getFieldsAndFragmentNames(selectionSet ast.SelectionSet) (*sequentialFieldsMap, []*ast.FragmentSpread) {
- fieldsMap := sequentialFieldsMap{
- data: make(map[string][]*ast.Field),
- }
- var fragmentSpreads []*ast.FragmentSpread
-
- var walk func(selectionSet ast.SelectionSet)
- walk = func(selectionSet ast.SelectionSet) {
- for _, selection := range selectionSet {
- switch selection := selection.(type) {
- case *ast.Field:
- responseName := selection.Name
- if selection.Alias != "" {
- responseName = selection.Alias
- }
- fieldsMap.Push(responseName, selection)
-
- case *ast.InlineFragment:
- walk(selection.SelectionSet)
-
- case *ast.FragmentSpread:
- fragmentSpreads = append(fragmentSpreads, selection)
- }
- }
- }
- walk(selectionSet)
-
- return &fieldsMap, fragmentSpreads
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/possible_fragment_spreads.go b/vendor/github.com/vektah/gqlparser/validator/rules/possible_fragment_spreads.go
deleted file mode 100644
index 04611834..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/possible_fragment_spreads.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("PossibleFragmentSpreads", func(observers *Events, addError AddErrFunc) {
-
- validate := func(walker *Walker, parentDef *ast.Definition, fragmentName string, emitError func()) {
- if parentDef == nil {
- return
- }
-
- var parentDefs []*ast.Definition
- switch parentDef.Kind {
- case ast.Object:
- parentDefs = []*ast.Definition{parentDef}
- case ast.Interface, ast.Union:
- parentDefs = walker.Schema.GetPossibleTypes(parentDef)
- default:
- return
- }
-
- fragmentDefType := walker.Schema.Types[fragmentName]
- if fragmentDefType == nil {
- return
- }
- if !fragmentDefType.IsCompositeType() {
- // checked by FragmentsOnCompositeTypes
- return
- }
- fragmentDefs := walker.Schema.GetPossibleTypes(fragmentDefType)
-
- for _, fragmentDef := range fragmentDefs {
- for _, parentDef := range parentDefs {
- if parentDef.Name == fragmentDef.Name {
- return
- }
- }
- }
-
- emitError()
- }
-
- observers.OnInlineFragment(func(walker *Walker, inlineFragment *ast.InlineFragment) {
- validate(walker, inlineFragment.ObjectDefinition, inlineFragment.TypeCondition, func() {
- addError(
- Message(`Fragment cannot be spread here as objects of type "%s" can never be of type "%s".`, inlineFragment.ObjectDefinition.Name, inlineFragment.TypeCondition),
- At(inlineFragment.Position),
- )
- })
- })
-
- observers.OnFragmentSpread(func(walker *Walker, fragmentSpread *ast.FragmentSpread) {
- if fragmentSpread.Definition == nil {
- return
- }
- validate(walker, fragmentSpread.ObjectDefinition, fragmentSpread.Definition.TypeCondition, func() {
- addError(
- Message(`Fragment "%s" cannot be spread here as objects of type "%s" can never be of type "%s".`, fragmentSpread.Name, fragmentSpread.ObjectDefinition.Name, fragmentSpread.Definition.TypeCondition),
- At(fragmentSpread.Position),
- )
- })
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/provided_required_arguments.go b/vendor/github.com/vektah/gqlparser/validator/rules/provided_required_arguments.go
deleted file mode 100644
index 55791a6b..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/provided_required_arguments.go
+++ /dev/null
@@ -1,63 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("ProvidedRequiredArguments", func(observers *Events, addError AddErrFunc) {
-
- observers.OnField(func(walker *Walker, field *ast.Field) {
- if field.Definition == nil {
- return
- }
-
- argDef:
- for _, argDef := range field.Definition.Arguments {
- if !argDef.Type.NonNull {
- continue
- }
- if argDef.DefaultValue != nil {
- continue
- }
- for _, arg := range field.Arguments {
- if arg.Name == argDef.Name {
- continue argDef
- }
- }
-
- addError(
- Message(`Field "%s" argument "%s" of type "%s" is required but not provided.`, field.Name, argDef.Name, argDef.Type.String()),
- At(field.Position),
- )
- }
- })
-
- observers.OnDirective(func(walker *Walker, directive *ast.Directive) {
- if directive.Definition == nil {
- return
- }
-
- argDef:
- for _, argDef := range directive.Definition.Arguments {
- if !argDef.Type.NonNull {
- continue
- }
- if argDef.DefaultValue != nil {
- continue
- }
- for _, arg := range directive.Arguments {
- if arg.Name == argDef.Name {
- continue argDef
- }
- }
-
- addError(
- Message(`Directive "@%s" argument "%s" of type "%s" is required but not provided.`, directive.Definition.Name, argDef.Name, argDef.Type.String()),
- At(directive.Position),
- )
- }
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/scalar_leafs.go b/vendor/github.com/vektah/gqlparser/validator/rules/scalar_leafs.go
deleted file mode 100644
index bb961f44..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/scalar_leafs.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("ScalarLeafs", func(observers *Events, addError AddErrFunc) {
- observers.OnField(func(walker *Walker, field *ast.Field) {
- if field.Definition == nil {
- return
- }
-
- fieldType := walker.Schema.Types[field.Definition.Type.Name()]
- if fieldType == nil {
- return
- }
-
- if fieldType.IsLeafType() && len(field.SelectionSet) > 0 {
- addError(
- Message(`Field "%s" must not have a selection since type "%s" has no subfields.`, field.Name, fieldType.Name),
- At(field.Position),
- )
- }
-
- if !fieldType.IsLeafType() && len(field.SelectionSet) == 0 {
- addError(
- Message(`Field "%s" of type "%s" must have a selection of subfields.`, field.Name, field.Definition.Type.String()),
- Suggestf(`"%s { ... }"`, field.Name),
- At(field.Position),
- )
- }
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/single_field_subscriptions.go b/vendor/github.com/vektah/gqlparser/validator/rules/single_field_subscriptions.go
deleted file mode 100644
index 53003c11..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/single_field_subscriptions.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package validator
-
-import (
- "strconv"
-
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("SingleFieldSubscriptions", func(observers *Events, addError AddErrFunc) {
- observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) {
- if operation.Operation != ast.Subscription {
- return
- }
-
- if len(operation.SelectionSet) > 1 {
- name := "Anonymous Subscription"
- if operation.Name != "" {
- name = `Subscription ` + strconv.Quote(operation.Name)
- }
-
- addError(
- Message(`%s must select only one top level field.`, name),
- At(operation.SelectionSet[1].GetPosition()),
- )
- }
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/unique_argument_names.go b/vendor/github.com/vektah/gqlparser/validator/rules/unique_argument_names.go
deleted file mode 100644
index 0ddcde72..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/unique_argument_names.go
+++ /dev/null
@@ -1,33 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("UniqueArgumentNames", func(observers *Events, addError AddErrFunc) {
- observers.OnField(func(walker *Walker, field *ast.Field) {
- checkUniqueArgs(field.Arguments, addError)
- })
-
- observers.OnDirective(func(walker *Walker, directive *ast.Directive) {
- checkUniqueArgs(directive.Arguments, addError)
- })
- })
-}
-
-func checkUniqueArgs(args ast.ArgumentList, addError AddErrFunc) {
- knownArgNames := map[string]bool{}
-
- for _, arg := range args {
- if knownArgNames[arg.Name] {
- addError(
- Message(`There can be only one argument named "%s".`, arg.Name),
- At(arg.Position),
- )
- }
-
- knownArgNames[arg.Name] = true
- }
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/unique_directives_per_location.go b/vendor/github.com/vektah/gqlparser/validator/rules/unique_directives_per_location.go
deleted file mode 100644
index 077c4687..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/unique_directives_per_location.go
+++ /dev/null
@@ -1,24 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("UniqueDirectivesPerLocation", func(observers *Events, addError AddErrFunc) {
- observers.OnDirectiveList(func(walker *Walker, directives []*ast.Directive) {
- seen := map[string]bool{}
-
- for _, dir := range directives {
- if seen[dir.Name] {
- addError(
- Message(`The directive "%s" can only be used once at this location.`, dir.Name),
- At(dir.Position),
- )
- }
- seen[dir.Name] = true
- }
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/unique_fragment_names.go b/vendor/github.com/vektah/gqlparser/validator/rules/unique_fragment_names.go
deleted file mode 100644
index 46a8b7c7..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/unique_fragment_names.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("UniqueFragmentNames", func(observers *Events, addError AddErrFunc) {
- seenFragments := map[string]bool{}
-
- observers.OnFragment(func(walker *Walker, fragment *ast.FragmentDefinition) {
- if seenFragments[fragment.Name] {
- addError(
- Message(`There can be only one fragment named "%s".`, fragment.Name),
- At(fragment.Position),
- )
- }
- seenFragments[fragment.Name] = true
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/unique_input_field_names.go b/vendor/github.com/vektah/gqlparser/validator/rules/unique_input_field_names.go
deleted file mode 100644
index f254d588..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/unique_input_field_names.go
+++ /dev/null
@@ -1,27 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("UniqueInputFieldNames", func(observers *Events, addError AddErrFunc) {
- observers.OnValue(func(walker *Walker, value *ast.Value) {
- if value.Kind != ast.ObjectValue {
- return
- }
-
- seen := map[string]bool{}
- for _, field := range value.Children {
- if seen[field.Name] {
- addError(
- Message(`There can be only one input field named "%s".`, field.Name),
- At(field.Position),
- )
- }
- seen[field.Name] = true
- }
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/unique_operation_names.go b/vendor/github.com/vektah/gqlparser/validator/rules/unique_operation_names.go
deleted file mode 100644
index c1ab56be..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/unique_operation_names.go
+++ /dev/null
@@ -1,22 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("UniqueOperationNames", func(observers *Events, addError AddErrFunc) {
- seen := map[string]bool{}
-
- observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) {
- if seen[operation.Name] {
- addError(
- Message(`There can be only one operation named "%s".`, operation.Name),
- At(operation.Position),
- )
- }
- seen[operation.Name] = true
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/unique_variable_names.go b/vendor/github.com/vektah/gqlparser/validator/rules/unique_variable_names.go
deleted file mode 100644
index 70590a88..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/unique_variable_names.go
+++ /dev/null
@@ -1,23 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("UniqueVariableNames", func(observers *Events, addError AddErrFunc) {
- observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) {
- seen := map[string]bool{}
- for _, def := range operation.VariableDefinitions {
- if seen[def.Variable] {
- addError(
- Message(`There can be only one variable named "%s".`, def.Variable),
- At(def.Position),
- )
- }
- seen[def.Variable] = true
- }
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/values_of_correct_type.go b/vendor/github.com/vektah/gqlparser/validator/rules/values_of_correct_type.go
deleted file mode 100644
index d64cc666..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/values_of_correct_type.go
+++ /dev/null
@@ -1,130 +0,0 @@
-package validator
-
-import (
- "fmt"
-
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("ValuesOfCorrectType", func(observers *Events, addError AddErrFunc) {
- observers.OnValue(func(walker *Walker, value *ast.Value) {
- if value.Definition == nil || value.ExpectedType == nil {
- return
- }
-
- if value.Definition.Kind == ast.Scalar {
- // Skip custom validating scalars
- if !value.Definition.OneOf("Int", "Float", "String", "Boolean", "ID") {
- return
- }
- }
-
- var possibleEnums []string
- if value.Definition.Kind == ast.Enum {
- for _, val := range value.Definition.EnumValues {
- possibleEnums = append(possibleEnums, val.Name)
- }
- }
-
- rawVal, err := value.Value(nil)
- if err != nil {
- unexpectedTypeMessage(addError, value)
- }
-
- switch value.Kind {
- case ast.NullValue:
- if value.ExpectedType.NonNull {
- unexpectedTypeMessage(addError, value)
- }
-
- case ast.ListValue:
- if value.ExpectedType.Elem == nil {
- unexpectedTypeMessage(addError, value)
- return
- }
-
- case ast.IntValue:
- if !value.Definition.OneOf("Int", "Float", "ID") {
- unexpectedTypeMessage(addError, value)
- }
-
- case ast.FloatValue:
- if !value.Definition.OneOf("Float") {
- unexpectedTypeMessage(addError, value)
- }
-
- case ast.StringValue, ast.BlockValue:
- if value.Definition.Kind == ast.Enum {
- rawValStr := fmt.Sprint(rawVal)
- addError(
- Message("Expected type %s, found %s.", value.ExpectedType.String(), value.String()),
- SuggestListUnquoted("Did you mean the enum value", rawValStr, possibleEnums),
- At(value.Position),
- )
- } else if !value.Definition.OneOf("String", "ID") {
- unexpectedTypeMessage(addError, value)
- }
-
- case ast.EnumValue:
- if value.Definition.Kind != ast.Enum || value.Definition.EnumValues.ForName(value.Raw) == nil {
- rawValStr := fmt.Sprint(rawVal)
- addError(
- Message("Expected type %s, found %s.", value.ExpectedType.String(), value.String()),
- SuggestListUnquoted("Did you mean the enum value", rawValStr, possibleEnums),
- At(value.Position),
- )
- }
-
- case ast.BooleanValue:
- if !value.Definition.OneOf("Boolean") {
- unexpectedTypeMessage(addError, value)
- }
-
- case ast.ObjectValue:
-
- for _, field := range value.Definition.Fields {
- if field.Type.NonNull {
- fieldValue := value.Children.ForName(field.Name)
- if fieldValue == nil && field.DefaultValue == nil {
- addError(
- Message("Field %s.%s of required type %s was not provided.", value.Definition.Name, field.Name, field.Type.String()),
- At(value.Position),
- )
- continue
- }
- }
- }
-
- for _, fieldValue := range value.Children {
- if value.Definition.Fields.ForName(fieldValue.Name) == nil {
- var suggestions []string
- for _, fieldValue := range value.Definition.Fields {
- suggestions = append(suggestions, fieldValue.Name)
- }
-
- addError(
- Message(`Field "%s" is not defined by type %s.`, fieldValue.Name, value.Definition.Name),
- SuggestListUnquoted("Did you mean", fieldValue.Name, suggestions),
- At(fieldValue.Position),
- )
- }
- }
-
- case ast.Variable:
- return
-
- default:
- panic(fmt.Errorf("unhandled %T", value))
- }
- })
- })
-}
-
-func unexpectedTypeMessage(addError AddErrFunc, v *ast.Value) {
- addError(
- Message("Expected type %s, found %s.", v.ExpectedType.String(), v.String()),
- At(v.Position),
- )
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/variables_are_input_types.go b/vendor/github.com/vektah/gqlparser/validator/rules/variables_are_input_types.go
deleted file mode 100644
index 9d58ae1c..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/variables_are_input_types.go
+++ /dev/null
@@ -1,28 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("VariablesAreInputTypes", func(observers *Events, addError AddErrFunc) {
- observers.OnOperation(func(walker *Walker, operation *ast.OperationDefinition) {
- for _, def := range operation.VariableDefinitions {
- if def.Definition == nil {
- continue
- }
- if !def.Definition.IsInputType() {
- addError(
- Message(
- `Variable "$%s" cannot be non-input type "%s".`,
- def.Variable,
- def.Type.String(),
- ),
- At(def.Position),
- )
- }
- }
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/rules/variables_in_allowed_position.go b/vendor/github.com/vektah/gqlparser/validator/rules/variables_in_allowed_position.go
deleted file mode 100644
index e6d97c9f..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/rules/variables_in_allowed_position.go
+++ /dev/null
@@ -1,36 +0,0 @@
-package validator
-
-import (
- "github.com/vektah/gqlparser/ast"
- . "github.com/vektah/gqlparser/validator"
-)
-
-func init() {
- AddRule("VariablesInAllowedPosition", func(observers *Events, addError AddErrFunc) {
- observers.OnValue(func(walker *Walker, value *ast.Value) {
- if value.Kind != ast.Variable || value.ExpectedType == nil || value.VariableDefinition == nil || walker.CurrentOperation == nil {
- return
- }
-
- // todo: move me into walk
- // If there is a default non nullable types can be null
- if value.VariableDefinition.DefaultValue != nil && value.VariableDefinition.DefaultValue.Kind != ast.NullValue {
- if value.ExpectedType.NonNull {
- value.ExpectedType.NonNull = false
- }
- }
-
- if !value.VariableDefinition.Type.IsCompatible(value.ExpectedType) {
- addError(
- Message(
- `Variable "%s" of type "%s" used in position expecting type "%s".`,
- value,
- value.VariableDefinition.Type.String(),
- value.ExpectedType.String(),
- ),
- At(value.Position),
- )
- }
- })
- })
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/schema.go b/vendor/github.com/vektah/gqlparser/validator/schema.go
deleted file mode 100644
index 57d2022e..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/schema.go
+++ /dev/null
@@ -1,276 +0,0 @@
-//go:generate go run ./inliner/inliner.go
-
-package validator
-
-import (
- "strconv"
- "strings"
-
- . "github.com/vektah/gqlparser/ast"
- "github.com/vektah/gqlparser/gqlerror"
- "github.com/vektah/gqlparser/parser"
-)
-
-func LoadSchema(inputs ...*Source) (*Schema, *gqlerror.Error) {
- ast, err := parser.ParseSchemas(inputs...)
- if err != nil {
- return nil, err
- }
- return ValidateSchemaDocument(ast)
-}
-
-func ValidateSchemaDocument(ast *SchemaDocument) (*Schema, *gqlerror.Error) {
- schema := Schema{
- Types: map[string]*Definition{},
- Directives: map[string]*DirectiveDefinition{},
- PossibleTypes: map[string][]*Definition{},
- Implements: map[string][]*Definition{},
- }
-
- for i, def := range ast.Definitions {
- if schema.Types[def.Name] != nil {
- return nil, gqlerror.ErrorPosf(def.Position, "Cannot redeclare type %s.", def.Name)
- }
- schema.Types[def.Name] = ast.Definitions[i]
- }
-
- for _, ext := range ast.Extensions {
- def := schema.Types[ext.Name]
- if def == nil {
- return nil, gqlerror.ErrorPosf(ext.Position, "Cannot extend type %s because it does not exist.", ext.Name)
- }
-
- if def.Kind != ext.Kind {
- return nil, gqlerror.ErrorPosf(ext.Position, "Cannot extend type %s because the base type is a %s, not %s.", ext.Name, def.Kind, ext.Kind)
- }
-
- def.Directives = append(def.Directives, ext.Directives...)
- def.Interfaces = append(def.Interfaces, ext.Interfaces...)
- def.Fields = append(def.Fields, ext.Fields...)
- def.Types = append(def.Types, ext.Types...)
- def.EnumValues = append(def.EnumValues, ext.EnumValues...)
- }
-
- for _, def := range ast.Definitions {
- switch def.Kind {
- case Union:
- for _, t := range def.Types {
- schema.AddPossibleType(def.Name, schema.Types[t])
- schema.AddImplements(t, def)
- }
- case InputObject, Object:
- for _, intf := range def.Interfaces {
- schema.AddPossibleType(intf, def)
- schema.AddImplements(def.Name, schema.Types[intf])
- }
- schema.AddPossibleType(def.Name, def)
- }
- }
-
- for i, dir := range ast.Directives {
- if schema.Directives[dir.Name] != nil {
- return nil, gqlerror.ErrorPosf(dir.Position, "Cannot redeclare directive %s.", dir.Name)
- }
- schema.Directives[dir.Name] = ast.Directives[i]
- }
-
- if len(ast.Schema) > 1 {
- return nil, gqlerror.ErrorPosf(ast.Schema[1].Position, "Cannot have multiple schema entry points, consider schema extensions instead.")
- }
-
- if len(ast.Schema) == 1 {
- for _, entrypoint := range ast.Schema[0].OperationTypes {
- def := schema.Types[entrypoint.Type]
- if def == nil {
- return nil, gqlerror.ErrorPosf(entrypoint.Position, "Schema root %s refers to a type %s that does not exist.", entrypoint.Operation, entrypoint.Type)
- }
- switch entrypoint.Operation {
- case Query:
- schema.Query = def
- case Mutation:
- schema.Mutation = def
- case Subscription:
- schema.Subscription = def
- }
- }
- }
-
- for _, ext := range ast.SchemaExtension {
- for _, entrypoint := range ext.OperationTypes {
- def := schema.Types[entrypoint.Type]
- if def == nil {
- return nil, gqlerror.ErrorPosf(entrypoint.Position, "Schema root %s refers to a type %s that does not exist.", entrypoint.Operation, entrypoint.Type)
- }
- switch entrypoint.Operation {
- case Query:
- schema.Query = def
- case Mutation:
- schema.Mutation = def
- case Subscription:
- schema.Subscription = def
- }
- }
- }
-
- for _, typ := range schema.Types {
- err := validateDefinition(&schema, typ)
- if err != nil {
- return nil, err
- }
- }
-
- for _, dir := range schema.Directives {
- err := validateDirective(&schema, dir)
- if err != nil {
- return nil, err
- }
- }
-
- if schema.Query == nil && schema.Types["Query"] != nil {
- schema.Query = schema.Types["Query"]
- }
-
- if schema.Mutation == nil && schema.Types["Mutation"] != nil {
- schema.Mutation = schema.Types["Mutation"]
- }
-
- if schema.Subscription == nil && schema.Types["Subscription"] != nil {
- schema.Subscription = schema.Types["Subscription"]
- }
-
- if schema.Query != nil {
- schema.Query.Fields = append(
- schema.Query.Fields,
- &FieldDefinition{
- Name: "__schema",
- Type: NonNullNamedType("__Schema", nil),
- },
- &FieldDefinition{
- Name: "__type",
- Type: NonNullNamedType("__Type", nil),
- Arguments: ArgumentDefinitionList{
- {Name: "name", Type: NamedType("String", nil)},
- },
- },
- )
- }
-
- return &schema, nil
-}
-
-func validateDirective(schema *Schema, def *DirectiveDefinition) *gqlerror.Error {
- if err := validateName(def.Position, def.Name); err != nil {
- // now, GraphQL spec doesn't have reserved directive name
- return err
- }
-
- return validateArgs(schema, def.Arguments, def)
-}
-
-func validateDefinition(schema *Schema, def *Definition) *gqlerror.Error {
- for _, field := range def.Fields {
- if err := validateName(field.Position, field.Name); err != nil {
- // now, GraphQL spec doesn't have reserved field name
- return err
- }
- if err := validateTypeRef(schema, field.Type); err != nil {
- return err
- }
- if err := validateArgs(schema, field.Arguments, nil); err != nil {
- return err
- }
- if err := validateDirectives(schema, field.Directives, nil); err != nil {
- return err
- }
- }
-
- for _, intf := range def.Interfaces {
- intDef := schema.Types[intf]
- if intDef == nil {
- return gqlerror.ErrorPosf(def.Position, "Undefined type %s.", strconv.Quote(intf))
- }
- if intDef.Kind != Interface {
- return gqlerror.ErrorPosf(def.Position, "%s is a non interface type %s.", strconv.Quote(intf), intDef.Kind)
- }
- }
-
- switch def.Kind {
- case Object, Interface:
- if len(def.Fields) == 0 {
- return gqlerror.ErrorPosf(def.Position, "%s must define one or more fields.", def.Kind)
- }
- case Enum:
- if len(def.EnumValues) == 0 {
- return gqlerror.ErrorPosf(def.Position, "%s must define one or more unique enum values.", def.Kind)
- }
- case InputObject:
- if len(def.Fields) == 0 {
- return gqlerror.ErrorPosf(def.Position, "%s must define one or more input fields.", def.Kind)
- }
- }
-
- for idx, field1 := range def.Fields {
- for _, field2 := range def.Fields[idx+1:] {
- if field1.Name == field2.Name {
- return gqlerror.ErrorPosf(field2.Position, "Field %s.%s can only be defined once.", def.Name, field2.Name)
- }
- }
- }
-
- if !def.BuiltIn {
- // GraphQL spec has reserved type names a lot!
- err := validateName(def.Position, def.Name)
- if err != nil {
- return err
- }
- }
-
- return validateDirectives(schema, def.Directives, nil)
-}
-
-func validateTypeRef(schema *Schema, typ *Type) *gqlerror.Error {
- if schema.Types[typ.Name()] == nil {
- return gqlerror.ErrorPosf(typ.Position, "Undefined type %s.", typ.Name())
- }
- return nil
-}
-
-func validateArgs(schema *Schema, args ArgumentDefinitionList, currentDirective *DirectiveDefinition) *gqlerror.Error {
- for _, arg := range args {
- if err := validateName(arg.Position, arg.Name); err != nil {
- // now, GraphQL spec doesn't have reserved argument name
- return err
- }
- if err := validateTypeRef(schema, arg.Type); err != nil {
- return err
- }
- if err := validateDirectives(schema, arg.Directives, currentDirective); err != nil {
- return err
- }
- }
- return nil
-}
-
-func validateDirectives(schema *Schema, dirs DirectiveList, currentDirective *DirectiveDefinition) *gqlerror.Error {
- for _, dir := range dirs {
- if err := validateName(dir.Position, dir.Name); err != nil {
- // now, GraphQL spec doesn't have reserved directive name
- return err
- }
- if currentDirective != nil && dir.Name == currentDirective.Name {
- return gqlerror.ErrorPosf(dir.Position, "Directive %s cannot refer to itself.", currentDirective.Name)
- }
- if schema.Directives[dir.Name] == nil {
- return gqlerror.ErrorPosf(dir.Position, "Undefined directive %s.", dir.Name)
- }
- dir.Definition = schema.Directives[dir.Name]
- }
- return nil
-}
-
-func validateName(pos *Position, name string) *gqlerror.Error {
- if strings.HasPrefix(name, "__") {
- return gqlerror.ErrorPosf(pos, `Name "%s" must not begin with "__", which is reserved by GraphQL introspection.`, name)
- }
- return nil
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/schema_test.yml b/vendor/github.com/vektah/gqlparser/validator/schema_test.yml
deleted file mode 100644
index abc8dd7e..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/schema_test.yml
+++ /dev/null
@@ -1,323 +0,0 @@
-types:
- - name: cannot be redeclared
- input: |
- type A {
- name: String
- }
- type A {
- name: String
- }
- error:
- message: "Cannot redeclare type A."
- locations: [{line: 4, column: 6}]
- - name: cannot be duplicated field at same definition 1
- input: |
- type A {
- name: String
- name: String
- }
- error:
- message: "Field A.name can only be defined once."
- locations: [{line: 3, column: 3}]
- - name: cannot be duplicated field at same definition 2
- input: |
- type A {
- name: String
- }
- extend type A {
- name: String
- }
- error:
- message: "Field A.name can only be defined once."
- locations: [{line: 5, column: 3}]
- - name: cannot be duplicated field at same definition 3
- input: |
- type A {
- name: String
- }
- extend type A {
- age: Int
- age: Int
- }
- error:
- message: "Field A.age can only be defined once."
- locations: [{line: 6, column: 3}]
-
-object types:
- - name: must define one or more fields
- input: |
- directive @D on OBJECT
-
- # This pattern rejected by parser
- # type InvalidObject1 {}
-
- type InvalidObject2 @D
-
- type ValidObject {
- id: ID
- }
- extend type ValidObject @D
- extend type ValidObject {
- b: Int
- }
- error:
- message: 'OBJECT must define one or more fields.'
- locations: [{line: 6, column: 6}]
- - name: check reserved names on type name
- input: |
- type __FooBar {
- id: ID
- }
- error:
- message: 'Name "__FooBar" must not begin with "__", which is reserved by GraphQL introspection.'
- locations: [{line: 1, column: 6}]
- - name: check reserved names on type field
- input: |
- type FooBar {
- __id: ID
- }
- error:
- message: 'Name "__id" must not begin with "__", which is reserved by GraphQL introspection.'
- locations: [{line: 2, column: 3}]
-
- - name: check reserved names on type field argument
- input: |
- type FooBar {
- foo(__bar: ID): ID
- }
- error:
- message: 'Name "__bar" must not begin with "__", which is reserved by GraphQL introspection.'
- locations: [{line: 2, column: 7}]
-
-interfaces:
- - name: must exist
- input: |
- type Thing implements Object {
- id: ID!
- }
-
- type Query {
- Things: [Thing!]!
- }
- error:
- message: 'Undefined type "Object".'
- locations: [{line: 1, column: 6}]
-
- - name: must be an interface
- input: |
- type Thing implements Object {
- id: ID!
- }
-
- type Query {
- Things: [Thing!]!
- }
-
- type Object {
- name: String
- }
- error:
- message: '"Object" is a non interface type OBJECT.'
- locations: [{line: 1, column: 6}]
-
- - name: must define one or more fields
- input: |
- directive @D on INTERFACE
-
- # This pattern rejected by parser
- # interface InvalidInterface1 {}
-
- interface InvalidInterface2 @D
-
- interface ValidInterface {
- id: ID
- }
- extend interface ValidInterface @D
- extend interface ValidInterface {
- b: Int
- }
- error:
- message: 'INTERFACE must define one or more fields.'
- locations: [{line: 6, column: 11}]
- - name: check reserved names on type name
- input: |
- interface __FooBar {
- id: ID
- }
- error:
- message: 'Name "__FooBar" must not begin with "__", which is reserved by GraphQL introspection.'
- locations: [{line: 1, column: 11}]
-
-inputs:
- - name: must define one or more input fields
- input: |
- directive @D on INPUT_OBJECT
-
- # This pattern rejected by parser
- # input InvalidInput1 {}
-
- input InvalidInput2 @D
-
- input ValidInput {
- id: ID
- }
- extend input ValidInput @D
- extend input ValidInput {
- b: Int
- }
- error:
- message: 'INPUT_OBJECT must define one or more input fields.'
- locations: [{line: 6, column: 7}]
- - name: check reserved names on type name
- input: |
- input __FooBar {
- id: ID
- }
- error:
- message: 'Name "__FooBar" must not begin with "__", which is reserved by GraphQL introspection.'
- locations: [{line: 1, column: 7}]
-
-enums:
- - name: must define one or more unique enum values
- input: |
- directive @D on ENUM
-
- # This pattern rejected by parser
- # enum InvalidEmum1 {}
-
- enum InvalidEnum2 @D
-
- enum ValidEnum {
- FOO
- }
- extend enum ValidEnum @D
- extend enum ValidEnum {
- BAR
- }
- error:
- message: 'ENUM must define one or more unique enum values.'
- locations: [{line: 6, column: 6}]
- - name: check reserved names on type name
- input: |
- enum __FooBar {
- A
- B
- }
- error:
- message: 'Name "__FooBar" must not begin with "__", which is reserved by GraphQL introspection.'
- locations: [{line: 1, column: 6}]
-
-type extensions:
- - name: cannot extend non existant types
- input: |
- extend type A {
- name: String
- }
- error:
- message: "Cannot extend type A because it does not exist."
- locations: [{line: 1, column: 13}]
-
- - name: cannot extend incorret type existant types
- input: |
- scalar A
- extend type A {
- name: String
- }
- error:
- message: "Cannot extend type A because the base type is a SCALAR, not OBJECT."
- locations: [{line: 2, column: 13}]
-
-directives:
- - name: cannot redeclare directives
- input: |
- directive @A on FIELD_DEFINITION
- directive @A on FIELD_DEFINITION
- error:
- message: "Cannot redeclare directive A."
- locations: [{line: 2, column: 12}]
-
- - name: must be declared
- input: |
- type User {
- name: String @foo
- }
- error:
- message: "Undefined directive foo."
- locations: [{line: 2, column: 17}]
-
- - name: cannot be self-referential
- input: |
- directive @A(foo: Int! @A) on FIELD_DEFINITION
- error:
- message: "Directive A cannot refer to itself."
- locations: [{line: 1, column: 25}]
- - name: check reserved names on type name
- input: |
- directive @__A on FIELD_DEFINITION
- error:
- message: 'Name "__A" must not begin with "__", which is reserved by GraphQL introspection.'
- locations: [{line: 1, column: 12}]
-
-entry points:
- - name: multiple schema entry points
- input: |
- schema {
- query: Query
- }
- schema {
- query: Query
- }
- scalar Query
- error:
- message: "Cannot have multiple schema entry points, consider schema extensions instead."
- locations: [{line: 4, column: 8}]
-
- - name: Undefined schema entrypoint
- input: |
- schema {
- query: Query
- }
- error:
- message: "Schema root query refers to a type Query that does not exist."
- locations: [{line: 2, column: 3}]
-
-entry point extensions:
- - name: Undefined schema entrypoint
- input: |
- schema {
- query: Query
- }
- scalar Query
- extend schema {
- mutation: Mutation
- }
- error:
- message: "Schema root mutation refers to a type Mutation that does not exist."
- locations: [{line: 6, column: 3}]
-
-type references:
- - name: Field types
- input: |
- type User {
- posts: Post
- }
- error:
- message: "Undefined type Post."
- locations: [{line: 2, column: 10}]
-
- - name: Arg types
- input: |
- type User {
- posts(foo: FooBar): String
- }
- error:
- message: "Undefined type FooBar."
- locations: [{line: 2, column: 14}]
-
- - name: Directive arg types
- input: |
- directive @Foo(foo: FooBar) on FIELD_DEFINITION
-
- error:
- message: "Undefined type FooBar."
- locations: [{line: 1, column: 21}]
diff --git a/vendor/github.com/vektah/gqlparser/validator/suggestionList.go b/vendor/github.com/vektah/gqlparser/validator/suggestionList.go
deleted file mode 100644
index f58d0fc2..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/suggestionList.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package validator
-
-import (
- "sort"
- "strings"
-
- "github.com/agnivade/levenshtein"
-)
-
-// Given an invalid input string and a list of valid options, returns a filtered
-// list of valid options sorted based on their similarity with the input.
-func SuggestionList(input string, options []string) []string {
- var results []string
- optionsByDistance := map[string]int{}
-
- for _, option := range options {
- distance := lexicalDistance(input, option)
- threshold := calcThreshold(input, option)
- if distance <= threshold {
- results = append(results, option)
- optionsByDistance[option] = distance
- }
- }
-
- sort.Slice(results, func(i, j int) bool {
- return optionsByDistance[results[i]] < optionsByDistance[results[j]]
- })
- return results
-}
-
-func calcThreshold(a, b string) (threshold int) {
- if len(a) >= len(b) {
- threshold = len(a) / 2
- } else {
- threshold = len(b) / 2
- }
- if threshold < 1 {
- threshold = 1
- }
- return
-}
-
-// Computes the lexical distance between strings A and B.
-//
-// The "distance" between two strings is given by counting the minimum number
-// of edits needed to transform string A into string B. An edit can be an
-// insertion, deletion, or substitution of a single character, or a swap of two
-// adjacent characters.
-//
-// Includes a custom alteration from Damerau-Levenshtein to treat case changes
-// as a single edit which helps identify mis-cased values with an edit distance
-// of 1.
-//
-// This distance can be useful for detecting typos in input or sorting
-func lexicalDistance(a, b string) int {
- if a == b {
- return 0
- }
-
- a = strings.ToLower(a)
- b = strings.ToLower(b)
-
- // Any case change counts as a single edit
- if a == b {
- return 1
- }
-
- return levenshtein.ComputeDistance(a, b)
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/validator.go b/vendor/github.com/vektah/gqlparser/validator/validator.go
deleted file mode 100644
index bbacec6f..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/validator.go
+++ /dev/null
@@ -1,44 +0,0 @@
-package validator
-
-import (
- . "github.com/vektah/gqlparser/ast"
- "github.com/vektah/gqlparser/gqlerror"
-)
-
-type AddErrFunc func(options ...ErrorOption)
-
-type ruleFunc func(observers *Events, addError AddErrFunc)
-
-type rule struct {
- name string
- rule ruleFunc
-}
-
-var rules []rule
-
-// addRule to rule set.
-// f is called once each time `Validate` is executed.
-func AddRule(name string, f ruleFunc) {
- rules = append(rules, rule{name: name, rule: f})
-}
-
-func Validate(schema *Schema, doc *QueryDocument) gqlerror.List {
- var errs gqlerror.List
-
- observers := &Events{}
- for i := range rules {
- rule := rules[i]
- rule.rule(observers, func(options ...ErrorOption) {
- err := &gqlerror.Error{
- Rule: rule.name,
- }
- for _, o := range options {
- o(err)
- }
- errs = append(errs, err)
- })
- }
-
- Walk(schema, doc, observers)
- return errs
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/vars.go b/vendor/github.com/vektah/gqlparser/validator/vars.go
deleted file mode 100644
index aaf3a0d1..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/vars.go
+++ /dev/null
@@ -1,199 +0,0 @@
-package validator
-
-import (
- "reflect"
-
- "fmt"
-
- "github.com/vektah/gqlparser/ast"
- "github.com/vektah/gqlparser/gqlerror"
-)
-
-var UnexpectedType = fmt.Errorf("Unexpected Type")
-
-// VariableValues coerces and validates variable values
-func VariableValues(schema *ast.Schema, op *ast.OperationDefinition, variables map[string]interface{}) (map[string]interface{}, *gqlerror.Error) {
- coercedVars := map[string]interface{}{}
-
- validator := varValidator{
- path: []interface{}{"variable"},
- schema: schema,
- }
-
- for _, v := range op.VariableDefinitions {
- validator.path = append(validator.path, v.Variable)
-
- if !v.Definition.IsInputType() {
- return nil, gqlerror.ErrorPathf(validator.path, "must an input type")
- }
-
- val, hasValue := variables[v.Variable]
- if !hasValue {
- if v.DefaultValue != nil {
- var err error
- val, err = v.DefaultValue.Value(nil)
- if err != nil {
- return nil, gqlerror.WrapPath(validator.path, err)
- }
- hasValue = true
- } else if v.Type.NonNull {
- return nil, gqlerror.ErrorPathf(validator.path, "must be defined")
- }
- }
-
- if hasValue {
- if val == nil {
- if v.Type.NonNull {
- return nil, gqlerror.ErrorPathf(validator.path, "cannot be null")
- }
- coercedVars[v.Variable] = nil
- } else {
- rv := reflect.ValueOf(val)
- if rv.Kind() == reflect.Ptr || rv.Kind() == reflect.Interface {
- rv = rv.Elem()
- }
-
- if err := validator.validateVarType(v.Type, rv); err != nil {
- return nil, err
- }
-
- coercedVars[v.Variable] = val
- }
- }
-
- validator.path = validator.path[0 : len(validator.path)-1]
- }
-
- return coercedVars, nil
-}
-
-type varValidator struct {
- path []interface{}
- schema *ast.Schema
-}
-
-func (v *varValidator) validateVarType(typ *ast.Type, val reflect.Value) *gqlerror.Error {
- currentPath := v.path
- resetPath := func() {
- v.path = currentPath
- }
- defer resetPath()
-
- if typ.Elem != nil {
- if val.Kind() != reflect.Slice {
- return gqlerror.ErrorPathf(v.path, "must be an array")
- }
-
- for i := 0; i < val.Len(); i++ {
- resetPath()
- v.path = append(v.path, i)
- field := val.Index(i)
-
- if field.Kind() == reflect.Ptr || field.Kind() == reflect.Interface {
- if typ.Elem.NonNull && field.IsNil() {
- return gqlerror.ErrorPathf(v.path, "cannot be null")
- }
- field = field.Elem()
- }
-
- if err := v.validateVarType(typ.Elem, field); err != nil {
- return err
- }
- }
-
- return nil
- }
-
- def := v.schema.Types[typ.NamedType]
- if def == nil {
- panic(fmt.Errorf("missing def for %s", typ.NamedType))
- }
-
- switch def.Kind {
- case ast.Enum:
- kind := val.Type().Kind()
- if kind == reflect.Int || kind == reflect.Int32 || kind == reflect.Int64 || kind == reflect.String {
- return nil
- }
- return gqlerror.ErrorPathf(v.path, "enums must be ints or strings")
- case ast.Scalar:
- kind := val.Type().Kind()
- switch typ.NamedType {
- case "Int":
- if kind == reflect.String || kind == reflect.Int || kind == reflect.Int32 || kind == reflect.Int64 {
- return nil
- }
- case "Float":
- if kind == reflect.String || kind == reflect.Float32 || kind == reflect.Float64 || kind == reflect.Int || kind == reflect.Int32 || kind == reflect.Int64 {
- return nil
- }
- case "String":
- if kind == reflect.String {
- return nil
- }
-
- case "Boolean":
- if kind == reflect.Bool {
- return nil
- }
-
- case "ID":
- if kind == reflect.Int || kind == reflect.Int32 || kind == reflect.Int64 || kind == reflect.String {
- return nil
- }
- default:
- // assume custom scalars are ok
- return nil
- }
- return gqlerror.ErrorPathf(v.path, "cannot use %s as %s", kind.String(), typ.NamedType)
- case ast.InputObject:
- if val.Kind() != reflect.Map {
- return gqlerror.ErrorPathf(v.path, "must be a %s", def.Name)
- }
-
- // check for unknown fields
- for _, name := range val.MapKeys() {
- val.MapIndex(name)
- fieldDef := def.Fields.ForName(name.String())
- resetPath()
- v.path = append(v.path, name.String())
-
- if fieldDef == nil {
- return gqlerror.ErrorPathf(v.path, "unknown field")
- }
- }
-
- for _, fieldDef := range def.Fields {
- resetPath()
- v.path = append(v.path, fieldDef.Name)
-
- field := val.MapIndex(reflect.ValueOf(fieldDef.Name))
- if !field.IsValid() {
- if fieldDef.Type.NonNull {
- return gqlerror.ErrorPathf(v.path, "must be defined")
- }
- continue
- }
-
- if field.Kind() == reflect.Ptr || field.Kind() == reflect.Interface {
- if fieldDef.Type.NonNull && field.IsNil() {
- return gqlerror.ErrorPathf(v.path, "cannot be null")
- }
- //allow null object field and skip it
- if !fieldDef.Type.NonNull && field.IsNil() {
- continue
- }
- field = field.Elem()
- }
-
- err := v.validateVarType(fieldDef.Type, field)
- if err != nil {
- return err
- }
- }
- default:
- panic(fmt.Errorf("unsupported type %s", def.Kind))
- }
-
- return nil
-}
diff --git a/vendor/github.com/vektah/gqlparser/validator/walk.go b/vendor/github.com/vektah/gqlparser/validator/walk.go
deleted file mode 100644
index 751ba1f1..00000000
--- a/vendor/github.com/vektah/gqlparser/validator/walk.go
+++ /dev/null
@@ -1,286 +0,0 @@
-package validator
-
-import (
- "context"
- "fmt"
-
- "github.com/vektah/gqlparser/ast"
-)
-
-type Events struct {
- operationVisitor []func(walker *Walker, operation *ast.OperationDefinition)
- field []func(walker *Walker, field *ast.Field)
- fragment []func(walker *Walker, fragment *ast.FragmentDefinition)
- inlineFragment []func(walker *Walker, inlineFragment *ast.InlineFragment)
- fragmentSpread []func(walker *Walker, fragmentSpread *ast.FragmentSpread)
- directive []func(walker *Walker, directive *ast.Directive)
- directiveList []func(walker *Walker, directives []*ast.Directive)
- value []func(walker *Walker, value *ast.Value)
-}
-
-func (o *Events) OnOperation(f func(walker *Walker, operation *ast.OperationDefinition)) {
- o.operationVisitor = append(o.operationVisitor, f)
-}
-func (o *Events) OnField(f func(walker *Walker, field *ast.Field)) {
- o.field = append(o.field, f)
-}
-func (o *Events) OnFragment(f func(walker *Walker, fragment *ast.FragmentDefinition)) {
- o.fragment = append(o.fragment, f)
-}
-func (o *Events) OnInlineFragment(f func(walker *Walker, inlineFragment *ast.InlineFragment)) {
- o.inlineFragment = append(o.inlineFragment, f)
-}
-func (o *Events) OnFragmentSpread(f func(walker *Walker, fragmentSpread *ast.FragmentSpread)) {
- o.fragmentSpread = append(o.fragmentSpread, f)
-}
-func (o *Events) OnDirective(f func(walker *Walker, directive *ast.Directive)) {
- o.directive = append(o.directive, f)
-}
-func (o *Events) OnDirectiveList(f func(walker *Walker, directives []*ast.Directive)) {
- o.directiveList = append(o.directiveList, f)
-}
-func (o *Events) OnValue(f func(walker *Walker, value *ast.Value)) {
- o.value = append(o.value, f)
-}
-
-func Walk(schema *ast.Schema, document *ast.QueryDocument, observers *Events) {
- w := Walker{
- Observers: observers,
- Schema: schema,
- Document: document,
- }
-
- w.walk()
-}
-
-type Walker struct {
- Context context.Context
- Observers *Events
- Schema *ast.Schema
- Document *ast.QueryDocument
-
- validatedFragmentSpreads map[string]bool
- CurrentOperation *ast.OperationDefinition
-}
-
-func (w *Walker) walk() {
- for _, child := range w.Document.Operations {
- w.validatedFragmentSpreads = make(map[string]bool)
- w.walkOperation(child)
- }
- for _, child := range w.Document.Fragments {
- w.validatedFragmentSpreads = make(map[string]bool)
- w.walkFragment(child)
- }
-}
-
-func (w *Walker) walkOperation(operation *ast.OperationDefinition) {
- w.CurrentOperation = operation
- for _, varDef := range operation.VariableDefinitions {
- varDef.Definition = w.Schema.Types[varDef.Type.Name()]
-
- if varDef.DefaultValue != nil {
- varDef.DefaultValue.ExpectedType = varDef.Type
- varDef.DefaultValue.Definition = w.Schema.Types[varDef.Type.Name()]
- }
- }
-
- var def *ast.Definition
- var loc ast.DirectiveLocation
- switch operation.Operation {
- case ast.Query, "":
- def = w.Schema.Query
- loc = ast.LocationQuery
- case ast.Mutation:
- def = w.Schema.Mutation
- loc = ast.LocationMutation
- case ast.Subscription:
- def = w.Schema.Subscription
- loc = ast.LocationSubscription
- }
-
- w.walkDirectives(def, operation.Directives, loc)
-
- for _, varDef := range operation.VariableDefinitions {
- if varDef.DefaultValue != nil {
- w.walkValue(varDef.DefaultValue)
- }
- }
-
- w.walkSelectionSet(def, operation.SelectionSet)
-
- for _, v := range w.Observers.operationVisitor {
- v(w, operation)
- }
- w.CurrentOperation = nil
-}
-
-func (w *Walker) walkFragment(it *ast.FragmentDefinition) {
- def := w.Schema.Types[it.TypeCondition]
-
- it.Definition = def
-
- w.walkDirectives(def, it.Directives, ast.LocationFragmentDefinition)
- w.walkSelectionSet(def, it.SelectionSet)
-
- for _, v := range w.Observers.fragment {
- v(w, it)
- }
-}
-
-func (w *Walker) walkDirectives(parentDef *ast.Definition, directives []*ast.Directive, location ast.DirectiveLocation) {
- for _, dir := range directives {
- def := w.Schema.Directives[dir.Name]
- dir.Definition = def
- dir.ParentDefinition = parentDef
- dir.Location = location
-
- for _, arg := range dir.Arguments {
- var argDef *ast.ArgumentDefinition
- if def != nil {
- argDef = def.Arguments.ForName(arg.Name)
- }
-
- w.walkArgument(argDef, arg)
- }
-
- for _, v := range w.Observers.directive {
- v(w, dir)
- }
- }
-
- for _, v := range w.Observers.directiveList {
- v(w, directives)
- }
-}
-
-func (w *Walker) walkValue(value *ast.Value) {
- if value.Kind == ast.Variable && w.CurrentOperation != nil {
- value.VariableDefinition = w.CurrentOperation.VariableDefinitions.ForName(value.Raw)
- if value.VariableDefinition != nil {
- value.VariableDefinition.Used = true
- }
- }
-
- if value.Kind == ast.ObjectValue {
- for _, child := range value.Children {
- if value.Definition != nil {
- fieldDef := value.Definition.Fields.ForName(child.Name)
- if fieldDef != nil {
- child.Value.ExpectedType = fieldDef.Type
- child.Value.Definition = w.Schema.Types[fieldDef.Type.Name()]
- }
- }
- w.walkValue(child.Value)
- }
- }
-
- if value.Kind == ast.ListValue {
- for _, child := range value.Children {
- if value.ExpectedType != nil && value.ExpectedType.Elem != nil {
- child.Value.ExpectedType = value.ExpectedType.Elem
- child.Value.Definition = value.Definition
- }
-
- w.walkValue(child.Value)
- }
- }
-
- for _, v := range w.Observers.value {
- v(w, value)
- }
-}
-
-func (w *Walker) walkArgument(argDef *ast.ArgumentDefinition, arg *ast.Argument) {
- if argDef != nil {
- arg.Value.ExpectedType = argDef.Type
- arg.Value.Definition = w.Schema.Types[argDef.Type.Name()]
- }
-
- w.walkValue(arg.Value)
-}
-
-func (w *Walker) walkSelectionSet(parentDef *ast.Definition, it ast.SelectionSet) {
- for _, child := range it {
- w.walkSelection(parentDef, child)
- }
-}
-
-func (w *Walker) walkSelection(parentDef *ast.Definition, it ast.Selection) {
- switch it := it.(type) {
- case *ast.Field:
- var def *ast.FieldDefinition
- if it.Name == "__typename" {
- def = &ast.FieldDefinition{
- Name: "__typename",
- Type: ast.NamedType("String", nil),
- }
- } else if parentDef != nil {
- def = parentDef.Fields.ForName(it.Name)
- }
-
- it.Definition = def
- it.ObjectDefinition = parentDef
-
- var nextParentDef *ast.Definition
- if def != nil {
- nextParentDef = w.Schema.Types[def.Type.Name()]
- }
-
- for _, arg := range it.Arguments {
- var argDef *ast.ArgumentDefinition
- if def != nil {
- argDef = def.Arguments.ForName(arg.Name)
- }
-
- w.walkArgument(argDef, arg)
- }
-
- w.walkDirectives(nextParentDef, it.Directives, ast.LocationField)
- w.walkSelectionSet(nextParentDef, it.SelectionSet)
-
- for _, v := range w.Observers.field {
- v(w, it)
- }
-
- case *ast.InlineFragment:
- it.ObjectDefinition = parentDef
-
- nextParentDef := parentDef
- if it.TypeCondition != "" {
- nextParentDef = w.Schema.Types[it.TypeCondition]
- }
-
- w.walkDirectives(nextParentDef, it.Directives, ast.LocationInlineFragment)
- w.walkSelectionSet(nextParentDef, it.SelectionSet)
-
- for _, v := range w.Observers.inlineFragment {
- v(w, it)
- }
-
- case *ast.FragmentSpread:
- def := w.Document.Fragments.ForName(it.Name)
- it.Definition = def
- it.ObjectDefinition = parentDef
-
- var nextParentDef *ast.Definition
- if def != nil {
- nextParentDef = w.Schema.Types[def.TypeCondition]
- }
-
- w.walkDirectives(nextParentDef, it.Directives, ast.LocationFragmentSpread)
-
- if def != nil && !w.validatedFragmentSpreads[def.Name] {
- // prevent inifinite recursion
- w.validatedFragmentSpreads[def.Name] = true
- w.walkSelectionSet(nextParentDef, def.SelectionSet)
- }
-
- for _, v := range w.Observers.fragmentSpread {
- v(w, it)
- }
-
- default:
- panic(fmt.Errorf("unsupported %T", it))
- }
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/.gitignore b/vendor/github.com/xanzy/go-gitlab/.gitignore
deleted file mode 100644
index 19b0dcfb..00000000
--- a/vendor/github.com/xanzy/go-gitlab/.gitignore
+++ /dev/null
@@ -1,28 +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
-
-# IDE specific files and folders
-.idea
-*.iml
diff --git a/vendor/github.com/xanzy/go-gitlab/.travis.yml b/vendor/github.com/xanzy/go-gitlab/.travis.yml
deleted file mode 100644
index ee77c02b..00000000
--- a/vendor/github.com/xanzy/go-gitlab/.travis.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-language: go
-
-go:
- - 1.10.x
- - 1.11.x
- - 1.12.x
- - 1.13.x
- - master
-
-stages:
- - lint
- - test
-
-jobs:
- include:
- - stage: lint
- script:
- - go get golang.org/x/lint/golint
- - golint -set_exit_status
- - go vet -v
- - stage: test
- script:
- - go test -v
-
-matrix:
- allow_failures:
- - go: master
- fast_finish: true
diff --git a/vendor/github.com/xanzy/go-gitlab/CHANGELOG.md b/vendor/github.com/xanzy/go-gitlab/CHANGELOG.md
deleted file mode 100644
index 29e93fff..00000000
--- a/vendor/github.com/xanzy/go-gitlab/CHANGELOG.md
+++ /dev/null
@@ -1,27 +0,0 @@
-go-github CHANGELOG
-===================
-
-0.6.0
------
-- Add support for the V4 Gitlab API. This means the older V3 API is no longer fully supported
- with this version. If you still need that version, please use the `f-api-v3` branch.
-
-0.4.0
------
-- Add support to use [`sudo`](https://docs.gitlab.com/ce/api/README.html#sudo) for all API calls.
-- Add support for the Notification Settings API.
-- Add support for the Time Tracking API.
-- Make sure that the error response correctly outputs any returned errors.
-- And a reasonable number of smaller enhanchements and bugfixes.
-
-0.3.0
------
-- Moved the tags related API calls to their own service, following the Gitlab API structure.
-
-0.2.0
------
-- Convert all Option structs to use pointers for their fields.
-
-0.1.0
------
-- Initial release.
diff --git a/vendor/github.com/xanzy/go-gitlab/LICENSE b/vendor/github.com/xanzy/go-gitlab/LICENSE
deleted file mode 100644
index e06d2081..00000000
--- a/vendor/github.com/xanzy/go-gitlab/LICENSE
+++ /dev/null
@@ -1,202 +0,0 @@
-Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "{}"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright {yyyy} {name of copyright owner}
-
- 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/xanzy/go-gitlab/README.md b/vendor/github.com/xanzy/go-gitlab/README.md
deleted file mode 100644
index 48fb4882..00000000
--- a/vendor/github.com/xanzy/go-gitlab/README.md
+++ /dev/null
@@ -1,173 +0,0 @@
-# go-gitlab
-
-A GitLab API client enabling Go programs to interact with GitLab in a simple and uniform way
-
-[![Build Status](https://travis-ci.org/xanzy/go-gitlab.svg?branch=master)](https://travis-ci.org/xanzy/go-gitlab)
-[![GitHub license](https://img.shields.io/github/license/xanzy/go-gitlab.svg)](https://github.com/xanzy/go-gitlab/blob/master/LICENSE)
-[![Sourcegraph](https://sourcegraph.com/github.com/xanzy/go-gitlab/-/badge.svg)](https://sourcegraph.com/github.com/xanzy/go-gitlab?badge)
-[![GoDoc](https://godoc.org/github.com/xanzy/go-gitlab?status.svg)](https://godoc.org/github.com/xanzy/go-gitlab)
-[![Go Report Card](https://goreportcard.com/badge/github.com/xanzy/go-gitlab)](https://goreportcard.com/report/github.com/xanzy/go-gitlab)
-[![GitHub issues](https://img.shields.io/github/issues/xanzy/go-gitlab.svg)](https://github.com/xanzy/go-gitlab/issues)
-
-## NOTE
-
-Release v0.6.0 (released on 25-08-2017) no longer supports the older V3 Gitlab API. If
-you need V3 support, please use the `f-api-v3` branch. This release contains some backwards
-incompatible changes that were needed to fully support the V4 Gitlab API.
-
-## Coverage
-
-This API client package covers most of the existing Gitlab API calls and is updated regularly
-to add new and/or missing endpoints. Currently the following services are supported:
-
-- [x] Award Emojis
-- [x] Branches
-- [x] Broadcast Messages
-- [x] Commits
-- [x] Container Registry
-- [x] Custom Attributes
-- [x] Deploy Keys
-- [x] Deployments
-- [ ] Discussions (threaded comments)
-- [x] Environments
-- [ ] Epic Issues
-- [ ] Epics
-- [x] Events
-- [x] Feature Flags
-- [ ] Geo Nodes
-- [x] GitLab CI Config Templates
-- [x] Gitignores Templates
-- [x] Group Access Requests
-- [x] Group Issue Boards
-- [x] Group Members
-- [x] Group Milestones
-- [x] Group-Level Variables
-- [x] Groups
-- [x] Issue Boards
-- [x] Issues
-- [x] Jobs
-- [x] Keys
-- [x] Labels
-- [x] License
-- [x] Merge Request Approvals
-- [x] Merge Requests
-- [x] Namespaces
-- [x] Notes (comments)
-- [x] Notification Settings
-- [x] Open Source License Templates
-- [x] Pages Domains
-- [x] Pipeline Schedules
-- [x] Pipeline Triggers
-- [x] Pipelines
-- [x] Project Access Requests
-- [x] Project Badges
-- [x] Project Clusters
-- [x] Project Import/export
-- [x] Project Members
-- [x] Project Milestones
-- [x] Project Snippets
-- [x] Project-Level Variables
-- [x] Projects (including setting Webhooks)
-- [x] Protected Branches
-- [x] Protected Tags
-- [x] Repositories
-- [x] Repository Files
-- [x] Runners
-- [x] Search
-- [x] Services
-- [x] Settings
-- [x] Sidekiq Metrics
-- [x] System Hooks
-- [x] Tags
-- [x] Todos
-- [x] Users
-- [x] Validate CI Configuration
-- [x] Version
-- [x] Wikis
-
-## Usage
-
-```go
-import "github.com/xanzy/go-gitlab"
-```
-
-Construct a new GitLab client, then use the various services on the client to
-access different parts of the GitLab API. For example, to list all
-users:
-
-```go
-git := gitlab.NewClient(nil, "yourtokengoeshere")
-//git.SetBaseURL("https://git.mydomain.com/api/v4")
-users, _, err := git.Users.ListUsers(&gitlab.ListUsersOptions{})
-```
-
-Some API methods have optional parameters that can be passed. For example,
-to list all projects for user "svanharmelen":
-
-```go
-git := gitlab.NewClient(nil)
-opt := &ListProjectsOptions{Search: gitlab.String("svanharmelen")}
-projects, _, err := git.Projects.ListProjects(opt)
-```
-
-### Examples
-
-The [examples](https://github.com/xanzy/go-gitlab/tree/master/examples) directory
-contains a couple for clear examples, of which one is partially listed here as well:
-
-```go
-package main
-
-import (
- "log"
-
- "github.com/xanzy/go-gitlab"
-)
-
-func main() {
- git := gitlab.NewClient(nil, "yourtokengoeshere")
-
- // Create new project
- p := &gitlab.CreateProjectOptions{
- Name: gitlab.String("My Project"),
- Description: gitlab.String("Just a test project to play with"),
- MergeRequestsEnabled: gitlab.Bool(true),
- SnippetsEnabled: gitlab.Bool(true),
- Visibility: gitlab.Visibility(gitlab.PublicVisibility),
- }
- project, _, err := git.Projects.CreateProject(p)
- if err != nil {
- log.Fatal(err)
- }
-
- // Add a new snippet
- s := &gitlab.CreateProjectSnippetOptions{
- Title: gitlab.String("Dummy Snippet"),
- FileName: gitlab.String("snippet.go"),
- Code: gitlab.String("package main...."),
- Visibility: gitlab.Visibility(gitlab.PublicVisibility),
- }
- _, _, err = git.ProjectSnippets.CreateSnippet(project.ID, s)
- if err != nil {
- log.Fatal(err)
- }
-}
-```
-
-For complete usage of go-gitlab, see the full [package docs](https://godoc.org/github.com/xanzy/go-gitlab).
-
-## ToDo
-
-- The biggest thing this package still needs is tests :disappointed:
-
-## Issues
-
-- If you have an issue: report it on the [issue tracker](https://github.com/xanzy/go-gitlab/issues)
-
-## Author
-
-Sander van Harmelen (<sander@xanzy.io>)
-
-## License
-
-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>
diff --git a/vendor/github.com/xanzy/go-gitlab/access_requests.go b/vendor/github.com/xanzy/go-gitlab/access_requests.go
deleted file mode 100644
index 3fa406bc..00000000
--- a/vendor/github.com/xanzy/go-gitlab/access_requests.go
+++ /dev/null
@@ -1,236 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// AccessRequest represents a access request for a group or project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html
-type AccessRequest struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- RequestedAt *time.Time `json:"requested_at"`
- AccessLevel AccessLevelValue `json:"access_level"`
-}
-
-// AccessRequestsService handles communication with the project/group
-// access requests related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/access_requests.html
-type AccessRequestsService struct {
- client *Client
-}
-
-// ListAccessRequestsOptions represents the available
-// ListProjectAccessRequests() or ListGroupAccessRequests() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#list-access-requests-for-a-group-or-project
-type ListAccessRequestsOptions ListOptions
-
-// ListProjectAccessRequests gets a list of access requests
-// viewable by the authenticated user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#list-access-requests-for-a-group-or-project
-func (s *AccessRequestsService) ListProjectAccessRequests(pid interface{}, opt *ListAccessRequestsOptions, options ...OptionFunc) ([]*AccessRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/access_requests", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ars []*AccessRequest
- resp, err := s.client.Do(req, &ars)
- if err != nil {
- return nil, resp, err
- }
-
- return ars, resp, err
-}
-
-// ListGroupAccessRequests gets a list of access requests
-// viewable by the authenticated user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#list-access-requests-for-a-group-or-project
-func (s *AccessRequestsService) ListGroupAccessRequests(gid interface{}, opt *ListAccessRequestsOptions, options ...OptionFunc) ([]*AccessRequest, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/access_requests", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ars []*AccessRequest
- resp, err := s.client.Do(req, &ars)
- if err != nil {
- return nil, resp, err
- }
-
- return ars, resp, err
-}
-
-// RequestProjectAccess requests access for the authenticated user
-// to a group or project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#request-access-to-a-group-or-project
-func (s *AccessRequestsService) RequestProjectAccess(pid interface{}, options ...OptionFunc) (*AccessRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/access_requests", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ar := new(AccessRequest)
- resp, err := s.client.Do(req, ar)
- if err != nil {
- return nil, resp, err
- }
-
- return ar, resp, err
-}
-
-// RequestGroupAccess requests access for the authenticated user
-// to a group or project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#request-access-to-a-group-or-project
-func (s *AccessRequestsService) RequestGroupAccess(gid interface{}, options ...OptionFunc) (*AccessRequest, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/access_requests", pathEscape(group))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ar := new(AccessRequest)
- resp, err := s.client.Do(req, ar)
- if err != nil {
- return nil, resp, err
- }
-
- return ar, resp, err
-}
-
-// ApproveAccessRequestOptions represents the available
-// ApproveProjectAccessRequest() and ApproveGroupAccessRequest() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#approve-an-access-request
-type ApproveAccessRequestOptions struct {
- AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
-}
-
-// ApproveProjectAccessRequest approves an access request for the given user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#approve-an-access-request
-func (s *AccessRequestsService) ApproveProjectAccessRequest(pid interface{}, user int, opt *ApproveAccessRequestOptions, options ...OptionFunc) (*AccessRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/access_requests/%d/approve", pathEscape(project), user)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ar := new(AccessRequest)
- resp, err := s.client.Do(req, ar)
- if err != nil {
- return nil, resp, err
- }
-
- return ar, resp, err
-}
-
-// ApproveGroupAccessRequest approves an access request for the given user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#approve-an-access-request
-func (s *AccessRequestsService) ApproveGroupAccessRequest(gid interface{}, user int, opt *ApproveAccessRequestOptions, options ...OptionFunc) (*AccessRequest, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/access_requests/%d/approve", pathEscape(group), user)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ar := new(AccessRequest)
- resp, err := s.client.Do(req, ar)
- if err != nil {
- return nil, resp, err
- }
-
- return ar, resp, err
-}
-
-// DenyProjectAccessRequest denies an access request for the given user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#deny-an-access-request
-func (s *AccessRequestsService) DenyProjectAccessRequest(pid interface{}, user int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/access_requests/%d", pathEscape(project), user)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DenyGroupAccessRequest denies an access request for the given user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/access_requests.html#deny-an-access-request
-func (s *AccessRequestsService) DenyGroupAccessRequest(gid interface{}, user int, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/access_requests/%d", pathEscape(group), user)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/award_emojis.go b/vendor/github.com/xanzy/go-gitlab/award_emojis.go
deleted file mode 100644
index 4c054f96..00000000
--- a/vendor/github.com/xanzy/go-gitlab/award_emojis.go
+++ /dev/null
@@ -1,467 +0,0 @@
-//
-// Copyright 2017, Arkbriar
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// AwardEmojiService handles communication with the emoji awards related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/award_emoji.html
-type AwardEmojiService struct {
- client *Client
-}
-
-// AwardEmoji represents a GitLab Award Emoji.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/award_emoji.html
-type AwardEmoji struct {
- ID int `json:"id"`
- Name string `json:"name"`
- User struct {
- Name string `json:"name"`
- Username string `json:"username"`
- ID int `json:"id"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"user"`
- CreatedAt *time.Time `json:"created_at"`
- UpdatedAt *time.Time `json:"updated_at"`
- AwardableID int `json:"awardable_id"`
- AwardableType string `json:"awardable_type"`
-}
-
-const (
- awardMergeRequest = "merge_requests"
- awardIssue = "issues"
- awardSnippets = "snippets"
-)
-
-// ListAwardEmojiOptions represents the available options for listing emoji
-// for each resources
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html
-type ListAwardEmojiOptions ListOptions
-
-// ListMergeRequestAwardEmoji gets a list of all award emoji on the merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
-func (s *AwardEmojiService) ListMergeRequestAwardEmoji(pid interface{}, mergeRequestIID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- return s.listAwardEmoji(pid, awardMergeRequest, mergeRequestIID, opt, options...)
-}
-
-// ListIssueAwardEmoji gets a list of all award emoji on the issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
-func (s *AwardEmojiService) ListIssueAwardEmoji(pid interface{}, issueIID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- return s.listAwardEmoji(pid, awardIssue, issueIID, opt, options...)
-}
-
-// ListSnippetAwardEmoji gets a list of all award emoji on the snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
-func (s *AwardEmojiService) ListSnippetAwardEmoji(pid interface{}, snippetID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- return s.listAwardEmoji(pid, awardSnippets, snippetID, opt, options...)
-}
-
-func (s *AwardEmojiService) listAwardEmoji(pid interface{}, resource string, resourceID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/award_emoji",
- pathEscape(project),
- resource,
- resourceID,
- )
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var as []*AwardEmoji
- resp, err := s.client.Do(req, &as)
- if err != nil {
- return nil, resp, err
- }
-
- return as, resp, err
-}
-
-// GetMergeRequestAwardEmoji get an award emoji from merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
-func (s *AwardEmojiService) GetMergeRequestAwardEmoji(pid interface{}, mergeRequestIID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.getAwardEmoji(pid, awardMergeRequest, mergeRequestIID, awardID, options...)
-}
-
-// GetIssueAwardEmoji get an award emoji from issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
-func (s *AwardEmojiService) GetIssueAwardEmoji(pid interface{}, issueIID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.getAwardEmoji(pid, awardIssue, issueIID, awardID, options...)
-}
-
-// GetSnippetAwardEmoji get an award emoji from snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#list-an-awardable-39-s-award-emoji
-func (s *AwardEmojiService) GetSnippetAwardEmoji(pid interface{}, snippetID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.getAwardEmoji(pid, awardSnippets, snippetID, awardID, options...)
-}
-
-func (s *AwardEmojiService) getAwardEmoji(pid interface{}, resource string, resourceID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/award_emoji/%d",
- pathEscape(project),
- resource,
- resourceID,
- awardID,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(AwardEmoji)
- resp, err := s.client.Do(req, &a)
- if err != nil {
- return nil, resp, err
- }
-
- return a, resp, err
-}
-
-// CreateAwardEmojiOptions represents the available options for awarding emoji
-// for a resource
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji
-type CreateAwardEmojiOptions struct {
- Name string `json:"name"`
-}
-
-// CreateMergeRequestAwardEmoji get an award emoji from merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji
-func (s *AwardEmojiService) CreateMergeRequestAwardEmoji(pid interface{}, mergeRequestIID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.createAwardEmoji(pid, awardMergeRequest, mergeRequestIID, opt, options...)
-}
-
-// CreateIssueAwardEmoji get an award emoji from issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji
-func (s *AwardEmojiService) CreateIssueAwardEmoji(pid interface{}, issueIID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.createAwardEmoji(pid, awardIssue, issueIID, opt, options...)
-}
-
-// CreateSnippetAwardEmoji get an award emoji from snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji
-func (s *AwardEmojiService) CreateSnippetAwardEmoji(pid interface{}, snippetID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.createAwardEmoji(pid, awardSnippets, snippetID, opt, options...)
-}
-
-func (s *AwardEmojiService) createAwardEmoji(pid interface{}, resource string, resourceID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/award_emoji",
- pathEscape(project),
- resource,
- resourceID,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(AwardEmoji)
- resp, err := s.client.Do(req, &a)
- if err != nil {
- return nil, resp, err
- }
-
- return a, resp, err
-}
-
-// DeleteIssueAwardEmoji delete award emoji on an issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note
-func (s *AwardEmojiService) DeleteIssueAwardEmoji(pid interface{}, issueIID, awardID int, options ...OptionFunc) (*Response, error) {
- return s.deleteAwardEmoji(pid, awardMergeRequest, issueIID, awardID, options...)
-}
-
-// DeleteMergeRequestAwardEmoji delete award emoji on a merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note
-func (s *AwardEmojiService) DeleteMergeRequestAwardEmoji(pid interface{}, mergeRequestIID, awardID int, options ...OptionFunc) (*Response, error) {
- return s.deleteAwardEmoji(pid, awardMergeRequest, mergeRequestIID, awardID, options...)
-}
-
-// DeleteSnippetAwardEmoji delete award emoji on a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note
-func (s *AwardEmojiService) DeleteSnippetAwardEmoji(pid interface{}, snippetID, awardID int, options ...OptionFunc) (*Response, error) {
- return s.deleteAwardEmoji(pid, awardMergeRequest, snippetID, awardID, options...)
-}
-
-// DeleteAwardEmoji Delete an award emoji on the specified resource.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#delete-an-award-emoji
-func (s *AwardEmojiService) deleteAwardEmoji(pid interface{}, resource string, resourceID, awardID int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/award_emoji/%d", pathEscape(project), resource,
- resourceID, awardID)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
- return s.client.Do(req, nil)
-}
-
-// ListIssuesAwardEmojiOnNote gets a list of all award emoji on a note from the
-// issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) ListIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- return s.listAwardEmojiOnNote(pid, awardIssue, issueID, noteID, opt, options...)
-}
-
-// ListMergeRequestAwardEmojiOnNote gets a list of all award emoji on a note
-// from the merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) ListMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- return s.listAwardEmojiOnNote(pid, awardMergeRequest, mergeRequestIID, noteID, opt, options...)
-}
-
-// ListSnippetAwardEmojiOnNote gets a list of all award emoji on a note from the
-// snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) ListSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- return s.listAwardEmojiOnNote(pid, awardSnippets, snippetIID, noteID, opt, options...)
-}
-
-func (s *AwardEmojiService) listAwardEmojiOnNote(pid interface{}, resources string, ressourceID, noteID int, opt *ListAwardEmojiOptions, options ...OptionFunc) ([]*AwardEmoji, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/notes/%d/award_emoji", pathEscape(project), resources,
- ressourceID, noteID)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var as []*AwardEmoji
- resp, err := s.client.Do(req, &as)
- if err != nil {
- return nil, resp, err
- }
-
- return as, resp, err
-}
-
-// GetIssuesAwardEmojiOnNote gets an award emoji on a note from an issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) GetIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.getSingleNoteAwardEmoji(pid, awardIssue, issueID, noteID, awardID, options...)
-}
-
-// GetMergeRequestAwardEmojiOnNote gets an award emoji on a note from a
-// merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) GetMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.getSingleNoteAwardEmoji(pid, awardMergeRequest, mergeRequestIID, noteID, awardID,
- options...)
-}
-
-// GetSnippetAwardEmojiOnNote gets an award emoji on a note from a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) GetSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.getSingleNoteAwardEmoji(pid, awardSnippets, snippetIID, noteID, awardID, options...)
-}
-
-func (s *AwardEmojiService) getSingleNoteAwardEmoji(pid interface{}, ressource string, resourceID, noteID, awardID int, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/notes/%d/award_emoji/%d",
- pathEscape(project),
- ressource,
- resourceID,
- noteID,
- awardID,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(AwardEmoji)
- resp, err := s.client.Do(req, &a)
- if err != nil {
- return nil, resp, err
- }
-
- return a, resp, err
-}
-
-// CreateIssuesAwardEmojiOnNote gets an award emoji on a note from an issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) CreateIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.createAwardEmojiOnNote(pid, awardIssue, issueID, noteID, opt, options...)
-}
-
-// CreateMergeRequestAwardEmojiOnNote gets an award emoji on a note from a
-// merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) CreateMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.createAwardEmojiOnNote(pid, awardMergeRequest, mergeRequestIID, noteID, opt, options...)
-}
-
-// CreateSnippetAwardEmojiOnNote gets an award emoji on a note from a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) CreateSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- return s.createAwardEmojiOnNote(pid, awardSnippets, snippetIID, noteID, opt, options...)
-}
-
-// CreateAwardEmojiOnNote award emoji on a note.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-a-new-emoji-on-a-note
-func (s *AwardEmojiService) createAwardEmojiOnNote(pid interface{}, resource string, resourceID, noteID int, opt *CreateAwardEmojiOptions, options ...OptionFunc) (*AwardEmoji, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/notes/%d/award_emoji",
- pathEscape(project),
- resource,
- resourceID,
- noteID,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(AwardEmoji)
- resp, err := s.client.Do(req, &a)
- if err != nil {
- return nil, resp, err
- }
-
- return a, resp, err
-}
-
-// DeleteIssuesAwardEmojiOnNote deletes an award emoji on a note from an issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) DeleteIssuesAwardEmojiOnNote(pid interface{}, issueID, noteID, awardID int, options ...OptionFunc) (*Response, error) {
- return s.deleteAwardEmojiOnNote(pid, awardIssue, issueID, noteID, awardID, options...)
-}
-
-// DeleteMergeRequestAwardEmojiOnNote deletes an award emoji on a note from a
-// merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) DeleteMergeRequestAwardEmojiOnNote(pid interface{}, mergeRequestIID, noteID, awardID int, options ...OptionFunc) (*Response, error) {
- return s.deleteAwardEmojiOnNote(pid, awardMergeRequest, mergeRequestIID, noteID, awardID,
- options...)
-}
-
-// DeleteSnippetAwardEmojiOnNote deletes an award emoji on a note from a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/award_emoji.html#award-emoji-on-notes
-func (s *AwardEmojiService) DeleteSnippetAwardEmojiOnNote(pid interface{}, snippetIID, noteID, awardID int, options ...OptionFunc) (*Response, error) {
- return s.deleteAwardEmojiOnNote(pid, awardSnippets, snippetIID, noteID, awardID, options...)
-}
-
-func (s *AwardEmojiService) deleteAwardEmojiOnNote(pid interface{}, resource string, resourceID, noteID, awardID int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/notes/%d/award_emoji/%d",
- pathEscape(project),
- resource,
- resourceID,
- noteID,
- awardID,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/boards.go b/vendor/github.com/xanzy/go-gitlab/boards.go
deleted file mode 100644
index fd5e280f..00000000
--- a/vendor/github.com/xanzy/go-gitlab/boards.go
+++ /dev/null
@@ -1,344 +0,0 @@
-//
-// Copyright 2015, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
-)
-
-// IssueBoardsService handles communication with the issue board related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html
-type IssueBoardsService struct {
- client *Client
-}
-
-// IssueBoard represents a GitLab issue board.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html
-type IssueBoard struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Project *Project `json:"project"`
- Milestone *Milestone `json:"milestone"`
- Lists []*BoardList `json:"lists"`
-}
-
-func (b IssueBoard) String() string {
- return Stringify(b)
-}
-
-// BoardList represents a GitLab board list.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html
-type BoardList struct {
- ID int `json:"id"`
- Label *Label `json:"label"`
- Position int `json:"position"`
-}
-
-func (b BoardList) String() string {
- return Stringify(b)
-}
-
-// CreateIssueBoardOptions represents the available CreateIssueBoard() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/boards.html#create-a-board-starter
-type CreateIssueBoardOptions struct {
- Name *string `url:"name" json:"name"`
-}
-
-// CreateIssueBoard creates a new issue board.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/boards.html#create-a-board-starter
-func (s *IssueBoardsService) CreateIssueBoard(pid interface{}, opt *CreateIssueBoardOptions, options ...OptionFunc) (*IssueBoard, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/boards", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- board := new(IssueBoard)
- resp, err := s.client.Do(req, board)
- if err != nil {
- return nil, resp, err
- }
-
- return board, resp, err
-}
-
-// UpdateIssueBoardOptions represents the available UpdateIssueBoard() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/boards.html#update-a-board-starter
-type UpdateIssueBoardOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
- Labels Labels `url:"labels,omitempty" json:"labels,omitempty"`
- Weight *int `url:"weight,omitempty" json:"weight,omitempty"`
-}
-
-// UpdateIssueBoard update an issue board.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/boards.html#create-a-board-starter
-func (s *IssueBoardsService) UpdateIssueBoard(pid interface{}, board int, opt *UpdateIssueBoardOptions, options ...OptionFunc) (*IssueBoard, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/boards/%d", pathEscape(project), board)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- is := new(IssueBoard)
- resp, err := s.client.Do(req, is)
- if err != nil {
- return nil, resp, err
- }
-
- return is, resp, err
-}
-
-// DeleteIssueBoard deletes an issue board.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/boards.html#delete-a-board-starter
-func (s *IssueBoardsService) DeleteIssueBoard(pid interface{}, board int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/boards/%d", pathEscape(project), board)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListIssueBoardsOptions represents the available ListIssueBoards() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#project-board
-type ListIssueBoardsOptions ListOptions
-
-// ListIssueBoards gets a list of all issue boards in a project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#project-board
-func (s *IssueBoardsService) ListIssueBoards(pid interface{}, opt *ListIssueBoardsOptions, options ...OptionFunc) ([]*IssueBoard, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/boards", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var is []*IssueBoard
- resp, err := s.client.Do(req, &is)
- if err != nil {
- return nil, resp, err
- }
-
- return is, resp, err
-}
-
-// GetIssueBoard gets a single issue board of a project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#single-board
-func (s *IssueBoardsService) GetIssueBoard(pid interface{}, board int, options ...OptionFunc) (*IssueBoard, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/boards/%d", pathEscape(project), board)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ib := new(IssueBoard)
- resp, err := s.client.Do(req, ib)
- if err != nil {
- return nil, resp, err
- }
-
- return ib, resp, err
-}
-
-// GetIssueBoardListsOptions represents the available GetIssueBoardLists() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#list-board-lists
-type GetIssueBoardListsOptions ListOptions
-
-// GetIssueBoardLists gets a list of the issue board's lists. Does not include
-// backlog and closed lists.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#list-board-lists
-func (s *IssueBoardsService) GetIssueBoardLists(pid interface{}, board int, opt *GetIssueBoardListsOptions, options ...OptionFunc) ([]*BoardList, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/boards/%d/lists", pathEscape(project), board)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var bl []*BoardList
- resp, err := s.client.Do(req, &bl)
- if err != nil {
- return nil, resp, err
- }
-
- return bl, resp, err
-}
-
-// GetIssueBoardList gets a single issue board list.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#single-board-list
-func (s *IssueBoardsService) GetIssueBoardList(pid interface{}, board, list int, options ...OptionFunc) (*BoardList, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/boards/%d/lists/%d",
- pathEscape(project),
- board,
- list,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- bl := new(BoardList)
- resp, err := s.client.Do(req, bl)
- if err != nil {
- return nil, resp, err
- }
-
- return bl, resp, err
-}
-
-// CreateIssueBoardListOptions represents the available CreateIssueBoardList()
-// options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#new-board-list
-type CreateIssueBoardListOptions struct {
- LabelID *int `url:"label_id" json:"label_id"`
-}
-
-// CreateIssueBoardList creates a new issue board list.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#new-board-list
-func (s *IssueBoardsService) CreateIssueBoardList(pid interface{}, board int, opt *CreateIssueBoardListOptions, options ...OptionFunc) (*BoardList, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/boards/%d/lists", pathEscape(project), board)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- bl := new(BoardList)
- resp, err := s.client.Do(req, bl)
- if err != nil {
- return nil, resp, err
- }
-
- return bl, resp, err
-}
-
-// UpdateIssueBoardListOptions represents the available UpdateIssueBoardList()
-// options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#edit-board-list
-type UpdateIssueBoardListOptions struct {
- Position *int `url:"position" json:"position"`
-}
-
-// UpdateIssueBoardList updates the position of an existing issue board list.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/boards.html#edit-board-list
-func (s *IssueBoardsService) UpdateIssueBoardList(pid interface{}, board, list int, opt *UpdateIssueBoardListOptions, options ...OptionFunc) (*BoardList, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/boards/%d/lists/%d",
- pathEscape(project),
- board,
- list,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- bl := new(BoardList)
- resp, err := s.client.Do(req, bl)
- if err != nil {
- return nil, resp, err
- }
-
- return bl, resp, err
-}
-
-// DeleteIssueBoardList soft deletes an issue board list. Only for admins and
-// project owners.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/boards.html#delete-a-board-list
-func (s *IssueBoardsService) DeleteIssueBoardList(pid interface{}, board, list int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/boards/%d/lists/%d",
- pathEscape(project),
- board,
- list,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/branches.go b/vendor/github.com/xanzy/go-gitlab/branches.go
deleted file mode 100644
index e61ddfe7..00000000
--- a/vendor/github.com/xanzy/go-gitlab/branches.go
+++ /dev/null
@@ -1,242 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// BranchesService handles communication with the branch related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/branches.html
-type BranchesService struct {
- client *Client
-}
-
-// Branch represents a GitLab branch.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/branches.html
-type Branch struct {
- Commit *Commit `json:"commit"`
- Name string `json:"name"`
- Protected bool `json:"protected"`
- Merged bool `json:"merged"`
- Default bool `json:"default"`
- DevelopersCanPush bool `json:"developers_can_push"`
- DevelopersCanMerge bool `json:"developers_can_merge"`
-}
-
-func (b Branch) String() string {
- return Stringify(b)
-}
-
-// ListBranchesOptions represents the available ListBranches() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#list-repository-branches
-type ListBranchesOptions struct {
- ListOptions
- Search *string `url:"search,omitempty" json:"search,omitempty"`
-}
-
-// ListBranches gets a list of repository branches from a project, sorted by
-// name alphabetically.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#list-repository-branches
-func (s *BranchesService) ListBranches(pid interface{}, opts *ListBranchesOptions, options ...OptionFunc) ([]*Branch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/branches", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- var b []*Branch
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// GetBranch gets a single project repository branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#get-single-repository-branch
-func (s *BranchesService) GetBranch(pid interface{}, branch string, options ...OptionFunc) (*Branch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/branches/%s", pathEscape(project), url.PathEscape(branch))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- b := new(Branch)
- resp, err := s.client.Do(req, b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// ProtectBranchOptions represents the available ProtectBranch() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#protect-repository-branch
-type ProtectBranchOptions struct {
- DevelopersCanPush *bool `url:"developers_can_push,omitempty" json:"developers_can_push,omitempty"`
- DevelopersCanMerge *bool `url:"developers_can_merge,omitempty" json:"developers_can_merge,omitempty"`
-}
-
-// ProtectBranch protects a single project repository branch. This is an
-// idempotent function, protecting an already protected repository branch
-// still returns a 200 OK status code.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#protect-repository-branch
-func (s *BranchesService) ProtectBranch(pid interface{}, branch string, opts *ProtectBranchOptions, options ...OptionFunc) (*Branch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/branches/%s/protect", pathEscape(project), url.PathEscape(branch))
-
- req, err := s.client.NewRequest("PUT", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- b := new(Branch)
- resp, err := s.client.Do(req, b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// UnprotectBranch unprotects a single project repository branch. This is an
-// idempotent function, unprotecting an already unprotected repository branch
-// still returns a 200 OK status code.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#unprotect-repository-branch
-func (s *BranchesService) UnprotectBranch(pid interface{}, branch string, options ...OptionFunc) (*Branch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/branches/%s/unprotect", pathEscape(project), url.PathEscape(branch))
-
- req, err := s.client.NewRequest("PUT", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- b := new(Branch)
- resp, err := s.client.Do(req, b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// CreateBranchOptions represents the available CreateBranch() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#create-repository-branch
-type CreateBranchOptions struct {
- Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
-}
-
-// CreateBranch creates branch from commit SHA or existing branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#create-repository-branch
-func (s *BranchesService) CreateBranch(pid interface{}, opt *CreateBranchOptions, options ...OptionFunc) (*Branch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/branches", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- b := new(Branch)
- resp, err := s.client.Do(req, b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// DeleteBranch deletes an existing branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#delete-repository-branch
-func (s *BranchesService) DeleteBranch(pid interface{}, branch string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/branches/%s", pathEscape(project), url.PathEscape(branch))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteMergedBranches deletes all branches that are merged into the project's default branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/branches.html#delete-merged-branches
-func (s *BranchesService) DeleteMergedBranches(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/merged_branches", pathEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/broadcast_messages.go b/vendor/github.com/xanzy/go-gitlab/broadcast_messages.go
deleted file mode 100644
index aee852d4..00000000
--- a/vendor/github.com/xanzy/go-gitlab/broadcast_messages.go
+++ /dev/null
@@ -1,172 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// BroadcastMessagesService handles communication with the broadcast
-// messages methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/broadcast_messages.html
-type BroadcastMessagesService struct {
- client *Client
-}
-
-// BroadcastMessage represents a GitLab issue board.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#get-all-broadcast-messages
-type BroadcastMessage struct {
- Message string `json:"message"`
- StartsAt *time.Time `json:"starts_at"`
- EndsAt *time.Time `json:"ends_at"`
- Color string `json:"color"`
- Font string `json:"font"`
- ID int `json:"id"`
- Active bool `json:"active"`
-}
-
-// ListBroadcastMessagesOptions represents the available ListBroadcastMessages()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#get-all-broadcast-messages
-type ListBroadcastMessagesOptions ListOptions
-
-// ListBroadcastMessages gets a list of all broadcasted messages.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#get-all-broadcast-messages
-func (s *BroadcastMessagesService) ListBroadcastMessages(opt *ListBroadcastMessagesOptions, options ...OptionFunc) ([]*BroadcastMessage, *Response, error) {
- req, err := s.client.NewRequest("GET", "broadcast_messages", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var bs []*BroadcastMessage
- resp, err := s.client.Do(req, &bs)
- if err != nil {
- return nil, resp, err
- }
-
- return bs, resp, err
-}
-
-// GetBroadcastMessage gets a single broadcast message.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#get-a-specific-broadcast-message
-func (s *BroadcastMessagesService) GetBroadcastMessage(broadcast int, options ...OptionFunc) (*BroadcastMessage, *Response, error) {
- u := fmt.Sprintf("broadcast_messages/%d", broadcast)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- b := new(BroadcastMessage)
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// CreateBroadcastMessageOptions represents the available CreateBroadcastMessage()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#create-a-broadcast-message
-type CreateBroadcastMessageOptions struct {
- Message *string `url:"message" json:"message"`
- StartsAt *time.Time `url:"starts_at,omitempty" json:"starts_at,omitempty"`
- EndsAt *time.Time `url:"ends_at,omitempty" json:"ends_at,omitempty"`
- Color *string `url:"color,omitempty" json:"color,omitempty"`
- Font *string `url:"font,omitempty" json:"font,omitempty"`
-}
-
-// CreateBroadcastMessage creates a message to broadcast.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#create-a-broadcast-message
-func (s *BroadcastMessagesService) CreateBroadcastMessage(opt *CreateBroadcastMessageOptions, options ...OptionFunc) (*BroadcastMessage, *Response, error) {
- req, err := s.client.NewRequest("POST", "broadcast_messages", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- b := new(BroadcastMessage)
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// UpdateBroadcastMessageOptions represents the available CreateBroadcastMessage()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#update-a-broadcast-message
-type UpdateBroadcastMessageOptions struct {
- Message *string `url:"message,omitempty" json:"message,omitempty"`
- StartsAt *time.Time `url:"starts_at,omitempty" json:"starts_at,omitempty"`
- EndsAt *time.Time `url:"ends_at,omitempty" json:"ends_at,omitempty"`
- Color *string `url:"color,omitempty" json:"color,omitempty"`
- Font *string `url:"font,omitempty" json:"font,omitempty"`
-}
-
-// UpdateBroadcastMessage update a broadcasted message.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#update-a-broadcast-message
-func (s *BroadcastMessagesService) UpdateBroadcastMessage(broadcast int, opt *UpdateBroadcastMessageOptions, options ...OptionFunc) (*BroadcastMessage, *Response, error) {
- u := fmt.Sprintf("broadcast_messages/%d", broadcast)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- b := new(BroadcastMessage)
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b, resp, err
-}
-
-// DeleteBroadcastMessage deletes a broadcasted message.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/broadcast_messages.html#delete-a-broadcast-message
-func (s *BroadcastMessagesService) DeleteBroadcastMessage(broadcast int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("broadcast_messages/%d", broadcast)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/ci_yml_templates.go b/vendor/github.com/xanzy/go-gitlab/ci_yml_templates.go
deleted file mode 100644
index 7a185af6..00000000
--- a/vendor/github.com/xanzy/go-gitlab/ci_yml_templates.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package gitlab
-
-import (
- "fmt"
-)
-
-// CIYMLTemplatesService handles communication with the gitlab
-// CI YML templates related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html
-type CIYMLTemplatesService struct {
- client *Client
-}
-
-// CIYMLTemplate represents a GitLab CI YML template.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html
-type CIYMLTemplate struct {
- Name string `json:"name"`
- Content string `json:"content"`
-}
-
-// ListCIYMLTemplatesOptions represents the available ListAllTemplates() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitignores.html#list-gitignore-templates
-type ListCIYMLTemplatesOptions ListOptions
-
-// ListAllTemplates get all GitLab CI YML templates.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html#list-gitlab-ci-yml-templates
-func (s *CIYMLTemplatesService) ListAllTemplates(opt *ListCIYMLTemplatesOptions, options ...OptionFunc) ([]*CIYMLTemplate, *Response, error) {
- req, err := s.client.NewRequest("GET", "templates/gitlab_ci_ymls", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cts []*CIYMLTemplate
- resp, err := s.client.Do(req, &cts)
- if err != nil {
- return nil, resp, err
- }
-
- return cts, resp, err
-}
-
-// GetTemplate get a single GitLab CI YML template.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitlab_ci_ymls.html#single-gitlab-ci-yml-template
-func (s *CIYMLTemplatesService) GetTemplate(key string, options ...OptionFunc) (*CIYMLTemplate, *Response, error) {
- u := fmt.Sprintf("templates/gitlab_ci_ymls/%s", pathEscape(key))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ct := new(CIYMLTemplate)
- resp, err := s.client.Do(req, ct)
- if err != nil {
- return nil, resp, err
- }
-
- return ct, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/commits.go b/vendor/github.com/xanzy/go-gitlab/commits.go
deleted file mode 100644
index 27dd5645..00000000
--- a/vendor/github.com/xanzy/go-gitlab/commits.go
+++ /dev/null
@@ -1,593 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
- "time"
-)
-
-// CommitsService handles communication with the commit related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
-type CommitsService struct {
- client *Client
-}
-
-// Commit represents a GitLab commit.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
-type Commit struct {
- ID string `json:"id"`
- ShortID string `json:"short_id"`
- Title string `json:"title"`
- AuthorName string `json:"author_name"`
- AuthorEmail string `json:"author_email"`
- AuthoredDate *time.Time `json:"authored_date"`
- CommitterName string `json:"committer_name"`
- CommitterEmail string `json:"committer_email"`
- CommittedDate *time.Time `json:"committed_date"`
- CreatedAt *time.Time `json:"created_at"`
- Message string `json:"message"`
- ParentIDs []string `json:"parent_ids"`
- Stats *CommitStats `json:"stats"`
- Status *BuildStateValue `json:"status"`
- LastPipeline *PipelineInfo `json:"last_pipeline"`
- ProjectID int `json:"project_id"`
-}
-
-// CommitStats represents the number of added and deleted files in a commit.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
-type CommitStats struct {
- Additions int `json:"additions"`
- Deletions int `json:"deletions"`
- Total int `json:"total"`
-}
-
-func (c Commit) String() string {
- return Stringify(c)
-}
-
-// ListCommitsOptions represents the available ListCommits() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#list-repository-commits
-type ListCommitsOptions struct {
- ListOptions
- RefName *string `url:"ref_name,omitempty" json:"ref_name,omitempty"`
- Since *time.Time `url:"since,omitempty" json:"since,omitempty"`
- Until *time.Time `url:"until,omitempty" json:"until,omitempty"`
- Path *string `url:"path,omitempty" json:"path,omitempty"`
- All *bool `url:"all,omitempty" json:"all,omitempty"`
- WithStats *bool `url:"with_stats,omitempty" json:"with_stats,omitempty"`
-}
-
-// ListCommits gets a list of repository commits in a project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#list-commits
-func (s *CommitsService) ListCommits(pid interface{}, opt *ListCommitsOptions, options ...OptionFunc) ([]*Commit, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var c []*Commit
- resp, err := s.client.Do(req, &c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// FileAction represents the available actions that can be performed on a file.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
-type FileAction string
-
-// The available file actions.
-const (
- FileCreate FileAction = "create"
- FileDelete FileAction = "delete"
- FileMove FileAction = "move"
- FileUpdate FileAction = "update"
-)
-
-// CommitAction represents a single file action within a commit.
-type CommitAction struct {
- Action FileAction `url:"action" json:"action"`
- FilePath string `url:"file_path" json:"file_path"`
- PreviousPath string `url:"previous_path,omitempty" json:"previous_path,omitempty"`
- Content string `url:"content,omitempty" json:"content,omitempty"`
- Encoding string `url:"encoding,omitempty" json:"encoding,omitempty"`
-}
-
-// CommitRef represents the reference of branches/tags in a commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to
-type CommitRef struct {
- Type string `json:"type"`
- Name string `json:"name"`
-}
-
-// GetCommitRefsOptions represents the available GetCommitRefs() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to
-type GetCommitRefsOptions struct {
- ListOptions
- Type *string `url:"type,omitempty" json:"type,omitempty"`
-}
-
-// GetCommitRefs gets all references (from branches or tags) a commit is pushed to
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#get-references-a-commit-is-pushed-to
-func (s *CommitsService) GetCommitRefs(pid interface{}, sha string, opt *GetCommitRefsOptions, options ...OptionFunc) ([]*CommitRef, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/refs", pathEscape(project), url.PathEscape(sha))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cs []*CommitRef
- resp, err := s.client.Do(req, &cs)
- if err != nil {
- return nil, resp, err
- }
-
- return cs, resp, err
-}
-
-// GetCommit gets a specific commit identified by the commit hash or name of a
-// branch or tag.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#get-a-single-commit
-func (s *CommitsService) GetCommit(pid interface{}, sha string, options ...OptionFunc) (*Commit, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- if sha == "" {
- return nil, nil, fmt.Errorf("SHA must be a non-empty string")
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s", pathEscape(project), url.PathEscape(sha))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(Commit)
- resp, err := s.client.Do(req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// CreateCommitOptions represents the available options for a new commit.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
-type CreateCommitOptions struct {
- Branch *string `url:"branch" json:"branch"`
- CommitMessage *string `url:"commit_message" json:"commit_message"`
- StartBranch *string `url:"start_branch,omitempty" json:"start_branch,omitempty"`
- StartSHA *string `url:"start_sha,omitempty" json:"start_sha,omitempty"`
- StartProject *string `url:"start_project,omitempty" json:"start_project,omitempty"`
- Actions []*CommitAction `url:"actions" json:"actions"`
- AuthorEmail *string `url:"author_email,omitempty" json:"author_email,omitempty"`
- AuthorName *string `url:"author_name,omitempty" json:"author_name,omitempty"`
- Stats *bool `url:"stats,omitempty" json:"stats,omitempty"`
- Force *bool `url:"force,omitempty" json:"force,omitempty"`
-}
-
-// CreateCommit creates a commit with multiple files and actions.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
-func (s *CommitsService) CreateCommit(pid interface{}, opt *CreateCommitOptions, options ...OptionFunc) (*Commit, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(Commit)
- resp, err := s.client.Do(req, &c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// Diff represents a GitLab diff.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
-type Diff struct {
- Diff string `json:"diff"`
- NewPath string `json:"new_path"`
- OldPath string `json:"old_path"`
- AMode string `json:"a_mode"`
- BMode string `json:"b_mode"`
- NewFile bool `json:"new_file"`
- RenamedFile bool `json:"renamed_file"`
- DeletedFile bool `json:"deleted_file"`
-}
-
-func (d Diff) String() string {
- return Stringify(d)
-}
-
-// GetCommitDiffOptions represents the available GetCommitDiff() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#get-the-diff-of-a-commit
-type GetCommitDiffOptions ListOptions
-
-// GetCommitDiff gets the diff of a commit in a project..
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#get-the-diff-of-a-commit
-func (s *CommitsService) GetCommitDiff(pid interface{}, sha string, opt *GetCommitDiffOptions, options ...OptionFunc) ([]*Diff, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/diff", pathEscape(project), url.PathEscape(sha))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var d []*Diff
- resp, err := s.client.Do(req, &d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// CommitComment represents a GitLab commit comment.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html
-type CommitComment struct {
- Note string `json:"note"`
- Path string `json:"path"`
- Line int `json:"line"`
- LineType string `json:"line_type"`
- Author Author `json:"author"`
-}
-
-// Author represents a GitLab commit author
-type Author struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- Blocked bool `json:"blocked"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-func (c CommitComment) String() string {
- return Stringify(c)
-}
-
-// GetCommitCommentsOptions represents the available GetCommitComments() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#get-the-comments-of-a-commit
-type GetCommitCommentsOptions ListOptions
-
-// GetCommitComments gets the comments of a commit in a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#get-the-comments-of-a-commit
-func (s *CommitsService) GetCommitComments(pid interface{}, sha string, opt *GetCommitCommentsOptions, options ...OptionFunc) ([]*CommitComment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/comments", pathEscape(project), url.PathEscape(sha))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var c []*CommitComment
- resp, err := s.client.Do(req, &c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// PostCommitCommentOptions represents the available PostCommitComment()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#post-comment-to-commit
-type PostCommitCommentOptions struct {
- Note *string `url:"note,omitempty" json:"note,omitempty"`
- Path *string `url:"path" json:"path"`
- Line *int `url:"line" json:"line"`
- LineType *string `url:"line_type" json:"line_type"`
-}
-
-// PostCommitComment adds a comment to a commit. Optionally you can post
-// comments on a specific line of a commit. Therefor both path, line_new and
-// line_old are required.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#post-comment-to-commit
-func (s *CommitsService) PostCommitComment(pid interface{}, sha string, opt *PostCommitCommentOptions, options ...OptionFunc) (*CommitComment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/comments", pathEscape(project), url.PathEscape(sha))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(CommitComment)
- resp, err := s.client.Do(req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// GetCommitStatusesOptions represents the available GetCommitStatuses() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#get-the-status-of-a-commit
-type GetCommitStatusesOptions struct {
- ListOptions
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
- Stage *string `url:"stage,omitempty" json:"stage,omitempty"`
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- All *bool `url:"all,omitempty" json:"all,omitempty"`
-}
-
-// CommitStatus represents a GitLab commit status.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#get-the-status-of-a-commit
-type CommitStatus struct {
- ID int `json:"id"`
- SHA string `json:"sha"`
- Ref string `json:"ref"`
- Status string `json:"status"`
- Name string `json:"name"`
- TargetURL string `json:"target_url"`
- Description string `json:"description"`
- CreatedAt *time.Time `json:"created_at"`
- StartedAt *time.Time `json:"started_at"`
- FinishedAt *time.Time `json:"finished_at"`
- Author Author `json:"author"`
-}
-
-// GetCommitStatuses gets the statuses of a commit in a project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#get-the-status-of-a-commit
-func (s *CommitsService) GetCommitStatuses(pid interface{}, sha string, opt *GetCommitStatusesOptions, options ...OptionFunc) ([]*CommitStatus, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/statuses", pathEscape(project), url.PathEscape(sha))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cs []*CommitStatus
- resp, err := s.client.Do(req, &cs)
- if err != nil {
- return nil, resp, err
- }
-
- return cs, resp, err
-}
-
-// SetCommitStatusOptions represents the available SetCommitStatus() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#post-the-status-to-commit
-type SetCommitStatusOptions struct {
- State BuildStateValue `url:"state" json:"state"`
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Context *string `url:"context,omitempty" json:"context,omitempty"`
- TargetURL *string `url:"target_url,omitempty" json:"target_url,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
-}
-
-// SetCommitStatus sets the status of a commit in a project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#post-the-status-to-commit
-func (s *CommitsService) SetCommitStatus(pid interface{}, sha string, opt *SetCommitStatusOptions, options ...OptionFunc) (*CommitStatus, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/statuses/%s", pathEscape(project), url.PathEscape(sha))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- cs := new(CommitStatus)
- resp, err := s.client.Do(req, &cs)
- if err != nil {
- return nil, resp, err
- }
-
- return cs, resp, err
-}
-
-// GetMergeRequestsByCommit gets merge request associated with a commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/commits.html#list-merge-requests-associated-with-a-commit
-func (s *CommitsService) GetMergeRequestsByCommit(pid interface{}, sha string, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/merge_requests", pathEscape(project), url.PathEscape(sha))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var mrs []*MergeRequest
- resp, err := s.client.Do(req, &mrs)
- if err != nil {
- return nil, resp, err
- }
-
- return mrs, resp, err
-}
-
-// CherryPickCommitOptions represents the available CherryPickCommit() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#cherry-pick-a-commit
-type CherryPickCommitOptions struct {
- Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
-}
-
-// CherryPickCommit cherry picks a commit to a given branch.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/commits.html#cherry-pick-a-commit
-func (s *CommitsService) CherryPickCommit(pid interface{}, sha string, opt *CherryPickCommitOptions, options ...OptionFunc) (*Commit, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/cherry_pick", pathEscape(project), url.PathEscape(sha))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(Commit)
- resp, err := s.client.Do(req, &c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// RevertCommitOptions represents the available RevertCommit() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/commits.html#revert-a-commit
-type RevertCommitOptions struct {
- Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
-}
-
-// RevertCommit reverts a commit in a given branch.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/commits.html#revert-a-commit
-func (s *CommitsService) RevertCommit(pid interface{}, sha string, opt *RevertCommitOptions, options ...OptionFunc) (*Commit, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/revert", pathEscape(project), url.PathEscape(sha))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(Commit)
- resp, err := s.client.Do(req, &c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// GPGSignature represents a Gitlab commit's GPG Signature.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/commits.html#get-gpg-signature-of-a-commit
-type GPGSignature struct {
- KeyID int `json:"gpg_key_id"`
- KeyPrimaryKeyID string `json:"gpg_key_primary_keyid"`
- KeyUserName string `json:"gpg_key_user_name"`
- KeyUserEmail string `json:"gpg_key_user_email"`
- VerificationStatus string `json:"verification_status"`
- KeySubkeyID int `json:"gpg_key_subkey_id"`
-}
-
-// GetGPGSiganature gets a GPG signature of a commit.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/commits.html#get-gpg-signature-of-a-commit
-func (s *CommitsService) GetGPGSiganature(pid interface{}, sha string, options ...OptionFunc) (*GPGSignature, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/signature", pathEscape(project), url.PathEscape(sha))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- sig := new(GPGSignature)
- resp, err := s.client.Do(req, &sig)
- if err != nil {
- return nil, resp, err
- }
-
- return sig, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/custom_attributes.go b/vendor/github.com/xanzy/go-gitlab/custom_attributes.go
deleted file mode 100644
index ce165c80..00000000
--- a/vendor/github.com/xanzy/go-gitlab/custom_attributes.go
+++ /dev/null
@@ -1,171 +0,0 @@
-package gitlab
-
-import (
- "fmt"
-)
-
-// CustomAttributesService handles communication with the group, project and
-// user custom attributes related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/custom_attributes.html
-type CustomAttributesService struct {
- client *Client
-}
-
-// CustomAttribute struct is used to unmarshal response to api calls.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/custom_attributes.html
-type CustomAttribute struct {
- Key string `json:"key"`
- Value string `json:"value"`
-}
-
-// ListCustomUserAttributes lists the custom attributes of the specified user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#list-custom-attributes
-func (s *CustomAttributesService) ListCustomUserAttributes(user int, options ...OptionFunc) ([]*CustomAttribute, *Response, error) {
- return s.listCustomAttributes("users", user, options...)
-}
-
-// ListCustomGroupAttributes lists the custom attributes of the specified group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#list-custom-attributes
-func (s *CustomAttributesService) ListCustomGroupAttributes(group int, options ...OptionFunc) ([]*CustomAttribute, *Response, error) {
- return s.listCustomAttributes("groups", group, options...)
-}
-
-// ListCustomProjectAttributes lists the custom attributes of the specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#list-custom-attributes
-func (s *CustomAttributesService) ListCustomProjectAttributes(project int, options ...OptionFunc) ([]*CustomAttribute, *Response, error) {
- return s.listCustomAttributes("projects", project, options...)
-}
-
-func (s *CustomAttributesService) listCustomAttributes(resource string, id int, options ...OptionFunc) ([]*CustomAttribute, *Response, error) {
- u := fmt.Sprintf("%s/%d/custom_attributes", resource, id)
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cas []*CustomAttribute
- resp, err := s.client.Do(req, &cas)
- if err != nil {
- return nil, resp, err
- }
- return cas, resp, err
-}
-
-// GetCustomUserAttribute returns the user attribute with a speciifc key.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#single-custom-attribute
-func (s *CustomAttributesService) GetCustomUserAttribute(user int, key string, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- return s.getCustomAttribute("users", user, key, options...)
-}
-
-// GetCustomGroupAttribute returns the group attribute with a speciifc key.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#single-custom-attribute
-func (s *CustomAttributesService) GetCustomGroupAttribute(group int, key string, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- return s.getCustomAttribute("groups", group, key, options...)
-}
-
-// GetCustomProjectAttribute returns the project attribute with a speciifc key.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#single-custom-attribute
-func (s *CustomAttributesService) GetCustomProjectAttribute(project int, key string, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- return s.getCustomAttribute("projects", project, key, options...)
-}
-
-func (s *CustomAttributesService) getCustomAttribute(resource string, id int, key string, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- u := fmt.Sprintf("%s/%d/custom_attributes/%s", resource, id, key)
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ca *CustomAttribute
- resp, err := s.client.Do(req, &ca)
- if err != nil {
- return nil, resp, err
- }
- return ca, resp, err
-}
-
-// SetCustomUserAttribute sets the custom attributes of the specified user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#set-custom-attribute
-func (s *CustomAttributesService) SetCustomUserAttribute(user int, c CustomAttribute, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- return s.setCustomAttribute("users", user, c, options...)
-}
-
-// SetCustomGroupAttribute sets the custom attributes of the specified group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#set-custom-attribute
-func (s *CustomAttributesService) SetCustomGroupAttribute(group int, c CustomAttribute, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- return s.setCustomAttribute("groups", group, c, options...)
-}
-
-// SetCustomProjectAttribute sets the custom attributes of the specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#set-custom-attribute
-func (s *CustomAttributesService) SetCustomProjectAttribute(project int, c CustomAttribute, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- return s.setCustomAttribute("projects", project, c, options...)
-}
-
-func (s *CustomAttributesService) setCustomAttribute(resource string, id int, c CustomAttribute, options ...OptionFunc) (*CustomAttribute, *Response, error) {
- u := fmt.Sprintf("%s/%d/custom_attributes/%s", resource, id, c.Key)
- req, err := s.client.NewRequest("PUT", u, c, options)
- if err != nil {
- return nil, nil, err
- }
-
- ca := new(CustomAttribute)
- resp, err := s.client.Do(req, ca)
- if err != nil {
- return nil, resp, err
- }
- return ca, resp, err
-}
-
-// DeleteCustomUserAttribute removes the custom attribute of the specified user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#delete-custom-attribute
-func (s *CustomAttributesService) DeleteCustomUserAttribute(user int, key string, options ...OptionFunc) (*Response, error) {
- return s.deleteCustomAttribute("users", user, key, options...)
-}
-
-// DeleteCustomGroupAttribute removes the custom attribute of the specified group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#delete-custom-attribute
-func (s *CustomAttributesService) DeleteCustomGroupAttribute(group int, key string, options ...OptionFunc) (*Response, error) {
- return s.deleteCustomAttribute("groups", group, key, options...)
-}
-
-// DeleteCustomProjectAttribute removes the custom attribute of the specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/custom_attributes.html#delete-custom-attribute
-func (s *CustomAttributesService) DeleteCustomProjectAttribute(project int, key string, options ...OptionFunc) (*Response, error) {
- return s.deleteCustomAttribute("projects", project, key, options...)
-}
-
-func (s *CustomAttributesService) deleteCustomAttribute(resource string, id int, key string, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("%s/%d/custom_attributes/%s", resource, id, key)
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/deploy_keys.go b/vendor/github.com/xanzy/go-gitlab/deploy_keys.go
deleted file mode 100644
index 8c184184..00000000
--- a/vendor/github.com/xanzy/go-gitlab/deploy_keys.go
+++ /dev/null
@@ -1,200 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// DeployKeysService handles communication with the keys related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/deploy_keys.html
-type DeployKeysService struct {
- client *Client
-}
-
-// DeployKey represents a GitLab deploy key.
-type DeployKey struct {
- ID int `json:"id"`
- Title string `json:"title"`
- Key string `json:"key"`
- CanPush *bool `json:"can_push"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-func (k DeployKey) String() string {
- return Stringify(k)
-}
-
-// ListAllDeployKeys gets a list of all deploy keys
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#list-all-deploy-keys
-func (s *DeployKeysService) ListAllDeployKeys(options ...OptionFunc) ([]*DeployKey, *Response, error) {
- req, err := s.client.NewRequest("GET", "deploy_keys", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ks []*DeployKey
- resp, err := s.client.Do(req, &ks)
- if err != nil {
- return nil, resp, err
- }
-
- return ks, resp, err
-}
-
-// ListProjectDeployKeysOptions represents the available ListProjectDeployKeys()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#list-project-deploy-keys
-type ListProjectDeployKeysOptions ListOptions
-
-// ListProjectDeployKeys gets a list of a project's deploy keys
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#list-project-deploy-keys
-func (s *DeployKeysService) ListProjectDeployKeys(pid interface{}, opt *ListProjectDeployKeysOptions, options ...OptionFunc) ([]*DeployKey, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/deploy_keys", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ks []*DeployKey
- resp, err := s.client.Do(req, &ks)
- if err != nil {
- return nil, resp, err
- }
-
- return ks, resp, err
-}
-
-// GetDeployKey gets a single deploy key.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#single-deploy-key
-func (s *DeployKeysService) GetDeployKey(pid interface{}, deployKey int, options ...OptionFunc) (*DeployKey, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/deploy_keys/%d", pathEscape(project), deployKey)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(DeployKey)
- resp, err := s.client.Do(req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
-
-// AddDeployKeyOptions represents the available ADDDeployKey() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#add-deploy-key
-type AddDeployKeyOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Key *string `url:"key,omitempty" json:"key,omitempty"`
- CanPush *bool `url:"can_push,omitempty" json:"can_push,omitempty"`
-}
-
-// AddDeployKey creates a new deploy key for a project. If deploy key already
-// exists in another project - it will be joined to project but only if
-// original one was is accessible by same user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#add-deploy-key
-func (s *DeployKeysService) AddDeployKey(pid interface{}, opt *AddDeployKeyOptions, options ...OptionFunc) (*DeployKey, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/deploy_keys", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(DeployKey)
- resp, err := s.client.Do(req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
-
-// DeleteDeployKey deletes a deploy key from a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#delete-deploy-key
-func (s *DeployKeysService) DeleteDeployKey(pid interface{}, deployKey int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/deploy_keys/%d", pathEscape(project), deployKey)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// EnableDeployKey enables a deploy key.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deploy_keys.html#enable-deploy-key
-func (s *DeployKeysService) EnableDeployKey(pid interface{}, deployKey int, options ...OptionFunc) (*DeployKey, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/deploy_keys/%d/enable", pathEscape(project), deployKey)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(DeployKey)
- resp, err := s.client.Do(req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/deployments.go b/vendor/github.com/xanzy/go-gitlab/deployments.go
deleted file mode 100644
index 8041ce92..00000000
--- a/vendor/github.com/xanzy/go-gitlab/deployments.go
+++ /dev/null
@@ -1,120 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// DeploymentsService handles communication with the deployment related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/deployments.html
-type DeploymentsService struct {
- client *Client
-}
-
-// Deployment represents the Gitlab deployment
-type Deployment struct {
- ID int `json:"id"`
- IID int `json:"iid"`
- Ref string `json:"ref"`
- SHA string `json:"sha"`
- CreatedAt *time.Time `json:"created_at"`
- User *ProjectUser `json:"user"`
- Environment *Environment `json:"environment"`
- Deployable struct {
- ID int `json:"id"`
- Status string `json:"status"`
- Stage string `json:"stage"`
- Name string `json:"name"`
- Ref string `json:"ref"`
- Tag bool `json:"tag"`
- Coverage float64 `json:"coverage"`
- CreatedAt *time.Time `json:"created_at"`
- StartedAt *time.Time `json:"started_at"`
- FinishedAt *time.Time `json:"finished_at"`
- Duration float64 `json:"duration"`
- User *User `json:"user"`
- Commit *Commit `json:"commit"`
- Pipeline struct {
- ID int `json:"id"`
- SHA string `json:"sha"`
- Ref string `json:"ref"`
- Status string `json:"status"`
- } `json:"pipeline"`
- Runner *Runner `json:"runner"`
- } `json:"deployable"`
-}
-
-// ListProjectDeploymentsOptions represents the available ListProjectDeployments() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/deployments.html#list-project-deployments
-type ListProjectDeploymentsOptions struct {
- ListOptions
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
-}
-
-// ListProjectDeployments gets a list of deployments in a project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/deployments.html#list-project-deployments
-func (s *DeploymentsService) ListProjectDeployments(pid interface{}, opts *ListProjectDeploymentsOptions, options ...OptionFunc) ([]*Deployment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/deployments", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ds []*Deployment
- resp, err := s.client.Do(req, &ds)
- if err != nil {
- return nil, resp, err
- }
-
- return ds, resp, err
-}
-
-// GetProjectDeployment get a deployment for a project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/deployments.html#get-a-specific-deployment
-func (s *DeploymentsService) GetProjectDeployment(pid interface{}, deployment int, options ...OptionFunc) (*Deployment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/deployments/%d", pathEscape(project), deployment)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Deployment)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/discussions.go b/vendor/github.com/xanzy/go-gitlab/discussions.go
deleted file mode 100644
index 17ed1c7d..00000000
--- a/vendor/github.com/xanzy/go-gitlab/discussions.go
+++ /dev/null
@@ -1,1112 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// DiscussionsService handles communication with the discussions related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/discussions.html
-type DiscussionsService struct {
- client *Client
-}
-
-// Discussion represents a GitLab discussion.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/discussions.html
-type Discussion struct {
- ID string `json:"id"`
- IndividualNote bool `json:"individual_note"`
- Notes []*Note `json:"notes"`
-}
-
-func (d Discussion) String() string {
- return Stringify(d)
-}
-
-// ListIssueDiscussionsOptions represents the available ListIssueDiscussions()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-project-issue-discussion-items
-type ListIssueDiscussionsOptions ListOptions
-
-// ListIssueDiscussions gets a list of all discussions for a single
-// issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-project-issue-discussion-items
-func (s *DiscussionsService) ListIssueDiscussions(pid interface{}, issue int, opt *ListIssueDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/discussions", pathEscape(project), issue)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ds []*Discussion
- resp, err := s.client.Do(req, &ds)
- if err != nil {
- return nil, resp, err
- }
-
- return ds, resp, err
-}
-
-// GetIssueDiscussion returns a single discussion for a specific project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#get-single-issue-discussion-item
-func (s *DiscussionsService) GetIssueDiscussion(pid interface{}, issue int, discussion string, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/discussions/%s",
- pathEscape(project),
- issue,
- discussion,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// CreateIssueDiscussionOptions represents the available CreateIssueDiscussion()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-issue-thread
-type CreateIssueDiscussionOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// CreateIssueDiscussion creates a new discussion to a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-issue-thread
-func (s *DiscussionsService) CreateIssueDiscussion(pid interface{}, issue int, opt *CreateIssueDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/discussions", pathEscape(project), issue)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// AddIssueDiscussionNoteOptions represents the available AddIssueDiscussionNote()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-issue-thread
-type AddIssueDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// AddIssueDiscussionNote creates a new discussion to a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-issue-thread
-func (s *DiscussionsService) AddIssueDiscussionNote(pid interface{}, issue int, discussion string, opt *AddIssueDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/discussions/%s/notes",
- pathEscape(project),
- issue,
- discussion,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// UpdateIssueDiscussionNoteOptions represents the available
-// UpdateIssueDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-issue-thread-note
-type UpdateIssueDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// UpdateIssueDiscussionNote modifies existing discussion of an issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-issue-thread-note
-func (s *DiscussionsService) UpdateIssueDiscussionNote(pid interface{}, issue int, discussion string, note int, opt *UpdateIssueDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/discussions/%s/notes/%d",
- pathEscape(project),
- issue,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// DeleteIssueDiscussionNote deletes an existing discussion of an issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#delete-an-issue-thread-note
-func (s *DiscussionsService) DeleteIssueDiscussionNote(pid interface{}, issue int, discussion string, note int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/discussions/%s/notes/%d",
- pathEscape(project),
- issue,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListSnippetDiscussionsOptions represents the available ListSnippetDiscussions()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-project-snippet-discussion-items
-type ListSnippetDiscussionsOptions ListOptions
-
-// ListSnippetDiscussions gets a list of all discussions for a single
-// snippet. Snippet discussions are comments users can post to a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-project-snippet-discussion-items
-func (s *DiscussionsService) ListSnippetDiscussions(pid interface{}, snippet int, opt *ListSnippetDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/discussions", pathEscape(project), snippet)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ds []*Discussion
- resp, err := s.client.Do(req, &ds)
- if err != nil {
- return nil, resp, err
- }
-
- return ds, resp, err
-}
-
-// GetSnippetDiscussion returns a single discussion for a given snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#get-single-snippet-discussion-item
-func (s *DiscussionsService) GetSnippetDiscussion(pid interface{}, snippet int, discussion string, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/discussions/%s",
- pathEscape(project),
- snippet,
- discussion,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// CreateSnippetDiscussionOptions represents the available
-// CreateSnippetDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-snippet-thread
-type CreateSnippetDiscussionOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// CreateSnippetDiscussion creates a new discussion for a single snippet.
-// Snippet discussions are comments users can post to a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-snippet-thread
-func (s *DiscussionsService) CreateSnippetDiscussion(pid interface{}, snippet int, opt *CreateSnippetDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/discussions", pathEscape(project), snippet)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// AddSnippetDiscussionNoteOptions represents the available
-// AddSnippetDiscussionNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-snippet-thread
-type AddSnippetDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// AddSnippetDiscussionNote creates a new discussion to a single project
-// snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-snippet-thread
-func (s *DiscussionsService) AddSnippetDiscussionNote(pid interface{}, snippet int, discussion string, opt *AddSnippetDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/discussions/%s/notes",
- pathEscape(project),
- snippet,
- discussion,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// UpdateSnippetDiscussionNoteOptions represents the available
-// UpdateSnippetDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-snippet-thread-note
-type UpdateSnippetDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// UpdateSnippetDiscussionNote modifies existing discussion of a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-snippet-thread-note
-func (s *DiscussionsService) UpdateSnippetDiscussionNote(pid interface{}, snippet int, discussion string, note int, opt *UpdateSnippetDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/discussions/%s/notes/%d",
- pathEscape(project),
- snippet,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// DeleteSnippetDiscussionNote deletes an existing discussion of a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#delete-a-snippet-thread-note
-func (s *DiscussionsService) DeleteSnippetDiscussionNote(pid interface{}, snippet int, discussion string, note int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/discussions/%s/notes/%d",
- pathEscape(project),
- snippet,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListGroupEpicDiscussionsOptions represents the available
-// ListEpicDiscussions() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-group-epic-discussion-items
-type ListGroupEpicDiscussionsOptions ListOptions
-
-// ListGroupEpicDiscussions gets a list of all discussions for a single
-// epic. Epic discussions are comments users can post to a epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-group-epic-discussion-items
-func (s *DiscussionsService) ListGroupEpicDiscussions(gid interface{}, epic int, opt *ListGroupEpicDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/discussions",
- pathEscape(group),
- epic,
- )
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ds []*Discussion
- resp, err := s.client.Do(req, &ds)
- if err != nil {
- return nil, resp, err
- }
-
- return ds, resp, err
-}
-
-// GetEpicDiscussion returns a single discussion for a given epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#get-single-epic-discussion-item
-func (s *DiscussionsService) GetEpicDiscussion(gid interface{}, epic int, discussion string, options ...OptionFunc) (*Discussion, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/discussions/%s",
- pathEscape(group),
- epic,
- discussion,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// CreateEpicDiscussionOptions represents the available CreateEpicDiscussion()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-epic-thread
-type CreateEpicDiscussionOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// CreateEpicDiscussion creates a new discussion for a single epic. Epic
-// discussions are comments users can post to a epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-epic-thread
-func (s *DiscussionsService) CreateEpicDiscussion(gid interface{}, epic int, opt *CreateEpicDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/discussions",
- pathEscape(group),
- epic,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// AddEpicDiscussionNoteOptions represents the available
-// AddEpicDiscussionNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-epic-thread
-type AddEpicDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// AddEpicDiscussionNote creates a new discussion to a single project epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-epic-thread
-func (s *DiscussionsService) AddEpicDiscussionNote(gid interface{}, epic int, discussion string, opt *AddEpicDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/discussions/%s/notes",
- pathEscape(group),
- epic,
- discussion,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// UpdateEpicDiscussionNoteOptions represents the available UpdateEpicDiscussion()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-epic-thread-note
-type UpdateEpicDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// UpdateEpicDiscussionNote modifies existing discussion of a epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-epic-thread-note
-func (s *DiscussionsService) UpdateEpicDiscussionNote(gid interface{}, epic int, discussion string, note int, opt *UpdateEpicDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/discussions/%s/notes/%d",
- pathEscape(group),
- epic,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// DeleteEpicDiscussionNote deletes an existing discussion of a epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#delete-an-epic-thread-note
-func (s *DiscussionsService) DeleteEpicDiscussionNote(gid interface{}, epic int, discussion string, note int, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/discussions/%s/notes/%d",
- pathEscape(group),
- epic,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListMergeRequestDiscussionsOptions represents the available
-// ListMergeRequestDiscussions() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-project-merge-request-discussion-items
-type ListMergeRequestDiscussionsOptions ListOptions
-
-// ListMergeRequestDiscussions gets a list of all discussions for a single
-// merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-project-merge-request-discussion-items
-func (s *DiscussionsService) ListMergeRequestDiscussions(pid interface{}, mergeRequest int, opt *ListMergeRequestDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/discussions",
- pathEscape(project),
- mergeRequest,
- )
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ds []*Discussion
- resp, err := s.client.Do(req, &ds)
- if err != nil {
- return nil, resp, err
- }
-
- return ds, resp, err
-}
-
-// GetMergeRequestDiscussion returns a single discussion for a given merge
-// request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#get-single-merge-request-discussion-item
-func (s *DiscussionsService) GetMergeRequestDiscussion(pid interface{}, mergeRequest int, discussion string, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/discussions/%s",
- pathEscape(project),
- mergeRequest,
- discussion,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// CreateMergeRequestDiscussionOptions represents the available
-// CreateMergeRequestDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-merge-request-thread
-type CreateMergeRequestDiscussionOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
- Position *NotePosition `url:"position,omitempty" json:"position,omitempty"`
-}
-
-// CreateMergeRequestDiscussion creates a new discussion for a single merge
-// request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-merge-request-thread
-func (s *DiscussionsService) CreateMergeRequestDiscussion(pid interface{}, mergeRequest int, opt *CreateMergeRequestDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/discussions",
- pathEscape(project),
- mergeRequest,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// ResolveMergeRequestDiscussionOptions represents the available
-// ResolveMergeRequestDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#resolve-a-merge-request-thread
-type ResolveMergeRequestDiscussionOptions struct {
- Resolved *bool `url:"resolved,omitempty" json:"resolved,omitempty"`
-}
-
-// ResolveMergeRequestDiscussion resolves/unresolves whole discussion of a merge
-// request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#resolve-a-merge-request-thread
-func (s *DiscussionsService) ResolveMergeRequestDiscussion(pid interface{}, mergeRequest int, discussion string, opt *ResolveMergeRequestDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/discussions/%s",
- pathEscape(project),
- mergeRequest,
- discussion,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// AddMergeRequestDiscussionNoteOptions represents the available
-// AddMergeRequestDiscussionNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-merge-request-discussion
-type AddMergeRequestDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// AddMergeRequestDiscussionNote creates a new discussion to a single project
-// merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-merge-request-discussion
-func (s *DiscussionsService) AddMergeRequestDiscussionNote(pid interface{}, mergeRequest int, discussion string, opt *AddMergeRequestDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/discussions/%s/notes",
- pathEscape(project),
- mergeRequest,
- discussion,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// UpdateMergeRequestDiscussionNoteOptions represents the available
-// UpdateMergeRequestDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-merge-request-discussion-note
-type UpdateMergeRequestDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
- Resolved *bool `url:"resolved,omitempty" json:"resolved,omitempty"`
-}
-
-// UpdateMergeRequestDiscussionNote modifies existing discussion of a merge
-// request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-existing-merge-request-discussion-note
-func (s *DiscussionsService) UpdateMergeRequestDiscussionNote(pid interface{}, mergeRequest int, discussion string, note int, opt *UpdateMergeRequestDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/discussions/%s/notes/%d",
- pathEscape(project),
- mergeRequest,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// DeleteMergeRequestDiscussionNote deletes an existing discussion of a merge
-// request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#delete-a-merge-request-discussion-note
-func (s *DiscussionsService) DeleteMergeRequestDiscussionNote(pid interface{}, mergeRequest int, discussion string, note int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/discussions/%s/notes/%d",
- pathEscape(project),
- mergeRequest,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListCommitDiscussionsOptions represents the available
-// ListCommitDiscussions() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-project-commit-discussion-items
-type ListCommitDiscussionsOptions ListOptions
-
-// ListCommitDiscussions gets a list of all discussions for a single
-// commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#list-project-commit-discussion-items
-func (s *DiscussionsService) ListCommitDiscussions(pid interface{}, commit string, opt *ListCommitDiscussionsOptions, options ...OptionFunc) ([]*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/discussions",
- pathEscape(project),
- commit,
- )
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ds []*Discussion
- resp, err := s.client.Do(req, &ds)
- if err != nil {
- return nil, resp, err
- }
-
- return ds, resp, err
-}
-
-// GetCommitDiscussion returns a single discussion for a specific project
-// commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#get-single-commit-discussion-item
-func (s *DiscussionsService) GetCommitDiscussion(pid interface{}, commit string, discussion string, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/discussions/%s",
- pathEscape(project),
- commit,
- discussion,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// CreateCommitDiscussionOptions represents the available
-// CreateCommitDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-commit-thread
-type CreateCommitDiscussionOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
- Position *NotePosition `url:"position,omitempty" json:"position,omitempty"`
-}
-
-// CreateCommitDiscussion creates a new discussion to a single project commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#create-new-commit-thread
-func (s *DiscussionsService) CreateCommitDiscussion(pid interface{}, commit string, opt *CreateCommitDiscussionOptions, options ...OptionFunc) (*Discussion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/discussions",
- pathEscape(project),
- commit,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- d := new(Discussion)
- resp, err := s.client.Do(req, d)
- if err != nil {
- return nil, resp, err
- }
-
- return d, resp, err
-}
-
-// AddCommitDiscussionNoteOptions represents the available
-// AddCommitDiscussionNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-commit-thread
-type AddCommitDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// AddCommitDiscussionNote creates a new discussion to a single project commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#add-note-to-existing-commit-thread
-func (s *DiscussionsService) AddCommitDiscussionNote(pid interface{}, commit string, discussion string, opt *AddCommitDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/discussions/%s/notes",
- pathEscape(project),
- commit,
- discussion,
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// UpdateCommitDiscussionNoteOptions represents the available
-// UpdateCommitDiscussion() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-an-existing-commit-thread-note
-type UpdateCommitDiscussionNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// UpdateCommitDiscussionNote modifies existing discussion of an commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#modify-an-existing-commit-thread-note
-func (s *DiscussionsService) UpdateCommitDiscussionNote(pid interface{}, commit string, discussion string, note int, opt *UpdateCommitDiscussionNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/discussions/%s/notes/%d",
- pathEscape(project),
- commit,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// DeleteCommitDiscussionNote deletes an existing discussion of an commit.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/discussions.html#delete-a-commit-thread-note
-func (s *DiscussionsService) DeleteCommitDiscussionNote(pid interface{}, commit string, discussion string, note int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/commits/%s/discussions/%s/notes/%d",
- pathEscape(project),
- commit,
- discussion,
- note,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/environments.go b/vendor/github.com/xanzy/go-gitlab/environments.go
deleted file mode 100644
index 397c2d28..00000000
--- a/vendor/github.com/xanzy/go-gitlab/environments.go
+++ /dev/null
@@ -1,212 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
-)
-
-// EnvironmentsService handles communication with the environment related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/environments.html
-type EnvironmentsService struct {
- client *Client
-}
-
-// Environment represents a GitLab environment.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/environments.html
-type Environment struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Slug string `json:"slug"`
- State string `json:"state"`
- ExternalURL string `json:"external_url"`
- Project *Project `json:"project"`
- LastDeployment *Deployment `json:"last_deployment"`
-}
-
-func (env Environment) String() string {
- return Stringify(env)
-}
-
-// ListEnvironmentsOptions represents the available ListEnvironments() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/environments.html#list-environments
-type ListEnvironmentsOptions ListOptions
-
-// ListEnvironments gets a list of environments from a project, sorted by name
-// alphabetically.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/environments.html#list-environments
-func (s *EnvironmentsService) ListEnvironments(pid interface{}, opts *ListEnvironmentsOptions, options ...OptionFunc) ([]*Environment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/environments", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- var envs []*Environment
- resp, err := s.client.Do(req, &envs)
- if err != nil {
- return nil, resp, err
- }
-
- return envs, resp, err
-}
-
-// GetEnvironment gets a specific environment from a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/environments.html#get-a-specific-environment
-func (s *EnvironmentsService) GetEnvironment(pid interface{}, environment int, options ...OptionFunc) (*Environment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/environments/%d", pathEscape(project), environment)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- env := new(Environment)
- resp, err := s.client.Do(req, env)
- if err != nil {
- return nil, resp, err
- }
-
- return env, resp, err
-}
-
-// CreateEnvironmentOptions represents the available CreateEnvironment() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/environments.html#create-a-new-environment
-type CreateEnvironmentOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- ExternalURL *string `url:"external_url,omitempty" json:"external_url,omitempty"`
-}
-
-// CreateEnvironment adds an environment to a project. This is an idempotent
-// method and can be called multiple times with the same parameters. Createing
-// an environment that is already a environment does not affect the
-// existing environmentship.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/environments.html#create-a-new-environment
-func (s *EnvironmentsService) CreateEnvironment(pid interface{}, opt *CreateEnvironmentOptions, options ...OptionFunc) (*Environment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/environments", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- env := new(Environment)
- resp, err := s.client.Do(req, env)
- if err != nil {
- return nil, resp, err
- }
-
- return env, resp, err
-}
-
-// EditEnvironmentOptions represents the available EditEnvironment() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/environments.html#edit-an-existing-environment
-type EditEnvironmentOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- ExternalURL *string `url:"external_url,omitempty" json:"external_url,omitempty"`
-}
-
-// EditEnvironment updates a project team environment to a specified access level..
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/environments.html#edit-an-existing-environment
-func (s *EnvironmentsService) EditEnvironment(pid interface{}, environment int, opt *EditEnvironmentOptions, options ...OptionFunc) (*Environment, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/environments/%d", pathEscape(project), environment)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- env := new(Environment)
- resp, err := s.client.Do(req, env)
- if err != nil {
- return nil, resp, err
- }
-
- return env, resp, err
-}
-
-// DeleteEnvironment removes an environment from a project team.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/environments.html#remove-a-environment-from-a-group-or-project
-func (s *EnvironmentsService) DeleteEnvironment(pid interface{}, environment int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/environments/%d", pathEscape(project), environment)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// StopEnvironment stop an environment from a project team.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/environments.html#stop-an-environment
-func (s *EnvironmentsService) StopEnvironment(pid interface{}, environmentID int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/environments/%d/stop", pathEscape(project), environmentID)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/epics.go b/vendor/github.com/xanzy/go-gitlab/epics.go
deleted file mode 100644
index 1e93c8ec..00000000
--- a/vendor/github.com/xanzy/go-gitlab/epics.go
+++ /dev/null
@@ -1,211 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// EpicsService handles communication with the epic related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/epics.html
-type EpicsService struct {
- client *Client
-}
-
-// EpicAuthor represents a author of the epic.
-type EpicAuthor struct {
- ID int `json:"id"`
- State string `json:"state"`
- WebURL string `json:"web_url"`
- Name string `json:"name"`
- AvatarURL string `json:"avatar_url"`
- Username string `json:"username"`
-}
-
-// Epic represents a GitLab epic.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/epics.html
-type Epic struct {
- ID int `json:"id"`
- IID int `json:"iid"`
- GroupID int `json:"group_id"`
- Author *EpicAuthor `json:"author"`
- Description string `json:"description"`
- State string `json:"state"`
- Upvotes int `json:"upvotes"`
- Downvotes int `json:"downvotes"`
- Labels []string `json:"labels"`
- Title string `json:"title"`
- UpdatedAt *time.Time `json:"updated_at"`
- CreatedAt *time.Time `json:"created_at"`
- UserNotesCount int `json:"user_notes_count"`
- StartDate *ISOTime `json:"start_date"`
- StartDateIsFixed bool `json:"start_date_is_fixed"`
- StartDateFixed *ISOTime `json:"start_date_fixed"`
- StartDateFromMilestones *ISOTime `json:"start_date_from_milestones"`
- DueDate *ISOTime `json:"due_date"`
- DueDateIsFixed bool `json:"due_date_is_fixed"`
- DueDateFixed *ISOTime `json:"due_date_fixed"`
- DueDateFromMilestones *ISOTime `json:"due_date_from_milestones"`
-}
-
-func (e Epic) String() string {
- return Stringify(e)
-}
-
-// ListGroupEpicsOptions represents the available ListGroupEpics() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#list-epics-for-a-group
-type ListGroupEpicsOptions struct {
- ListOptions
- State *string `url:"state,omitempty" json:"state,omitempty"`
- Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
-}
-
-// ListGroupEpics gets a list of group epics. This function accepts pagination
-// parameters page and per_page to return the list of group epics.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#list-epics-for-a-group
-func (s *EpicsService) ListGroupEpics(gid interface{}, opt *ListGroupEpicsOptions, options ...OptionFunc) ([]*Epic, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var es []*Epic
- resp, err := s.client.Do(req, &es)
- if err != nil {
- return nil, resp, err
- }
-
- return es, resp, err
-}
-
-// GetEpic gets a single group epic.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#single-epic
-func (s *EpicsService) GetEpic(gid interface{}, epic int, options ...OptionFunc) (*Epic, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d", pathEscape(group), epic)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- e := new(Epic)
- resp, err := s.client.Do(req, e)
- if err != nil {
- return nil, resp, err
- }
-
- return e, resp, err
-}
-
-// CreateEpicOptions represents the available CreateEpic() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#new-epic
-type CreateEpicOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- StartDateIsFixed *bool `url:"start_date_is_fixed,omitempty" json:"start_date_is_fixed,omitempty"`
- StartDateFixed *ISOTime `url:"start_date_fixed,omitempty" json:"start_date_fixed,omitempty"`
- DueDateIsFixed *bool `url:"due_date_is_fixed,omitempty" json:"due_date_is_fixed,omitempty"`
- DueDateFixed *ISOTime `url:"due_date_fixed,omitempty" json:"due_date_fixed,omitempty"`
-}
-
-// CreateEpic creates a new group epic.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#new-epic
-func (s *EpicsService) CreateEpic(gid interface{}, opt *CreateEpicOptions, options ...OptionFunc) (*Epic, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics", pathEscape(group))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- e := new(Epic)
- resp, err := s.client.Do(req, e)
- if err != nil {
- return nil, resp, err
- }
-
- return e, resp, err
-}
-
-// UpdateEpicOptions represents the available UpdateEpic() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#update-epic
-type UpdateEpicOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- StartDateIsFixed *bool `url:"start_date_is_fixed,omitempty" json:"start_date_is_fixed,omitempty"`
- StartDateFixed *ISOTime `url:"start_date_fixed,omitempty" json:"start_date_fixed,omitempty"`
- DueDateIsFixed *bool `url:"due_date_is_fixed,omitempty" json:"due_date_is_fixed,omitempty"`
- DueDateFixed *ISOTime `url:"due_date_fixed,omitempty" json:"due_date_fixed,omitempty"`
- StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"`
-}
-
-// UpdateEpic updates an existing group epic. This function is also used
-// to mark an epic as closed.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#update-epic
-func (s *EpicsService) UpdateEpic(gid interface{}, epic int, opt *UpdateEpicOptions, options ...OptionFunc) (*Epic, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d", pathEscape(group), epic)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- e := new(Epic)
- resp, err := s.client.Do(req, e)
- if err != nil {
- return nil, resp, err
- }
-
- return e, resp, err
-}
-
-// DeleteEpic deletes a single group epic.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/epics.html#delete-epic
-func (s *EpicsService) DeleteEpic(gid interface{}, epic int, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d", pathEscape(group), epic)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/event_parsing.go b/vendor/github.com/xanzy/go-gitlab/event_parsing.go
deleted file mode 100644
index 7ac042ae..00000000
--- a/vendor/github.com/xanzy/go-gitlab/event_parsing.go
+++ /dev/null
@@ -1,117 +0,0 @@
-package gitlab
-
-import (
- "encoding/json"
- "fmt"
- "net/http"
-)
-
-// EventType represents a Gitlab event type.
-type EventType string
-
-// List of available event types.
-const (
- EventTypeBuild EventType = "Build Hook"
- EventTypeIssue EventType = "Issue Hook"
- EventTypeJob EventType = "Job Hook"
- EventTypeMergeRequest EventType = "Merge Request Hook"
- EventTypeNote EventType = "Note Hook"
- EventTypePipeline EventType = "Pipeline Hook"
- EventTypePush EventType = "Push Hook"
- EventTypeTagPush EventType = "Tag Push Hook"
- EventTypeWikiPage EventType = "Wiki Page Hook"
-)
-
-const (
- noteableTypeCommit = "Commit"
- noteableTypeMergeRequest = "MergeRequest"
- noteableTypeIssue = "Issue"
- noteableTypeSnippet = "Snippet"
-)
-
-type noteEvent struct {
- ObjectKind string `json:"object_kind"`
- ObjectAttributes struct {
- NoteableType string `json:"noteable_type"`
- } `json:"object_attributes"`
-}
-
-const eventTypeHeader = "X-Gitlab-Event"
-
-// WebhookEventType returns the event type for the given request.
-func WebhookEventType(r *http.Request) EventType {
- return EventType(r.Header.Get(eventTypeHeader))
-}
-
-// ParseWebhook parses the event payload. For recognized event types, a
-// value of the corresponding struct type will be returned. An error will
-// be returned for unrecognized event types.
-//
-// Example usage:
-//
-// func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
-// payload, err := ioutil.ReadAll(r.Body)
-// if err != nil { ... }
-// event, err := gitlab.ParseWebhook(gitlab.WebhookEventType(r), payload)
-// if err != nil { ... }
-// switch event := event.(type) {
-// case *gitlab.PushEvent:
-// processPushEvent(event)
-// case *gitlab.MergeEvent:
-// processMergeEvent(event)
-// ...
-// }
-// }
-//
-func ParseWebhook(eventType EventType, payload []byte) (event interface{}, err error) {
- switch eventType {
- case EventTypeBuild:
- event = &BuildEvent{}
- case EventTypeIssue:
- event = &IssueEvent{}
- case EventTypeJob:
- event = &JobEvent{}
- case EventTypeMergeRequest:
- event = &MergeEvent{}
- case EventTypePipeline:
- event = &PipelineEvent{}
- case EventTypePush:
- event = &PushEvent{}
- case EventTypeTagPush:
- event = &TagEvent{}
- case EventTypeWikiPage:
- event = &WikiPageEvent{}
- case EventTypeNote:
- note := &noteEvent{}
- err := json.Unmarshal(payload, note)
- if err != nil {
- return nil, err
- }
-
- if note.ObjectKind != "note" {
- return nil, fmt.Errorf("unexpected object kind %s", note.ObjectKind)
- }
-
- switch note.ObjectAttributes.NoteableType {
- case noteableTypeCommit:
- event = &CommitCommentEvent{}
- case noteableTypeMergeRequest:
- event = &MergeCommentEvent{}
- case noteableTypeIssue:
- event = &IssueCommentEvent{}
- case noteableTypeSnippet:
- event = &SnippetCommentEvent{}
- default:
- return nil, fmt.Errorf("unexpected noteable type %s", note.ObjectAttributes.NoteableType)
- }
-
- default:
- return nil, fmt.Errorf("unexpected event type: %s", eventType)
- }
-
- if err := json.Unmarshal(payload, event); err != nil {
- return nil, err
- }
-
- return event, nil
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/event_types.go b/vendor/github.com/xanzy/go-gitlab/event_types.go
deleted file mode 100644
index ae04a049..00000000
--- a/vendor/github.com/xanzy/go-gitlab/event_types.go
+++ /dev/null
@@ -1,815 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "encoding/json"
- "fmt"
- "strconv"
- "time"
-)
-
-// PushEvent represents a push event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#push-events
-type PushEvent struct {
- ObjectKind string `json:"object_kind"`
- Before string `json:"before"`
- After string `json:"after"`
- Ref string `json:"ref"`
- CheckoutSHA string `json:"checkout_sha"`
- UserID int `json:"user_id"`
- UserName string `json:"user_name"`
- UserUsername string `json:"user_username"`
- UserEmail string `json:"user_email"`
- UserAvatar string `json:"user_avatar"`
- ProjectID int `json:"project_id"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Repository *Repository `json:"repository"`
- Commits []*struct {
- ID string `json:"id"`
- Message string `json:"message"`
- Timestamp *time.Time `json:"timestamp"`
- URL string `json:"url"`
- Author struct {
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"author"`
- Added []string `json:"added"`
- Modified []string `json:"modified"`
- Removed []string `json:"removed"`
- } `json:"commits"`
- TotalCommitsCount int `json:"total_commits_count"`
-}
-
-// TagEvent represents a tag event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#tag-events
-type TagEvent struct {
- ObjectKind string `json:"object_kind"`
- Before string `json:"before"`
- After string `json:"after"`
- Ref string `json:"ref"`
- CheckoutSHA string `json:"checkout_sha"`
- UserID int `json:"user_id"`
- UserName string `json:"user_name"`
- UserAvatar string `json:"user_avatar"`
- ProjectID int `json:"project_id"`
- Message string `json:"message"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Repository *Repository `json:"repository"`
- Commits []*struct {
- ID string `json:"id"`
- Message string `json:"message"`
- Timestamp *time.Time `json:"timestamp"`
- URL string `json:"url"`
- Author struct {
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"author"`
- Added []string `json:"added"`
- Modified []string `json:"modified"`
- Removed []string `json:"removed"`
- } `json:"commits"`
- TotalCommitsCount int `json:"total_commits_count"`
-}
-
-// IssueEvent represents a issue event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#issues-events
-type IssueEvent struct {
- ObjectKind string `json:"object_kind"`
- User *User `json:"user"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Repository *Repository `json:"repository"`
- ObjectAttributes struct {
- ID int `json:"id"`
- Title string `json:"title"`
- AssigneeID int `json:"assignee_id"`
- AuthorID int `json:"author_id"`
- ProjectID int `json:"project_id"`
- CreatedAt string `json:"created_at"` // Should be *time.Time (see Gitlab issue #21468)
- UpdatedAt string `json:"updated_at"` // Should be *time.Time (see Gitlab issue #21468)
- Position int `json:"position"`
- BranchName string `json:"branch_name"`
- Description string `json:"description"`
- MilestoneID int `json:"milestone_id"`
- State string `json:"state"`
- IID int `json:"iid"`
- URL string `json:"url"`
- Action string `json:"action"`
- } `json:"object_attributes"`
- Assignee struct {
- Name string `json:"name"`
- Username string `json:"username"`
- AvatarURL string `json:"avatar_url"`
- } `json:"assignee"`
- Assignees []struct {
- Name string `json:"name"`
- Username string `json:"username"`
- AvatarURL string `json:"avatar_url"`
- } `json:"assignees"`
- Labels []Label `json:"labels"`
- Changes struct {
- Labels struct {
- Previous []Label `json:"previous"`
- Current []Label `json:"current"`
- } `json:"labels"`
- UpdatedByID struct {
- Previous int `json:"previous"`
- Current int `json:"current"`
- } `json:"updated_by_id"`
- } `json:"changes"`
-}
-
-// JobEvent represents a job event.
-//
-// GitLab API docs:
-// TODO: link to docs instead of src once they are published.
-// https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/gitlab/data_builder/build.rb
-type JobEvent struct {
- ObjectKind string `json:"object_kind"`
- Ref string `json:"ref"`
- Tag bool `json:"tag"`
- BeforeSHA string `json:"before_sha"`
- SHA string `json:"sha"`
- BuildID int `json:"build_id"`
- BuildName string `json:"build_name"`
- BuildStage string `json:"build_stage"`
- BuildStatus string `json:"build_status"`
- BuildStartedAt string `json:"build_started_at"`
- BuildFinishedAt string `json:"build_finished_at"`
- BuildDuration float64 `json:"build_duration"`
- BuildAllowFailure bool `json:"build_allow_failure"`
- ProjectID int `json:"project_id"`
- ProjectName string `json:"project_name"`
- User struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"user"`
- Commit struct {
- ID int `json:"id"`
- SHA string `json:"sha"`
- Message string `json:"message"`
- AuthorName string `json:"author_name"`
- AuthorEmail string `json:"author_email"`
- AuthorURL string `json:"author_url"`
- Status string `json:"status"`
- Duration int `json:"duration"`
- StartedAt string `json:"started_at"`
- FinishedAt string `json:"finished_at"`
- } `json:"commit"`
- Repository *Repository `json:"repository"`
-}
-
-// CommitCommentEvent represents a comment on a commit event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#comment-on-commit
-type CommitCommentEvent struct {
- ObjectKind string `json:"object_kind"`
- User *User `json:"user"`
- ProjectID int `json:"project_id"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Repository *Repository `json:"repository"`
- ObjectAttributes struct {
- ID int `json:"id"`
- Note string `json:"note"`
- NoteableType string `json:"noteable_type"`
- AuthorID int `json:"author_id"`
- CreatedAt string `json:"created_at"`
- UpdatedAt string `json:"updated_at"`
- ProjectID int `json:"project_id"`
- Attachment string `json:"attachment"`
- LineCode string `json:"line_code"`
- CommitID string `json:"commit_id"`
- NoteableID int `json:"noteable_id"`
- System bool `json:"system"`
- StDiff struct {
- Diff string `json:"diff"`
- NewPath string `json:"new_path"`
- OldPath string `json:"old_path"`
- AMode string `json:"a_mode"`
- BMode string `json:"b_mode"`
- NewFile bool `json:"new_file"`
- RenamedFile bool `json:"renamed_file"`
- DeletedFile bool `json:"deleted_file"`
- } `json:"st_diff"`
- } `json:"object_attributes"`
- Commit *struct {
- ID string `json:"id"`
- Message string `json:"message"`
- Timestamp *time.Time `json:"timestamp"`
- URL string `json:"url"`
- Author struct {
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"author"`
- } `json:"commit"`
-}
-
-// MergeCommentEvent represents a comment on a merge event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#comment-on-merge-request
-type MergeCommentEvent struct {
- ObjectKind string `json:"object_kind"`
- User *User `json:"user"`
- ProjectID int `json:"project_id"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- ObjectAttributes struct {
- ID int `json:"id"`
- DiscussionID string `json:"discussion_id"`
- Note string `json:"note"`
- NoteableType string `json:"noteable_type"`
- AuthorID int `json:"author_id"`
- CreatedAt string `json:"created_at"`
- UpdatedAt string `json:"updated_at"`
- ProjectID int `json:"project_id"`
- Attachment string `json:"attachment"`
- LineCode string `json:"line_code"`
- CommitID string `json:"commit_id"`
- NoteableID int `json:"noteable_id"`
- System bool `json:"system"`
- StDiff *Diff `json:"st_diff"`
- URL string `json:"url"`
- } `json:"object_attributes"`
- Repository *Repository `json:"repository"`
- MergeRequest struct {
- ID int `json:"id"`
- TargetBranch string `json:"target_branch"`
- SourceBranch string `json:"source_branch"`
- SourceProjectID int `json:"source_project_id"`
- AuthorID int `json:"author_id"`
- AssigneeID int `json:"assignee_id"`
- Title string `json:"title"`
- CreatedAt string `json:"created_at"`
- UpdatedAt string `json:"updated_at"`
- MilestoneID int `json:"milestone_id"`
- State string `json:"state"`
- MergeStatus string `json:"merge_status"`
- TargetProjectID int `json:"target_project_id"`
- IID int `json:"iid"`
- Description string `json:"description"`
- Position int `json:"position"`
- LockedAt string `json:"locked_at"`
- UpdatedByID int `json:"updated_by_id"`
- MergeError string `json:"merge_error"`
- MergeParams struct {
- ForceRemoveSourceBranch string `json:"force_remove_source_branch"`
- } `json:"merge_params"`
- MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"`
- MergeUserID int `json:"merge_user_id"`
- MergeCommitSHA string `json:"merge_commit_sha"`
- DeletedAt string `json:"deleted_at"`
- InProgressMergeCommitSHA string `json:"in_progress_merge_commit_sha"`
- LockVersion int `json:"lock_version"`
- ApprovalsBeforeMerge string `json:"approvals_before_merge"`
- RebaseCommitSHA string `json:"rebase_commit_sha"`
- TimeEstimate int `json:"time_estimate"`
- Squash bool `json:"squash"`
- LastEditedAt string `json:"last_edited_at"`
- LastEditedByID int `json:"last_edited_by_id"`
- Source *Repository `json:"source"`
- Target *Repository `json:"target"`
- LastCommit struct {
- ID string `json:"id"`
- Message string `json:"message"`
- Timestamp *time.Time `json:"timestamp"`
- URL string `json:"url"`
- Author struct {
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"author"`
- } `json:"last_commit"`
- WorkInProgress bool `json:"work_in_progress"`
- TotalTimeSpent int `json:"total_time_spent"`
- HeadPipelineID int `json:"head_pipeline_id"`
- } `json:"merge_request"`
-}
-
-// IssueCommentEvent represents a comment on an issue event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#comment-on-issue
-type IssueCommentEvent struct {
- ObjectKind string `json:"object_kind"`
- User *User `json:"user"`
- ProjectID int `json:"project_id"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Repository *Repository `json:"repository"`
- ObjectAttributes struct {
- ID int `json:"id"`
- Note string `json:"note"`
- NoteableType string `json:"noteable_type"`
- AuthorID int `json:"author_id"`
- CreatedAt string `json:"created_at"`
- UpdatedAt string `json:"updated_at"`
- ProjectID int `json:"project_id"`
- Attachment string `json:"attachment"`
- LineCode string `json:"line_code"`
- CommitID string `json:"commit_id"`
- NoteableID int `json:"noteable_id"`
- System bool `json:"system"`
- StDiff []*Diff `json:"st_diff"`
- URL string `json:"url"`
- } `json:"object_attributes"`
- Issue struct {
- ID int `json:"id"`
- IID int `json:"iid"`
- ProjectID int `json:"project_id"`
- MilestoneID int `json:"milestone_id"`
- AuthorID int `json:"author_id"`
- Description string `json:"description"`
- State string `json:"state"`
- Title string `json:"title"`
- LastEditedAt string `json:"last_edit_at"`
- LastEditedByID int `json:"last_edited_by_id"`
- UpdatedAt string `json:"updated_at"`
- UpdatedByID int `json:"updated_by_id"`
- CreatedAt string `json:"created_at"`
- ClosedAt string `json:"closed_at"`
- DueDate *ISOTime `json:"due_date"`
- URL string `json:"url"`
- TimeEstimate int `json:"time_estimate"`
- Confidential bool `json:"confidential"`
- TotalTimeSpent int `json:"total_time_spent"`
- HumanTotalTimeSpent int `json:"human_total_time_spent"`
- HumanTimeEstimate int `json:"human_time_estimate"`
- AssigneeIDs []int `json:"assignee_ids"`
- AssigneeID int `json:"assignee_id"`
- } `json:"issue"`
-}
-
-// SnippetCommentEvent represents a comment on a snippet event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#comment-on-code-snippet
-type SnippetCommentEvent struct {
- ObjectKind string `json:"object_kind"`
- User *User `json:"user"`
- ProjectID int `json:"project_id"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Repository *Repository `json:"repository"`
- ObjectAttributes struct {
- ID int `json:"id"`
- Note string `json:"note"`
- NoteableType string `json:"noteable_type"`
- AuthorID int `json:"author_id"`
- CreatedAt string `json:"created_at"`
- UpdatedAt string `json:"updated_at"`
- ProjectID int `json:"project_id"`
- Attachment string `json:"attachment"`
- LineCode string `json:"line_code"`
- CommitID string `json:"commit_id"`
- NoteableID int `json:"noteable_id"`
- System bool `json:"system"`
- StDiff *Diff `json:"st_diff"`
- URL string `json:"url"`
- } `json:"object_attributes"`
- Snippet *Snippet `json:"snippet"`
-}
-
-// MergeEvent represents a merge event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#merge-request-events
-type MergeEvent struct {
- ObjectKind string `json:"object_kind"`
- User *User `json:"user"`
- Project struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- ObjectAttributes struct {
- ID int `json:"id"`
- TargetBranch string `json:"target_branch"`
- SourceBranch string `json:"source_branch"`
- SourceProjectID int `json:"source_project_id"`
- AuthorID int `json:"author_id"`
- AssigneeID int `json:"assignee_id"`
- Title string `json:"title"`
- CreatedAt string `json:"created_at"` // Should be *time.Time (see Gitlab issue #21468)
- UpdatedAt string `json:"updated_at"` // Should be *time.Time (see Gitlab issue #21468)
- StCommits []*Commit `json:"st_commits"`
- StDiffs []*Diff `json:"st_diffs"`
- MilestoneID int `json:"milestone_id"`
- State string `json:"state"`
- MergeStatus string `json:"merge_status"`
- TargetProjectID int `json:"target_project_id"`
- IID int `json:"iid"`
- Description string `json:"description"`
- Position int `json:"position"`
- LockedAt string `json:"locked_at"`
- UpdatedByID int `json:"updated_by_id"`
- MergeError string `json:"merge_error"`
- MergeParams *MergeParams `json:"merge_params"`
- MergeWhenBuildSucceeds bool `json:"merge_when_build_succeeds"`
- MergeUserID int `json:"merge_user_id"`
- MergeCommitSHA string `json:"merge_commit_sha"`
- DeletedAt string `json:"deleted_at"`
- ApprovalsBeforeMerge string `json:"approvals_before_merge"`
- RebaseCommitSHA string `json:"rebase_commit_sha"`
- InProgressMergeCommitSHA string `json:"in_progress_merge_commit_sha"`
- LockVersion int `json:"lock_version"`
- TimeEstimate int `json:"time_estimate"`
- Source *Repository `json:"source"`
- Target *Repository `json:"target"`
- LastCommit struct {
- ID string `json:"id"`
- Message string `json:"message"`
- Timestamp *time.Time `json:"timestamp"`
- URL string `json:"url"`
- Author struct {
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"author"`
- } `json:"last_commit"`
- WorkInProgress bool `json:"work_in_progress"`
- URL string `json:"url"`
- Action string `json:"action"`
- OldRev string `json:"oldrev"`
- Assignee MergeAssignee `json:"assignee"`
- } `json:"object_attributes"`
- Repository *Repository `json:"repository"`
- Assignee MergeAssignee `json:"assignee"`
- Labels []Label `json:"labels"`
- Changes struct {
- Assignees struct {
- Previous []MergeAssignee `json:"previous"`
- Current []MergeAssignee `json:"current"`
- } `json:"assignees"`
- Description struct {
- Previous string `json:"previous"`
- Current string `json:"current"`
- } `json:"description"`
- Labels struct {
- Previous []Label `json:"previous"`
- Current []Label `json:"current"`
- } `json:"labels"`
- SourceBranch struct {
- Previous string `json:"previous"`
- Current string `json:"current"`
- } `json:"source_branch"`
- SourceProjectID struct {
- Previous int `json:"previous"`
- Current int `json:"current"`
- } `json:"source_project_id"`
- TargetBranch struct {
- Previous string `json:"previous"`
- Current string `json:"current"`
- } `json:"target_branch"`
- TargetProjectID struct {
- Previous int `json:"previous"`
- Current int `json:"current"`
- } `json:"target_project_id"`
- Title struct {
- Previous string `json:"previous"`
- Current string `json:"current"`
- } `json:"title"`
- UpdatedByID struct {
- Previous int `json:"previous"`
- Current int `json:"current"`
- } `json:"updated_by_id"`
- } `json:"changes"`
-}
-
-// MergeAssignee represents a merge assignee.
-type MergeAssignee struct {
- Name string `json:"name"`
- Username string `json:"username"`
- AvatarURL string `json:"avatar_url"`
-}
-
-// MergeParams represents the merge params.
-type MergeParams struct {
- ForceRemoveSourceBranch bool `json:"force_remove_source_branch"`
-}
-
-// UnmarshalJSON decodes the merge parameters
-//
-// This allows support of ForceRemoveSourceBranch for both type bool (>11.9) and string (<11.9)
-func (p *MergeParams) UnmarshalJSON(b []byte) error {
- type Alias MergeParams
- raw := struct {
- *Alias
- ForceRemoveSourceBranch interface{} `json:"force_remove_source_branch"`
- }{
- Alias: (*Alias)(p),
- }
-
- err := json.Unmarshal(b, &raw)
- if err != nil {
- return err
- }
-
- switch v := raw.ForceRemoveSourceBranch.(type) {
- case nil:
- // No action needed.
- case bool:
- p.ForceRemoveSourceBranch = v
- case string:
- p.ForceRemoveSourceBranch, err = strconv.ParseBool(v)
- if err != nil {
- return err
- }
- default:
- return fmt.Errorf("failed to unmarshal ForceRemoveSourceBranch of type: %T", v)
- }
-
- return nil
-}
-
-// WikiPageEvent represents a wiki page event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#wiki-page-events
-type WikiPageEvent struct {
- ObjectKind string `json:"object_kind"`
- User *User `json:"user"`
- Project struct {
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Wiki struct {
- WebURL string `json:"web_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- } `json:"wiki"`
- ObjectAttributes struct {
- Title string `json:"title"`
- Content string `json:"content"`
- Format string `json:"format"`
- Message string `json:"message"`
- Slug string `json:"slug"`
- URL string `json:"url"`
- Action string `json:"action"`
- } `json:"object_attributes"`
-}
-
-// PipelineEvent represents a pipeline event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#pipeline-events
-type PipelineEvent struct {
- ObjectKind string `json:"object_kind"`
- ObjectAttributes struct {
- ID int `json:"id"`
- Ref string `json:"ref"`
- Tag bool `json:"tag"`
- SHA string `json:"sha"`
- BeforeSHA string `json:"before_sha"`
- Status string `json:"status"`
- Stages []string `json:"stages"`
- CreatedAt string `json:"created_at"`
- FinishedAt string `json:"finished_at"`
- Duration int `json:"duration"`
- } `json:"object_attributes"`
- User struct {
- Name string `json:"name"`
- Username string `json:"username"`
- AvatarURL string `json:"avatar_url"`
- } `json:"user"`
- Project struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Description string `json:"description"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
- WebURL string `json:"web_url"`
- Visibility VisibilityValue `json:"visibility"`
- } `json:"project"`
- Commit struct {
- ID string `json:"id"`
- Message string `json:"message"`
- Timestamp *time.Time `json:"timestamp"`
- URL string `json:"url"`
- Author struct {
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"author"`
- } `json:"commit"`
- Builds []struct {
- ID int `json:"id"`
- Stage string `json:"stage"`
- Name string `json:"name"`
- Status string `json:"status"`
- CreatedAt string `json:"created_at"`
- StartedAt string `json:"started_at"`
- FinishedAt string `json:"finished_at"`
- When string `json:"when"`
- Manual bool `json:"manual"`
- User struct {
- Name string `json:"name"`
- Username string `json:"username"`
- AvatarURL string `json:"avatar_url"`
- } `json:"user"`
- Runner struct {
- ID int `json:"id"`
- Description string `json:"description"`
- Active bool `json:"active"`
- IsShared bool `json:"is_shared"`
- } `json:"runner"`
- ArtifactsFile struct {
- Filename string `json:"filename"`
- Size int `json:"size"`
- } `json:"artifacts_file"`
- } `json:"builds"`
-}
-
-//BuildEvent represents a build event
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/user/project/integrations/webhooks.html#build-events
-type BuildEvent struct {
- ObjectKind string `json:"object_kind"`
- Ref string `json:"ref"`
- Tag bool `json:"tag"`
- BeforeSHA string `json:"before_sha"`
- SHA string `json:"sha"`
- BuildID int `json:"build_id"`
- BuildName string `json:"build_name"`
- BuildStage string `json:"build_stage"`
- BuildStatus string `json:"build_status"`
- BuildStartedAt string `json:"build_started_at"`
- BuildFinishedAt string `json:"build_finished_at"`
- BuildDuration float64 `json:"build_duration"`
- BuildAllowFailure bool `json:"build_allow_failure"`
- ProjectID int `json:"project_id"`
- ProjectName string `json:"project_name"`
- User struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"user"`
- Commit struct {
- ID int `json:"id"`
- SHA string `json:"sha"`
- Message string `json:"message"`
- AuthorName string `json:"author_name"`
- AuthorEmail string `json:"author_email"`
- Status string `json:"status"`
- Duration int `json:"duration"`
- StartedAt string `json:"started_at"`
- FinishedAt string `json:"finished_at"`
- } `json:"commit"`
- Repository *Repository `json:"repository"`
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/events.go b/vendor/github.com/xanzy/go-gitlab/events.go
deleted file mode 100644
index 821b19d0..00000000
--- a/vendor/github.com/xanzy/go-gitlab/events.go
+++ /dev/null
@@ -1,146 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// EventsService handles communication with the event related methods of
-// the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/events.html
-type EventsService struct {
- client *Client
-}
-
-// ContributionEvent represents a user's contribution
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/events.html#get-user-contribution-events
-type ContributionEvent struct {
- Title string `json:"title"`
- ProjectID int `json:"project_id"`
- ActionName string `json:"action_name"`
- TargetID int `json:"target_id"`
- TargetIID int `json:"target_iid"`
- TargetType string `json:"target_type"`
- AuthorID int `json:"author_id"`
- TargetTitle string `json:"target_title"`
- CreatedAt *time.Time `json:"created_at"`
- PushData struct {
- CommitCount int `json:"commit_count"`
- Action string `json:"action"`
- RefType string `json:"ref_type"`
- CommitFrom string `json:"commit_from"`
- CommitTo string `json:"commit_to"`
- Ref string `json:"ref"`
- CommitTitle string `json:"commit_title"`
- } `json:"push_data"`
- Note *Note `json:"note"`
- Author struct {
- Name string `json:"name"`
- Username string `json:"username"`
- ID int `json:"id"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"author"`
- AuthorUsername string `json:"author_username"`
-}
-
-// ListContributionEventsOptions represents the options for GetUserContributionEvents
-//
-// GitLap API docs:
-// https://docs.gitlab.com/ce/api/events.html#get-user-contribution-events
-type ListContributionEventsOptions struct {
- ListOptions
- Action *EventTypeValue `url:"action,omitempty" json:"action,omitempty"`
- TargetType *EventTargetTypeValue `url:"target_type,omitempty" json:"target_type,omitempty"`
- Before *ISOTime `url:"before,omitempty" json:"before,omitempty"`
- After *ISOTime `url:"after,omitempty" json:"after,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
-}
-
-// ListUserContributionEvents retrieves user contribution events
-// for the specified user, sorted from newest to oldest.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/events.html#get-user-contribution-events
-func (s *UsersService) ListUserContributionEvents(uid interface{}, opt *ListContributionEventsOptions, options ...OptionFunc) ([]*ContributionEvent, *Response, error) {
- user, err := parseID(uid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("users/%s/events", user)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cs []*ContributionEvent
- resp, err := s.client.Do(req, &cs)
- if err != nil {
- return nil, resp, err
- }
-
- return cs, resp, err
-}
-
-// ListCurrentUserContributionEvents gets a list currently authenticated user's events
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/events.html#list-currently-authenticated-user-39-s-events
-func (s *EventsService) ListCurrentUserContributionEvents(opt *ListContributionEventsOptions, options ...OptionFunc) ([]*ContributionEvent, *Response, error) {
- req, err := s.client.NewRequest("GET", "events", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cs []*ContributionEvent
- resp, err := s.client.Do(req, &cs)
- if err != nil {
- return nil, resp, err
- }
-
- return cs, resp, err
-}
-
-// ListProjectVisibleEvents gets a list of visible events for a particular project
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/events.html#list-a-project-s-visible-events
-func (s *EventsService) ListProjectVisibleEvents(pid interface{}, opt *ListContributionEventsOptions, options ...OptionFunc) ([]*ContributionEvent, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/events", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var cs []*ContributionEvent
- resp, err := s.client.Do(req, &cs)
- if err != nil {
- return nil, resp, err
- }
-
- return cs, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/feature_flags.go b/vendor/github.com/xanzy/go-gitlab/feature_flags.go
deleted file mode 100644
index 1b5df5fa..00000000
--- a/vendor/github.com/xanzy/go-gitlab/feature_flags.go
+++ /dev/null
@@ -1,79 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// FeaturesService handles the communication with the application FeaturesService
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/features.html
-type FeaturesService struct {
- client *Client
-}
-
-// Feature represents a GitLab feature flag.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/features.html
-type Feature struct {
- Name string `json:"name"`
- State string `json:"state"`
- Gates []Gate
-}
-
-// Gate represents a gate of a GitLab feature flag.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/features.html
-type Gate struct {
- Key string `json:"key"`
- Value interface{} `json:"value"`
-}
-
-func (f Feature) String() string {
- return Stringify(f)
-}
-
-// ListFeatures gets a list of feature flags
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/features.html#list-all-features
-func (s *FeaturesService) ListFeatures(options ...OptionFunc) ([]*Feature, *Response, error) {
- req, err := s.client.NewRequest("GET", "features", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var f []*Feature
- resp, err := s.client.Do(req, &f)
- if err != nil {
- return nil, resp, err
- }
- return f, resp, err
-}
-
-// SetFeatureFlag sets or creates a feature flag gate
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/features.html#set-or-create-a-feature
-func (s *FeaturesService) SetFeatureFlag(name string, value interface{}, options ...OptionFunc) (*Feature, *Response, error) {
- u := fmt.Sprintf("features/%s", url.PathEscape(name))
-
- opt := struct {
- Value interface{} `url:"value" json:"value"`
- }{
- value,
- }
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- f := &Feature{}
- resp, err := s.client.Do(req, f)
- if err != nil {
- return nil, resp, err
- }
- return f, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/gitignore_templates.go b/vendor/github.com/xanzy/go-gitlab/gitignore_templates.go
deleted file mode 100644
index 1f5e83af..00000000
--- a/vendor/github.com/xanzy/go-gitlab/gitignore_templates.go
+++ /dev/null
@@ -1,84 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// GitIgnoreTemplatesService handles communication with the gitignore
-// templates related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/templates/gitignores.html
-type GitIgnoreTemplatesService struct {
- client *Client
-}
-
-// GitIgnoreTemplate represents a GitLab gitignore template.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/templates/gitignores.html
-type GitIgnoreTemplate struct {
- Name string `json:"name"`
- Content string `json:"content"`
-}
-
-// ListTemplatesOptions represents the available ListAllTemplates() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitignores.html#list-gitignore-templates
-type ListTemplatesOptions ListOptions
-
-// ListTemplates get a list of available git ignore templates
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitignores.html#list-gitignore-templates
-func (s *GitIgnoreTemplatesService) ListTemplates(opt *ListTemplatesOptions, options ...OptionFunc) ([]*GitIgnoreTemplate, *Response, error) {
- req, err := s.client.NewRequest("GET", "templates/gitignores", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var gs []*GitIgnoreTemplate
- resp, err := s.client.Do(req, &gs)
- if err != nil {
- return nil, resp, err
- }
-
- return gs, resp, err
-}
-
-// GetTemplate get a git ignore template
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/gitignores.html#single-gitignore-template
-func (s *GitIgnoreTemplatesService) GetTemplate(key string, options ...OptionFunc) (*GitIgnoreTemplate, *Response, error) {
- u := fmt.Sprintf("templates/gitignores/%s", url.PathEscape(key))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- g := new(GitIgnoreTemplate)
- resp, err := s.client.Do(req, g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/gitlab.go b/vendor/github.com/xanzy/go-gitlab/gitlab.go
deleted file mode 100644
index b8c951c5..00000000
--- a/vendor/github.com/xanzy/go-gitlab/gitlab.go
+++ /dev/null
@@ -1,955 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// Package gitlab implements a GitLab API client.
-package gitlab
-
-import (
- "bytes"
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "io"
- "io/ioutil"
- "net/http"
- "net/url"
- "sort"
- "strconv"
- "strings"
- "time"
-
- "github.com/google/go-querystring/query"
- "golang.org/x/oauth2"
-)
-
-const (
- defaultBaseURL = "https://gitlab.com/"
- apiVersionPath = "api/v4/"
- userAgent = "go-gitlab"
-)
-
-// authType represents an authentication type within GitLab.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/
-type authType int
-
-// List of available authentication types.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/
-const (
- basicAuth authType = iota
- oAuthToken
- privateToken
-)
-
-// AccessLevelValue represents a permission level within GitLab.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/permissions/permissions.html
-type AccessLevelValue int
-
-// List of available access levels
-//
-// GitLab API docs: https://docs.gitlab.com/ce/permissions/permissions.html
-const (
- NoPermissions AccessLevelValue = 0
- GuestPermissions AccessLevelValue = 10
- ReporterPermissions AccessLevelValue = 20
- DeveloperPermissions AccessLevelValue = 30
- MaintainerPermissions AccessLevelValue = 40
- OwnerPermissions AccessLevelValue = 50
-
- // These are deprecated and should be removed in a future version
- MasterPermissions AccessLevelValue = 40
- OwnerPermission AccessLevelValue = 50
-)
-
-// BuildStateValue represents a GitLab build state.
-type BuildStateValue string
-
-// These constants represent all valid build states.
-const (
- Pending BuildStateValue = "pending"
- Running BuildStateValue = "running"
- Success BuildStateValue = "success"
- Failed BuildStateValue = "failed"
- Canceled BuildStateValue = "canceled"
- Skipped BuildStateValue = "skipped"
- Manual BuildStateValue = "manual"
-)
-
-// ISOTime represents an ISO 8601 formatted date
-type ISOTime time.Time
-
-// ISO 8601 date format
-const iso8601 = "2006-01-02"
-
-// MarshalJSON implements the json.Marshaler interface
-func (t ISOTime) MarshalJSON() ([]byte, error) {
- if y := time.Time(t).Year(); y < 0 || y >= 10000 {
- // ISO 8901 uses 4 digits for the years
- return nil, errors.New("json: ISOTime year outside of range [0,9999]")
- }
-
- b := make([]byte, 0, len(iso8601)+2)
- b = append(b, '"')
- b = time.Time(t).AppendFormat(b, iso8601)
- b = append(b, '"')
-
- return b, nil
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface
-func (t *ISOTime) UnmarshalJSON(data []byte) error {
- // Ignore null, like in the main JSON package
- if string(data) == "null" {
- return nil
- }
-
- isotime, err := time.Parse(`"`+iso8601+`"`, string(data))
- *t = ISOTime(isotime)
-
- return err
-}
-
-// EncodeValues implements the query.Encoder interface
-func (t *ISOTime) EncodeValues(key string, v *url.Values) error {
- if t == nil || (time.Time(*t)).IsZero() {
- return nil
- }
- v.Add(key, t.String())
- return nil
-}
-
-// String implements the Stringer interface
-func (t ISOTime) String() string {
- return time.Time(t).Format(iso8601)
-}
-
-// NotificationLevelValue represents a notification level.
-type NotificationLevelValue int
-
-// String implements the fmt.Stringer interface.
-func (l NotificationLevelValue) String() string {
- return notificationLevelNames[l]
-}
-
-// MarshalJSON implements the json.Marshaler interface.
-func (l NotificationLevelValue) MarshalJSON() ([]byte, error) {
- return json.Marshal(l.String())
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (l *NotificationLevelValue) UnmarshalJSON(data []byte) error {
- var raw interface{}
- if err := json.Unmarshal(data, &raw); err != nil {
- return err
- }
-
- switch raw := raw.(type) {
- case float64:
- *l = NotificationLevelValue(raw)
- case string:
- *l = notificationLevelTypes[raw]
- case nil:
- // No action needed.
- default:
- return fmt.Errorf("json: cannot unmarshal %T into Go value of type %T", raw, *l)
- }
-
- return nil
-}
-
-// List of valid notification levels.
-const (
- DisabledNotificationLevel NotificationLevelValue = iota
- ParticipatingNotificationLevel
- WatchNotificationLevel
- GlobalNotificationLevel
- MentionNotificationLevel
- CustomNotificationLevel
-)
-
-var notificationLevelNames = [...]string{
- "disabled",
- "participating",
- "watch",
- "global",
- "mention",
- "custom",
-}
-
-var notificationLevelTypes = map[string]NotificationLevelValue{
- "disabled": DisabledNotificationLevel,
- "participating": ParticipatingNotificationLevel,
- "watch": WatchNotificationLevel,
- "global": GlobalNotificationLevel,
- "mention": MentionNotificationLevel,
- "custom": CustomNotificationLevel,
-}
-
-// VisibilityValue represents a visibility level within GitLab.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/
-type VisibilityValue string
-
-// List of available visibility levels.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/
-const (
- PrivateVisibility VisibilityValue = "private"
- InternalVisibility VisibilityValue = "internal"
- PublicVisibility VisibilityValue = "public"
-)
-
-// VariableTypeValue represents a variable type within GitLab.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/
-type VariableTypeValue string
-
-// List of available variable types.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/
-const (
- EnvVariableType VariableTypeValue = "env_var"
- FileVariableType VariableTypeValue = "file"
-)
-
-// MergeMethodValue represents a project merge type within GitLab.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method
-type MergeMethodValue string
-
-// List of available merge type
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#project-merge-method
-const (
- NoFastForwardMerge MergeMethodValue = "merge"
- FastForwardMerge MergeMethodValue = "ff"
- RebaseMerge MergeMethodValue = "rebase_merge"
-)
-
-// EventTypeValue represents actions type for contribution events
-type EventTypeValue string
-
-// List of available action type
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/events.html#action-types
-const (
- CreatedEventType EventTypeValue = "created"
- UpdatedEventType EventTypeValue = "updated"
- ClosedEventType EventTypeValue = "closed"
- ReopenedEventType EventTypeValue = "reopened"
- PushedEventType EventTypeValue = "pushed"
- CommentedEventType EventTypeValue = "commented"
- MergedEventType EventTypeValue = "merged"
- JoinedEventType EventTypeValue = "joined"
- LeftEventType EventTypeValue = "left"
- DestroyedEventType EventTypeValue = "destroyed"
- ExpiredEventType EventTypeValue = "expired"
-)
-
-// EventTargetTypeValue represents actions type value for contribution events
-type EventTargetTypeValue string
-
-// List of available action type
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/events.html#target-types
-const (
- IssueEventTargetType EventTargetTypeValue = "issue"
- MilestoneEventTargetType EventTargetTypeValue = "milestone"
- MergeRequestEventTargetType EventTargetTypeValue = "merge_request"
- NoteEventTargetType EventTargetTypeValue = "note"
- ProjectEventTargetType EventTargetTypeValue = "project"
- SnippetEventTargetType EventTargetTypeValue = "snippet"
- UserEventTargetType EventTargetTypeValue = "user"
-)
-
-// A Client manages communication with the GitLab API.
-type Client struct {
- // HTTP client used to communicate with the API.
- client *http.Client
-
- // Base URL for API requests. Defaults to the public GitLab API, but can be
- // set to a domain endpoint to use with a self hosted GitLab server. baseURL
- // should always be specified with a trailing slash.
- baseURL *url.URL
-
- // Token type used to make authenticated API calls.
- authType authType
-
- // Username and password used for basix authentication.
- username, password string
-
- // Token used to make authenticated API calls.
- token string
-
- // User agent used when communicating with the GitLab API.
- UserAgent string
-
- // Services used for talking to different parts of the GitLab API.
- AccessRequests *AccessRequestsService
- AwardEmoji *AwardEmojiService
- Boards *IssueBoardsService
- Branches *BranchesService
- BroadcastMessage *BroadcastMessagesService
- CIYMLTemplate *CIYMLTemplatesService
- Commits *CommitsService
- ContainerRegistry *ContainerRegistryService
- CustomAttribute *CustomAttributesService
- DeployKeys *DeployKeysService
- Deployments *DeploymentsService
- Discussions *DiscussionsService
- Environments *EnvironmentsService
- Epics *EpicsService
- Events *EventsService
- Features *FeaturesService
- GitIgnoreTemplates *GitIgnoreTemplatesService
- GroupBadges *GroupBadgesService
- GroupCluster *GroupClustersService
- GroupIssueBoards *GroupIssueBoardsService
- GroupLabels *GroupLabelsService
- GroupMembers *GroupMembersService
- GroupMilestones *GroupMilestonesService
- GroupVariables *GroupVariablesService
- Groups *GroupsService
- IssueLinks *IssueLinksService
- Issues *IssuesService
- Jobs *JobsService
- Keys *KeysService
- Labels *LabelsService
- License *LicenseService
- LicenseTemplates *LicenseTemplatesService
- MergeRequestApprovals *MergeRequestApprovalsService
- MergeRequests *MergeRequestsService
- Milestones *MilestonesService
- Namespaces *NamespacesService
- Notes *NotesService
- NotificationSettings *NotificationSettingsService
- PagesDomains *PagesDomainsService
- PipelineSchedules *PipelineSchedulesService
- PipelineTriggers *PipelineTriggersService
- Pipelines *PipelinesService
- ProjectBadges *ProjectBadgesService
- ProjectCluster *ProjectClustersService
- ProjectImportExport *ProjectImportExportService
- ProjectMembers *ProjectMembersService
- ProjectSnippets *ProjectSnippetsService
- ProjectVariables *ProjectVariablesService
- Projects *ProjectsService
- ProtectedBranches *ProtectedBranchesService
- ProtectedTags *ProtectedTagsService
- ReleaseLinks *ReleaseLinksService
- Releases *ReleasesService
- Repositories *RepositoriesService
- RepositoryFiles *RepositoryFilesService
- ResourceLabelEvents *ResourceLabelEventsService
- Runners *RunnersService
- Search *SearchService
- Services *ServicesService
- Settings *SettingsService
- Sidekiq *SidekiqService
- Snippets *SnippetsService
- SystemHooks *SystemHooksService
- Tags *TagsService
- Todos *TodosService
- Users *UsersService
- Validate *ValidateService
- Version *VersionService
- Wikis *WikisService
-}
-
-// ListOptions specifies the optional parameters to various List methods that
-// support pagination.
-type ListOptions struct {
- // For paginated result sets, page of results to retrieve.
- Page int `url:"page,omitempty" json:"page,omitempty"`
-
- // For paginated result sets, the number of results to include per page.
- PerPage int `url:"per_page,omitempty" json:"per_page,omitempty"`
-}
-
-// NewClient returns a new GitLab API client. If a nil httpClient is
-// provided, http.DefaultClient will be used. To use API methods which require
-// authentication, provide a valid private or personal token.
-func NewClient(httpClient *http.Client, token string) *Client {
- client := newClient(httpClient)
- client.authType = privateToken
- client.token = token
- return client
-}
-
-// NewBasicAuthClient returns a new GitLab API client. If a nil httpClient is
-// provided, http.DefaultClient will be used. To use API methods which require
-// authentication, provide a valid username and password.
-func NewBasicAuthClient(httpClient *http.Client, endpoint, username, password string) (*Client, error) {
- client := newClient(httpClient)
- client.authType = basicAuth
- client.username = username
- client.password = password
- client.SetBaseURL(endpoint)
-
- err := client.requestOAuthToken(context.TODO())
- if err != nil {
- return nil, err
- }
-
- return client, nil
-}
-
-func (c *Client) requestOAuthToken(ctx context.Context) error {
- config := &oauth2.Config{
- Endpoint: oauth2.Endpoint{
- AuthURL: fmt.Sprintf("%s://%s/oauth/authorize", c.BaseURL().Scheme, c.BaseURL().Host),
- TokenURL: fmt.Sprintf("%s://%s/oauth/token", c.BaseURL().Scheme, c.BaseURL().Host),
- },
- }
- ctx = context.WithValue(ctx, oauth2.HTTPClient, c.client)
- t, err := config.PasswordCredentialsToken(ctx, c.username, c.password)
- if err != nil {
- return err
- }
- c.token = t.AccessToken
- return nil
-}
-
-// NewOAuthClient returns a new GitLab API client. If a nil httpClient is
-// provided, http.DefaultClient will be used. To use API methods which require
-// authentication, provide a valid oauth token.
-func NewOAuthClient(httpClient *http.Client, token string) *Client {
- client := newClient(httpClient)
- client.authType = oAuthToken
- client.token = token
- return client
-}
-
-func newClient(httpClient *http.Client) *Client {
- if httpClient == nil {
- httpClient = http.DefaultClient
- }
-
- c := &Client{client: httpClient, UserAgent: userAgent}
- if err := c.SetBaseURL(defaultBaseURL); err != nil {
- // Should never happen since defaultBaseURL is our constant.
- panic(err)
- }
-
- // Create the internal timeStats service.
- timeStats := &timeStatsService{client: c}
-
- // Create all the public services.
- c.AccessRequests = &AccessRequestsService{client: c}
- c.AwardEmoji = &AwardEmojiService{client: c}
- c.Boards = &IssueBoardsService{client: c}
- c.Branches = &BranchesService{client: c}
- c.BroadcastMessage = &BroadcastMessagesService{client: c}
- c.CIYMLTemplate = &CIYMLTemplatesService{client: c}
- c.Commits = &CommitsService{client: c}
- c.ContainerRegistry = &ContainerRegistryService{client: c}
- c.CustomAttribute = &CustomAttributesService{client: c}
- c.DeployKeys = &DeployKeysService{client: c}
- c.Deployments = &DeploymentsService{client: c}
- c.Discussions = &DiscussionsService{client: c}
- c.Environments = &EnvironmentsService{client: c}
- c.Epics = &EpicsService{client: c}
- c.Events = &EventsService{client: c}
- c.Features = &FeaturesService{client: c}
- c.GitIgnoreTemplates = &GitIgnoreTemplatesService{client: c}
- c.GroupBadges = &GroupBadgesService{client: c}
- c.GroupCluster = &GroupClustersService{client: c}
- c.GroupIssueBoards = &GroupIssueBoardsService{client: c}
- c.GroupLabels = &GroupLabelsService{client: c}
- c.GroupMembers = &GroupMembersService{client: c}
- c.GroupMilestones = &GroupMilestonesService{client: c}
- c.GroupVariables = &GroupVariablesService{client: c}
- c.Groups = &GroupsService{client: c}
- c.IssueLinks = &IssueLinksService{client: c}
- c.Issues = &IssuesService{client: c, timeStats: timeStats}
- c.Jobs = &JobsService{client: c}
- c.Keys = &KeysService{client: c}
- c.Labels = &LabelsService{client: c}
- c.License = &LicenseService{client: c}
- c.LicenseTemplates = &LicenseTemplatesService{client: c}
- c.MergeRequestApprovals = &MergeRequestApprovalsService{client: c}
- c.MergeRequests = &MergeRequestsService{client: c, timeStats: timeStats}
- c.Milestones = &MilestonesService{client: c}
- c.Namespaces = &NamespacesService{client: c}
- c.Notes = &NotesService{client: c}
- c.NotificationSettings = &NotificationSettingsService{client: c}
- c.PagesDomains = &PagesDomainsService{client: c}
- c.PipelineSchedules = &PipelineSchedulesService{client: c}
- c.PipelineTriggers = &PipelineTriggersService{client: c}
- c.Pipelines = &PipelinesService{client: c}
- c.ProjectBadges = &ProjectBadgesService{client: c}
- c.ProjectCluster = &ProjectClustersService{client: c}
- c.ProjectImportExport = &ProjectImportExportService{client: c}
- c.ProjectMembers = &ProjectMembersService{client: c}
- c.ProjectSnippets = &ProjectSnippetsService{client: c}
- c.ProjectVariables = &ProjectVariablesService{client: c}
- c.Projects = &ProjectsService{client: c}
- c.ProtectedBranches = &ProtectedBranchesService{client: c}
- c.ProtectedTags = &ProtectedTagsService{client: c}
- c.ReleaseLinks = &ReleaseLinksService{client: c}
- c.Releases = &ReleasesService{client: c}
- c.Repositories = &RepositoriesService{client: c}
- c.RepositoryFiles = &RepositoryFilesService{client: c}
- c.ResourceLabelEvents = &ResourceLabelEventsService{client: c}
- c.Runners = &RunnersService{client: c}
- c.Search = &SearchService{client: c}
- c.Services = &ServicesService{client: c}
- c.Settings = &SettingsService{client: c}
- c.Sidekiq = &SidekiqService{client: c}
- c.Snippets = &SnippetsService{client: c}
- c.SystemHooks = &SystemHooksService{client: c}
- c.Tags = &TagsService{client: c}
- c.Todos = &TodosService{client: c}
- c.Users = &UsersService{client: c}
- c.Validate = &ValidateService{client: c}
- c.Version = &VersionService{client: c}
- c.Wikis = &WikisService{client: c}
-
- return c
-}
-
-// BaseURL return a copy of the baseURL.
-func (c *Client) BaseURL() *url.URL {
- u := *c.baseURL
- return &u
-}
-
-// SetBaseURL sets the base URL for API requests to a custom endpoint. urlStr
-// should always be specified with a trailing slash.
-func (c *Client) SetBaseURL(urlStr string) error {
- // Make sure the given URL end with a slash
- if !strings.HasSuffix(urlStr, "/") {
- urlStr += "/"
- }
-
- baseURL, err := url.Parse(urlStr)
- if err != nil {
- return err
- }
-
- if !strings.HasSuffix(baseURL.Path, apiVersionPath) {
- baseURL.Path += apiVersionPath
- }
-
- // Update the base URL of the client.
- c.baseURL = baseURL
-
- return nil
-}
-
-// NewRequest creates an API request. A relative URL path can be provided in
-// urlStr, in which case it is resolved relative to the base URL of the Client.
-// Relative URL paths should always be specified without a preceding slash. If
-// specified, the value pointed to by body is JSON encoded and included as the
-// request body.
-func (c *Client) NewRequest(method, path string, opt interface{}, options []OptionFunc) (*http.Request, error) {
- u := *c.baseURL
- unescaped, err := url.PathUnescape(path)
- if err != nil {
- return nil, err
- }
-
- // Set the encoded path data
- u.RawPath = c.baseURL.Path + path
- u.Path = c.baseURL.Path + unescaped
-
- if opt != nil {
- q, err := query.Values(opt)
- if err != nil {
- return nil, err
- }
- u.RawQuery = q.Encode()
- }
-
- req := &http.Request{
- Method: method,
- URL: &u,
- Proto: "HTTP/1.1",
- ProtoMajor: 1,
- ProtoMinor: 1,
- Header: make(http.Header),
- Host: u.Host,
- }
-
- for _, fn := range options {
- if fn == nil {
- continue
- }
-
- if err := fn(req); err != nil {
- return nil, err
- }
- }
-
- if method == "POST" || method == "PUT" {
- bodyBytes, err := json.Marshal(opt)
- if err != nil {
- return nil, err
- }
- bodyReader := bytes.NewReader(bodyBytes)
-
- u.RawQuery = ""
- req.Body = ioutil.NopCloser(bodyReader)
- req.GetBody = func() (io.ReadCloser, error) {
- return ioutil.NopCloser(bodyReader), nil
- }
- req.ContentLength = int64(bodyReader.Len())
- req.Header.Set("Content-Type", "application/json")
- }
-
- req.Header.Set("Accept", "application/json")
-
- switch c.authType {
- case basicAuth, oAuthToken:
- req.Header.Set("Authorization", "Bearer "+c.token)
- case privateToken:
- req.Header.Set("PRIVATE-TOKEN", c.token)
- }
-
- if c.UserAgent != "" {
- req.Header.Set("User-Agent", c.UserAgent)
- }
-
- return req, nil
-}
-
-// Response is a GitLab API response. This wraps the standard http.Response
-// returned from GitLab and provides convenient access to things like
-// pagination links.
-type Response struct {
- *http.Response
-
- // These fields provide the page values for paginating through a set of
- // results. Any or all of these may be set to the zero value for
- // responses that are not part of a paginated set, or for which there
- // are no additional pages.
- TotalItems int
- TotalPages int
- ItemsPerPage int
- CurrentPage int
- NextPage int
- PreviousPage int
-}
-
-// newResponse creates a new Response for the provided http.Response.
-func newResponse(r *http.Response) *Response {
- response := &Response{Response: r}
- response.populatePageValues()
- return response
-}
-
-const (
- xTotal = "X-Total"
- xTotalPages = "X-Total-Pages"
- xPerPage = "X-Per-Page"
- xPage = "X-Page"
- xNextPage = "X-Next-Page"
- xPrevPage = "X-Prev-Page"
-)
-
-// populatePageValues parses the HTTP Link response headers and populates the
-// various pagination link values in the Response.
-func (r *Response) populatePageValues() {
- if totalItems := r.Response.Header.Get(xTotal); totalItems != "" {
- r.TotalItems, _ = strconv.Atoi(totalItems)
- }
- if totalPages := r.Response.Header.Get(xTotalPages); totalPages != "" {
- r.TotalPages, _ = strconv.Atoi(totalPages)
- }
- if itemsPerPage := r.Response.Header.Get(xPerPage); itemsPerPage != "" {
- r.ItemsPerPage, _ = strconv.Atoi(itemsPerPage)
- }
- if currentPage := r.Response.Header.Get(xPage); currentPage != "" {
- r.CurrentPage, _ = strconv.Atoi(currentPage)
- }
- if nextPage := r.Response.Header.Get(xNextPage); nextPage != "" {
- r.NextPage, _ = strconv.Atoi(nextPage)
- }
- if previousPage := r.Response.Header.Get(xPrevPage); previousPage != "" {
- r.PreviousPage, _ = strconv.Atoi(previousPage)
- }
-}
-
-// Do sends an API request and returns the API response. The API response is
-// JSON decoded and stored in the value pointed to by v, or returned as an
-// error if an API error has occurred. If v implements the io.Writer
-// interface, the raw response body will be written to v, without attempting to
-// first decode it.
-func (c *Client) Do(req *http.Request, v interface{}) (*Response, error) {
- resp, err := c.client.Do(req)
- if err != nil {
- return nil, err
- }
- defer resp.Body.Close()
-
- if resp.StatusCode == http.StatusUnauthorized && c.authType == basicAuth {
- err = c.requestOAuthToken(req.Context())
- if err != nil {
- return nil, err
- }
- return c.Do(req, v)
- }
-
- response := newResponse(resp)
-
- err = CheckResponse(resp)
- if err != nil {
- // even though there was an error, we still return the response
- // in case the caller wants to inspect it further
- return response, err
- }
-
- if v != nil {
- if w, ok := v.(io.Writer); ok {
- _, err = io.Copy(w, resp.Body)
- } else {
- err = json.NewDecoder(resp.Body).Decode(v)
- }
- }
-
- return response, err
-}
-
-// Helper function to accept and format both the project ID or name as project
-// identifier for all API calls.
-func parseID(id interface{}) (string, error) {
- switch v := id.(type) {
- case int:
- return strconv.Itoa(v), nil
- case string:
- return v, nil
- default:
- return "", fmt.Errorf("invalid ID type %#v, the ID must be an int or a string", id)
- }
-}
-
-// Helper function to escape a project identifier.
-func pathEscape(s string) string {
- return strings.Replace(url.PathEscape(s), ".", "%2E", -1)
-}
-
-// An ErrorResponse reports one or more errors caused by an API request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/README.html#data-validation-and-error-reporting
-type ErrorResponse struct {
- Body []byte
- Response *http.Response
- Message string
-}
-
-func (e *ErrorResponse) Error() string {
- path, _ := url.QueryUnescape(e.Response.Request.URL.Path)
- u := fmt.Sprintf("%s://%s%s", e.Response.Request.URL.Scheme, e.Response.Request.URL.Host, path)
- return fmt.Sprintf("%s %s: %d %s", e.Response.Request.Method, u, e.Response.StatusCode, e.Message)
-}
-
-// CheckResponse checks the API response for errors, and returns them if present.
-func CheckResponse(r *http.Response) error {
- switch r.StatusCode {
- case 200, 201, 202, 204, 304:
- return nil
- }
-
- errorResponse := &ErrorResponse{Response: r}
- data, err := ioutil.ReadAll(r.Body)
- if err == nil && data != nil {
- errorResponse.Body = data
-
- var raw interface{}
- if err := json.Unmarshal(data, &raw); err != nil {
- errorResponse.Message = "failed to parse unknown error format"
- } else {
- errorResponse.Message = parseError(raw)
- }
- }
-
- return errorResponse
-}
-
-// Format:
-// {
-// "message": {
-// "<property-name>": [
-// "<error-message>",
-// "<error-message>",
-// ...
-// ],
-// "<embed-entity>": {
-// "<property-name>": [
-// "<error-message>",
-// "<error-message>",
-// ...
-// ],
-// }
-// },
-// "error": "<error-message>"
-// }
-func parseError(raw interface{}) string {
- switch raw := raw.(type) {
- case string:
- return raw
-
- case []interface{}:
- var errs []string
- for _, v := range raw {
- errs = append(errs, parseError(v))
- }
- return fmt.Sprintf("[%s]", strings.Join(errs, ", "))
-
- case map[string]interface{}:
- var errs []string
- for k, v := range raw {
- errs = append(errs, fmt.Sprintf("{%s: %s}", k, parseError(v)))
- }
- sort.Strings(errs)
- return strings.Join(errs, ", ")
-
- default:
- return fmt.Sprintf("failed to parse unexpected error type: %T", raw)
- }
-}
-
-// OptionFunc can be passed to all API requests to make the API call as if you were
-// another user, provided your private token is from an administrator account.
-//
-// GitLab docs: https://docs.gitlab.com/ce/api/README.html#sudo
-type OptionFunc func(*http.Request) error
-
-// WithSudo takes either a username or user ID and sets the SUDO request header
-func WithSudo(uid interface{}) OptionFunc {
- return func(req *http.Request) error {
- user, err := parseID(uid)
- if err != nil {
- return err
- }
- req.Header.Set("SUDO", user)
- return nil
- }
-}
-
-// WithContext runs the request with the provided context
-func WithContext(ctx context.Context) OptionFunc {
- return func(req *http.Request) error {
- *req = *req.WithContext(ctx)
- return nil
- }
-}
-
-// 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 {
- p := new(bool)
- *p = v
- return p
-}
-
-// 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) *int {
- p := new(int)
- *p = v
- return p
-}
-
-// 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 {
- p := new(string)
- *p = v
- return p
-}
-
-// Time is a helper routine that allocates a new time.Time value
-// to store v and returns a pointer to it.
-func Time(v time.Time) *time.Time {
- p := new(time.Time)
- *p = v
- return p
-}
-
-// AccessLevel is a helper routine that allocates a new AccessLevelValue
-// to store v and returns a pointer to it.
-func AccessLevel(v AccessLevelValue) *AccessLevelValue {
- p := new(AccessLevelValue)
- *p = v
- return p
-}
-
-// BuildState is a helper routine that allocates a new BuildStateValue
-// to store v and returns a pointer to it.
-func BuildState(v BuildStateValue) *BuildStateValue {
- p := new(BuildStateValue)
- *p = v
- return p
-}
-
-// NotificationLevel is a helper routine that allocates a new NotificationLevelValue
-// to store v and returns a pointer to it.
-func NotificationLevel(v NotificationLevelValue) *NotificationLevelValue {
- p := new(NotificationLevelValue)
- *p = v
- return p
-}
-
-// VariableType is a helper routine that allocates a new VariableTypeValue
-// to store v and returns a pointer to it.
-func VariableType(v VariableTypeValue) *VariableTypeValue {
- p := new(VariableTypeValue)
- *p = v
- return p
-}
-
-// Visibility is a helper routine that allocates a new VisibilityValue
-// to store v and returns a pointer to it.
-func Visibility(v VisibilityValue) *VisibilityValue {
- p := new(VisibilityValue)
- *p = v
- return p
-}
-
-// MergeMethod is a helper routine that allocates a new MergeMethod
-// to sotre v and returns a pointer to it.
-func MergeMethod(v MergeMethodValue) *MergeMethodValue {
- p := new(MergeMethodValue)
- *p = v
- return p
-}
-
-// BoolValue is a boolean value with advanced json unmarshaling features.
-type BoolValue bool
-
-// UnmarshalJSON allows 1 and 0 to be considered as boolean values
-// Needed for https://gitlab.com/gitlab-org/gitlab-ce/issues/50122
-func (t *BoolValue) UnmarshalJSON(b []byte) error {
- switch string(b) {
- case `"1"`:
- *t = true
- return nil
- case `"0"`:
- *t = false
- return nil
- default:
- var v bool
- err := json.Unmarshal(b, &v)
- *t = BoolValue(v)
- return err
- }
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/go.mod b/vendor/github.com/xanzy/go-gitlab/go.mod
deleted file mode 100644
index 0632997b..00000000
--- a/vendor/github.com/xanzy/go-gitlab/go.mod
+++ /dev/null
@@ -1,12 +0,0 @@
-module github.com/xanzy/go-gitlab
-
-require (
- github.com/google/go-querystring v1.0.0
- github.com/stretchr/testify v1.4.0
- golang.org/x/net v0.0.0-20181108082009-03003ca0c849 // indirect
- golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288
- golang.org/x/sync v0.0.0-20181108010431-42b317875d0f // indirect
- google.golang.org/appengine v1.3.0 // indirect
-)
-
-go 1.13
diff --git a/vendor/github.com/xanzy/go-gitlab/go.sum b/vendor/github.com/xanzy/go-gitlab/go.sum
deleted file mode 100644
index d78b9d5f..00000000
--- a/vendor/github.com/xanzy/go-gitlab/go.sum
+++ /dev/null
@@ -1,25 +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/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/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.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
-github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
-golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-golang.org/x/net v0.0.0-20181108082009-03003ca0c849 h1:FSqE2GGG7wzsYUsWiQ8MZrvEd1EOyU3NCF0AW3Wtltg=
-golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
-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 h1:Bl/8QSvNqXvPGPGXa2z5xUTmV7VDcZyvRZ+QQXkXTZQ=
-golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-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 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
-gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/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=
diff --git a/vendor/github.com/xanzy/go-gitlab/group_badges.go b/vendor/github.com/xanzy/go-gitlab/group_badges.go
deleted file mode 100644
index 9be27bd2..00000000
--- a/vendor/github.com/xanzy/go-gitlab/group_badges.go
+++ /dev/null
@@ -1,213 +0,0 @@
-package gitlab
-
-import (
- "fmt"
-)
-
-// GroupBadgesService handles communication with the group badges
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_badges.html
-type GroupBadgesService struct {
- client *Client
-}
-
-// BadgeKind represents a GitLab Badge Kind
-type BadgeKind string
-
-// all possible values Badge Kind
-const (
- ProjectBadgeKind BadgeKind = "project"
- GroupBadgeKind BadgeKind = "group"
-)
-
-// GroupBadge represents a group badge.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_badges.html
-type GroupBadge struct {
- ID int `json:"id"`
- LinkURL string `json:"link_url"`
- ImageURL string `json:"image_url"`
- RenderedLinkURL string `json:"rendered_link_url"`
- RenderedImageURL string `json:"rendered_image_url"`
- Kind BadgeKind `json:"kind"`
-}
-
-// ListGroupBadgesOptions represents the available ListGroupBadges() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_badges.html#list-all-badges-of-a-group
-type ListGroupBadgesOptions ListOptions
-
-// ListGroupBadges gets a list of a group badges.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_badges.html#list-all-badges-of-a-group
-func (s *GroupBadgesService) ListGroupBadges(gid interface{}, opt *ListGroupBadgesOptions, options ...OptionFunc) ([]*GroupBadge, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/badges", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var gb []*GroupBadge
- resp, err := s.client.Do(req, &gb)
- if err != nil {
- return nil, resp, err
- }
-
- return gb, resp, err
-}
-
-// GetGroupBadge gets a group badge.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_badges.html#get-a-badge-of-a-group
-func (s *GroupBadgesService) GetGroupBadge(gid interface{}, badge int, options ...OptionFunc) (*GroupBadge, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/badges/%d", pathEscape(group), badge)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- gb := new(GroupBadge)
- resp, err := s.client.Do(req, gb)
- if err != nil {
- return nil, resp, err
- }
-
- return gb, resp, err
-}
-
-// AddGroupBadgeOptions represents the available AddGroupBadge() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_badges.html#add-a-badge-to-a-group
-type AddGroupBadgeOptions struct {
- LinkURL *string `url:"link_url,omitempty" json:"link_url,omitempty"`
- ImageURL *string `url:"image_url,omitempty" json:"image_url,omitempty"`
-}
-
-// AddGroupBadge adds a badge to a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_badges.html#add-a-badge-to-a-group
-func (s *GroupBadgesService) AddGroupBadge(gid interface{}, opt *AddGroupBadgeOptions, options ...OptionFunc) (*GroupBadge, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/badges", pathEscape(group))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- gb := new(GroupBadge)
- resp, err := s.client.Do(req, gb)
- if err != nil {
- return nil, resp, err
- }
-
- return gb, resp, err
-}
-
-// EditGroupBadgeOptions represents the available EditGroupBadge() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_badges.html#edit-a-badge-of-a-group
-type EditGroupBadgeOptions struct {
- LinkURL *string `url:"link_url,omitempty" json:"link_url,omitempty"`
- ImageURL *string `url:"image_url,omitempty" json:"image_url,omitempty"`
-}
-
-// EditGroupBadge updates a badge of a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_badges.html#edit-a-badge-of-a-group
-func (s *GroupBadgesService) EditGroupBadge(gid interface{}, badge int, opt *EditGroupBadgeOptions, options ...OptionFunc) (*GroupBadge, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/badges/%d", pathEscape(group), badge)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- gb := new(GroupBadge)
- resp, err := s.client.Do(req, gb)
- if err != nil {
- return nil, resp, err
- }
-
- return gb, resp, err
-}
-
-// DeleteGroupBadge removes a badge from a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_badges.html#remove-a-badge-from-a-group
-func (s *GroupBadgesService) DeleteGroupBadge(gid interface{}, badge int, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/badges/%d", pathEscape(group), badge)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// GroupBadgePreviewOptions represents the available PreviewGroupBadge() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_badges.html#preview-a-badge-from-a-group
-type GroupBadgePreviewOptions struct {
- LinkURL *string `url:"link_url,omitempty" json:"link_url,omitempty"`
- ImageURL *string `url:"image_url,omitempty" json:"image_url,omitempty"`
-}
-
-// PreviewGroupBadge returns how the link_url and image_url final URLs would be after
-// resolving the placeholder interpolation.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_badges.html#preview-a-badge-from-a-group
-func (s *GroupBadgesService) PreviewGroupBadge(gid interface{}, opt *GroupBadgePreviewOptions, options ...OptionFunc) (*GroupBadge, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/badges/render", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- gb := new(GroupBadge)
- resp, err := s.client.Do(req, &gb)
- if err != nil {
- return nil, resp, err
- }
-
- return gb, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/group_boards.go b/vendor/github.com/xanzy/go-gitlab/group_boards.go
deleted file mode 100644
index 1e814c57..00000000
--- a/vendor/github.com/xanzy/go-gitlab/group_boards.go
+++ /dev/null
@@ -1,261 +0,0 @@
-//
-// Copyright 2018, Patrick Webster
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
-)
-
-// GroupIssueBoardsService handles communication with the group issue board
-// related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html
-type GroupIssueBoardsService struct {
- client *Client
-}
-
-// GroupIssueBoard represents a GitLab group issue board.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html
-type GroupIssueBoard struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Group *Group `json:"group"`
- Milestone *Milestone `json:"milestone"`
- Lists []*BoardList `json:"lists"`
-}
-
-func (b GroupIssueBoard) String() string {
- return Stringify(b)
-}
-
-// ListGroupIssueBoardsOptions represents the available
-// ListGroupIssueBoards() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#group-board
-type ListGroupIssueBoardsOptions ListOptions
-
-// ListGroupIssueBoards gets a list of all issue boards in a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#group-board
-func (s *GroupIssueBoardsService) ListGroupIssueBoards(gid interface{}, opt *ListGroupIssueBoardsOptions, options ...OptionFunc) ([]*GroupIssueBoard, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/boards", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var gs []*GroupIssueBoard
- resp, err := s.client.Do(req, &gs)
- if err != nil {
- return nil, resp, err
- }
-
- return gs, resp, err
-}
-
-// GetGroupIssueBoard gets a single issue board of a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#single-board
-func (s *GroupIssueBoardsService) GetGroupIssueBoard(gid interface{}, board int, options ...OptionFunc) (*GroupIssueBoard, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/boards/%d", pathEscape(group), board)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- gib := new(GroupIssueBoard)
- resp, err := s.client.Do(req, gib)
- if err != nil {
- return nil, resp, err
- }
-
- return gib, resp, err
-}
-
-// ListGroupIssueBoardListsOptions represents the available
-// ListGroupIssueBoardLists() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#list-board-lists
-type ListGroupIssueBoardListsOptions ListOptions
-
-// ListGroupIssueBoardLists gets a list of the issue board's lists. Does not include
-// backlog and closed lists.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/group_boards.html#list-board-lists
-func (s *GroupIssueBoardsService) ListGroupIssueBoardLists(gid interface{}, board int, opt *ListGroupIssueBoardListsOptions, options ...OptionFunc) ([]*BoardList, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/boards/%d/lists", pathEscape(group), board)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var gbl []*BoardList
- resp, err := s.client.Do(req, &gbl)
- if err != nil {
- return nil, resp, err
- }
-
- return gbl, resp, err
-}
-
-// GetGroupIssueBoardList gets a single issue board list.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#single-board-list
-func (s *GroupIssueBoardsService) GetGroupIssueBoardList(gid interface{}, board, list int, options ...OptionFunc) (*BoardList, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/boards/%d/lists/%d",
- pathEscape(group),
- board,
- list,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- gbl := new(BoardList)
- resp, err := s.client.Do(req, gbl)
- if err != nil {
- return nil, resp, err
- }
-
- return gbl, resp, err
-}
-
-// CreateGroupIssueBoardListOptions represents the available
-// CreateGroupIssueBoardList() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#new-board-list
-type CreateGroupIssueBoardListOptions struct {
- LabelID *int `url:"label_id" json:"label_id"`
-}
-
-// CreateGroupIssueBoardList creates a new issue board list.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#new-board-list
-func (s *GroupIssueBoardsService) CreateGroupIssueBoardList(gid interface{}, board int, opt *CreateGroupIssueBoardListOptions, options ...OptionFunc) (*BoardList, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/boards/%d/lists", pathEscape(group), board)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- gbl := new(BoardList)
- resp, err := s.client.Do(req, gbl)
- if err != nil {
- return nil, resp, err
- }
-
- return gbl, resp, err
-}
-
-// UpdateGroupIssueBoardListOptions represents the available
-// UpdateGroupIssueBoardList() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#edit-board-list
-type UpdateGroupIssueBoardListOptions struct {
- Position *int `url:"position" json:"position"`
-}
-
-// UpdateIssueBoardList updates the position of an existing
-// group issue board list.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#edit-board-list
-func (s *GroupIssueBoardsService) UpdateIssueBoardList(gid interface{}, board, list int, opt *UpdateGroupIssueBoardListOptions, options ...OptionFunc) ([]*BoardList, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/boards/%d/lists/%d",
- pathEscape(group),
- board,
- list,
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var gbl []*BoardList
- resp, err := s.client.Do(req, gbl)
- if err != nil {
- return nil, resp, err
- }
-
- return gbl, resp, err
-}
-
-// DeleteGroupIssueBoardList soft deletes a group issue board list.
-// Only for admins and group owners.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_boards.html#delete-a-board-list
-func (s *GroupIssueBoardsService) DeleteGroupIssueBoardList(gid interface{}, board, list int, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/boards/%d/lists/%d",
- pathEscape(group),
- board,
- list,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/group_clusters.go b/vendor/github.com/xanzy/go-gitlab/group_clusters.go
deleted file mode 100644
index 9f38bc0b..00000000
--- a/vendor/github.com/xanzy/go-gitlab/group_clusters.go
+++ /dev/null
@@ -1,211 +0,0 @@
-//
-// Copyright 2019, Paul Shoemaker
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// GroupClustersService handles communication with the
-// group clusters related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_clusters.html
-type GroupClustersService struct {
- client *Client
-}
-
-// GroupCluster represents a GitLab Group Cluster.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/group_clusters.html
-type GroupCluster struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Domain string `json:"domain"`
- CreatedAt *time.Time `json:"created_at"`
- ProviderType string `json:"provider_type"`
- PlatformType string `json:"platform_type"`
- EnvironmentScope string `json:"environment_scope"`
- ClusterType string `json:"cluster_type"`
- User *User `json:"user"`
- PlatformKubernetes *PlatformKubernetes `json:"platform_kubernetes"`
- Group *Group `json:"group"`
-}
-
-func (v GroupCluster) String() string {
- return Stringify(v)
-}
-
-// ListClusters gets a list of all clusters in a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_clusters.html#list-group-clusters
-func (s *GroupClustersService) ListClusters(pid interface{}, options ...OptionFunc) ([]*GroupCluster, *Response, error) {
- group, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/clusters", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pcs []*GroupCluster
- resp, err := s.client.Do(req, &pcs)
- if err != nil {
- return nil, resp, err
- }
-
- return pcs, resp, err
-}
-
-// GetCluster gets a cluster.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_clusters.html#get-a-single-group-cluster
-func (s *GroupClustersService) GetCluster(pid interface{}, cluster int, options ...OptionFunc) (*GroupCluster, *Response, error) {
- group, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/clusters/%d", pathEscape(group), cluster)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pc := new(GroupCluster)
- resp, err := s.client.Do(req, &pc)
- if err != nil {
- return nil, resp, err
- }
-
- return pc, resp, err
-}
-
-// AddGroupClusterOptions represents the available AddCluster() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_clusters.html#add-existing-cluster-to-group
-type AddGroupClusterOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Domain *string `url:"domain,omitempty" json:"domain,omitempty"`
- Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"`
- Managed *bool `url:"managed,omitempty" json:"managed,omitempty"`
- EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
- PlatformKubernetes *AddGroupPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"`
-}
-
-// AddGroupPlatformKubernetesOptions represents the available PlatformKubernetes options for adding.
-type AddGroupPlatformKubernetesOptions struct {
- APIURL *string `url:"api_url,omitempty" json:"api_url,omitempty"`
- Token *string `url:"token,omitempty" json:"token,omitempty"`
- CaCert *string `url:"ca_cert,omitempty" json:"ca_cert,omitempty"`
- Namespace *string `url:"namespace,omitempty" json:"namespace,omitempty"`
- AuthorizationType *string `url:"authorization_type,omitempty" json:"authorization_type,omitempty"`
-}
-
-// AddCluster adds an existing cluster to the group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_clusters.html#add-existing-cluster-to-group
-func (s *GroupClustersService) AddCluster(pid interface{}, opt *AddGroupClusterOptions, options ...OptionFunc) (*GroupCluster, *Response, error) {
- group, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/clusters/user", pathEscape(group))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pc := new(GroupCluster)
- resp, err := s.client.Do(req, pc)
- if err != nil {
- return nil, resp, err
- }
-
- return pc, resp, err
-}
-
-// EditGroupClusterOptions represents the available EditCluster() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_clusters.html#edit-group-cluster
-type EditGroupClusterOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Domain *string `url:"domain,omitempty" json:"domain,omitempty"`
- EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
- PlatformKubernetes *EditGroupPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"`
-}
-
-// EditGroupPlatformKubernetesOptions represents the available PlatformKubernetes options for editing.
-type EditGroupPlatformKubernetesOptions struct {
- APIURL *string `url:"api_url,omitempty" json:"api_url,omitempty"`
- Token *string `url:"token,omitempty" json:"token,omitempty"`
- CaCert *string `url:"ca_cert,omitempty" json:"ca_cert,omitempty"`
-}
-
-// EditCluster updates an existing group cluster.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_clusters.html#edit-group-cluster
-func (s *GroupClustersService) EditCluster(pid interface{}, cluster int, opt *EditGroupClusterOptions, options ...OptionFunc) (*GroupCluster, *Response, error) {
- group, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/clusters/%d", pathEscape(group), cluster)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pc := new(GroupCluster)
- resp, err := s.client.Do(req, pc)
- if err != nil {
- return nil, resp, err
- }
-
- return pc, resp, err
-}
-
-// DeleteCluster deletes an existing group cluster.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_clusters.html#delete-group-cluster
-func (s *GroupClustersService) DeleteCluster(pid interface{}, cluster int, options ...OptionFunc) (*Response, error) {
- group, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/clusters/%d", pathEscape(group), cluster)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/group_labels.go b/vendor/github.com/xanzy/go-gitlab/group_labels.go
deleted file mode 100644
index 4e733281..00000000
--- a/vendor/github.com/xanzy/go-gitlab/group_labels.go
+++ /dev/null
@@ -1,196 +0,0 @@
-package gitlab
-
-import (
- "fmt"
-)
-
-// GroupLabelsService handles communication with the label related methods of the
-// GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/group_labels.html
-type GroupLabelsService struct {
- client *Client
-}
-
-// GroupLabel represents a GitLab group label.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/group_labels.html
-type GroupLabel Label
-
-func (l GroupLabel) String() string {
- return Stringify(l)
-}
-
-// ListGroupLabelsOptions represents the available ListGroupLabels() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#list-labels
-type ListGroupLabelsOptions ListOptions
-
-// ListGroupLabels gets all labels for given group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_labels.html#list-group-labels
-func (s *GroupLabelsService) ListGroupLabels(gid interface{}, opt *ListGroupLabelsOptions, options ...OptionFunc) ([]*GroupLabel, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/labels", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var l []*GroupLabel
- resp, err := s.client.Do(req, &l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// CreateGroupLabelOptions represents the available CreateGroupLabel() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_labels.html#create-a-new-group-label
-type CreateGroupLabelOptions CreateLabelOptions
-
-// CreateGroupLabel creates a new label for given group with given name and
-// color.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_labels.html#create-a-new-group-label
-func (s *GroupLabelsService) CreateGroupLabel(gid interface{}, opt *CreateGroupLabelOptions, options ...OptionFunc) (*GroupLabel, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/labels", pathEscape(group))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(GroupLabel)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// DeleteGroupLabelOptions represents the available DeleteGroupLabel() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_labels.html#delete-a-group-label
-type DeleteGroupLabelOptions DeleteLabelOptions
-
-// DeleteGroupLabel deletes a group label given by its name.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#delete-a-label
-func (s *GroupLabelsService) DeleteGroupLabel(gid interface{}, opt *DeleteGroupLabelOptions, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/labels", pathEscape(group))
-
- req, err := s.client.NewRequest("DELETE", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// UpdateGroupLabelOptions represents the available UpdateGroupLabel() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_labels.html#update-a-group-label
-type UpdateGroupLabelOptions UpdateLabelOptions
-
-// UpdateGroupLabel updates an existing label with new name or now color. At least
-// one parameter is required, to update the label.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_labels.html#update-a-group-label
-func (s *GroupLabelsService) UpdateGroupLabel(gid interface{}, opt *UpdateGroupLabelOptions, options ...OptionFunc) (*GroupLabel, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/labels", pathEscape(group))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(GroupLabel)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// SubscribeToGroupLabel subscribes the authenticated user to a label to receive
-// notifications. If the user is already subscribed to the label, the status
-// code 304 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_labels.html#subscribe-to-a-group-label
-func (s *GroupLabelsService) SubscribeToGroupLabel(gid interface{}, labelID interface{}, options ...OptionFunc) (*GroupLabel, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- label, err := parseID(labelID)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/labels/%s/subscribe", pathEscape(group), label)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(GroupLabel)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// UnsubscribeFromGroupLabel unsubscribes the authenticated user from a label to not
-// receive notifications from it. If the user is not subscribed to the label, the
-// status code 304 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_labels.html#unsubscribe-from-a-group-label
-func (s *GroupLabelsService) UnsubscribeFromGroupLabel(gid interface{}, labelID interface{}, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- label, err := parseID(labelID)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/labels/%s/unsubscribe", pathEscape(group), label)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/group_members.go b/vendor/github.com/xanzy/go-gitlab/group_members.go
deleted file mode 100644
index 5d6f5e60..00000000
--- a/vendor/github.com/xanzy/go-gitlab/group_members.go
+++ /dev/null
@@ -1,219 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
-)
-
-// GroupMembersService handles communication with the group members
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/members.html
-type GroupMembersService struct {
- client *Client
-}
-
-// GroupMember represents a GitLab group member.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/members.html
-type GroupMember struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Name string `json:"name"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- ExpiresAt *ISOTime `json:"expires_at"`
- AccessLevel AccessLevelValue `json:"access_level"`
-}
-
-// ListGroupMembersOptions represents the available ListGroupMembers() and
-// ListAllGroupMembers() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project
-type ListGroupMembersOptions struct {
- ListOptions
- Query *string `url:"query,omitempty" json:"query,omitempty"`
-}
-
-// ListGroupMembers get a list of group members viewable by the authenticated
-// user. Inherited members through ancestor groups are not included.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project
-func (s *GroupsService) ListGroupMembers(gid interface{}, opt *ListGroupMembersOptions, options ...OptionFunc) ([]*GroupMember, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/members", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var gm []*GroupMember
- resp, err := s.client.Do(req, &gm)
- if err != nil {
- return nil, resp, err
- }
-
- return gm, resp, err
-}
-
-// ListAllGroupMembers get a list of group members viewable by the authenticated
-// user. Returns a list including inherited members through ancestor groups.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project-including-inherited-members
-func (s *GroupsService) ListAllGroupMembers(gid interface{}, opt *ListGroupMembersOptions, options ...OptionFunc) ([]*GroupMember, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/members/all", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var gm []*GroupMember
- resp, err := s.client.Do(req, &gm)
- if err != nil {
- return nil, resp, err
- }
-
- return gm, resp, err
-}
-
-// AddGroupMemberOptions represents the available AddGroupMember() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project
-type AddGroupMemberOptions struct {
- UserID *int `url:"user_id,omitempty" json:"user_id,omitempty"`
- AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
- ExpiresAt *string `url:"expires_at,omitempty" json:"expires_at"`
-}
-
-// GetGroupMember gets a member of a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#get-a-member-of-a-group-or-project
-func (s *GroupMembersService) GetGroupMember(gid interface{}, user int, options ...OptionFunc) (*GroupMember, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/members/%d", pathEscape(group), user)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- gm := new(GroupMember)
- resp, err := s.client.Do(req, gm)
- if err != nil {
- return nil, resp, err
- }
-
- return gm, resp, err
-}
-
-// AddGroupMember adds a user to the list of group members.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project
-func (s *GroupMembersService) AddGroupMember(gid interface{}, opt *AddGroupMemberOptions, options ...OptionFunc) (*GroupMember, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/members", pathEscape(group))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- gm := new(GroupMember)
- resp, err := s.client.Do(req, gm)
- if err != nil {
- return nil, resp, err
- }
-
- return gm, resp, err
-}
-
-// EditGroupMemberOptions represents the available EditGroupMember()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project
-type EditGroupMemberOptions struct {
- AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
- ExpiresAt *string `url:"expires_at,omitempty" json:"expires_at"`
-}
-
-// EditGroupMember updates a member of a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project
-func (s *GroupMembersService) EditGroupMember(gid interface{}, user int, opt *EditGroupMemberOptions, options ...OptionFunc) (*GroupMember, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/members/%d", pathEscape(group), user)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- gm := new(GroupMember)
- resp, err := s.client.Do(req, gm)
- if err != nil {
- return nil, resp, err
- }
-
- return gm, resp, err
-}
-
-// RemoveGroupMember removes user from user team.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#remove-a-member-from-a-group-or-project
-func (s *GroupMembersService) RemoveGroupMember(gid interface{}, user int, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/members/%d", pathEscape(group), user)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/group_milestones.go b/vendor/github.com/xanzy/go-gitlab/group_milestones.go
deleted file mode 100644
index d9436c65..00000000
--- a/vendor/github.com/xanzy/go-gitlab/group_milestones.go
+++ /dev/null
@@ -1,249 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// GroupMilestonesService handles communication with the milestone related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/group_milestones.html
-type GroupMilestonesService struct {
- client *Client
-}
-
-// GroupMilestone represents a GitLab milestone.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/group_milestones.html
-type GroupMilestone struct {
- ID int `json:"id"`
- IID int `json:"iid"`
- GroupID int `json:"group_id"`
- Title string `json:"title"`
- Description string `json:"description"`
- StartDate *ISOTime `json:"start_date"`
- DueDate *ISOTime `json:"due_date"`
- State string `json:"state"`
- UpdatedAt *time.Time `json:"updated_at"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-func (m GroupMilestone) String() string {
- return Stringify(m)
-}
-
-// ListGroupMilestonesOptions represents the available
-// ListGroupMilestones() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#list-group-milestones
-type ListGroupMilestonesOptions struct {
- ListOptions
- IIDs []int `url:"iids,omitempty" json:"iids,omitempty"`
- State string `url:"state,omitempty" json:"state,omitempty"`
- Search string `url:"search,omitempty" json:"search,omitempty"`
-}
-
-// ListGroupMilestones returns a list of group milestones.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#list-group-milestones
-func (s *GroupMilestonesService) ListGroupMilestones(gid interface{}, opt *ListGroupMilestonesOptions, options ...OptionFunc) ([]*GroupMilestone, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/milestones", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var m []*GroupMilestone
- resp, err := s.client.Do(req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// GetGroupMilestone gets a single group milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#get-single-milestone
-func (s *GroupMilestonesService) GetGroupMilestone(gid interface{}, milestone int, options ...OptionFunc) (*GroupMilestone, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/milestones/%d", pathEscape(group), milestone)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(GroupMilestone)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// CreateGroupMilestoneOptions represents the available CreateGroupMilestone() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#create-new-milestone
-type CreateGroupMilestoneOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- StartDate *ISOTime `url:"start_date,omitempty" json:"start_date,omitempty"`
- DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
-}
-
-// CreateGroupMilestone creates a new group milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#create-new-milestone
-func (s *GroupMilestonesService) CreateGroupMilestone(gid interface{}, opt *CreateGroupMilestoneOptions, options ...OptionFunc) (*GroupMilestone, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/milestones", pathEscape(group))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(GroupMilestone)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// UpdateGroupMilestoneOptions represents the available UpdateGroupMilestone() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#edit-milestone
-type UpdateGroupMilestoneOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- StartDate *ISOTime `url:"start_date,omitempty" json:"start_date,omitempty"`
- DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
- StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"`
-}
-
-// UpdateGroupMilestone updates an existing group milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#edit-milestone
-func (s *GroupMilestonesService) UpdateGroupMilestone(gid interface{}, milestone int, opt *UpdateGroupMilestoneOptions, options ...OptionFunc) (*GroupMilestone, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/milestones/%d", pathEscape(group), milestone)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(GroupMilestone)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// GetGroupMilestoneIssuesOptions represents the available GetGroupMilestoneIssues() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#get-all-issues-assigned-to-a-single-milestone
-type GetGroupMilestoneIssuesOptions ListOptions
-
-// GetGroupMilestoneIssues gets all issues assigned to a single group milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#get-all-issues-assigned-to-a-single-milestone
-func (s *GroupMilestonesService) GetGroupMilestoneIssues(gid interface{}, milestone int, opt *GetGroupMilestoneIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/milestones/%d/issues", pathEscape(group), milestone)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var i []*Issue
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// GetGroupMilestoneMergeRequestsOptions represents the available
-// GetGroupMilestoneMergeRequests() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#get-all-merge-requests-assigned-to-a-single-milestone
-type GetGroupMilestoneMergeRequestsOptions ListOptions
-
-// GetGroupMilestoneMergeRequests gets all merge requests assigned to a
-// single group milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/group_milestones.html#get-all-merge-requests-assigned-to-a-single-milestone
-func (s *GroupMilestonesService) GetGroupMilestoneMergeRequests(gid interface{}, milestone int, opt *GetGroupMilestoneMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/milestones/%d/merge_requests", pathEscape(group), milestone)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var mr []*MergeRequest
- resp, err := s.client.Do(req, &mr)
- if err != nil {
- return nil, resp, err
- }
-
- return mr, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/group_variables.go b/vendor/github.com/xanzy/go-gitlab/group_variables.go
deleted file mode 100644
index 694b2019..00000000
--- a/vendor/github.com/xanzy/go-gitlab/group_variables.go
+++ /dev/null
@@ -1,196 +0,0 @@
-//
-// Copyright 2018, Patrick Webster
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// GroupVariablesService handles communication with the
-// group variables related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html
-type GroupVariablesService struct {
- client *Client
-}
-
-// GroupVariable represents a GitLab group Variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html
-type GroupVariable struct {
- Key string `json:"key"`
- Value string `json:"value"`
- VariableType VariableTypeValue `json:"variable_type"`
- Protected bool `json:"protected"`
-}
-
-func (v GroupVariable) String() string {
- return Stringify(v)
-}
-
-// ListGroupVariablesOptions represents the available options for listing variables
-// for a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html#list-group-variables
-type ListGroupVariablesOptions ListOptions
-
-// ListVariables gets a list of all variables for a group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html#list-group-variables
-func (s *GroupVariablesService) ListVariables(gid interface{}, opt *ListGroupVariablesOptions, options ...OptionFunc) ([]*GroupVariable, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/variables", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var vs []*GroupVariable
- resp, err := s.client.Do(req, &vs)
- if err != nil {
- return nil, resp, err
- }
-
- return vs, resp, err
-}
-
-// GetVariable gets a variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html#show-variable-details
-func (s *GroupVariablesService) GetVariable(gid interface{}, key string, options ...OptionFunc) (*GroupVariable, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/variables/%s", pathEscape(group), url.PathEscape(key))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(GroupVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// CreateGroupVariableOptions represents the available CreateVariable()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html#create-variable
-type CreateGroupVariableOptions struct {
- Key *string `url:"key,omitempty" json:"key,omitempty"`
- Value *string `url:"value,omitempty" json:"value,omitempty"`
- VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"`
- Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
-}
-
-// CreateVariable creates a new group variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html#create-variable
-func (s *GroupVariablesService) CreateVariable(gid interface{}, opt *CreateGroupVariableOptions, options ...OptionFunc) (*GroupVariable, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/variables", pathEscape(group))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(GroupVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// UpdateGroupVariableOptions represents the available UpdateVariable()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html#update-variable
-type UpdateGroupVariableOptions struct {
- Value *string `url:"value,omitempty" json:"value,omitempty"`
- VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"`
- Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
-}
-
-// UpdateVariable updates the position of an existing
-// group issue board list.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html#update-variable
-func (s *GroupVariablesService) UpdateVariable(gid interface{}, key string, opt *UpdateGroupVariableOptions, options ...OptionFunc) (*GroupVariable, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/variables/%s", pathEscape(group), url.PathEscape(key))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(GroupVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// RemoveVariable removes a group's variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/group_level_variables.html#remove-variable
-func (s *GroupVariablesService) RemoveVariable(gid interface{}, key string, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/variables/%s", pathEscape(group), url.PathEscape(key))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/groups.go b/vendor/github.com/xanzy/go-gitlab/groups.go
deleted file mode 100644
index b2e7dd32..00000000
--- a/vendor/github.com/xanzy/go-gitlab/groups.go
+++ /dev/null
@@ -1,335 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
-)
-
-// GroupsService handles communication with the group related methods of
-// the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html
-type GroupsService struct {
- client *Client
-}
-
-// Group represents a GitLab group.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html
-type Group struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Path string `json:"path"`
- Description string `json:"description"`
- Visibility *VisibilityValue `json:"visibility"`
- LFSEnabled bool `json:"lfs_enabled"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- RequestAccessEnabled bool `json:"request_access_enabled"`
- FullName string `json:"full_name"`
- FullPath string `json:"full_path"`
- ParentID int `json:"parent_id"`
- Projects []*Project `json:"projects"`
- Statistics *StorageStatistics `json:"statistics"`
- CustomAttributes []*CustomAttribute `json:"custom_attributes"`
- ShareWithGroupLock bool `json:"share_with_group_lock"`
- RequireTwoFactorAuth bool `json:"require_two_factor_authentication"`
- TwoFactorGracePeriod int `json:"two_factor_grace_period"`
- ProjectCreationLevel string `json:"project_creation_level"`
- AutoDevopsEnabled bool `json:"auto_devops_enabled"`
- SubGroupCreationLevel string `json:"subgroup_creation_level"`
- EmailsDisabled bool `json:"emails_disabled"`
- RunnersToken string `json:"runners_token"`
- SharedProjects []*Project `json:"shared_projects"`
- LDAPCN string `json:"ldap_cn"`
- LDAPAccess bool `json:"ldap_access"`
- SharedRunnersMinutesLimit int `json:"shared_runners_minutes_limit"`
- ExtraSharedRunnersMinutesLimit int `json:"extra_shared_runners_minutes_limit"`
-}
-
-// ListGroupsOptions represents the available ListGroups() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#list-project-groups
-type ListGroupsOptions struct {
- ListOptions
- AllAvailable *bool `url:"all_available,omitempty" json:"all_available,omitempty"`
- MinAccessLevel *AccessLevelValue `url:"min_access_level,omitempty" json:"min_access_level,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Owned *bool `url:"owned,omitempty" json:"owned,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- SkipGroups []int `url:"skip_groups,omitempty" json:"skip_groups,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Statistics *bool `url:"statistics,omitempty" json:"statistics,omitempty"`
- WithCustomAttributes *bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"`
-}
-
-// ListGroups gets a list of groups (as user: my groups, as admin: all groups).
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/groups.html#list-project-groups
-func (s *GroupsService) ListGroups(opt *ListGroupsOptions, options ...OptionFunc) ([]*Group, *Response, error) {
- req, err := s.client.NewRequest("GET", "groups", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var g []*Group
- resp, err := s.client.Do(req, &g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
-
-// GetGroup gets all details of a group.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#details-of-a-group
-func (s *GroupsService) GetGroup(gid interface{}, options ...OptionFunc) (*Group, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- g := new(Group)
- resp, err := s.client.Do(req, g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
-
-// CreateGroupOptions represents the available CreateGroup() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#new-group
-type CreateGroupOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Path *string `url:"path,omitempty" json:"path,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
- LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
- RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
- ParentID *int `url:"parent_id,omitempty" json:"parent_id,omitempty"`
-}
-
-// CreateGroup creates a new project group. Available only for users who can
-// create groups.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#new-group
-func (s *GroupsService) CreateGroup(opt *CreateGroupOptions, options ...OptionFunc) (*Group, *Response, error) {
- req, err := s.client.NewRequest("POST", "groups", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- g := new(Group)
- resp, err := s.client.Do(req, g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
-
-// TransferGroup transfers a project to the Group namespace. Available only
-// for admin.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/groups.html#transfer-project-to-group
-func (s *GroupsService) TransferGroup(gid interface{}, pid interface{}, options ...OptionFunc) (*Group, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/projects/%s", pathEscape(group), pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- g := new(Group)
- resp, err := s.client.Do(req, g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
-
-// UpdateGroupOptions represents the set of available options to update a Group;
-// as of today these are exactly the same available when creating a new Group.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#update-group
-type UpdateGroupOptions CreateGroupOptions
-
-// UpdateGroup updates an existing group; only available to group owners and
-// administrators.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#update-group
-func (s *GroupsService) UpdateGroup(gid interface{}, opt *UpdateGroupOptions, options ...OptionFunc) (*Group, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s", pathEscape(group))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- g := new(Group)
- resp, err := s.client.Do(req, g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
-
-// DeleteGroup removes group with all projects inside.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#remove-group
-func (s *GroupsService) DeleteGroup(gid interface{}, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s", pathEscape(group))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// SearchGroup get all groups that match your string in their name or path.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/groups.html#search-for-group
-func (s *GroupsService) SearchGroup(query string, options ...OptionFunc) ([]*Group, *Response, error) {
- var q struct {
- Search string `url:"search,omitempty" json:"search,omitempty"`
- }
- q.Search = query
-
- req, err := s.client.NewRequest("GET", "groups", &q, options)
- if err != nil {
- return nil, nil, err
- }
-
- var g []*Group
- resp, err := s.client.Do(req, &g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
-
-// ListGroupProjectsOptions represents the available ListGroupProjects()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/groups.html#list-a-group-39-s-projects
-type ListGroupProjectsOptions struct {
- ListOptions
- Archived *bool `url:"archived,omitempty" json:"archived,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- Simple *bool `url:"simple,omitempty" json:"simple,omitempty"`
- Owned *bool `url:"owned,omitempty" json:"owned,omitempty"`
- Starred *bool `url:"starred,omitempty" json:"starred,omitempty"`
- WithIssuesEnabled *bool `url:"with_issues_enabled,omitempty" json:"with_issues_enabled,omitempty"`
- WithMergeRequestsEnabled *bool `url:"with_merge_requests_enabled,omitempty" json:"with_merge_requests_enabled,omitempty"`
- WithShared *bool `url:"with_shared,omitempty" json:"with_shared,omitempty"`
- IncludeSubgroups *bool `url:"include_subgroups,omitempty" json:"include_subgroups,omitempty"`
- WithCustomAttributes *bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"`
-}
-
-// ListGroupProjects get a list of group projects
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/groups.html#list-a-group-39-s-projects
-func (s *GroupsService) ListGroupProjects(gid interface{}, opt *ListGroupProjectsOptions, options ...OptionFunc) ([]*Project, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/projects", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*Project
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ListSubgroupsOptions represents the available ListSubgroupsOptions()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/groups.html#list-a-groups-s-subgroups
-type ListSubgroupsOptions ListGroupsOptions
-
-// ListSubgroups gets a list of subgroups for a given project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/groups.html#list-a-groups-s-subgroups
-func (s *GroupsService) ListSubgroups(gid interface{}, opt *ListSubgroupsOptions, options ...OptionFunc) ([]*Group, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/subgroups", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var g []*Group
- resp, err := s.client.Do(req, &g)
- if err != nil {
- return nil, resp, err
- }
-
- return g, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/issue_links.go b/vendor/github.com/xanzy/go-gitlab/issue_links.go
deleted file mode 100644
index f310d791..00000000
--- a/vendor/github.com/xanzy/go-gitlab/issue_links.go
+++ /dev/null
@@ -1,127 +0,0 @@
-//
-// Copyright 2017, Arkbriar
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
-)
-
-// IssueLinksService handles communication with the issue relations related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/issue_links.html
-type IssueLinksService struct {
- client *Client
-}
-
-// IssueLink represents a two-way relation between two issues.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/issue_links.html
-type IssueLink struct {
- SourceIssue *Issue `json:"source_issue"`
- TargetIssue *Issue `json:"target_issue"`
-}
-
-// ListIssueRelations gets a list of related issues of a given issue,
-// sorted by the relationship creation datetime (ascending).
-//
-// Issues will be filtered according to the user authorizations.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/issue_links.html#list-issue-relations
-func (s *IssueLinksService) ListIssueRelations(pid interface{}, issueIID int, options ...OptionFunc) ([]*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/links", pathEscape(project), issueIID)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var is []*Issue
- resp, err := s.client.Do(req, &is)
- if err != nil {
- return nil, resp, err
- }
-
- return is, resp, err
-}
-
-// CreateIssueLinkOptions represents the available CreateIssueLink() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/issue_links.html
-type CreateIssueLinkOptions struct {
- TargetProjectID *string `json:"target_project_id"`
- TargetIssueIID *string `json:"target_issue_iid"`
-}
-
-// CreateIssueLink creates a two-way relation between two issues.
-// User must be allowed to update both issues in order to succeed.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/issue_links.html#create-an-issue-link
-func (s *IssueLinksService) CreateIssueLink(pid interface{}, issueIID int, opt *CreateIssueLinkOptions, options ...OptionFunc) (*IssueLink, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/links", pathEscape(project), issueIID)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(IssueLink)
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// DeleteIssueLink deletes an issue link, thus removes the two-way relationship.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/issue_links.html#delete-an-issue-link
-func (s *IssueLinksService) DeleteIssueLink(pid interface{}, issueIID, issueLinkID int, options ...OptionFunc) (*IssueLink, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/links/%d",
- pathEscape(project),
- issueIID,
- issueLinkID)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(IssueLink)
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/issues.go b/vendor/github.com/xanzy/go-gitlab/issues.go
deleted file mode 100644
index 70a1255d..00000000
--- a/vendor/github.com/xanzy/go-gitlab/issues.go
+++ /dev/null
@@ -1,568 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "encoding/json"
- "fmt"
- "strings"
- "time"
-)
-
-// IssuesService handles communication with the issue related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html
-type IssuesService struct {
- client *Client
- timeStats *timeStatsService
-}
-
-// IssueAuthor represents a author of the issue.
-type IssueAuthor struct {
- ID int `json:"id"`
- State string `json:"state"`
- WebURL string `json:"web_url"`
- Name string `json:"name"`
- AvatarURL string `json:"avatar_url"`
- Username string `json:"username"`
-}
-
-// IssueAssignee represents a assignee of the issue.
-type IssueAssignee struct {
- ID int `json:"id"`
- State string `json:"state"`
- WebURL string `json:"web_url"`
- Name string `json:"name"`
- AvatarURL string `json:"avatar_url"`
- Username string `json:"username"`
-}
-
-// IssueLinks represents links of the issue.
-type IssueLinks struct {
- Self string `json:"self"`
- Notes string `json:"notes"`
- AwardEmoji string `json:"award_emoji"`
- Project string `json:"project"`
-}
-
-// Issue represents a GitLab issue.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html
-type Issue struct {
- ID int `json:"id"`
- IID int `json:"iid"`
- ProjectID int `json:"project_id"`
- Milestone *Milestone `json:"milestone"`
- Author *IssueAuthor `json:"author"`
- Description string `json:"description"`
- State string `json:"state"`
- Assignees []*IssueAssignee `json:"assignees"`
- Assignee *IssueAssignee `json:"assignee"`
- Upvotes int `json:"upvotes"`
- Downvotes int `json:"downvotes"`
- Labels Labels `json:"labels"`
- Title string `json:"title"`
- UpdatedAt *time.Time `json:"updated_at"`
- CreatedAt *time.Time `json:"created_at"`
- ClosedAt *time.Time `json:"closed_at"`
- Subscribed bool `json:"subscribed"`
- UserNotesCount int `json:"user_notes_count"`
- DueDate *ISOTime `json:"due_date"`
- WebURL string `json:"web_url"`
- TimeStats *TimeStats `json:"time_stats"`
- Confidential bool `json:"confidential"`
- Weight int `json:"weight"`
- DiscussionLocked bool `json:"discussion_locked"`
- Links *IssueLinks `json:"_links"`
- IssueLinkID int `json:"issue_link_id"`
- MergeRequestCount int `json:"merge_requests_count"`
-}
-
-func (i Issue) String() string {
- return Stringify(i)
-}
-
-// Labels is a custom type with specific marshaling characteristics.
-type Labels []string
-
-// MarshalJSON implements the json.Marshaler interface.
-func (l *Labels) MarshalJSON() ([]byte, error) {
- return json.Marshal(strings.Join(*l, ","))
-}
-
-// ListIssuesOptions represents the available ListIssues() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-issues
-type ListIssuesOptions struct {
- ListOptions
- State *string `url:"state,omitempty" json:"state,omitempty"`
- Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"`
- Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
- IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
- CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
- UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
- UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
- Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
-}
-
-// ListIssues gets all issues created by authenticated user. This function
-// takes pagination parameters page and per_page to restrict the list of issues.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-issues
-func (s *IssuesService) ListIssues(opt *ListIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- req, err := s.client.NewRequest("GET", "issues", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var i []*Issue
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// ListGroupIssuesOptions represents the available ListGroupIssues() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-group-issues
-type ListGroupIssuesOptions struct {
- ListOptions
- State *string `url:"state,omitempty" json:"state,omitempty"`
- Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
- Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- In *string `url:"in,omitempty" json:"in,omitempty"`
- CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
- CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
- UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
- UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
-}
-
-// ListGroupIssues gets a list of group issues. This function accepts
-// pagination parameters page and per_page to return the list of group issues.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-group-issues
-func (s *IssuesService) ListGroupIssues(pid interface{}, opt *ListGroupIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- group, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/issues", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var i []*Issue
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// ListProjectIssuesOptions represents the available ListProjectIssues() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-project-issues
-type ListProjectIssuesOptions struct {
- ListOptions
- IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
- State *string `url:"state,omitempty" json:"state,omitempty"`
- Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- WithLabelDetails *bool `url:"with_labels_details,omitempty" json:"with_labels_details,omitempty"`
- Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- In *string `url:"in,omitempty" json:"in,omitempty"`
- CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
- CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
- UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
- UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
- Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
-}
-
-// ListProjectIssues gets a list of project issues. This function accepts
-// pagination parameters page and per_page to return the list of project issues.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#list-project-issues
-func (s *IssuesService) ListProjectIssues(pid interface{}, opt *ListProjectIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var i []*Issue
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// GetIssue gets a single project issue.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#single-issues
-func (s *IssuesService) GetIssue(pid interface{}, issue int, options ...OptionFunc) (*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d", pathEscape(project), issue)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(Issue)
- resp, err := s.client.Do(req, i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// CreateIssueOptions represents the available CreateIssue() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#new-issues
-type CreateIssueOptions struct {
- IID *int `url:"iid,omitempty" json:"iid,omitempty"`
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
- AssigneeIDs []int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"`
- MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
- Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
- DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
- MergeRequestToResolveDiscussionsOf *int `url:"merge_request_to_resolve_discussions_of,omitempty" json:"merge_request_to_resolve_discussions_of,omitempty"`
- DiscussionToResolve *string `url:"discussion_to_resolve,omitempty" json:"discussion_to_resolve,omitempty"`
- Weight *int `url:"weight,omitempty" json:"weight,omitempty"`
-}
-
-// CreateIssue creates a new project issue.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#new-issues
-func (s *IssuesService) CreateIssue(pid interface{}, opt *CreateIssueOptions, options ...OptionFunc) (*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(Issue)
- resp, err := s.client.Do(req, i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// UpdateIssueOptions represents the available UpdateIssue() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/issues.html#edit-issue
-type UpdateIssueOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Confidential *bool `url:"confidential,omitempty" json:"confidential,omitempty"`
- AssigneeIDs []int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"`
- MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
- Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"`
- UpdatedAt *time.Time `url:"updated_at,omitempty" json:"updated_at,omitempty"`
- DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
- Weight *int `url:"weight,omitempty" json:"weight,omitempty"`
- DiscussionLocked *bool `url:"discussion_locked,omitempty" json:"discussion_locked,omitempty"`
-}
-
-// UpdateIssue updates an existing project issue. This function is also used
-// to mark an issue as closed.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#edit-issues
-func (s *IssuesService) UpdateIssue(pid interface{}, issue int, opt *UpdateIssueOptions, options ...OptionFunc) (*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d", pathEscape(project), issue)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(Issue)
- resp, err := s.client.Do(req, i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// DeleteIssue deletes a single project issue.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/issues.html#delete-an-issue
-func (s *IssuesService) DeleteIssue(pid interface{}, issue int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d", pathEscape(project), issue)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// MoveIssueOptions represents the available MoveIssue() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/issues.html#move-an-issue
-type MoveIssueOptions struct {
- ToProjectID *int `url:"to_project_id,omitempty" json:"to_project_id,omitempty"`
-}
-
-// MoveIssue updates an existing project issue. This function is also used
-// to mark an issue as closed.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/issues.html#move-an-issue
-func (s *IssuesService) MoveIssue(pid interface{}, issue int, opt *MoveIssueOptions, options ...OptionFunc) (*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/move", pathEscape(project), issue)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(Issue)
- resp, err := s.client.Do(req, i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// SubscribeToIssue subscribes the authenticated user to the given issue to
-// receive notifications. If the user is already subscribed to the issue, the
-// status code 304 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#subscribe-to-a-merge-request
-func (s *IssuesService) SubscribeToIssue(pid interface{}, issue int, options ...OptionFunc) (*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/subscribe", pathEscape(project), issue)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(Issue)
- resp, err := s.client.Do(req, i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// UnsubscribeFromIssue unsubscribes the authenticated user from the given
-// issue to not receive notifications from that merge request. If the user
-// is not subscribed to the issue, status code 304 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#unsubscribe-from-a-merge-request
-func (s *IssuesService) UnsubscribeFromIssue(pid interface{}, issue int, options ...OptionFunc) (*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/unsubscribe", pathEscape(project), issue)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- i := new(Issue)
- resp, err := s.client.Do(req, i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// ListMergeRequestsClosingIssueOptions represents the available
-// ListMergeRequestsClosingIssue() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#list-merge-requests-that-will-close-issue-on-merge
-type ListMergeRequestsClosingIssueOptions ListOptions
-
-// ListMergeRequestsClosingIssue gets all the merge requests that will close
-// issue when merged.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#list-merge-requests-that-will-close-issue-on-merge
-func (s *IssuesService) ListMergeRequestsClosingIssue(pid interface{}, issue int, opt *ListMergeRequestsClosingIssueOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("/projects/%s/issues/%d/closed_by", pathEscape(project), issue)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var m []*MergeRequest
- resp, err := s.client.Do(req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// ListMergeRequestsRelatedToIssueOptions represents the available
-// ListMergeRequestsRelatedToIssue() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#list-merge-requests-related-to-issue
-type ListMergeRequestsRelatedToIssueOptions ListOptions
-
-// ListMergeRequestsRelatedToIssue gets all the merge requests that are
-// related to the issue
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#list-merge-requests-related-to-issue
-func (s *IssuesService) ListMergeRequestsRelatedToIssue(pid interface{}, issue int, opt *ListMergeRequestsRelatedToIssueOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("/projects/%s/issues/%d/related_merge_requests",
- pathEscape(project),
- issue,
- )
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var m []*MergeRequest
- resp, err := s.client.Do(req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// SetTimeEstimate sets the time estimate for a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#set-a-time-estimate-for-an-issue
-func (s *IssuesService) SetTimeEstimate(pid interface{}, issue int, opt *SetTimeEstimateOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.setTimeEstimate(pid, "issues", issue, opt, options...)
-}
-
-// ResetTimeEstimate resets the time estimate for a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#reset-the-time-estimate-for-an-issue
-func (s *IssuesService) ResetTimeEstimate(pid interface{}, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.resetTimeEstimate(pid, "issues", issue, options...)
-}
-
-// AddSpentTime adds spent time for a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#add-spent-time-for-an-issue
-func (s *IssuesService) AddSpentTime(pid interface{}, issue int, opt *AddSpentTimeOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.addSpentTime(pid, "issues", issue, opt, options...)
-}
-
-// ResetSpentTime resets the spent time for a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#reset-spent-time-for-an-issue
-func (s *IssuesService) ResetSpentTime(pid interface{}, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.resetSpentTime(pid, "issues", issue, options...)
-}
-
-// GetTimeSpent gets the spent time for a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/issues.html#get-time-tracking-stats
-func (s *IssuesService) GetTimeSpent(pid interface{}, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.getTimeSpent(pid, "issues", issue, options...)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/jobs.go b/vendor/github.com/xanzy/go-gitlab/jobs.go
deleted file mode 100644
index f0c1e2c4..00000000
--- a/vendor/github.com/xanzy/go-gitlab/jobs.go
+++ /dev/null
@@ -1,408 +0,0 @@
-//
-// Copyright 2017, Arkbriar
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "bytes"
- "fmt"
- "io"
- "time"
-)
-
-// JobsService handles communication with the ci builds related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/jobs.html
-type JobsService struct {
- client *Client
-}
-
-// Job represents a ci build.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/jobs.html
-type Job struct {
- Commit *Commit `json:"commit"`
- Coverage float64 `json:"coverage"`
- AllowFailure bool `json:"allow_failure"`
- CreatedAt *time.Time `json:"created_at"`
- StartedAt *time.Time `json:"started_at"`
- FinishedAt *time.Time `json:"finished_at"`
- Duration float64 `json:"duration"`
- ArtifactsExpireAt *time.Time `json:"artifacts_expire_at"`
- ID int `json:"id"`
- Name string `json:"name"`
- Pipeline struct {
- ID int `json:"id"`
- Ref string `json:"ref"`
- Sha string `json:"sha"`
- Status string `json:"status"`
- } `json:"pipeline"`
- Ref string `json:"ref"`
- Artifacts []struct {
- FileType string `json:"file_type"`
- Filename string `json:"filename"`
- Size int `json:"size"`
- FileFormat string `json:"file_format"`
- } `json:"artifacts"`
- ArtifactsFile struct {
- Filename string `json:"filename"`
- Size int `json:"size"`
- } `json:"artifacts_file"`
- Runner struct {
- ID int `json:"id"`
- Description string `json:"description"`
- Active bool `json:"active"`
- IsShared bool `json:"is_shared"`
- Name string `json:"name"`
- } `json:"runner"`
- Stage string `json:"stage"`
- Status string `json:"status"`
- Tag bool `json:"tag"`
- WebURL string `json:"web_url"`
- User *User `json:"user"`
-}
-
-// ListJobsOptions are options for two list apis
-type ListJobsOptions struct {
- ListOptions
- Scope []BuildStateValue `url:"scope[],omitempty" json:"scope,omitempty"`
-}
-
-// ListProjectJobs gets a list of jobs in a project.
-//
-// The scope of jobs to show, one or array of: created, pending, running,
-// failed, success, canceled, skipped; showing all jobs if none provided
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#list-project-jobs
-func (s *JobsService) ListProjectJobs(pid interface{}, opts *ListJobsOptions, options ...OptionFunc) ([]Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- var jobs []Job
- resp, err := s.client.Do(req, &jobs)
- if err != nil {
- return nil, resp, err
- }
-
- return jobs, resp, err
-}
-
-// ListPipelineJobs gets a list of jobs for specific pipeline in a
-// project. If the pipeline ID is not found, it will respond with 404.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#list-pipeline-jobs
-func (s *JobsService) ListPipelineJobs(pid interface{}, pipelineID int, opts *ListJobsOptions, options ...OptionFunc) ([]*Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipelines/%d/jobs", pathEscape(project), pipelineID)
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- var jobs []*Job
- resp, err := s.client.Do(req, &jobs)
- if err != nil {
- return nil, resp, err
- }
-
- return jobs, resp, err
-}
-
-// GetJob gets a single job of a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#get-a-single-job
-func (s *JobsService) GetJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d", pathEscape(project), jobID)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- job := new(Job)
- resp, err := s.client.Do(req, job)
- if err != nil {
- return nil, resp, err
- }
-
- return job, resp, err
-}
-
-// GetJobArtifacts get jobs artifacts of a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#get-job-artifacts
-func (s *JobsService) GetJobArtifacts(pid interface{}, jobID int, options ...OptionFunc) (io.Reader, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d/artifacts", pathEscape(project), jobID)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- artifactsBuf := new(bytes.Buffer)
- resp, err := s.client.Do(req, artifactsBuf)
- if err != nil {
- return nil, resp, err
- }
-
- return artifactsBuf, resp, err
-}
-
-// DownloadArtifactsFileOptions represents the available DownloadArtifactsFile()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#download-the-artifacts-file
-type DownloadArtifactsFileOptions struct {
- Job *string `url:"job" json:"job"`
-}
-
-// DownloadArtifactsFile download the artifacts file from the given
-// reference name and job provided the job finished successfully.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#download-the-artifacts-file
-func (s *JobsService) DownloadArtifactsFile(pid interface{}, refName string, opt *DownloadArtifactsFileOptions, options ...OptionFunc) (io.Reader, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/artifacts/%s/download", pathEscape(project), refName)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- artifactsBuf := new(bytes.Buffer)
- resp, err := s.client.Do(req, artifactsBuf)
- if err != nil {
- return nil, resp, err
- }
-
- return artifactsBuf, resp, err
-}
-
-// DownloadSingleArtifactsFile download a file from the artifacts from the
-// given reference name and job provided the job finished successfully.
-// Only a single file is going to be extracted from the archive and streamed
-// to a client.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#download-a-single-artifact-file
-func (s *JobsService) DownloadSingleArtifactsFile(pid interface{}, jobID int, artifactPath string, options ...OptionFunc) (io.Reader, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
-
- u := fmt.Sprintf(
- "projects/%s/jobs/%d/artifacts/%s",
- pathEscape(project),
- jobID,
- artifactPath,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- artifactBuf := new(bytes.Buffer)
- resp, err := s.client.Do(req, artifactBuf)
- if err != nil {
- return nil, resp, err
- }
-
- return artifactBuf, resp, err
-}
-
-// GetTraceFile gets a trace of a specific job of a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#get-a-trace-file
-func (s *JobsService) GetTraceFile(pid interface{}, jobID int, options ...OptionFunc) (io.Reader, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d/trace", pathEscape(project), jobID)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- traceBuf := new(bytes.Buffer)
- resp, err := s.client.Do(req, traceBuf)
- if err != nil {
- return nil, resp, err
- }
-
- return traceBuf, resp, err
-}
-
-// CancelJob cancels a single job of a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#cancel-a-job
-func (s *JobsService) CancelJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d/cancel", pathEscape(project), jobID)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- job := new(Job)
- resp, err := s.client.Do(req, job)
- if err != nil {
- return nil, resp, err
- }
-
- return job, resp, err
-}
-
-// RetryJob retries a single job of a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#retry-a-job
-func (s *JobsService) RetryJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d/retry", pathEscape(project), jobID)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- job := new(Job)
- resp, err := s.client.Do(req, job)
- if err != nil {
- return nil, resp, err
- }
-
- return job, resp, err
-}
-
-// EraseJob erases a single job of a project, removes a job
-// artifacts and a job trace.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#erase-a-job
-func (s *JobsService) EraseJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d/erase", pathEscape(project), jobID)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- job := new(Job)
- resp, err := s.client.Do(req, job)
- if err != nil {
- return nil, resp, err
- }
-
- return job, resp, err
-}
-
-// KeepArtifacts prevents artifacts from being deleted when
-// expiration is set.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#keep-artifacts
-func (s *JobsService) KeepArtifacts(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d/artifacts/keep", pathEscape(project), jobID)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- job := new(Job)
- resp, err := s.client.Do(req, job)
- if err != nil {
- return nil, resp, err
- }
-
- return job, resp, err
-}
-
-// PlayJob triggers a manual action to start a job.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/jobs.html#play-a-job
-func (s *JobsService) PlayJob(pid interface{}, jobID int, options ...OptionFunc) (*Job, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/jobs/%d/play", pathEscape(project), jobID)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- job := new(Job)
- resp, err := s.client.Do(req, job)
- if err != nil {
- return nil, resp, err
- }
-
- return job, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/keys.go b/vendor/github.com/xanzy/go-gitlab/keys.go
deleted file mode 100644
index 9657e862..00000000
--- a/vendor/github.com/xanzy/go-gitlab/keys.go
+++ /dev/null
@@ -1,65 +0,0 @@
-//
-// Copyright 2018, Patrick Webster
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// KeysService handles communication with the
-// keys related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/keys.html
-type KeysService struct {
- client *Client
-}
-
-// Key represents a GitLab user's SSH key.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/keys.html
-type Key struct {
- ID int `json:"id"`
- Title string `json:"title"`
- Key string `json:"key"`
- CreatedAt *time.Time `json:"created_at"`
- User User `json:"user"`
-}
-
-// GetKeyWithUser gets a single key by id along with the associated
-// user information.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/keys.html#get-ssh-key-with-user-by-id-of-an-ssh-key
-func (s *KeysService) GetKeyWithUser(key int, options ...OptionFunc) (*Key, *Response, error) {
- u := fmt.Sprintf("keys/%d", key)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(Key)
- resp, err := s.client.Do(req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/labels.go b/vendor/github.com/xanzy/go-gitlab/labels.go
deleted file mode 100644
index 7baf6663..00000000
--- a/vendor/github.com/xanzy/go-gitlab/labels.go
+++ /dev/null
@@ -1,250 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "encoding/json"
- "fmt"
-)
-
-// LabelsService handles communication with the label related methods of the
-// GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html
-type LabelsService struct {
- client *Client
-}
-
-// Label represents a GitLab label.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html
-type Label struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Color string `json:"color"`
- TextColor string `json:"text_color"`
- Description string `json:"description"`
- OpenIssuesCount int `json:"open_issues_count"`
- ClosedIssuesCount int `json:"closed_issues_count"`
- OpenMergeRequestsCount int `json:"open_merge_requests_count"`
- Subscribed bool `json:"subscribed"`
- Priority int `json:"priority"`
- IsProjectLabel bool `json:"is_project_label"`
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface.
-func (l *Label) UnmarshalJSON(data []byte) error {
- type alias Label
- if err := json.Unmarshal(data, (*alias)(l)); err != nil {
- return err
- }
-
- if l.Name == "" {
- var raw map[string]interface{}
- if err := json.Unmarshal(data, &raw); err != nil {
- return err
- }
- if title, ok := raw["title"].(string); ok {
- l.Name = title
- }
- }
-
- return nil
-}
-
-func (l Label) String() string {
- return Stringify(l)
-}
-
-// ListLabelsOptions represents the available ListLabels() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#list-labels
-type ListLabelsOptions ListOptions
-
-// ListLabels gets all labels for given project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#list-labels
-func (s *LabelsService) ListLabels(pid interface{}, opt *ListLabelsOptions, options ...OptionFunc) ([]*Label, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/labels", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var l []*Label
- resp, err := s.client.Do(req, &l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// CreateLabelOptions represents the available CreateLabel() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#create-a-new-label
-type CreateLabelOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Color *string `url:"color,omitempty" json:"color,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
-}
-
-// CreateLabel creates a new label for given repository with given name and
-// color.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#create-a-new-label
-func (s *LabelsService) CreateLabel(pid interface{}, opt *CreateLabelOptions, options ...OptionFunc) (*Label, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/labels", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(Label)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// DeleteLabelOptions represents the available DeleteLabel() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#delete-a-label
-type DeleteLabelOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
-}
-
-// DeleteLabel deletes a label given by its name.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#delete-a-label
-func (s *LabelsService) DeleteLabel(pid interface{}, opt *DeleteLabelOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/labels", pathEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// UpdateLabelOptions represents the available UpdateLabel() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#delete-a-label
-type UpdateLabelOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- NewName *string `url:"new_name,omitempty" json:"new_name,omitempty"`
- Color *string `url:"color,omitempty" json:"color,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
-}
-
-// UpdateLabel updates an existing label with new name or now color. At least
-// one parameter is required, to update the label.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/labels.html#edit-an-existing-label
-func (s *LabelsService) UpdateLabel(pid interface{}, opt *UpdateLabelOptions, options ...OptionFunc) (*Label, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/labels", pathEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(Label)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// SubscribeToLabel subscribes the authenticated user to a label to receive
-// notifications. If the user is already subscribed to the label, the status
-// code 304 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/labels.html#subscribe-to-a-label
-func (s *LabelsService) SubscribeToLabel(pid interface{}, labelID interface{}, options ...OptionFunc) (*Label, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- label, err := parseID(labelID)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/labels/%s/subscribe", pathEscape(project), label)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(Label)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// UnsubscribeFromLabel unsubscribes the authenticated user from a label to not
-// receive notifications from it. If the user is not subscribed to the label, the
-// status code 304 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/labels.html#unsubscribe-from-a-label
-func (s *LabelsService) UnsubscribeFromLabel(pid interface{}, labelID interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- label, err := parseID(labelID)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/labels/%s/unsubscribe", pathEscape(project), label)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/license.go b/vendor/github.com/xanzy/go-gitlab/license.go
deleted file mode 100644
index 746e99ae..00000000
--- a/vendor/github.com/xanzy/go-gitlab/license.go
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// Copyright 2018, Patrick Webster
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-// LicenseService handles communication with the license
-// related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/license.html
-type LicenseService struct {
- client *Client
-}
-
-// License represents a GitLab license.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/license.html
-type License struct {
- StartsAt *ISOTime `json:"starts_at"`
- ExpiresAt *ISOTime `json:"expires_at"`
- Licensee struct {
- Name string `json:"Name"`
- Company string `json:"Company"`
- Email string `json:"Email"`
- } `json:"licensee"`
- UserLimit int `json:"user_limit"`
- ActiveUsers int `json:"active_users"`
- AddOns struct {
- GitLabFileLocks int `json:"GitLabFileLocks"`
- } `json:"add_ons"`
-}
-
-func (l License) String() string {
- return Stringify(l)
-}
-
-// GetLicense retrieves information about the current license.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/license.html#retrieve-information-about-the-current-license
-func (s *LicenseService) GetLicense() (*License, *Response, error) {
- req, err := s.client.NewRequest("GET", "license", nil, nil)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(License)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// AddLicenseOptions represents the available AddLicense() options.
-//
-// https://docs.gitlab.com/ee/api/license.html#add-a-new-license
-type AddLicenseOptions struct {
- License *string `url:"license" json:"license"`
-}
-
-// AddLicense adds a new license.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/license.html#add-a-new-license
-func (s *LicenseService) AddLicense(opt *AddLicenseOptions, options ...OptionFunc) (*License, *Response, error) {
- req, err := s.client.NewRequest("POST", "license", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(License)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/license_templates.go b/vendor/github.com/xanzy/go-gitlab/license_templates.go
deleted file mode 100644
index 83f8259b..00000000
--- a/vendor/github.com/xanzy/go-gitlab/license_templates.go
+++ /dev/null
@@ -1,92 +0,0 @@
-package gitlab
-
-import (
- "fmt"
-)
-
-// LicenseTemplate represents a license template.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/licenses.html
-type LicenseTemplate struct {
- Key string `json:"key"`
- Name string `json:"name"`
- Nickname string `json:"nickname"`
- Featured bool `json:"featured"`
- HTMLURL string `json:"html_url"`
- SourceURL string `json:"source_url"`
- Description string `json:"description"`
- Conditions []string `json:"conditions"`
- Permissions []string `json:"permissions"`
- Limitations []string `json:"limitations"`
- Content string `json:"content"`
-}
-
-// LicenseTemplatesService handles communication with the license templates
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/templates/licenses.html
-type LicenseTemplatesService struct {
- client *Client
-}
-
-// ListLicenseTemplatesOptions represents the available
-// ListLicenseTemplates() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/licenses.html#list-license-templates
-type ListLicenseTemplatesOptions struct {
- ListOptions
- Popular *bool `url:"popular,omitempty" json:"popular,omitempty"`
-}
-
-// ListLicenseTemplates get all license templates.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/licenses.html#list-license-templates
-func (s *LicenseTemplatesService) ListLicenseTemplates(opt *ListLicenseTemplatesOptions, options ...OptionFunc) ([]*LicenseTemplate, *Response, error) {
- req, err := s.client.NewRequest("GET", "templates/licenses", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var lts []*LicenseTemplate
- resp, err := s.client.Do(req, &lts)
- if err != nil {
- return nil, resp, err
- }
-
- return lts, resp, err
-}
-
-// GetLicenseTemplateOptions represents the available
-// GetLicenseTemplate() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/licenses.html#single-license-template
-type GetLicenseTemplateOptions struct {
- Project *string `url:"project,omitempty" json:"project,omitempty"`
- Fullname *string `url:"fullname,omitempty" json:"fullname,omitempty"`
-}
-
-// GetLicenseTemplate get a single license template. You can pass parameters
-// to replace the license placeholder.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/templates/licenses.html#single-license-template
-func (s *LicenseTemplatesService) GetLicenseTemplate(template string, opt *GetLicenseTemplateOptions, options ...OptionFunc) (*LicenseTemplate, *Response, error) {
- u := fmt.Sprintf("templates/licenses/%s", template)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- lt := new(LicenseTemplate)
- resp, err := s.client.Do(req, lt)
- if err != nil {
- return nil, resp, err
- }
-
- return lt, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go b/vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go
deleted file mode 100644
index c11fe357..00000000
--- a/vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go
+++ /dev/null
@@ -1,191 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// MergeRequestApprovalsService handles communication with the merge request
-// approvals related methods of the GitLab API. This includes reading/updating
-// approval settings and approve/unapproving merge requests
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/merge_request_approvals.html
-type MergeRequestApprovalsService struct {
- client *Client
-}
-
-// MergeRequestApprovals represents GitLab merge request approvals.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#merge-request-level-mr-approvals
-type MergeRequestApprovals struct {
- ID int `json:"id"`
- ProjectID int `json:"project_id"`
- Title string `json:"title"`
- Description string `json:"description"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- UpdatedAt *time.Time `json:"updated_at"`
- MergeStatus string `json:"merge_status"`
- ApprovalsBeforeMerge int `json:"approvals_before_merge"`
- ApprovalsRequired int `json:"approvals_required"`
- ApprovalsLeft int `json:"approvals_left"`
- ApprovedBy []*MergeRequestApproverUser `json:"approved_by"`
- Approvers []*MergeRequestApproverUser `json:"approvers"`
- ApproverGroups []*MergeRequestApproverGroup `json:"approver_groups"`
- SuggestedApprovers []*BasicUser `json:"suggested_approvers"`
-}
-
-func (m MergeRequestApprovals) String() string {
- return Stringify(m)
-}
-
-// MergeRequestApproverGroup represents GitLab project level merge request approver group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#project-level-mr-approvals
-type MergeRequestApproverGroup struct {
- Group struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Path string `json:"path"`
- Description string `json:"description"`
- Visibility string `json:"visibility"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- FullName string `json:"full_name"`
- FullPath string `json:"full_path"`
- LFSEnabled bool `json:"lfs_enabled"`
- RequestAccessEnabled bool `json:"request_access_enabled"`
- }
-}
-
-// MergeRequestApproverUser represents GitLab project level merge request approver user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#project-level-mr-approvals
-type MergeRequestApproverUser struct {
- User *BasicUser
-}
-
-// ApproveMergeRequestOptions represents the available ApproveMergeRequest() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#approve-merge-request
-type ApproveMergeRequestOptions struct {
- SHA *string `url:"sha,omitempty" json:"sha,omitempty"`
-}
-
-// ApproveMergeRequest approves a merge request on GitLab. If a non-empty sha
-// is provided then it must match the sha at the HEAD of the MR.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#approve-merge-request
-func (s *MergeRequestApprovalsService) ApproveMergeRequest(pid interface{}, mr int, opt *ApproveMergeRequestOptions, options ...OptionFunc) (*MergeRequestApprovals, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/approve", pathEscape(project), mr)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequestApprovals)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// UnapproveMergeRequest unapproves a previously approved merge request on GitLab.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#unapprove-merge-request
-func (s *MergeRequestApprovalsService) UnapproveMergeRequest(pid interface{}, mr int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/unapprove", pathEscape(project), mr)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ChangeMergeRequestApprovalConfigurationOptions represents the available
-// ChangeMergeRequestApprovalConfiguration() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-approval-configuration
-type ChangeMergeRequestApprovalConfigurationOptions struct {
- ApprovalsRequired *int `url:"approvals_required,omitempty" json:"approvals_required,omitempty"`
-}
-
-// ChangeApprovalConfiguration updates the approval configuration of a merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-approval-configuration
-func (s *MergeRequestApprovalsService) ChangeApprovalConfiguration(pid interface{}, mergeRequestIID int, opt *ChangeMergeRequestApprovalConfigurationOptions, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/approvals", pathEscape(project), mergeRequestIID)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// ChangeMergeRequestAllowedApproversOptions represents the available
-// ChangeMergeRequestAllowedApprovers() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-allowed-approvers-for-merge-request
-type ChangeMergeRequestAllowedApproversOptions struct {
- ApproverIDs []int `url:"approver_ids" json:"approver_ids"`
- ApproverGroupIDs []int `url:"approver_group_ids" json:"approver_group_ids"`
-}
-
-// ChangeAllowedApprovers updates the approvers for a merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-allowed-approvers-for-merge-request
-func (s *MergeRequestApprovalsService) ChangeAllowedApprovers(pid interface{}, mergeRequestIID int, opt *ChangeMergeRequestAllowedApproversOptions, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/approvers", pathEscape(project), mergeRequestIID)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/merge_requests.go b/vendor/github.com/xanzy/go-gitlab/merge_requests.go
deleted file mode 100644
index 4e10cb8f..00000000
--- a/vendor/github.com/xanzy/go-gitlab/merge_requests.go
+++ /dev/null
@@ -1,836 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// MergeRequestsService handles communication with the merge requests related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/merge_requests.html
-type MergeRequestsService struct {
- client *Client
- timeStats *timeStatsService
-}
-
-// MergeRequest represents a GitLab merge request.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/merge_requests.html
-type MergeRequest struct {
- ID int `json:"id"`
- IID int `json:"iid"`
- TargetBranch string `json:"target_branch"`
- SourceBranch string `json:"source_branch"`
- ProjectID int `json:"project_id"`
- Title string `json:"title"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- UpdatedAt *time.Time `json:"updated_at"`
- Upvotes int `json:"upvotes"`
- Downvotes int `json:"downvotes"`
- Author *BasicUser `json:"author"`
- Assignee *BasicUser `json:"assignee"`
- Assignees []*BasicUser `json:"assignees"`
- SourceProjectID int `json:"source_project_id"`
- TargetProjectID int `json:"target_project_id"`
- Labels Labels `json:"labels"`
- Description string `json:"description"`
- WorkInProgress bool `json:"work_in_progress"`
- Milestone *Milestone `json:"milestone"`
- MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"`
- MergeStatus string `json:"merge_status"`
- MergeError string `json:"merge_error"`
- MergedBy *BasicUser `json:"merged_by"`
- MergedAt *time.Time `json:"merged_at"`
- ClosedBy *BasicUser `json:"closed_by"`
- ClosedAt *time.Time `json:"closed_at"`
- Subscribed bool `json:"subscribed"`
- SHA string `json:"sha"`
- MergeCommitSHA string `json:"merge_commit_sha"`
- UserNotesCount int `json:"user_notes_count"`
- ChangesCount string `json:"changes_count"`
- ShouldRemoveSourceBranch bool `json:"should_remove_source_branch"`
- ForceRemoveSourceBranch bool `json:"force_remove_source_branch"`
- WebURL string `json:"web_url"`
- DiscussionLocked bool `json:"discussion_locked"`
- Changes []struct {
- OldPath string `json:"old_path"`
- NewPath string `json:"new_path"`
- AMode string `json:"a_mode"`
- BMode string `json:"b_mode"`
- Diff string `json:"diff"`
- NewFile bool `json:"new_file"`
- RenamedFile bool `json:"renamed_file"`
- DeletedFile bool `json:"deleted_file"`
- } `json:"changes"`
- TimeStats *TimeStats `json:"time_stats"`
- Squash bool `json:"squash"`
- Pipeline *PipelineInfo `json:"pipeline"`
- HeadPipeline *Pipeline `json:"head_pipeline"`
- DiffRefs struct {
- BaseSha string `json:"base_sha"`
- HeadSha string `json:"head_sha"`
- StartSha string `json:"start_sha"`
- } `json:"diff_refs"`
- DivergedCommitsCount int `json:"diverged_commits_count"`
- RebaseInProgress bool `json:"rebase_in_progress"`
- ApprovalsBeforeMerge int `json:"approvals_before_merge"`
- Reference string `json:"reference"`
- TaskCompletionStatus struct {
- Count int `json:"count"`
- CompletedCount int `json:"completed_count"`
- } `json:"task_completion_status"`
-}
-
-func (m MergeRequest) String() string {
- return Stringify(m)
-}
-
-// MergeRequestDiffVersion represents Gitlab merge request version.
-//
-// Gitlab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-a-single-mr-diff-version
-type MergeRequestDiffVersion struct {
- ID int `json:"id"`
- HeadCommitSHA string `json:"head_commit_sha,omitempty"`
- BaseCommitSHA string `json:"base_commit_sha,omitempty"`
- StartCommitSHA string `json:"start_commit_sha,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- MergeRequestID int `json:"merge_request_id,omitempty"`
- State string `json:"state,omitempty"`
- RealSize string `json:"real_size,omitempty"`
- Commits []*Commit `json:"commits,omitempty"`
- Diffs []*Diff `json:"diffs,omitempty"`
-}
-
-func (m MergeRequestDiffVersion) String() string {
- return Stringify(m)
-}
-
-// ListMergeRequestsOptions represents the available ListMergeRequests()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-merge-requests
-type ListMergeRequestsOptions struct {
- ListOptions
- State *string `url:"state,omitempty" json:"state,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
- View *string `url:"view,omitempty" json:"view,omitempty"`
- Labels Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
- CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
- UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
- UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
- SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
- TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- In *string `url:"in,omitempty" json:"in,omitempty"`
- WIP *string `url:"wip,omitempty" json:"wip,omitempty"`
-}
-
-// ListMergeRequests gets all merge requests. The state parameter can be used
-// to get only merge requests with a given state (opened, closed, or merged)
-// or all of them (all). The pagination parameters page and per_page can be
-// used to restrict the list of merge requests.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-merge-requests
-func (s *MergeRequestsService) ListMergeRequests(opt *ListMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- req, err := s.client.NewRequest("GET", "merge_requests", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var m []*MergeRequest
- resp, err := s.client.Do(req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// ListGroupMergeRequestsOptions represents the available ListGroupMergeRequests()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-group-merge-requests
-type ListGroupMergeRequestsOptions struct {
- ListOptions
- State *string `url:"state,omitempty" json:"state,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
- View *string `url:"view,omitempty" json:"view,omitempty"`
- Labels *Labels `url:"labels,omitempty" json:"labels,omitempty"`
- CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
- CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
- UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
- UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
- SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
- TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
-}
-
-// ListGroupMergeRequests gets all merge requests for this group.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-group-merge-requests
-func (s *MergeRequestsService) ListGroupMergeRequests(gid interface{}, opt *ListGroupMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/merge_requests", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var m []*MergeRequest
- resp, err := s.client.Do(req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// ListProjectMergeRequestsOptions represents the available ListMergeRequests()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-project-merge-requests
-type ListProjectMergeRequestsOptions struct {
- ListOptions
- IIDs []int `url:"iids[],omitempty" json:"iids,omitempty"`
- State *string `url:"state,omitempty" json:"state,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Milestone *string `url:"milestone,omitempty" json:"milestone,omitempty"`
- View *string `url:"view,omitempty" json:"view,omitempty"`
- Labels *Labels `url:"labels,omitempty" json:"labels,omitempty"`
- CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
- CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
- UpdatedAfter *time.Time `url:"updated_after,omitempty" json:"updated_after,omitempty"`
- UpdatedBefore *time.Time `url:"updated_before,omitempty" json:"updated_before,omitempty"`
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- MyReactionEmoji *string `url:"my_reaction_emoji,omitempty" json:"my_reaction_emoji,omitempty"`
- SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
- TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- WIP *string `url:"wip,omitempty" json:"wip,omitempty"`
-}
-
-// ListProjectMergeRequests gets all merge requests for this project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-project-merge-requests
-func (s *MergeRequestsService) ListProjectMergeRequests(pid interface{}, opt *ListProjectMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var m []*MergeRequest
- resp, err := s.client.Do(req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// GetMergeRequestsOptions represents the available GetMergeRequests()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr
-type GetMergeRequestsOptions struct {
- RenderHTML *bool `url:"render_html,omitempty" json:"render_html,omitempty"`
- IncludeDivergedCommitsCount *bool `url:"include_diverged_commits_count,omitempty" json:"include_diverged_commits_count,omitempty"`
- IncludeRebaseInProgress *bool `url:"include_rebase_in_progress,omitempty" json:"include_rebase_in_progress,omitempty"`
-}
-
-// GetMergeRequest shows information about a single merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr
-func (s *MergeRequestsService) GetMergeRequest(pid interface{}, mergeRequest int, opt *GetMergeRequestsOptions, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// GetMergeRequestApprovals gets information about a merge requests approvals
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#merge-request-level-mr-approvals
-func (s *MergeRequestsService) GetMergeRequestApprovals(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequestApprovals, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/approvals", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- a := new(MergeRequestApprovals)
- resp, err := s.client.Do(req, a)
- if err != nil {
- return nil, resp, err
- }
-
- return a, resp, err
-}
-
-// GetMergeRequestCommitsOptions represents the available GetMergeRequestCommits()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr-commits
-type GetMergeRequestCommitsOptions ListOptions
-
-// GetMergeRequestCommits gets a list of merge request commits.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr-commits
-func (s *MergeRequestsService) GetMergeRequestCommits(pid interface{}, mergeRequest int, opt *GetMergeRequestCommitsOptions, options ...OptionFunc) ([]*Commit, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/commits", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var c []*Commit
- resp, err := s.client.Do(req, &c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// GetMergeRequestChanges shows information about the merge request including
-// its files and changes.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-single-mr-changes
-func (s *MergeRequestsService) GetMergeRequestChanges(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/changes", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// ListMergeRequestPipelines gets all pipelines for the provided merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-mr-pipelines
-func (s *MergeRequestsService) ListMergeRequestPipelines(pid interface{}, mergeRequest int, options ...OptionFunc) ([]*PipelineInfo, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/pipelines", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*PipelineInfo
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// GetIssuesClosedOnMergeOptions represents the available GetIssuesClosedOnMerge()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-issues-that-will-close-on-merge
-type GetIssuesClosedOnMergeOptions ListOptions
-
-// GetIssuesClosedOnMerge gets all the issues that would be closed by merging the
-// provided merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#list-issues-that-will-close-on-merge
-func (s *MergeRequestsService) GetIssuesClosedOnMerge(pid interface{}, mergeRequest int, opt *GetIssuesClosedOnMergeOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/closes_issues", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var i []*Issue
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// CreateMergeRequestOptions represents the available CreateMergeRequest()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#create-mr
-type CreateMergeRequestOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- SourceBranch *string `url:"source_branch,omitempty" json:"source_branch,omitempty"`
- TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
- Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- AssigneeIDs []int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"`
- TargetProjectID *int `url:"target_project_id,omitempty" json:"target_project_id,omitempty"`
- MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
- RemoveSourceBranch *bool `url:"remove_source_branch,omitempty" json:"remove_source_branch,omitempty"`
- Squash *bool `url:"squash,omitempty" json:"squash,omitempty"`
- AllowCollaboration *bool `url:"allow_collaboration,omitempty" json:"allow_collaboration,omitempty"`
-}
-
-// CreateMergeRequest creates a new merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#create-mr
-func (s *MergeRequestsService) CreateMergeRequest(pid interface{}, opt *CreateMergeRequestOptions, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// UpdateMergeRequestOptions represents the available UpdateMergeRequest()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#update-mr
-type UpdateMergeRequestOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- TargetBranch *string `url:"target_branch,omitempty" json:"target_branch,omitempty"`
- AssigneeID *int `url:"assignee_id,omitempty" json:"assignee_id,omitempty"`
- AssigneeIDs []int `url:"assignee_ids,omitempty" json:"assignee_ids,omitempty"`
- Labels *Labels `url:"labels,comma,omitempty" json:"labels,omitempty"`
- MilestoneID *int `url:"milestone_id,omitempty" json:"milestone_id,omitempty"`
- StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"`
- RemoveSourceBranch *bool `url:"remove_source_branch,omitempty" json:"remove_source_branch,omitempty"`
- Squash *bool `url:"squash,omitempty" json:"squash,omitempty"`
- DiscussionLocked *bool `url:"discussion_locked,omitempty" json:"discussion_locked,omitempty"`
- AllowCollaboration *bool `url:"allow_collaboration,omitempty" json:"allow_collaboration,omitempty"`
-}
-
-// UpdateMergeRequest updates an existing project milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#update-mr
-func (s *MergeRequestsService) UpdateMergeRequest(pid interface{}, mergeRequest int, opt *UpdateMergeRequestOptions, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// DeleteMergeRequest deletes a merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#delete-a-merge-request
-func (s *MergeRequestsService) DeleteMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// AcceptMergeRequestOptions represents the available AcceptMergeRequest()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#accept-mr
-type AcceptMergeRequestOptions struct {
- MergeCommitMessage *string `url:"merge_commit_message,omitempty" json:"merge_commit_message,omitempty"`
- SquashCommitMessage *string `url:"squash_commit_message,omitempty" json:"squash_commit_message,omitempty"`
- Squash *bool `url:"squash,omitempty" json:"squash,omitempty"`
- ShouldRemoveSourceBranch *bool `url:"should_remove_source_branch,omitempty" json:"should_remove_source_branch,omitempty"`
- MergeWhenPipelineSucceeds *bool `url:"merge_when_pipeline_succeeds,omitempty" json:"merge_when_pipeline_succeeds,omitempty"`
- SHA *string `url:"sha,omitempty" json:"sha,omitempty"`
-}
-
-// AcceptMergeRequest merges changes submitted with MR using this API. If merge
-// success you get 200 OK. If it has some conflicts and can not be merged - you
-// get 405 and error message 'Branch cannot be merged'. If merge request is
-// already merged or closed - you get 405 and error message 'Method Not Allowed'
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#accept-mr
-func (s *MergeRequestsService) AcceptMergeRequest(pid interface{}, mergeRequest int, opt *AcceptMergeRequestOptions, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/merge", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// CancelMergeWhenPipelineSucceeds cancels a merge when pipeline succeeds. If
-// you don't have permissions to accept this merge request - you'll get a 401.
-// If the merge request is already merged or closed - you get 405 and error
-// message 'Method Not Allowed'. In case the merge request is not set to be
-// merged when the pipeline succeeds, you'll also get a 406 error.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#cancel-merge-when-pipeline-succeeds
-func (s *MergeRequestsService) CancelMergeWhenPipelineSucceeds(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/cancel_merge_when_pipeline_succeeds", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("PUT", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// RebaseMergeRequest automatically rebases the source_branch of the merge
-// request against its target_branch. If you don’t have permissions to push
-// to the merge request’s source branch, you’ll get a 403 Forbidden response.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#rebase-a-merge-request
-func (s *MergeRequestsService) RebaseMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/rebase", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("PUT", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// GetMergeRequestDiffVersionsOptions represents the available
-// GetMergeRequestDiffVersions() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-mr-diff-versions
-type GetMergeRequestDiffVersionsOptions ListOptions
-
-// GetMergeRequestDiffVersions get a list of merge request diff versions.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-mr-diff-versions
-func (s *MergeRequestsService) GetMergeRequestDiffVersions(pid interface{}, mergeRequest int, opt *GetMergeRequestDiffVersionsOptions, options ...OptionFunc) ([]*MergeRequestDiffVersion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/versions", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var v []*MergeRequestDiffVersion
- resp, err := s.client.Do(req, &v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// GetSingleMergeRequestDiffVersion get a single MR diff version
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-a-single-mr-diff-version
-func (s *MergeRequestsService) GetSingleMergeRequestDiffVersion(pid interface{}, mergeRequest, version int, options ...OptionFunc) (*MergeRequestDiffVersion, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/versions/%d", pathEscape(project), mergeRequest, version)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var v = new(MergeRequestDiffVersion)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// SubscribeToMergeRequest subscribes the authenticated user to the given merge
-// request to receive notifications. If the user is already subscribed to the
-// merge request, the status code 304 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#subscribe-to-a-merge-request
-func (s *MergeRequestsService) SubscribeToMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/subscribe", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// UnsubscribeFromMergeRequest unsubscribes the authenticated user from the
-// given merge request to not receive notifications from that merge request.
-// If the user is not subscribed to the merge request, status code 304 is
-// returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#unsubscribe-from-a-merge-request
-func (s *MergeRequestsService) UnsubscribeFromMergeRequest(pid interface{}, mergeRequest int, options ...OptionFunc) (*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/unsubscribe", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(MergeRequest)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// CreateTodo manually creates a todo for the current user on a merge request.
-// If there already exists a todo for the user on that merge request,
-// status code 304 is returned.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#create-a-todo
-func (s *MergeRequestsService) CreateTodo(pid interface{}, mergeRequest int, options ...OptionFunc) (*Todo, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/todo", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(Todo)
- resp, err := s.client.Do(req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// SetTimeEstimate sets the time estimate for a single project merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#set-a-time-estimate-for-a-merge-request
-func (s *MergeRequestsService) SetTimeEstimate(pid interface{}, mergeRequest int, opt *SetTimeEstimateOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.setTimeEstimate(pid, "merge_requests", mergeRequest, opt, options...)
-}
-
-// ResetTimeEstimate resets the time estimate for a single project merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#reset-the-time-estimate-for-a-merge-request
-func (s *MergeRequestsService) ResetTimeEstimate(pid interface{}, mergeRequest int, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.resetTimeEstimate(pid, "merge_requests", mergeRequest, options...)
-}
-
-// AddSpentTime adds spent time for a single project merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#add-spent-time-for-a-merge-request
-func (s *MergeRequestsService) AddSpentTime(pid interface{}, mergeRequest int, opt *AddSpentTimeOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.addSpentTime(pid, "merge_requests", mergeRequest, opt, options...)
-}
-
-// ResetSpentTime resets the spent time for a single project merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#reset-spent-time-for-a-merge-request
-func (s *MergeRequestsService) ResetSpentTime(pid interface{}, mergeRequest int, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.resetSpentTime(pid, "merge_requests", mergeRequest, options...)
-}
-
-// GetTimeSpent gets the spent time for a single project merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/merge_requests.html#get-time-tracking-stats
-func (s *MergeRequestsService) GetTimeSpent(pid interface{}, mergeRequest int, options ...OptionFunc) (*TimeStats, *Response, error) {
- return s.timeStats.getTimeSpent(pid, "merge_requests", mergeRequest, options...)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/milestones.go b/vendor/github.com/xanzy/go-gitlab/milestones.go
deleted file mode 100644
index f3f7f7c8..00000000
--- a/vendor/github.com/xanzy/go-gitlab/milestones.go
+++ /dev/null
@@ -1,267 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// MilestonesService handles communication with the milestone related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/milestones.html
-type MilestonesService struct {
- client *Client
-}
-
-// Milestone represents a GitLab milestone.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/milestones.html
-type Milestone struct {
- ID int `json:"id"`
- IID int `json:"iid"`
- ProjectID int `json:"project_id"`
- Title string `json:"title"`
- Description string `json:"description"`
- StartDate *ISOTime `json:"start_date"`
- DueDate *ISOTime `json:"due_date"`
- State string `json:"state"`
- UpdatedAt *time.Time `json:"updated_at"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-func (m Milestone) String() string {
- return Stringify(m)
-}
-
-// ListMilestonesOptions represents the available ListMilestones() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#list-project-milestones
-type ListMilestonesOptions struct {
- ListOptions
- IIDs []int `url:"iids,omitempty" json:"iids,omitempty"`
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- State *string `url:"state,omitempty" json:"state,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
-}
-
-// ListMilestones returns a list of project milestones.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#list-project-milestones
-func (s *MilestonesService) ListMilestones(pid interface{}, opt *ListMilestonesOptions, options ...OptionFunc) ([]*Milestone, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/milestones", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var m []*Milestone
- resp, err := s.client.Do(req, &m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// GetMilestone gets a single project milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#get-single-milestone
-func (s *MilestonesService) GetMilestone(pid interface{}, milestone int, options ...OptionFunc) (*Milestone, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/milestones/%d", pathEscape(project), milestone)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(Milestone)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// CreateMilestoneOptions represents the available CreateMilestone() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#create-new-milestone
-type CreateMilestoneOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- StartDate *ISOTime `url:"start_date,omitempty" json:"start_date,omitempty"`
- DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
-}
-
-// CreateMilestone creates a new project milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#create-new-milestone
-func (s *MilestonesService) CreateMilestone(pid interface{}, opt *CreateMilestoneOptions, options ...OptionFunc) (*Milestone, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/milestones", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(Milestone)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// UpdateMilestoneOptions represents the available UpdateMilestone() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#edit-milestone
-type UpdateMilestoneOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- StartDate *ISOTime `url:"start_date,omitempty" json:"start_date,omitempty"`
- DueDate *ISOTime `url:"due_date,omitempty" json:"due_date,omitempty"`
- StateEvent *string `url:"state_event,omitempty" json:"state_event,omitempty"`
-}
-
-// UpdateMilestone updates an existing project milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#edit-milestone
-func (s *MilestonesService) UpdateMilestone(pid interface{}, milestone int, opt *UpdateMilestoneOptions, options ...OptionFunc) (*Milestone, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/milestones/%d", pathEscape(project), milestone)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- m := new(Milestone)
- resp, err := s.client.Do(req, m)
- if err != nil {
- return nil, resp, err
- }
-
- return m, resp, err
-}
-
-// DeleteMilestone deletes a specified project milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#delete-project-milestone
-func (s *MilestonesService) DeleteMilestone(pid interface{}, milestone int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/milestones/%d", pathEscape(project), milestone)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
- return s.client.Do(req, nil)
-}
-
-// GetMilestoneIssuesOptions represents the available GetMilestoneIssues() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#get-all-issues-assigned-to-a-single-milestone
-type GetMilestoneIssuesOptions ListOptions
-
-// GetMilestoneIssues gets all issues assigned to a single project milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#get-all-issues-assigned-to-a-single-milestone
-func (s *MilestonesService) GetMilestoneIssues(pid interface{}, milestone int, opt *GetMilestoneIssuesOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/milestones/%d/issues", pathEscape(project), milestone)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var i []*Issue
- resp, err := s.client.Do(req, &i)
- if err != nil {
- return nil, resp, err
- }
-
- return i, resp, err
-}
-
-// GetMilestoneMergeRequestsOptions represents the available
-// GetMilestoneMergeRequests() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#get-all-merge-requests-assigned-to-a-single-milestone
-type GetMilestoneMergeRequestsOptions ListOptions
-
-// GetMilestoneMergeRequests gets all merge requests assigned to a single
-// project milestone.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/milestones.html#get-all-merge-requests-assigned-to-a-single-milestone
-func (s *MilestonesService) GetMilestoneMergeRequests(pid interface{}, milestone int, opt *GetMilestoneMergeRequestsOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/milestones/%d/merge_requests", pathEscape(project), milestone)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var mr []*MergeRequest
- resp, err := s.client.Do(req, &mr)
- if err != nil {
- return nil, resp, err
- }
-
- return mr, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/namespaces.go b/vendor/github.com/xanzy/go-gitlab/namespaces.go
deleted file mode 100644
index 9add6449..00000000
--- a/vendor/github.com/xanzy/go-gitlab/namespaces.go
+++ /dev/null
@@ -1,122 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
-)
-
-// NamespacesService handles communication with the namespace related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html
-type NamespacesService struct {
- client *Client
-}
-
-// Namespace represents a GitLab namespace.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html
-type Namespace struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Path string `json:"path"`
- Kind string `json:"kind"`
- FullPath string `json:"full_path"`
- ParentID int `json:"parent_id"`
- MembersCountWithDescendants int `json:"members_count_with_descendants"`
-}
-
-func (n Namespace) String() string {
- return Stringify(n)
-}
-
-// ListNamespacesOptions represents the available ListNamespaces() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html#list-namespaces
-type ListNamespacesOptions struct {
- ListOptions
- Search *string `url:"search,omitempty" json:"search,omitempty"`
-}
-
-// ListNamespaces gets a list of projects accessible by the authenticated user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/namespaces.html#list-namespaces
-func (s *NamespacesService) ListNamespaces(opt *ListNamespacesOptions, options ...OptionFunc) ([]*Namespace, *Response, error) {
- req, err := s.client.NewRequest("GET", "namespaces", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var n []*Namespace
- resp, err := s.client.Do(req, &n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// SearchNamespace gets all namespaces that match your string in their name
-// or path.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/namespaces.html#search-for-namespace
-func (s *NamespacesService) SearchNamespace(query string, options ...OptionFunc) ([]*Namespace, *Response, error) {
- var q struct {
- Search string `url:"search,omitempty" json:"search,omitempty"`
- }
- q.Search = query
-
- req, err := s.client.NewRequest("GET", "namespaces", &q, options)
- if err != nil {
- return nil, nil, err
- }
-
- var n []*Namespace
- resp, err := s.client.Do(req, &n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// GetNamespace gets a namespace by id.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/namespaces.html#get-namespace-by-id
-func (s *NamespacesService) GetNamespace(id interface{}, options ...OptionFunc) (*Namespace, *Response, error) {
- namespace, err := parseID(id)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("namespaces/%s", namespace)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Namespace)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/notes.go b/vendor/github.com/xanzy/go-gitlab/notes.go
deleted file mode 100644
index 91ecf450..00000000
--- a/vendor/github.com/xanzy/go-gitlab/notes.go
+++ /dev/null
@@ -1,678 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// NotesService handles communication with the notes related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/notes.html
-type NotesService struct {
- client *Client
-}
-
-// Note represents a GitLab note.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/notes.html
-type Note struct {
- ID int `json:"id"`
- Body string `json:"body"`
- Attachment string `json:"attachment"`
- Title string `json:"title"`
- FileName string `json:"file_name"`
- Author struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"author"`
- System bool `json:"system"`
- ExpiresAt *time.Time `json:"expires_at"`
- UpdatedAt *time.Time `json:"updated_at"`
- CreatedAt *time.Time `json:"created_at"`
- NoteableID int `json:"noteable_id"`
- NoteableType string `json:"noteable_type"`
- Position *NotePosition `json:"position"`
- Resolvable bool `json:"resolvable"`
- Resolved bool `json:"resolved"`
- ResolvedBy struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"resolved_by"`
- NoteableIID int `json:"noteable_iid"`
-}
-
-// NotePosition represents the position attributes of a note.
-type NotePosition struct {
- BaseSHA string `json:"base_sha"`
- StartSHA string `json:"start_sha"`
- HeadSHA string `json:"head_sha"`
- PositionType string `json:"position_type"`
- NewPath string `json:"new_path,omitempty"`
- NewLine int `json:"new_line,omitempty"`
- OldPath string `json:"old_path,omitempty"`
- OldLine int `json:"old_line,omitempty"`
- Width int `json:"width,omitempty"`
- Height int `json:"height,omitempty"`
- X int `json:"x,omitempty"`
- Y int `json:"y,omitempty"`
-}
-
-func (n Note) String() string {
- return Stringify(n)
-}
-
-// ListIssueNotesOptions represents the available ListIssueNotes() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#list-project-issue-notes
-type ListIssueNotesOptions struct {
- ListOptions
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
-}
-
-// ListIssueNotes gets a list of all notes for a single issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#list-project-issue-notes
-func (s *NotesService) ListIssueNotes(pid interface{}, issue int, opt *ListIssueNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/notes", pathEscape(project), issue)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var n []*Note
- resp, err := s.client.Do(req, &n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// GetIssueNote returns a single note for a specific project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#get-single-issue-note
-func (s *NotesService) GetIssueNote(pid interface{}, issue, note int, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/notes/%d", pathEscape(project), issue, note)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// CreateIssueNoteOptions represents the available CreateIssueNote()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#create-new-issue-note
-type CreateIssueNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
- CreatedAt *time.Time `url:"created_at,omitempty" json:"created_at,omitempty"`
-}
-
-// CreateIssueNote creates a new note to a single project issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#create-new-issue-note
-func (s *NotesService) CreateIssueNote(pid interface{}, issue int, opt *CreateIssueNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/notes", pathEscape(project), issue)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// UpdateIssueNoteOptions represents the available UpdateIssueNote()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#modify-existing-issue-note
-type UpdateIssueNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
-}
-
-// UpdateIssueNote modifies existing note of an issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#modify-existing-issue-note
-func (s *NotesService) UpdateIssueNote(pid interface{}, issue, note int, opt *UpdateIssueNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/notes/%d", pathEscape(project), issue, note)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// DeleteIssueNote deletes an existing note of an issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#delete-an-issue-note
-func (s *NotesService) DeleteIssueNote(pid interface{}, issue, note int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/notes/%d", pathEscape(project), issue, note)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListSnippetNotesOptions represents the available ListSnippetNotes() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#list-all-snippet-notes
-type ListSnippetNotesOptions struct {
- ListOptions
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
-}
-
-// ListSnippetNotes gets a list of all notes for a single snippet. Snippet
-// notes are comments users can post to a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#list-all-snippet-notes
-func (s *NotesService) ListSnippetNotes(pid interface{}, snippet int, opt *ListSnippetNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/notes", pathEscape(project), snippet)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var n []*Note
- resp, err := s.client.Do(req, &n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// GetSnippetNote returns a single note for a given snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#get-single-snippet-note
-func (s *NotesService) GetSnippetNote(pid interface{}, snippet, note int, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/notes/%d", pathEscape(project), snippet, note)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// CreateSnippetNoteOptions represents the available CreateSnippetNote()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#create-new-snippet-note
-type CreateSnippetNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
-}
-
-// CreateSnippetNote creates a new note for a single snippet. Snippet notes are
-// comments users can post to a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#create-new-snippet-note
-func (s *NotesService) CreateSnippetNote(pid interface{}, snippet int, opt *CreateSnippetNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/notes", pathEscape(project), snippet)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// UpdateSnippetNoteOptions represents the available UpdateSnippetNote()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#modify-existing-snippet-note
-type UpdateSnippetNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
-}
-
-// UpdateSnippetNote modifies existing note of a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#modify-existing-snippet-note
-func (s *NotesService) UpdateSnippetNote(pid interface{}, snippet, note int, opt *UpdateSnippetNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/notes/%d", pathEscape(project), snippet, note)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// DeleteSnippetNote deletes an existing note of a snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#delete-a-snippet-note
-func (s *NotesService) DeleteSnippetNote(pid interface{}, snippet, note int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/notes/%d", pathEscape(project), snippet, note)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListMergeRequestNotesOptions represents the available ListMergeRequestNotes()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#list-all-merge-request-notes
-type ListMergeRequestNotesOptions struct {
- ListOptions
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
-}
-
-// ListMergeRequestNotes gets a list of all notes for a single merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#list-all-merge-request-notes
-func (s *NotesService) ListMergeRequestNotes(pid interface{}, mergeRequest int, opt *ListMergeRequestNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/notes", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var n []*Note
- resp, err := s.client.Do(req, &n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// GetMergeRequestNote returns a single note for a given merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#get-single-merge-request-note
-func (s *NotesService) GetMergeRequestNote(pid interface{}, mergeRequest, note int, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/notes/%d", pathEscape(project), mergeRequest, note)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// CreateMergeRequestNoteOptions represents the available
-// CreateMergeRequestNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#create-new-merge-request-note
-type CreateMergeRequestNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
-}
-
-// CreateMergeRequestNote creates a new note for a single merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#create-new-merge-request-note
-func (s *NotesService) CreateMergeRequestNote(pid interface{}, mergeRequest int, opt *CreateMergeRequestNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/notes", pathEscape(project), mergeRequest)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// UpdateMergeRequestNoteOptions represents the available
-// UpdateMergeRequestNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#modify-existing-merge-request-note
-type UpdateMergeRequestNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
-}
-
-// UpdateMergeRequestNote modifies existing note of a merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#modify-existing-merge-request-note
-func (s *NotesService) UpdateMergeRequestNote(pid interface{}, mergeRequest, note int, opt *UpdateMergeRequestNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf(
- "projects/%s/merge_requests/%d/notes/%d", pathEscape(project), mergeRequest, note)
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// DeleteMergeRequestNote deletes an existing note of a merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notes.html#delete-a-merge-request-note
-func (s *NotesService) DeleteMergeRequestNote(pid interface{}, mergeRequest, note int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf(
- "projects/%s/merge_requests/%d/notes/%d", pathEscape(project), mergeRequest, note)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListEpicNotesOptions represents the available ListEpicNotes() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/notes.html#list-all-epic-notes
-type ListEpicNotesOptions struct {
- ListOptions
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
-}
-
-// ListEpicNotes gets a list of all notes for a single epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/notes.html#list-all-epic-notes
-func (s *NotesService) ListEpicNotes(gid interface{}, epic int, opt *ListEpicNotesOptions, options ...OptionFunc) ([]*Note, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/notes", pathEscape(group), epic)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var n []*Note
- resp, err := s.client.Do(req, &n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// GetEpicNote returns a single note for an epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/notes.html#get-single-epic-note
-func (s *NotesService) GetEpicNote(gid interface{}, epic, note int, options ...OptionFunc) (*Note, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/notes/%d", pathEscape(group), epic, note)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// CreateEpicNoteOptions represents the available CreateEpicNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/notes.html#create-new-epic-note
-type CreateEpicNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
-}
-
-// CreateEpicNote creates a new note for a single merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/notes.html#create-new-epic-note
-func (s *NotesService) CreateEpicNote(gid interface{}, epic int, opt *CreateEpicNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/notes", pathEscape(group), epic)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// UpdateEpicNoteOptions represents the available UpdateEpicNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/notes.html#modify-existing-epic-note
-type UpdateEpicNoteOptions struct {
- Body *string `url:"body,omitempty" json:"body,omitempty"`
-}
-
-// UpdateEpicNote modifies existing note of an epic.
-//
-// https://docs.gitlab.com/ee/api/notes.html#modify-existing-epic-note
-func (s *NotesService) UpdateEpicNote(gid interface{}, epic, note int, opt *UpdateEpicNoteOptions, options ...OptionFunc) (*Note, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/notes/%d", pathEscape(group), epic, note)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- n := new(Note)
- resp, err := s.client.Do(req, n)
- if err != nil {
- return nil, resp, err
- }
-
- return n, resp, err
-}
-
-// DeleteEpicNote deletes an existing note of a merge request.
-//
-// https://docs.gitlab.com/ee/api/notes.html#delete-an-epic-note
-func (s *NotesService) DeleteEpicNote(gid interface{}, epic, note int, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/notes/%d", pathEscape(group), epic, note)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/notifications.go b/vendor/github.com/xanzy/go-gitlab/notifications.go
deleted file mode 100644
index c044831b..00000000
--- a/vendor/github.com/xanzy/go-gitlab/notifications.go
+++ /dev/null
@@ -1,213 +0,0 @@
-package gitlab
-
-import (
- "errors"
- "fmt"
-)
-
-// NotificationSettingsService handles communication with the notification settings
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/notification_settings.html
-type NotificationSettingsService struct {
- client *Client
-}
-
-// NotificationSettings represents the Gitlab notification setting.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#notification-settings
-type NotificationSettings struct {
- Level NotificationLevelValue `json:"level"`
- NotificationEmail string `json:"notification_email"`
- Events *NotificationEvents `json:"events"`
-}
-
-// NotificationEvents represents the available notification setting events.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#notification-settings
-type NotificationEvents struct {
- CloseIssue bool `json:"close_issue"`
- CloseMergeRequest bool `json:"close_merge_request"`
- FailedPipeline bool `json:"failed_pipeline"`
- MergeMergeRequest bool `json:"merge_merge_request"`
- NewIssue bool `json:"new_issue"`
- NewMergeRequest bool `json:"new_merge_request"`
- NewNote bool `json:"new_note"`
- ReassignIssue bool `json:"reassign_issue"`
- ReassignMergeRequest bool `json:"reassign_merge_request"`
- ReopenIssue bool `json:"reopen_issue"`
- ReopenMergeRequest bool `json:"reopen_merge_request"`
- SuccessPipeline bool `json:"success_pipeline"`
-}
-
-func (ns NotificationSettings) String() string {
- return Stringify(ns)
-}
-
-// GetGlobalSettings returns current notification settings and email address.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#global-notification-settings
-func (s *NotificationSettingsService) GetGlobalSettings(options ...OptionFunc) (*NotificationSettings, *Response, error) {
- u := "notification_settings"
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ns := new(NotificationSettings)
- resp, err := s.client.Do(req, ns)
- if err != nil {
- return nil, resp, err
- }
-
- return ns, resp, err
-}
-
-// NotificationSettingsOptions represents the available options that can be passed
-// to the API when updating the notification settings.
-type NotificationSettingsOptions struct {
- Level *NotificationLevelValue `url:"level,omitempty" json:"level,omitempty"`
- NotificationEmail *string `url:"notification_email,omitempty" json:"notification_email,omitempty"`
- CloseIssue *bool `url:"close_issue,omitempty" json:"close_issue,omitempty"`
- CloseMergeRequest *bool `url:"close_merge_request,omitempty" json:"close_merge_request,omitempty"`
- FailedPipeline *bool `url:"failed_pipeline,omitempty" json:"failed_pipeline,omitempty"`
- MergeMergeRequest *bool `url:"merge_merge_request,omitempty" json:"merge_merge_request,omitempty"`
- NewIssue *bool `url:"new_issue,omitempty" json:"new_issue,omitempty"`
- NewMergeRequest *bool `url:"new_merge_request,omitempty" json:"new_merge_request,omitempty"`
- NewNote *bool `url:"new_note,omitempty" json:"new_note,omitempty"`
- ReassignIssue *bool `url:"reassign_issue,omitempty" json:"reassign_issue,omitempty"`
- ReassignMergeRequest *bool `url:"reassign_merge_request,omitempty" json:"reassign_merge_request,omitempty"`
- ReopenIssue *bool `url:"reopen_issue,omitempty" json:"reopen_issue,omitempty"`
- ReopenMergeRequest *bool `url:"reopen_merge_request,omitempty" json:"reopen_merge_request,omitempty"`
- SuccessPipeline *bool `url:"success_pipeline,omitempty" json:"success_pipeline,omitempty"`
-}
-
-// UpdateGlobalSettings updates current notification settings and email address.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#update-global-notification-settings
-func (s *NotificationSettingsService) UpdateGlobalSettings(opt *NotificationSettingsOptions, options ...OptionFunc) (*NotificationSettings, *Response, error) {
- if opt.Level != nil && *opt.Level == GlobalNotificationLevel {
- return nil, nil, errors.New(
- "notification level 'global' is not valid for global notification settings")
- }
-
- u := "notification_settings"
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ns := new(NotificationSettings)
- resp, err := s.client.Do(req, ns)
- if err != nil {
- return nil, resp, err
- }
-
- return ns, resp, err
-}
-
-// GetSettingsForGroup returns current group notification settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#group-project-level-notification-settings
-func (s *NotificationSettingsService) GetSettingsForGroup(gid interface{}, options ...OptionFunc) (*NotificationSettings, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/notification_settings", pathEscape(group))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ns := new(NotificationSettings)
- resp, err := s.client.Do(req, ns)
- if err != nil {
- return nil, resp, err
- }
-
- return ns, resp, err
-}
-
-// GetSettingsForProject returns current project notification settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#group-project-level-notification-settings
-func (s *NotificationSettingsService) GetSettingsForProject(pid interface{}, options ...OptionFunc) (*NotificationSettings, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/notification_settings", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ns := new(NotificationSettings)
- resp, err := s.client.Do(req, ns)
- if err != nil {
- return nil, resp, err
- }
-
- return ns, resp, err
-}
-
-// UpdateSettingsForGroup updates current group notification settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#update-group-project-level-notification-settings
-func (s *NotificationSettingsService) UpdateSettingsForGroup(gid interface{}, opt *NotificationSettingsOptions, options ...OptionFunc) (*NotificationSettings, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/notification_settings", pathEscape(group))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ns := new(NotificationSettings)
- resp, err := s.client.Do(req, ns)
- if err != nil {
- return nil, resp, err
- }
-
- return ns, resp, err
-}
-
-// UpdateSettingsForProject updates current project notification settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/notification_settings.html#update-group-project-level-notification-settings
-func (s *NotificationSettingsService) UpdateSettingsForProject(pid interface{}, opt *NotificationSettingsOptions, options ...OptionFunc) (*NotificationSettings, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/notification_settings", pathEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ns := new(NotificationSettings)
- resp, err := s.client.Do(req, ns)
- if err != nil {
- return nil, resp, err
- }
-
- return ns, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/pages_domains.go b/vendor/github.com/xanzy/go-gitlab/pages_domains.go
deleted file mode 100644
index da8f5149..00000000
--- a/vendor/github.com/xanzy/go-gitlab/pages_domains.go
+++ /dev/null
@@ -1,193 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// PagesDomainsService handles communication with the pages domains
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pages_domains.html
-type PagesDomainsService struct {
- client *Client
-}
-
-// PagesDomain represents a pages domain.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pages_domains.html
-type PagesDomain struct {
- Domain string `json:"domain"`
- URL string `json:"url"`
- ProjectID int `json:"project_id"`
- Verified bool `json:"verified"`
- VerificationCode string `json:"verification_code"`
- EnabledUntil *time.Time `json:"enabled_until"`
- Certificate struct {
- Expired bool `json:"expired"`
- Expiration *time.Time `json:"expiration"`
- } `json:"certificate"`
-}
-
-// ListPagesDomainsOptions represents the available ListPagesDomains() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#list-pages-domains
-type ListPagesDomainsOptions ListOptions
-
-// ListPagesDomains gets a list of project pages domains.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#list-pages-domains
-func (s *PagesDomainsService) ListPagesDomains(pid interface{}, opt *ListPagesDomainsOptions, options ...OptionFunc) ([]*PagesDomain, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pages/domains", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pd []*PagesDomain
- resp, err := s.client.Do(req, &pd)
- if err != nil {
- return nil, resp, err
- }
-
- return pd, resp, err
-}
-
-// ListAllPagesDomains gets a list of all pages domains.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#list-all-pages-domains
-func (s *PagesDomainsService) ListAllPagesDomains(options ...OptionFunc) ([]*PagesDomain, *Response, error) {
- req, err := s.client.NewRequest("GET", "pages/domains", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pd []*PagesDomain
- resp, err := s.client.Do(req, &pd)
- if err != nil {
- return nil, resp, err
- }
-
- return pd, resp, err
-}
-
-// GetPagesDomain get a specific pages domain for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#single-pages-domain
-func (s *PagesDomainsService) GetPagesDomain(pid interface{}, domain string, options ...OptionFunc) (*PagesDomain, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pages/domains/%s", pathEscape(project), domain)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pd := new(PagesDomain)
- resp, err := s.client.Do(req, pd)
- if err != nil {
- return nil, resp, err
- }
-
- return pd, resp, err
-}
-
-// CreatePagesDomainOptions represents the available CreatePagesDomain() options.
-//
-// GitLab API docs:
-// // https://docs.gitlab.com/ce/api/pages_domains.html#create-new-pages-domain
-type CreatePagesDomainOptions struct {
- Domain *string `url:"domain,omitempty" json:"domain,omitempty"`
- Certificate *string `url:"certifiate,omitempty" json:"certifiate,omitempty"`
- Key *string `url:"key,omitempty" json:"key,omitempty"`
-}
-
-// CreatePagesDomain creates a new project pages domain.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#create-new-pages-domain
-func (s *PagesDomainsService) CreatePagesDomain(pid interface{}, opt *CreatePagesDomainOptions, options ...OptionFunc) (*PagesDomain, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pages/domains", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pd := new(PagesDomain)
- resp, err := s.client.Do(req, pd)
- if err != nil {
- return nil, resp, err
- }
-
- return pd, resp, err
-}
-
-// UpdatePagesDomainOptions represents the available UpdatePagesDomain() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#update-pages-domain
-type UpdatePagesDomainOptions struct {
- Cerificate *string `url:"certifiate" json:"certifiate"`
- Key *string `url:"key" json:"key"`
-}
-
-// UpdatePagesDomain updates an existing project pages domain.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#update-pages-domain
-func (s *PagesDomainsService) UpdatePagesDomain(pid interface{}, domain string, opt *UpdatePagesDomainOptions, options ...OptionFunc) (*PagesDomain, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pages/domains/%s", pathEscape(project), domain)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pd := new(PagesDomain)
- resp, err := s.client.Do(req, pd)
- if err != nil {
- return nil, resp, err
- }
-
- return pd, resp, err
-}
-
-// DeletePagesDomain deletes an existing prject pages domain.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pages_domains.html#delete-pages-domain
-func (s *PagesDomainsService) DeletePagesDomain(pid interface{}, domain string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/pages/domains/%s", pathEscape(project), domain)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go b/vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go
deleted file mode 100644
index ebcf8297..00000000
--- a/vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go
+++ /dev/null
@@ -1,327 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// PipelineSchedulesService handles communication with the pipeline
-// schedules related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipeline_schedules.html
-type PipelineSchedulesService struct {
- client *Client
-}
-
-// PipelineSchedule represents a pipeline schedule.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html
-type PipelineSchedule struct {
- ID int `json:"id"`
- Description string `json:"description"`
- Ref string `json:"ref"`
- Cron string `json:"cron"`
- CronTimezone string `json:"cron_timezone"`
- NextRunAt *time.Time `json:"next_run_at"`
- Active bool `json:"active"`
- CreatedAt *time.Time `json:"created_at"`
- UpdatedAt *time.Time `json:"updated_at"`
- Owner *User `json:"owner"`
- LastPipeline struct {
- ID int `json:"id"`
- SHA string `json:"sha"`
- Ref string `json:"ref"`
- Status string `json:"status"`
- } `json:"last_pipeline"`
- Variables []*PipelineVariable `json:"variables"`
-}
-
-// ListPipelineSchedulesOptions represents the available ListPipelineTriggers() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#list-project-triggers
-type ListPipelineSchedulesOptions ListOptions
-
-// ListPipelineSchedules gets a list of project triggers.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html
-func (s *PipelineSchedulesService) ListPipelineSchedules(pid interface{}, opt *ListPipelineSchedulesOptions, options ...OptionFunc) ([]*PipelineSchedule, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ps []*PipelineSchedule
- resp, err := s.client.Do(req, &ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// GetPipelineSchedule gets a pipeline schedule.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html
-func (s *PipelineSchedulesService) GetPipelineSchedule(pid interface{}, schedule int, options ...OptionFunc) (*PipelineSchedule, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules/%d", pathEscape(project), schedule)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineSchedule)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// CreatePipelineScheduleOptions represents the available
-// CreatePipelineSchedule() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
-type CreatePipelineScheduleOptions struct {
- Description *string `url:"description" json:"description"`
- Ref *string `url:"ref" json:"ref"`
- Cron *string `url:"cron" json:"cron"`
- CronTimezone *string `url:"cron_timezone,omitempty" json:"cron_timezone,omitempty"`
- Active *bool `url:"active,omitempty" json:"active,omitempty"`
-}
-
-// CreatePipelineSchedule creates a pipeline schedule.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
-func (s *PipelineSchedulesService) CreatePipelineSchedule(pid interface{}, opt *CreatePipelineScheduleOptions, options ...OptionFunc) (*PipelineSchedule, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineSchedule)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// EditPipelineScheduleOptions represents the available
-// EditPipelineSchedule() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
-type EditPipelineScheduleOptions struct {
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
- Cron *string `url:"cron,omitempty" json:"cron,omitempty"`
- CronTimezone *string `url:"cron_timezone,omitempty" json:"cron_timezone,omitempty"`
- Active *bool `url:"active,omitempty" json:"active,omitempty"`
-}
-
-// EditPipelineSchedule edits a pipeline schedule.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#edit-a-pipeline-schedule
-func (s *PipelineSchedulesService) EditPipelineSchedule(pid interface{}, schedule int, opt *EditPipelineScheduleOptions, options ...OptionFunc) (*PipelineSchedule, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules/%d", pathEscape(project), schedule)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineSchedule)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// TakeOwnershipOfPipelineSchedule sets the owner of the specified
-// pipeline schedule to the user issuing the request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#take-ownership-of-a-pipeline-schedule
-func (s *PipelineSchedulesService) TakeOwnershipOfPipelineSchedule(pid interface{}, schedule int, options ...OptionFunc) (*PipelineSchedule, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/take_ownership", pathEscape(project), schedule)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineSchedule)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// DeletePipelineSchedule deletes a pipeline schedule.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#delete-a-pipeline-schedule
-func (s *PipelineSchedulesService) DeletePipelineSchedule(pid interface{}, schedule int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules/%d", pathEscape(project), schedule)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// CreatePipelineScheduleVariableOptions represents the available
-// CreatePipelineScheduleVariable() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
-type CreatePipelineScheduleVariableOptions struct {
- Key *string `url:"key" json:"key"`
- Value *string `url:"value" json:"value"`
- VariableType *string `url:"variable_type,omitempty" json:"variable_type,omitempty"`
-}
-
-// CreatePipelineScheduleVariable creates a pipeline schedule variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#create-a-new-pipeline-schedule
-func (s *PipelineSchedulesService) CreatePipelineScheduleVariable(pid interface{}, schedule int, opt *CreatePipelineScheduleVariableOptions, options ...OptionFunc) (*PipelineVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/variables", pathEscape(project), schedule)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineVariable)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// EditPipelineScheduleVariableOptions represents the available
-// EditPipelineScheduleVariable() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#edit-a-pipeline-schedule-variable
-type EditPipelineScheduleVariableOptions struct {
- Value *string `url:"value" json:"value"`
- VariableType *string `url:"variable_type,omitempty" json:"variable_type,omitempty"`
-}
-
-// EditPipelineScheduleVariable creates a pipeline schedule variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#edit-a-pipeline-schedule-variable
-func (s *PipelineSchedulesService) EditPipelineScheduleVariable(pid interface{}, schedule int, key string, opt *EditPipelineScheduleVariableOptions, options ...OptionFunc) (*PipelineVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/variables/%s", pathEscape(project), schedule, key)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineVariable)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// DeletePipelineScheduleVariable creates a pipeline schedule variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_schedules.html#delete-a-pipeline-schedule-variable
-func (s *PipelineSchedulesService) DeletePipelineScheduleVariable(pid interface{}, schedule int, key string, options ...OptionFunc) (*PipelineVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline_schedules/%d/variables/%s", pathEscape(project), schedule, key)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(PipelineVariable)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/pipeline_triggers.go b/vendor/github.com/xanzy/go-gitlab/pipeline_triggers.go
deleted file mode 100644
index f4f83ca0..00000000
--- a/vendor/github.com/xanzy/go-gitlab/pipeline_triggers.go
+++ /dev/null
@@ -1,231 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// PipelineTriggersService handles Project pipeline triggers.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html
-type PipelineTriggersService struct {
- client *Client
-}
-
-// PipelineTrigger represents a project pipeline trigger.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#pipeline-triggers
-type PipelineTrigger struct {
- ID int `json:"id"`
- Description string `json:"description"`
- CreatedAt *time.Time `json:"created_at"`
- DeletedAt *time.Time `json:"deleted_at"`
- LastUsed *time.Time `json:"last_used"`
- Token string `json:"token"`
- UpdatedAt *time.Time `json:"updated_at"`
- Owner *User `json:"owner"`
-}
-
-// ListPipelineTriggersOptions represents the available ListPipelineTriggers() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#list-project-triggers
-type ListPipelineTriggersOptions ListOptions
-
-// ListPipelineTriggers gets a list of project triggers.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#list-project-triggers
-func (s *PipelineTriggersService) ListPipelineTriggers(pid interface{}, opt *ListPipelineTriggersOptions, options ...OptionFunc) ([]*PipelineTrigger, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/triggers", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pt []*PipelineTrigger
- resp, err := s.client.Do(req, &pt)
- if err != nil {
- return nil, resp, err
- }
-
- return pt, resp, err
-}
-
-// GetPipelineTrigger gets a specific pipeline trigger for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#get-trigger-details
-func (s *PipelineTriggersService) GetPipelineTrigger(pid interface{}, trigger int, options ...OptionFunc) (*PipelineTrigger, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/triggers/%d", pathEscape(project), trigger)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pt := new(PipelineTrigger)
- resp, err := s.client.Do(req, pt)
- if err != nil {
- return nil, resp, err
- }
-
- return pt, resp, err
-}
-
-// AddPipelineTriggerOptions represents the available AddPipelineTrigger() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#create-a-project-trigger
-type AddPipelineTriggerOptions struct {
- Description *string `url:"description,omitempty" json:"description,omitempty"`
-}
-
-// AddPipelineTrigger adds a pipeline trigger to a specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#create-a-project-trigger
-func (s *PipelineTriggersService) AddPipelineTrigger(pid interface{}, opt *AddPipelineTriggerOptions, options ...OptionFunc) (*PipelineTrigger, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/triggers", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pt := new(PipelineTrigger)
- resp, err := s.client.Do(req, pt)
- if err != nil {
- return nil, resp, err
- }
-
- return pt, resp, err
-}
-
-// EditPipelineTriggerOptions represents the available EditPipelineTrigger() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#update-a-project-trigger
-type EditPipelineTriggerOptions struct {
- Description *string `url:"description,omitempty" json:"description,omitempty"`
-}
-
-// EditPipelineTrigger edits a trigger for a specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#update-a-project-trigger
-func (s *PipelineTriggersService) EditPipelineTrigger(pid interface{}, trigger int, opt *EditPipelineTriggerOptions, options ...OptionFunc) (*PipelineTrigger, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/triggers/%d", pathEscape(project), trigger)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pt := new(PipelineTrigger)
- resp, err := s.client.Do(req, pt)
- if err != nil {
- return nil, resp, err
- }
-
- return pt, resp, err
-}
-
-// TakeOwnershipOfPipelineTrigger sets the owner of the specified
-// pipeline trigger to the user issuing the request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#take-ownership-of-a-project-trigger
-func (s *PipelineTriggersService) TakeOwnershipOfPipelineTrigger(pid interface{}, trigger int, options ...OptionFunc) (*PipelineTrigger, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/triggers/%d/take_ownership", pathEscape(project), trigger)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pt := new(PipelineTrigger)
- resp, err := s.client.Do(req, pt)
- if err != nil {
- return nil, resp, err
- }
-
- return pt, resp, err
-}
-
-// DeletePipelineTrigger removes a trigger from a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipeline_triggers.html#remove-a-project-trigger
-func (s *PipelineTriggersService) DeletePipelineTrigger(pid interface{}, trigger int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/triggers/%d", pathEscape(project), trigger)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// RunPipelineTriggerOptions represents the available RunPipelineTrigger() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/ci/triggers/README.html#triggering-a-pipeline
-type RunPipelineTriggerOptions struct {
- Ref *string `url:"ref" json:"ref"`
- Token *string `url:"token" json:"token"`
- Variables map[string]string `url:"variables,omitempty" json:"variables,omitempty"`
-}
-
-// RunPipelineTrigger starts a trigger from a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/ci/triggers/README.html#triggering-a-pipeline
-func (s *PipelineTriggersService) RunPipelineTrigger(pid interface{}, opt *RunPipelineTriggerOptions, options ...OptionFunc) (*Pipeline, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/trigger/pipeline", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pt := new(Pipeline)
- resp, err := s.client.Do(req, pt)
- if err != nil {
- return nil, resp, err
- }
-
- return pt, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/pipelines.go b/vendor/github.com/xanzy/go-gitlab/pipelines.go
deleted file mode 100644
index 071e5e50..00000000
--- a/vendor/github.com/xanzy/go-gitlab/pipelines.go
+++ /dev/null
@@ -1,286 +0,0 @@
-//
-// Copyright 2017, Igor Varavko
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// PipelinesService handles communication with the repositories related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html
-type PipelinesService struct {
- client *Client
-}
-
-// PipelineVariable represents a pipeline variable.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html
-type PipelineVariable struct {
- Key string `json:"key"`
- Value string `json:"value"`
- VariableType string `json:"variable_type"`
-}
-
-// Pipeline represents a GitLab pipeline.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html
-type Pipeline struct {
- ID int `json:"id"`
- Status string `json:"status"`
- Ref string `json:"ref"`
- SHA string `json:"sha"`
- BeforeSHA string `json:"before_sha"`
- Tag bool `json:"tag"`
- YamlErrors string `json:"yaml_errors"`
- User *BasicUser `json:"user"`
- UpdatedAt *time.Time `json:"updated_at"`
- CreatedAt *time.Time `json:"created_at"`
- StartedAt *time.Time `json:"started_at"`
- FinishedAt *time.Time `json:"finished_at"`
- CommittedAt *time.Time `json:"committed_at"`
- Duration int `json:"duration"`
- Coverage string `json:"coverage"`
- WebURL string `json:"web_url"`
- DetailedStatus *DetailedStatus `json:"detailed_status"`
-}
-
-// DetailedStatus contains detailed information about the status of a pipeline
-type DetailedStatus struct {
- Icon string `json:"icon"`
- Text string `json:"text"`
- Label string `json:"label"`
- Group string `json:"group"`
- Tooltip string `json:"tooltip"`
- HasDetails bool `json:"has_details"`
- DetailsPath string `json:"details_path"`
- Illustration struct {
- Image string `json:"image"`
- } `json:"illustration"`
- Favicon string `json:"favicon"`
-}
-
-func (p Pipeline) String() string {
- return Stringify(p)
-}
-
-// PipelineInfo shows the basic entities of a pipeline, mostly used as fields
-// on other assets, like Commit.
-type PipelineInfo struct {
- ID int `json:"id"`
- Status string `json:"status"`
- Ref string `json:"ref"`
- SHA string `json:"sha"`
- WebURL string `json:"web_url"`
- UpdatedAt *time.Time `json:"updated_at"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-func (p PipelineInfo) String() string {
- return Stringify(p)
-}
-
-// ListProjectPipelinesOptions represents the available ListProjectPipelines() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#list-project-pipelines
-type ListProjectPipelinesOptions struct {
- ListOptions
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- Status *BuildStateValue `url:"status,omitempty" json:"status,omitempty"`
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
- SHA *string `url:"sha,omitempty" json:"sha,omitempty"`
- YamlErrors *bool `url:"yaml_errors,omitempty" json:"yaml_errors,omitempty"`
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Username *string `url:"username,omitempty" json:"username,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
-}
-
-// ListProjectPipelines gets a list of project piplines.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#list-project-pipelines
-func (s *PipelinesService) ListProjectPipelines(pid interface{}, opt *ListProjectPipelinesOptions, options ...OptionFunc) ([]*PipelineInfo, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipelines", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*PipelineInfo
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// GetPipeline gets a single project pipeline.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#get-a-single-pipeline
-func (s *PipelinesService) GetPipeline(pid interface{}, pipeline int, options ...OptionFunc) (*Pipeline, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipelines/%d", pathEscape(project), pipeline)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Pipeline)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// GetPipelineVariables gets the variables of a single project pipeline.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#get-variables-of-a-pipeline
-func (s *PipelinesService) GetPipelineVariables(pid interface{}, pipeline int, options ...OptionFunc) ([]*PipelineVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipelines/%d/variables", pathEscape(project), pipeline)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*PipelineVariable
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// CreatePipelineOptions represents the available CreatePipeline() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#create-a-new-pipeline
-type CreatePipelineOptions struct {
- Ref *string `url:"ref" json:"ref"`
- Variables []*PipelineVariable `url:"variables,omitempty" json:"variables,omitempty"`
-}
-
-// CreatePipeline creates a new project pipeline.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/pipelines.html#create-a-new-pipeline
-func (s *PipelinesService) CreatePipeline(pid interface{}, opt *CreatePipelineOptions, options ...OptionFunc) (*Pipeline, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipeline", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Pipeline)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// RetryPipelineBuild retries failed builds in a pipeline
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipelines.html#retry-failed-builds-in-a-pipeline
-func (s *PipelinesService) RetryPipelineBuild(pid interface{}, pipeline int, options ...OptionFunc) (*Pipeline, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipelines/%d/retry", pathEscape(project), pipeline)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Pipeline)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// CancelPipelineBuild cancels a pipeline builds
-//
-// GitLab API docs:
-//https://docs.gitlab.com/ce/api/pipelines.html#cancel-a-pipelines-builds
-func (s *PipelinesService) CancelPipelineBuild(pid interface{}, pipeline int, options ...OptionFunc) (*Pipeline, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/pipelines/%d/cancel", pathEscape(project), pipeline)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Pipeline)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// DeletePipeline deletes an existing pipeline.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/pipelines.html#delete-a-pipeline
-func (s *PipelinesService) DeletePipeline(pid interface{}, pipeline int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/pipelines/%d", pathEscape(project), pipeline)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/project_badges.go b/vendor/github.com/xanzy/go-gitlab/project_badges.go
deleted file mode 100644
index da2dc4d4..00000000
--- a/vendor/github.com/xanzy/go-gitlab/project_badges.go
+++ /dev/null
@@ -1,207 +0,0 @@
-package gitlab
-
-import (
- "fmt"
-)
-
-// ProjectBadge represents a project badge.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#list-all-badges-of-a-project
-type ProjectBadge struct {
- ID int `json:"id"`
- LinkURL string `json:"link_url"`
- ImageURL string `json:"image_url"`
- RenderedLinkURL string `json:"rendered_link_url"`
- RenderedImageURL string `json:"rendered_image_url"`
- // Kind represents a project badge kind. Can be empty, when used PreviewProjectBadge().
- Kind string `json:"kind"`
-}
-
-// ProjectBadgesService handles communication with the project badges
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/project_badges.html
-type ProjectBadgesService struct {
- client *Client
-}
-
-// ListProjectBadgesOptions represents the available ListProjectBadges()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#list-all-badges-of-a-project
-type ListProjectBadgesOptions ListOptions
-
-// ListProjectBadges gets a list of a project's badges and its group badges.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#list-all-badges-of-a-project
-func (s *ProjectBadgesService) ListProjectBadges(pid interface{}, opt *ListProjectBadgesOptions, options ...OptionFunc) ([]*ProjectBadge, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/badges", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pb []*ProjectBadge
- resp, err := s.client.Do(req, &pb)
- if err != nil {
- return nil, resp, err
- }
-
- return pb, resp, err
-}
-
-// GetProjectBadge gets a project badge.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#get-a-badge-of-a-project
-func (s *ProjectBadgesService) GetProjectBadge(pid interface{}, badge int, options ...OptionFunc) (*ProjectBadge, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/badges/%d", pathEscape(project), badge)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pb := new(ProjectBadge)
- resp, err := s.client.Do(req, pb)
- if err != nil {
- return nil, resp, err
- }
-
- return pb, resp, err
-}
-
-// AddProjectBadgeOptions represents the available AddProjectBadge() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#add-a-badge-to-a-project
-type AddProjectBadgeOptions struct {
- LinkURL *string `url:"link_url,omitempty" json:"link_url,omitempty"`
- ImageURL *string `url:"image_url,omitempty" json:"image_url,omitempty"`
-}
-
-// AddProjectBadge adds a badge to a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#add-a-badge-to-a-project
-func (s *ProjectBadgesService) AddProjectBadge(pid interface{}, opt *AddProjectBadgeOptions, options ...OptionFunc) (*ProjectBadge, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/badges", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pb := new(ProjectBadge)
- resp, err := s.client.Do(req, pb)
- if err != nil {
- return nil, resp, err
- }
-
- return pb, resp, err
-}
-
-// EditProjectBadgeOptions represents the available EditProjectBadge() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#edit-a-badge-of-a-project
-type EditProjectBadgeOptions struct {
- LinkURL *string `url:"link_url,omitempty" json:"link_url,omitempty"`
- ImageURL *string `url:"image_url,omitempty" json:"image_url,omitempty"`
-}
-
-// EditProjectBadge updates a badge of a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#edit-a-badge-of-a-project
-func (s *ProjectBadgesService) EditProjectBadge(pid interface{}, badge int, opt *EditProjectBadgeOptions, options ...OptionFunc) (*ProjectBadge, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/badges/%d", pathEscape(project), badge)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pb := new(ProjectBadge)
- resp, err := s.client.Do(req, pb)
- if err != nil {
- return nil, resp, err
- }
-
- return pb, resp, err
-}
-
-// DeleteProjectBadge removes a badge from a project. Only project's
-// badges will be removed by using this endpoint.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#remove-a-badge-from-a-project
-func (s *ProjectBadgesService) DeleteProjectBadge(pid interface{}, badge int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/badges/%d", pathEscape(project), badge)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ProjectBadgePreviewOptions represents the available PreviewProjectBadge() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#preview-a-badge-from-a-project
-type ProjectBadgePreviewOptions struct {
- LinkURL *string `url:"link_url,omitempty" json:"link_url,omitempty"`
- ImageURL *string `url:"image_url,omitempty" json:"image_url,omitempty"`
-}
-
-// PreviewProjectBadge returns how the link_url and image_url final URLs would be after
-// resolving the placeholder interpolation.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_badges.html#preview-a-badge-from-a-project
-func (s *ProjectBadgesService) PreviewProjectBadge(pid interface{}, opt *ProjectBadgePreviewOptions, options ...OptionFunc) (*ProjectBadge, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/badges/render", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pb := new(ProjectBadge)
- resp, err := s.client.Do(req, &pb)
- if err != nil {
- return nil, resp, err
- }
-
- return pb, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/project_clusters.go b/vendor/github.com/xanzy/go-gitlab/project_clusters.go
deleted file mode 100644
index d2be60e2..00000000
--- a/vendor/github.com/xanzy/go-gitlab/project_clusters.go
+++ /dev/null
@@ -1,221 +0,0 @@
-//
-// Copyright 2019, Matej Velikonja
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// ProjectClustersService handles communication with the
-// project clusters related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_clusters.html
-type ProjectClustersService struct {
- client *Client
-}
-
-// ProjectCluster represents a GitLab Project Cluster.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/project_clusters.html
-type ProjectCluster struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Domain string `json:"domain"`
- CreatedAt *time.Time `json:"created_at"`
- ProviderType string `json:"provider_type"`
- PlatformType string `json:"platform_type"`
- EnvironmentScope string `json:"environment_scope"`
- ClusterType string `json:"cluster_type"`
- User *User `json:"user"`
- PlatformKubernetes *PlatformKubernetes `json:"platform_kubernetes"`
- Project *Project `json:"project"`
-}
-
-func (v ProjectCluster) String() string {
- return Stringify(v)
-}
-
-// PlatformKubernetes represents a GitLab Project Cluster PlatformKubernetes.
-type PlatformKubernetes struct {
- APIURL string `json:"api_url"`
- Token string `json:"token"`
- CaCert string `json:"ca_cert"`
- Namespace string `json:"namespace"`
- AuthorizationType string `json:"authorization_type"`
-}
-
-// ListClusters gets a list of all clusters in a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_clusters.html#list-project-clusters
-func (s *ProjectClustersService) ListClusters(pid interface{}, options ...OptionFunc) ([]*ProjectCluster, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/clusters", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pcs []*ProjectCluster
- resp, err := s.client.Do(req, &pcs)
- if err != nil {
- return nil, resp, err
- }
-
- return pcs, resp, err
-}
-
-// GetCluster gets a cluster.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_clusters.html#get-a-single-project-cluster
-func (s *ProjectClustersService) GetCluster(pid interface{}, cluster int, options ...OptionFunc) (*ProjectCluster, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/clusters/%d", pathEscape(project), cluster)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pc := new(ProjectCluster)
- resp, err := s.client.Do(req, &pc)
- if err != nil {
- return nil, resp, err
- }
-
- return pc, resp, err
-}
-
-// AddClusterOptions represents the available AddCluster() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_clusters.html#add-existing-cluster-to-project
-type AddClusterOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Domain *string `url:"domain,omitempty" json:"domain,omitempty"`
- Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"`
- Managed *bool `url:"managed,omitempty" json:"managed,omitempty"`
- EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
- PlatformKubernetes *AddPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"`
-}
-
-// AddPlatformKubernetesOptions represents the available PlatformKubernetes options for adding.
-type AddPlatformKubernetesOptions struct {
- APIURL *string `url:"api_url,omitempty" json:"api_url,omitempty"`
- Token *string `url:"token,omitempty" json:"token,omitempty"`
- CaCert *string `url:"ca_cert,omitempty" json:"ca_cert,omitempty"`
- Namespace *string `url:"namespace,omitempty" json:"namespace,omitempty"`
- AuthorizationType *string `url:"authorization_type,omitempty" json:"authorization_type,omitempty"`
-}
-
-// AddCluster adds an existing cluster to the project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_clusters.html#add-existing-cluster-to-project
-func (s *ProjectClustersService) AddCluster(pid interface{}, opt *AddClusterOptions, options ...OptionFunc) (*ProjectCluster, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/clusters/user", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pc := new(ProjectCluster)
- resp, err := s.client.Do(req, pc)
- if err != nil {
- return nil, resp, err
- }
-
- return pc, resp, err
-}
-
-// EditClusterOptions represents the available EditCluster() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_clusters.html#edit-project-cluster
-type EditClusterOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Domain *string `url:"domain,omitempty" json:"domain,omitempty"`
- EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
- PlatformKubernetes *EditPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"`
-}
-
-// EditPlatformKubernetesOptions represents the available PlatformKubernetes options for editing.
-type EditPlatformKubernetesOptions struct {
- APIURL *string `url:"api_url,omitempty" json:"api_url,omitempty"`
- Token *string `url:"token,omitempty" json:"token,omitempty"`
- CaCert *string `url:"ca_cert,omitempty" json:"ca_cert,omitempty"`
- Namespace *string `url:"namespace,omitempty" json:"namespace,omitempty"`
-}
-
-// EditCluster updates an existing project cluster.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_clusters.html#edit-project-cluster
-func (s *ProjectClustersService) EditCluster(pid interface{}, cluster int, opt *EditClusterOptions, options ...OptionFunc) (*ProjectCluster, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/clusters/%d", pathEscape(project), cluster)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pc := new(ProjectCluster)
- resp, err := s.client.Do(req, pc)
- if err != nil {
- return nil, resp, err
- }
-
- return pc, resp, err
-}
-
-// DeleteCluster deletes an existing project cluster.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_clusters.html#delete-project-cluster
-func (s *ProjectClustersService) DeleteCluster(pid interface{}, cluster int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/clusters/%d", pathEscape(project), cluster)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/project_import_export.go b/vendor/github.com/xanzy/go-gitlab/project_import_export.go
deleted file mode 100644
index 839b187b..00000000
--- a/vendor/github.com/xanzy/go-gitlab/project_import_export.go
+++ /dev/null
@@ -1,196 +0,0 @@
-package gitlab
-
-import (
- "bytes"
- "fmt"
- "time"
-)
-
-// ProjectImportExportService handles communication with the project
-// import/export related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/user/project/settings/import_export.html
-type ProjectImportExportService struct {
- client *Client
-}
-
-// ImportStatus represents a project import status.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_import_export.html#import-status
-type ImportStatus struct {
- ID int `json:"id"`
- Description string `json:"description"`
- Name string `json:"name"`
- NameWithNamespace string `json:"name_with_namespace"`
- Path string `json:"path"`
- PathWithNamespace string `json:"path_with_namespace"`
- CreateAt *time.Time `json:"create_at"`
- ImportStatus string `json:"import_status"`
-}
-
-func (s ImportStatus) String() string {
- return Stringify(s)
-}
-
-// ExportStatus represents a project export status.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_import_export.html#export-status
-type ExportStatus struct {
- ID int `json:"id"`
- Description string `json:"description"`
- Name string `json:"name"`
- NameWithNamespace string `json:"name_with_namespace"`
- Path string `json:"path"`
- PathWithNamespace string `json:"path_with_namespace"`
- CreatedAt *time.Time `json:"created_at"`
- ExportStatus string `json:"export_status"`
- Message string `json:"message"`
- Links struct {
- APIURL string `json:"api_url"`
- WebURL string `json:"web_url"`
- } `json:"_links"`
-}
-
-func (s ExportStatus) String() string {
- return Stringify(s)
-}
-
-// ScheduleExportOptions represents the available ScheduleExport() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_import_export.html#schedule-an-export
-type ScheduleExportOptions struct {
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Upload struct {
- URL *string `url:"url,omitempty" json:"url,omitempty"`
- HTTPMethod *string `url:"http_method,omitempty" json:"http_method,omitempty"`
- } `url:"upload,omitempty" json:"upload,omitempty"`
-}
-
-// ScheduleExport schedules a project export.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_import_export.html#schedule-an-export
-func (s *ProjectImportExportService) ScheduleExport(pid interface{}, opt *ScheduleExportOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/export", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ExportStatus get the status of export.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_import_export.html#export-status
-func (s *ProjectImportExportService) ExportStatus(pid interface{}, options ...OptionFunc) (*ExportStatus, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/export", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- es := new(ExportStatus)
- resp, err := s.client.Do(req, es)
- if err != nil {
- return nil, resp, err
- }
-
- return es, resp, err
-}
-
-// ExportDownload download the finished export.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_import_export.html#export-download
-func (s *ProjectImportExportService) ExportDownload(pid interface{}, options ...OptionFunc) ([]byte, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/export/download", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var b bytes.Buffer
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b.Bytes(), resp, err
-}
-
-// ImportFileOptions represents the available ImportFile() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_import_export.html#import-a-file
-type ImportFileOptions struct {
- Namespace *string `url:"namespace,omitempty" json:"namespace,omitempty"`
- File *string `url:"file,omitempty" json:"file,omitempty"`
- Path *string `url:"path,omitempty" json:"path,omitempty"`
- Overwrite *bool `url:"overwrite,omitempty" json:"overwrite,omitempty"`
- OverrideParams *CreateProjectOptions `url:"override_params,omitempty" json:"override_params,omitempty"`
-}
-
-// ImportFile import a file.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_import_export.html#import-a-file
-func (s *ProjectImportExportService) ImportFile(opt *ImportFileOptions, options ...OptionFunc) (*ImportStatus, *Response, error) {
- req, err := s.client.NewRequest("POST", "projects/import", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- is := new(ImportStatus)
- resp, err := s.client.Do(req, is)
- if err != nil {
- return nil, resp, err
- }
-
- return is, resp, err
-}
-
-// ImportStatus get the status of an import.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_import_export.html#import-status
-func (s *ProjectImportExportService) ImportStatus(pid interface{}, options ...OptionFunc) (*ImportStatus, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/import", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- is := new(ImportStatus)
- resp, err := s.client.Do(req, is)
- if err != nil {
- return nil, resp, err
- }
-
- return is, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/project_members.go b/vendor/github.com/xanzy/go-gitlab/project_members.go
deleted file mode 100644
index 54a25fdc..00000000
--- a/vendor/github.com/xanzy/go-gitlab/project_members.go
+++ /dev/null
@@ -1,209 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
-)
-
-// ProjectMembersService handles communication with the project members
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/members.html
-type ProjectMembersService struct {
- client *Client
-}
-
-// ListProjectMembersOptions represents the available ListProjectMembers() and
-// ListAllProjectMembers() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project
-type ListProjectMembersOptions struct {
- ListOptions
- Query *string `url:"query,omitempty" json:"query,omitempty"`
-}
-
-// ListProjectMembers gets a list of a project's team members viewable by the
-// authenticated user. Returns only direct members and not inherited members
-// through ancestors groups.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project
-func (s *ProjectMembersService) ListProjectMembers(pid interface{}, opt *ListProjectMembersOptions, options ...OptionFunc) ([]*ProjectMember, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/members", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pm []*ProjectMember
- resp, err := s.client.Do(req, &pm)
- if err != nil {
- return nil, resp, err
- }
-
- return pm, resp, err
-}
-
-// ListAllProjectMembers gets a list of a project's team members viewable by the
-// authenticated user. Returns a list including inherited members through
-// ancestor groups.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#list-all-members-of-a-group-or-project-including-inherited-members
-func (s *ProjectMembersService) ListAllProjectMembers(pid interface{}, opt *ListProjectMembersOptions, options ...OptionFunc) ([]*ProjectMember, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/members/all", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pm []*ProjectMember
- resp, err := s.client.Do(req, &pm)
- if err != nil {
- return nil, resp, err
- }
-
- return pm, resp, err
-}
-
-// GetProjectMember gets a project team member.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#get-a-member-of-a-group-or-project
-func (s *ProjectMembersService) GetProjectMember(pid interface{}, user int, options ...OptionFunc) (*ProjectMember, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/members/%d", pathEscape(project), user)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pm := new(ProjectMember)
- resp, err := s.client.Do(req, pm)
- if err != nil {
- return nil, resp, err
- }
-
- return pm, resp, err
-}
-
-// AddProjectMemberOptions represents the available AddProjectMember() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project
-type AddProjectMemberOptions struct {
- UserID *int `url:"user_id,omitempty" json:"user_id,omitempty"`
- AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
- ExpiresAt *string `url:"expires_at,omitempty" json:"expires_at"`
-}
-
-// AddProjectMember adds a user to a project team. This is an idempotent
-// method and can be called multiple times with the same parameters. Adding
-// team membership to a user that is already a member does not affect the
-// existing membership.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#add-a-member-to-a-group-or-project
-func (s *ProjectMembersService) AddProjectMember(pid interface{}, opt *AddProjectMemberOptions, options ...OptionFunc) (*ProjectMember, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/members", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pm := new(ProjectMember)
- resp, err := s.client.Do(req, pm)
- if err != nil {
- return nil, resp, err
- }
-
- return pm, resp, err
-}
-
-// EditProjectMemberOptions represents the available EditProjectMember() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project
-type EditProjectMemberOptions struct {
- AccessLevel *AccessLevelValue `url:"access_level,omitempty" json:"access_level,omitempty"`
- ExpiresAt *string `url:"expires_at,omitempty" json:"expires_at"`
-}
-
-// EditProjectMember updates a project team member to a specified access level..
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#edit-a-member-of-a-group-or-project
-func (s *ProjectMembersService) EditProjectMember(pid interface{}, user int, opt *EditProjectMemberOptions, options ...OptionFunc) (*ProjectMember, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/members/%d", pathEscape(project), user)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pm := new(ProjectMember)
- resp, err := s.client.Do(req, pm)
- if err != nil {
- return nil, resp, err
- }
-
- return pm, resp, err
-}
-
-// DeleteProjectMember removes a user from a project team.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/members.html#remove-a-member-from-a-group-or-project
-func (s *ProjectMembersService) DeleteProjectMember(pid interface{}, user int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/members/%d", pathEscape(project), user)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/project_snippets.go b/vendor/github.com/xanzy/go-gitlab/project_snippets.go
deleted file mode 100644
index 9dc254f0..00000000
--- a/vendor/github.com/xanzy/go-gitlab/project_snippets.go
+++ /dev/null
@@ -1,206 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "bytes"
- "fmt"
-)
-
-// ProjectSnippetsService handles communication with the project snippets
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/project_snippets.html
-type ProjectSnippetsService struct {
- client *Client
-}
-
-// ListProjectSnippetsOptions represents the available ListSnippets() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/project_snippets.html#list-snippets
-type ListProjectSnippetsOptions ListOptions
-
-// ListSnippets gets a list of project snippets.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/project_snippets.html#list-snippets
-func (s *ProjectSnippetsService) ListSnippets(pid interface{}, opt *ListProjectSnippetsOptions, options ...OptionFunc) ([]*Snippet, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ps []*Snippet
- resp, err := s.client.Do(req, &ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// GetSnippet gets a single project snippet
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_snippets.html#single-snippet
-func (s *ProjectSnippetsService) GetSnippet(pid interface{}, snippet int, options ...OptionFunc) (*Snippet, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d", pathEscape(project), snippet)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ps := new(Snippet)
- resp, err := s.client.Do(req, ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// CreateProjectSnippetOptions represents the available CreateSnippet() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_snippets.html#create-new-snippet
-type CreateProjectSnippetOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Code *string `url:"code,omitempty" json:"code,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
-}
-
-// CreateSnippet creates a new project snippet. The user must have permission
-// to create new snippets.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_snippets.html#create-new-snippet
-func (s *ProjectSnippetsService) CreateSnippet(pid interface{}, opt *CreateProjectSnippetOptions, options ...OptionFunc) (*Snippet, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ps := new(Snippet)
- resp, err := s.client.Do(req, ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// UpdateProjectSnippetOptions represents the available UpdateSnippet() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_snippets.html#update-snippet
-type UpdateProjectSnippetOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Code *string `url:"code,omitempty" json:"code,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
-}
-
-// UpdateSnippet updates an existing project snippet. The user must have
-// permission to change an existing snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_snippets.html#update-snippet
-func (s *ProjectSnippetsService) UpdateSnippet(pid interface{}, snippet int, opt *UpdateProjectSnippetOptions, options ...OptionFunc) (*Snippet, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d", pathEscape(project), snippet)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ps := new(Snippet)
- resp, err := s.client.Do(req, ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// DeleteSnippet deletes an existing project snippet. This is an idempotent
-// function and deleting a non-existent snippet still returns a 200 OK status
-// code.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_snippets.html#delete-snippet
-func (s *ProjectSnippetsService) DeleteSnippet(pid interface{}, snippet int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d", pathEscape(project), snippet)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// SnippetContent returns the raw project snippet as plain text.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/project_snippets.html#snippet-content
-func (s *ProjectSnippetsService) SnippetContent(pid interface{}, snippet int, options ...OptionFunc) ([]byte, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/snippets/%d/raw", pathEscape(project), snippet)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var b bytes.Buffer
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b.Bytes(), resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/project_variables.go b/vendor/github.com/xanzy/go-gitlab/project_variables.go
deleted file mode 100644
index 155e3e55..00000000
--- a/vendor/github.com/xanzy/go-gitlab/project_variables.go
+++ /dev/null
@@ -1,201 +0,0 @@
-//
-// Copyright 2018, Patrick Webster
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// ProjectVariablesService handles communication with the
-// project variables related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html
-type ProjectVariablesService struct {
- client *Client
-}
-
-// ProjectVariable represents a GitLab Project Variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html
-type ProjectVariable struct {
- Key string `json:"key"`
- Value string `json:"value"`
- VariableType VariableTypeValue `json:"variable_type"`
- Protected bool `json:"protected"`
- Masked bool `json:"masked"`
- EnvironmentScope string `json:"environment_scope"`
-}
-
-func (v ProjectVariable) String() string {
- return Stringify(v)
-}
-
-// ListProjectVariablesOptions represents the available options for listing variables
-// in a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#list-project-variables
-type ListProjectVariablesOptions ListOptions
-
-// ListVariables gets a list of all variables in a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#list-project-variables
-func (s *ProjectVariablesService) ListVariables(pid interface{}, opt *ListProjectVariablesOptions, options ...OptionFunc) ([]*ProjectVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/variables", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var vs []*ProjectVariable
- resp, err := s.client.Do(req, &vs)
- if err != nil {
- return nil, resp, err
- }
-
- return vs, resp, err
-}
-
-// GetVariable gets a variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#show-variable-details
-func (s *ProjectVariablesService) GetVariable(pid interface{}, key string, options ...OptionFunc) (*ProjectVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/variables/%s", pathEscape(project), url.PathEscape(key))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(ProjectVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// CreateProjectVariableOptions represents the available CreateVariable()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#create-variable
-type CreateProjectVariableOptions struct {
- Key *string `url:"key,omitempty" json:"key,omitempty"`
- Value *string `url:"value,omitempty" json:"value,omitempty"`
- VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"`
- Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
- Masked *bool `url:"masked,omitempty" json:"masked,omitempty"`
- EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
-}
-
-// CreateVariable creates a new project variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#create-variable
-func (s *ProjectVariablesService) CreateVariable(pid interface{}, opt *CreateProjectVariableOptions, options ...OptionFunc) (*ProjectVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/variables", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(ProjectVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// UpdateProjectVariableOptions represents the available UpdateVariable()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#update-variable
-type UpdateProjectVariableOptions struct {
- Value *string `url:"value,omitempty" json:"value,omitempty"`
- VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"`
- Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
- Masked *bool `url:"masked,omitempty" json:"masked,omitempty"`
- EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
-}
-
-// UpdateVariable updates a project's variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#update-variable
-func (s *ProjectVariablesService) UpdateVariable(pid interface{}, key string, opt *UpdateProjectVariableOptions, options ...OptionFunc) (*ProjectVariable, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/variables/%s", pathEscape(project), url.PathEscape(key))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(ProjectVariable)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
-
-// RemoveVariable removes a project's variable.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/project_level_variables.html#remove-variable
-func (s *ProjectVariablesService) RemoveVariable(pid interface{}, key string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/variables/%s", pathEscape(project), url.PathEscape(key))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/projects.go b/vendor/github.com/xanzy/go-gitlab/projects.go
deleted file mode 100644
index 04c3c894..00000000
--- a/vendor/github.com/xanzy/go-gitlab/projects.go
+++ /dev/null
@@ -1,1512 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "bytes"
- "fmt"
- "io"
- "io/ioutil"
- "mime/multipart"
- "os"
- "time"
-)
-
-// ProjectsService handles communication with the repositories related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html
-type ProjectsService struct {
- client *Client
-}
-
-// Project represents a GitLab project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html
-type Project struct {
- ID int `json:"id"`
- Description string `json:"description"`
- DefaultBranch string `json:"default_branch"`
- Public bool `json:"public"`
- Visibility VisibilityValue `json:"visibility"`
- SSHURLToRepo string `json:"ssh_url_to_repo"`
- HTTPURLToRepo string `json:"http_url_to_repo"`
- WebURL string `json:"web_url"`
- ReadmeURL string `json:"readme_url"`
- TagList []string `json:"tag_list"`
- Owner *User `json:"owner"`
- Name string `json:"name"`
- NameWithNamespace string `json:"name_with_namespace"`
- Path string `json:"path"`
- PathWithNamespace string `json:"path_with_namespace"`
- IssuesEnabled bool `json:"issues_enabled"`
- OpenIssuesCount int `json:"open_issues_count"`
- MergeRequestsEnabled bool `json:"merge_requests_enabled"`
- ApprovalsBeforeMerge int `json:"approvals_before_merge"`
- JobsEnabled bool `json:"jobs_enabled"`
- WikiEnabled bool `json:"wiki_enabled"`
- SnippetsEnabled bool `json:"snippets_enabled"`
- ResolveOutdatedDiffDiscussions bool `json:"resolve_outdated_diff_discussions"`
- ContainerRegistryEnabled bool `json:"container_registry_enabled"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- LastActivityAt *time.Time `json:"last_activity_at,omitempty"`
- CreatorID int `json:"creator_id"`
- Namespace *ProjectNamespace `json:"namespace"`
- ImportStatus string `json:"import_status"`
- ImportError string `json:"import_error"`
- Permissions *Permissions `json:"permissions"`
- Archived bool `json:"archived"`
- AvatarURL string `json:"avatar_url"`
- SharedRunnersEnabled bool `json:"shared_runners_enabled"`
- ForksCount int `json:"forks_count"`
- StarCount int `json:"star_count"`
- RunnersToken string `json:"runners_token"`
- PublicBuilds bool `json:"public_builds"`
- OnlyAllowMergeIfPipelineSucceeds bool `json:"only_allow_merge_if_pipeline_succeeds"`
- OnlyAllowMergeIfAllDiscussionsAreResolved bool `json:"only_allow_merge_if_all_discussions_are_resolved"`
- LFSEnabled bool `json:"lfs_enabled"`
- RequestAccessEnabled bool `json:"request_access_enabled"`
- MergeMethod MergeMethodValue `json:"merge_method"`
- ForkedFromProject *ForkParent `json:"forked_from_project"`
- Mirror bool `json:"mirror"`
- MirrorUserID int `json:"mirror_user_id"`
- MirrorTriggerBuilds bool `json:"mirror_trigger_builds"`
- OnlyMirrorProtectedBranches bool `json:"only_mirror_protected_branches"`
- MirrorOverwritesDivergedBranches bool `json:"mirror_overwrites_diverged_branches"`
- SharedWithGroups []struct {
- GroupID int `json:"group_id"`
- GroupName string `json:"group_name"`
- GroupAccessLevel int `json:"group_access_level"`
- } `json:"shared_with_groups"`
- Statistics *ProjectStatistics `json:"statistics"`
- Links *Links `json:"_links,omitempty"`
- CIConfigPath *string `json:"ci_config_path"`
- CustomAttributes []*CustomAttribute `json:"custom_attributes"`
-}
-
-// Repository represents a repository.
-type Repository struct {
- Name string `json:"name"`
- Description string `json:"description"`
- WebURL string `json:"web_url"`
- AvatarURL string `json:"avatar_url"`
- GitSSHURL string `json:"git_ssh_url"`
- GitHTTPURL string `json:"git_http_url"`
- Namespace string `json:"namespace"`
- Visibility VisibilityValue `json:"visibility"`
- PathWithNamespace string `json:"path_with_namespace"`
- DefaultBranch string `json:"default_branch"`
- Homepage string `json:"homepage"`
- URL string `json:"url"`
- SSHURL string `json:"ssh_url"`
- HTTPURL string `json:"http_url"`
-}
-
-// ProjectNamespace represents a project namespace.
-type ProjectNamespace struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Path string `json:"path"`
- Kind string `json:"kind"`
- FullPath string `json:"full_path"`
-}
-
-// StorageStatistics represents a statistics record for a group or project.
-type StorageStatistics struct {
- StorageSize int64 `json:"storage_size"`
- RepositorySize int64 `json:"repository_size"`
- LfsObjectsSize int64 `json:"lfs_objects_size"`
- JobArtifactsSize int64 `json:"job_artifacts_size"`
-}
-
-// ProjectStatistics represents a statistics record for a project.
-type ProjectStatistics struct {
- StorageStatistics
- CommitCount int `json:"commit_count"`
-}
-
-// Permissions represents permissions.
-type Permissions struct {
- ProjectAccess *ProjectAccess `json:"project_access"`
- GroupAccess *GroupAccess `json:"group_access"`
-}
-
-// ProjectAccess represents project access.
-type ProjectAccess struct {
- AccessLevel AccessLevelValue `json:"access_level"`
- NotificationLevel NotificationLevelValue `json:"notification_level"`
-}
-
-// GroupAccess represents group access.
-type GroupAccess struct {
- AccessLevel AccessLevelValue `json:"access_level"`
- NotificationLevel NotificationLevelValue `json:"notification_level"`
-}
-
-// ForkParent represents the parent project when this is a fork.
-type ForkParent struct {
- HTTPURLToRepo string `json:"http_url_to_repo"`
- ID int `json:"id"`
- Name string `json:"name"`
- NameWithNamespace string `json:"name_with_namespace"`
- Path string `json:"path"`
- PathWithNamespace string `json:"path_with_namespace"`
- WebURL string `json:"web_url"`
-}
-
-// Links represents a project web links for self, issues, merge_requests,
-// repo_branches, labels, events, members.
-type Links struct {
- Self string `json:"self"`
- Issues string `json:"issues"`
- MergeRequests string `json:"merge_requests"`
- RepoBranches string `json:"repo_branches"`
- Labels string `json:"labels"`
- Events string `json:"events"`
- Members string `json:"members"`
-}
-
-func (s Project) String() string {
- return Stringify(s)
-}
-
-// ProjectApprovalRule represents a GitLab project approval rule.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#get-project-level-rules
-type ProjectApprovalRule struct {
- ID int `json:"id"`
- Name string `json:"name"`
- RuleType string `json:"rule_type"`
- EligibleApprovers []*BasicUser `json:"eligible_approvers"`
- ApprovalsRequired int `json:"approvals_required"`
- Users []*BasicUser `json:"users"`
- Groups []*Group `json:"groups"`
- ContainsHiddenGroups bool `json:"contains_hidden_groups"`
-}
-
-func (s ProjectApprovalRule) String() string {
- return Stringify(s)
-}
-
-// ListProjectsOptions represents the available ListProjects() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#list-projects
-type ListProjectsOptions struct {
- ListOptions
- Archived *bool `url:"archived,omitempty" json:"archived,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- Simple *bool `url:"simple,omitempty" json:"simple,omitempty"`
- Owned *bool `url:"owned,omitempty" json:"owned,omitempty"`
- Membership *bool `url:"membership,omitempty" json:"membership,omitempty"`
- Starred *bool `url:"starred,omitempty" json:"starred,omitempty"`
- Statistics *bool `url:"statistics,omitempty" json:"statistics,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
- WithIssuesEnabled *bool `url:"with_issues_enabled,omitempty" json:"with_issues_enabled,omitempty"`
- WithMergeRequestsEnabled *bool `url:"with_merge_requests_enabled,omitempty" json:"with_merge_requests_enabled,omitempty"`
- MinAccessLevel *AccessLevelValue `url:"min_access_level,omitempty" json:"min_access_level,omitempty"`
- WithCustomAttributes *bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"`
- WithProgrammingLanguage *string `url:"with_programming_language,omitempty" json:"with_programming_language,omitempty"`
-}
-
-// ListProjects gets a list of projects accessible by the authenticated user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#list-projects
-func (s *ProjectsService) ListProjects(opt *ListProjectsOptions, options ...OptionFunc) ([]*Project, *Response, error) {
- req, err := s.client.NewRequest("GET", "projects", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*Project
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ListUserProjects gets a list of projects for the given user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#list-user-projects
-func (s *ProjectsService) ListUserProjects(uid interface{}, opt *ListProjectsOptions, options ...OptionFunc) ([]*Project, *Response, error) {
- user, err := parseID(uid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("users/%s/projects", user)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*Project
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ProjectUser represents a GitLab project user.
-type ProjectUser struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Username string `json:"username"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
-}
-
-// ListProjectUserOptions represents the available ListProjectsUsers() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#get-project-users
-type ListProjectUserOptions struct {
- ListOptions
- Search *string `url:"search,omitempty" json:"search,omitempty"`
-}
-
-// ListProjectsUsers gets a list of users for the given project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#get-project-users
-func (s *ProjectsService) ListProjectsUsers(pid interface{}, opt *ListProjectUserOptions, options ...OptionFunc) ([]*ProjectUser, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/users", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*ProjectUser
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ProjectLanguages is a map of strings because the response is arbitrary
-//
-// Gitlab API docs: https://docs.gitlab.com/ce/api/projects.html#languages
-type ProjectLanguages map[string]float32
-
-// GetProjectLanguages gets a list of languages used by the project
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#languages
-func (s *ProjectsService) GetProjectLanguages(pid interface{}, options ...OptionFunc) (*ProjectLanguages, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/languages", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(ProjectLanguages)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// GetProjectOptions represents the available GetProject() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/projects.html#get-single-project
-type GetProjectOptions struct {
- Statistics *bool `url:"statistics,omitempty" json:"statistics,omitempty"`
- License *bool `url:"license,omitempty" json:"license,omitempty"`
- WithCustomAttributes *bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"`
-}
-
-// GetProject gets a specific project, identified by project ID or
-// NAMESPACE/PROJECT_NAME, which is owned by the authenticated user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#get-single-project
-func (s *ProjectsService) GetProject(pid interface{}, opt *GetProjectOptions, options ...OptionFunc) (*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ProjectEvent represents a GitLab project event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#get-project-events
-type ProjectEvent struct {
- Title interface{} `json:"title"`
- ProjectID int `json:"project_id"`
- ActionName string `json:"action_name"`
- TargetID interface{} `json:"target_id"`
- TargetType interface{} `json:"target_type"`
- AuthorID int `json:"author_id"`
- AuthorUsername string `json:"author_username"`
- Data struct {
- Before string `json:"before"`
- After string `json:"after"`
- Ref string `json:"ref"`
- UserID int `json:"user_id"`
- UserName string `json:"user_name"`
- Repository *Repository `json:"repository"`
- Commits []*Commit `json:"commits"`
- TotalCommitsCount int `json:"total_commits_count"`
- } `json:"data"`
- TargetTitle interface{} `json:"target_title"`
-}
-
-func (s ProjectEvent) String() string {
- return Stringify(s)
-}
-
-// GetProjectEventsOptions represents the available GetProjectEvents() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#get-project-events
-type GetProjectEventsOptions ListOptions
-
-// GetProjectEvents gets the events for the specified project. Sorted from
-// newest to latest.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#get-project-events
-func (s *ProjectsService) GetProjectEvents(pid interface{}, opt *GetProjectEventsOptions, options ...OptionFunc) ([]*ProjectEvent, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/events", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*ProjectEvent
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// CreateProjectOptions represents the available CreateProject() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/projects.html#create-project
-type CreateProjectOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Path *string `url:"path,omitempty" json:"path,omitempty"`
- DefaultBranch *string `url:"default_branch,omitempty" json:"default_branch,omitempty"`
- NamespaceID *int `url:"namespace_id,omitempty" json:"namespace_id,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- IssuesEnabled *bool `url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"`
- MergeRequestsEnabled *bool `url:"merge_requests_enabled,omitempty" json:"merge_requests_enabled,omitempty"`
- JobsEnabled *bool `url:"jobs_enabled,omitempty" json:"jobs_enabled,omitempty"`
- WikiEnabled *bool `url:"wiki_enabled,omitempty" json:"wiki_enabled,omitempty"`
- SnippetsEnabled *bool `url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"`
- ResolveOutdatedDiffDiscussions *bool `url:"resolve_outdated_diff_discussions,omitempty" json:"resolve_outdated_diff_discussions,omitempty"`
- ContainerRegistryEnabled *bool `url:"container_registry_enabled,omitempty" json:"container_registry_enabled,omitempty"`
- SharedRunnersEnabled *bool `url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
- ImportURL *string `url:"import_url,omitempty" json:"import_url,omitempty"`
- PublicBuilds *bool `url:"public_builds,omitempty" json:"public_builds,omitempty"`
- OnlyAllowMergeIfPipelineSucceeds *bool `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"`
- OnlyAllowMergeIfAllDiscussionsAreResolved *bool `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"`
- MergeMethod *MergeMethodValue `url:"merge_method,omitempty" json:"merge_method,omitempty"`
- LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
- RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
- TagList *[]string `url:"tag_list,omitempty" json:"tag_list,omitempty"`
- PrintingMergeRequestLinkEnabled *bool `url:"printing_merge_request_link_enabled,omitempty" json:"printing_merge_request_link_enabled,omitempty"`
- CIConfigPath *string `url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"`
- ApprovalsBeforeMerge *int `url:"approvals_before_merge,omitempty" json:"approvals_before_merge,omitempty"`
- Mirror *bool `url:"mirror,omitempty" json:"mirror,omitempty"`
- MirrorTriggerBuilds *bool `url:"mirror_trigger_builds,omitempty" json:"mirror_trigger_builds,omitempty"`
- InitializeWithReadme *bool `url:"initialize_with_readme,omitempty" json:"initialize_with_readme,omitempty"`
- TemplateName *string `url:"template_name,omitempty" json:"template_name,omitempty"`
- UseCustomTemplate *bool `url:"use_custom_template,omitempty" json:"use_custom_template,omitempty"`
- GroupWithProjectTemplatesID *int `url:"group_with_project_templates_id,omitempty" json:"group_with_project_templates_id,omitempty"`
-}
-
-// CreateProject creates a new project owned by the authenticated user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#create-project
-func (s *ProjectsService) CreateProject(opt *CreateProjectOptions, options ...OptionFunc) (*Project, *Response, error) {
- req, err := s.client.NewRequest("POST", "projects", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// CreateProjectForUserOptions represents the available CreateProjectForUser()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#create-project-for-user
-type CreateProjectForUserOptions CreateProjectOptions
-
-// CreateProjectForUser creates a new project owned by the specified user.
-// Available only for admins.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#create-project-for-user
-func (s *ProjectsService) CreateProjectForUser(user int, opt *CreateProjectForUserOptions, options ...OptionFunc) (*Project, *Response, error) {
- u := fmt.Sprintf("projects/user/%d", user)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// EditProjectOptions represents the available EditProject() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#edit-project
-type EditProjectOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Path *string `url:"path,omitempty" json:"path,omitempty"`
- DefaultBranch *string `url:"default_branch,omitempty" json:"default_branch,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- IssuesEnabled *bool `url:"issues_enabled,omitempty" json:"issues_enabled,omitempty"`
- MergeRequestsEnabled *bool `url:"merge_requests_enabled,omitempty" json:"merge_requests_enabled,omitempty"`
- JobsEnabled *bool `url:"jobs_enabled,omitempty" json:"jobs_enabled,omitempty"`
- WikiEnabled *bool `url:"wiki_enabled,omitempty" json:"wiki_enabled,omitempty"`
- SnippetsEnabled *bool `url:"snippets_enabled,omitempty" json:"snippets_enabled,omitempty"`
- ResolveOutdatedDiffDiscussions *bool `url:"resolve_outdated_diff_discussions,omitempty" json:"resolve_outdated_diff_discussions,omitempty"`
- ContainerRegistryEnabled *bool `url:"container_registry_enabled,omitempty" json:"container_registry_enabled,omitempty"`
- SharedRunnersEnabled *bool `url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
- ImportURL *string `url:"import_url,omitempty" json:"import_url,omitempty"`
- PublicBuilds *bool `url:"public_builds,omitempty" json:"public_builds,omitempty"`
- OnlyAllowMergeIfPipelineSucceeds *bool `url:"only_allow_merge_if_pipeline_succeeds,omitempty" json:"only_allow_merge_if_pipeline_succeeds,omitempty"`
- OnlyAllowMergeIfAllDiscussionsAreResolved *bool `url:"only_allow_merge_if_all_discussions_are_resolved,omitempty" json:"only_allow_merge_if_all_discussions_are_resolved,omitempty"`
- MergeMethod *MergeMethodValue `url:"merge_method,omitempty" json:"merge_method,omitempty"`
- LFSEnabled *bool `url:"lfs_enabled,omitempty" json:"lfs_enabled,omitempty"`
- RequestAccessEnabled *bool `url:"request_access_enabled,omitempty" json:"request_access_enabled,omitempty"`
- TagList *[]string `url:"tag_list,omitempty" json:"tag_list,omitempty"`
- CIConfigPath *string `url:"ci_config_path,omitempty" json:"ci_config_path,omitempty"`
- ApprovalsBeforeMerge *int `url:"approvals_before_merge,omitempty" json:"approvals_before_merge,omitempty"`
- ExternalAuthorizationClassificationLabel *string `url:"external_authorization_classification_label,omitempty" json:"external_authorization_classification_label,omitempty"`
- Mirror *bool `url:"mirror,omitempty" json:"mirror,omitempty"`
- MirrorTriggerBuilds *bool `url:"mirror_trigger_builds,omitempty" json:"mirror_trigger_builds,omitempty"`
- MirrorUserID *int `url:"mirror_user_id,omitempty" json:"mirror_user_id,omitempty"`
- OnlyMirrorProtectedBranches *bool `url:"only_mirror_protected_branches,omitempty" json:"only_mirror_protected_branches,omitempty"`
- MirrorOverwritesDivergedBranches *bool `url:"mirror_overwrites_diverged_branches,omitempty" json:"mirror_overwrites_diverged_branches,omitempty"`
- PackagesEnabled *bool `url:"packages_enabled,omitempty" json:"packages_enabled,omitempty"`
-}
-
-// EditProject updates an existing project.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#edit-project
-func (s *ProjectsService) EditProject(pid interface{}, opt *EditProjectOptions, options ...OptionFunc) (*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s", pathEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ForkProjectOptions represents the available ForkProject() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#fork-project
-type ForkProjectOptions struct {
- Namespace *string `url:"namespace,omitempty" json:"namespace,omitempty"`
- Name *string `url:"name,omitempty" json:"name,omitempty" `
- Path *string `url:"path,omitempty" json:"path,omitempty"`
-}
-
-// ForkProject forks a project into the user namespace of the authenticated
-// user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#fork-project
-func (s *ProjectsService) ForkProject(pid interface{}, opt *ForkProjectOptions, options ...OptionFunc) (*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/fork", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// StarProject stars a given the project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#star-a-project
-func (s *ProjectsService) StarProject(pid interface{}, options ...OptionFunc) (*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/star", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// UnstarProject unstars a given project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#unstar-a-project
-func (s *ProjectsService) UnstarProject(pid interface{}, options ...OptionFunc) (*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/unstar", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ArchiveProject archives the project if the user is either admin or the
-// project owner of this project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#archive-a-project
-func (s *ProjectsService) ArchiveProject(pid interface{}, options ...OptionFunc) (*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/archive", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// UnarchiveProject unarchives the project if the user is either admin or
-// the project owner of this project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#unarchive-a-project
-func (s *ProjectsService) UnarchiveProject(pid interface{}, options ...OptionFunc) (*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/unarchive", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(Project)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// DeleteProject removes a project including all associated resources
-// (issues, merge requests etc.)
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#remove-project
-func (s *ProjectsService) DeleteProject(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s", pathEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ShareWithGroupOptions represents options to share project with groups
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#share-project-with-group
-type ShareWithGroupOptions struct {
- GroupID *int `url:"group_id" json:"group_id"`
- GroupAccess *AccessLevelValue `url:"group_access" json:"group_access"`
- ExpiresAt *string `url:"expires_at" json:"expires_at"`
-}
-
-// ShareProjectWithGroup allows to share a project with a group.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#share-project-with-group
-func (s *ProjectsService) ShareProjectWithGroup(pid interface{}, opt *ShareWithGroupOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/share", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteSharedProjectFromGroup allows to unshare a project from a group.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#delete-a-shared-project-link-within-a-group
-func (s *ProjectsService) DeleteSharedProjectFromGroup(pid interface{}, groupID int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/share/%d", pathEscape(project), groupID)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ProjectMember represents a project member.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#list-project-team-members
-type ProjectMember struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- ExpiresAt *ISOTime `json:"expires_at"`
- AccessLevel AccessLevelValue `json:"access_level"`
-}
-
-// ProjectHook represents a project hook.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#list-project-hooks
-type ProjectHook struct {
- ID int `json:"id"`
- URL string `json:"url"`
- ProjectID int `json:"project_id"`
- PushEvents bool `json:"push_events"`
- IssuesEvents bool `json:"issues_events"`
- ConfidentialIssuesEvents bool `json:"confidential_issues_events"`
- MergeRequestsEvents bool `json:"merge_requests_events"`
- TagPushEvents bool `json:"tag_push_events"`
- NoteEvents bool `json:"note_events"`
- JobEvents bool `json:"job_events"`
- PipelineEvents bool `json:"pipeline_events"`
- WikiPageEvents bool `json:"wiki_page_events"`
- EnableSSLVerification bool `json:"enable_ssl_verification"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-// ListProjectHooksOptions represents the available ListProjectHooks() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#list-project-hooks
-type ListProjectHooksOptions ListOptions
-
-// ListProjectHooks gets a list of project hooks.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#list-project-hooks
-func (s *ProjectsService) ListProjectHooks(pid interface{}, opt *ListProjectHooksOptions, options ...OptionFunc) ([]*ProjectHook, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/hooks", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ph []*ProjectHook
- resp, err := s.client.Do(req, &ph)
- if err != nil {
- return nil, resp, err
- }
-
- return ph, resp, err
-}
-
-// GetProjectHook gets a specific hook for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#get-project-hook
-func (s *ProjectsService) GetProjectHook(pid interface{}, hook int, options ...OptionFunc) (*ProjectHook, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/hooks/%d", pathEscape(project), hook)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ph := new(ProjectHook)
- resp, err := s.client.Do(req, ph)
- if err != nil {
- return nil, resp, err
- }
-
- return ph, resp, err
-}
-
-// AddProjectHookOptions represents the available AddProjectHook() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#add-project-hook
-type AddProjectHookOptions struct {
- URL *string `url:"url,omitempty" json:"url,omitempty"`
- PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
- IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"`
- ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
- MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
- TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
- NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"`
- JobEvents *bool `url:"job_events,omitempty" json:"job_events,omitempty"`
- PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"`
- WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"`
- EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"`
- Token *string `url:"token,omitempty" json:"token,omitempty"`
-}
-
-// AddProjectHook adds a hook to a specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#add-project-hook
-func (s *ProjectsService) AddProjectHook(pid interface{}, opt *AddProjectHookOptions, options ...OptionFunc) (*ProjectHook, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/hooks", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ph := new(ProjectHook)
- resp, err := s.client.Do(req, ph)
- if err != nil {
- return nil, resp, err
- }
-
- return ph, resp, err
-}
-
-// EditProjectHookOptions represents the available EditProjectHook() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#edit-project-hook
-type EditProjectHookOptions struct {
- URL *string `url:"url,omitempty" json:"url,omitempty"`
- PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
- IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"`
- ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
- MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
- TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
- NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"`
- JobEvents *bool `url:"job_events,omitempty" json:"job_events,omitempty"`
- PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"`
- WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"`
- EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"`
- Token *string `url:"token,omitempty" json:"token,omitempty"`
-}
-
-// EditProjectHook edits a hook for a specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#edit-project-hook
-func (s *ProjectsService) EditProjectHook(pid interface{}, hook int, opt *EditProjectHookOptions, options ...OptionFunc) (*ProjectHook, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/hooks/%d", pathEscape(project), hook)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ph := new(ProjectHook)
- resp, err := s.client.Do(req, ph)
- if err != nil {
- return nil, resp, err
- }
-
- return ph, resp, err
-}
-
-// DeleteProjectHook removes a hook from a project. This is an idempotent
-// method and can be called multiple times. Either the hook is available or not.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#delete-project-hook
-func (s *ProjectsService) DeleteProjectHook(pid interface{}, hook int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/hooks/%d", pathEscape(project), hook)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ProjectForkRelation represents a project fork relationship.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#admin-fork-relation
-type ProjectForkRelation struct {
- ID int `json:"id"`
- ForkedToProjectID int `json:"forked_to_project_id"`
- ForkedFromProjectID int `json:"forked_from_project_id"`
- CreatedAt *time.Time `json:"created_at"`
- UpdatedAt *time.Time `json:"updated_at"`
-}
-
-// CreateProjectForkRelation creates a forked from/to relation between
-// existing projects.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#create-a-forked-fromto-relation-between-existing-projects.
-func (s *ProjectsService) CreateProjectForkRelation(pid int, fork int, options ...OptionFunc) (*ProjectForkRelation, *Response, error) {
- u := fmt.Sprintf("projects/%d/fork/%d", pid, fork)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pfr := new(ProjectForkRelation)
- resp, err := s.client.Do(req, pfr)
- if err != nil {
- return nil, resp, err
- }
-
- return pfr, resp, err
-}
-
-// DeleteProjectForkRelation deletes an existing forked from relationship.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#delete-an-existing-forked-from-relationship
-func (s *ProjectsService) DeleteProjectForkRelation(pid int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("projects/%d/fork", pid)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ProjectFile represents an uploaded project file
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#upload-a-file
-type ProjectFile struct {
- Alt string `json:"alt"`
- URL string `json:"url"`
- Markdown string `json:"markdown"`
-}
-
-// UploadFile upload a file from disk
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#upload-a-file
-func (s *ProjectsService) UploadFile(pid interface{}, file string, options ...OptionFunc) (*ProjectFile, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/uploads", pathEscape(project))
-
- f, err := os.Open(file)
- if err != nil {
- return nil, nil, err
- }
- defer f.Close()
-
- b := &bytes.Buffer{}
- w := multipart.NewWriter(b)
-
- fw, err := w.CreateFormFile("file", file)
- if err != nil {
- return nil, nil, err
- }
-
- _, err = io.Copy(fw, f)
- if err != nil {
- return nil, nil, err
- }
- w.Close()
-
- req, err := s.client.NewRequest("", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- req.Body = ioutil.NopCloser(b)
- req.ContentLength = int64(b.Len())
- req.Header.Set("Content-Type", w.FormDataContentType())
- req.Method = "POST"
-
- uf := &ProjectFile{}
- resp, err := s.client.Do(req, uf)
- if err != nil {
- return nil, resp, err
- }
-
- return uf, resp, nil
-}
-
-// ListProjectForks gets a list of project forks.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/projects.html#list-forks-of-a-project
-func (s *ProjectsService) ListProjectForks(pid interface{}, opt *ListProjectsOptions, options ...OptionFunc) ([]*Project, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/forks", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var forks []*Project
- resp, err := s.client.Do(req, &forks)
- if err != nil {
- return nil, resp, err
- }
-
- return forks, resp, err
-}
-
-// ProjectPushRules represents a project push rule.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/projects.html#push-rules
-type ProjectPushRules struct {
- ID int `json:"id"`
- ProjectID int `json:"project_id"`
- CommitMessageRegex string `json:"commit_message_regex"`
- BranchNameRegex string `json:"branch_name_regex"`
- DenyDeleteTag bool `json:"deny_delete_tag"`
- CreatedAt *time.Time `json:"created_at"`
- MemberCheck bool `json:"member_check"`
- PreventSecrets bool `json:"prevent_secrets"`
- AuthorEmailRegex string `json:"author_email_regex"`
- FileNameRegex string `json:"file_name_regex"`
- MaxFileSize int `json:"max_file_size"`
-}
-
-// GetProjectPushRules gets the push rules of a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/projects.html#get-project-push-rules
-func (s *ProjectsService) GetProjectPushRules(pid interface{}, options ...OptionFunc) (*ProjectPushRules, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/push_rule", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ppr := new(ProjectPushRules)
- resp, err := s.client.Do(req, ppr)
- if err != nil {
- return nil, resp, err
- }
-
- return ppr, resp, err
-}
-
-// AddProjectPushRuleOptions represents the available AddProjectPushRule()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/projects.html#add-project-push-rule
-type AddProjectPushRuleOptions struct {
- DenyDeleteTag *bool `url:"deny_delete_tag,omitempty" json:"deny_delete_tag,omitempty"`
- MemberCheck *bool `url:"member_check,omitempty" json:"member_check,omitempty"`
- PreventSecrets *bool `url:"prevent_secrets,omitempty" json:"prevent_secrets,omitempty"`
- CommitMessageRegex *string `url:"commit_message_regex,omitempty" json:"commit_message_regex,omitempty"`
- BranchNameRegex *string `url:"branch_name_regex,omitempty" json:"branch_name_regex,omitempty"`
- AuthorEmailRegex *string `url:"author_email_regex,omitempty" json:"author_email_regex,omitempty"`
- FileNameRegex *string `url:"file_name_regex,omitempty" json:"file_name_regex,omitempty"`
- MaxFileSize *int `url:"max_file_size,omitempty" json:"max_file_size,omitempty"`
-}
-
-// AddProjectPushRule adds a push rule to a specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/projects.html#add-project-push-rule
-func (s *ProjectsService) AddProjectPushRule(pid interface{}, opt *AddProjectPushRuleOptions, options ...OptionFunc) (*ProjectPushRules, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/push_rule", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ppr := new(ProjectPushRules)
- resp, err := s.client.Do(req, ppr)
- if err != nil {
- return nil, resp, err
- }
-
- return ppr, resp, err
-}
-
-// EditProjectPushRuleOptions represents the available EditProjectPushRule()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/projects.html#edit-project-push-rule
-type EditProjectPushRuleOptions struct {
- AuthorEmailRegex *string `url:"author_email_regex,omitempty" json:"author_email_regex,omitempty"`
- BranchNameRegex *string `url:"branch_name_regex,omitempty" json:"branch_name_regex,omitempty"`
- CommitMessageRegex *string `url:"commit_message_regex,omitempty" json:"commit_message_regex,omitempty"`
- FileNameRegex *string `url:"file_name_regex,omitempty" json:"file_name_regex,omitempty"`
- DenyDeleteTag *bool `url:"deny_delete_tag,omitempty" json:"deny_delete_tag,omitempty"`
- MemberCheck *bool `url:"member_check,omitempty" json:"member_check,omitempty"`
- PreventSecrets *bool `url:"prevent_secrets,omitempty" json:"prevent_secrets,omitempty"`
- MaxFileSize *int `url:"max_file_size,omitempty" json:"max_file_size,omitempty"`
-}
-
-// EditProjectPushRule edits a push rule for a specified project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/projects.html#edit-project-push-rule
-func (s *ProjectsService) EditProjectPushRule(pid interface{}, opt *EditProjectPushRuleOptions, options ...OptionFunc) (*ProjectPushRules, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/push_rule", pathEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ppr := new(ProjectPushRules)
- resp, err := s.client.Do(req, ppr)
- if err != nil {
- return nil, resp, err
- }
-
- return ppr, resp, err
-}
-
-// DeleteProjectPushRule removes a push rule from a project. This is an
-// idempotent method and can be called multiple times. Either the push rule is
-// available or not.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/projects.html#delete-project-push-rule
-func (s *ProjectsService) DeleteProjectPushRule(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/push_rule", pathEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ProjectApprovals represents GitLab project level merge request approvals.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#project-level-mr-approvals
-type ProjectApprovals struct {
- Approvers []*MergeRequestApproverUser `json:"approvers"`
- ApproverGroups []*MergeRequestApproverGroup `json:"approver_groups"`
- ApprovalsBeforeMerge int `json:"approvals_before_merge"`
- ResetApprovalsOnPush bool `json:"reset_approvals_on_push"`
- DisableOverridingApproversPerMergeRequest bool `json:"disable_overriding_approvers_per_merge_request"`
- MergeRequestsAuthorApproval bool `json:"merge_requests_author_approval"`
- MergeRequestsDisableCommittersApproval bool `json:"merge_requests_disable_committers_approval"`
-}
-
-// GetApprovalConfiguration get the approval configuration for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#get-configuration
-func (s *ProjectsService) GetApprovalConfiguration(pid interface{}, options ...OptionFunc) (*ProjectApprovals, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/approvals", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pa := new(ProjectApprovals)
- resp, err := s.client.Do(req, pa)
- if err != nil {
- return nil, resp, err
- }
-
- return pa, resp, err
-}
-
-// ChangeApprovalConfigurationOptions represents the available
-// ApprovalConfiguration() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-configuration
-type ChangeApprovalConfigurationOptions struct {
- ApprovalsBeforeMerge *int `url:"approvals_before_merge,omitempty" json:"approvals_before_merge,omitempty"`
- ResetApprovalsOnPush *bool `url:"reset_approvals_on_push,omitempty" json:"reset_approvals_on_push,omitempty"`
- DisableOverridingApproversPerMergeRequest *bool `url:"disable_overriding_approvers_per_merge_request,omitempty" json:"disable_overriding_approvers_per_merge_request,omitempty"`
- MergeRequestsAuthorApproval *bool `url:"merge_requests_author_approval,omitempty" json:"merge_requests_author_approval,omitempty"`
- MergeRequestsDisableCommittersApproval *bool `url:"merge_requests_disable_committers_approval,omitempty" json:"merge_requests_disable_committers_approval,omitempty"`
-}
-
-// ChangeApprovalConfiguration updates the approval configuration for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-configuration
-func (s *ProjectsService) ChangeApprovalConfiguration(pid interface{}, opt *ChangeApprovalConfigurationOptions, options ...OptionFunc) (*ProjectApprovals, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/approvals", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pa := new(ProjectApprovals)
- resp, err := s.client.Do(req, pa)
- if err != nil {
- return nil, resp, err
- }
-
- return pa, resp, err
-}
-
-// GetProjectApprovalRules looks up the list of project level approvers.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#get-project-level-rules
-func (s *ProjectsService) GetProjectApprovalRules(pid interface{}, options ...OptionFunc) ([]*ProjectApprovalRule, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/approval_rules", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var par []*ProjectApprovalRule
- resp, err := s.client.Do(req, &par)
- if err != nil {
- return nil, resp, err
- }
-
- return par, resp, err
-}
-
-// CreateProjectLevelRuleOptions represents the available CreateProjectApprovalRule()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#create-project-level-rules
-type CreateProjectLevelRuleOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- ApprovalsRequired *int `url:"approvals_required,omitempty" json:"approvals_required,omitempty"`
- UserIDs []int `url:"user_ids,omitempty" json:"user_ids,omitempty"`
- GroupIDs []int `url:"group_ids,omitempty" json:"group_ids,omitempty"`
-}
-
-// CreateProjectApprovalRule creates a new project-level approval rule.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#create-project-level-rules
-func (s *ProjectsService) CreateProjectApprovalRule(pid interface{}, opt *CreateProjectLevelRuleOptions, options ...OptionFunc) (*ProjectApprovalRule, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/approval_rules", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- par := new(ProjectApprovalRule)
- resp, err := s.client.Do(req, &par)
- if err != nil {
- return nil, resp, err
- }
-
- return par, resp, err
-}
-
-// UpdateProjectLevelRuleOptions represents the available UpdateProjectApprovalRule()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#update-project-level-rules
-type UpdateProjectLevelRuleOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- ApprovalsRequired *int `url:"approvals_required,omitempty" json:"approvals_required,omitempty"`
- UserIDs []int `url:"user_ids,omitempty" json:"user_ids,omitempty"`
- GroupIDs []int `url:"group_ids,omitempty" json:"group_ids,omitempty"`
-}
-
-// UpdateProjectApprovalRule updates an existing approval rule with new options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#update-project-level-rules
-func (s *ProjectsService) UpdateProjectApprovalRule(pid interface{}, approvalRule int, opt *UpdateProjectLevelRuleOptions, options ...OptionFunc) (*ProjectApprovalRule, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/approval_rules/%d", pathEscape(project), approvalRule)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- par := new(ProjectApprovalRule)
- resp, err := s.client.Do(req, &par)
- if err != nil {
- return nil, resp, err
- }
-
- return par, resp, err
-}
-
-// DeleteProjectApprovalRule deletes a project-level approval rule.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#delete-project-level-rules
-func (s *ProjectsService) DeleteProjectApprovalRule(pid interface{}, approvalRule int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/approval_rules/%d", pathEscape(project), approvalRule)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ChangeAllowedApproversOptions represents the available ChangeAllowedApprovers()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-allowed-approvers
-type ChangeAllowedApproversOptions struct {
- ApproverIDs []int `url:"approver_ids,omitempty" json:"approver_ids,omitempty"`
- ApproverGroupIDs []int `url:"approver_group_ids,omitempty" json:"approver_group_ids,omitempty"`
-}
-
-// ChangeAllowedApprovers updates the list of approvers and approver groups.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/merge_request_approvals.html#change-allowed-approvers
-func (s *ProjectsService) ChangeAllowedApprovers(pid interface{}, opt *ChangeAllowedApproversOptions, options ...OptionFunc) (*ProjectApprovals, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/approvers", pathEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pa := new(ProjectApprovals)
- resp, err := s.client.Do(req, pa)
- if err != nil {
- return nil, resp, err
- }
-
- return pa, resp, err
-}
-
-// StartMirroringProject start the pull mirroring process for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/projects.html#start-the-pull-mirroring-process-for-a-project-starter
-func (s *ProjectsService) StartMirroringProject(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/mirror/pull", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- resp, err := s.client.Do(req, nil)
- if err != nil {
- return resp, err
- }
-
- return resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/protected_branches.go b/vendor/github.com/xanzy/go-gitlab/protected_branches.go
deleted file mode 100644
index 3567f6eb..00000000
--- a/vendor/github.com/xanzy/go-gitlab/protected_branches.go
+++ /dev/null
@@ -1,165 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen, Michael Lihs
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// ProtectedBranchesService handles communication with the protected branch
-// related methods of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#protected-branches-api
-type ProtectedBranchesService struct {
- client *Client
-}
-
-// BranchAccessDescription represents the access description for a protected
-// branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#protected-branches-api
-type BranchAccessDescription struct {
- AccessLevel AccessLevelValue `json:"access_level"`
- AccessLevelDescription string `json:"access_level_description"`
-}
-
-// ProtectedBranch represents a protected branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#list-protected-branches
-type ProtectedBranch struct {
- Name string `json:"name"`
- PushAccessLevels []*BranchAccessDescription `json:"push_access_levels"`
- MergeAccessLevels []*BranchAccessDescription `json:"merge_access_levels"`
-}
-
-// ListProtectedBranchesOptions represents the available ListProtectedBranches()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#list-protected-branches
-type ListProtectedBranchesOptions ListOptions
-
-// ListProtectedBranches gets a list of protected branches from a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#list-protected-branches
-func (s *ProtectedBranchesService) ListProtectedBranches(pid interface{}, opt *ListProtectedBranchesOptions, options ...OptionFunc) ([]*ProtectedBranch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/protected_branches", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var p []*ProtectedBranch
- resp, err := s.client.Do(req, &p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// GetProtectedBranch gets a single protected branch or wildcard protected branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#get-a-single-protected-branch-or-wildcard-protected-branch
-func (s *ProtectedBranchesService) GetProtectedBranch(pid interface{}, branch string, options ...OptionFunc) (*ProtectedBranch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/protected_branches/%s", pathEscape(project), url.PathEscape(branch))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(ProtectedBranch)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// ProtectRepositoryBranchesOptions represents the available
-// ProtectRepositoryBranches() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#protect-repository-branches
-type ProtectRepositoryBranchesOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- PushAccessLevel *AccessLevelValue `url:"push_access_level,omitempty" json:"push_access_level,omitempty"`
- MergeAccessLevel *AccessLevelValue `url:"merge_access_level,omitempty" json:"merge_access_level,omitempty"`
-}
-
-// ProtectRepositoryBranches protects a single repository branch or several
-// project repository branches using a wildcard protected branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#protect-repository-branches
-func (s *ProtectedBranchesService) ProtectRepositoryBranches(pid interface{}, opt *ProtectRepositoryBranchesOptions, options ...OptionFunc) (*ProtectedBranch, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/protected_branches", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(ProtectedBranch)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// UnprotectRepositoryBranches unprotects the given protected branch or wildcard
-// protected branch.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/protected_branches.html#unprotect-repository-branches
-func (s *ProtectedBranchesService) UnprotectRepositoryBranches(pid interface{}, branch string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/protected_branches/%s", pathEscape(project), url.PathEscape(branch))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/protected_tags.go b/vendor/github.com/xanzy/go-gitlab/protected_tags.go
deleted file mode 100644
index f50014d2..00000000
--- a/vendor/github.com/xanzy/go-gitlab/protected_tags.go
+++ /dev/null
@@ -1,145 +0,0 @@
-package gitlab
-
-import (
- "fmt"
-)
-
-// ProtectedTagsService handles communication with the protected tag methods
-// of the GitLab API.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/protected_tags.html
-type ProtectedTagsService struct {
- client *Client
-}
-
-// ProtectedTag represents a protected tag.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/protected_tags.html
-type ProtectedTag struct {
- Name string `json:"name"`
- CreateAccessLevels []*TagAccessDescription `json:"create_access_levels"`
-}
-
-// TagAccessDescription reperesents the access decription for a protected tag.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/protected_tags.html
-type TagAccessDescription struct {
- AccessLevel AccessLevelValue `json:"access_level"`
- AccessLevelDescription string `json:"access_level_description"`
-}
-
-// ListProtectedTagsOptions represents the available ListProtectedTags()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/protected_tags.html#list-protected-tags
-type ListProtectedTagsOptions ListOptions
-
-// ListProtectedTags returns a list of protected tags from a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/protected_tags.html#list-protected-tags
-func (s *ProtectedTagsService) ListProtectedTags(pid interface{}, opt *ListProtectedTagsOptions, options ...OptionFunc) ([]*ProtectedTag, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/protected_tags", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var pts []*ProtectedTag
- resp, err := s.client.Do(req, &pts)
- if err != nil {
- return nil, resp, err
- }
-
- return pts, resp, err
-}
-
-// GetProtectedTag returns a single protected tag or wildcard protected tag.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/protected_tags.html#get-a-single-protected-tag-or-wildcard-protected-tag
-func (s *ProtectedTagsService) GetProtectedTag(pid interface{}, tag string, options ...OptionFunc) (*ProtectedTag, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/protected_tags/%s", pathEscape(project), pathEscape(tag))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- pt := new(ProtectedTag)
- resp, err := s.client.Do(req, pt)
- if err != nil {
- return nil, resp, err
- }
-
- return pt, resp, err
-}
-
-// ProtectRepositoryTagsOptions represents the available ProtectRepositoryTags()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/protected_tags.html#protect-repository-tags
-type ProtectRepositoryTagsOptions struct {
- Name *string `url:"name" json:"name"`
- CreateAccessLevel *AccessLevelValue `url:"create_access_level,omitempty" json:"create_access_level,omitempty"`
-}
-
-// ProtectRepositoryTags protects a single repository tag or several project
-// repository tags using a wildcard protected tag.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/protected_tags.html#protect-repository-tags
-func (s *ProtectedTagsService) ProtectRepositoryTags(pid interface{}, opt *ProtectRepositoryTagsOptions, options ...OptionFunc) (*ProtectedTag, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/protected_tags", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- pt := new(ProtectedTag)
- resp, err := s.client.Do(req, pt)
- if err != nil {
- return nil, resp, err
- }
-
- return pt, resp, err
-}
-
-// UnprotectRepositoryTags unprotects the given protected tag or wildcard
-// protected tag.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/protected_tags.html#unprotect-repository-tags
-func (s *ProtectedTagsService) UnprotectRepositoryTags(pid interface{}, tag string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/protected_tags/%s", pathEscape(project), pathEscape(tag))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/registry.go b/vendor/github.com/xanzy/go-gitlab/registry.go
deleted file mode 100644
index 41fff709..00000000
--- a/vendor/github.com/xanzy/go-gitlab/registry.go
+++ /dev/null
@@ -1,219 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// ContainerRegistryService handles communication with the container registry
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/container_registry.html
-type ContainerRegistryService struct {
- client *Client
-}
-
-// RegistryRepository represents a GitLab content registry repository.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/container_registry.html
-type RegistryRepository struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Path string `json:"path"`
- Location string `json:"location"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-func (s RegistryRepository) String() string {
- return Stringify(s)
-}
-
-// RegistryRepositoryTag represents a GitLab registry image tag.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/container_registry.html
-type RegistryRepositoryTag struct {
- Name string `json:"name"`
- Path string `json:"path"`
- Location string `json:"location"`
- Revision string `json:"revision"`
- ShortRevision string `json:"short_revision"`
- Digest string `json:"digest"`
- CreatedAt *time.Time `json:"created_at"`
- TotalSize int `json:"total_size"`
-}
-
-func (s RegistryRepositoryTag) String() string {
- return Stringify(s)
-}
-
-// ListRegistryRepositoriesOptions represents the available
-// ListRegistryRepositories() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/container_registry.html#list-registry-repositories
-type ListRegistryRepositoriesOptions ListOptions
-
-// ListRegistryRepositories gets a list of registry repositories in a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/container_registry.html#list-registry-repositories
-func (s *ContainerRegistryService) ListRegistryRepositories(pid interface{}, opt *ListRegistryRepositoriesOptions, options ...OptionFunc) ([]*RegistryRepository, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/registry/repositories", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var repos []*RegistryRepository
- resp, err := s.client.Do(req, &repos)
- if err != nil {
- return nil, resp, err
- }
-
- return repos, resp, err
-}
-
-// DeleteRegistryRepository deletes a repository in a registry.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/container_registry.html#delete-registry-repository
-func (s *ContainerRegistryService) DeleteRegistryRepository(pid interface{}, repository int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/registry/repositories/%d", pathEscape(project), repository)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListRegistryRepositoryTagsOptions represents the available
-// ListRegistryRepositoryTags() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/container_registry.html#list-repository-tags
-type ListRegistryRepositoryTagsOptions ListOptions
-
-// ListRegistryRepositoryTags gets a list of tags for given registry repository.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/container_registry.html#list-repository-tags
-func (s *ContainerRegistryService) ListRegistryRepositoryTags(pid interface{}, repository int, opt *ListRegistryRepositoryTagsOptions, options ...OptionFunc) ([]*RegistryRepositoryTag, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/registry/repositories/%d/tags",
- pathEscape(project),
- repository,
- )
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var tags []*RegistryRepositoryTag
- resp, err := s.client.Do(req, &tags)
- if err != nil {
- return nil, resp, err
- }
-
- return tags, resp, err
-}
-
-// GetRegistryRepositoryTagDetail get details of a registry repository tag
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/container_registry.html#get-details-of-a-repository-tag
-func (s *ContainerRegistryService) GetRegistryRepositoryTagDetail(pid interface{}, repository int, tagName string, options ...OptionFunc) (*RegistryRepositoryTag, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/registry/repositories/%d/tags/%s",
- pathEscape(project),
- repository,
- tagName,
- )
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- tag := new(RegistryRepositoryTag)
- resp, err := s.client.Do(req, &tag)
- if err != nil {
- return nil, resp, err
- }
-
- return tag, resp, err
-}
-
-// DeleteRegistryRepositoryTag deletes a registry repository tag.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/container_registry.html#delete-a-repository-tag
-func (s *ContainerRegistryService) DeleteRegistryRepositoryTag(pid interface{}, repository int, tagName string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/registry/repositories/%d/tags/%s",
- pathEscape(project),
- repository,
- tagName,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteRegistryRepositoryTagsOptions represents the available
-// DeleteRegistryRepositoryTags() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/container_registry.html#delete-repository-tags-in-bulk
-type DeleteRegistryRepositoryTagsOptions struct {
- NameRegexp *string `url:"name_regex,omitempty" json:"name_regex,omitempty"`
- KeepN *int `url:"keep_n,omitempty" json:"keep_n,omitempty"`
- OlderThan *string `url:"older_than,omitempty" json:"older_than,omitempty"`
-}
-
-// DeleteRegistryRepositoryTags deletes repository tags in bulk based on
-// given criteria.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/container_registry.html#delete-repository-tags-in-bulk
-func (s *ContainerRegistryService) DeleteRegistryRepositoryTags(pid interface{}, repository int, opt *DeleteRegistryRepositoryTagsOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/registry/repositories/%d/tags",
- pathEscape(project),
- repository,
- )
-
- req, err := s.client.NewRequest("DELETE", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/releaselinks.go b/vendor/github.com/xanzy/go-gitlab/releaselinks.go
deleted file mode 100644
index b14be1f6..00000000
--- a/vendor/github.com/xanzy/go-gitlab/releaselinks.go
+++ /dev/null
@@ -1,176 +0,0 @@
-package gitlab
-
-import (
- "fmt"
-)
-
-// ReleaseLinksService handles communication with the release link methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html
-type ReleaseLinksService struct {
- client *Client
-}
-
-// ReleaseLink represents a release link.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html
-type ReleaseLink struct {
- ID int `json:"id"`
- Name string `json:"name"`
- URL string `json:"url"`
- External bool `json:"external"`
-}
-
-// ListReleaseLinksOptions represents ListReleaseLinks() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#get-links
-type ListReleaseLinksOptions ListOptions
-
-// ListReleaseLinks gets assets as links from a Release.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#get-links
-func (s *ReleaseLinksService) ListReleaseLinks(pid interface{}, tagName string, opt *ListReleaseLinksOptions, options ...OptionFunc) ([]*ReleaseLink, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/releases/%s/assets/links", pathEscape(project), tagName)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var rls []*ReleaseLink
- resp, err := s.client.Do(req, &rls)
- if err != nil {
- return nil, resp, err
- }
-
- return rls, resp, err
-}
-
-// GetReleaseLink returns a link from release assets.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#get-a-link
-func (s *ReleaseLinksService) GetReleaseLink(pid interface{}, tagName string, link int, options ...OptionFunc) (*ReleaseLink, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/releases/%s/assets/links/%d",
- pathEscape(project),
- tagName,
- link)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- rl := new(ReleaseLink)
- resp, err := s.client.Do(req, rl)
- if err != nil {
- return nil, resp, err
- }
-
- return rl, resp, err
-}
-
-// CreateReleaseLinkOptions represents CreateReleaseLink() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#create-a-link
-type CreateReleaseLinkOptions struct {
- Name *string `url:"name" json:"name"`
- URL *string `url:"url" json:"url"`
-}
-
-// CreateReleaseLink creates a link.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#create-a-link
-func (s *ReleaseLinksService) CreateReleaseLink(pid interface{}, tagName string, opt *CreateReleaseLinkOptions, options ...OptionFunc) (*ReleaseLink, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/releases/%s/assets/links", pathEscape(project), tagName)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- rl := new(ReleaseLink)
- resp, err := s.client.Do(req, rl)
- if err != nil {
- return nil, resp, err
- }
-
- return rl, resp, err
-}
-
-// UpdateReleaseLinkOptions represents UpdateReleaseLink() options.
-//
-// You have to specify at least one of Name of URL.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#update-a-link
-type UpdateReleaseLinkOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- URL *string `url:"url,omitempty" json:"url,omitempty"`
-}
-
-// UpdateReleaseLink updates an asset link.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#update-a-link
-func (s *ReleaseLinksService) UpdateReleaseLink(pid interface{}, tagName string, link int, opt *UpdateReleaseLinkOptions, options ...OptionFunc) (*ReleaseLink, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/releases/%s/assets/links/%d",
- pathEscape(project),
- tagName,
- link)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- rl := new(ReleaseLink)
- resp, err := s.client.Do(req, rl)
- if err != nil {
- return nil, resp, err
- }
-
- return rl, resp, err
-}
-
-// DeleteReleaseLink deletes a link from release.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/releases/links.html#delete-a-link
-func (s *ReleaseLinksService) DeleteReleaseLink(pid interface{}, tagName string, link int, options ...OptionFunc) (*ReleaseLink, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/releases/%s/assets/links/%d",
- pathEscape(project),
- tagName,
- link,
- )
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- rl := new(ReleaseLink)
- resp, err := s.client.Do(req, rl)
- if err != nil {
- return nil, resp, err
- }
-
- return rl, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/releases.go b/vendor/github.com/xanzy/go-gitlab/releases.go
deleted file mode 100644
index 8202e985..00000000
--- a/vendor/github.com/xanzy/go-gitlab/releases.go
+++ /dev/null
@@ -1,212 +0,0 @@
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// ReleasesService handles communication with the releases methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/releases/index.html
-type ReleasesService struct {
- client *Client
-}
-
-// Release represents a project release.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/releases/index.html#list-releases
-type Release struct {
- TagName string `json:"tag_name"`
- Name string `json:"name"`
- Description string `json:"description,omitempty"`
- DescriptionHTML string `json:"description_html,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- Author struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Username string `json:"username"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"author"`
- Commit Commit `json:"commit"`
- Assets struct {
- Count int `json:"count"`
- Sources []struct {
- Format string `json:"format"`
- URL string `json:"url"`
- } `json:"sources"`
- Links []*ReleaseLink `json:"links"`
- } `json:"assets"`
-}
-
-// ListReleasesOptions represents ListReleases() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/releases/index.html#list-releases
-type ListReleasesOptions ListOptions
-
-// ListReleases gets a pagenated of releases accessible by the authenticated user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/releases/index.html#list-releases
-func (s *ReleasesService) ListReleases(pid interface{}, opt *ListReleasesOptions, options ...OptionFunc) ([]*Release, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/releases", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var rs []*Release
- resp, err := s.client.Do(req, &rs)
- if err != nil {
- return nil, resp, err
- }
-
- return rs, resp, err
-}
-
-// GetRelease returns a single release, identified by a tag name.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/releases/index.html#get-a-release-by-a-tag-name
-func (s *ReleasesService) GetRelease(pid interface{}, tagName string, options ...OptionFunc) (*Release, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/releases/%s", pathEscape(project), tagName)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(Release)
- resp, err := s.client.Do(req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
-
-// ReleaseAssets represents release assets in CreateRelease() options
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/releases/index.html#create-a-release
-type ReleaseAssets struct {
- Links []*ReleaseAssetLink `url:"links" json:"links"`
-}
-
-// ReleaseAssetLink represents release asset link in CreateRelease() options
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/releases/index.html#create-a-release
-type ReleaseAssetLink struct {
- Name string `url:"name" json:"name"`
- URL string `url:"url" json:"url"`
-}
-
-// CreateReleaseOptions represents CreateRelease() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/releases/index.html#create-a-release
-type CreateReleaseOptions struct {
- Name *string `url:"name" json:"name"`
- TagName *string `url:"tag_name" json:"tag_name"`
- Description *string `url:"description" json:"description"`
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
- Assets *ReleaseAssets `url:"assets,omitempty" json:"assets,omitempty"`
-}
-
-// CreateRelease creates a release.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/releases/index.html#create-a-release
-func (s *ReleasesService) CreateRelease(pid interface{}, opts *CreateReleaseOptions, options ...OptionFunc) (*Release, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/releases", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(Release)
- resp, err := s.client.Do(req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
-
-// UpdateReleaseOptions represents UpdateRelease() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/releases/index.html#update-a-release
-type UpdateReleaseOptions struct {
- Name *string `url:"name" json:"name"`
- Description *string `url:"description" json:"description"`
-}
-
-// UpdateRelease updates a release.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/releases/index.html#update-a-release
-func (s *ReleasesService) UpdateRelease(pid interface{}, tagName string, opts *UpdateReleaseOptions, options ...OptionFunc) (*Release, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/releases/%s", pathEscape(project), tagName)
-
- req, err := s.client.NewRequest("PUT", u, opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(Release)
- resp, err := s.client.Do(req, &r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
-
-// DeleteRelease deletes a release.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/releases/index.html#delete-a-release
-func (s *ReleasesService) DeleteRelease(pid interface{}, tagName string, options ...OptionFunc) (*Release, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/releases/%s", pathEscape(project), tagName)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(Release)
- resp, err := s.client.Do(req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/repositories.go b/vendor/github.com/xanzy/go-gitlab/repositories.go
deleted file mode 100644
index 96766aea..00000000
--- a/vendor/github.com/xanzy/go-gitlab/repositories.go
+++ /dev/null
@@ -1,327 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "bytes"
- "fmt"
- "io"
- "net/url"
-)
-
-// RepositoriesService handles communication with the repositories related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repositories.html
-type RepositoriesService struct {
- client *Client
-}
-
-// TreeNode represents a GitLab repository file or directory.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repositories.html
-type TreeNode struct {
- ID string `json:"id"`
- Name string `json:"name"`
- Type string `json:"type"`
- Path string `json:"path"`
- Mode string `json:"mode"`
-}
-
-func (t TreeNode) String() string {
- return Stringify(t)
-}
-
-// ListTreeOptions represents the available ListTree() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#list-repository-tree
-type ListTreeOptions struct {
- ListOptions
- Path *string `url:"path,omitempty" json:"path,omitempty"`
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
- Recursive *bool `url:"recursive,omitempty" json:"recursive,omitempty"`
-}
-
-// ListTree gets a list of repository files and directories in a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#list-repository-tree
-func (s *RepositoriesService) ListTree(pid interface{}, opt *ListTreeOptions, options ...OptionFunc) ([]*TreeNode, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/tree", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var t []*TreeNode
- resp, err := s.client.Do(req, &t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// Blob gets information about blob in repository like size and content. Note
-// that blob content is Base64 encoded.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#get-a-blob-from-repository
-func (s *RepositoriesService) Blob(pid interface{}, sha string, options ...OptionFunc) ([]byte, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/blobs/%s", pathEscape(project), url.PathEscape(sha))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var b bytes.Buffer
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b.Bytes(), resp, err
-}
-
-// RawBlobContent gets the raw file contents for a blob by blob SHA.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#raw-blob-content
-func (s *RepositoriesService) RawBlobContent(pid interface{}, sha string, options ...OptionFunc) ([]byte, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/blobs/%s/raw", pathEscape(project), url.PathEscape(sha))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var b bytes.Buffer
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b.Bytes(), resp, err
-}
-
-// ArchiveOptions represents the available Archive() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#get-file-archive
-type ArchiveOptions struct {
- Format *string `url:"-" json:"-"`
- SHA *string `url:"sha,omitempty" json:"sha,omitempty"`
-}
-
-// Archive gets an archive of the repository.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#get-file-archive
-func (s *RepositoriesService) Archive(pid interface{}, opt *ArchiveOptions, options ...OptionFunc) ([]byte, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/archive", pathEscape(project))
-
- // Set an optional format for the archive.
- if opt != nil && opt.Format != nil {
- u = fmt.Sprintf("%s.%s", u, *opt.Format)
- }
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var b bytes.Buffer
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b.Bytes(), resp, err
-}
-
-// StreamArchive streams an archive of the repository to the provided
-// io.Writer.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#get-file-archive
-func (s *RepositoriesService) StreamArchive(pid interface{}, w io.Writer, opt *ArchiveOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/archive", pathEscape(project))
-
- // Set an optional format for the archive.
- if opt != nil && opt.Format != nil {
- u = fmt.Sprintf("%s.%s", u, *opt.Format)
- }
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, w)
-}
-
-// Compare represents the result of a comparison of branches, tags or commits.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#compare-branches-tags-or-commits
-type Compare struct {
- Commit *Commit `json:"commit"`
- Commits []*Commit `json:"commits"`
- Diffs []*Diff `json:"diffs"`
- CompareTimeout bool `json:"compare_timeout"`
- CompareSameRef bool `json:"compare_same_ref"`
-}
-
-func (c Compare) String() string {
- return Stringify(c)
-}
-
-// CompareOptions represents the available Compare() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#compare-branches-tags-or-commits
-type CompareOptions struct {
- From *string `url:"from,omitempty" json:"from,omitempty"`
- To *string `url:"to,omitempty" json:"to,omitempty"`
- Straight *bool `url:"straight,omitempty" json:"straight,omitempty"`
-}
-
-// Compare compares branches, tags or commits.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#compare-branches-tags-or-commits
-func (s *RepositoriesService) Compare(pid interface{}, opt *CompareOptions, options ...OptionFunc) (*Compare, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/compare", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(Compare)
- resp, err := s.client.Do(req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// Contributor represents a GitLap contributor.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repositories.html#contributors
-type Contributor struct {
- Name string `json:"name"`
- Email string `json:"email"`
- Commits int `json:"commits"`
- Additions int `json:"additions"`
- Deletions int `json:"deletions"`
-}
-
-func (c Contributor) String() string {
- return Stringify(c)
-}
-
-// ListContributorsOptions represents the available ListContributors() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repositories.html#contributors
-type ListContributorsOptions ListOptions
-
-// Contributors gets the repository contributors list.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repositories.html#contributors
-func (s *RepositoriesService) Contributors(pid interface{}, opt *ListContributorsOptions, options ...OptionFunc) ([]*Contributor, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/contributors", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var c []*Contributor
- resp, err := s.client.Do(req, &c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
-
-// MergeBaseOptions represents the available MergeBase() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#merge-base
-type MergeBaseOptions struct {
- Ref []string `url:"refs[],omitempty" json:"refs,omitempty"`
-}
-
-// MergeBase gets the common ancestor for 2 refs (commit SHAs, branch
-// names or tags).
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repositories.html#merge-base
-func (s *RepositoriesService) MergeBase(pid interface{}, opt *MergeBaseOptions, options ...OptionFunc) (*Commit, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/merge_base", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(Commit)
- resp, err := s.client.Do(req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/repository_files.go b/vendor/github.com/xanzy/go-gitlab/repository_files.go
deleted file mode 100644
index 26149319..00000000
--- a/vendor/github.com/xanzy/go-gitlab/repository_files.go
+++ /dev/null
@@ -1,311 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "bytes"
- "fmt"
- "net/url"
- "strconv"
-)
-
-// RepositoryFilesService handles communication with the repository files
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repository_files.html
-type RepositoryFilesService struct {
- client *Client
-}
-
-// File represents a GitLab repository file.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repository_files.html
-type File struct {
- FileName string `json:"file_name"`
- FilePath string `json:"file_path"`
- Size int `json:"size"`
- Encoding string `json:"encoding"`
- Content string `json:"content"`
- Ref string `json:"ref"`
- BlobID string `json:"blob_id"`
- CommitID string `json:"commit_id"`
- SHA256 string `json:"content_sha256"`
-}
-
-func (r File) String() string {
- return Stringify(r)
-}
-
-// GetFileOptions represents the available GetFile() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#get-file-from-repository
-type GetFileOptions struct {
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
-}
-
-// GetFile allows you to receive information about a file in repository like
-// name, size, content. Note that file content is Base64 encoded.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#get-file-from-repository
-func (s *RepositoryFilesService) GetFile(pid interface{}, fileName string, opt *GetFileOptions, options ...OptionFunc) (*File, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf(
- "projects/%s/repository/files/%s",
- pathEscape(project),
- url.PathEscape(fileName),
- )
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- f := new(File)
- resp, err := s.client.Do(req, f)
- if err != nil {
- return nil, resp, err
- }
-
- return f, resp, err
-}
-
-// GetFileMetaDataOptions represents the available GetFileMetaData() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#get-file-from-repository
-type GetFileMetaDataOptions struct {
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
-}
-
-// GetFileMetaData allows you to receive meta information about a file in
-// repository like name, size.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#get-file-from-repository
-func (s *RepositoryFilesService) GetFileMetaData(pid interface{}, fileName string, opt *GetFileMetaDataOptions, options ...OptionFunc) (*File, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf(
- "projects/%s/repository/files/%s",
- pathEscape(project),
- url.PathEscape(fileName),
- )
-
- req, err := s.client.NewRequest("HEAD", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- resp, err := s.client.Do(req, nil)
- if err != nil {
- return nil, resp, err
- }
-
- f := &File{
- BlobID: resp.Header.Get("X-Gitlab-Blob-Id"),
- CommitID: resp.Header.Get("X-Gitlab-Last-Commit-Id"),
- Encoding: resp.Header.Get("X-Gitlab-Encoding"),
- FileName: resp.Header.Get("X-Gitlab-File-Name"),
- FilePath: resp.Header.Get("X-Gitlab-File-Path"),
- Ref: resp.Header.Get("X-Gitlab-Ref"),
- SHA256: resp.Header.Get("X-Gitlab-Content-Sha256"),
- }
-
- if sizeString := resp.Header.Get("X-Gitlab-Size"); sizeString != "" {
- f.Size, err = strconv.Atoi(sizeString)
- if err != nil {
- return nil, resp, err
- }
- }
-
- return f, resp, err
-}
-
-// GetRawFileOptions represents the available GetRawFile() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#get-raw-file-from-repository
-type GetRawFileOptions struct {
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
-}
-
-// GetRawFile allows you to receive the raw file in repository.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#get-raw-file-from-repository
-func (s *RepositoryFilesService) GetRawFile(pid interface{}, fileName string, opt *GetRawFileOptions, options ...OptionFunc) ([]byte, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf(
- "projects/%s/repository/files/%s/raw",
- pathEscape(project),
- url.PathEscape(fileName),
- )
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var f bytes.Buffer
- resp, err := s.client.Do(req, &f)
- if err != nil {
- return nil, resp, err
- }
-
- return f.Bytes(), resp, err
-}
-
-// FileInfo represents file details of a GitLab repository file.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/repository_files.html
-type FileInfo struct {
- FilePath string `json:"file_path"`
- Branch string `json:"branch"`
-}
-
-func (r FileInfo) String() string {
- return Stringify(r)
-}
-
-// CreateFileOptions represents the available CreateFile() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#create-new-file-in-repository
-type CreateFileOptions struct {
- Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
- Encoding *string `url:"encoding,omitempty" json:"encoding,omitempty"`
- AuthorEmail *string `url:"author_email,omitempty" json:"author_email,omitempty"`
- AuthorName *string `url:"author_name,omitempty" json:"author_name,omitempty"`
- Content *string `url:"content,omitempty" json:"content,omitempty"`
- CommitMessage *string `url:"commit_message,omitempty" json:"commit_message,omitempty"`
-}
-
-// CreateFile creates a new file in a repository.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#create-new-file-in-repository
-func (s *RepositoryFilesService) CreateFile(pid interface{}, fileName string, opt *CreateFileOptions, options ...OptionFunc) (*FileInfo, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf(
- "projects/%s/repository/files/%s",
- pathEscape(project),
- url.PathEscape(fileName),
- )
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- f := new(FileInfo)
- resp, err := s.client.Do(req, f)
- if err != nil {
- return nil, resp, err
- }
-
- return f, resp, err
-}
-
-// UpdateFileOptions represents the available UpdateFile() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#update-existing-file-in-repository
-type UpdateFileOptions struct {
- Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
- Encoding *string `url:"encoding,omitempty" json:"encoding,omitempty"`
- AuthorEmail *string `url:"author_email,omitempty" json:"author_email,omitempty"`
- AuthorName *string `url:"author_name,omitempty" json:"author_name,omitempty"`
- Content *string `url:"content,omitempty" json:"content,omitempty"`
- CommitMessage *string `url:"commit_message,omitempty" json:"commit_message,omitempty"`
- LastCommitID *string `url:"last_commit_id,omitempty" json:"last_commit_id,omitempty"`
-}
-
-// UpdateFile updates an existing file in a repository
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#update-existing-file-in-repository
-func (s *RepositoryFilesService) UpdateFile(pid interface{}, fileName string, opt *UpdateFileOptions, options ...OptionFunc) (*FileInfo, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf(
- "projects/%s/repository/files/%s",
- pathEscape(project),
- url.PathEscape(fileName),
- )
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- f := new(FileInfo)
- resp, err := s.client.Do(req, f)
- if err != nil {
- return nil, resp, err
- }
-
- return f, resp, err
-}
-
-// DeleteFileOptions represents the available DeleteFile() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#delete-existing-file-in-repository
-type DeleteFileOptions struct {
- Branch *string `url:"branch,omitempty" json:"branch,omitempty"`
- AuthorEmail *string `url:"author_email,omitempty" json:"author_email,omitempty"`
- AuthorName *string `url:"author_name,omitempty" json:"author_name,omitempty"`
- CommitMessage *string `url:"commit_message,omitempty" json:"commit_message,omitempty"`
-}
-
-// DeleteFile deletes an existing file in a repository
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/repository_files.html#delete-existing-file-in-repository
-func (s *RepositoryFilesService) DeleteFile(pid interface{}, fileName string, opt *DeleteFileOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf(
- "projects/%s/repository/files/%s",
- pathEscape(project),
- url.PathEscape(fileName),
- )
-
- req, err := s.client.NewRequest("DELETE", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/resource_label_events.go b/vendor/github.com/xanzy/go-gitlab/resource_label_events.go
deleted file mode 100644
index e9ff66a3..00000000
--- a/vendor/github.com/xanzy/go-gitlab/resource_label_events.go
+++ /dev/null
@@ -1,219 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// ResourceLabelEventsService handles communication with the event related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/resource_label_events.html
-type ResourceLabelEventsService struct {
- client *Client
-}
-
-// LabelEvent represents a resource label event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/resource_label_events.html#get-single-issue-label-event
-type LabelEvent struct {
- ID int `json:"id"`
- Action string `json:"action"`
- CreatedAt *time.Time `json:"created_at"`
- ResourceType string `json:"resource_type"`
- ResourceID int `json:"resource_id"`
- User struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Username string `json:"username"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"user"`
- Label struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Color string `json:"color"`
- TextColor string `json:"text_color"`
- Description string `json:"description"`
- } `json:"label"`
-}
-
-// ListLabelEventsOptions represents the options for all resource label events
-// list methods.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/resource_label_events.html#list-project-issue-label-events
-type ListLabelEventsOptions struct {
- ListOptions
-}
-
-// ListIssueLabelEvents retrieves resource label events for the
-// specified project and issue.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/resource_label_events.html#list-project-issue-label-events
-func (s *ResourceLabelEventsService) ListIssueLabelEvents(pid interface{}, issue int, opt *ListLabelEventsOptions, options ...OptionFunc) ([]*LabelEvent, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/resource_label_events", pathEscape(project), issue)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ls []*LabelEvent
- resp, err := s.client.Do(req, &ls)
- if err != nil {
- return nil, resp, err
- }
-
- return ls, resp, err
-}
-
-// GetIssueLabelEvent gets a single issue-label-event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/resource_label_events.html#get-single-issue-label-event
-func (s *ResourceLabelEventsService) GetIssueLabelEvent(pid interface{}, issue int, event int, options ...OptionFunc) (*LabelEvent, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/issues/%d/resource_label_events/%d", pathEscape(project), issue, event)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(LabelEvent)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// ListGroupEpicLabelEvents retrieves resource label events for the specified
-// group and epic.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/resource_label_events.html#list-group-epic-label-events
-func (s *ResourceLabelEventsService) ListGroupEpicLabelEvents(gid interface{}, epic int, opt *ListLabelEventsOptions, options ...OptionFunc) ([]*LabelEvent, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/resource_label_events", pathEscape(group), epic)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ls []*LabelEvent
- resp, err := s.client.Do(req, &ls)
- if err != nil {
- return nil, resp, err
- }
-
- return ls, resp, err
-}
-
-// GetGroupEpicLabelEvent gets a single group epic label event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/resource_label_events.html#get-single-epic-label-event
-func (s *ResourceLabelEventsService) GetGroupEpicLabelEvent(gid interface{}, epic int, event int, options ...OptionFunc) (*LabelEvent, *Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("groups/%s/epics/%d/resource_label_events/%d", pathEscape(group), epic, event)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(LabelEvent)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
-
-// ListMergeLabelEvents retrieves resource label events for the specified
-// project and merge request.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/resource_label_events.html#list-project-merge-request-label-events
-func (s *ResourceLabelEventsService) ListMergeLabelEvents(pid interface{}, request int, opt *ListLabelEventsOptions, options ...OptionFunc) ([]*LabelEvent, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/resource_label_events", pathEscape(project), request)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ls []*LabelEvent
- resp, err := s.client.Do(req, &ls)
- if err != nil {
- return nil, resp, err
- }
-
- return ls, resp, err
-}
-
-// GetMergeRequestLabelEvent gets a single merge request label event.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/resource_label_events.html#get-single-merge-request-label-event
-func (s *ResourceLabelEventsService) GetMergeRequestLabelEvent(pid interface{}, request int, event int, options ...OptionFunc) (*LabelEvent, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/merge_requests/%d/resource_label_events/%d", pathEscape(project), request, event)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(LabelEvent)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/runners.go b/vendor/github.com/xanzy/go-gitlab/runners.go
deleted file mode 100644
index d3330d44..00000000
--- a/vendor/github.com/xanzy/go-gitlab/runners.go
+++ /dev/null
@@ -1,415 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// RunnersService handles communication with the runner related methods of the
-// GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/runners.html
-type RunnersService struct {
- client *Client
-}
-
-// Runner represents a GitLab CI Runner.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/runners.html
-type Runner struct {
- ID int `json:"id"`
- Description string `json:"description"`
- Active bool `json:"active"`
- IsShared bool `json:"is_shared"`
- IPAddress string `json:"ip_address"`
- Name string `json:"name"`
- Online bool `json:"online"`
- Status string `json:"status"`
- Token string `json:"token"`
-}
-
-// RunnerDetails represents the GitLab CI runner details.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/runners.html
-type RunnerDetails struct {
- Active bool `json:"active"`
- Architecture string `json:"architecture"`
- Description string `json:"description"`
- ID int `json:"id"`
- IPAddress string `json:"ip_address"`
- IsShared bool `json:"is_shared"`
- ContactedAt *time.Time `json:"contacted_at"`
- Name string `json:"name"`
- Online bool `json:"online"`
- Status string `json:"status"`
- Platform string `json:"platform"`
- Projects []struct {
- ID int `json:"id"`
- Name string `json:"name"`
- NameWithNamespace string `json:"name_with_namespace"`
- Path string `json:"path"`
- PathWithNamespace string `json:"path_with_namespace"`
- } `json:"projects"`
- Token string `json:"token"`
- Revision string `json:"revision"`
- TagList []string `json:"tag_list"`
- Version string `json:"version"`
- AccessLevel string `json:"access_level"`
- MaximumTimeout int `json:"maximum_timeout"`
- Groups []struct {
- ID int `json:"id"`
- Name string `json:"name"`
- WebURL string `json:"web_url"`
- } `json:"groups"`
-}
-
-// ListRunnersOptions represents the available ListRunners() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#list-owned-runners
-type ListRunnersOptions struct {
- ListOptions
- Scope *string `url:"scope,omitempty" json:"scope,omitempty"`
- Type *string `url:"type,omitempty" json:"type,omitempty"`
- Status *string `url:"status,omitempty" json:"status,omitempty"`
- TagList []string `url:"tag_list,comma,omitempty" json:"tag_list,omitempty"`
-}
-
-// ListRunners gets a list of runners accessible by the authenticated user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#list-owned-runners
-func (s *RunnersService) ListRunners(opt *ListRunnersOptions, options ...OptionFunc) ([]*Runner, *Response, error) {
- req, err := s.client.NewRequest("GET", "runners", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var rs []*Runner
- resp, err := s.client.Do(req, &rs)
- if err != nil {
- return nil, resp, err
- }
-
- return rs, resp, err
-}
-
-// ListAllRunners gets a list of all runners in the GitLab instance. Access is
-// restricted to users with admin privileges.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#list-all-runners
-func (s *RunnersService) ListAllRunners(opt *ListRunnersOptions, options ...OptionFunc) ([]*Runner, *Response, error) {
- req, err := s.client.NewRequest("GET", "runners/all", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var rs []*Runner
- resp, err := s.client.Do(req, &rs)
- if err != nil {
- return nil, resp, err
- }
-
- return rs, resp, err
-}
-
-// GetRunnerDetails returns details for given runner.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#get-runner-39-s-details
-func (s *RunnersService) GetRunnerDetails(rid interface{}, options ...OptionFunc) (*RunnerDetails, *Response, error) {
- runner, err := parseID(rid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("runners/%s", runner)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var rs *RunnerDetails
- resp, err := s.client.Do(req, &rs)
- if err != nil {
- return nil, resp, err
- }
-
- return rs, resp, err
-}
-
-// UpdateRunnerDetailsOptions represents the available UpdateRunnerDetails() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#update-runner-39-s-details
-type UpdateRunnerDetailsOptions struct {
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Active *bool `url:"active,omitempty" json:"active,omitempty"`
- TagList []string `url:"tag_list[],omitempty" json:"tag_list,omitempty"`
- RunUntagged *bool `url:"run_untagged,omitempty" json:"run_untagged,omitempty"`
- Locked *bool `url:"locked,omitempty" json:"locked,omitempty"`
- AccessLevel *string `url:"access_level,omitempty" json:"access_level,omitempty"`
- MaximumTimeout *int `url:"maximum_timeout,omitempty" json:"maximum_timeout,omitempty"`
-}
-
-// UpdateRunnerDetails updates details for a given runner.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#update-runner-39-s-details
-func (s *RunnersService) UpdateRunnerDetails(rid interface{}, opt *UpdateRunnerDetailsOptions, options ...OptionFunc) (*RunnerDetails, *Response, error) {
- runner, err := parseID(rid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("runners/%s", runner)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var rs *RunnerDetails
- resp, err := s.client.Do(req, &rs)
- if err != nil {
- return nil, resp, err
- }
-
- return rs, resp, err
-}
-
-// RemoveRunner removes a runner.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#remove-a-runner
-func (s *RunnersService) RemoveRunner(rid interface{}, options ...OptionFunc) (*Response, error) {
- runner, err := parseID(rid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("runners/%s", runner)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ListRunnerJobsOptions represents the available ListRunnerJobs()
-// options. Status can be one of: running, success, failed, canceled.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#list-runners-jobs
-type ListRunnerJobsOptions struct {
- ListOptions
- Status *string `url:"status,omitempty" json:"status,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
-}
-
-// ListRunnerJobs gets a list of jobs that are being processed or were processed by specified Runner.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#list-runner-39-s-jobs
-func (s *RunnersService) ListRunnerJobs(rid interface{}, opt *ListRunnerJobsOptions, options ...OptionFunc) ([]*Job, *Response, error) {
- runner, err := parseID(rid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("runners/%s/jobs", runner)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var rs []*Job
- resp, err := s.client.Do(req, &rs)
- if err != nil {
- return nil, resp, err
- }
-
- return rs, resp, err
-}
-
-// ListProjectRunnersOptions represents the available ListProjectRunners()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#list-project-s-runners
-type ListProjectRunnersOptions ListRunnersOptions
-
-// ListProjectRunners gets a list of runners accessible by the authenticated user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#list-project-s-runners
-func (s *RunnersService) ListProjectRunners(pid interface{}, opt *ListProjectRunnersOptions, options ...OptionFunc) ([]*Runner, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/runners", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var rs []*Runner
- resp, err := s.client.Do(req, &rs)
- if err != nil {
- return nil, resp, err
- }
-
- return rs, resp, err
-}
-
-// EnableProjectRunnerOptions represents the available EnableProjectRunner()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#enable-a-runner-in-project
-type EnableProjectRunnerOptions struct {
- RunnerID int `json:"runner_id"`
-}
-
-// EnableProjectRunner enables an available specific runner in the project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#enable-a-runner-in-project
-func (s *RunnersService) EnableProjectRunner(pid interface{}, opt *EnableProjectRunnerOptions, options ...OptionFunc) (*Runner, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/runners", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var r *Runner
- resp, err := s.client.Do(req, &r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
-
-// DisableProjectRunner disables a specific runner from project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#disable-a-runner-from-project
-func (s *RunnersService) DisableProjectRunner(pid interface{}, runner int, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/runners/%d", pathEscape(project), runner)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// RegisterNewRunnerOptions represents the available RegisterNewRunner()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#register-a-new-runner
-type RegisterNewRunnerOptions struct {
- Token *string `url:"token" json:"token"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Info *string `url:"info,omitempty" json:"info,omitempty"`
- Active *bool `url:"active,omitempty" json:"active,omitempty"`
- Locked *bool `url:"locked,omitempty" json:"locked,omitempty"`
- RunUntagged *bool `url:"run_untagged,omitempty" json:"run_untagged,omitempty"`
- TagList []string `url:"tag_list[],omitempty" json:"tag_list,omitempty"`
- MaximumTimeout *int `url:"maximum_timeout,omitempty" json:"maximum_timeout,omitempty"`
-}
-
-// RegisterNewRunner registers a new Runner for the instance.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#register-a-new-runner
-func (s *RunnersService) RegisterNewRunner(opt *RegisterNewRunnerOptions, options ...OptionFunc) (*Runner, *Response, error) {
- req, err := s.client.NewRequest("POST", "runners", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var r *Runner
- resp, err := s.client.Do(req, &r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
-
-// DeleteRegisteredRunnerOptions represents the available
-// DeleteRegisteredRunner() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#delete-a-registered-runner
-type DeleteRegisteredRunnerOptions struct {
- Token *string `url:"token" json:"token"`
-}
-
-// DeleteRegisteredRunner registers a new Runner for the instance.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#delete-a-registered-runner
-func (s *RunnersService) DeleteRegisteredRunner(opt *DeleteRegisteredRunnerOptions, options ...OptionFunc) (*Response, error) {
- req, err := s.client.NewRequest("DELETE", "runners", opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// VerifyRegisteredRunnerOptions represents the available
-// VerifyRegisteredRunner() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#verify-authentication-for-a-registered-runner
-type VerifyRegisteredRunnerOptions struct {
- Token *string `url:"token" json:"token"`
-}
-
-// VerifyRegisteredRunner registers a new Runner for the instance.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/runners.html#verify-authentication-for-a-registered-runner
-func (s *RunnersService) VerifyRegisteredRunner(opt *VerifyRegisteredRunnerOptions, options ...OptionFunc) (*Response, error) {
- req, err := s.client.NewRequest("POST", "runners/verify", opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/search.go b/vendor/github.com/xanzy/go-gitlab/search.go
deleted file mode 100644
index de3ad362..00000000
--- a/vendor/github.com/xanzy/go-gitlab/search.go
+++ /dev/null
@@ -1,354 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
-)
-
-// SearchService handles communication with the search related methods of the
-// GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html
-type SearchService struct {
- client *Client
-}
-
-// SearchOptions represents the available options for all search methods.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html
-type SearchOptions ListOptions
-
-type searchOptions struct {
- SearchOptions
- Scope string `url:"scope" json:"scope"`
- Search string `url:"search" json:"search"`
-}
-
-// Projects searches the expression within projects
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-projects
-func (s *SearchService) Projects(query string, opt *SearchOptions, options ...OptionFunc) ([]*Project, *Response, error) {
- var ps []*Project
- resp, err := s.search("projects", query, &ps, opt, options...)
- return ps, resp, err
-}
-
-// ProjectsByGroup searches the expression within projects for
-// the specified group
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#group-search-api
-func (s *SearchService) ProjectsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Project, *Response, error) {
- var ps []*Project
- resp, err := s.searchByGroup(gid, "projects", query, &ps, opt, options...)
- return ps, resp, err
-}
-
-// Issues searches the expression within issues
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-issues
-func (s *SearchService) Issues(query string, opt *SearchOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- var is []*Issue
- resp, err := s.search("issues", query, &is, opt, options...)
- return is, resp, err
-}
-
-// IssuesByGroup searches the expression within issues for
-// the specified group
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-issues
-func (s *SearchService) IssuesByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- var is []*Issue
- resp, err := s.searchByGroup(gid, "issues", query, &is, opt, options...)
- return is, resp, err
-}
-
-// IssuesByProject searches the expression within issues for
-// the specified project
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-issues
-func (s *SearchService) IssuesByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Issue, *Response, error) {
- var is []*Issue
- resp, err := s.searchByProject(pid, "issues", query, &is, opt, options...)
- return is, resp, err
-}
-
-// MergeRequests searches the expression within merge requests
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-merge_requests
-func (s *SearchService) MergeRequests(query string, opt *SearchOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- var ms []*MergeRequest
- resp, err := s.search("merge_requests", query, &ms, opt, options...)
- return ms, resp, err
-}
-
-// MergeRequestsByGroup searches the expression within merge requests for
-// the specified group
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-merge_requests
-func (s *SearchService) MergeRequestsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- var ms []*MergeRequest
- resp, err := s.searchByGroup(gid, "merge_requests", query, &ms, opt, options...)
- return ms, resp, err
-}
-
-// MergeRequestsByProject searches the expression within merge requests for
-// the specified project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-merge_requests
-func (s *SearchService) MergeRequestsByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*MergeRequest, *Response, error) {
- var ms []*MergeRequest
- resp, err := s.searchByProject(pid, "merge_requests", query, &ms, opt, options...)
- return ms, resp, err
-}
-
-// Milestones searches the expression within milestones
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-milestones
-func (s *SearchService) Milestones(query string, opt *SearchOptions, options ...OptionFunc) ([]*Milestone, *Response, error) {
- var ms []*Milestone
- resp, err := s.search("milestones", query, &ms, opt, options...)
- return ms, resp, err
-}
-
-// MilestonesByGroup searches the expression within milestones for
-// the specified group
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-milestones
-func (s *SearchService) MilestonesByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Milestone, *Response, error) {
- var ms []*Milestone
- resp, err := s.searchByGroup(gid, "milestones", query, &ms, opt, options...)
- return ms, resp, err
-}
-
-// MilestonesByProject searches the expression within milestones for
-// the specified project
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-milestones
-func (s *SearchService) MilestonesByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Milestone, *Response, error) {
- var ms []*Milestone
- resp, err := s.searchByProject(pid, "milestones", query, &ms, opt, options...)
- return ms, resp, err
-}
-
-// SnippetTitles searches the expression within snippet titles
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-snippet_titles
-func (s *SearchService) SnippetTitles(query string, opt *SearchOptions, options ...OptionFunc) ([]*Snippet, *Response, error) {
- var ss []*Snippet
- resp, err := s.search("snippet_titles", query, &ss, opt, options...)
- return ss, resp, err
-}
-
-// SnippetBlobs searches the expression within snippet blobs
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-snippet_blobs
-func (s *SearchService) SnippetBlobs(query string, opt *SearchOptions, options ...OptionFunc) ([]*Snippet, *Response, error) {
- var ss []*Snippet
- resp, err := s.search("snippet_blobs", query, &ss, opt, options...)
- return ss, resp, err
-}
-
-// NotesByProject searches the expression within notes for the specified
-// project
-//
-// GitLab API docs: // https://docs.gitlab.com/ce/api/search.html#scope-notes
-func (s *SearchService) NotesByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Note, *Response, error) {
- var ns []*Note
- resp, err := s.searchByProject(pid, "notes", query, &ns, opt, options...)
- return ns, resp, err
-}
-
-// WikiBlobs searches the expression within all wiki blobs
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-wiki_blobs
-func (s *SearchService) WikiBlobs(query string, opt *SearchOptions, options ...OptionFunc) ([]*Wiki, *Response, error) {
- var ws []*Wiki
- resp, err := s.search("wiki_blobs", query, &ws, opt, options...)
- return ws, resp, err
-}
-
-// WikiBlobsByGroup searches the expression within wiki blobs for
-// specified group
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-wiki_blobs
-func (s *SearchService) WikiBlobsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Wiki, *Response, error) {
- var ws []*Wiki
- resp, err := s.searchByGroup(gid, "wiki_blobs", query, &ws, opt, options...)
- return ws, resp, err
-}
-
-// WikiBlobsByProject searches the expression within wiki blobs for
-// the specified project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/search.html#scope-wiki_blobs
-func (s *SearchService) WikiBlobsByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Wiki, *Response, error) {
- var ws []*Wiki
- resp, err := s.searchByProject(pid, "wiki_blobs", query, &ws, opt, options...)
- return ws, resp, err
-}
-
-// Commits searches the expression within all commits
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-commits
-func (s *SearchService) Commits(query string, opt *SearchOptions, options ...OptionFunc) ([]*Commit, *Response, error) {
- var cs []*Commit
- resp, err := s.search("commits", query, &cs, opt, options...)
- return cs, resp, err
-}
-
-// CommitsByGroup searches the expression within commits for the specified
-// group
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-commits
-func (s *SearchService) CommitsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Commit, *Response, error) {
- var cs []*Commit
- resp, err := s.searchByGroup(gid, "commits", query, &cs, opt, options...)
- return cs, resp, err
-}
-
-// CommitsByProject searches the expression within commits for the
-// specified project
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-commits
-func (s *SearchService) CommitsByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Commit, *Response, error) {
- var cs []*Commit
- resp, err := s.searchByProject(pid, "commits", query, &cs, opt, options...)
- return cs, resp, err
-}
-
-// Blob represents a single blob.
-type Blob struct {
- Basename string `json:"basename"`
- Data string `json:"data"`
- Filename string `json:"filename"`
- ID int `json:"id"`
- Ref string `json:"ref"`
- Startline int `json:"startline"`
- ProjectID int `json:"project_id"`
-}
-
-// Blobs searches the expression within all blobs
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-blobs
-func (s *SearchService) Blobs(query string, opt *SearchOptions, options ...OptionFunc) ([]*Blob, *Response, error) {
- var bs []*Blob
- resp, err := s.search("blobs", query, &bs, opt, options...)
- return bs, resp, err
-}
-
-// BlobsByGroup searches the expression within blobs for the specified
-// group
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-blobs
-func (s *SearchService) BlobsByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Blob, *Response, error) {
- var bs []*Blob
- resp, err := s.searchByGroup(gid, "blobs", query, &bs, opt, options...)
- return bs, resp, err
-}
-
-// BlobsByProject searches the expression within blobs for the specified
-// project
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/search.html#scope-blobs
-func (s *SearchService) BlobsByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*Blob, *Response, error) {
- var bs []*Blob
- resp, err := s.searchByProject(pid, "blobs", query, &bs, opt, options...)
- return bs, resp, err
-}
-
-// Users searches the expression within all users
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/search.html#scope-users
-func (s *SearchService) Users(query string, opt *SearchOptions, options ...OptionFunc) ([]*User, *Response, error) {
- var ret []*User
- resp, err := s.search("users", query, &ret, opt, options...)
- return ret, resp, err
-}
-
-// UsersByGroup searches the expression within users for the specified
-// group
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/search.html#scope-users-1
-func (s *SearchService) UsersByGroup(gid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*User, *Response, error) {
- var ret []*User
- resp, err := s.searchByGroup(gid, "users", query, &ret, opt, options...)
- return ret, resp, err
-}
-
-// UsersByProject searches the expression within users for the
-// specified project
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/search.html#scope-users-2
-func (s *SearchService) UsersByProject(pid interface{}, query string, opt *SearchOptions, options ...OptionFunc) ([]*User, *Response, error) {
- var ret []*User
- resp, err := s.searchByProject(pid, "users", query, &ret, opt, options...)
- return ret, resp, err
-}
-
-func (s *SearchService) search(scope, query string, result interface{}, opt *SearchOptions, options ...OptionFunc) (*Response, error) {
- opts := &searchOptions{SearchOptions: *opt, Scope: scope, Search: query}
-
- req, err := s.client.NewRequest("GET", "search", opts, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, result)
-}
-
-func (s *SearchService) searchByGroup(gid interface{}, scope, query string, result interface{}, opt *SearchOptions, options ...OptionFunc) (*Response, error) {
- group, err := parseID(gid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("groups/%s/-/search", pathEscape(group))
-
- opts := &searchOptions{SearchOptions: *opt, Scope: scope, Search: query}
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, result)
-}
-
-func (s *SearchService) searchByProject(pid interface{}, scope, query string, result interface{}, opt *SearchOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/-/search", pathEscape(project))
-
- opts := &searchOptions{SearchOptions: *opt, Scope: scope, Search: query}
-
- req, err := s.client.NewRequest("GET", u, opts, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, result)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/services.go b/vendor/github.com/xanzy/go-gitlab/services.go
deleted file mode 100644
index 8d16cadc..00000000
--- a/vendor/github.com/xanzy/go-gitlab/services.go
+++ /dev/null
@@ -1,864 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "encoding/json"
- "fmt"
- "strconv"
- "time"
-)
-
-// ServicesService handles communication with the services related methods of
-// the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/services.html
-type ServicesService struct {
- client *Client
-}
-
-// Service represents a GitLab service.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/services.html
-type Service struct {
- ID int `json:"id"`
- Title string `json:"title"`
- CreatedAt *time.Time `json:"created_at"`
- UpdatedAt *time.Time `json:"updated_at"`
- Active bool `json:"active"`
- PushEvents bool `json:"push_events"`
- IssuesEvents bool `json:"issues_events"`
- ConfidentialIssuesEvents bool `json:"confidential_issues_events"`
- MergeRequestsEvents bool `json:"merge_requests_events"`
- TagPushEvents bool `json:"tag_push_events"`
- NoteEvents bool `json:"note_events"`
- ConfidentialNoteEvents bool `json:"confidential_note_events"`
- PipelineEvents bool `json:"pipeline_events"`
- JobEvents bool `json:"job_events"`
- WikiPageEvents bool `json:"wiki_page_events"`
-}
-
-// SetGitLabCIServiceOptions represents the available SetGitLabCIService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-gitlab-ci-service
-type SetGitLabCIServiceOptions struct {
- Token *string `url:"token,omitempty" json:"token,omitempty"`
- ProjectURL *string `url:"project_url,omitempty" json:"project_url,omitempty"`
-}
-
-// SetGitLabCIService sets GitLab CI service for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-gitlab-ci-service
-func (s *ServicesService) SetGitLabCIService(pid interface{}, opt *SetGitLabCIServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/gitlab-ci", pathEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteGitLabCIService deletes GitLab CI service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-gitlab-ci-service
-func (s *ServicesService) DeleteGitLabCIService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/gitlab-ci", pathEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// GithubService represents Github service settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#github-premium
-type GithubService struct {
- Service
- Properties *GithubServiceProperties `json:"properties"`
-}
-
-// GithubServiceProperties represents Github specific properties.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#github-premium
-type GithubServiceProperties struct {
- RepositoryURL string `json:"repository_url,omitempty"`
- StaticContext string `json:"static_context,omitempty"`
-}
-
-// GetGithubService gets Github service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#get-github-service-settings
-func (s *ServicesService) GetGithubService(pid interface{}, options ...OptionFunc) (*GithubService, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/services/github", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- svc := new(GithubService)
- resp, err := s.client.Do(req, svc)
- if err != nil {
- return nil, resp, err
- }
-
- return svc, resp, err
-}
-
-// SetGithubServiceOptions represents the available SetGithubService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#createedit-github-service
-type SetGithubServiceOptions struct {
- Token *string `url:"token,omitempty" json:"token,omitempty"`
- RepositoryURL *string `url:"repository_url,omitempty" json:"repository_url,omitempty"`
- StaticContext *bool `url:"static_context,omitempty" json:"static_context,omitempty"`
-}
-
-// SetGithubService sets Github service for a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#createedit-github-service
-func (s *ServicesService) SetGithubService(pid interface{}, opt *SetGithubServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/github", pathEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteGithubService deletes Github service for a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-github-service
-func (s *ServicesService) DeleteGithubService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/github", pathEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// SetHipChatServiceOptions represents the available SetHipChatService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-hipchat-service
-type SetHipChatServiceOptions struct {
- Token *string `url:"token,omitempty" json:"token,omitempty" `
- Room *string `url:"room,omitempty" json:"room,omitempty"`
-}
-
-// SetHipChatService sets HipChat service for a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-hipchat-service
-func (s *ServicesService) SetHipChatService(pid interface{}, opt *SetHipChatServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/hipchat", pathEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteHipChatService deletes HipChat service for project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-hipchat-service
-func (s *ServicesService) DeleteHipChatService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/hipchat", pathEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DroneCIService represents Drone CI service settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#drone-ci
-type DroneCIService struct {
- Service
- Properties *DroneCIServiceProperties `json:"properties"`
-}
-
-// DroneCIServiceProperties represents Drone CI specific properties.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#drone-ci
-type DroneCIServiceProperties struct {
- Token string `json:"token"`
- DroneURL string `json:"drone_url"`
- EnableSSLVerification bool `json:"enable_ssl_verification"`
-}
-
-// GetDroneCIService gets Drone CI service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#get-drone-ci-service-settings
-func (s *ServicesService) GetDroneCIService(pid interface{}, options ...OptionFunc) (*DroneCIService, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/services/drone-ci", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- svc := new(DroneCIService)
- resp, err := s.client.Do(req, svc)
- if err != nil {
- return nil, resp, err
- }
-
- return svc, resp, err
-}
-
-// SetDroneCIServiceOptions represents the available SetDroneCIService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#createedit-drone-ci-service
-type SetDroneCIServiceOptions struct {
- Token *string `url:"token" json:"token" `
- DroneURL *string `url:"drone_url" json:"drone_url"`
- EnableSSLVerification *bool `url:"enable_ssl_verification,omitempty" json:"enable_ssl_verification,omitempty"`
-}
-
-// SetDroneCIService sets Drone CI service for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#createedit-drone-ci-service
-func (s *ServicesService) SetDroneCIService(pid interface{}, opt *SetDroneCIServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/drone-ci", pathEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteDroneCIService deletes Drone CI service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-drone-ci-service
-func (s *ServicesService) DeleteDroneCIService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/drone-ci", pathEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// SlackService represents Slack service settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#slack
-type SlackService struct {
- Service
- Properties *SlackServiceProperties `json:"properties"`
-}
-
-// SlackServiceProperties represents Slack specific properties.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#slack
-type SlackServiceProperties struct {
- WebHook string `json:"webhook,omitempty"`
- Username string `json:"username,omitempty"`
- Channel string `json:"channel,omitempty"`
- NotifyOnlyBrokenPipelines BoolValue `json:"notify_only_broken_pipelines,omitempty"`
- NotifyOnlyDefaultBranch BoolValue `json:"notify_only_default_branch,omitempty"`
- ConfidentialIssueChannel string `json:"confidential_issue_channel,omitempty"`
- ConfidentialNoteChannel string `json:"confidential_note_channel,omitempty"`
- DeploymentChannel string `json:"deployment_channel,omitempty"`
- IssueChannel string `json:"issue_channel,omitempty"`
- MergeRequestChannel string `json:"merge_request_channel,omitempty"`
- NoteChannel string `json:"note_channel,omitempty"`
- TagPushChannel string `json:"tag_push_channel,omitempty"`
- PipelineChannel string `json:"pipeline_channel,omitempty"`
- PushChannel string `json:"push_channel,omitempty"`
- WikiPageChannel string `json:"wiki_page_channel,omitempty"`
-}
-
-// GetSlackService gets Slack service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#get-slack-service-settings
-func (s *ServicesService) GetSlackService(pid interface{}, options ...OptionFunc) (*SlackService, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- svc := new(SlackService)
- resp, err := s.client.Do(req, svc)
- if err != nil {
- return nil, resp, err
- }
-
- return svc, resp, err
-}
-
-// SetSlackServiceOptions represents the available SetSlackService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-slack-service
-type SetSlackServiceOptions struct {
- WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"`
- Username *string `url:"username,omitempty" json:"username,omitempty"`
- Channel *string `url:"channel,omitempty" json:"channel,omitempty"`
- NotifyOnlyBrokenPipelines *bool `url:"notify_only_broken_pipelines,omitempty" json:"notify_only_broken_pipelines,omitempty"`
- NotifyOnlyDefaultBranch *bool `url:"notify_only_default_branch,omitempty" json:"notify_only_default_branch,omitempty"`
- ConfidentialIssueChannel *string `url:"confidential_issue_channel,omitempty" json:"confidential_issue_channel,omitempty"`
- ConfidentialIssuesEvents *bool `url:"confidential_issues_events,omitempty" json:"confidential_issues_events,omitempty"`
- // TODO: Currently, GitLab ignores this option (not implemented yet?), so
- // there is no way to set it. Uncomment when this is fixed.
- // See: https://gitlab.com/gitlab-org/gitlab-ce/issues/49730
- //ConfidentialNoteChannel *string `json:"confidential_note_channel,omitempty"`
- ConfidentialNoteEvents *bool `url:"confidential_note_events,omitempty" json:"confidential_note_events,omitempty"`
- DeploymentChannel *string `url:"deployment_channel,omitempty" json:"deployment_channel,omitempty"`
- DeploymentEvents *bool `url:"deployment_events,omitempty" json:"deployment_events,omitempty"`
- IssueChannel *string `url:"issue_channel,omitempty" json:"issue_channel,omitempty"`
- IssuesEvents *bool `url:"issues_events,omitempty" json:"issues_events,omitempty"`
- MergeRequestChannel *string `url:"merge_request_channel,omitempty" json:"merge_request_channel,omitempty"`
- MergeRequestsEvents *bool `url:"merge_requests_events,omitempty" json:"merge_requests_events,omitempty"`
- TagPushChannel *string `url:"tag_push_channel,omitempty" json:"tag_push_channel,omitempty"`
- TagPushEvents *bool `url:"tag_push_events,omitempty" json:"tag_push_events,omitempty"`
- NoteChannel *string `url:"note_channel,omitempty" json:"note_channel,omitempty"`
- NoteEvents *bool `url:"note_events,omitempty" json:"note_events,omitempty"`
- PipelineChannel *string `url:"pipeline_channel,omitempty" json:"pipeline_channel,omitempty"`
- PipelineEvents *bool `url:"pipeline_events,omitempty" json:"pipeline_events,omitempty"`
- PushChannel *string `url:"push_channel,omitempty" json:"push_channel,omitempty"`
- PushEvents *bool `url:"push_events,omitempty" json:"push_events,omitempty"`
- WikiPageChannel *string `url:"wiki_page_channel,omitempty" json:"wiki_page_channel,omitempty"`
- WikiPageEvents *bool `url:"wiki_page_events,omitempty" json:"wiki_page_events,omitempty"`
-}
-
-// SetSlackService sets Slack service for a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-slack-service
-func (s *ServicesService) SetSlackService(pid interface{}, opt *SetSlackServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteSlackService deletes Slack service for project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-slack-service
-func (s *ServicesService) DeleteSlackService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/slack", pathEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// JiraService represents Jira service settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#jira
-type JiraService struct {
- Service
- Properties *JiraServiceProperties `json:"properties"`
-}
-
-// JiraServiceProperties represents Jira specific properties.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#jira
-type JiraServiceProperties struct {
- URL string `json:"url,omitempty"`
- APIURL string `json:"api_url,omitempty"`
- ProjectKey string `json:"project_key,omitempty" `
- Username string `json:"username,omitempty" `
- Password string `json:"password,omitempty" `
- JiraIssueTransitionID string `json:"jira_issue_transition_id,omitempty"`
-}
-
-// UnmarshalJSON decodes the Jira Service Properties.
-//
-// This allows support of JiraIssueTransitionID for both type string (>11.9) and float64 (<11.9)
-func (p *JiraServiceProperties) UnmarshalJSON(b []byte) error {
- type Alias JiraServiceProperties
- raw := struct {
- *Alias
- JiraIssueTransitionID interface{} `json:"jira_issue_transition_id"`
- }{
- Alias: (*Alias)(p),
- }
-
- if err := json.Unmarshal(b, &raw); err != nil {
- return err
- }
-
- switch id := raw.JiraIssueTransitionID.(type) {
- case nil:
- // No action needed.
- case string:
- p.JiraIssueTransitionID = id
- case float64:
- p.JiraIssueTransitionID = strconv.Itoa(int(id))
- default:
- return fmt.Errorf("failed to unmarshal JiraTransitionID of type: %T", id)
- }
-
- return nil
-}
-
-// GetJiraService gets Jira service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#get-jira-service-settings
-func (s *ServicesService) GetJiraService(pid interface{}, options ...OptionFunc) (*JiraService, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/services/jira", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- svc := new(JiraService)
- resp, err := s.client.Do(req, svc)
- if err != nil {
- return nil, resp, err
- }
-
- return svc, resp, err
-}
-
-// SetJiraServiceOptions represents the available SetJiraService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-jira-service
-type SetJiraServiceOptions struct {
- URL *string `url:"url,omitempty" json:"url,omitempty"`
- APIURL *string `url:"api_url,omitempty" json:"api_url,omitempty"`
- ProjectKey *string `url:"project_key,omitempty" json:"project_key,omitempty" `
- Username *string `url:"username,omitempty" json:"username,omitempty" `
- Password *string `url:"password,omitempty" json:"password,omitempty" `
- JiraIssueTransitionID *string `url:"jira_issue_transition_id,omitempty" json:"jira_issue_transition_id,omitempty"`
-}
-
-// SetJiraService sets Jira service for a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#edit-jira-service
-func (s *ServicesService) SetJiraService(pid interface{}, opt *SetJiraServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/jira", pathEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteJiraService deletes Jira service for project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-jira-service
-func (s *ServicesService) DeleteJiraService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/jira", pathEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// JenkinsCIService represents Jenkins CI service settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/services.html#jenkins-ci
-type JenkinsCIService struct {
- Service
- Properties *JenkinsCIServiceProperties `json:"properties"`
-}
-
-// JenkinsCIServiceProperties represents Jenkins CI specific properties.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/services.html#jenkins-ci
-type JenkinsCIServiceProperties struct {
- URL string `json:"jenkins_url,omitempty"`
- ProjectName string `json:"project_name,omitempty"`
- Username string `json:"username,omitempty"`
-}
-
-// GetJenkinsCIService gets Jenkins CI service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/services.html#get-jenkins-ci-service-settings
-func (s *ServicesService) GetJenkinsCIService(pid interface{}, options ...OptionFunc) (*JenkinsCIService, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/services/jenkins", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- svc := new(JenkinsCIService)
- resp, err := s.client.Do(req, svc)
- if err != nil {
- return nil, resp, err
- }
-
- return svc, resp, err
-}
-
-// SetJenkinsCIServiceOptions represents the available SetJenkinsCIService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/services.html#jenkins-ci
-type SetJenkinsCIServiceOptions struct {
- URL *string `url:"jenkins_url,omitempty" json:"jenkins_url,omitempty"`
- ProjectName *string `url:"project_name,omitempty" json:"project_name,omitempty"`
- Username *string `url:"username,omitempty" json:"username,omitempty"`
- Password *string `url:"password,omitempty" json:"password,omitempty"`
-}
-
-// SetJenkinsCIService sets Jenkins service for a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ee/api/services.html#create-edit-jenkins-ci-service
-func (s *ServicesService) SetJenkinsCIService(pid interface{}, opt *SetJenkinsCIServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/jenkins", pathEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteJenkinsCIService deletes Jenkins CI service for project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-jira-service
-func (s *ServicesService) DeleteJenkinsCIService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/jenkins", pathEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// MicrosoftTeamsService represents Microsoft Teams service settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#microsoft-teams
-type MicrosoftTeamsService struct {
- Service
- Properties *MicrosoftTeamsServiceProperties `json:"properties"`
-}
-
-// MicrosoftTeamsServiceProperties represents Microsoft Teams specific properties.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#microsoft-teams
-type MicrosoftTeamsServiceProperties struct {
- WebHook string `json:"webhook"`
-}
-
-// GetMicrosoftTeamsService gets MicrosoftTeams service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#get-microsoft-teams-service-settings
-func (s *ServicesService) GetMicrosoftTeamsService(pid interface{}, options ...OptionFunc) (*MicrosoftTeamsService, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/services/microsoft-teams", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- svc := new(MicrosoftTeamsService)
- resp, err := s.client.Do(req, svc)
- if err != nil {
- return nil, resp, err
- }
-
- return svc, resp, err
-}
-
-// SetMicrosoftTeamsServiceOptions represents the available SetMicrosoftTeamsService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#create-edit-microsoft-teams-service
-type SetMicrosoftTeamsServiceOptions struct {
- WebHook *string `url:"webhook,omitempty" json:"webhook,omitempty"`
-}
-
-// SetMicrosoftTeamsService sets Microsoft Teams service for a project
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#create-edit-microsoft-teams-service
-func (s *ServicesService) SetMicrosoftTeamsService(pid interface{}, opt *SetMicrosoftTeamsServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/microsoft-teams", pathEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
- return s.client.Do(req, nil)
-}
-
-// DeleteMicrosoftTeamsService deletes Microsoft Teams service for project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-microsoft-teams-service
-func (s *ServicesService) DeleteMicrosoftTeamsService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/microsoft-teams", pathEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ExternalWikiService represents External Wiki service settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#external-wiki
-type ExternalWikiService struct {
- Service
- Properties *ExternalWikiServiceProperties `json:"properties"`
-}
-
-// ExternalWikiServiceProperties represents External Wiki specific properties.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#external-wiki
-type ExternalWikiServiceProperties struct {
- ExternalWikiURL string `json:"external_wiki_url"`
-}
-
-// GetExternalWikiService gets External Wiki service settings for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#get-external-wiki-service-settings
-func (s *ServicesService) GetExternalWikiService(pid interface{}, options ...OptionFunc) (*ExternalWikiService, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/services/external-wiki", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- svc := new(ExternalWikiService)
- resp, err := s.client.Do(req, svc)
- if err != nil {
- return nil, resp, err
- }
-
- return svc, resp, err
-}
-
-// SetExternalWikiServiceOptions represents the available SetExternalWikiService()
-// options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#createedit-external-wiki-service
-type SetExternalWikiServiceOptions struct {
- ExternalWikiURL *string `url:"external_wiki_url,omitempty" json:"external_wiki_url,omitempty"`
-}
-
-// SetExternalWikiService sets External Wiki service for a project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#createedit-external-wiki-service
-func (s *ServicesService) SetExternalWikiService(pid interface{}, opt *SetExternalWikiServiceOptions, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/external-wiki", pathEscape(project))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteExternalWikiService deletes External Wiki service for project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/services.html#delete-external-wiki-service
-func (s *ServicesService) DeleteExternalWikiService(pid interface{}, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/services/external-wiki", pathEscape(project))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/settings.go b/vendor/github.com/xanzy/go-gitlab/settings.go
deleted file mode 100644
index c25b28aa..00000000
--- a/vendor/github.com/xanzy/go-gitlab/settings.go
+++ /dev/null
@@ -1,409 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import "time"
-
-// SettingsService handles communication with the application SettingsService
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/settings.html
-type SettingsService struct {
- client *Client
-}
-
-// Settings represents the GitLab application settings.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/settings.html
-type Settings struct {
- ID int `json:"id"`
- CreatedAt *time.Time `json:"created_at"`
- UpdatedAt *time.Time `json:"updated_at"`
- AdminNotificationEmail string `json:"admin_notification_email"`
- AfterSignOutPath string `json:"after_sign_out_path"`
- AfterSignUpText string `json:"after_sign_up_text"`
- AkismetAPIKey string `json:"akismet_api_key"`
- AkismetEnabled bool `json:"akismet_enabled"`
- AllowGroupOwnersToManageLDAP bool `json:"allow_group_owners_to_manage_ldap"`
- AllowLocalRequestsFromHooksAndServices bool `json:"allow_local_requests_from_hooks_and_services"`
- AllowLocalRequestsFromSystemHooks bool `json:"allow_local_requests_from_system_hooks"`
- AllowLocalRequestsFromWebHooksAndServices bool `json:"allow_local_requests_from_web_hooks_and_services"`
- ArchiveBuildsInHumanReadable string `json:"archive_builds_in_human_readable"`
- AssetProxyEnabled bool `json:"asset_proxy_enabled"`
- AssetProxySecretKey string `json:"asset_proxy_secret_key"`
- AssetProxyURL string `json:"asset_proxy_url"`
- AssetProxyWhitelist []string `json:"asset_proxy_whitelist"`
- AuthorizedKeysEnabled bool `json:"authorized_keys_enabled_enabled"`
- AutoDevOpsDomain string `json:"auto_devops_domain"`
- AutoDevOpsEnabled bool `json:"auto_devops_enabled"`
- CheckNamespacePlan bool `json:"check_namespace_plan"`
- CommitEmailHostname string `json:"commit_email_hostname"`
- ContainerRegistryTokenExpireDelay int `json:"container_registry_token_expire_delay"`
- DefaultArtifactsExpireIn string `json:"default_artifacts_expire_in"`
- DefaultBranchProtection int `json:"default_branch_protection"`
- DefaultGroupVisibility *VisibilityValue `json:"default_group_visibility"`
- DefaultProjectCreation int `json:"default_project_creation"`
- DefaultProjectsLimit int `json:"default_projects_limit"`
- DefaultProjectVisibility *VisibilityValue `json:"default_project_visibility"`
- DefaultSnippetVisibility *VisibilityValue `json:"default_snippet_visibility"`
- DiffMaxPatchBytes int `json:"diff_max_patch_bytes"`
- DisabledOauthSignInSources []string `json:"disabled_oauth_sign_in_sources"`
- DNSRebindingProtectionEnabled bool `json:"dns_rebinding_protection_enabled"`
- DomainBlacklist []string `json:"domain_blacklist"`
- DomainBlacklistEnabled bool `json:"domain_blacklist_enabled"`
- DomainWhitelist []string `json:"domain_whitelist"`
- DSAKeyRestriction int `json:"dsa_key_restriction"`
- ECDSAKeyRestriction int `json:"ecdsa_key_restriction"`
- Ed25519KeyRestriction int `json:"ed25519_key_restriction"`
- ElasticsearchAWSAccessKey string `json:"elasticsearch_aws_access_key"`
- ElasticsearchAWS bool `json:"elasticsearch_aws"`
- ElasticsearchAWSRegion string `json:"elasticsearch_aws_region"`
- ElasticsearchAWSSecretAccessKey string `json:"elasticsearch_aws_secret_access_key"`
- ElasticsearchIndexing bool `json:"elasticsearch_indexing"`
- ElasticsearchLimitIndexing bool `json:"elasticsearch_limit_indexing"`
- ElasticsearchNamespaceIDs []int `json:"elasticsearch_namespace_ids"`
- ElasticsearchProjectIDs []int `json:"elasticsearch_project_ids"`
- ElasticsearchSearch bool `json:"elasticsearch_search"`
- ElasticsearchURL []string `json:"elasticsearch_url"`
- EmailAdditionalText string `json:"email_additional_text"`
- EmailAuthorInBody bool `json:"email_author_in_body"`
- EnabledGitAccessProtocol string `json:"enabled_git_access_protocol"`
- EnforceTerms bool `json:"enforce_terms"`
- ExternalAuthClientCert string `json:"external_auth_client_cert"`
- ExternalAuthClientKeyPass string `json:"external_auth_client_key_pass"`
- ExternalAuthClientKey string `json:"external_auth_client_key"`
- ExternalAuthorizationServiceDefaultLabel string `json:"external_authorization_service_default_label"`
- ExternalAuthorizationServiceEnabled bool `json:"external_authorization_service_enabled"`
- ExternalAuthorizationServiceTimeout float64 `json:"external_authorization_service_timeout"`
- ExternalAuthorizationServiceURL string `json:"external_authorization_service_url"`
- FileTemplateProjectID int `json:"file_template_project_id"`
- FirstDayOfWeek int `json:"first_day_of_week"`
- GeoNodeAllowedIPs string `json:"geo_node_allowed_ips"`
- GeoStatusTimeout int `json:"geo_status_timeout"`
- GitalyTimeoutDefault int `json:"gitaly_timeout_default"`
- GitalyTimeoutFast int `json:"gitaly_timeout_fast"`
- GitalyTimeoutMedium int `json:"gitaly_timeout_medium"`
- GrafanaEnabled bool `json:"grafana_enabled"`
- GrafanaURL string `json:"grafana_url"`
- GravatarEnabled bool `json:"gravatar_enabled"`
- HashedStorageEnabled bool `json:"hashed_storage_enabled"`
- HelpPageHideCommercialContent bool `json:"help_page_hide_commercial_content"`
- HelpPageSupportURL string `json:"help_page_support_url"`
- HelpPageText string `json:"help_page_text"`
- HelpText string `json:"help_text"`
- HideThirdPartyOffers bool `json:"hide_third_party_offers"`
- HomePageURL string `json:"home_page_url"`
- HousekeepingBitmapsEnabled bool `json:"housekeeping_bitmaps_enabled"`
- HousekeepingEnabled bool `json:"housekeeping_enabled"`
- HousekeepingFullRepackPeriod int `json:"housekeeping_full_repack_period"`
- HousekeepingGcPeriod int `json:"housekeeping_gc_period"`
- HousekeepingIncrementalRepackPeriod int `json:"housekeeping_incremental_repack_period"`
- HTMLEmailsEnabled bool `json:"html_emails_enabled"`
- ImportSources []string `json:"import_sources"`
- InstanceStatisticsVisibilityPrivate bool `json:"instance_statistics_visibility_private"`
- LocalMarkdownVersion int `json:"local_markdown_version"`
- MaxArtifactsSize int `json:"max_artifacts_size"`
- MaxAttachmentSize int `json:"max_attachment_size"`
- MaxPagesSize int `json:"max_pages_size"`
- MetricsEnabled bool `json:"metrics_enabled"`
- MetricsHost string `json:"metrics_host"`
- MetricsMethodCallThreshold int `json:"metrics_method_call_threshold"`
- MetricsPacketSize int `json:"metrics_packet_size"`
- MetricsPoolSize int `json:"metrics_pool_size"`
- MetricsPort int `json:"metrics_port"`
- MetricsSampleInterval int `json:"metrics_sample_interval"`
- MetricsTimeout int `json:"metrics_timeout"`
- MirrorAvailable bool `json:"mirror_available"`
- MirrorCapacityThreshold int `json:"mirror_capacity_threshold"`
- MirrorMaxCapacity int `json:"mirror_max_capacity"`
- MirrorMaxDelay int `json:"mirror_max_delay"`
- OutboundLocalRequestsWhitelist []string `json:"outbound_local_requests_whitelist"`
- PagesDomainVerificationEnabled bool `json:"pages_domain_verification_enabled"`
- PasswordAuthenticationEnabledForGit bool `json:"password_authentication_enabled_for_git"`
- PasswordAuthenticationEnabledForWeb bool `json:"password_authentication_enabled_for_web"`
- PerformanceBarAllowedGroupID string `json:"performance_bar_allowed_group_id"`
- PerformanceBarAllowedGroupPath string `json:"performance_bar_allowed_group_path"`
- PerformanceBarEnabled bool `json:"performance_bar_enabled"`
- PlantumlEnabled bool `json:"plantuml_enabled"`
- PlantumlURL string `json:"plantuml_url"`
- PollingIntervalMultiplier float64 `json:"polling_interval_multiplier,string"`
- ProjectExportEnabled bool `json:"project_export_enabled"`
- PrometheusMetricsEnabled bool `json:"prometheus_metrics_enabled"`
- ProtectedCIVariables bool `json:"protected_ci_variables"`
- PseudonymizerEnabled bool `json:"psedonymizer_enabled"`
- PushEventHooksLimit int `json:"push_event_hooks_limit"`
- PushEventActivitiesLimit int `json:"push_event_activities_limit"`
- RecaptchaEnabled bool `json:"recaptcha_enabled"`
- RecaptchaPrivateKey string `json:"recaptcha_private_key"`
- RecaptchaSiteKey string `json:"recaptcha_site_key"`
- ReceiveMaxInputSize int `json:"receive_max_input_size"`
- RepositoryChecksEnabled bool `json:"repository_checks_enabled"`
- RepositorySizeLimit int `json:"repository_size_limit"`
- RepositoryStorages []string `json:"repository_storages"`
- RequireTwoFactorAuthentication bool `json:"require_two_factor_authentication"`
- RestrictedVisibilityLevels []VisibilityValue `json:"restricted_visibility_levels"`
- RsaKeyRestriction int `json:"rsa_key_restriction"`
- SendUserConfirmationEmail bool `json:"send_user_confirmation_email"`
- SessionExpireDelay int `json:"session_expire_delay"`
- SharedRunnersEnabled bool `json:"shared_runners_enabled"`
- SharedRunnersMinutes int `json:"shared_runners_minutes"`
- SharedRunnersText string `json:"shared_runners_text"`
- SignInText string `json:"sign_in_text"`
- SignupEnabled bool `json:"signup_enabled"`
- SlackAppEnabled bool `json:"slack_app_enabled"`
- SlackAppID string `json:"slack_app_id"`
- SlackAppSecret string `json:"slack_app_secret"`
- SlackAppVerificationToken string `json:"slack_app_verification_token"`
- SnowplowCollectorHostname string `json:"snowplow_collector_hostname"`
- SnowplowCookieDomain string `json:"snowplow_cookie_domain"`
- SnowplowEnabled bool `json:"snowplow_enabled"`
- SnowplowSiteID string `json:"snowplow_site_id"`
- TerminalMaxSessionTime int `json:"terminal_max_session_time"`
- Terms string `json:"terms"`
- ThrottleAuthenticatedAPIEnabled bool `json:"throttle_authenticated_api_enabled"`
- ThrottleAuthenticatedAPIPeriodInSeconds int `json:"throttle_authenticated_api_period_in_seconds"`
- ThrottleAuthenticatedAPIRequestsPerPeriod int `json:"throttle_authenticated_api_requests_per_period"`
- ThrottleAuthenticatedWebEnabled bool `json:"throttle_authenticated_web_enabled"`
- ThrottleAuthenticatedWebPeriodInSeconds int `json:"throttle_authenticated_web_period_in_seconds"`
- ThrottleAuthenticatedWebRequestsPerPeriod int `json:"throttle_authenticated_web_requests_per_period"`
- ThrottleUnauthenticatedEnabled bool `json:"throttle_unauthenticated_enabled"`
- ThrottleUnauthenticatedPeriodInSeconds int `json:"throttle_unauthenticated_period_in_seconds"`
- ThrottleUnauthenticatedRequestsPerPeriod int `json:"throttle_unauthenticated_requests_per_period"`
- TimeTrackingLimitToHours bool `json:"time_tracking_limit_to_hours"`
- TwoFactorGracePeriod int `json:"two_factor_grace_period"`
- UniqueIPsLimitEnabled bool `json:"unique_ips_limit_enabled"`
- UniqueIPsLimitPerUser int `json:"unique_ips_limit_per_user"`
- UniqueIPsLimitTimeWindow int `json:"unique_ips_limit_time_window"`
- UsagePingEnabled bool `json:"usage_ping_enabled"`
- UserDefaultExternal bool `json:"user_default_external"`
- UserDefaultInternalRegex string `json:"user_default_internal_regex"`
- UserOauthApplications bool `json:"user_oauth_applications"`
- UserShowAddSSHKeyMessage bool `json:"user_show_add_ssh_key_message"`
- VersionCheckEnabled bool `json:"version_check_enabled"`
- WebIDEClientsidePreviewEnabled bool `json:"web_ide_clientside_preview_enabled"`
-}
-
-func (s Settings) String() string {
- return Stringify(s)
-}
-
-// GetSettings gets the current application settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/settings.html#get-current-application.settings
-func (s *SettingsService) GetSettings(options ...OptionFunc) (*Settings, *Response, error) {
- req, err := s.client.NewRequest("GET", "application/settings", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- as := new(Settings)
- resp, err := s.client.Do(req, as)
- if err != nil {
- return nil, resp, err
- }
-
- return as, resp, err
-}
-
-// UpdateSettingsOptions represents the available UpdateSettings() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/settings.html#change-application.settings
-type UpdateSettingsOptions struct {
- AdminNotificationEmail *string `url:"admin_notification_email,omitempty" json:"admin_notification_email,omitempty"`
- AfterSignOutPath *string `url:"after_sign_out_path,omitempty" json:"after_sign_out_path,omitempty"`
- AfterSignUpText *string `url:"after_sign_up_text,omitempty" json:"after_sign_up_text,omitempty"`
- AkismetAPIKey *string `url:"akismet_api_key,omitempty" json:"akismet_api_key,omitempty"`
- AkismetEnabled *bool `url:"akismet_enabled,omitempty" json:"akismet_enabled,omitempty"`
- AllowGroupOwnersToManageLDAP *bool `url:"allow_group_owners_to_manage_ldap,omitempty" json:"allow_group_owners_to_manage_ldap,omitempty"`
- AllowLocalRequestsFromHooksAndServices *bool `url:"allow_local_requests_from_hooks_and_services,omitempty" json:"allow_local_requests_from_hooks_and_services,omitempty"`
- AllowLocalRequestsFromSystemHooks *bool `url:"allow_local_requests_from_system_hooks,omitempty" json:"allow_local_requests_from_system_hooks,omitempty"`
- AllowLocalRequestsFromWebHooksAndServices *bool `url:"allow_local_requests_from_web_hooks_and_services,omitempty" json:"allow_local_requests_from_web_hooks_and_services,omitempty"`
- ArchiveBuildsInHumanReadable *string `url:"archive_builds_in_human_readable,omitempty" json:"archive_builds_in_human_readable,omitempty"`
- AssetProxyEnabled *bool `url:"asset_proxy_enabled,omitempty" json:"asset_proxy_enabled,omitempty"`
- AssetProxySecretKey *string `url:"asset_proxy_secret_key,omitempty" json:"asset_proxy_secret_key,omitempty"`
- AssetProxyURL *string `url:"asset_proxy_url,omitempty" json:"asset_proxy_url,omitempty"`
- AssetProxyWhitelist []string `url:"asset_proxy_whitelist,omitempty" json:"asset_proxy_whitelist,omitempty"`
- AuthorizedKeysEnabled *bool `url:"authorized_keys_enabled,omitempty" json:"authorized_keys_enabled,omitempty"`
- AutoDevOpsDomain *string `url:"auto_devops_domain,omitempty" json:"auto_devops_domain,omitempty"`
- AutoDevOpsEnabled *bool `url:"auto_devops_enabled,omitempty" json:"auto_devops_enabled,omitempty"`
- CheckNamespacePlan *bool `url:"check_namespace_plan,omitempty" json:"check_namespace_plan,omitempty"`
- CommitEmailHostname *string `url:"commit_email_hostname,omitempty" json:"commit_email_hostname,omitempty"`
- ContainerRegistryTokenExpireDelay *int `url:"container_registry_token_expire_delay,omitempty" json:"container_registry_token_expire_delay,omitempty"`
- DefaultArtifactsExpireIn *string `url:"default_artifacts_expire_in,omitempty" json:"default_artifacts_expire_in,omitempty"`
- DefaultBranchProtection *int `url:"default_branch_protection,omitempty" json:"default_branch_protection,omitempty"`
- DefaultGroupVisibility *VisibilityValue `url:"default_group_visibility,omitempty" json:"default_group_visibility,omitempty"`
- DefaultProjectCreation *int `url:"default_project_creation,omitempty" json:"default_project_creation,omitempty"`
- DefaultProjectsLimit *int `url:"default_projects_limit,omitempty" json:"default_projects_limit,omitempty"`
- DefaultProjectVisibility *VisibilityValue `url:"default_project_visibility,omitempty" json:"default_project_visibility,omitempty"`
- DefaultSnippetVisibility *VisibilityValue `url:"default_snippet_visibility,omitempty" json:"default_snippet_visibility,omitempty"`
- DiffMaxPatchBytes *int `url:"diff_max_patch_bytes,omitempty" json:"diff_max_patch_bytes,omitempty"`
- DisabledOauthSignInSources []string `url:"disabled_oauth_sign_in_sources,omitempty" json:"disabled_oauth_sign_in_sources,omitempty"`
- DNSRebindingProtectionEnabled *bool `url:"dns_rebinding_protection_enabled,omitempty" json:"dns_rebinding_protection_enabled,omitempty"`
- DomainBlacklist []string `url:"domain_blacklist,omitempty" json:"domain_blacklist,omitempty"`
- DomainBlacklistEnabled *bool `url:"domain_blacklist_enabled,omitempty" json:"domain_blacklist_enabled,omitempty"`
- DomainWhitelist []string `url:"domain_whitelist,omitempty" json:"domain_whitelist,omitempty"`
- DSAKeyRestriction *int `url:"dsa_key_restriction,omitempty" json:"dsa_key_restriction,omitempty"`
- ECDSAKeyRestriction *int `url:"ecdsa_key_restriction,omitempty" json:"ecdsa_key_restriction,omitempty"`
- Ed25519KeyRestriction *int `url:"ed25519_key_restriction,omitempty" json:"ed25519_key_restriction,omitempty"`
- ElasticsearchAWSAccessKey *string `url:"elasticsearch_aws_access_key,omitempty" json:"elasticsearch_aws_access_key,omitempty"`
- ElasticsearchAWS *bool `url:"elasticsearch_aws,omitempty" json:"elasticsearch_aws,omitempty"`
- ElasticsearchAWSRegion *string `url:"elasticsearch_aws_region,omitempty" json:"elasticsearch_aws_region,omitempty"`
- ElasticsearchAWSSecretAccessKey *string `url:"elasticsearch_aws_secret_access_key,omitempty" json:"elasticsearch_aws_secret_access_key,omitempty"`
- ElasticsearchIndexing *bool `url:"elasticsearch_indexing,omitempty" json:"elasticsearch_indexing,omitempty"`
- ElasticsearchLimitIndexing *bool `url:"elasticsearch_limit_indexing,omitempty" json:"elasticsearch_limit_indexing,omitempty"`
- ElasticsearchNamespaceIDs []int `url:"elasticsearch_namespace_ids,omitempty" json:"elasticsearch_namespace_ids,omitempty"`
- ElasticsearchProjectIDs []int `url:"elasticsearch_project_ids,omitempty" json:"elasticsearch_project_ids,omitempty"`
- ElasticsearchSearch *bool `url:"elasticsearch_search,omitempty" json:"elasticsearch_search,omitempty"`
- ElasticsearchURL *string `url:"elasticsearch_url,omitempty" json:"elasticsearch_url,omitempty"`
- EmailAdditionalText *string `url:"email_additional_text,omitempty" json:"email_additional_text,omitempty"`
- EmailAuthorInBody *bool `url:"email_author_in_body,omitempty" json:"email_author_in_body,omitempty"`
- EnabledGitAccessProtocol *string `url:"enabled_git_access_protocol,omitempty" json:"enabled_git_access_protocol,omitempty"`
- EnforceTerms *bool `url:"enforce_terms,omitempty" json:"enforce_terms,omitempty"`
- ExternalAuthClientCert *string `url:"external_auth_client_cert,omitempty" json:"external_auth_client_cert,omitempty"`
- ExternalAuthClientKeyPass *string `url:"external_auth_client_key_pass,omitempty" json:"external_auth_client_key_pass,omitempty"`
- ExternalAuthClientKey *string `url:"external_auth_client_key,omitempty" json:"external_auth_client_key,omitempty"`
- ExternalAuthorizationServiceDefaultLabel *string `url:"external_authorization_service_default_label,omitempty" json:"external_authorization_service_default_label,omitempty"`
- ExternalAuthorizationServiceEnabled *bool `url:"external_authorization_service_enabled,omitempty" json:"external_authorization_service_enabled,omitempty"`
- ExternalAuthorizationServiceTimeout *float64 `url:"external_authorization_service_timeout,omitempty" json:"external_authorization_service_timeout,omitempty"`
- ExternalAuthorizationServiceURL *string `url:"external_authorization_service_url,omitempty" json:"external_authorization_service_url,omitempty"`
- FileTemplateProjectID *int `url:"file_template_project_id,omitempty" json:"file_template_project_id,omitempty"`
- FirstDayOfWeek *int `url:"first_day_of_week,omitempty" json:"first_day_of_week,omitempty"`
- GeoNodeAllowedIPs *string `url:"geo_node_allowed_ips,omitempty" json:"geo_node_allowed_ips,omitempty"`
- GeoStatusTimeout *int `url:"geo_status_timeout,omitempty" json:"geo_status_timeout,omitempty"`
- GitalyTimeoutDefault *int `url:"gitaly_timeout_default,omitempty" json:"gitaly_timeout_default,omitempty"`
- GitalyTimeoutFast *int `url:"gitaly_timeout_fast,omitempty" json:"gitaly_timeout_fast,omitempty"`
- GitalyTimeoutMedium *int `url:"gitaly_timeout_medium,omitempty" json:"gitaly_timeout_medium,omitempty"`
- GrafanaEnabled *bool `url:"grafana_enabled,omitempty" json:"grafana_enabled,omitempty"`
- GrafanaURL *string `url:"grafana_url,omitempty" json:"grafana_url,omitempty"`
- GravatarEnabled *bool `url:"gravatar_enabled,omitempty" json:"gravatar_enabled,omitempty"`
- HashedStorageEnabled *bool `url:"hashed_storage_enabled,omitempty" json:"hashed_storage_enabled,omitempty"`
- HelpPageHideCommercialContent *bool `url:"help_page_hide_commercial_content,omitempty" json:"help_page_hide_commercial_content,omitempty"`
- HelpPageSupportURL *string `url:"help_page_support_url,omitempty" json:"help_page_support_url,omitempty"`
- HelpPageText *string `url:"help_page_text,omitempty" json:"help_page_text,omitempty"`
- HelpText *string `url:"help_text,omitempty" json:"help_text,omitempty"`
- HideThirdPartyOffers *bool `url:"hide_third_party_offers,omitempty" json:"hide_third_party_offers,omitempty"`
- HomePageURL *string `url:"home_page_url,omitempty" json:"home_page_url,omitempty"`
- HousekeepingBitmapsEnabled *bool `url:"housekeeping_bitmaps_enabled,omitempty" json:"housekeeping_bitmaps_enabled,omitempty"`
- HousekeepingEnabled *bool `url:"housekeeping_enabled,omitempty" json:"housekeeping_enabled,omitempty"`
- HousekeepingFullRepackPeriod *int `url:"housekeeping_full_repack_period,omitempty" json:"housekeeping_full_repack_period,omitempty"`
- HousekeepingGcPeriod *int `url:"housekeeping_gc_period,omitempty" json:"housekeeping_gc_period,omitempty"`
- HousekeepingIncrementalRepackPeriod *int `url:"housekeeping_incremental_repack_period,omitempty" json:"housekeeping_incremental_repack_period,omitempty"`
- HTMLEmailsEnabled *bool `url:"html_emails_enabled,omitempty" json:"html_emails_enabled,omitempty"`
- ImportSources []string `url:"import_sources,omitempty" json:"import_sources,omitempty"`
- InstanceStatisticsVisibilityPrivate *bool `url:"instance_statistics_visibility_private,omitempty" json:"instance_statistics_visibility_private,omitempty"`
- LocalMarkdownVersion *int `url:"local_markdown_version,omitempty" json:"local_markdown_version,omitempty"`
- MaxArtifactsSize *int `url:"max_artifacts_size,omitempty" json:"max_artifacts_size,omitempty"`
- MaxAttachmentSize *int `url:"max_attachment_size,omitempty" json:"max_attachment_size,omitempty"`
- MaxPagesSize *int `url:"max_pages_size,omitempty" json:"max_pages_size,omitempty"`
- MetricsEnabled *bool `url:"metrics_enabled,omitempty" json:"metrics_enabled,omitempty"`
- MetricsHost *string `url:"metrics_host,omitempty" json:"metrics_host,omitempty"`
- MetricsMethodCallThreshold *int `url:"metrics_method_call_threshold,omitempty" json:"metrics_method_call_threshold,omitempty"`
- MetricsPacketSize *int `url:"metrics_packet_size,omitempty" json:"metrics_packet_size,omitempty"`
- MetricsPoolSize *int `url:"metrics_pool_size,omitempty" json:"metrics_pool_size,omitempty"`
- MetricsPort *int `url:"metrics_port,omitempty" json:"metrics_port,omitempty"`
- MetricsSampleInterval *int `url:"metrics_sample_interval,omitempty" json:"metrics_sample_interval,omitempty"`
- MetricsTimeout *int `url:"metrics_timeout,omitempty" json:"metrics_timeout,omitempty"`
- MirrorAvailable *bool `url:"mirror_available,omitempty" json:"mirror_available,omitempty"`
- MirrorCapacityThreshold *int `url:"mirror_capacity_threshold,omitempty" json:"mirror_capacity_threshold,omitempty"`
- MirrorMaxCapacity *int `url:"mirror_max_capacity,omitempty" json:"mirror_max_capacity,omitempty"`
- MirrorMaxDelay *int `url:"mirror_max_delay,omitempty" json:"mirror_max_delay,omitempty"`
- OutboundLocalRequestsWhitelist []string `url:"outbound_local_requests_whitelist,omitempty" json:"outbound_local_requests_whitelist,omitempty"`
- PagesDomainVerificationEnabled *bool `url:"pages_domain_verification_enabled,omitempty" json:"pages_domain_verification_enabled,omitempty"`
- PasswordAuthenticationEnabledForGit *bool `url:"password_authentication_enabled_for_git,omitempty" json:"password_authentication_enabled_for_git,omitempty"`
- PasswordAuthenticationEnabledForWeb *bool `url:"password_authentication_enabled_for_web,omitempty" json:"password_authentication_enabled_for_web,omitempty"`
- PerformanceBarAllowedGroupID *string `url:"performance_bar_allowed_group_id,omitempty" json:"performance_bar_allowed_group_id,omitempty"`
- PerformanceBarAllowedGroupPath *string `url:"performance_bar_allowed_group_path,omitempty" json:"performance_bar_allowed_group_path,omitempty"`
- PerformanceBarEnabled *bool `url:"performance_bar_enabled,omitempty" json:"performance_bar_enabled,omitempty"`
- PlantumlEnabled *bool `url:"plantuml_enabled,omitempty" json:"plantuml_enabled,omitempty"`
- PlantumlURL *string `url:"plantuml_url,omitempty" json:"plantuml_url,omitempty"`
- PollingIntervalMultiplier *float64 `url:"polling_interval_multiplier,omitempty" json:"polling_interval_multiplier,omitempty"`
- ProjectExportEnabled *bool `url:"project_export_enabled,omitempty" json:"project_export_enabled,omitempty"`
- PrometheusMetricsEnabled *bool `url:"prometheus_metrics_enabled,omitempty" json:"prometheus_metrics_enabled,omitempty"`
- ProtectedCIVariables *bool `url:"protected_ci_variables,omitempty" json:"protected_ci_variables,omitempty"`
- PseudonymizerEnabled *bool `url:"psedonymizer_enabled,omitempty" json:"psedonymizer_enabled,omitempty"`
- PushEventHooksLimit *int `url:"push_event_hooks_limit,omitempty" json:"push_event_hooks_limit,omitempty"`
- PushEventActivitiesLimit *int `url:"push_event_activities_limit,omitempty" json:"push_event_activities_limit,omitempty"`
- RecaptchaEnabled *bool `url:"recaptcha_enabled,omitempty" json:"recaptcha_enabled,omitempty"`
- RecaptchaPrivateKey *string `url:"recaptcha_private_key,omitempty" json:"recaptcha_private_key,omitempty"`
- RecaptchaSiteKey *string `url:"recaptcha_site_key,omitempty" json:"recaptcha_site_key,omitempty"`
- ReceiveMaxInputSize *int `url:"receive_max_input_size,omitempty" json:"receive_max_input_size,omitempty"`
- RepositoryChecksEnabled *bool `url:"repository_checks_enabled,omitempty" json:"repository_checks_enabled,omitempty"`
- RepositorySizeLimit *int `url:"repository_size_limit,omitempty" json:"repository_size_limit,omitempty"`
- RepositoryStorages []string `url:"repository_storages,omitempty" json:"repository_storages,omitempty"`
- RequireTwoFactorAuthentication *bool `url:"require_two_factor_authentication,omitempty" json:"require_two_factor_authentication,omitempty"`
- RestrictedVisibilityLevels []VisibilityValue `url:"restricted_visibility_levels,omitempty" json:"restricted_visibility_levels,omitempty"`
- RsaKeyRestriction *int `url:"rsa_key_restriction,omitempty" json:"rsa_key_restriction,omitempty"`
- SendUserConfirmationEmail *bool `url:"send_user_confirmation_email,omitempty" json:"send_user_confirmation_email,omitempty"`
- SessionExpireDelay *int `url:"session_expire_delay,omitempty" json:"session_expire_delay,omitempty"`
- SharedRunnersEnabled *bool `url:"shared_runners_enabled,omitempty" json:"shared_runners_enabled,omitempty"`
- SharedRunnersMinutes *int `url:"shared_runners_minutes,omitempty" json:"shared_runners_minutes,omitempty"`
- SharedRunnersText *string `url:"shared_runners_text,omitempty" json:"shared_runners_text,omitempty"`
- SignInText *string `url:"sign_in_text,omitempty" json:"sign_in_text,omitempty"`
- SignupEnabled *bool `url:"signup_enabled,omitempty" json:"signup_enabled,omitempty"`
- SlackAppEnabled *bool `url:"slack_app_enabled,omitempty" json:"slack_app_enabled,omitempty"`
- SlackAppID *string `url:"slack_app_id,omitempty" json:"slack_app_id,omitempty"`
- SlackAppSecret *string `url:"slack_app_secret,omitempty" json:"slack_app_secret,omitempty"`
- SlackAppVerificationToken *string `url:"slack_app_verification_token,omitempty" json:"slack_app_verification_token,omitempty"`
- SnowplowCollectorHostname *string `url:"snowplow_collector_hostname,omitempty" json:"snowplow_collector_hostname,omitempty"`
- SnowplowCookieDomain *string `url:"snowplow_cookie_domain,omitempty" json:"snowplow_cookie_domain,omitempty"`
- SnowplowEnabled *bool `url:"snowplow_enabled,omitempty" json:"snowplow_enabled,omitempty"`
- SnowplowSiteID *string `url:"snowplow_site_id,omitempty" json:"snowplow_site_id,omitempty"`
- TerminalMaxSessionTime *int `url:"terminal_max_session_time,omitempty" json:"terminal_max_session_time,omitempty"`
- Terms *string `url:"terms,omitempty" json:"terms,omitempty"`
- ThrottleAuthenticatedAPIEnabled *bool `url:"throttle_authenticated_api_enabled,omitempty" json:"throttle_authenticated_api_enabled,omitempty"`
- ThrottleAuthenticatedAPIPeriodInSeconds *int `url:"throttle_authenticated_api_period_in_seconds,omitempty" json:"throttle_authenticated_api_period_in_seconds,omitempty"`
- ThrottleAuthenticatedAPIRequestsPerPeriod *int `url:"throttle_authenticated_api_requests_per_period,omitempty" json:"throttle_authenticated_api_requests_per_period,omitempty"`
- ThrottleAuthenticatedWebEnabled *bool `url:"throttle_authenticated_web_enabled,omitempty" json:"throttle_authenticated_web_enabled,omitempty"`
- ThrottleAuthenticatedWebPeriodInSeconds *int `url:"throttle_authenticated_web_period_in_seconds,omitempty" json:"throttle_authenticated_web_period_in_seconds,omitempty"`
- ThrottleAuthenticatedWebRequestsPerPeriod *int `url:"throttle_authenticated_web_requests_per_period,omitempty" json:"throttle_authenticated_web_requests_per_period,omitempty"`
- ThrottleUnauthenticatedEnabled *bool `url:"throttle_unauthenticated_enabled,omitempty" json:"throttle_unauthenticated_enabled,omitempty"`
- ThrottleUnauthenticatedPeriodInSeconds *int `url:"throttle_unauthenticated_period_in_seconds,omitempty" json:"throttle_unauthenticated_period_in_seconds,omitempty"`
- ThrottleUnauthenticatedRequestsPerPeriod *int `url:"throttle_unauthenticated_requests_per_period,omitempty" json:"throttle_unauthenticated_requests_per_period,omitempty"`
- TimeTrackingLimitToHours *bool `url:"time_tracking_limit_to_hours,omitempty" json:"time_tracking_limit_to_hours,omitempty"`
- TwoFactorGracePeriod *int `url:"two_factor_grace_period,omitempty" json:"two_factor_grace_period,omitempty"`
- UniqueIPsLimitEnabled *bool `url:"unique_ips_limit_enabled,omitempty" json:"unique_ips_limit_enabled,omitempty"`
- UniqueIPsLimitPerUser *int `url:"unique_ips_limit_per_user,omitempty" json:"unique_ips_limit_per_user,omitempty"`
- UniqueIPsLimitTimeWindow *int `url:"unique_ips_limit_time_window,omitempty" json:"unique_ips_limit_time_window,omitempty"`
- UsagePingEnabled *bool `url:"usage_ping_enabled,omitempty" json:"usage_ping_enabled,omitempty"`
- UserDefaultExternal *bool `url:"user_default_external,omitempty" json:"user_default_external,omitempty"`
- UserDefaultInternalRegex *string `url:"user_default_internal_regex,omitempty" json:"user_default_internal_regex,omitempty"`
- UserOauthApplications *bool `url:"user_oauth_applications,omitempty" json:"user_oauth_applications,omitempty"`
- UserShowAddSSHKeyMessage *bool `url:"user_show_add_ssh_key_message,omitempty" json:"user_show_add_ssh_key_message,omitempty"`
- VersionCheckEnabled *bool `url:"version_check_enabled,omitempty" json:"version_check_enabled,omitempty"`
- WebIDEClientsidePreviewEnabled *bool `url:"web_ide_clientside_preview_enabled,omitempty" json:"web_ide_clientside_preview_enabled,omitempty"`
-}
-
-// UpdateSettings updates the application settings.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/settings.html#change-application.settings
-func (s *SettingsService) UpdateSettings(opt *UpdateSettingsOptions, options ...OptionFunc) (*Settings, *Response, error) {
- req, err := s.client.NewRequest("PUT", "application/settings", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- as := new(Settings)
- resp, err := s.client.Do(req, as)
- if err != nil {
- return nil, resp, err
- }
-
- return as, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/sidekiq_metrics.go b/vendor/github.com/xanzy/go-gitlab/sidekiq_metrics.go
deleted file mode 100644
index 83e77024..00000000
--- a/vendor/github.com/xanzy/go-gitlab/sidekiq_metrics.go
+++ /dev/null
@@ -1,154 +0,0 @@
-//
-// Copyright 2018, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import "time"
-
-// SidekiqService handles communication with the sidekiq service
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/sidekiq_metrics.html
-type SidekiqService struct {
- client *Client
-}
-
-// QueueMetrics represents the GitLab sidekiq queue metrics.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-queue-metrics
-type QueueMetrics struct {
- Queues map[string]struct {
- Backlog int `json:"backlog"`
- Latency int `json:"latency"`
- } `json:"queues"`
-}
-
-// GetQueueMetrics lists information about all the registered queues,
-// their backlog and their latency.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-queue-metrics
-func (s *SidekiqService) GetQueueMetrics(options ...OptionFunc) (*QueueMetrics, *Response, error) {
- req, err := s.client.NewRequest("GET", "/sidekiq/queue_metrics", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- q := new(QueueMetrics)
- resp, err := s.client.Do(req, q)
- if err != nil {
- return nil, resp, err
- }
-
- return q, resp, err
-}
-
-// ProcessMetrics represents the GitLab sidekiq process metrics.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-process-metrics
-type ProcessMetrics struct {
- Processes []struct {
- Hostname string `json:"hostname"`
- Pid int `json:"pid"`
- Tag string `json:"tag"`
- StartedAt *time.Time `json:"started_at"`
- Queues []string `json:"queues"`
- Labels []string `json:"labels"`
- Concurrency int `json:"concurrency"`
- Busy int `json:"busy"`
- } `json:"processes"`
-}
-
-// GetProcessMetrics lists information about all the Sidekiq workers registered
-// to process your queues.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-process-metrics
-func (s *SidekiqService) GetProcessMetrics(options ...OptionFunc) (*ProcessMetrics, *Response, error) {
- req, err := s.client.NewRequest("GET", "/sidekiq/process_metrics", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- p := new(ProcessMetrics)
- resp, err := s.client.Do(req, p)
- if err != nil {
- return nil, resp, err
- }
-
- return p, resp, err
-}
-
-// JobStats represents the GitLab sidekiq job stats.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-job-statistics
-type JobStats struct {
- Jobs struct {
- Processed int `json:"processed"`
- Failed int `json:"failed"`
- Enqueued int `json:"enqueued"`
- } `json:"jobs"`
-}
-
-// GetJobStats list information about the jobs that Sidekiq has performed.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-job-statistics
-func (s *SidekiqService) GetJobStats(options ...OptionFunc) (*JobStats, *Response, error) {
- req, err := s.client.NewRequest("GET", "/sidekiq/job_stats", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- j := new(JobStats)
- resp, err := s.client.Do(req, j)
- if err != nil {
- return nil, resp, err
- }
-
- return j, resp, err
-}
-
-// CompoundMetrics represents the GitLab sidekiq compounded stats.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-a-compound-response-of-all-the-previously-mentioned-metrics
-type CompoundMetrics struct {
- QueueMetrics
- ProcessMetrics
- JobStats
-}
-
-// GetCompoundMetrics lists all the currently available information about Sidekiq.
-// Get a compound response of all the previously mentioned metrics
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/sidekiq_metrics.html#get-the-current-job-statistics
-func (s *SidekiqService) GetCompoundMetrics(options ...OptionFunc) (*CompoundMetrics, *Response, error) {
- req, err := s.client.NewRequest("GET", "/sidekiq/compound_metrics", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- c := new(CompoundMetrics)
- resp, err := s.client.Do(req, c)
- if err != nil {
- return nil, resp, err
- }
-
- return c, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/snippets.go b/vendor/github.com/xanzy/go-gitlab/snippets.go
deleted file mode 100644
index be232c8c..00000000
--- a/vendor/github.com/xanzy/go-gitlab/snippets.go
+++ /dev/null
@@ -1,230 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "bytes"
- "fmt"
- "time"
-)
-
-// SnippetsService handles communication with the snippets
-// related methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/snippets.html
-type SnippetsService struct {
- client *Client
-}
-
-// Snippet represents a GitLab snippet.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/snippets.html
-type Snippet struct {
- ID int `json:"id"`
- Title string `json:"title"`
- FileName string `json:"file_name"`
- Description string `json:"description"`
- Author struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- } `json:"author"`
- UpdatedAt *time.Time `json:"updated_at"`
- CreatedAt *time.Time `json:"created_at"`
- WebURL string `json:"web_url"`
- RawURL string `json:"raw_url"`
-}
-
-func (s Snippet) String() string {
- return Stringify(s)
-}
-
-// ListSnippetsOptions represents the available ListSnippets() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/snippets.html#list-snippets
-type ListSnippetsOptions ListOptions
-
-// ListSnippets gets a list of snippets.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/snippets.html#list-snippets
-func (s *SnippetsService) ListSnippets(opt *ListSnippetsOptions, options ...OptionFunc) ([]*Snippet, *Response, error) {
- req, err := s.client.NewRequest("GET", "snippets", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ps []*Snippet
- resp, err := s.client.Do(req, &ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// GetSnippet gets a single snippet
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#single-snippet
-func (s *SnippetsService) GetSnippet(snippet int, options ...OptionFunc) (*Snippet, *Response, error) {
- u := fmt.Sprintf("snippets/%d", snippet)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- ps := new(Snippet)
- resp, err := s.client.Do(req, ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// CreateSnippetOptions represents the available CreateSnippet() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#create-new-snippet
-type CreateSnippetOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Content *string `url:"content,omitempty" json:"content,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
-}
-
-// CreateSnippet creates a new snippet. The user must have permission
-// to create new snippets.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#create-new-snippet
-func (s *SnippetsService) CreateSnippet(opt *CreateSnippetOptions, options ...OptionFunc) (*Snippet, *Response, error) {
- req, err := s.client.NewRequest("POST", "snippets", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ps := new(Snippet)
- resp, err := s.client.Do(req, ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// UpdateSnippetOptions represents the available UpdateSnippet() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#update-snippet
-type UpdateSnippetOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- FileName *string `url:"file_name,omitempty" json:"file_name,omitempty"`
- Description *string `url:"description,omitempty" json:"description,omitempty"`
- Content *string `url:"content,omitempty" json:"content,omitempty"`
- Visibility *VisibilityValue `url:"visibility,omitempty" json:"visibility,omitempty"`
-}
-
-// UpdateSnippet updates an existing snippet. The user must have
-// permission to change an existing snippet.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#update-snippet
-func (s *SnippetsService) UpdateSnippet(snippet int, opt *UpdateSnippetOptions, options ...OptionFunc) (*Snippet, *Response, error) {
- u := fmt.Sprintf("snippets/%d", snippet)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- ps := new(Snippet)
- resp, err := s.client.Do(req, ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
-
-// DeleteSnippet deletes an existing snippet. This is an idempotent
-// function and deleting a non-existent snippet still returns a 200 OK status
-// code.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#delete-snippet
-func (s *SnippetsService) DeleteSnippet(snippet int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("snippets/%d", snippet)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// SnippetContent returns the raw snippet as plain text.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#snippet-content
-func (s *SnippetsService) SnippetContent(snippet int, options ...OptionFunc) ([]byte, *Response, error) {
- u := fmt.Sprintf("snippets/%d/raw", snippet)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var b bytes.Buffer
- resp, err := s.client.Do(req, &b)
- if err != nil {
- return nil, resp, err
- }
-
- return b.Bytes(), resp, err
-}
-
-// ExploreSnippetsOptions represents the available ExploreSnippets() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#explore-all-public-snippets
-type ExploreSnippetsOptions ListOptions
-
-// ExploreSnippets gets the list of public snippets.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/snippets.html#explore-all-public-snippets
-func (s *SnippetsService) ExploreSnippets(opt *ExploreSnippetsOptions, options ...OptionFunc) ([]*Snippet, *Response, error) {
- req, err := s.client.NewRequest("GET", "snippets/public", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ps []*Snippet
- resp, err := s.client.Do(req, &ps)
- if err != nil {
- return nil, resp, err
- }
-
- return ps, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/strings.go b/vendor/github.com/xanzy/go-gitlab/strings.go
deleted file mode 100644
index aeefb6b8..00000000
--- a/vendor/github.com/xanzy/go-gitlab/strings.go
+++ /dev/null
@@ -1,94 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "bytes"
- "fmt"
-
- "reflect"
-)
-
-// Stringify attempts to create a reasonable string representation of types in
-// the GitHub library. It does things like resolve pointers to their values
-// and omits struct fields with nil values.
-func Stringify(message interface{}) string {
- var buf bytes.Buffer
- v := reflect.ValueOf(message)
- stringifyValue(&buf, v)
- return buf.String()
-}
-
-// stringifyValue was heavily inspired by the goprotobuf library.
-func stringifyValue(buf *bytes.Buffer, val reflect.Value) {
- if val.Kind() == reflect.Ptr && val.IsNil() {
- buf.WriteString("<nil>")
- return
- }
-
- v := reflect.Indirect(val)
-
- switch v.Kind() {
- case reflect.String:
- fmt.Fprintf(buf, `"%s"`, v)
- case reflect.Slice:
- buf.WriteByte('[')
- for i := 0; i < v.Len(); i++ {
- if i > 0 {
- buf.WriteByte(' ')
- }
-
- stringifyValue(buf, v.Index(i))
- }
-
- buf.WriteByte(']')
- return
- case reflect.Struct:
- if v.Type().Name() != "" {
- buf.WriteString(v.Type().String())
- }
-
- buf.WriteByte('{')
-
- var sep bool
- for i := 0; i < v.NumField(); i++ {
- fv := v.Field(i)
- if fv.Kind() == reflect.Ptr && fv.IsNil() {
- continue
- }
- if fv.Kind() == reflect.Slice && fv.IsNil() {
- continue
- }
-
- if sep {
- buf.WriteString(", ")
- } else {
- sep = true
- }
-
- buf.WriteString(v.Type().Field(i).Name)
- buf.WriteByte(':')
- stringifyValue(buf, fv)
- }
-
- buf.WriteByte('}')
- default:
- if v.CanInterface() {
- fmt.Fprint(buf, v.Interface())
- }
- }
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/system_hooks.go b/vendor/github.com/xanzy/go-gitlab/system_hooks.go
deleted file mode 100644
index d5209d4f..00000000
--- a/vendor/github.com/xanzy/go-gitlab/system_hooks.go
+++ /dev/null
@@ -1,143 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "time"
-)
-
-// SystemHooksService handles communication with the system hooks related
-// methods of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/system_hooks.html
-type SystemHooksService struct {
- client *Client
-}
-
-// Hook represents a GitLap system hook.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/system_hooks.html
-type Hook struct {
- ID int `json:"id"`
- URL string `json:"url"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-func (h Hook) String() string {
- return Stringify(h)
-}
-
-// ListHooks gets a list of system hooks.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/system_hooks.html#list-system-hooks
-func (s *SystemHooksService) ListHooks(options ...OptionFunc) ([]*Hook, *Response, error) {
- req, err := s.client.NewRequest("GET", "hooks", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var h []*Hook
- resp, err := s.client.Do(req, &h)
- if err != nil {
- return nil, resp, err
- }
-
- return h, resp, err
-}
-
-// AddHookOptions represents the available AddHook() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/system_hooks.html#add-new-system-hook-hook
-type AddHookOptions struct {
- URL *string `url:"url,omitempty" json:"url,omitempty"`
-}
-
-// AddHook adds a new system hook hook.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/system_hooks.html#add-new-system-hook-hook
-func (s *SystemHooksService) AddHook(opt *AddHookOptions, options ...OptionFunc) (*Hook, *Response, error) {
- req, err := s.client.NewRequest("POST", "hooks", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- h := new(Hook)
- resp, err := s.client.Do(req, h)
- if err != nil {
- return nil, resp, err
- }
-
- return h, resp, err
-}
-
-// HookEvent represents an event trigger by a GitLab system hook.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/system_hooks.html
-type HookEvent struct {
- EventName string `json:"event_name"`
- Name string `json:"name"`
- Path string `json:"path"`
- ProjectID int `json:"project_id"`
- OwnerName string `json:"owner_name"`
- OwnerEmail string `json:"owner_email"`
-}
-
-func (h HookEvent) String() string {
- return Stringify(h)
-}
-
-// TestHook tests a system hook.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/system_hooks.html#test-system-hook
-func (s *SystemHooksService) TestHook(hook int, options ...OptionFunc) (*HookEvent, *Response, error) {
- u := fmt.Sprintf("hooks/%d", hook)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- h := new(HookEvent)
- resp, err := s.client.Do(req, h)
- if err != nil {
- return nil, resp, err
- }
-
- return h, resp, err
-}
-
-// DeleteHook deletes a system hook. This is an idempotent API function and
-// returns 200 OK even if the hook is not available. If the hook is deleted it
-// is also returned as JSON.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/system_hooks.html#delete-system-hook
-func (s *SystemHooksService) DeleteHook(hook int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("hooks/%d", hook)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/tags.go b/vendor/github.com/xanzy/go-gitlab/tags.go
deleted file mode 100644
index a6072dc7..00000000
--- a/vendor/github.com/xanzy/go-gitlab/tags.go
+++ /dev/null
@@ -1,243 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// TagsService handles communication with the tags related methods
-// of the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/tags.html
-type TagsService struct {
- client *Client
-}
-
-// Tag represents a GitLab tag.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/tags.html
-type Tag struct {
- Commit *Commit `json:"commit"`
- Release *ReleaseNote `json:"release"`
- Name string `json:"name"`
- Message string `json:"message"`
-}
-
-// ReleaseNote represents a GitLab version release.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/tags.html
-type ReleaseNote struct {
- TagName string `json:"tag_name"`
- Description string `json:"description"`
-}
-
-func (t Tag) String() string {
- return Stringify(t)
-}
-
-// ListTagsOptions represents the available ListTags() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#list-project-repository-tags
-type ListTagsOptions struct {
- ListOptions
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
-}
-
-// ListTags gets a list of tags from a project, sorted by name in reverse
-// alphabetical order.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#list-project-repository-tags
-func (s *TagsService) ListTags(pid interface{}, opt *ListTagsOptions, options ...OptionFunc) ([]*Tag, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/tags", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var t []*Tag
- resp, err := s.client.Do(req, &t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// GetTag a specific repository tag determined by its name. It returns 200 together
-// with the tag information if the tag exists. It returns 404 if the tag does not exist.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#get-a-single-repository-tag
-func (s *TagsService) GetTag(pid interface{}, tag string, options ...OptionFunc) (*Tag, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/tags/%s", pathEscape(project), url.PathEscape(tag))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var t *Tag
- resp, err := s.client.Do(req, &t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// CreateTagOptions represents the available CreateTag() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#create-a-new-tag
-type CreateTagOptions struct {
- TagName *string `url:"tag_name,omitempty" json:"tag_name,omitempty"`
- Ref *string `url:"ref,omitempty" json:"ref,omitempty"`
- Message *string `url:"message,omitempty" json:"message,omitempty"`
- // ReleaseDescription parameter was deprecated in GitLab 11.7
- ReleaseDescription *string `url:"release_description:omitempty" json:"release_description,omitempty"`
-}
-
-// CreateTag creates a new tag in the repository that points to the supplied ref.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#create-a-new-tag
-func (s *TagsService) CreateTag(pid interface{}, opt *CreateTagOptions, options ...OptionFunc) (*Tag, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/tags", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(Tag)
- resp, err := s.client.Do(req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// DeleteTag deletes a tag of a repository with given name.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#delete-a-tag
-func (s *TagsService) DeleteTag(pid interface{}, tag string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/tags/%s", pathEscape(project), url.PathEscape(tag))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// CreateReleaseNoteOptions represents the available CreateReleaseNote() options.
-//
-// Deprecated: This feature was deprecated in GitLab 11.7.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#create-a-new-release
-type CreateReleaseNoteOptions struct {
- Description *string `url:"description:omitempty" json:"description,omitempty"`
-}
-
-// CreateReleaseNote Add release notes to the existing git tag.
-// If there already exists a release for the given tag, status code 409 is returned.
-//
-// Deprecated: This feature was deprecated in GitLab 11.7.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#create-a-new-release
-func (s *TagsService) CreateReleaseNote(pid interface{}, tag string, opt *CreateReleaseNoteOptions, options ...OptionFunc) (*ReleaseNote, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/tags/%s/release", pathEscape(project), url.PathEscape(tag))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(ReleaseNote)
- resp, err := s.client.Do(req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
-
-// UpdateReleaseNoteOptions represents the available UpdateReleaseNote() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#update-a-release
-type UpdateReleaseNoteOptions struct {
- Description *string `url:"description:omitempty" json:"description,omitempty"`
-}
-
-// UpdateReleaseNote Updates the release notes of a given release.
-//
-// Deprecated: This feature was deprecated in GitLab 11.7.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/tags.html#update-a-release
-func (s *TagsService) UpdateReleaseNote(pid interface{}, tag string, opt *UpdateReleaseNoteOptions, options ...OptionFunc) (*ReleaseNote, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/repository/tags/%s/release", pathEscape(project), url.PathEscape(tag))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- r := new(ReleaseNote)
- resp, err := s.client.Do(req, r)
- if err != nil {
- return nil, resp, err
- }
-
- return r, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/time_stats.go b/vendor/github.com/xanzy/go-gitlab/time_stats.go
deleted file mode 100644
index 437a4e01..00000000
--- a/vendor/github.com/xanzy/go-gitlab/time_stats.go
+++ /dev/null
@@ -1,162 +0,0 @@
-package gitlab
-
-import (
- "fmt"
-)
-
-// timeStatsService handles communication with the time tracking related
-// methods of the GitLab API.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-type timeStatsService struct {
- client *Client
-}
-
-// TimeStats represents the time estimates and time spent for an issue.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-type TimeStats struct {
- HumanTimeEstimate string `json:"human_time_estimate"`
- HumanTotalTimeSpent string `json:"human_total_time_spent"`
- TimeEstimate int `json:"time_estimate"`
- TotalTimeSpent int `json:"total_time_spent"`
-}
-
-func (t TimeStats) String() string {
- return Stringify(t)
-}
-
-// SetTimeEstimateOptions represents the available SetTimeEstimate()
-// options.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-type SetTimeEstimateOptions struct {
- Duration *string `url:"duration,omitempty" json:"duration,omitempty"`
-}
-
-// setTimeEstimate sets the time estimate for a single project issue.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-func (s *timeStatsService) setTimeEstimate(pid interface{}, entity string, issue int, opt *SetTimeEstimateOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/time_estimate", pathEscape(project), entity, issue)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(TimeStats)
- resp, err := s.client.Do(req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// resetTimeEstimate resets the time estimate for a single project issue.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-func (s *timeStatsService) resetTimeEstimate(pid interface{}, entity string, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/reset_time_estimate", pathEscape(project), entity, issue)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(TimeStats)
- resp, err := s.client.Do(req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// AddSpentTimeOptions represents the available AddSpentTime() options.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-type AddSpentTimeOptions struct {
- Duration *string `url:"duration,omitempty" json:"duration,omitempty"`
-}
-
-// addSpentTime adds spent time for a single project issue.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-func (s *timeStatsService) addSpentTime(pid interface{}, entity string, issue int, opt *AddSpentTimeOptions, options ...OptionFunc) (*TimeStats, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/add_spent_time", pathEscape(project), entity, issue)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(TimeStats)
- resp, err := s.client.Do(req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// resetSpentTime resets the spent time for a single project issue.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-func (s *timeStatsService) resetSpentTime(pid interface{}, entity string, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/reset_spent_time", pathEscape(project), entity, issue)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(TimeStats)
- resp, err := s.client.Do(req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// getTimeSpent gets the spent time for a single project issue.
-//
-// GitLab docs: https://docs.gitlab.com/ce/workflow/time_tracking.html
-func (s *timeStatsService) getTimeSpent(pid interface{}, entity string, issue int, options ...OptionFunc) (*TimeStats, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/%s/%d/time_stats", pathEscape(project), entity, issue)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(TimeStats)
- resp, err := s.client.Do(req, t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/todos.go b/vendor/github.com/xanzy/go-gitlab/todos.go
deleted file mode 100644
index 4c32d085..00000000
--- a/vendor/github.com/xanzy/go-gitlab/todos.go
+++ /dev/null
@@ -1,176 +0,0 @@
-package gitlab
-
-import "time"
-import "fmt"
-
-// TodosService handles communication with the todos related methods of
-// the Gitlab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html
-type TodosService struct {
- client *Client
-}
-
-// TodoAction represents the available actions that can be performed on a todo.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html
-type TodoAction string
-
-// The available todo actions.
-const (
- TodoAssigned TodoAction = "assigned"
- TodoMentioned TodoAction = "mentioned"
- TodoBuildFailed TodoAction = "build_failed"
- TodoMarked TodoAction = "marked"
- TodoApprovalRequired TodoAction = "approval_required"
- TodoDirectlyAddressed TodoAction = "directly_addressed"
-)
-
-// TodoTarget represents a todo target of type Issue or MergeRequest
-type TodoTarget struct {
- // TODO: replace both Assignee and Author structs with v4 User struct
- Assignee struct {
- Name string `json:"name"`
- Username string `json:"username"`
- ID int `json:"id"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"assignee"`
- Author struct {
- Name string `json:"name"`
- Username string `json:"username"`
- ID int `json:"id"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"author"`
- CreatedAt *time.Time `json:"created_at"`
- Description string `json:"description"`
- Downvotes int `json:"downvotes"`
- ID int `json:"id"`
- IID int `json:"iid"`
- Labels []string `json:"labels"`
- Milestone Milestone `json:"milestone"`
- ProjectID int `json:"project_id"`
- State string `json:"state"`
- Subscribed bool `json:"subscribed"`
- Title string `json:"title"`
- UpdatedAt *time.Time `json:"updated_at"`
- Upvotes int `json:"upvotes"`
- UserNotesCount int `json:"user_notes_count"`
- WebURL string `json:"web_url"`
-
- // Only available for type Issue
- Confidential bool `json:"confidential"`
- DueDate string `json:"due_date"`
- Weight int `json:"weight"`
-
- // Only available for type MergeRequest
- ApprovalsBeforeMerge int `json:"approvals_before_merge"`
- ForceRemoveSourceBranch bool `json:"force_remove_source_branch"`
- MergeCommitSHA string `json:"merge_commit_sha"`
- MergeWhenPipelineSucceeds bool `json:"merge_when_pipeline_succeeds"`
- MergeStatus string `json:"merge_status"`
- SHA string `json:"sha"`
- ShouldRemoveSourceBranch bool `json:"should_remove_source_branch"`
- SourceBranch string `json:"source_branch"`
- SourceProjectID int `json:"source_project_id"`
- Squash bool `json:"squash"`
- TargetBranch string `json:"target_branch"`
- TargetProjectID int `json:"target_project_id"`
- WorkInProgress bool `json:"work_in_progress"`
-}
-
-// Todo represents a GitLab todo.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html
-type Todo struct {
- ID int `json:"id"`
- Project struct {
- ID int `json:"id"`
- HTTPURLToRepo string `json:"http_url_to_repo"`
- WebURL string `json:"web_url"`
- Name string `json:"name"`
- NameWithNamespace string `json:"name_with_namespace"`
- Path string `json:"path"`
- PathWithNamespace string `json:"path_with_namespace"`
- } `json:"project"`
- Author struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Username string `json:"username"`
- State string `json:"state"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
- } `json:"author"`
- ActionName TodoAction `json:"action_name"`
- TargetType string `json:"target_type"`
- Target TodoTarget `json:"target"`
- TargetURL string `json:"target_url"`
- Body string `json:"body"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-func (t Todo) String() string {
- return Stringify(t)
-}
-
-// ListTodosOptions represents the available ListTodos() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html#get-a-list-of-todos
-type ListTodosOptions struct {
- ListOptions
- Action *TodoAction `url:"action,omitempty" json:"action,omitempty"`
- AuthorID *int `url:"author_id,omitempty" json:"author_id,omitempty"`
- ProjectID *int `url:"project_id,omitempty" json:"project_id,omitempty"`
- State *string `url:"state,omitempty" json:"state,omitempty"`
- Type *string `url:"type,omitempty" json:"type,omitempty"`
-}
-
-// ListTodos lists all todos created by authenticated user.
-// When no filter is applied, it returns all pending todos for the current user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/todos.html#get-a-list-of-todos
-func (s *TodosService) ListTodos(opt *ListTodosOptions, options ...OptionFunc) ([]*Todo, *Response, error) {
- req, err := s.client.NewRequest("GET", "todos", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var t []*Todo
- resp, err := s.client.Do(req, &t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// MarkTodoAsDone marks a single pending todo given by its ID for the current user as done.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html#mark-a-todo-as-done
-func (s *TodosService) MarkTodoAsDone(id int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("todos/%d/mark_as_done", id)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// MarkAllTodosAsDone marks all pending todos for the current user as done.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/todos.html#mark-all-todos-as-done
-func (s *TodosService) MarkAllTodosAsDone(options ...OptionFunc) (*Response, error) {
- req, err := s.client.NewRequest("POST", "todos/mark_as_done", nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/users.go b/vendor/github.com/xanzy/go-gitlab/users.go
deleted file mode 100644
index c8015cda..00000000
--- a/vendor/github.com/xanzy/go-gitlab/users.go
+++ /dev/null
@@ -1,871 +0,0 @@
-//
-// Copyright 2017, Sander van Harmelen
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-import (
- "errors"
- "fmt"
- "time"
-)
-
-// List a couple of standard errors.
-var (
- ErrUserBlockPrevented = errors.New("Cannot block a user that is already blocked by LDAP synchronization")
- ErrUserNotFound = errors.New("User does not exist")
- ErrUserUnblockPrevented = errors.New("Cannot unblock a user that is blocked by LDAP synchronization")
-)
-
-// UsersService handles communication with the user related methods of
-// the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html
-type UsersService struct {
- client *Client
-}
-
-// BasicUser included in other service responses (such as merge requests, pipelines, etc).
-type BasicUser struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- AvatarURL string `json:"avatar_url"`
- WebURL string `json:"web_url"`
-}
-
-// User represents a GitLab user.
-//
-// GitLab API docs: https://docs.gitlab.com/ee/api/users.html
-type User struct {
- ID int `json:"id"`
- Username string `json:"username"`
- Email string `json:"email"`
- Name string `json:"name"`
- State string `json:"state"`
- CreatedAt *time.Time `json:"created_at"`
- Bio string `json:"bio"`
- Location string `json:"location"`
- PublicEmail string `json:"public_email"`
- Skype string `json:"skype"`
- Linkedin string `json:"linkedin"`
- Twitter string `json:"twitter"`
- WebsiteURL string `json:"website_url"`
- Organization string `json:"organization"`
- ExternUID string `json:"extern_uid"`
- Provider string `json:"provider"`
- ThemeID int `json:"theme_id"`
- LastActivityOn *ISOTime `json:"last_activity_on"`
- ColorSchemeID int `json:"color_scheme_id"`
- IsAdmin bool `json:"is_admin"`
- AvatarURL string `json:"avatar_url"`
- CanCreateGroup bool `json:"can_create_group"`
- CanCreateProject bool `json:"can_create_project"`
- ProjectsLimit int `json:"projects_limit"`
- CurrentSignInAt *time.Time `json:"current_sign_in_at"`
- LastSignInAt *time.Time `json:"last_sign_in_at"`
- ConfirmedAt *time.Time `json:"confirmed_at"`
- TwoFactorEnabled bool `json:"two_factor_enabled"`
- Identities []*UserIdentity `json:"identities"`
- External bool `json:"external"`
- PrivateProfile bool `json:"private_profile"`
- SharedRunnersMinutesLimit int `json:"shared_runners_minutes_limit"`
- CustomAttributes []*CustomAttribute `json:"custom_attributes"`
-}
-
-// UserIdentity represents a user identity.
-type UserIdentity struct {
- Provider string `json:"provider"`
- ExternUID string `json:"extern_uid"`
-}
-
-// ListUsersOptions represents the available ListUsers() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-users
-type ListUsersOptions struct {
- ListOptions
- Active *bool `url:"active,omitempty" json:"active,omitempty"`
- Blocked *bool `url:"blocked,omitempty" json:"blocked,omitempty"`
-
- // The options below are only available for admins.
- Search *string `url:"search,omitempty" json:"search,omitempty"`
- Username *string `url:"username,omitempty" json:"username,omitempty"`
- ExternalUID *string `url:"extern_uid,omitempty" json:"extern_uid,omitempty"`
- Provider *string `url:"provider,omitempty" json:"provider,omitempty"`
- CreatedBefore *time.Time `url:"created_before,omitempty" json:"created_before,omitempty"`
- CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
- OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
- Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
- WithCustomAttributes *bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"`
-}
-
-// ListUsers gets a list of users.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-users
-func (s *UsersService) ListUsers(opt *ListUsersOptions, options ...OptionFunc) ([]*User, *Response, error) {
- req, err := s.client.NewRequest("GET", "users", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var usr []*User
- resp, err := s.client.Do(req, &usr)
- if err != nil {
- return nil, resp, err
- }
-
- return usr, resp, err
-}
-
-// GetUser gets a single user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#single-user
-func (s *UsersService) GetUser(user int, options ...OptionFunc) (*User, *Response, error) {
- u := fmt.Sprintf("users/%d", user)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- usr := new(User)
- resp, err := s.client.Do(req, usr)
- if err != nil {
- return nil, resp, err
- }
-
- return usr, resp, err
-}
-
-// CreateUserOptions represents the available CreateUser() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-creation
-type CreateUserOptions struct {
- Email *string `url:"email,omitempty" json:"email,omitempty"`
- Password *string `url:"password,omitempty" json:"password,omitempty"`
- ResetPassword *bool `url:"reset_password,omitempty" json:"reset_password,omitempty"`
- Username *string `url:"username,omitempty" json:"username,omitempty"`
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Skype *string `url:"skype,omitempty" json:"skype,omitempty"`
- Linkedin *string `url:"linkedin,omitempty" json:"linkedin,omitempty"`
- Twitter *string `url:"twitter,omitempty" json:"twitter,omitempty"`
- WebsiteURL *string `url:"website_url,omitempty" json:"website_url,omitempty"`
- Organization *string `url:"organization,omitempty" json:"organization,omitempty"`
- ProjectsLimit *int `url:"projects_limit,omitempty" json:"projects_limit,omitempty"`
- ExternUID *string `url:"extern_uid,omitempty" json:"extern_uid,omitempty"`
- Provider *string `url:"provider,omitempty" json:"provider,omitempty"`
- Bio *string `url:"bio,omitempty" json:"bio,omitempty"`
- Location *string `url:"location,omitempty" json:"location,omitempty"`
- Admin *bool `url:"admin,omitempty" json:"admin,omitempty"`
- CanCreateGroup *bool `url:"can_create_group,omitempty" json:"can_create_group,omitempty"`
- SkipConfirmation *bool `url:"skip_confirmation,omitempty" json:"skip_confirmation,omitempty"`
- External *bool `url:"external,omitempty" json:"external,omitempty"`
- PrivateProfile *bool `url:"private_profile,omitempty" json:"private_profile,omitempty"`
-}
-
-// CreateUser creates a new user. Note only administrators can create new users.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-creation
-func (s *UsersService) CreateUser(opt *CreateUserOptions, options ...OptionFunc) (*User, *Response, error) {
- req, err := s.client.NewRequest("POST", "users", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- usr := new(User)
- resp, err := s.client.Do(req, usr)
- if err != nil {
- return nil, resp, err
- }
-
- return usr, resp, err
-}
-
-// ModifyUserOptions represents the available ModifyUser() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-modification
-type ModifyUserOptions struct {
- Email *string `url:"email,omitempty" json:"email,omitempty"`
- Password *string `url:"password,omitempty" json:"password,omitempty"`
- Username *string `url:"username,omitempty" json:"username,omitempty"`
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Skype *string `url:"skype,omitempty" json:"skype,omitempty"`
- Linkedin *string `url:"linkedin,omitempty" json:"linkedin,omitempty"`
- Twitter *string `url:"twitter,omitempty" json:"twitter,omitempty"`
- WebsiteURL *string `url:"website_url,omitempty" json:"website_url,omitempty"`
- Organization *string `url:"organization,omitempty" json:"organization,omitempty"`
- ProjectsLimit *int `url:"projects_limit,omitempty" json:"projects_limit,omitempty"`
- ExternUID *string `url:"extern_uid,omitempty" json:"extern_uid,omitempty"`
- Provider *string `url:"provider,omitempty" json:"provider,omitempty"`
- Bio *string `url:"bio,omitempty" json:"bio,omitempty"`
- Location *string `url:"location,omitempty" json:"location,omitempty"`
- Admin *bool `url:"admin,omitempty" json:"admin,omitempty"`
- CanCreateGroup *bool `url:"can_create_group,omitempty" json:"can_create_group,omitempty"`
- SkipReconfirmation *bool `url:"skip_reconfirmation,omitempty" json:"skip_reconfirmation,omitempty"`
- External *bool `url:"external,omitempty" json:"external,omitempty"`
- PrivateProfile *bool `url:"private_profile,omitempty" json:"private_profile,omitempty"`
-}
-
-// ModifyUser modifies an existing user. Only administrators can change attributes
-// of a user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-modification
-func (s *UsersService) ModifyUser(user int, opt *ModifyUserOptions, options ...OptionFunc) (*User, *Response, error) {
- u := fmt.Sprintf("users/%d", user)
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- usr := new(User)
- resp, err := s.client.Do(req, usr)
- if err != nil {
- return nil, resp, err
- }
-
- return usr, resp, err
-}
-
-// DeleteUser deletes a user. Available only for administrators. This is an
-// idempotent function, calling this function for a non-existent user id still
-// returns a status code 200 OK. The JSON response differs if the user was
-// actually deleted or not. In the former the user is returned and in the
-// latter not.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-deletion
-func (s *UsersService) DeleteUser(user int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("users/%d", user)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// CurrentUser gets currently authenticated user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#current-user
-func (s *UsersService) CurrentUser(options ...OptionFunc) (*User, *Response, error) {
- req, err := s.client.NewRequest("GET", "user", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- usr := new(User)
- resp, err := s.client.Do(req, usr)
- if err != nil {
- return nil, resp, err
- }
-
- return usr, resp, err
-}
-
-// SSHKey represents a SSH key.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-ssh-keys
-type SSHKey struct {
- ID int `json:"id"`
- Title string `json:"title"`
- Key string `json:"key"`
- CreatedAt *time.Time `json:"created_at"`
-}
-
-// ListSSHKeys gets a list of currently authenticated user's SSH keys.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-ssh-keys
-func (s *UsersService) ListSSHKeys(options ...OptionFunc) ([]*SSHKey, *Response, error) {
- req, err := s.client.NewRequest("GET", "user/keys", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var k []*SSHKey
- resp, err := s.client.Do(req, &k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
-
-// ListSSHKeysForUserOptions represents the available ListSSHKeysForUser() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#list-ssh-keys-for-user
-type ListSSHKeysForUserOptions ListOptions
-
-// ListSSHKeysForUser gets a list of a specified user's SSH keys. Available
-// only for admin
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#list-ssh-keys-for-user
-func (s *UsersService) ListSSHKeysForUser(user int, opt *ListSSHKeysForUserOptions, options ...OptionFunc) ([]*SSHKey, *Response, error) {
- u := fmt.Sprintf("users/%d/keys", user)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var k []*SSHKey
- resp, err := s.client.Do(req, &k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
-
-// GetSSHKey gets a single key.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#single-ssh-key
-func (s *UsersService) GetSSHKey(key int, options ...OptionFunc) (*SSHKey, *Response, error) {
- u := fmt.Sprintf("user/keys/%d", key)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(SSHKey)
- resp, err := s.client.Do(req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
-
-// AddSSHKeyOptions represents the available AddSSHKey() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#add-ssh-key
-type AddSSHKeyOptions struct {
- Title *string `url:"title,omitempty" json:"title,omitempty"`
- Key *string `url:"key,omitempty" json:"key,omitempty"`
-}
-
-// AddSSHKey creates a new key owned by the currently authenticated user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-ssh-key
-func (s *UsersService) AddSSHKey(opt *AddSSHKeyOptions, options ...OptionFunc) (*SSHKey, *Response, error) {
- req, err := s.client.NewRequest("POST", "user/keys", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(SSHKey)
- resp, err := s.client.Do(req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
-
-// AddSSHKeyForUser creates new key owned by specified user. Available only for
-// admin.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-ssh-key-for-user
-func (s *UsersService) AddSSHKeyForUser(user int, opt *AddSSHKeyOptions, options ...OptionFunc) (*SSHKey, *Response, error) {
- u := fmt.Sprintf("users/%d/keys", user)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- k := new(SSHKey)
- resp, err := s.client.Do(req, k)
- if err != nil {
- return nil, resp, err
- }
-
- return k, resp, err
-}
-
-// DeleteSSHKey deletes key owned by currently authenticated user. This is an
-// idempotent function and calling it on a key that is already deleted or not
-// available results in 200 OK.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#delete-ssh-key-for-current-owner
-func (s *UsersService) DeleteSSHKey(key int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("user/keys/%d", key)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteSSHKeyForUser deletes key owned by a specified user. Available only
-// for admin.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#delete-ssh-key-for-given-user
-func (s *UsersService) DeleteSSHKeyForUser(user, key int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("users/%d/keys/%d", user, key)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// BlockUser blocks the specified user. Available only for admin.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#block-user
-func (s *UsersService) BlockUser(user int, options ...OptionFunc) error {
- u := fmt.Sprintf("users/%d/block", user)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return err
- }
-
- resp, err := s.client.Do(req, nil)
- if err != nil && resp == nil {
- return err
- }
-
- switch resp.StatusCode {
- case 201:
- return nil
- case 403:
- return ErrUserBlockPrevented
- case 404:
- return ErrUserNotFound
- default:
- return fmt.Errorf("Received unexpected result code: %d", resp.StatusCode)
- }
-}
-
-// UnblockUser unblocks the specified user. Available only for admin.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#unblock-user
-func (s *UsersService) UnblockUser(user int, options ...OptionFunc) error {
- u := fmt.Sprintf("users/%d/unblock", user)
-
- req, err := s.client.NewRequest("POST", u, nil, options)
- if err != nil {
- return err
- }
-
- resp, err := s.client.Do(req, nil)
- if err != nil && resp == nil {
- return err
- }
-
- switch resp.StatusCode {
- case 201:
- return nil
- case 403:
- return ErrUserUnblockPrevented
- case 404:
- return ErrUserNotFound
- default:
- return fmt.Errorf("Received unexpected result code: %d", resp.StatusCode)
- }
-}
-
-// Email represents an Email.
-//
-// GitLab API docs: https://doc.gitlab.com/ce/api/users.html#list-emails
-type Email struct {
- ID int `json:"id"`
- Email string `json:"email"`
-}
-
-// ListEmails gets a list of currently authenticated user's Emails.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-emails
-func (s *UsersService) ListEmails(options ...OptionFunc) ([]*Email, *Response, error) {
- req, err := s.client.NewRequest("GET", "user/emails", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var e []*Email
- resp, err := s.client.Do(req, &e)
- if err != nil {
- return nil, resp, err
- }
-
- return e, resp, err
-}
-
-// ListEmailsForUserOptions represents the available ListEmailsForUser() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#list-emails-for-user
-type ListEmailsForUserOptions ListOptions
-
-// ListEmailsForUser gets a list of a specified user's Emails. Available
-// only for admin
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#list-emails-for-user
-func (s *UsersService) ListEmailsForUser(user int, opt *ListEmailsForUserOptions, options ...OptionFunc) ([]*Email, *Response, error) {
- u := fmt.Sprintf("users/%d/emails", user)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var e []*Email
- resp, err := s.client.Do(req, &e)
- if err != nil {
- return nil, resp, err
- }
-
- return e, resp, err
-}
-
-// GetEmail gets a single email.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#single-email
-func (s *UsersService) GetEmail(email int, options ...OptionFunc) (*Email, *Response, error) {
- u := fmt.Sprintf("user/emails/%d", email)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- e := new(Email)
- resp, err := s.client.Do(req, e)
- if err != nil {
- return nil, resp, err
- }
-
- return e, resp, err
-}
-
-// AddEmailOptions represents the available AddEmail() options.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/projects.html#add-email
-type AddEmailOptions struct {
- Email *string `url:"email,omitempty" json:"email,omitempty"`
-}
-
-// AddEmail creates a new email owned by the currently authenticated user.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-email
-func (s *UsersService) AddEmail(opt *AddEmailOptions, options ...OptionFunc) (*Email, *Response, error) {
- req, err := s.client.NewRequest("POST", "user/emails", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- e := new(Email)
- resp, err := s.client.Do(req, e)
- if err != nil {
- return nil, resp, err
- }
-
- return e, resp, err
-}
-
-// AddEmailForUser creates new email owned by specified user. Available only for
-// admin.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-email-for-user
-func (s *UsersService) AddEmailForUser(user int, opt *AddEmailOptions, options ...OptionFunc) (*Email, *Response, error) {
- u := fmt.Sprintf("users/%d/emails", user)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- e := new(Email)
- resp, err := s.client.Do(req, e)
- if err != nil {
- return nil, resp, err
- }
-
- return e, resp, err
-}
-
-// DeleteEmail deletes email owned by currently authenticated user. This is an
-// idempotent function and calling it on a key that is already deleted or not
-// available results in 200 OK.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#delete-email-for-current-owner
-func (s *UsersService) DeleteEmail(email int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("user/emails/%d", email)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// DeleteEmailForUser deletes email owned by a specified user. Available only
-// for admin.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#delete-email-for-given-user
-func (s *UsersService) DeleteEmailForUser(user, email int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("users/%d/emails/%d", user, email)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// ImpersonationToken represents an impersonation token.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-all-impersonation-tokens-of-a-user
-type ImpersonationToken struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Active bool `json:"active"`
- Token string `json:"token"`
- Scopes []string `json:"scopes"`
- Revoked bool `json:"revoked"`
- CreatedAt *time.Time `json:"created_at"`
- ExpiresAt *ISOTime `json:"expires_at"`
-}
-
-// GetAllImpersonationTokensOptions represents the available
-// GetAllImpersonationTokens() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-all-impersonation-tokens-of-a-user
-type GetAllImpersonationTokensOptions struct {
- ListOptions
- State *string `url:"state,omitempty" json:"state,omitempty"`
-}
-
-// GetAllImpersonationTokens retrieves all impersonation tokens of a user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-all-impersonation-tokens-of-a-user
-func (s *UsersService) GetAllImpersonationTokens(user int, opt *GetAllImpersonationTokensOptions, options ...OptionFunc) ([]*ImpersonationToken, *Response, error) {
- u := fmt.Sprintf("users/%d/impersonation_tokens", user)
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var ts []*ImpersonationToken
- resp, err := s.client.Do(req, &ts)
- if err != nil {
- return nil, resp, err
- }
-
- return ts, resp, err
-}
-
-// GetImpersonationToken retrieves an impersonation token of a user.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-an-impersonation-token-of-a-user
-func (s *UsersService) GetImpersonationToken(user, token int, options ...OptionFunc) (*ImpersonationToken, *Response, error) {
- u := fmt.Sprintf("users/%d/impersonation_tokens/%d", user, token)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(ImpersonationToken)
- resp, err := s.client.Do(req, &t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// CreateImpersonationTokenOptions represents the available
-// CreateImpersonationToken() options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#create-an-impersonation-token
-type CreateImpersonationTokenOptions struct {
- Name *string `url:"name,omitempty" json:"name,omitempty"`
- Scopes *[]string `url:"scopes,omitempty" json:"scopes,omitempty"`
- ExpiresAt *time.Time `url:"expires_at,omitempty" json:"expires_at,omitempty"`
-}
-
-// CreateImpersonationToken creates an impersonation token.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#create-an-impersonation-token
-func (s *UsersService) CreateImpersonationToken(user int, opt *CreateImpersonationTokenOptions, options ...OptionFunc) (*ImpersonationToken, *Response, error) {
- u := fmt.Sprintf("users/%d/impersonation_tokens", user)
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- t := new(ImpersonationToken)
- resp, err := s.client.Do(req, &t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// RevokeImpersonationToken revokes an impersonation token.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#revoke-an-impersonation-token
-func (s *UsersService) RevokeImpersonationToken(user, token int, options ...OptionFunc) (*Response, error) {
- u := fmt.Sprintf("users/%d/impersonation_tokens/%d", user, token)
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}
-
-// UserActivity represents an entry in the user/activities response
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-user-activities-admin-only
-type UserActivity struct {
- Username string `json:"username"`
- LastActivityOn *ISOTime `json:"last_activity_on"`
-}
-
-// GetUserActivitiesOptions represents the options for GetUserActivities
-//
-// GitLap API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-user-activities-admin-only
-type GetUserActivitiesOptions struct {
- From *ISOTime `url:"from,omitempty" json:"from,omitempty"`
-}
-
-// GetUserActivities retrieves user activities (admin only)
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-user-activities-admin-only
-func (s *UsersService) GetUserActivities(opt *GetUserActivitiesOptions, options ...OptionFunc) ([]*UserActivity, *Response, error) {
- req, err := s.client.NewRequest("GET", "user/activities", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var t []*UserActivity
- resp, err := s.client.Do(req, &t)
- if err != nil {
- return nil, resp, err
- }
-
- return t, resp, err
-}
-
-// UserStatus represents the current status of a user
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#user-status
-type UserStatus struct {
- Emoji string `json:"emoji"`
- Message string `json:"message"`
- MessageHTML string `json:"message_html"`
-}
-
-// CurrentUserStatus retrieves the user status
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#user-status
-func (s *UsersService) CurrentUserStatus(options ...OptionFunc) (*UserStatus, *Response, error) {
- req, err := s.client.NewRequest("GET", "user/status", nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- status := new(UserStatus)
- resp, err := s.client.Do(req, status)
- if err != nil {
- return nil, resp, err
- }
-
- return status, resp, err
-}
-
-// GetUserStatus retrieves a user's status
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#get-the-status-of-a-user
-func (s *UsersService) GetUserStatus(user int, options ...OptionFunc) (*UserStatus, *Response, error) {
- u := fmt.Sprintf("users/%d/status", user)
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- status := new(UserStatus)
- resp, err := s.client.Do(req, status)
- if err != nil {
- return nil, resp, err
- }
-
- return status, resp, err
-}
-
-// UserStatusOptions represents the options required to set the status
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#set-user-status
-type UserStatusOptions struct {
- Emoji *string `url:"emoji,omitempty" json:"emoji,omitempty"`
- Message *string `url:"message,omitempty" json:"message,omitempty"`
-}
-
-// SetUserStatus sets the user's status
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/users.html#set-user-status
-func (s *UsersService) SetUserStatus(opt *UserStatusOptions, options ...OptionFunc) (*UserStatus, *Response, error) {
- req, err := s.client.NewRequest("PUT", "user/status", opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- status := new(UserStatus)
- resp, err := s.client.Do(req, status)
- if err != nil {
- return nil, resp, err
- }
-
- return status, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/validate.go b/vendor/github.com/xanzy/go-gitlab/validate.go
deleted file mode 100644
index a88e1884..00000000
--- a/vendor/github.com/xanzy/go-gitlab/validate.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package gitlab
-
-// ValidateService handles communication with the validation related methods of
-// the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/lint.html
-type ValidateService struct {
- client *Client
-}
-
-// LintResult represents the linting results.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/lint.html
-type LintResult struct {
- Status string `json:"status"`
- Errors []string `json:"errors"`
-}
-
-// Lint validates .gitlab-ci.yml content.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/lint.html
-func (s *ValidateService) Lint(content string, options ...OptionFunc) (*LintResult, *Response, error) {
- var opts struct {
- Content string `url:"content,omitempty" json:"content,omitempty"`
- }
- opts.Content = content
-
- req, err := s.client.NewRequest("POST", "ci/lint", &opts, options)
- if err != nil {
- return nil, nil, err
- }
-
- l := new(LintResult)
- resp, err := s.client.Do(req, l)
- if err != nil {
- return nil, resp, err
- }
-
- return l, resp, nil
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/version.go b/vendor/github.com/xanzy/go-gitlab/version.go
deleted file mode 100644
index f1a3a7f5..00000000
--- a/vendor/github.com/xanzy/go-gitlab/version.go
+++ /dev/null
@@ -1,56 +0,0 @@
-//
-// Copyright 2017, Andrea Funto'
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-package gitlab
-
-// VersionService handles communication with the GitLab server instance to
-// retrieve its version information via the GitLab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/version.md
-type VersionService struct {
- client *Client
-}
-
-// Version represents a GitLab instance version.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/version.md
-type Version struct {
- Version string `json:"version"`
- Revision string `json:"revision"`
-}
-
-func (s Version) String() string {
- return Stringify(s)
-}
-
-// GetVersion gets a GitLab server instance version; it is only available to
-// authenticated users.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/version.md
-func (s *VersionService) GetVersion() (*Version, *Response, error) {
- req, err := s.client.NewRequest("GET", "version", nil, nil)
- if err != nil {
- return nil, nil, err
- }
-
- v := new(Version)
- resp, err := s.client.Do(req, v)
- if err != nil {
- return nil, resp, err
- }
-
- return v, resp, err
-}
diff --git a/vendor/github.com/xanzy/go-gitlab/wikis.go b/vendor/github.com/xanzy/go-gitlab/wikis.go
deleted file mode 100644
index 06117212..00000000
--- a/vendor/github.com/xanzy/go-gitlab/wikis.go
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright 2017, Stany MARCEL
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package gitlab
-
-import (
- "fmt"
- "net/url"
-)
-
-// WikisService handles communication with the wikis related methods of
-// the Gitlab API.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/wikis.html
-type WikisService struct {
- client *Client
-}
-
-// WikiFormat represents the available wiki formats.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/wikis.html
-type WikiFormat string
-
-// The available wiki formats.
-const (
- WikiFormatMarkdown WikiFormat = "markdown"
- WikiFormatRFoc WikiFormat = "rdoc"
- WikiFormatASCIIDoc WikiFormat = "asciidoc"
-)
-
-// Wiki represents a GitLab wiki.
-//
-// GitLab API docs: https://docs.gitlab.com/ce/api/wikis.html
-type Wiki struct {
- Content string `json:"content"`
- Format WikiFormat `json:"format"`
- Slug string `json:"slug"`
- Title string `json:"title"`
-}
-
-func (w Wiki) String() string {
- return Stringify(w)
-}
-
-// ListWikisOptions represents the available ListWikis options.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#list-wiki-pages
-type ListWikisOptions struct {
- WithContent *bool `url:"with_content,omitempty" json:"with_content,omitempty"`
-}
-
-// ListWikis lists all pages of the wiki of the given project id.
-// When with_content is set, it also returns the content of the pages.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#list-wiki-pages
-func (s *WikisService) ListWikis(pid interface{}, opt *ListWikisOptions, options ...OptionFunc) ([]*Wiki, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/wikis", pathEscape(project))
-
- req, err := s.client.NewRequest("GET", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- var w []*Wiki
- resp, err := s.client.Do(req, &w)
- if err != nil {
- return nil, resp, err
- }
-
- return w, resp, err
-}
-
-// GetWikiPage gets a wiki page for a given project.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#get-a-wiki-page
-func (s *WikisService) GetWikiPage(pid interface{}, slug string, options ...OptionFunc) (*Wiki, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/wikis/%s", pathEscape(project), url.PathEscape(slug))
-
- req, err := s.client.NewRequest("GET", u, nil, options)
- if err != nil {
- return nil, nil, err
- }
-
- var w *Wiki
- resp, err := s.client.Do(req, &w)
- if err != nil {
- return nil, resp, err
- }
-
- return w, resp, err
-}
-
-// CreateWikiPageOptions represents options to CreateWikiPage.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#create-a-new-wiki-page
-type CreateWikiPageOptions struct {
- Content *string `url:"content" json:"content"`
- Title *string `url:"title" json:"title"`
- Format *string `url:"format,omitempty" json:"format,omitempty"`
-}
-
-// CreateWikiPage creates a new wiki page for the given repository with
-// the given title, slug, and content.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#create-a-new-wiki-page
-func (s *WikisService) CreateWikiPage(pid interface{}, opt *CreateWikiPageOptions, options ...OptionFunc) (*Wiki, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/wikis", pathEscape(project))
-
- req, err := s.client.NewRequest("POST", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- w := new(Wiki)
- resp, err := s.client.Do(req, w)
- if err != nil {
- return nil, resp, err
- }
-
- return w, resp, err
-}
-
-// EditWikiPageOptions represents options to EditWikiPage.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#edit-an-existing-wiki-page
-type EditWikiPageOptions struct {
- Content *string `url:"content" json:"content"`
- Title *string `url:"title" json:"title"`
- Format *string `url:"format,omitempty" json:"format,omitempty"`
-}
-
-// EditWikiPage Updates an existing wiki page. At least one parameter is
-// required to update the wiki page.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#edit-an-existing-wiki-page
-func (s *WikisService) EditWikiPage(pid interface{}, slug string, opt *EditWikiPageOptions, options ...OptionFunc) (*Wiki, *Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, nil, err
- }
- u := fmt.Sprintf("projects/%s/wikis/%s", pathEscape(project), url.PathEscape(slug))
-
- req, err := s.client.NewRequest("PUT", u, opt, options)
- if err != nil {
- return nil, nil, err
- }
-
- w := new(Wiki)
- resp, err := s.client.Do(req, w)
- if err != nil {
- return nil, resp, err
- }
-
- return w, resp, err
-}
-
-// DeleteWikiPage deletes a wiki page with a given slug.
-//
-// GitLab API docs:
-// https://docs.gitlab.com/ce/api/wikis.html#delete-a-wiki-page
-func (s *WikisService) DeleteWikiPage(pid interface{}, slug string, options ...OptionFunc) (*Response, error) {
- project, err := parseID(pid)
- if err != nil {
- return nil, err
- }
- u := fmt.Sprintf("projects/%s/wikis/%s", pathEscape(project), url.PathEscape(slug))
-
- req, err := s.client.NewRequest("DELETE", u, nil, options)
- if err != nil {
- return nil, err
- }
-
- return s.client.Do(req, nil)
-}