From 6d3bd33d7100bdd1bbd843e0ed23af0590e442a2 Mon Sep 17 00:00:00 2001 From: Matt Moore Date: Mon, 2 Jan 2023 12:08:32 -0800 Subject: [PATCH] Feature: Add support for verifying base image policies. :gift: This implements the very basics from my recent comment on #356. This still needs a bunch of work, but some playing with it and `go run` seem to demonstrate what I'd hope for. Things I'd like to do still: - Add validation that warns/errors if aspects of CIP irrelevant outside K8s are used (e.g. `match:`, `includeSpec:`), - Expand unit test coverage significantly, - Move `pkg/policy` upstream to `sigstore/policy-controller` to facilitate using this in other projects with similar ease (e.g. kaniko, buildpacks, ...) /kind feature --- .ko.yaml | 25 +- go.mod | 169 +- go.sum | 650 +- pkg/commands/config.go | 8 + pkg/commands/options/build.go | 52 +- pkg/policy/parse.go | 114 + pkg/policy/parse_test.go | 189 + pkg/policy/policy.go | 91 + pkg/policy/validate.go | 112 + pkg/policy/validate_test.go | 203 + pkg/policy/verifier.go | 147 + .../go/compute/internal/version.go | 2 +- .../go/compute/metadata/CHANGES.md | 7 + .../go/compute/metadata/metadata.go | 1 + .../exporter/ocagent/.gitignore | 17 + .../exporter/ocagent/.travis.yml | 20 + .../exporter/ocagent/CONTRIBUTING.md | 24 + .../exporter/ocagent/LICENSE | 201 + .../exporter/ocagent/README.md | 61 + .../exporter/ocagent/common.go | 38 + .../exporter/ocagent/connection.go | 113 + .../exporter/ocagent/nodeinfo.go | 46 + .../exporter/ocagent/ocagent.go | 581 + .../exporter/ocagent/options.go | 206 + .../exporter/ocagent/span_config.go | 25 + .../exporter/ocagent/transform_spans.go | 243 + .../ocagent/transform_stats_to_metrics.go | 278 + .../exporter/ocagent/version.go | 17 + .../exporter/prometheus/.gitignore | 1 + .../exporter/prometheus/.golangci.yml | 123 + .../exporter/prometheus/.travis.yml | 17 + .../exporter/prometheus/LICENSE | 201 + .../exporter/prometheus/Makefile | 50 + .../exporter/prometheus/README.md | 14 + .../exporter/prometheus/prometheus.go | 303 + .../exporter/prometheus/sanitize.go | 38 + vendor/cuelang.org/go/AUTHORS | 6 + vendor/cuelang.org/go/LICENSE | 202 + vendor/cuelang.org/go/cue/ast/ast.go | 1057 + .../cuelang.org/go/cue/ast/astutil/apply.go | 512 + vendor/cuelang.org/go/cue/ast/astutil/file.go | 38 + .../cuelang.org/go/cue/ast/astutil/resolve.go | 461 + .../go/cue/ast/astutil/sanitize.go | 354 + vendor/cuelang.org/go/cue/ast/astutil/util.go | 158 + vendor/cuelang.org/go/cue/ast/astutil/walk.go | 196 + vendor/cuelang.org/go/cue/ast/comments.go | 46 + vendor/cuelang.org/go/cue/ast/ident.go | 195 + vendor/cuelang.org/go/cue/ast/walk.go | 265 + vendor/cuelang.org/go/cue/attribute.go | 200 + vendor/cuelang.org/go/cue/build.go | 157 + vendor/cuelang.org/go/cue/build/context.go | 128 + vendor/cuelang.org/go/cue/build/doc.go | 16 + vendor/cuelang.org/go/cue/build/file.go | 86 + vendor/cuelang.org/go/cue/build/import.go | 170 + vendor/cuelang.org/go/cue/build/instance.go | 287 + vendor/cuelang.org/go/cue/builtin.go | 31 + vendor/cuelang.org/go/cue/builtinutil.go | 45 + vendor/cuelang.org/go/cue/context.go | 473 + vendor/cuelang.org/go/cue/cue.go | 43 + .../go/cue/cuecontext/cuecontext.go | 31 + vendor/cuelang.org/go/cue/decode.go | 943 + vendor/cuelang.org/go/cue/errors.go | 134 + vendor/cuelang.org/go/cue/errors/errors.go | 651 + vendor/cuelang.org/go/cue/format.go | 201 + vendor/cuelang.org/go/cue/format/format.go | 350 + vendor/cuelang.org/go/cue/format/import.go | 167 + vendor/cuelang.org/go/cue/format/node.go | 916 + vendor/cuelang.org/go/cue/format/printer.go | 424 + vendor/cuelang.org/go/cue/format/simplify.go | 113 + vendor/cuelang.org/go/cue/instance.go | 357 + vendor/cuelang.org/go/cue/literal/doc.go | 17 + vendor/cuelang.org/go/cue/literal/indent.go | 33 + vendor/cuelang.org/go/cue/literal/num.go | 357 + vendor/cuelang.org/go/cue/literal/quote.go | 370 + vendor/cuelang.org/go/cue/literal/string.go | 421 + vendor/cuelang.org/go/cue/marshal.go | 221 + vendor/cuelang.org/go/cue/op.go | 182 + vendor/cuelang.org/go/cue/parser/doc.go | 23 + vendor/cuelang.org/go/cue/parser/fuzz.go | 26 + vendor/cuelang.org/go/cue/parser/interface.go | 232 + vendor/cuelang.org/go/cue/parser/parser.go | 1669 + vendor/cuelang.org/go/cue/path.go | 520 + vendor/cuelang.org/go/cue/query.go | 84 + vendor/cuelang.org/go/cue/scanner/fuzz.go | 40 + vendor/cuelang.org/go/cue/scanner/scanner.go | 991 + vendor/cuelang.org/go/cue/token/position.go | 472 + vendor/cuelang.org/go/cue/token/token.go | 266 + vendor/cuelang.org/go/cue/types.go | 2536 + vendor/cuelang.org/go/encoding/json/json.go | 265 + .../go/internal/astinternal/debugstr.go | 281 + vendor/cuelang.org/go/internal/attrs.go | 252 + vendor/cuelang.org/go/internal/cli/cli.go | 91 + .../cuelang.org/go/internal/core/adt/adt.go | 380 + .../cuelang.org/go/internal/core/adt/binop.go | 321 + .../go/internal/core/adt/closed.go | 518 + .../go/internal/core/adt/closed2.go | 68 + .../go/internal/core/adt/composite.go | 838 + .../go/internal/core/adt/comprehension.go | 70 + .../go/internal/core/adt/context.go | 1283 + .../go/internal/core/adt/decimal.go | 131 + .../go/internal/core/adt/default.go | 132 + .../go/internal/core/adt/disjunct.go | 588 + .../cuelang.org/go/internal/core/adt/doc.go | 78 + .../go/internal/core/adt/equality.go | 192 + .../go/internal/core/adt/errors.go | 324 + .../cuelang.org/go/internal/core/adt/eval.go | 2173 + .../cuelang.org/go/internal/core/adt/expr.go | 1759 + .../go/internal/core/adt/feature.go | 324 + .../cuelang.org/go/internal/core/adt/kind.go | 184 + vendor/cuelang.org/go/internal/core/adt/op.go | 141 + .../go/internal/core/adt/optional.go | 137 + .../go/internal/core/adt/simplify.go | 223 + .../go/internal/core/compile/builtin.go | 203 + .../go/internal/core/compile/compile.go | 1062 + .../go/internal/core/compile/errors.go | 48 + .../go/internal/core/compile/label.go | 150 + .../go/internal/core/compile/predeclared.go | 169 + .../go/internal/core/convert/go.go | 817 + .../go/internal/core/debug/compact.go | 337 + .../go/internal/core/debug/debug.go | 533 + .../cuelang.org/go/internal/core/eval/eval.go | 66 + .../go/internal/core/export/adt.go | 493 + .../go/internal/core/export/bounds.go | 213 + .../go/internal/core/export/export.go | 565 + .../go/internal/core/export/expr.go | 510 + .../go/internal/core/export/extract.go | 202 + .../go/internal/core/export/label.go | 48 + .../go/internal/core/export/toposort.go | 190 + .../go/internal/core/export/value.go | 483 + .../go/internal/core/runtime/build.go | 150 + .../go/internal/core/runtime/errors.go | 52 + .../go/internal/core/runtime/go.go | 53 + .../go/internal/core/runtime/imports.go | 150 + .../go/internal/core/runtime/index.go | 93 + .../go/internal/core/runtime/resolve.go | 169 + .../go/internal/core/runtime/runtime.go | 57 + .../go/internal/core/subsume/structural.go | 280 + .../go/internal/core/subsume/subsume.go | 144 + .../go/internal/core/subsume/value.go | 311 + .../go/internal/core/subsume/vertex.go | 260 + .../go/internal/core/validate/validate.go | 112 + .../cuelang.org/go/internal/core/walk/walk.go | 191 + .../go/internal/encoding/yaml/encode.go | 379 + vendor/cuelang.org/go/internal/internal.go | 422 + .../cuelang.org/go/internal/source/source.go | 53 + vendor/cuelang.org/go/internal/task/task.go | 152 + .../go/internal/third_party/yaml/LICENSE | 201 + .../internal/third_party/yaml/LICENSE.libyaml | 31 + .../go/internal/third_party/yaml/METADATA | 15 + .../go/internal/third_party/yaml/NOTICE | 13 + .../go/internal/third_party/yaml/README.md | 11 + .../go/internal/third_party/yaml/apic.go | 740 + .../go/internal/third_party/yaml/decode.go | 776 + .../go/internal/third_party/yaml/parserc.go | 1101 + .../go/internal/third_party/yaml/readerc.go | 412 + .../go/internal/third_party/yaml/resolve.go | 256 + .../go/internal/third_party/yaml/scannerc.go | 2719 + .../go/internal/third_party/yaml/yaml.go | 369 + .../go/internal/third_party/yaml/yamlh.go | 752 + .../internal/third_party/yaml/yamlprivateh.go | 173 + vendor/cuelang.org/go/internal/types/value.go | 37 + vendor/cuelang.org/go/internal/value/value.go | 97 + .../go/pkg/crypto/ed25519/ed25519.go | 36 + .../cuelang.org/go/pkg/crypto/ed25519/pkg.go | 38 + vendor/cuelang.org/go/pkg/crypto/hmac/hmac.go | 77 + vendor/cuelang.org/go/pkg/crypto/hmac/pkg.go | 59 + vendor/cuelang.org/go/pkg/crypto/md5/md5.go | 33 + vendor/cuelang.org/go/pkg/crypto/md5/pkg.go | 39 + vendor/cuelang.org/go/pkg/crypto/sha1/pkg.go | 39 + vendor/cuelang.org/go/pkg/crypto/sha1/sha1.go | 33 + .../cuelang.org/go/pkg/crypto/sha256/pkg.go | 54 + .../go/pkg/crypto/sha256/sha256.go | 42 + .../cuelang.org/go/pkg/crypto/sha512/pkg.go | 84 + .../go/pkg/crypto/sha512/sha512.go | 63 + vendor/cuelang.org/go/pkg/doc.go | 38 + .../go/pkg/encoding/base64/manual.go | 62 + .../cuelang.org/go/pkg/encoding/base64/pkg.go | 73 + .../cuelang.org/go/pkg/encoding/csv/manual.go | 60 + vendor/cuelang.org/go/pkg/encoding/csv/pkg.go | 45 + vendor/cuelang.org/go/pkg/encoding/hex/hex.go | 51 + .../cuelang.org/go/pkg/encoding/hex/manual.go | 22 + vendor/cuelang.org/go/pkg/encoding/hex/pkg.go | 81 + .../cuelang.org/go/pkg/encoding/json/json.go | 28 + .../go/pkg/encoding/json/manual.go | 137 + .../cuelang.org/go/pkg/encoding/json/pkg.go | 132 + .../go/pkg/encoding/yaml/manual.go | 171 + .../cuelang.org/go/pkg/encoding/yaml/pkg.go | 95 + vendor/cuelang.org/go/pkg/html/html.go | 40 + vendor/cuelang.org/go/pkg/html/pkg.go | 45 + vendor/cuelang.org/go/pkg/internal/builtin.go | 241 + vendor/cuelang.org/go/pkg/internal/context.go | 329 + vendor/cuelang.org/go/pkg/internal/errors.go | 97 + .../cuelang.org/go/pkg/internal/register.go | 31 + vendor/cuelang.org/go/pkg/list/list.go | 254 + vendor/cuelang.org/go/pkg/list/math.go | 146 + vendor/cuelang.org/go/pkg/list/pkg.go | 309 + vendor/cuelang.org/go/pkg/list/sort.cue | 48 + vendor/cuelang.org/go/pkg/list/sort.go | 98 + vendor/cuelang.org/go/pkg/math/big.go | 56 + vendor/cuelang.org/go/pkg/math/bits/manual.go | 113 + vendor/cuelang.org/go/pkg/math/bits/pkg.go | 150 + vendor/cuelang.org/go/pkg/math/manual.go | 118 + vendor/cuelang.org/go/pkg/math/math.go | 559 + vendor/cuelang.org/go/pkg/math/pkg.go | 729 + vendor/cuelang.org/go/pkg/net/doc.go | 27 + vendor/cuelang.org/go/pkg/net/host.go | 106 + vendor/cuelang.org/go/pkg/net/ip.go | 231 + vendor/cuelang.org/go/pkg/net/pkg.go | 232 + vendor/cuelang.org/go/pkg/path/match.go | 245 + vendor/cuelang.org/go/pkg/path/os.go | 76 + vendor/cuelang.org/go/pkg/path/path.go | 411 + vendor/cuelang.org/go/pkg/path/path_nix.go | 74 + vendor/cuelang.org/go/pkg/path/path_p9.go | 72 + vendor/cuelang.org/go/pkg/path/path_win.go | 212 + vendor/cuelang.org/go/pkg/path/pkg.go | 270 + vendor/cuelang.org/go/pkg/regexp/manual.go | 225 + vendor/cuelang.org/go/pkg/regexp/pkg.go | 167 + vendor/cuelang.org/go/pkg/regexp/regexp.go | 37 + vendor/cuelang.org/go/pkg/register.go | 50 + vendor/cuelang.org/go/pkg/strconv/manual.go | 26 + vendor/cuelang.org/go/pkg/strconv/pkg.go | 263 + vendor/cuelang.org/go/pkg/strconv/strconv.go | 224 + vendor/cuelang.org/go/pkg/strings/manual.go | 120 + vendor/cuelang.org/go/pkg/strings/pkg.go | 462 + vendor/cuelang.org/go/pkg/strings/strings.go | 219 + vendor/cuelang.org/go/pkg/struct/pkg.go | 47 + vendor/cuelang.org/go/pkg/struct/struct.go | 58 + .../go/pkg/text/tabwriter/manual.go | 61 + .../cuelang.org/go/pkg/text/tabwriter/pkg.go | 33 + .../go/pkg/text/template/manual.go | 39 + .../cuelang.org/go/pkg/text/template/pkg.go | 58 + .../go/pkg/text/template/template.go | 33 + vendor/cuelang.org/go/pkg/time/duration.go | 75 + vendor/cuelang.org/go/pkg/time/pkg.go | 247 + vendor/cuelang.org/go/pkg/time/time.go | 244 + vendor/cuelang.org/go/pkg/tool/cli/cli.cue | 41 + vendor/cuelang.org/go/pkg/tool/cli/cli.go | 85 + vendor/cuelang.org/go/pkg/tool/cli/doc.go | 33 + vendor/cuelang.org/go/pkg/tool/cli/pkg.go | 32 + vendor/cuelang.org/go/pkg/tool/doc.go | 87 + vendor/cuelang.org/go/pkg/tool/exec/doc.go | 43 + vendor/cuelang.org/go/pkg/tool/exec/exec.cue | 51 + vendor/cuelang.org/go/pkg/tool/exec/exec.go | 172 + vendor/cuelang.org/go/pkg/tool/exec/pkg.go | 35 + vendor/cuelang.org/go/pkg/tool/file/doc.go | 128 + vendor/cuelang.org/go/pkg/tool/file/file.cue | 136 + vendor/cuelang.org/go/pkg/tool/file/file.go | 183 + vendor/cuelang.org/go/pkg/tool/file/pkg.go | 65 + vendor/cuelang.org/go/pkg/tool/generate.go | 18 + vendor/cuelang.org/go/pkg/tool/http/doc.go | 53 + vendor/cuelang.org/go/pkg/tool/http/http.cue | 61 + vendor/cuelang.org/go/pkg/tool/http/http.go | 167 + vendor/cuelang.org/go/pkg/tool/http/pkg.go | 64 + vendor/cuelang.org/go/pkg/tool/os/doc.go | 48 + vendor/cuelang.org/go/pkg/tool/os/env.go | 150 + vendor/cuelang.org/go/pkg/tool/os/os.cue | 56 + vendor/cuelang.org/go/pkg/tool/os/pkg.go | 46 + vendor/cuelang.org/go/pkg/tool/tool.cue | 80 + vendor/cuelang.org/go/pkg/uuid/pkg.go | 159 + vendor/cuelang.org/go/pkg/uuid/uuid.cue | 35 + vendor/cuelang.org/go/pkg/uuid/uuid.go | 121 + .../alibabacloudsdkgo/helper/LICENSE | 201 + .../alibabacloudsdkgo/helper/helper.go | 51 + .../Azure/azure-sdk-for-go/version/version.go | 2 +- vendor/github.com/OneOfOne/xxhash/.gitignore | 4 + vendor/github.com/OneOfOne/xxhash/.travis.yml | 13 + vendor/github.com/OneOfOne/xxhash/LICENSE | 187 + vendor/github.com/OneOfOne/xxhash/README.md | 74 + vendor/github.com/OneOfOne/xxhash/xxhash.go | 294 + .../github.com/OneOfOne/xxhash/xxhash_go17.go | 161 + .../github.com/OneOfOne/xxhash/xxhash_safe.go | 183 + .../OneOfOne/xxhash/xxhash_unsafe.go | 240 + .../ThalesIgnite/crypto11/.gitignore | 6 + .../ThalesIgnite/crypto11/.travis.yml | 27 + .../ThalesIgnite/crypto11/LICENCE.txt | 22 + .../ThalesIgnite/crypto11/README.md | 208 + .../github.com/ThalesIgnite/crypto11/aead.go | 189 + .../ThalesIgnite/crypto11/attributes.go | 510 + .../github.com/ThalesIgnite/crypto11/block.go | 91 + .../ThalesIgnite/crypto11/blockmode.go | 202 + .../ThalesIgnite/crypto11/certificates.go | 299 + .../ThalesIgnite/crypto11/common.go | 125 + .../github.com/ThalesIgnite/crypto11/config | 5 + .../ThalesIgnite/crypto11/crypto11.go | 485 + .../github.com/ThalesIgnite/crypto11/dsa.go | 175 + .../github.com/ThalesIgnite/crypto11/ecdsa.go | 302 + .../github.com/ThalesIgnite/crypto11/hmac.go | 215 + .../github.com/ThalesIgnite/crypto11/keys.go | 613 + .../github.com/ThalesIgnite/crypto11/rand.go | 54 + .../github.com/ThalesIgnite/crypto11/rsa.go | 325 + .../ThalesIgnite/crypto11/sessions.go | 88 + .../ThalesIgnite/crypto11/symmetric.go | 366 + .../agnivade/levenshtein/.gitignore | 5 + .../agnivade/levenshtein/.travis.yml | 23 + .../agnivade/levenshtein/License.txt | 21 + .../github.com/agnivade/levenshtein/Makefile | 15 + .../github.com/agnivade/levenshtein/README.md | 80 + .../agnivade/levenshtein/levenshtein.go | 89 + .../alibabacloud-gateway-spi/LICENSE | 201 + .../alibabacloud-gateway-spi/client/client.go | 305 + .../cr-20160607/client/client.go | 2513 + .../alibabacloud-go/cr-20181201/LICENSE | 201 + .../cr-20181201/client/client.go | 16031 ++++ .../alibabacloud-go/darabonba-openapi/LICENSE | 201 + .../darabonba-openapi/client/client.go | 1694 + .../github.com/alibabacloud-go/debug/LICENSE | 201 + .../alibabacloud-go/debug/debug/assert.go | 12 + .../alibabacloud-go/debug/debug/debug.go | 36 + .../alibabacloud-go/endpoint-util/LICENSE | 201 + .../endpoint-util/service/service.go | 41 + .../alibabacloud-go/openapi-util/LICENSE | 201 + .../openapi-util/service/service.go | 635 + .../alibabacloud-go/tea-utils/LICENSE | 201 + .../tea-utils/service/service.go | 468 + .../alibabacloud-go/tea-utils/service/util.go | 52 + .../tea-xml/service/service.go | 105 + vendor/github.com/alibabacloud-go/tea/LICENSE | 201 + .../alibabacloud-go/tea/tea/json_parser.go | 333 + .../github.com/alibabacloud-go/tea/tea/tea.go | 1158 + .../alibabacloud-go/tea/tea/trans.go | 491 + .../alibabacloud-go/tea/utils/assert.go | 64 + .../alibabacloud-go/tea/utils/logger.go | 109 + .../alibabacloud-go/tea/utils/progress.go | 60 + .../github.com/aliyun/credentials-go/LICENSE | 201 + .../credentials/access_key_credential.go | 41 + .../credentials/bearer_token_credential.go | 40 + .../credentials-go/credentials/credential.go | 401 + .../credentials/credential_updater.go | 25 + .../credentials/ecs_ram_role.go | 149 + .../credentials/env_provider.go | 47 + .../credentials/instance_provider.go | 28 + .../credentials/oidc_credential.go | 178 + .../credentials-go/credentials/oidc_token | 1 + .../credentials/profile_provider.go | 351 + .../credentials-go/credentials/provider.go | 13 + .../credentials/provider_chain.go | 32 + .../credentials/request/common_request.go | 63 + .../credentials/response/common_response.go | 53 + .../credentials/rsa_key_pair_credential.go | 145 + .../credentials/session_credential.go | 7 + .../credentials/sts_credential.go | 43 + .../credentials/sts_role_arn_credential.go | 163 + .../credentials/uri_credential.go | 125 + .../credentials/utils/runtime.go | 35 + .../credentials-go/credentials/utils/utils.go | 146 + .../github.com/aws/aws-sdk-go-v2/CHANGELOG.md | 877 + vendor/github.com/aws/aws-sdk-go-v2/Makefile | 1 + vendor/github.com/aws/aws-sdk-go-v2/README.md | 4 +- .../aws/aws-sdk-go-v2/aws/arn/arn.go | 92 + .../aws/aws-sdk-go-v2/aws/credential_cache.go | 6 + .../aws/aws-sdk-go-v2/aws/credentials.go | 39 + .../aws-sdk-go-v2/aws/go_module_metadata.go | 2 +- .../aws-sdk-go-v2/aws/signer/v4/middleware.go | 7 +- .../aws/aws-sdk-go-v2/config/CHANGELOG.md | 34 + .../config/go_module_metadata.go | 2 +- .../config/resolve_bearer_token.go | 15 +- .../config/resolve_credentials.go | 26 +- .../aws/aws-sdk-go-v2/config/shared_config.go | 124 +- .../aws-sdk-go-v2/credentials/CHANGELOG.md | 33 + .../credentials/go_module_metadata.go | 2 +- .../ssocreds/sso_credentials_provider.go | 42 +- .../feature/ec2/imds/CHANGELOG.md | 13 + .../feature/ec2/imds/api_client.go | 6 +- .../feature/ec2/imds/go_module_metadata.go | 2 +- .../feature/ec2/imds/request_middleware.go | 19 + .../internal/configsources/CHANGELOG.md | 12 + .../configsources/go_module_metadata.go | 2 +- .../internal/endpoints/v2/CHANGELOG.md | 12 + .../endpoints/v2/go_module_metadata.go | 2 +- .../aws-sdk-go-v2/internal/ini/CHANGELOG.md | 12 + .../internal/ini/go_module_metadata.go | 2 +- .../github.com/aws/aws-sdk-go-v2/modman.toml | 4 +- .../aws-sdk-go-v2/service/ecr/CHANGELOG.md | 60 + .../service/ecr/go_module_metadata.go | 2 +- .../ecr/internal/endpoints/endpoints.go | 8 + .../service/ecrpublic/CHANGELOG.md | 56 + .../service/ecrpublic/go_module_metadata.go | 2 +- .../internal/presigned-url/CHANGELOG.md | 12 + .../presigned-url/go_module_metadata.go | 2 +- .../aws-sdk-go-v2/service/sso/CHANGELOG.md | 12 + .../service/sso/go_module_metadata.go | 2 +- .../service/ssooidc/CHANGELOG.md | 12 + .../service/ssooidc/go_module_metadata.go | 2 +- .../aws-sdk-go-v2/service/sts/CHANGELOG.md | 29 + .../service/sts/api_op_AssumeRole.go | 111 +- .../service/sts/api_op_AssumeRoleWithSAML.go | 74 +- .../sts/api_op_AssumeRoleWithWebIdentity.go | 74 +- .../service/sts/api_op_GetFederationToken.go | 87 +- .../service/sts/go_module_metadata.go | 2 +- .../sts/internal/endpoints/endpoints.go | 9 + vendor/github.com/aws/smithy-go/CHANGELOG.md | 10 + vendor/github.com/aws/smithy-go/Makefile | 34 + vendor/github.com/aws/smithy-go/README.md | 2 +- .../aws/smithy-go/encoding/xml/doc.go | 2 +- .../aws/smithy-go/go_module_metadata.go | 2 +- vendor/github.com/beorn7/perks/LICENSE | 20 + .../beorn7/perks/quantile/exampledata.txt | 2388 + .../beorn7/perks/quantile/stream.go | 316 + vendor/github.com/blang/semver/.travis.yml | 21 + vendor/github.com/blang/semver/LICENSE | 22 + vendor/github.com/blang/semver/README.md | 194 + vendor/github.com/blang/semver/json.go | 23 + vendor/github.com/blang/semver/package.json | 17 + vendor/github.com/blang/semver/range.go | 416 + vendor/github.com/blang/semver/semver.go | 418 + vendor/github.com/blang/semver/sort.go | 28 + vendor/github.com/blang/semver/sql.go | 30 + .../github.com/blendle/zapdriver/.gitignore | 1 + vendor/github.com/blendle/zapdriver/LICENSE | 15 + vendor/github.com/blendle/zapdriver/README.md | 347 + vendor/github.com/blendle/zapdriver/config.go | 55 + vendor/github.com/blendle/zapdriver/core.go | 243 + .../github.com/blendle/zapdriver/encoder.go | 59 + vendor/github.com/blendle/zapdriver/http.go | 160 + vendor/github.com/blendle/zapdriver/label.go | 77 + vendor/github.com/blendle/zapdriver/logger.go | 39 + .../github.com/blendle/zapdriver/operation.go | 72 + vendor/github.com/blendle/zapdriver/report.go | 70 + .../github.com/blendle/zapdriver/service.go | 36 + vendor/github.com/blendle/zapdriver/source.go | 66 + vendor/github.com/blendle/zapdriver/trace.go | 24 + .../opencensus-proto/AUTHORS | 1 + .../opencensus-proto/LICENSE | 202 + .../gen-go/agent/common/v1/common.pb.go | 570 + .../agent/metrics/v1/metrics_service.pb.go | 410 + .../agent/metrics/v1/metrics_service.pb.gw.go | 160 + .../gen-go/agent/trace/v1/trace_service.pb.go | 664 + .../agent/trace/v1/trace_service.pb.gw.go | 160 + .../gen-go/metrics/v1/metrics.pb.go | 1632 + .../gen-go/resource/v1/resource.pb.go | 189 + .../gen-go/trace/v1/trace.pb.go | 2235 + .../gen-go/trace/v1/trace_config.pb.go | 555 + .../github.com/cespare/xxhash/v2/LICENSE.txt | 22 + vendor/github.com/cespare/xxhash/v2/README.md | 69 + vendor/github.com/cespare/xxhash/v2/xxhash.go | 235 + .../cespare/xxhash/v2/xxhash_amd64.go | 13 + .../cespare/xxhash/v2/xxhash_amd64.s | 215 + .../cespare/xxhash/v2/xxhash_other.go | 76 + .../cespare/xxhash/v2/xxhash_safe.go | 15 + .../cespare/xxhash/v2/xxhash_unsafe.go | 57 + .../pkg/token/token.go | 10 +- .../github.com/clbanning/mxj/v2/.travis.yml | 4 + vendor/github.com/clbanning/mxj/v2/LICENSE | 22 + vendor/github.com/clbanning/mxj/v2/anyxml.go | 201 + .../clbanning/mxj/v2/atomFeedString.xml | 54 + vendor/github.com/clbanning/mxj/v2/doc.go | 138 + .../clbanning/mxj/v2/escapechars.go | 93 + vendor/github.com/clbanning/mxj/v2/exists.go | 9 + vendor/github.com/clbanning/mxj/v2/files.go | 287 + .../clbanning/mxj/v2/files_test.badjson | 2 + .../clbanning/mxj/v2/files_test.badxml | 9 + .../clbanning/mxj/v2/files_test.json | 2 + .../clbanning/mxj/v2/files_test.xml | 9 + .../clbanning/mxj/v2/files_test_dup.json | 1 + .../clbanning/mxj/v2/files_test_dup.xml | 1 + .../clbanning/mxj/v2/files_test_indent.json | 12 + .../clbanning/mxj/v2/files_test_indent.xml | 8 + vendor/github.com/clbanning/mxj/v2/gob.go | 35 + vendor/github.com/clbanning/mxj/v2/json.go | 323 + .../github.com/clbanning/mxj/v2/keyvalues.go | 668 + .../github.com/clbanning/mxj/v2/leafnode.go | 112 + vendor/github.com/clbanning/mxj/v2/misc.go | 86 + vendor/github.com/clbanning/mxj/v2/mxj.go | 128 + vendor/github.com/clbanning/mxj/v2/newmap.go | 184 + vendor/github.com/clbanning/mxj/v2/readme.md | 207 + vendor/github.com/clbanning/mxj/v2/remove.go | 37 + vendor/github.com/clbanning/mxj/v2/rename.go | 61 + vendor/github.com/clbanning/mxj/v2/set.go | 26 + .../clbanning/mxj/v2/setfieldsep.go | 20 + .../github.com/clbanning/mxj/v2/songtext.xml | 29 + vendor/github.com/clbanning/mxj/v2/strict.go | 30 + vendor/github.com/clbanning/mxj/v2/struct.go | 54 + .../clbanning/mxj/v2/updatevalues.go | 258 + vendor/github.com/clbanning/mxj/v2/xml.go | 1414 + vendor/github.com/clbanning/mxj/v2/xmlseq.go | 877 + vendor/github.com/clbanning/mxj/v2/xmlseq2.go | 18 + .../github.com/cockroachdb/apd/v2/.travis.yml | 7 + vendor/github.com/cockroachdb/apd/v2/LICENSE | 202 + .../github.com/cockroachdb/apd/v2/README.md | 25 + .../cockroachdb/apd/v2/condition.go | 166 + vendor/github.com/cockroachdb/apd/v2/const.go | 122 + .../github.com/cockroachdb/apd/v2/context.go | 1282 + .../github.com/cockroachdb/apd/v2/decimal.go | 835 + vendor/github.com/cockroachdb/apd/v2/doc.go | 74 + vendor/github.com/cockroachdb/apd/v2/error.go | 188 + .../cockroachdb/apd/v2/form_string.go | 16 + .../github.com/cockroachdb/apd/v2/format.go | 208 + vendor/github.com/cockroachdb/apd/v2/loop.go | 89 + vendor/github.com/cockroachdb/apd/v2/round.go | 192 + vendor/github.com/cockroachdb/apd/v2/table.go | 138 + .../common-nighthawk/go-figure/.travis.yml | 1 + .../common-nighthawk/go-figure/LICENSE | 21 + .../common-nighthawk/go-figure/README.md | 437 + .../common-nighthawk/go-figure/bindata.go | 3641 + .../go-figure/figlet-parser.go | 52 + .../common-nighthawk/go-figure/figure.go | 80 + .../common-nighthawk/go-figure/font.go | 112 + .../go-figure/public_methods.go | 108 + .../cyberphone/json-canonicalization/LICENSE | 13 + .../webpki.org/jsoncanonicalizer/es6numfmt.go | 71 + .../jsoncanonicalizer/jsoncanonicalizer.go | 378 + vendor/github.com/davecgh/go-spew/LICENSE | 15 + .../github.com/davecgh/go-spew/spew/bypass.go | 145 + .../davecgh/go-spew/spew/bypasssafe.go | 38 + .../github.com/davecgh/go-spew/spew/common.go | 341 + .../github.com/davecgh/go-spew/spew/config.go | 306 + vendor/github.com/davecgh/go-spew/spew/doc.go | 211 + .../github.com/davecgh/go-spew/spew/dump.go | 509 + .../github.com/davecgh/go-spew/spew/format.go | 419 + .../github.com/davecgh/go-spew/spew/spew.go | 148 + .../emicklei/go-restful/v3/.gitignore | 71 + .../emicklei/go-restful/v3/.goconvey | 1 + .../emicklei/go-restful/v3/.travis.yml | 13 + .../emicklei/go-restful/v3/CHANGES.md | 376 + .../github.com/emicklei/go-restful/v3/LICENSE | 22 + .../emicklei/go-restful/v3/Makefile | 8 + .../emicklei/go-restful/v3/README.md | 111 + .../emicklei/go-restful/v3/SECURITY.md | 13 + .../github.com/emicklei/go-restful/v3/Srcfile | 1 + .../emicklei/go-restful/v3/bench_test.sh | 10 + .../emicklei/go-restful/v3/compress.go | 127 + .../go-restful/v3/compressor_cache.go | 103 + .../go-restful/v3/compressor_pools.go | 91 + .../emicklei/go-restful/v3/compressors.go | 54 + .../emicklei/go-restful/v3/constants.go | 30 + .../emicklei/go-restful/v3/container.go | 450 + .../emicklei/go-restful/v3/cors_filter.go | 193 + .../emicklei/go-restful/v3/coverage.sh | 2 + .../emicklei/go-restful/v3/curly.go | 173 + .../emicklei/go-restful/v3/curly_route.go | 54 + .../emicklei/go-restful/v3/custom_verb.go | 29 + .../github.com/emicklei/go-restful/v3/doc.go | 185 + .../go-restful/v3/entity_accessors.go | 162 + .../emicklei/go-restful/v3/extensions.go | 21 + .../emicklei/go-restful/v3/filter.go | 37 + .../emicklei/go-restful/v3/filter_adapter.go | 21 + .../github.com/emicklei/go-restful/v3/json.go | 11 + .../emicklei/go-restful/v3/jsoniter.go | 12 + .../emicklei/go-restful/v3/jsr311.go | 326 + .../emicklei/go-restful/v3/log/log.go | 34 + .../emicklei/go-restful/v3/logger.go | 32 + .../github.com/emicklei/go-restful/v3/mime.go | 50 + .../emicklei/go-restful/v3/options_filter.go | 34 + .../emicklei/go-restful/v3/parameter.go | 242 + .../emicklei/go-restful/v3/path_expression.go | 74 + .../emicklei/go-restful/v3/path_processor.go | 74 + .../emicklei/go-restful/v3/request.go | 132 + .../emicklei/go-restful/v3/response.go | 256 + .../emicklei/go-restful/v3/route.go | 178 + .../emicklei/go-restful/v3/route_builder.go | 376 + .../emicklei/go-restful/v3/route_reader.go | 66 + .../emicklei/go-restful/v3/router.go | 20 + .../emicklei/go-restful/v3/service_error.go | 32 + .../emicklei/go-restful/v3/web_service.go | 305 + .../go-restful/v3/web_service_container.go | 39 + vendor/github.com/ghodss/yaml/.gitignore | 20 + vendor/github.com/ghodss/yaml/.travis.yml | 7 + vendor/github.com/ghodss/yaml/LICENSE | 50 + vendor/github.com/ghodss/yaml/README.md | 121 + vendor/github.com/ghodss/yaml/fields.go | 501 + vendor/github.com/ghodss/yaml/yaml.go | 277 + vendor/github.com/go-chi/chi/.gitignore | 3 + vendor/github.com/go-chi/chi/.travis.yml | 20 + vendor/github.com/go-chi/chi/CHANGELOG.md | 190 + vendor/github.com/go-chi/chi/CONTRIBUTING.md | 31 + vendor/github.com/go-chi/chi/LICENSE | 20 + vendor/github.com/go-chi/chi/README.md | 441 + vendor/github.com/go-chi/chi/chain.go | 49 + vendor/github.com/go-chi/chi/chi.go | 134 + vendor/github.com/go-chi/chi/context.go | 172 + .../go-chi/chi/middleware/basic_auth.go | 32 + .../go-chi/chi/middleware/compress.go | 399 + .../go-chi/chi/middleware/content_charset.go | 51 + .../go-chi/chi/middleware/content_encoding.go | 34 + .../go-chi/chi/middleware/content_type.go | 51 + .../go-chi/chi/middleware/get_head.go | 39 + .../go-chi/chi/middleware/heartbeat.go | 26 + .../go-chi/chi/middleware/logger.go | 155 + .../go-chi/chi/middleware/middleware.go | 23 + .../go-chi/chi/middleware/nocache.go | 58 + .../go-chi/chi/middleware/profiler.go | 55 + .../go-chi/chi/middleware/realip.go | 54 + .../go-chi/chi/middleware/recoverer.go | 192 + .../go-chi/chi/middleware/request_id.go | 96 + .../go-chi/chi/middleware/route_headers.go | 160 + .../github.com/go-chi/chi/middleware/strip.go | 56 + .../go-chi/chi/middleware/terminal.go | 63 + .../go-chi/chi/middleware/throttle.go | 132 + .../go-chi/chi/middleware/timeout.go | 49 + .../go-chi/chi/middleware/url_format.go | 72 + .../github.com/go-chi/chi/middleware/value.go | 17 + .../go-chi/chi/middleware/wrap_writer.go | 180 + vendor/github.com/go-chi/chi/mux.go | 466 + vendor/github.com/go-chi/chi/tree.go | 865 + vendor/github.com/go-kit/log/.gitignore | 15 + vendor/github.com/go-kit/log/LICENSE | 21 + vendor/github.com/go-kit/log/README.md | 156 + vendor/github.com/go-kit/log/doc.go | 116 + vendor/github.com/go-kit/log/json_logger.go | 91 + vendor/github.com/go-kit/log/level/doc.go | 33 + vendor/github.com/go-kit/log/level/level.go | 256 + vendor/github.com/go-kit/log/log.go | 179 + vendor/github.com/go-kit/log/logfmt_logger.go | 62 + vendor/github.com/go-kit/log/nop_logger.go | 8 + vendor/github.com/go-kit/log/staticcheck.conf | 1 + vendor/github.com/go-kit/log/stdlib.go | 151 + vendor/github.com/go-kit/log/sync.go | 113 + vendor/github.com/go-kit/log/value.go | 110 + vendor/github.com/go-logfmt/logfmt/.gitignore | 1 + .../github.com/go-logfmt/logfmt/CHANGELOG.md | 48 + vendor/github.com/go-logfmt/logfmt/LICENSE | 22 + vendor/github.com/go-logfmt/logfmt/README.md | 33 + vendor/github.com/go-logfmt/logfmt/decode.go | 237 + vendor/github.com/go-logfmt/logfmt/doc.go | 6 + vendor/github.com/go-logfmt/logfmt/encode.go | 322 + .../github.com/go-logfmt/logfmt/jsonstring.go | 277 + .../go-openapi/runtime/client/auth_info.go | 77 + .../go-openapi/runtime/client/keepalive.go | 56 + .../go-openapi/runtime/client/opentracing.go | 99 + .../go-openapi/runtime/client/request.go | 474 + .../go-openapi/runtime/client/response.go | 50 + .../go-openapi/runtime/client/runtime.go | 531 + .../go-openapi/runtime/logger/logger.go | 20 + .../go-openapi/runtime/logger/standard.go | 22 + .../go-openapi/runtime/middleware/context.go | 624 + .../runtime/middleware/denco/LICENSE | 19 + .../runtime/middleware/denco/README.md | 180 + .../runtime/middleware/denco/router.go | 460 + .../runtime/middleware/denco/server.go | 106 + .../runtime/middleware/denco/util.go | 12 + .../go-openapi/runtime/middleware/doc.go | 62 + .../go-openapi/runtime/middleware/go18.go | 9 + .../runtime/middleware/header/header.go | 329 + .../runtime/middleware/negotiate.go | 98 + .../runtime/middleware/not_implemented.go | 67 + .../runtime/middleware/operation.go | 30 + .../runtime/middleware/parameter.go | 485 + .../go-openapi/runtime/middleware/pre_go18.go | 9 + .../go-openapi/runtime/middleware/rapidoc.go | 90 + .../go-openapi/runtime/middleware/redoc.go | 103 + .../go-openapi/runtime/middleware/request.go | 104 + .../go-openapi/runtime/middleware/router.go | 488 + .../go-openapi/runtime/middleware/security.go | 39 + .../go-openapi/runtime/middleware/spec.go | 48 + .../runtime/middleware/swaggerui.go | 162 + .../runtime/middleware/untyped/api.go | 286 + .../runtime/middleware/validation.go | 126 + .../runtime/security/authenticator.go | 276 + .../go-openapi/runtime/security/authorizer.go | 27 + .../go-openapi/runtime/yamlpc/yaml.go | 40 + .../go-playground/locales/.gitignore | 24 + .../go-playground/locales/.travis.yml | 26 + .../github.com/go-playground/locales/LICENSE | 21 + .../go-playground/locales/README.md | 172 + .../locales/currency/currency.go | 311 + .../github.com/go-playground/locales/logo.png | Bin 0 -> 37360 bytes .../github.com/go-playground/locales/rules.go | 293 + .../universal-translator/.gitignore | 25 + .../universal-translator/.travis.yml | 27 + .../universal-translator/LICENSE | 21 + .../universal-translator/Makefile | 18 + .../universal-translator/README.md | 89 + .../universal-translator/errors.go | 148 + .../universal-translator/import_export.go | 276 + .../universal-translator/logo.png | Bin 0 -> 16598 bytes .../universal-translator/translator.go | 420 + .../universal_translator.go | 113 + .../go-playground/validator/v10/.gitignore | 30 + .../go-playground/validator/v10/LICENSE | 22 + .../validator/v10/MAINTAINERS.md | 16 + .../go-playground/validator/v10/Makefile | 18 + .../go-playground/validator/v10/README.md | 338 + .../go-playground/validator/v10/baked_in.go | 2526 + .../go-playground/validator/v10/cache.go | 327 + .../validator/v10/country_codes.go | 1132 + .../validator/v10/currency_codes.go | 79 + .../go-playground/validator/v10/doc.go | 1401 + .../go-playground/validator/v10/errors.go | 275 + .../validator/v10/field_level.go | 120 + .../go-playground/validator/v10/logo.png | Bin 0 -> 13443 bytes .../validator/v10/postcode_regexes.go | 173 + .../go-playground/validator/v10/regexes.go | 131 + .../validator/v10/struct_level.go | 175 + .../validator/v10/translations.go | 11 + .../go-playground/validator/v10/util.go | 288 + .../go-playground/validator/v10/validator.go | 486 + .../validator/v10/validator_instance.go | 699 + vendor/github.com/gobwas/glob/.gitignore | 8 + vendor/github.com/gobwas/glob/.travis.yml | 9 + vendor/github.com/gobwas/glob/LICENSE | 21 + vendor/github.com/gobwas/glob/bench.sh | 26 + .../gobwas/glob/compiler/compiler.go | 525 + vendor/github.com/gobwas/glob/glob.go | 80 + vendor/github.com/gobwas/glob/match/any.go | 45 + vendor/github.com/gobwas/glob/match/any_of.go | 82 + vendor/github.com/gobwas/glob/match/btree.go | 146 + .../github.com/gobwas/glob/match/contains.go | 58 + .../github.com/gobwas/glob/match/every_of.go | 99 + vendor/github.com/gobwas/glob/match/list.go | 49 + vendor/github.com/gobwas/glob/match/match.go | 81 + vendor/github.com/gobwas/glob/match/max.go | 49 + vendor/github.com/gobwas/glob/match/min.go | 57 + .../github.com/gobwas/glob/match/nothing.go | 27 + vendor/github.com/gobwas/glob/match/prefix.go | 50 + .../gobwas/glob/match/prefix_any.go | 55 + .../gobwas/glob/match/prefix_suffix.go | 62 + vendor/github.com/gobwas/glob/match/range.go | 48 + vendor/github.com/gobwas/glob/match/row.go | 77 + .../github.com/gobwas/glob/match/segments.go | 91 + vendor/github.com/gobwas/glob/match/single.go | 43 + vendor/github.com/gobwas/glob/match/suffix.go | 35 + .../gobwas/glob/match/suffix_any.go | 43 + vendor/github.com/gobwas/glob/match/super.go | 33 + vendor/github.com/gobwas/glob/match/text.go | 45 + vendor/github.com/gobwas/glob/readme.md | 148 + .../github.com/gobwas/glob/syntax/ast/ast.go | 122 + .../gobwas/glob/syntax/ast/parser.go | 157 + .../gobwas/glob/syntax/lexer/lexer.go | 273 + .../gobwas/glob/syntax/lexer/token.go | 88 + .../github.com/gobwas/glob/syntax/syntax.go | 14 + .../gobwas/glob/util/runes/runes.go | 154 + .../gobwas/glob/util/strings/strings.go | 39 + .../gogo/protobuf/sortkeys/sortkeys.go | 101 + vendor/github.com/golang/groupcache/LICENSE | 191 + .../github.com/golang/groupcache/lru/lru.go | 133 + vendor/github.com/golang/snappy/.gitignore | 16 + vendor/github.com/golang/snappy/AUTHORS | 18 + vendor/github.com/golang/snappy/CONTRIBUTORS | 41 + vendor/github.com/golang/snappy/LICENSE | 27 + vendor/github.com/golang/snappy/README | 107 + vendor/github.com/golang/snappy/decode.go | 264 + .../github.com/golang/snappy/decode_amd64.s | 490 + .../github.com/golang/snappy/decode_arm64.s | 494 + vendor/github.com/golang/snappy/decode_asm.go | 15 + .../github.com/golang/snappy/decode_other.go | 115 + vendor/github.com/golang/snappy/encode.go | 289 + .../github.com/golang/snappy/encode_amd64.s | 730 + .../github.com/golang/snappy/encode_arm64.s | 722 + vendor/github.com/golang/snappy/encode_asm.go | 30 + .../github.com/golang/snappy/encode_other.go | 238 + vendor/github.com/golang/snappy/snappy.go | 98 + .../certificate-transparency-go/.gitignore | 28 + .../.golangci.yaml | 38 + .../certificate-transparency-go/AUTHORS | 27 + .../certificate-transparency-go/CHANGELOG.md | 586 + .../certificate-transparency-go/CODEOWNERS | 1 + .../CONTRIBUTING.md | 58 + .../certificate-transparency-go/CONTRIBUTORS | 60 + .../certificate-transparency-go/LICENSE | 202 + .../PULL_REQUEST_TEMPLATE.md | 16 + .../certificate-transparency-go/README.md | 120 + .../asn1/README.md | 7 + .../certificate-transparency-go/asn1/asn1.go | 1195 + .../asn1/common.go | 187 + .../asn1/marshal.go | 691 + .../cloudbuild.yaml | 201 + .../cloudbuild_master.yaml | 217 + .../cloudbuild_tag.yaml | 167 + .../certificate-transparency-go/codecov.yml | 19 + .../gossip/minimal/x509ext/x509ext.go | 92 + .../certificate-transparency-go/proto_gen.go | 25 + .../serialization.go | 317 + .../certificate-transparency-go/signatures.go | 110 + .../tls/signature.go | 152 + .../certificate-transparency-go/tls/tls.go | 711 + .../certificate-transparency-go/tls/types.go | 117 + .../certificate-transparency-go/types.go | 576 + .../x509/README.md | 7 + .../x509/cert_pool.go | 159 + .../x509/curves.go | 37 + .../certificate-transparency-go/x509/error.go | 236 + .../x509/errors.go | 302 + .../certificate-transparency-go/x509/names.go | 165 + .../x509/pem_decrypt.go | 240 + .../certificate-transparency-go/x509/pkcs1.go | 174 + .../certificate-transparency-go/x509/pkcs8.go | 139 + .../x509/pkix/pkix.go | 286 + .../x509/ptr_sysptr_windows.go | 21 + .../x509/ptr_uint_windows.go | 18 + .../x509/revoked.go | 365 + .../certificate-transparency-go/x509/root.go | 25 + .../x509/root_bsd.go | 16 + .../x509/root_cgo_darwin.go | 315 + .../x509/root_darwin.go | 288 + .../x509/root_darwin_armx.go | 4314 + .../x509/root_js.go | 19 + .../x509/root_linux.go | 15 + .../x509/root_nocgo_darwin.go | 12 + .../x509/root_plan9.go | 40 + .../x509/root_solaris.go | 12 + .../x509/root_unix.go | 88 + .../x509/root_windows.go | 286 + .../certificate-transparency-go/x509/rpki.go | 242 + .../certificate-transparency-go/x509/sec1.go | 127 + .../x509/test-dir.crt | 31 + .../x509/test-file.crt | 32 + .../x509/verify.go | 1109 + .../certificate-transparency-go/x509/x509.go | 3291 + .../x509util/files.go | 116 + .../x509util/fuzz.go | 26 + .../x509util/pem_cert_pool.go | 120 + .../x509util/revoked.go | 169 + .../x509util/x509util.go | 900 + vendor/github.com/google/gnostic/LICENSE | 203 + .../google/gnostic/compiler/README.md | 4 + .../google/gnostic/compiler/context.go | 49 + .../google/gnostic/compiler/error.go | 70 + .../google/gnostic/compiler/extensions.go | 86 + .../google/gnostic/compiler/helpers.go | 397 + .../google/gnostic/compiler/main.go | 16 + .../google/gnostic/compiler/reader.go | 307 + .../google/gnostic/extensions/README.md | 13 + .../google/gnostic/extensions/extension.pb.go | 461 + .../google/gnostic/extensions/extension.proto | 97 + .../google/gnostic/extensions/extensions.go | 64 + .../google/gnostic/jsonschema/README.md | 4 + .../google/gnostic/jsonschema/base.go | 84 + .../google/gnostic/jsonschema/display.go | 244 + .../google/gnostic/jsonschema/models.go | 230 + .../google/gnostic/jsonschema/operations.go | 394 + .../google/gnostic/jsonschema/reader.go | 441 + .../google/gnostic/jsonschema/schema.json | 150 + .../google/gnostic/jsonschema/writer.go | 393 + .../google/gnostic/openapiv2/OpenAPIv2.go | 8825 ++ .../google/gnostic/openapiv2/OpenAPIv2.pb.go | 7342 ++ .../google/gnostic/openapiv2/OpenAPIv2.proto | 666 + .../google/gnostic/openapiv2/README.md | 14 + .../google/gnostic/openapiv2/document.go | 42 + .../google/gnostic/openapiv2/openapi-2.0.json | 1610 + .../google/gnostic/openapiv3/OpenAPIv3.go | 8638 ++ .../google/gnostic/openapiv3/OpenAPIv3.pb.go | 8054 ++ .../google/gnostic/openapiv3/OpenAPIv3.proto | 672 + .../google/gnostic/openapiv3/README.md | 25 + .../gnostic/openapiv3/annotations.pb.go | 183 + .../gnostic/openapiv3/annotations.proto | 60 + .../google/gnostic/openapiv3/document.go | 42 + .../google/gnostic/openapiv3/openapi-3.0.json | 1251 + .../google/gnostic/openapiv3/openapi-3.1.json | 1250 + .../pkg/authn/k8schain/LICENSE | 202 + .../pkg/authn/k8schain/README.md | 49 + .../pkg/authn/k8schain/doc.go | 18 + .../pkg/authn/k8schain/k8schain.go | 105 + .../pkg/authn/kubernetes/LICENSE | 202 + .../pkg/authn/kubernetes/keychain.go | 312 + .../github.com/google/go-github/v45/AUTHORS | 357 + .../github.com/google/go-github/v45/LICENSE | 27 + .../google/go-github/v45/github/actions.go | 12 + .../go-github/v45/github/actions_artifacts.go | 139 + .../v45/github/actions_runner_groups.go | 302 + .../go-github/v45/github/actions_runners.go | 377 + .../go-github/v45/github/actions_secrets.go | 358 + .../v45/github/actions_workflow_jobs.go | 129 + .../v45/github/actions_workflow_runs.go | 323 + .../go-github/v45/github/actions_workflows.go | 218 + .../google/go-github/v45/github/activity.go | 72 + .../go-github/v45/github/activity_events.go | 217 + .../v45/github/activity_notifications.go | 223 + .../go-github/v45/github/activity_star.go | 141 + .../go-github/v45/github/activity_watching.go | 147 + .../google/go-github/v45/github/admin.go | 119 + .../google/go-github/v45/github/admin_orgs.go | 89 + .../go-github/v45/github/admin_stats.go | 171 + .../go-github/v45/github/admin_users.go | 133 + .../google/go-github/v45/github/apps.go | 356 + .../google/go-github/v45/github/apps_hooks.go | 48 + .../v45/github/apps_hooks_deliveries.go | 72 + .../go-github/v45/github/apps_installation.go | 128 + .../go-github/v45/github/apps_manifest.go | 49 + .../go-github/v45/github/apps_marketplace.go | 180 + .../go-github/v45/github/authorizations.go | 281 + .../google/go-github/v45/github/billing.go | 199 + .../google/go-github/v45/github/checks.go | 451 + .../go-github/v45/github/code-scanning.go | 334 + .../google/go-github/v45/github/dependabot.go | 12 + .../v45/github/dependabot_secrets.go | 228 + .../google/go-github/v45/github/doc.go | 213 + .../google/go-github/v45/github/enterprise.go | 12 + .../v45/github/enterprise_actions_runners.go | 69 + .../v45/github/enterprise_audit_log.go | 35 + .../google/go-github/v45/github/event.go | 158 + .../go-github/v45/github/event_types.go | 1361 + .../google/go-github/v45/github/gists.go | 368 + .../go-github/v45/github/gists_comments.go | 119 + .../google/go-github/v45/github/git.go | 12 + .../google/go-github/v45/github/git_blobs.go | 82 + .../go-github/v45/github/git_commits.go | 200 + .../google/go-github/v45/github/git_refs.go | 175 + .../google/go-github/v45/github/git_tags.go | 84 + .../google/go-github/v45/github/git_trees.go | 162 + .../go-github/v45/github/github-accessors.go | 20143 +++++ .../google/go-github/v45/github/github.go | 1366 + .../google/go-github/v45/github/gitignore.go | 64 + .../go-github/v45/github/interactions.go | 28 + .../go-github/v45/github/interactions_orgs.go | 80 + .../v45/github/interactions_repos.go | 80 + .../go-github/v45/github/issue_import.go | 152 + .../google/go-github/v45/github/issues.go | 358 + .../go-github/v45/github/issues_assignees.go | 95 + .../go-github/v45/github/issues_comments.go | 154 + .../go-github/v45/github/issues_events.go | 179 + .../go-github/v45/github/issues_labels.go | 231 + .../go-github/v45/github/issues_milestones.go | 148 + .../go-github/v45/github/issues_timeline.go | 188 + .../google/go-github/v45/github/licenses.go | 97 + .../google/go-github/v45/github/messages.go | 306 + .../google/go-github/v45/github/migrations.go | 228 + .../v45/github/migrations_source_import.go | 305 + .../go-github/v45/github/migrations_user.go | 214 + .../google/go-github/v45/github/misc.go | 271 + .../google/go-github/v45/github/orgs.go | 275 + .../v45/github/orgs_actions_allowed.go | 63 + .../v45/github/orgs_actions_permissions.go | 63 + .../go-github/v45/github/orgs_audit_log.go | 116 + .../go-github/v45/github/orgs_custom_roles.go | 46 + .../google/go-github/v45/github/orgs_hooks.go | 130 + .../v45/github/orgs_hooks_deliveries.go | 73 + .../go-github/v45/github/orgs_members.go | 391 + .../v45/github/orgs_outside_collaborators.go | 81 + .../go-github/v45/github/orgs_packages.go | 149 + .../go-github/v45/github/orgs_projects.go | 60 + .../v45/github/orgs_users_blocking.go | 91 + .../google/go-github/v45/github/packages.go | 143 + .../google/go-github/v45/github/projects.go | 596 + .../google/go-github/v45/github/pulls.go | 486 + .../go-github/v45/github/pulls_comments.go | 202 + .../go-github/v45/github/pulls_reviewers.go | 80 + .../go-github/v45/github/pulls_reviews.go | 312 + .../go-github/v45/github/pulls_threads.go | 17 + .../google/go-github/v45/github/reactions.go | 520 + .../google/go-github/v45/github/repos.go | 1676 + .../v45/github/repos_actions_allowed.go | 49 + .../v45/github/repos_actions_permissions.go | 62 + .../go-github/v45/github/repos_autolinks.go | 102 + .../v45/github/repos_collaborators.go | 159 + .../go-github/v45/github/repos_comments.go | 162 + .../go-github/v45/github/repos_commits.go | 312 + .../v45/github/repos_community_health.go | 62 + .../go-github/v45/github/repos_contents.go | 321 + .../go-github/v45/github/repos_deployments.go | 250 + .../v45/github/repos_environments.go | 201 + .../go-github/v45/github/repos_forks.go | 96 + .../go-github/v45/github/repos_hooks.go | 199 + .../v45/github/repos_hooks_deliveries.go | 136 + .../go-github/v45/github/repos_invitations.go | 89 + .../google/go-github/v45/github/repos_keys.go | 91 + .../go-github/v45/github/repos_merging.go | 72 + .../go-github/v45/github/repos_pages.go | 240 + .../v45/github/repos_prereceive_hooks.go | 110 + .../go-github/v45/github/repos_projects.go | 69 + .../go-github/v45/github/repos_releases.go | 441 + .../go-github/v45/github/repos_stats.go | 232 + .../go-github/v45/github/repos_statuses.go | 133 + .../go-github/v45/github/repos_traffic.go | 141 + .../google/go-github/v45/github/scim.go | 163 + .../google/go-github/v45/github/search.go | 327 + .../go-github/v45/github/secret_scanning.go | 232 + .../google/go-github/v45/github/strings.go | 96 + .../google/go-github/v45/github/teams.go | 973 + .../v45/github/teams_discussion_comments.go | 242 + .../go-github/v45/github/teams_discussions.go | 247 + .../go-github/v45/github/teams_members.go | 243 + .../google/go-github/v45/github/timestamp.go | 44 + .../google/go-github/v45/github/users.go | 277 + .../v45/github/users_administration.go | 72 + .../go-github/v45/github/users_blocking.go | 91 + .../go-github/v45/github/users_emails.go | 72 + .../go-github/v45/github/users_followers.go | 122 + .../go-github/v45/github/users_gpg_keys.go | 130 + .../google/go-github/v45/github/users_keys.go | 111 + .../go-github/v45/github/users_packages.go | 211 + .../go-github/v45/github/users_projects.go | 68 + .../go-github/v45/github/with_appengine.go | 21 + .../go-github/v45/github/without_appengine.go | 20 + .../github.com/google/go-querystring/LICENSE | 27 + .../google/go-querystring/query/encode.go | 357 + vendor/github.com/google/gofuzz/.travis.yml | 10 + .../github.com/google/gofuzz/CONTRIBUTING.md | 67 + vendor/github.com/google/gofuzz/LICENSE | 202 + vendor/github.com/google/gofuzz/README.md | 89 + .../google/gofuzz/bytesource/bytesource.go | 81 + vendor/github.com/google/gofuzz/doc.go | 18 + vendor/github.com/google/gofuzz/fuzz.go | 605 + vendor/github.com/google/trillian/.gitignore | 24 + .../github.com/google/trillian/.golangci.yaml | 37 + vendor/github.com/google/trillian/AUTHORS | 14 + vendor/github.com/google/trillian/BUILD.bazel | 55 + .../github.com/google/trillian/CHANGELOG.md | 1069 + vendor/github.com/google/trillian/CODEOWNERS | 21 + .../google/trillian/CONTRIBUTING.md | 58 + .../github.com/google/trillian/CONTRIBUTORS | 39 + vendor/github.com/google/trillian/LICENSE | 202 + .../google/trillian/PULL_REQUEST_TEMPLATE.md | 15 + vendor/github.com/google/trillian/README.md | 314 + .../google/trillian/cloudbuild.yaml | 187 + .../google/trillian/cloudbuild_master.yaml | 165 + .../google/trillian/cloudbuild_pr.yaml | 175 + .../google/trillian/cloudbuild_tag.yaml | 51 + vendor/github.com/google/trillian/codecov.yml | 22 + vendor/github.com/google/trillian/gen.go | 21 + .../github.com/google/trillian/trillian.pb.go | 800 + .../github.com/google/trillian/trillian.proto | 235 + .../google/trillian/trillian_admin_api.pb.go | 621 + .../google/trillian/trillian_admin_api.proto | 107 + .../trillian/trillian_admin_api_grpc.pb.go | 311 + .../google/trillian/trillian_log_api.pb.go | 2070 + .../google/trillian/trillian_log_api.proto | 363 + .../trillian/trillian_log_api_grpc.pb.go | 461 + .../google/trillian/types/internal/tls/tls.go | 713 + .../google/trillian/types/logroot.go | 102 + vendor/github.com/google/uuid/.travis.yml | 9 + vendor/github.com/google/uuid/CONTRIBUTING.md | 10 + vendor/github.com/google/uuid/CONTRIBUTORS | 9 + vendor/github.com/google/uuid/LICENSE | 27 + vendor/github.com/google/uuid/README.md | 19 + vendor/github.com/google/uuid/dce.go | 80 + vendor/github.com/google/uuid/doc.go | 12 + vendor/github.com/google/uuid/hash.go | 53 + vendor/github.com/google/uuid/marshal.go | 38 + vendor/github.com/google/uuid/node.go | 90 + vendor/github.com/google/uuid/node_js.go | 12 + vendor/github.com/google/uuid/node_net.go | 33 + vendor/github.com/google/uuid/null.go | 118 + vendor/github.com/google/uuid/sql.go | 59 + vendor/github.com/google/uuid/time.go | 123 + vendor/github.com/google/uuid/util.go | 43 + vendor/github.com/google/uuid/uuid.go | 294 + vendor/github.com/google/uuid/version1.go | 44 + vendor/github.com/google/uuid/version4.go | 76 + .../grpc-gateway/v2/LICENSE.txt | 27 + .../v2/internal/httprule/BUILD.bazel | 35 + .../v2/internal/httprule/compile.go | 121 + .../grpc-gateway/v2/internal/httprule/fuzz.go | 11 + .../v2/internal/httprule/parse.go | 369 + .../v2/internal/httprule/types.go | 60 + .../grpc-gateway/v2/runtime/BUILD.bazel | 97 + .../grpc-gateway/v2/runtime/context.go | 364 + .../grpc-gateway/v2/runtime/convert.go | 322 + .../grpc-gateway/v2/runtime/doc.go | 5 + .../grpc-gateway/v2/runtime/errors.go | 181 + .../grpc-gateway/v2/runtime/fieldmask.go | 165 + .../grpc-gateway/v2/runtime/handler.go | 227 + .../v2/runtime/marshal_httpbodyproto.go | 32 + .../grpc-gateway/v2/runtime/marshal_json.go | 45 + .../grpc-gateway/v2/runtime/marshal_jsonpb.go | 355 + .../grpc-gateway/v2/runtime/marshal_proto.go | 63 + .../grpc-gateway/v2/runtime/marshaler.go | 50 + .../v2/runtime/marshaler_registry.go | 109 + .../grpc-gateway/v2/runtime/mux.go | 453 + .../grpc-gateway/v2/runtime/pattern.go | 383 + .../grpc-gateway/v2/runtime/proto2_convert.go | 80 + .../grpc-gateway/v2/runtime/query.go | 342 + .../grpc-gateway/v2/utilities/BUILD.bazel | 31 + .../grpc-gateway/v2/utilities/doc.go | 2 + .../grpc-gateway/v2/utilities/pattern.go | 22 + .../v2/utilities/readerfactory.go | 20 + .../v2/utilities/string_array_flag.go | 33 + .../grpc-gateway/v2/utilities/trie.go | 174 + .../github.com/hashicorp/go-cleanhttp/LICENSE | 363 + .../hashicorp/go-cleanhttp/README.md | 30 + .../hashicorp/go-cleanhttp/cleanhttp.go | 58 + .../github.com/hashicorp/go-cleanhttp/doc.go | 20 + .../hashicorp/go-cleanhttp/handlers.go | 48 + .../hashicorp/go-retryablehttp/.gitignore | 4 + .../hashicorp/go-retryablehttp/LICENSE | 363 + .../hashicorp/go-retryablehttp/Makefile | 11 + .../hashicorp/go-retryablehttp/README.md | 81 + .../hashicorp/go-retryablehttp/client.go | 815 + .../go-retryablehttp/roundtripper.go | 52 + .../hashicorp/golang-lru/.gitignore | 23 + vendor/github.com/hashicorp/golang-lru/2q.go | 223 + .../github.com/hashicorp/golang-lru/LICENSE | 362 + .../github.com/hashicorp/golang-lru/README.md | 25 + vendor/github.com/hashicorp/golang-lru/arc.go | 257 + vendor/github.com/hashicorp/golang-lru/doc.go | 21 + vendor/github.com/hashicorp/golang-lru/lru.go | 150 + .../hashicorp/golang-lru/simplelru/lru.go | 177 + .../golang-lru/simplelru/lru_interface.go | 39 + .../github.com/imdario/mergo/.deepsource.toml | 12 + vendor/github.com/imdario/mergo/.gitignore | 33 + vendor/github.com/imdario/mergo/.travis.yml | 12 + .../imdario/mergo/CODE_OF_CONDUCT.md | 46 + vendor/github.com/imdario/mergo/LICENSE | 28 + vendor/github.com/imdario/mergo/README.md | 235 + vendor/github.com/imdario/mergo/doc.go | 143 + vendor/github.com/imdario/mergo/map.go | 178 + vendor/github.com/imdario/mergo/merge.go | 380 + vendor/github.com/imdario/mergo/mergo.go | 78 + .../github.com/in-toto/in-toto-golang/LICENSE | 13 + .../in-toto-golang/in_toto/certconstraint.go | 156 + .../in-toto/in-toto-golang/in_toto/hashlib.go | 30 + .../in-toto/in-toto-golang/in_toto/keylib.go | 670 + .../in-toto/in-toto-golang/in_toto/match.go | 227 + .../in-toto/in-toto-golang/in_toto/model.go | 1073 + .../in-toto/in-toto-golang/in_toto/rulelib.go | 131 + .../in-toto/in-toto-golang/in_toto/runlib.go | 409 + .../in_toto/slsa_provenance/common/common.go | 16 + .../slsa_provenance/v0.1/provenance.go | 50 + .../slsa_provenance/v0.2/provenance.go | 137 + .../in-toto/in-toto-golang/in_toto/util.go | 147 + .../in-toto-golang/in_toto/util_unix.go | 14 + .../in-toto-golang/in_toto/util_windows.go | 25 + .../in-toto-golang/in_toto/verifylib.go | 1091 + .../jedisct1/go-minisign/.gitignore | 14 + .../github.com/jedisct1/go-minisign/LICENSE | 21 + .../github.com/jedisct1/go-minisign/README.md | 4 + .../jedisct1/go-minisign/minisign.go | 133 + .../github.com/json-iterator/go/.codecov.yml | 3 + vendor/github.com/json-iterator/go/.gitignore | 4 + .../github.com/json-iterator/go/.travis.yml | 14 + vendor/github.com/json-iterator/go/Gopkg.lock | 21 + vendor/github.com/json-iterator/go/Gopkg.toml | 26 + vendor/github.com/json-iterator/go/LICENSE | 21 + vendor/github.com/json-iterator/go/README.md | 85 + vendor/github.com/json-iterator/go/adapter.go | 150 + vendor/github.com/json-iterator/go/any.go | 325 + .../github.com/json-iterator/go/any_array.go | 278 + .../github.com/json-iterator/go/any_bool.go | 137 + .../github.com/json-iterator/go/any_float.go | 83 + .../github.com/json-iterator/go/any_int32.go | 74 + .../github.com/json-iterator/go/any_int64.go | 74 + .../json-iterator/go/any_invalid.go | 82 + vendor/github.com/json-iterator/go/any_nil.go | 69 + .../github.com/json-iterator/go/any_number.go | 123 + .../github.com/json-iterator/go/any_object.go | 374 + vendor/github.com/json-iterator/go/any_str.go | 166 + .../github.com/json-iterator/go/any_uint32.go | 74 + .../github.com/json-iterator/go/any_uint64.go | 74 + vendor/github.com/json-iterator/go/build.sh | 12 + vendor/github.com/json-iterator/go/config.go | 375 + .../go/fuzzy_mode_convert_table.md | 7 + vendor/github.com/json-iterator/go/iter.go | 349 + .../github.com/json-iterator/go/iter_array.go | 64 + .../github.com/json-iterator/go/iter_float.go | 342 + .../github.com/json-iterator/go/iter_int.go | 346 + .../json-iterator/go/iter_object.go | 267 + .../github.com/json-iterator/go/iter_skip.go | 130 + .../json-iterator/go/iter_skip_sloppy.go | 163 + .../json-iterator/go/iter_skip_strict.go | 99 + .../github.com/json-iterator/go/iter_str.go | 215 + .../github.com/json-iterator/go/jsoniter.go | 18 + vendor/github.com/json-iterator/go/pool.go | 42 + vendor/github.com/json-iterator/go/reflect.go | 337 + .../json-iterator/go/reflect_array.go | 104 + .../json-iterator/go/reflect_dynamic.go | 70 + .../json-iterator/go/reflect_extension.go | 483 + .../json-iterator/go/reflect_json_number.go | 112 + .../go/reflect_json_raw_message.go | 76 + .../json-iterator/go/reflect_map.go | 346 + .../json-iterator/go/reflect_marshaler.go | 225 + .../json-iterator/go/reflect_native.go | 453 + .../json-iterator/go/reflect_optional.go | 129 + .../json-iterator/go/reflect_slice.go | 99 + .../go/reflect_struct_decoder.go | 1097 + .../go/reflect_struct_encoder.go | 211 + vendor/github.com/json-iterator/go/stream.go | 210 + .../json-iterator/go/stream_float.go | 111 + .../github.com/json-iterator/go/stream_int.go | 190 + .../github.com/json-iterator/go/stream_str.go | 372 + vendor/github.com/json-iterator/go/test.sh | 12 + .../kelseyhightower/envconfig/.travis.yml | 13 + .../kelseyhightower/envconfig/LICENSE | 19 + .../kelseyhightower/envconfig/MAINTAINERS | 2 + .../kelseyhightower/envconfig/README.md | 192 + .../kelseyhightower/envconfig/doc.go | 8 + .../kelseyhightower/envconfig/env_os.go | 7 + .../kelseyhightower/envconfig/env_syscall.go | 7 + .../kelseyhightower/envconfig/envconfig.go | 382 + .../kelseyhightower/envconfig/usage.go | 164 + vendor/github.com/leodido/go-urn/.gitignore | 11 + vendor/github.com/leodido/go-urn/.travis.yml | 16 + vendor/github.com/leodido/go-urn/LICENSE | 21 + vendor/github.com/leodido/go-urn/README.md | 55 + vendor/github.com/leodido/go-urn/machine.go | 1691 + .../github.com/leodido/go-urn/machine.go.rl | 159 + vendor/github.com/leodido/go-urn/makefile | 39 + vendor/github.com/leodido/go-urn/urn.go | 86 + .../letsencrypt/boulder/core/objects.go | 5 - .../letsencrypt/boulder/core/util.go | 8 +- .../letsencrypt/boulder/errors/errors.go | 40 +- .../boulder/features/featureflag_string.go | 53 +- .../letsencrypt/boulder/features/features.go | 32 +- .../letsencrypt/boulder/sa/proto/sa.pb.go | 1246 +- .../letsencrypt/boulder/sa/proto/sa.proto | 90 +- .../boulder/sa/proto/sa_grpc.pb.go | 2521 +- .../golang_protobuf_extensions/LICENSE | 201 + .../golang_protobuf_extensions/NOTICE | 1 + .../pbutil/.gitignore | 1 + .../pbutil/Makefile | 7 + .../pbutil/decode.go | 75 + .../golang_protobuf_extensions/pbutil/doc.go | 16 + .../pbutil/encode.go | 46 + vendor/github.com/miekg/pkcs11/.gitignore | 3 + vendor/github.com/miekg/pkcs11/LICENSE | 27 + .../github.com/miekg/pkcs11/Makefile.release | 57 + vendor/github.com/miekg/pkcs11/README.md | 68 + vendor/github.com/miekg/pkcs11/error.go | 98 + vendor/github.com/miekg/pkcs11/hsm.db | Bin 0 -> 10240 bytes vendor/github.com/miekg/pkcs11/params.go | 190 + vendor/github.com/miekg/pkcs11/pkcs11.go | 1609 + vendor/github.com/miekg/pkcs11/pkcs11.h | 265 + vendor/github.com/miekg/pkcs11/pkcs11f.h | 939 + vendor/github.com/miekg/pkcs11/pkcs11go.h | 33 + vendor/github.com/miekg/pkcs11/pkcs11t.h | 2047 + vendor/github.com/miekg/pkcs11/release.go | 18 + vendor/github.com/miekg/pkcs11/softhsm.conf | 1 + vendor/github.com/miekg/pkcs11/softhsm2.conf | 4 + vendor/github.com/miekg/pkcs11/types.go | 315 + vendor/github.com/miekg/pkcs11/vendor.go | 127 + vendor/github.com/miekg/pkcs11/zconst.go | 766 + .../modern-go/concurrent/.gitignore | 1 + .../modern-go/concurrent/.travis.yml | 14 + .../github.com/modern-go/concurrent/LICENSE | 201 + .../github.com/modern-go/concurrent/README.md | 49 + .../modern-go/concurrent/executor.go | 14 + .../modern-go/concurrent/go_above_19.go | 15 + .../modern-go/concurrent/go_below_19.go | 33 + vendor/github.com/modern-go/concurrent/log.go | 13 + .../github.com/modern-go/concurrent/test.sh | 12 + .../concurrent/unbounded_executor.go | 119 + .../github.com/modern-go/reflect2/.gitignore | 2 + .../github.com/modern-go/reflect2/.travis.yml | 15 + .../github.com/modern-go/reflect2/Gopkg.lock | 9 + .../github.com/modern-go/reflect2/Gopkg.toml | 31 + vendor/github.com/modern-go/reflect2/LICENSE | 201 + .../github.com/modern-go/reflect2/README.md | 71 + .../modern-go/reflect2/go_above_118.go | 23 + .../modern-go/reflect2/go_above_19.go | 17 + .../modern-go/reflect2/go_below_118.go | 21 + .../github.com/modern-go/reflect2/reflect2.go | 300 + .../modern-go/reflect2/reflect2_amd64.s | 0 .../modern-go/reflect2/reflect2_kind.go | 30 + .../modern-go/reflect2/relfect2_386.s | 0 .../modern-go/reflect2/relfect2_amd64p32.s | 0 .../modern-go/reflect2/relfect2_arm.s | 0 .../modern-go/reflect2/relfect2_arm64.s | 0 .../modern-go/reflect2/relfect2_mips64x.s | 0 .../modern-go/reflect2/relfect2_mipsx.s | 0 .../modern-go/reflect2/relfect2_ppc64x.s | 0 .../modern-go/reflect2/relfect2_s390x.s | 0 .../modern-go/reflect2/safe_field.go | 58 + .../github.com/modern-go/reflect2/safe_map.go | 101 + .../modern-go/reflect2/safe_slice.go | 92 + .../modern-go/reflect2/safe_struct.go | 29 + .../modern-go/reflect2/safe_type.go | 78 + .../github.com/modern-go/reflect2/type_map.go | 70 + .../modern-go/reflect2/unsafe_array.go | 65 + .../modern-go/reflect2/unsafe_eface.go | 59 + .../modern-go/reflect2/unsafe_field.go | 74 + .../modern-go/reflect2/unsafe_iface.go | 64 + .../modern-go/reflect2/unsafe_link.go | 76 + .../modern-go/reflect2/unsafe_map.go | 130 + .../modern-go/reflect2/unsafe_ptr.go | 46 + .../modern-go/reflect2/unsafe_slice.go | 177 + .../modern-go/reflect2/unsafe_struct.go | 59 + .../modern-go/reflect2/unsafe_type.go | 85 + .../docker-credential-acr-helper/LICENSE | 21 + .../pkg/acr/client.go | 41 + .../pkg/acr/ee.go | 79 + .../pkg/acr/openapiauth.go | 44 + .../pkg/acr/person.go | 126 + .../pkg/acr/registry.go | 74 + .../pkg/credhelper/helper.go | 58 + .../pkg/version/version.go | 18 + vendor/github.com/mpvl/unique/.gitignore | 24 + vendor/github.com/mpvl/unique/LICENSE | 22 + vendor/github.com/mpvl/unique/unique.go | 98 + vendor/github.com/munnerz/goautoneg/LICENSE | 31 + vendor/github.com/munnerz/goautoneg/Makefile | 13 + .../github.com/munnerz/goautoneg/README.txt | 67 + .../github.com/munnerz/goautoneg/autoneg.go | 189 + .../github.com/open-policy-agent/opa/LICENSE | 202 + .../open-policy-agent/opa/ast/annotations.go | 786 + .../open-policy-agent/opa/ast/builtins.go | 3071 + .../open-policy-agent/opa/ast/capabilities.go | 116 + .../open-policy-agent/opa/ast/check.go | 1245 + .../open-policy-agent/opa/ast/compare.go | 391 + .../open-policy-agent/opa/ast/compile.go | 5097 ++ .../opa/ast/compilehelper.go | 60 + .../opa/ast/compilemetrics.go | 9 + .../open-policy-agent/opa/ast/conflicts.go | 48 + .../open-policy-agent/opa/ast/doc.go | 36 + .../open-policy-agent/opa/ast/env.go | 327 + .../open-policy-agent/opa/ast/errors.go | 123 + .../open-policy-agent/opa/ast/fuzz.go | 17 + .../open-policy-agent/opa/ast/index.go | 884 + .../opa/ast/internal/scanner/scanner.go | 431 + .../opa/ast/internal/tokens/tokens.go | 151 + .../opa/ast/location/location.go | 90 + .../open-policy-agent/opa/ast/map.go | 133 + .../open-policy-agent/opa/ast/parser.go | 2401 + .../open-policy-agent/opa/ast/parser_ext.go | 725 + .../open-policy-agent/opa/ast/policy.go | 1583 + .../open-policy-agent/opa/ast/pretty.go | 82 + .../open-policy-agent/opa/ast/schema.go | 63 + .../open-policy-agent/opa/ast/strings.go | 15 + .../open-policy-agent/opa/ast/term.go | 2948 + .../open-policy-agent/opa/ast/transform.go | 416 + .../open-policy-agent/opa/ast/unify.go | 235 + .../open-policy-agent/opa/ast/varset.go | 100 + .../open-policy-agent/opa/ast/visit.go | 737 + .../open-policy-agent/opa/bundle/bundle.go | 1379 + .../open-policy-agent/opa/bundle/file.go | 413 + .../open-policy-agent/opa/bundle/filefs.go | 100 + .../open-policy-agent/opa/bundle/hash.go | 141 + .../open-policy-agent/opa/bundle/keys.go | 145 + .../open-policy-agent/opa/bundle/sign.go | 135 + .../open-policy-agent/opa/bundle/store.go | 995 + .../open-policy-agent/opa/bundle/verify.go | 231 + .../opa/capabilities/capabilities.go | 18 + .../opa/capabilities/v0.17.0.json | 2392 + .../opa/capabilities/v0.17.1.json | 2392 + .../opa/capabilities/v0.17.2.json | 2525 + .../opa/capabilities/v0.17.3.json | 2525 + .../opa/capabilities/v0.18.0.json | 2685 + .../opa/capabilities/v0.19.0-rc1.json | 2835 + .../opa/capabilities/v0.19.0.json | 2858 + .../opa/capabilities/v0.19.1.json | 2858 + .../opa/capabilities/v0.19.2.json | 2858 + .../opa/capabilities/v0.20.0.json | 3064 + .../opa/capabilities/v0.20.1.json | 3064 + .../opa/capabilities/v0.20.2.json | 3064 + .../opa/capabilities/v0.20.3.json | 3064 + .../opa/capabilities/v0.20.4.json | 3064 + .../opa/capabilities/v0.20.5.json | 3064 + .../opa/capabilities/v0.21.0.json | 3086 + .../opa/capabilities/v0.21.1.json | 3086 + .../opa/capabilities/v0.22.0.json | 3137 + .../opa/capabilities/v0.23.0.json | 3168 + .../opa/capabilities/v0.23.1.json | 3168 + .../opa/capabilities/v0.23.2.json | 3168 + .../opa/capabilities/v0.24.0.json | 3243 + .../opa/capabilities/v0.25.0-rc1.json | 3271 + .../opa/capabilities/v0.25.0-rc2.json | 3313 + .../opa/capabilities/v0.25.0-rc3.json | 3313 + .../opa/capabilities/v0.25.0-rc4.json | 3313 + .../opa/capabilities/v0.25.0.json | 3355 + .../opa/capabilities/v0.25.1.json | 3355 + .../opa/capabilities/v0.25.2.json | 3355 + .../opa/capabilities/v0.26.0.json | 3383 + .../opa/capabilities/v0.27.0.json | 3389 + .../opa/capabilities/v0.27.1.json | 3389 + .../opa/capabilities/v0.28.0.json | 3458 + .../opa/capabilities/v0.29.0.json | 3458 + .../opa/capabilities/v0.29.1.json | 3458 + .../opa/capabilities/v0.29.2.json | 3458 + .../opa/capabilities/v0.29.3.json | 3458 + .../opa/capabilities/v0.29.4.json | 3458 + .../opa/capabilities/v0.30.0.json | 3458 + .../opa/capabilities/v0.30.1.json | 3458 + .../opa/capabilities/v0.30.2.json | 3458 + .../opa/capabilities/v0.31.0.json | 3512 + .../opa/capabilities/v0.32.0.json | 3512 + .../opa/capabilities/v0.32.1.json | 3512 + .../opa/capabilities/v0.33.0.json | 3534 + .../opa/capabilities/v0.33.1.json | 3534 + .../opa/capabilities/v0.34.0.json | 3602 + .../opa/capabilities/v0.34.1.json | 3602 + .../opa/capabilities/v0.34.2.json | 3602 + .../opa/capabilities/v0.35.0.json | 3619 + .../opa/capabilities/v0.36.0.json | 3721 + .../opa/capabilities/v0.36.1.json | 3721 + .../opa/capabilities/v0.37.0.json | 3825 + .../opa/capabilities/v0.37.1.json | 3825 + .../opa/capabilities/v0.37.2.json | 3825 + .../opa/capabilities/v0.38.0.json | 3826 + .../opa/capabilities/v0.38.1.json | 3826 + .../opa/capabilities/v0.39.0.json | 3826 + .../opa/capabilities/v0.40.0.json | 3847 + .../opa/capabilities/v0.41.0.json | 4007 + .../opa/capabilities/v0.42.0.json | 4076 + .../opa/capabilities/v0.42.1.json | 4076 + .../opa/capabilities/v0.42.2.json | 4076 + .../opa/capabilities/v0.43.0.json | 4079 + .../opa/capabilities/v0.43.1.json | 4079 + .../opa/capabilities/v0.44.0.json | 4190 + .../opa/capabilities/v0.45.0.json | 4306 + .../open-policy-agent/opa/format/format.go | 1329 + .../opa/internal/bundle/utils.go | 85 + .../opa/internal/cidr/merge/merge.go | 367 + .../internal/compiler/wasm/opa/callgraph.csv | 2416 + .../opa/internal/compiler/wasm/opa/opa.go | 27 + .../opa/internal/compiler/wasm/opa/opa.wasm | Bin 0 -> 423668 bytes .../internal/compiler/wasm/optimizations.go | 271 + .../opa/internal/compiler/wasm/wasm.go | 1785 + .../opa/internal/debug/debug.go | 36 + .../opa/internal/deepcopy/deepcopy.go | 31 + .../opa/internal/file/archive/tarball.go | 42 + .../opa/internal/file/url/url.go | 42 + .../opa/internal/future/filter_imports.go | 37 + .../opa/internal/future/parser_opts.go | 42 + .../gojsonschema/LICENSE-APACHE-2.0.txt | 202 + .../opa/internal/gojsonschema/README.md | 481 + .../opa/internal/gojsonschema/draft.go | 122 + .../opa/internal/gojsonschema/errors.go | 366 + .../internal/gojsonschema/format_checkers.go | 368 + .../opa/internal/gojsonschema/internalLog.go | 37 + .../opa/internal/gojsonschema/jsonContext.go | 73 + .../opa/internal/gojsonschema/jsonLoader.go | 411 + .../opa/internal/gojsonschema/locales.go | 472 + .../opa/internal/gojsonschema/result.go | 220 + .../opa/internal/gojsonschema/schema.go | 958 + .../opa/internal/gojsonschema/schemaLoader.go | 206 + .../opa/internal/gojsonschema/schemaPool.go | 230 + .../gojsonschema/schemaReferencePool.go | 68 + .../opa/internal/gojsonschema/schemaType.go | 83 + .../opa/internal/gojsonschema/subSchema.go | 151 + .../opa/internal/gojsonschema/types.go | 62 + .../opa/internal/gojsonschema/utils.go | 165 + .../opa/internal/gojsonschema/validation.go | 837 + .../opa/internal/gqlparser/LICENSE | 19 + .../opa/internal/gqlparser/ast/argmap.go | 37 + .../opa/internal/gqlparser/ast/collections.go | 148 + .../opa/internal/gqlparser/ast/decode.go | 216 + .../opa/internal/gqlparser/ast/definition.go | 94 + .../opa/internal/gqlparser/ast/directive.go | 43 + .../opa/internal/gqlparser/ast/document.go | 79 + .../opa/internal/gqlparser/ast/dumper.go | 159 + .../opa/internal/gqlparser/ast/fragment.go | 38 + .../opa/internal/gqlparser/ast/operation.go | 30 + .../opa/internal/gqlparser/ast/path.go | 67 + .../opa/internal/gqlparser/ast/selection.go | 39 + .../opa/internal/gqlparser/ast/source.go | 19 + .../opa/internal/gqlparser/ast/type.go | 68 + .../opa/internal/gqlparser/ast/value.go | 120 + .../opa/internal/gqlparser/gqlerror/error.go | 147 + .../internal/gqlparser/lexer/blockstring.go | 58 + .../opa/internal/gqlparser/lexer/lexer.go | 517 + .../internal/gqlparser/lexer/lexer_test.yml | 692 + .../opa/internal/gqlparser/lexer/token.go | 148 + .../opa/internal/gqlparser/parser/parser.go | 136 + .../opa/internal/gqlparser/parser/query.go | 349 + .../internal/gqlparser/parser/query_test.yml | 544 + .../opa/internal/gqlparser/parser/schema.go | 535 + .../internal/gqlparser/parser/schema_test.yml | 646 + .../opa/internal/gqlparser/validator/error.go | 55 + .../internal/gqlparser/validator/messaging.go | 39 + .../internal/gqlparser/validator/prelude.go | 16 + .../gqlparser/validator/prelude.graphql | 121 + .../validator/rules/fields_on_correct_type.go | 97 + .../rules/fragments_on_composite_types.go | 41 + .../validator/rules/known_argument_names.go | 59 + .../validator/rules/known_directives.go | 49 + .../validator/rules/known_fragment_names.go | 21 + .../validator/rules/known_root_type.go | 37 + .../validator/rules/known_type_names.go | 61 + .../rules/lone_anonymous_operation.go | 21 + .../validator/rules/no_fragment_cycles.go | 95 + .../validator/rules/no_undefined_variables.go | 30 + .../validator/rules/no_unused_fragments.go | 32 + .../validator/rules/no_unused_variables.go | 32 + .../rules/overlapping_fields_can_be_merged.go | 562 + .../rules/possible_fragment_spreads.go | 70 + .../rules/provided_required_arguments.go | 64 + .../gqlparser/validator/rules/scalar_leafs.go | 38 + .../rules/single_field_subscriptions.go | 88 + .../validator/rules/unique_argument_names.go | 35 + .../rules/unique_directives_per_location.go | 26 + .../validator/rules/unique_fragment_names.go | 24 + .../rules/unique_input_field_names.go | 29 + .../validator/rules/unique_operation_names.go | 24 + .../validator/rules/unique_variable_names.go | 26 + .../validator/rules/values_of_correct_type.go | 170 + .../rules/variables_are_input_types.go | 30 + .../rules/variables_in_allowed_position.go | 40 + .../internal/gqlparser/validator/schema.go | 513 + .../gqlparser/validator/schema_test.yml | 678 + .../gqlparser/validator/suggestionList.go | 69 + .../internal/gqlparser/validator/validator.go | 45 + .../opa/internal/gqlparser/validator/vars.go | 258 + .../opa/internal/gqlparser/validator/walk.go | 292 + .../opa/internal/json/patch/patch.go | 45 + .../opa/internal/jwx/LICENSE | 21 + .../opa/internal/jwx/buffer/buffer.go | 112 + .../opa/internal/jwx/jwa/elliptic.go | 11 + .../opa/internal/jwx/jwa/key_type.go | 67 + .../opa/internal/jwx/jwa/parameters.go | 29 + .../opa/internal/jwx/jwa/signature.go | 78 + .../opa/internal/jwx/jwk/ecdsa.go | 120 + .../opa/internal/jwx/jwk/headers.go | 178 + .../opa/internal/jwx/jwk/interface.go | 71 + .../opa/internal/jwx/jwk/jwk.go | 153 + .../opa/internal/jwx/jwk/key_ops.go | 68 + .../opa/internal/jwx/jwk/rsa.go | 133 + .../opa/internal/jwx/jwk/symmetric.go | 41 + .../opa/internal/jwx/jws/headers.go | 154 + .../opa/internal/jwx/jws/interface.go | 22 + .../opa/internal/jwx/jws/jws.go | 221 + .../opa/internal/jwx/jws/message.go | 26 + .../opa/internal/jwx/jws/sign/ecdsa.go | 90 + .../opa/internal/jwx/jws/sign/hmac.go | 66 + .../opa/internal/jwx/jws/sign/interface.go | 46 + .../opa/internal/jwx/jws/sign/rsa.go | 97 + .../opa/internal/jwx/jws/sign/sign.go | 67 + .../opa/internal/jwx/jws/verify/ecdsa.go | 67 + .../opa/internal/jwx/jws/verify/hmac.go | 33 + .../opa/internal/jwx/jws/verify/interface.go | 39 + .../opa/internal/jwx/jws/verify/rsa.go | 88 + .../opa/internal/jwx/jws/verify/verify.go | 57 + .../opa/internal/lcss/README.md | 3 + .../opa/internal/lcss/lcss.go | 197 + .../opa/internal/lcss/qsufsort.go | 169 + .../opa/internal/leb128/leb128.go | 170 + .../opa/internal/merge/merge.go | 64 + .../opa/internal/planner/planner.go | 2284 + .../opa/internal/planner/rules.go | 214 + .../opa/internal/planner/varstack.go | 71 + .../open-policy-agent/opa/internal/ref/ref.go | 39 + .../opa/internal/rego/opa/engine.go | 65 + .../opa/internal/rego/opa/options.go | 30 + .../opa/internal/semver/LICENSE | 202 + .../opa/internal/semver/semver.go | 235 + .../opa/internal/strings/strings.go | 74 + .../opa/internal/uuid/uuid.go | 22 + .../opa/internal/version/version.go | 36 + .../opa/internal/wasm/constant/constant.go | 77 + .../opa/internal/wasm/encoding/doc.go | 6 + .../opa/internal/wasm/encoding/reader.go | 965 + .../opa/internal/wasm/encoding/writer.go | 777 + .../opa/internal/wasm/instruction/control.go | 183 + .../internal/wasm/instruction/instruction.go | 33 + .../opa/internal/wasm/instruction/memory.go | 39 + .../opa/internal/wasm/instruction/numeric.go | 199 + .../internal/wasm/instruction/parametric.go | 29 + .../opa/internal/wasm/instruction/variable.go | 54 + .../opa/internal/wasm/module/module.go | 385 + .../opa/internal/wasm/module/pretty.go | 84 + .../opa/internal/wasm/opcode/opcode.go | 218 + .../wasm/sdk/opa/capabilities/capabilities.go | 12 + .../opa/capabilities/capabilities_nowasm.go | 14 + .../opa/internal/wasm/types/types.go | 36 + .../opa/internal/wasm/util/util.go | 18 + .../github.com/open-policy-agent/opa/ir/ir.go | 479 + .../open-policy-agent/opa/ir/marshal.go | 137 + .../open-policy-agent/opa/ir/pretty.go | 44 + .../open-policy-agent/opa/ir/walk.go | 93 + .../open-policy-agent/opa/keys/keys.go | 100 + .../open-policy-agent/opa/loader/errors.go | 62 + .../opa/loader/filter/filter.go | 5 + .../loader/internal/embedtest/bar/bar.rego | 3 + .../loader/internal/embedtest/bar/bar.yaml | 1 + .../internal/embedtest/baz/qux/qux.json | 1 + .../opa/loader/internal/embedtest/foo.json | 1 + .../open-policy-agent/opa/loader/loader.go | 747 + .../open-policy-agent/opa/metrics/metrics.go | 312 + .../open-policy-agent/opa/rego/errors.go | 24 + .../open-policy-agent/opa/rego/rego.go | 2578 + .../open-policy-agent/opa/rego/resultset.go | 90 + .../opa/resolver/interface.go | 29 + .../opa/resolver/wasm/wasm.go | 173 + .../open-policy-agent/opa/storage/doc.go | 6 + .../open-policy-agent/opa/storage/errors.go | 122 + .../opa/storage/inmem/inmem.go | 406 + .../opa/storage/inmem/opts.go | 25 + .../opa/storage/inmem/txn.go | 396 + .../opa/storage/interface.go | 247 + .../opa/storage/internal/errors/errors.go | 39 + .../opa/storage/internal/ptr/ptr.go | 68 + .../open-policy-agent/opa/storage/path.go | 154 + .../open-policy-agent/opa/storage/storage.go | 126 + .../opa/topdown/aggregates.go | 260 + .../opa/topdown/arithmetic.go | 184 + .../open-policy-agent/opa/topdown/array.go | 94 + .../open-policy-agent/opa/topdown/binary.go | 45 + .../open-policy-agent/opa/topdown/bindings.go | 400 + .../open-policy-agent/opa/topdown/bits.go | 88 + .../open-policy-agent/opa/topdown/builtins.go | 206 + .../opa/topdown/builtins/builtins.go | 324 + .../open-policy-agent/opa/topdown/cache.go | 291 + .../opa/topdown/cache/cache.go | 167 + .../open-policy-agent/opa/topdown/cancel.go | 33 + .../open-policy-agent/opa/topdown/casts.go | 117 + .../open-policy-agent/opa/topdown/cidr.go | 405 + .../opa/topdown/comparison.go | 48 + .../copypropagation/copypropagation.go | 475 + .../opa/topdown/copypropagation/unionfind.go | 135 + .../open-policy-agent/opa/topdown/crypto.go | 419 + .../open-policy-agent/opa/topdown/doc.go | 10 + .../open-policy-agent/opa/topdown/encoding.go | 307 + .../open-policy-agent/opa/topdown/errors.go | 139 + .../open-policy-agent/opa/topdown/eval.go | 3423 + .../open-policy-agent/opa/topdown/glob.go | 78 + .../open-policy-agent/opa/topdown/graphql.go | 462 + .../open-policy-agent/opa/topdown/http.go | 1387 + .../opa/topdown/http_fixup.go | 8 + .../opa/topdown/http_fixup_darwin.go | 13 + .../open-policy-agent/opa/topdown/input.go | 100 + .../opa/topdown/instrumentation.go | 63 + .../open-policy-agent/opa/topdown/json.go | 629 + .../open-policy-agent/opa/topdown/net.go | 64 + .../open-policy-agent/opa/topdown/numbers.go | 99 + .../open-policy-agent/opa/topdown/object.go | 217 + .../open-policy-agent/opa/topdown/parse.go | 59 + .../opa/topdown/parse_bytes.go | 143 + .../opa/topdown/parse_units.go | 125 + .../open-policy-agent/opa/topdown/print.go | 86 + .../opa/topdown/print/print.go | 21 + .../open-policy-agent/opa/topdown/query.go | 501 + .../opa/topdown/reachable.go | 142 + .../open-policy-agent/opa/topdown/regex.go | 245 + .../opa/topdown/regex_template.go | 122 + .../open-policy-agent/opa/topdown/resolver.go | 107 + .../open-policy-agent/opa/topdown/runtime.go | 127 + .../open-policy-agent/opa/topdown/save.go | 431 + .../open-policy-agent/opa/topdown/semver.go | 59 + .../open-policy-agent/opa/topdown/sets.go | 88 + .../open-policy-agent/opa/topdown/strings.go | 590 + .../open-policy-agent/opa/topdown/subset.go | 263 + .../open-policy-agent/opa/topdown/time.go | 297 + .../open-policy-agent/opa/topdown/tokens.go | 1209 + .../open-policy-agent/opa/topdown/trace.go | 447 + .../open-policy-agent/opa/topdown/type.go | 82 + .../opa/topdown/type_name.go | 36 + .../open-policy-agent/opa/topdown/uuid.go | 36 + .../open-policy-agent/opa/topdown/walk.go | 96 + .../open-policy-agent/opa/tracing/tracing.go | 55 + .../open-policy-agent/opa/types/decode.go | 191 + .../open-policy-agent/opa/types/types.go | 1074 + .../open-policy-agent/opa/util/backoff.go | 51 + .../open-policy-agent/opa/util/close.go | 23 + .../open-policy-agent/opa/util/compare.go | 185 + .../open-policy-agent/opa/util/doc.go | 6 + .../open-policy-agent/opa/util/enumflag.go | 59 + .../open-policy-agent/opa/util/graph.go | 90 + .../open-policy-agent/opa/util/hashmap.go | 157 + .../open-policy-agent/opa/util/json.go | 116 + .../open-policy-agent/opa/util/queue.go | 113 + .../open-policy-agent/opa/util/wait.go | 34 + .../open-policy-agent/opa/version/version.go | 27 + .../opa/version/version_go1.18.go | 33 + .../open-policy-agent/opa/version/wasm.go | 13 + .../opentracing/opentracing-go/.gitignore | 1 + .../opentracing/opentracing-go/.travis.yml | 20 + .../opentracing/opentracing-go/CHANGELOG.md | 63 + .../opentracing/opentracing-go/LICENSE | 201 + .../opentracing/opentracing-go/Makefile | 20 + .../opentracing/opentracing-go/README.md | 171 + .../opentracing/opentracing-go/ext.go | 24 + .../opentracing/opentracing-go/ext/field.go | 17 + .../opentracing/opentracing-go/ext/tags.go | 215 + .../opentracing-go/globaltracer.go | 42 + .../opentracing/opentracing-go/gocontext.go | 65 + .../opentracing/opentracing-go/log/field.go | 282 + .../opentracing/opentracing-go/log/util.go | 61 + .../opentracing/opentracing-go/noop.go | 64 + .../opentracing/opentracing-go/propagation.go | 176 + .../opentracing/opentracing-go/span.go | 189 + .../opentracing/opentracing-go/tracer.go | 304 + .../prometheus/client_golang/LICENSE | 201 + .../prometheus/client_golang/NOTICE | 23 + .../client_golang/prometheus/.gitignore | 1 + .../client_golang/prometheus/README.md | 1 + .../prometheus/build_info_collector.go | 38 + .../client_golang/prometheus/collector.go | 128 + .../client_golang/prometheus/counter.go | 325 + .../client_golang/prometheus/desc.go | 189 + .../client_golang/prometheus/doc.go | 199 + .../prometheus/expvar_collector.go | 86 + .../client_golang/prometheus/fnv.go | 42 + .../client_golang/prometheus/gauge.go | 289 + .../client_golang/prometheus/get_pid.go | 26 + .../prometheus/get_pid_gopherjs.go | 23 + .../client_golang/prometheus/go_collector.go | 281 + .../prometheus/go_collector_go116.go | 122 + .../prometheus/go_collector_latest.go | 568 + .../client_golang/prometheus/histogram.go | 670 + .../prometheus/internal/difflib.go | 651 + .../internal/go_collector_options.go | 32 + .../prometheus/internal/go_runtime_metrics.go | 142 + .../prometheus/internal/metric.go | 101 + .../client_golang/prometheus/labels.go | 87 + .../client_golang/prometheus/metric.go | 256 + .../client_golang/prometheus/num_threads.go | 25 + .../prometheus/num_threads_gopherjs.go | 22 + .../client_golang/prometheus/observer.go | 64 + .../prometheus/process_collector.go | 164 + .../prometheus/process_collector_js.go | 26 + .../prometheus/process_collector_other.go | 66 + .../prometheus/process_collector_windows.go | 116 + .../prometheus/promhttp/delegator.go | 374 + .../client_golang/prometheus/promhttp/http.go | 395 + .../prometheus/promhttp/instrument_client.go | 248 + .../prometheus/promhttp/instrument_server.go | 566 + .../prometheus/promhttp/option.go | 58 + .../client_golang/prometheus/registry.go | 1044 + .../client_golang/prometheus/summary.go | 744 + .../client_golang/prometheus/timer.go | 54 + .../client_golang/prometheus/untyped.go | 42 + .../client_golang/prometheus/value.go | 237 + .../client_golang/prometheus/vec.go | 642 + .../client_golang/prometheus/wrap.go | 216 + .../prometheus/client_model/LICENSE | 201 + .../github.com/prometheus/client_model/NOTICE | 5 + .../prometheus/client_model/go/metrics.pb.go | 914 + vendor/github.com/prometheus/common/LICENSE | 201 + vendor/github.com/prometheus/common/NOTICE | 5 + .../prometheus/common/expfmt/decode.go | 429 + .../prometheus/common/expfmt/encode.go | 162 + .../prometheus/common/expfmt/expfmt.go | 41 + .../prometheus/common/expfmt/fuzz.go | 37 + .../common/expfmt/openmetrics_create.go | 527 + .../prometheus/common/expfmt/text_create.go | 465 + .../prometheus/common/expfmt/text_parse.go | 775 + .../bitbucket.org/ww/goautoneg/README.txt | 67 + .../bitbucket.org/ww/goautoneg/autoneg.go | 162 + .../prometheus/common/model/alert.go | 136 + .../prometheus/common/model/fingerprinting.go | 105 + .../github.com/prometheus/common/model/fnv.go | 42 + .../prometheus/common/model/labels.go | 218 + .../prometheus/common/model/labelset.go | 169 + .../prometheus/common/model/metric.go | 102 + .../prometheus/common/model/model.go | 16 + .../prometheus/common/model/signature.go | 144 + .../prometheus/common/model/silence.go | 106 + .../prometheus/common/model/time.go | 317 + .../prometheus/common/model/value.go | 416 + .../github.com/prometheus/procfs/.gitignore | 2 + .../prometheus/procfs/.golangci.yml | 12 + .../prometheus/procfs/CODE_OF_CONDUCT.md | 3 + .../prometheus/procfs/CONTRIBUTING.md | 121 + vendor/github.com/prometheus/procfs/LICENSE | 201 + .../prometheus/procfs/MAINTAINERS.md | 2 + vendor/github.com/prometheus/procfs/Makefile | 31 + .../prometheus/procfs/Makefile.common | 264 + vendor/github.com/prometheus/procfs/NOTICE | 7 + vendor/github.com/prometheus/procfs/README.md | 61 + .../github.com/prometheus/procfs/SECURITY.md | 6 + vendor/github.com/prometheus/procfs/arp.go | 116 + .../github.com/prometheus/procfs/buddyinfo.go | 85 + .../github.com/prometheus/procfs/cmdline.go | 30 + .../github.com/prometheus/procfs/cpuinfo.go | 482 + .../prometheus/procfs/cpuinfo_armx.go | 20 + .../prometheus/procfs/cpuinfo_mipsx.go | 20 + .../prometheus/procfs/cpuinfo_others.go | 19 + .../prometheus/procfs/cpuinfo_ppcx.go | 20 + .../prometheus/procfs/cpuinfo_riscvx.go | 20 + .../prometheus/procfs/cpuinfo_s390x.go | 19 + .../prometheus/procfs/cpuinfo_x86.go | 20 + vendor/github.com/prometheus/procfs/crypto.go | 153 + vendor/github.com/prometheus/procfs/doc.go | 45 + vendor/github.com/prometheus/procfs/fs.go | 43 + .../github.com/prometheus/procfs/fscache.go | 422 + .../prometheus/procfs/internal/fs/fs.go | 55 + .../prometheus/procfs/internal/util/parse.go | 97 + .../procfs/internal/util/readfile.go | 37 + .../procfs/internal/util/sysreadfile.go | 50 + .../internal/util/sysreadfile_compat.go | 27 + .../procfs/internal/util/valueparser.go | 91 + vendor/github.com/prometheus/procfs/ipvs.go | 240 + .../prometheus/procfs/kernel_random.go | 63 + .../github.com/prometheus/procfs/loadavg.go | 62 + vendor/github.com/prometheus/procfs/mdstat.go | 266 + .../github.com/prometheus/procfs/meminfo.go | 277 + .../github.com/prometheus/procfs/mountinfo.go | 180 + .../prometheus/procfs/mountstats.go | 638 + .../prometheus/procfs/net_conntrackstat.go | 153 + .../github.com/prometheus/procfs/net_dev.go | 205 + .../prometheus/procfs/net_ip_socket.go | 226 + .../prometheus/procfs/net_protocols.go | 180 + .../prometheus/procfs/net_sockstat.go | 163 + .../prometheus/procfs/net_softnet.go | 102 + .../github.com/prometheus/procfs/net_tcp.go | 64 + .../github.com/prometheus/procfs/net_udp.go | 64 + .../github.com/prometheus/procfs/net_unix.go | 257 + .../github.com/prometheus/procfs/net_xfrm.go | 189 + .../github.com/prometheus/procfs/netstat.go | 68 + vendor/github.com/prometheus/procfs/proc.go | 319 + .../prometheus/procfs/proc_cgroup.go | 98 + .../prometheus/procfs/proc_cgroups.go | 98 + .../prometheus/procfs/proc_environ.go | 37 + .../prometheus/procfs/proc_fdinfo.go | 132 + .../github.com/prometheus/procfs/proc_io.go | 59 + .../prometheus/procfs/proc_limits.go | 160 + .../github.com/prometheus/procfs/proc_maps.go | 211 + .../prometheus/procfs/proc_netstat.go | 440 + .../github.com/prometheus/procfs/proc_ns.go | 68 + .../github.com/prometheus/procfs/proc_psi.go | 102 + .../prometheus/procfs/proc_smaps.go | 166 + .../github.com/prometheus/procfs/proc_snmp.go | 353 + .../prometheus/procfs/proc_snmp6.go | 381 + .../github.com/prometheus/procfs/proc_stat.go | 222 + .../prometheus/procfs/proc_status.go | 170 + .../github.com/prometheus/procfs/proc_sys.go | 51 + .../github.com/prometheus/procfs/schedstat.go | 121 + vendor/github.com/prometheus/procfs/slab.go | 151 + .../github.com/prometheus/procfs/softirqs.go | 160 + vendor/github.com/prometheus/procfs/stat.go | 244 + vendor/github.com/prometheus/procfs/swaps.go | 89 + vendor/github.com/prometheus/procfs/ttar | 413 + vendor/github.com/prometheus/procfs/vm.go | 210 + .../github.com/prometheus/procfs/zoneinfo.go | 196 + .../prometheus/statsd_exporter/LICENSE | 201 + .../prometheus/statsd_exporter/NOTICE | 5 + .../statsd_exporter/pkg/level/level.go | 97 + .../statsd_exporter/pkg/mapper/action.go | 42 + .../statsd_exporter/pkg/mapper/escape.go | 86 + .../statsd_exporter/pkg/mapper/fsm/README.md | 132 + .../statsd_exporter/pkg/mapper/fsm/dump.go | 48 + .../pkg/mapper/fsm/formatter.go | 76 + .../statsd_exporter/pkg/mapper/fsm/fsm.go | 326 + .../statsd_exporter/pkg/mapper/fsm/fsm.png | Bin 0 -> 33685 bytes .../statsd_exporter/pkg/mapper/fsm/minmax.go | 30 + .../statsd_exporter/pkg/mapper/mapper.go | 386 + .../pkg/mapper/mapper_cache.go | 74 + .../pkg/mapper/mapper_defaults.go | 72 + .../statsd_exporter/pkg/mapper/mapping.go | 76 + .../statsd_exporter/pkg/mapper/match.go | 41 + .../statsd_exporter/pkg/mapper/metric_type.go | 46 + .../statsd_exporter/pkg/mapper/observer.go | 41 + .../github.com/rcrowley/go-metrics/.gitignore | 9 + .../rcrowley/go-metrics/.travis.yml | 23 + vendor/github.com/rcrowley/go-metrics/LICENSE | 29 + .../github.com/rcrowley/go-metrics/README.md | 171 + .../github.com/rcrowley/go-metrics/counter.go | 112 + .../github.com/rcrowley/go-metrics/debug.go | 80 + vendor/github.com/rcrowley/go-metrics/ewma.go | 138 + .../github.com/rcrowley/go-metrics/gauge.go | 120 + .../rcrowley/go-metrics/gauge_float64.go | 125 + .../rcrowley/go-metrics/graphite.go | 113 + .../rcrowley/go-metrics/healthcheck.go | 61 + .../rcrowley/go-metrics/histogram.go | 202 + vendor/github.com/rcrowley/go-metrics/json.go | 31 + vendor/github.com/rcrowley/go-metrics/log.go | 100 + .../github.com/rcrowley/go-metrics/memory.md | 285 + .../github.com/rcrowley/go-metrics/meter.go | 251 + .../github.com/rcrowley/go-metrics/metrics.go | 13 + .../rcrowley/go-metrics/opentsdb.go | 119 + .../rcrowley/go-metrics/registry.go | 373 + .../github.com/rcrowley/go-metrics/runtime.go | 216 + .../rcrowley/go-metrics/runtime_cgo.go | 10 + .../go-metrics/runtime_gccpufraction.go | 9 + .../rcrowley/go-metrics/runtime_no_cgo.go | 7 + .../go-metrics/runtime_no_gccpufraction.go | 9 + .../github.com/rcrowley/go-metrics/sample.go | 616 + .../github.com/rcrowley/go-metrics/syslog.go | 78 + .../github.com/rcrowley/go-metrics/timer.go | 329 + .../rcrowley/go-metrics/validate.sh | 10 + .../github.com/rcrowley/go-metrics/writer.go | 100 + vendor/github.com/sassoftware/relic/LICENSE | 202 + .../sassoftware/relic/lib/pkcs7/attributes.go | 127 + .../sassoftware/relic/lib/pkcs7/builder.go | 151 + .../sassoftware/relic/lib/pkcs7/content.go | 81 + .../sassoftware/relic/lib/pkcs7/marshal.go | 115 + .../sassoftware/relic/lib/pkcs7/structs.go | 85 + .../sassoftware/relic/lib/pkcs7/verify.go | 192 + .../relic/lib/x509tools/certpool.go | 58 + .../relic/lib/x509tools/digests.go | 97 + .../relic/lib/x509tools/ecdsa_curves.go | 191 + .../relic/lib/x509tools/keylogfile.go | 37 + .../sassoftware/relic/lib/x509tools/names.go | 203 + .../sassoftware/relic/lib/x509tools/pkix.go | 209 + .../relic/lib/x509tools/printcert.go | 275 + .../sassoftware/relic/lib/x509tools/rsapss.go | 108 + .../sassoftware/relic/lib/x509tools/util.go | 130 + .../relic/lib/x509tools/x509cmd.go | 340 + .../relic/signers/sigerrors/errors.go | 53 + .../go-securesystemslib/LICENSE | 21 + .../cjson/canonicaljson.go | 145 + .../go-securesystemslib/dsse/sign.go | 197 + .../go-securesystemslib/dsse/verify.go | 146 + .../github.com/shibumi/go-pathspec/.gitignore | 26 + .../github.com/shibumi/go-pathspec/GO-LICENSE | 27 + vendor/github.com/shibumi/go-pathspec/LICENSE | 201 + .../github.com/shibumi/go-pathspec/README.md | 45 + .../shibumi/go-pathspec/gitignore.go | 299 + .../cli/fulcio/fulcioverifier/ctl/verify.go | 197 + .../fulcio/fulcioverifier/ctutil/ctutil.go | 224 + .../cmd/cosign/cli/options/annotations.go | 53 + .../cosign/cmd/cosign/cli/options/attach.go | 118 + .../cosign/cmd/cosign/cli/options/attest.go | 85 + .../cmd/cosign/cli/options/attest_blob.go | 49 + .../cmd/cosign/cli/options/certificate.go | 80 + .../cosign/cmd/cosign/cli/options/clean.go | 32 + .../cosign/cmd/cosign/cli/options/copy.go | 40 + .../cosign/cmd/cosign/cli/options/download.go | 31 + .../cosign/cmd/cosign/cli/options/errors.go | 32 + .../cmd/cosign/cli/options/experimental.go | 31 + .../cosign/cmd/cosign/cli/options/files.go | 58 + .../cosign/cmd/cosign/cli/options/flags.go | 36 + .../cosign/cmd/cosign/cli/options/fulcio.go | 44 + .../cosign/cmd/cosign/cli/options/generate.go | 34 + .../cosign/cli/options/generate_key_pair.go | 34 + .../cmd/cosign/cli/options/import_key_pair.go | 35 + .../cmd/cosign/cli/options/initialize.go | 39 + .../cosign/cmd/cosign/cli/options/key.go | 45 + .../cosign/cmd/cosign/cli/options/load.go | 35 + .../cosign/cmd/cosign/cli/options/oidc.go | 77 + .../cosign/cmd/cosign/cli/options/options.go | 23 + .../cosign/cmd/cosign/cli/options/piv_tool.go | 138 + .../cmd/cosign/cli/options/pkcs11_tool.go | 55 + .../cosign/cmd/cosign/cli/options/policy.go | 87 + .../cmd/cosign/cli/options/predicate.go | 102 + .../cmd/cosign/cli/options/public_key.go | 42 + .../cmd/cosign/cli/options/reference.go | 32 + .../cosign/cmd/cosign/cli/options/registry.go | 101 + .../cosign/cmd/cosign/cli/options/rekor.go | 35 + .../cosign/cmd/cosign/cli/options/root.go | 47 + .../cosign/cmd/cosign/cli/options/save.go | 35 + .../cmd/cosign/cli/options/security_key.go | 37 + .../cosign/cmd/cosign/cli/options/sign.go | 101 + .../cosign/cli/options/signature_digest.go | 85 + .../cosign/cmd/cosign/cli/options/signblob.go | 73 + .../cosign/cmd/cosign/cli/options/tree.go | 28 + .../cmd/cosign/cli/options/triangulate.go | 36 + .../cosign/cmd/cosign/cli/options/upload.go | 59 + .../cmd/cosign/cli/options/useragent.go | 33 + .../cosign/cmd/cosign/cli/options/verify.go | 176 + .../sigstore/cosign/pkg/blob/load.go | 71 + .../pkg/cosign/attestation/attestation.go | 285 + .../cosign/pkg/cosign/certextensions.go | 195 + .../sigstore/cosign/pkg/cosign/common.go | 78 + .../sigstore/cosign/pkg/cosign/errors.go | 50 + .../sigstore/cosign/pkg/cosign/fetch.go | 161 + .../sigstore/cosign/pkg/cosign/git/git.go | 38 + .../cosign/pkg/cosign/git/github/github.go | 166 + .../cosign/pkg/cosign/git/gitlab/gitlab.go | 161 + .../sigstore/cosign/pkg/cosign/keys.go | 230 + .../cosign/pkg/cosign/kubernetes/client.go | 54 + .../cosign/pkg/cosign/kubernetes/secret.go | 140 + .../cosign/pkg/cosign/pkcs11key/disabled.go | 69 + .../cosign/pkg/cosign/pkcs11key/pkcs11key.go | 267 + .../cosign/pkg/cosign/pkcs11key/util.go | 248 + .../sigstore/cosign/pkg/cosign/rego/rego.go | 119 + .../cosign/pkg/cosign/rekor_factory.go | 41 + .../cosign/pkg/cosign/remote/index.go | 161 + .../cosign/pkg/cosign/remote/remote.go | 178 + .../sigstore/cosign/pkg/cosign/tlog.go | 492 + .../sigstore/cosign/pkg/cosign/verifiers.go | 90 + .../sigstore/cosign/pkg/cosign/verify.go | 1104 + .../sigstore/cosign/pkg/oci/layout/index.go | 154 + .../cosign/pkg/oci/layout/signatures.go | 45 + .../sigstore/cosign/pkg/oci/layout/write.go | 93 + .../sigstore/cosign/pkg/policy/attestation.go | 143 + .../sigstore/cosign/pkg/policy/eval.go | 80 + .../cosign/pkg/signature/annotations.go | 47 + .../sigstore/cosign/pkg/signature/keys.go | 251 + .../sigstore/policy-controller/COPYRIGHT.txt | 14 + .../sigstore/policy-controller/LICENSE | 201 + .../policy-controller/pkg/apis/config/doc.go | 23 + .../pkg/apis/config/image_policies.go | 176 + .../pkg/apis/config/store.go | 91 + .../pkg/apis/duck/v1beta1/doc.go | 20 + .../apis/duck/v1beta1/podscalable_defaults.go | 46 + .../apis/duck/v1beta1/podscalable_types.go | 129 + .../duck/v1beta1/podscalable_validation.go | 49 + .../pkg/apis/duck/v1beta1/register.go | 54 + .../duck/v1beta1/zz_generated.deepcopy.go | 129 + .../policy-controller/pkg/apis/glob/glob.go | 99 + .../pkg/apis/policy/common/validation.go | 42 + .../pkg/apis/policy/register.go | 31 + .../v1alpha1/clusterimagepolicy_conversion.go | 280 + .../v1alpha1/clusterimagepolicy_defaults.go | 41 + .../v1alpha1/clusterimagepolicy_types.go | 288 + .../v1alpha1/clusterimagepolicy_validation.go | 355 + .../pkg/apis/policy/v1alpha1/doc.go | 17 + .../pkg/apis/policy/v1alpha1/register.go | 53 + .../policy/v1alpha1/zz_generated.deepcopy.go | 424 + .../v1beta1/clusterimagepolicy_conversion.go | 34 + .../v1beta1/clusterimagepolicy_defaults.go | 41 + .../v1beta1/clusterimagepolicy_types.go | 287 + .../v1beta1/clusterimagepolicy_validation.go | 356 + .../pkg/apis/policy/v1beta1/doc.go | 17 + .../pkg/apis/policy/v1beta1/register.go | 53 + .../policy/v1beta1/zz_generated.deepcopy.go | 424 + .../apis/signaturealgo/signature_digest.go | 47 + .../policy-controller/pkg/config/store.go | 146 + .../policy-controller/pkg/webhook/cache.go | 56 + .../clusterimagepolicy_types.go | 377 + .../policy-controller/pkg/webhook/nocache.go | 31 + .../pkg/webhook/validation.go | 137 + .../pkg/webhook/validator.go | 1265 + .../pkg/webhook/validator_result.go | 139 + .../sigstore/rekor/pkg/client/options.go | 97 + .../sigstore/rekor/pkg/client/rekor_client.go | 51 + .../entries/create_log_entry_parameters.go | 164 + .../entries/create_log_entry_responses.go | 372 + .../client/entries/entries_client.go | 213 + .../get_log_entry_by_index_parameters.go | 173 + .../get_log_entry_by_index_responses.go | 248 + .../get_log_entry_by_uuid_parameters.go | 167 + .../get_log_entry_by_uuid_responses.go | 248 + .../entries/search_log_query_parameters.go | 166 + .../entries/search_log_query_responses.go | 329 + .../generated/client/index/index_client.go | 96 + .../client/index/search_index_parameters.go | 166 + .../client/index/search_index_responses.go | 260 + .../pubkey/get_public_key_parameters.go | 179 + .../client/pubkey/get_public_key_responses.go | 191 + .../generated/client/pubkey/pubkey_client.go | 94 + .../pkg/generated/client/rekor_client.go | 143 + .../client/tlog/get_log_info_parameters.go | 144 + .../client/tlog/get_log_info_responses.go | 193 + .../client/tlog/get_log_proof_parameters.go | 255 + .../client/tlog/get_log_proof_responses.go | 262 + .../pkg/generated/client/tlog/tlog_client.go | 135 + .../pkg/generated/models/rekor_version.go | 138 - .../github.com/sigstore/rekor/pkg/log/log.go | 79 + .../sigstore/rekor/pkg/pki/factory.go | 126 + .../rekor/pkg/pki/minisign/minisign.go | 184 + .../sigstore/rekor/pkg/pki/pgp/pgp.go | 305 + .../sigstore/rekor/pkg/pki/pkcs7/pkcs7.go | 215 + .../github.com/sigstore/rekor/pkg/pki/pki.go | 37 + .../sigstore/rekor/pkg/pki/ssh/README.md | 118 + .../sigstore/rekor/pkg/pki/ssh/encode.go | 95 + .../sigstore/rekor/pkg/pki/ssh/sign.go | 105 + .../sigstore/rekor/pkg/pki/ssh/ssh.go | 108 + .../sigstore/rekor/pkg/pki/ssh/verify.go | 50 + .../sigstore/rekor/pkg/pki/tuf/tuf.go | 172 + .../sigstore/rekor/pkg/pki/x509/x509.go | 244 + .../sigstore/rekor/pkg/types/README.md | 30 + .../sigstore/rekor/pkg/types/entries.go | 166 + .../sigstore/rekor/pkg/types/error.go | 20 + .../pkg/types/hashedrekord/hashedrekord.go | 75 + .../hashedrekord/hashedrekord_schema.json | 12 + .../pkg/types/hashedrekord/v0.0.1/entry.go | 247 + .../v0.0.1/hashedrekord_v0_0_1_schema.json | 54 + .../sigstore/rekor/pkg/types/intoto/README.md | 13 + .../sigstore/rekor/pkg/types/intoto/intoto.go | 135 + .../rekor/pkg/types/intoto/intoto_schema.json | 15 + .../rekor/pkg/types/intoto/v0.0.1/entry.go | 328 + .../intoto/v0.0.1/intoto_v0_0_1_schema.json | 70 + .../sigstore/rekor/pkg/types/test_util.go | 81 + .../sigstore/rekor/pkg/types/types.go | 104 + .../sigstore/rekor/pkg/types/versionmap.go | 97 + .../sigstore/rekor/pkg/util/checkpoint.go | 189 + .../sigstore/rekor/pkg/util/fetch.go | 49 + .../sigstore/rekor/pkg/util/pubkey.go | 44 + .../github.com/sigstore/rekor/pkg/util/sha.go | 33 + .../sigstore/rekor/pkg/util/signed_note.go | 192 + .../sigstore/rekor/pkg/util/timestamp_note.go | 171 + .../sigstore/rekor/pkg/util/validate.go | 68 + .../sigstore/sigstore/pkg/cryptoutils/sans.go | 149 + .../sigstore/sigstore/pkg/fulcioroots/doc.go | 17 + .../sigstore/pkg/fulcioroots/fulcioroots.go | 133 + .../sigstore/sigstore/pkg/signature/doc.go | 17 + .../sigstore/pkg/signature/dsse/adapters.go | 75 + .../sigstore/pkg/signature/dsse/doc.go | 17 + .../sigstore/pkg/signature/dsse/dsse.go | 150 + .../sigstore/pkg/signature/dsse/multidsse.go | 186 + .../sigstore/sigstore/pkg/signature/ecdsa.go | 253 + .../sigstore/pkg/signature/ed25519.go | 197 + .../sigstore/pkg/signature/kms/doc.go | 17 + .../sigstore/pkg/signature/kms/kms.go | 78 + .../sigstore/pkg/signature/message.go | 111 + .../sigstore/pkg/signature/options.go | 57 + .../sigstore/pkg/signature/options/context.go | 37 + .../sigstore/pkg/signature/options/digest.go | 35 + .../sigstore/pkg/signature/options/doc.go | 17 + .../pkg/signature/options/keyversion.go | 50 + .../sigstore/pkg/signature/options/noop.go | 49 + .../sigstore/pkg/signature/options/rand.go | 41 + .../signature/options/remoteverification.go | 32 + .../sigstore/pkg/signature/options/rpcauth.go | 58 + .../pkg/signature/options/signeropts.go | 40 + .../sigstore/pkg/signature/payload/doc.go | 17 + .../sigstore/pkg/signature/payload/payload.go | 105 + .../sigstore/pkg/signature/publickey.go | 25 + .../sigstore/pkg/signature/rsapkcs1v15.go | 225 + .../sigstore/sigstore/pkg/signature/rsapss.go | 260 + .../sigstore/sigstore/pkg/signature/signer.go | 89 + .../sigstore/pkg/signature/signerverifier.go | 69 + .../sigstore/sigstore/pkg/signature/util.go | 55 + .../sigstore/pkg/signature/verifier.go | 100 + .../sigstore/sigstore/pkg/tuf/client.go | 708 + .../sigstore/sigstore/pkg/tuf/policy.go | 204 + .../sigstore/pkg/tuf/repository/root.json | 144 + .../pkg/tuf/repository/targets/artifact.pub | 4 + .../pkg/tuf/repository/targets/ctfe.pub | 4 + .../pkg/tuf/repository/targets/fulcio.crt.pem | 13 + .../tuf/repository/targets/fulcio_v1.crt.pem | 13 + .../pkg/tuf/repository/targets/rekor.0.pub | 4 + .../pkg/tuf/repository/targets/rekor.json | 23 + .../pkg/tuf/repository/targets/rekor.pub | 4 + .../sigstore/sigstore/pkg/tuf/signer.go | 48 + .../sigstore/sigstore/pkg/tuf/status_type.go | 60 + .../sigstore/sigstore/pkg/tuf/testutils.go | 129 + .../sigstore/sigstore/pkg/tuf/usage_type.go | 64 + vendor/github.com/syndtr/goleveldb/LICENSE | 24 + .../syndtr/goleveldb/leveldb/batch.go | 384 + .../syndtr/goleveldb/leveldb/cache/cache.go | 827 + .../syndtr/goleveldb/leveldb/cache/lru.go | 158 + .../syndtr/goleveldb/leveldb/comparer.go | 67 + .../leveldb/comparer/bytes_comparer.go | 51 + .../goleveldb/leveldb/comparer/comparer.go | 57 + .../github.com/syndtr/goleveldb/leveldb/db.go | 1233 + .../syndtr/goleveldb/leveldb/db_compaction.go | 874 + .../syndtr/goleveldb/leveldb/db_iter.go | 364 + .../syndtr/goleveldb/leveldb/db_snapshot.go | 187 + .../syndtr/goleveldb/leveldb/db_state.go | 236 + .../goleveldb/leveldb/db_transaction.go | 335 + .../syndtr/goleveldb/leveldb/db_util.go | 102 + .../syndtr/goleveldb/leveldb/db_write.go | 467 + .../syndtr/goleveldb/leveldb/doc.go | 92 + .../syndtr/goleveldb/leveldb/errors.go | 20 + .../syndtr/goleveldb/leveldb/errors/errors.go | 79 + .../syndtr/goleveldb/leveldb/filter.go | 31 + .../syndtr/goleveldb/leveldb/filter/bloom.go | 116 + .../syndtr/goleveldb/leveldb/filter/filter.go | 60 + .../goleveldb/leveldb/iterator/array_iter.go | 181 + .../leveldb/iterator/indexed_iter.go | 241 + .../syndtr/goleveldb/leveldb/iterator/iter.go | 132 + .../goleveldb/leveldb/iterator/merged_iter.go | 350 + .../goleveldb/leveldb/journal/journal.go | 536 + .../syndtr/goleveldb/leveldb/key.go | 143 + .../syndtr/goleveldb/leveldb/memdb/memdb.go | 479 + .../syndtr/goleveldb/leveldb/opt/options.go | 772 + .../goleveldb/leveldb/opt/options_darwin.go | 8 + .../goleveldb/leveldb/opt/options_default.go | 8 + .../syndtr/goleveldb/leveldb/options.go | 107 + .../syndtr/goleveldb/leveldb/session.go | 242 + .../goleveldb/leveldb/session_compaction.go | 329 + .../goleveldb/leveldb/session_record.go | 323 + .../syndtr/goleveldb/leveldb/session_util.go | 491 + .../syndtr/goleveldb/leveldb/storage.go | 63 + .../goleveldb/leveldb/storage/file_storage.go | 679 + .../leveldb/storage/file_storage_nacl.go | 35 + .../leveldb/storage/file_storage_plan9.go | 63 + .../leveldb/storage/file_storage_solaris.go | 82 + .../leveldb/storage/file_storage_unix.go | 99 + .../leveldb/storage/file_storage_windows.go | 78 + .../goleveldb/leveldb/storage/mem_storage.go | 221 + .../goleveldb/leveldb/storage/storage.go | 188 + .../syndtr/goleveldb/leveldb/table.go | 605 + .../syndtr/goleveldb/leveldb/table/reader.go | 1139 + .../syndtr/goleveldb/leveldb/table/table.go | 173 + .../syndtr/goleveldb/leveldb/table/writer.go | 425 + .../syndtr/goleveldb/leveldb/util.go | 91 + .../syndtr/goleveldb/leveldb/util/buffer.go | 314 + .../goleveldb/leveldb/util/buffer_pool.go | 135 + .../syndtr/goleveldb/leveldb/util/crc32.go | 30 + .../syndtr/goleveldb/leveldb/util/hash.go | 48 + .../syndtr/goleveldb/leveldb/util/range.go | 32 + .../syndtr/goleveldb/leveldb/util/util.go | 73 + .../syndtr/goleveldb/leveldb/version.go | 573 + .../github.com/tchap/go-patricia/v2/AUTHORS | 3 + .../github.com/tchap/go-patricia/v2/LICENSE | 20 + .../tchap/go-patricia/v2/patricia/children.go | 363 + .../tchap/go-patricia/v2/patricia/patricia.go | 606 + .../tent/canonical-json-go/.travis.yml | 4 + .../github.com/tent/canonical-json-go/LICENSE | 27 + .../tent/canonical-json-go/encode.go | 620 + .../github.com/thales-e-security/pool/LICENSE | 202 + .../thales-e-security/pool/README.md | 7 + .../thales-e-security/pool/atomic.go | 186 + .../thales-e-security/pool/resource_pool.go | 383 + .../thales-e-security/pool/semaphore.go | 85 + .../thales-e-security/pool/timer.go | 159 + .../theupdateframework/go-tuf/.gitattributes | 5 + .../theupdateframework/go-tuf/.gitignore | 5 + .../theupdateframework/go-tuf/.golangci.yml | 16 + .../theupdateframework/go-tuf/README.md | 655 + .../go-tuf/client/client.go | 917 + .../go-tuf/client/delegations.go | 117 + .../go-tuf/client/errors.go | 107 + .../go-tuf/client/file_store.go | 90 + .../client/leveldbstore/leveldbstore.go | 60 + .../go-tuf/client/local_store.go | 29 + .../go-tuf/client/remote_store.go | 109 + .../go-tuf/data/hex_bytes.go | 42 + .../theupdateframework/go-tuf/data/types.go | 342 + .../theupdateframework/go-tuf/errors.go | 98 + .../go-tuf/internal/fsutil/fsutil.go | 23 + .../go-tuf/internal/fsutil/perm.go | 30 + .../go-tuf/internal/fsutil/perm_windows.go | 17 + .../go-tuf/internal/roles/roles.go | 48 + .../go-tuf/internal/sets/strings.go | 24 + .../go-tuf/internal/signer/sort.go | 49 + .../theupdateframework/go-tuf/local_store.go | 741 + .../pkg/deprecated/set_ecdsa/set_ecdsa.go | 23 + .../go-tuf/pkg/keys/deprecated_ecdsa.go | 101 + .../go-tuf/pkg/keys/ecdsa.go | 171 + .../go-tuf/pkg/keys/ed25519.go | 161 + .../go-tuf/pkg/keys/keys.go | 82 + .../go-tuf/pkg/keys/pkix.go | 56 + .../theupdateframework/go-tuf/pkg/keys/rsa.go | 162 + .../go-tuf/pkg/targets/delegation.go | 95 + .../go-tuf/pkg/targets/hash_bins.go | 113 + .../theupdateframework/go-tuf/repo.go | 1653 + .../go-tuf/requirements-test.txt | 5 + .../theupdateframework/go-tuf/sign/sign.go | 61 + .../theupdateframework/go-tuf/util/util.go | 332 + .../theupdateframework/go-tuf/verify/db.go | 104 + .../go-tuf/verify/errors.go | 73 + .../go-tuf/verify/verify.go | 175 + vendor/github.com/tjfoc/gmsm/LICENSE | 201 + vendor/github.com/tjfoc/gmsm/sm3/ifile | 1 + vendor/github.com/tjfoc/gmsm/sm3/sm3.go | 259 + .../transparency-dev/merkle/CONTRIBUTING.md | 58 + .../transparency-dev/merkle/LICENSE | 202 + .../transparency-dev/merkle/README.md | 25 + .../transparency-dev/merkle/compact/nodes.go | 89 + .../transparency-dev/merkle/compact/range.go | 264 + .../transparency-dev/merkle/hasher.go | 32 + .../transparency-dev/merkle/proof/proof.go | 191 + .../transparency-dev/merkle/proof/verify.go | 176 + .../merkle/rfc6962/rfc6962.go | 68 + vendor/github.com/xanzy/go-gitlab/.gitignore | 30 + .../github.com/xanzy/go-gitlab/.golangci.yml | 59 + vendor/github.com/xanzy/go-gitlab/LICENSE | 201 + vendor/github.com/xanzy/go-gitlab/README.md | 202 + .../xanzy/go-gitlab/access_requests.go | 253 + .../xanzy/go-gitlab/applications.go | 106 + .../xanzy/go-gitlab/audit_events.go | 199 + vendor/github.com/xanzy/go-gitlab/avatar.go | 64 + .../xanzy/go-gitlab/award_emojis.go | 468 + vendor/github.com/xanzy/go-gitlab/boards.go | 367 + vendor/github.com/xanzy/go-gitlab/branches.go | 245 + .../xanzy/go-gitlab/broadcast_messages.go | 173 + .../xanzy/go-gitlab/ci_yml_templates.go | 86 + .../xanzy/go-gitlab/client_options.go | 108 + .../xanzy/go-gitlab/cluster_agents.go | 294 + vendor/github.com/xanzy/go-gitlab/commits.go | 596 + .../xanzy/go-gitlab/container_registry.go | 307 + .../xanzy/go-gitlab/custom_attributes.go | 188 + .../github.com/xanzy/go-gitlab/deploy_keys.go | 275 + .../xanzy/go-gitlab/deploy_tokens.go | 288 + .../github.com/xanzy/go-gitlab/deployments.go | 203 + .../go-gitlab/deployments_merge_requests.go | 54 + .../github.com/xanzy/go-gitlab/discussions.go | 1114 + .../xanzy/go-gitlab/environments.go | 224 + .../github.com/xanzy/go-gitlab/epic_issues.go | 152 + vendor/github.com/xanzy/go-gitlab/epics.go | 265 + .../xanzy/go-gitlab/error_tracking.go | 196 + .../xanzy/go-gitlab/event_parsing.go | 284 + .../xanzy/go-gitlab/event_systemhook_types.go | 248 + .../xanzy/go-gitlab/event_webhook_types.go | 1005 + vendor/github.com/xanzy/go-gitlab/events.go | 148 + .../xanzy/go-gitlab/external_status_checks.go | 199 + .../xanzy/go-gitlab/feature_flags.go | 96 + .../xanzy/go-gitlab/freeze_periods.go | 194 + .../xanzy/go-gitlab/generic_packages.go | 158 + .../github.com/xanzy/go-gitlab/geo_nodes.go | 433 + .../xanzy/go-gitlab/gitignore_templates.go | 85 + vendor/github.com/xanzy/go-gitlab/gitlab.go | 945 + .../xanzy/go-gitlab/group_access_tokens.go | 165 + .../xanzy/go-gitlab/group_badges.go | 230 + .../xanzy/go-gitlab/group_boards.go | 352 + .../xanzy/go-gitlab/group_clusters.go | 217 + .../github.com/xanzy/go-gitlab/group_hooks.go | 217 + .../xanzy/go-gitlab/group_import_export.go | 180 + .../xanzy/go-gitlab/group_iterations.go | 90 + .../xanzy/go-gitlab/group_labels.go | 249 + .../xanzy/go-gitlab/group_members.go | 356 + .../xanzy/go-gitlab/group_milestones.go | 296 + .../xanzy/go-gitlab/group_variables.go | 203 + .../github.com/xanzy/go-gitlab/group_wikis.go | 204 + vendor/github.com/xanzy/go-gitlab/groups.go | 1067 + .../xanzy/go-gitlab/instance_clusters.go | 153 + .../xanzy/go-gitlab/instance_variables.go | 180 + vendor/github.com/xanzy/go-gitlab/invites.go | 176 + .../github.com/xanzy/go-gitlab/issue_links.go | 155 + vendor/github.com/xanzy/go-gitlab/issues.go | 752 + .../xanzy/go-gitlab/issues_statistics.go | 187 + vendor/github.com/xanzy/go-gitlab/jobs.go | 550 + vendor/github.com/xanzy/go-gitlab/keys.go | 66 + vendor/github.com/xanzy/go-gitlab/labels.go | 309 + vendor/github.com/xanzy/go-gitlab/license.go | 112 + .../xanzy/go-gitlab/license_templates.go | 109 + vendor/github.com/xanzy/go-gitlab/markdown.go | 47 + .../go-gitlab/merge_request_approvals.go | 419 + .../xanzy/go-gitlab/merge_requests.go | 938 + .../github.com/xanzy/go-gitlab/milestones.go | 271 + .../github.com/xanzy/go-gitlab/namespaces.go | 174 + vendor/github.com/xanzy/go-gitlab/notes.go | 693 + .../xanzy/go-gitlab/notifications.go | 230 + vendor/github.com/xanzy/go-gitlab/packages.go | 245 + vendor/github.com/xanzy/go-gitlab/pages.go | 45 + .../xanzy/go-gitlab/pages_domains.go | 213 + .../xanzy/go-gitlab/personal_access_tokens.go | 95 + .../xanzy/go-gitlab/pipeline_schedules.go | 347 + .../xanzy/go-gitlab/pipeline_triggers.go | 248 + .../github.com/xanzy/go-gitlab/pipelines.go | 375 + .../github.com/xanzy/go-gitlab/plan_limits.go | 104 + .../xanzy/go-gitlab/project_access_tokens.go | 166 + .../xanzy/go-gitlab/project_badges.go | 230 + .../xanzy/go-gitlab/project_clusters.go | 236 + .../xanzy/go-gitlab/project_import_export.go | 225 + .../xanzy/go-gitlab/project_iterations.go | 90 + .../go-gitlab/project_managed_licenses.go | 188 + .../xanzy/go-gitlab/project_members.go | 236 + .../xanzy/go-gitlab/project_mirror.go | 192 + .../xanzy/go-gitlab/project_snippets.go | 208 + .../xanzy/go-gitlab/project_variables.go | 226 + .../go-gitlab/project_vulnerabilities.go | 150 + vendor/github.com/xanzy/go-gitlab/projects.go | 1966 + .../xanzy/go-gitlab/protected_branches.go | 217 + .../xanzy/go-gitlab/protected_environments.go | 180 + .../xanzy/go-gitlab/protected_tags.go | 162 + .../xanzy/go-gitlab/releaselinks.go | 199 + vendor/github.com/xanzy/go-gitlab/releases.go | 241 + .../xanzy/go-gitlab/repositories.go | 332 + .../xanzy/go-gitlab/repository_files.go | 382 + .../xanzy/go-gitlab/repository_submodules.go | 93 + .../xanzy/go-gitlab/request_options.go | 61 + .../xanzy/go-gitlab/resource_label_events.go | 220 + .../go-gitlab/resource_milestone_events.go | 155 + .../xanzy/go-gitlab/resource_state_events.go | 154 + vendor/github.com/xanzy/go-gitlab/runners.go | 597 + vendor/github.com/xanzy/go-gitlab/search.go | 358 + vendor/github.com/xanzy/go-gitlab/services.go | 1608 + vendor/github.com/xanzy/go-gitlab/settings.go | 767 + .../xanzy/go-gitlab/sidekiq_metrics.go | 157 + vendor/github.com/xanzy/go-gitlab/snippets.go | 245 + vendor/github.com/xanzy/go-gitlab/strings.go | 94 + .../xanzy/go-gitlab/system_hooks.go | 176 + vendor/github.com/xanzy/go-gitlab/tags.go | 248 + .../github.com/xanzy/go-gitlab/time_stats.go | 179 + vendor/github.com/xanzy/go-gitlab/todos.go | 162 + vendor/github.com/xanzy/go-gitlab/topics.go | 222 + vendor/github.com/xanzy/go-gitlab/types.go | 821 + vendor/github.com/xanzy/go-gitlab/users.go | 1339 + vendor/github.com/xanzy/go-gitlab/validate.go | 147 + vendor/github.com/xanzy/go-gitlab/version.go | 58 + vendor/github.com/xanzy/go-gitlab/wikis.go | 204 + .../gojsonpointer/LICENSE-APACHE-2.0.txt | 202 + .../xeipuuv/gojsonpointer/README.md | 41 + .../xeipuuv/gojsonpointer/pointer.go | 211 + .../gojsonreference/LICENSE-APACHE-2.0.txt | 202 + .../xeipuuv/gojsonreference/README.md | 10 + .../xeipuuv/gojsonreference/reference.go | 147 + .../yashtewari/glob-intersection/LICENSE | 201 + .../yashtewari/glob-intersection/README.md | 26 + .../yashtewari/glob-intersection/glob.go | 182 + .../yashtewari/glob-intersection/match.go | 91 + .../yashtewari/glob-intersection/non_empty.go | 154 + .../yashtewari/glob-intersection/simplify.go | 43 + .../glob-intersection/test_samples.go | 84 + .../yashtewari/glob-intersection/tokenize.go | 252 + vendor/go.opencensus.io/.gitignore | 9 + vendor/go.opencensus.io/AUTHORS | 1 + vendor/go.opencensus.io/CONTRIBUTING.md | 63 + vendor/go.opencensus.io/LICENSE | 202 + vendor/go.opencensus.io/Makefile | 97 + vendor/go.opencensus.io/README.md | 267 + vendor/go.opencensus.io/appveyor.yml | 24 + vendor/go.opencensus.io/internal/internal.go | 37 + vendor/go.opencensus.io/internal/sanitize.go | 50 + .../internal/tagencoding/tagencoding.go | 75 + .../internal/traceinternals.go | 53 + .../go.opencensus.io/metric/metricdata/doc.go | 19 + .../metric/metricdata/exemplar.go | 38 + .../metric/metricdata/label.go | 35 + .../metric/metricdata/metric.go | 46 + .../metric/metricdata/point.go | 193 + .../metric/metricdata/type_string.go | 16 + .../metric/metricdata/unit.go | 27 + .../metric/metricexport/doc.go | 19 + .../metric/metricexport/export.go | 26 + .../metric/metricexport/reader.go | 200 + .../metric/metricproducer/manager.go | 78 + .../metric/metricproducer/producer.go | 28 + vendor/go.opencensus.io/opencensus.go | 21 + .../go.opencensus.io/plugin/ocgrpc/client.go | 56 + .../plugin/ocgrpc/client_metrics.go | 118 + .../plugin/ocgrpc/client_stats_handler.go | 49 + vendor/go.opencensus.io/plugin/ocgrpc/doc.go | 19 + .../go.opencensus.io/plugin/ocgrpc/server.go | 81 + .../plugin/ocgrpc/server_metrics.go | 108 + .../plugin/ocgrpc/server_stats_handler.go | 63 + .../plugin/ocgrpc/stats_common.go | 248 + .../plugin/ocgrpc/trace_common.go | 107 + vendor/go.opencensus.io/resource/resource.go | 164 + vendor/go.opencensus.io/stats/doc.go | 68 + .../go.opencensus.io/stats/internal/record.go | 31 + vendor/go.opencensus.io/stats/measure.go | 109 + .../go.opencensus.io/stats/measure_float64.go | 55 + .../go.opencensus.io/stats/measure_int64.go | 55 + vendor/go.opencensus.io/stats/record.go | 156 + vendor/go.opencensus.io/stats/units.go | 26 + .../stats/view/aggregation.go | 123 + .../stats/view/aggregation_data.go | 336 + .../go.opencensus.io/stats/view/collector.go | 93 + vendor/go.opencensus.io/stats/view/doc.go | 47 + vendor/go.opencensus.io/stats/view/export.go | 45 + vendor/go.opencensus.io/stats/view/view.go | 221 + .../stats/view/view_to_metric.go | 147 + vendor/go.opencensus.io/stats/view/worker.go | 424 + .../stats/view/worker_commands.go | 186 + vendor/go.opencensus.io/tag/context.go | 43 + vendor/go.opencensus.io/tag/doc.go | 26 + vendor/go.opencensus.io/tag/key.go | 44 + vendor/go.opencensus.io/tag/map.go | 229 + vendor/go.opencensus.io/tag/map_codec.go | 239 + vendor/go.opencensus.io/tag/metadata.go | 52 + vendor/go.opencensus.io/tag/profile_19.go | 32 + vendor/go.opencensus.io/tag/profile_not19.go | 24 + vendor/go.opencensus.io/tag/validate.go | 56 + vendor/go.opencensus.io/trace/basetypes.go | 129 + vendor/go.opencensus.io/trace/config.go | 86 + vendor/go.opencensus.io/trace/doc.go | 52 + vendor/go.opencensus.io/trace/evictedqueue.go | 38 + vendor/go.opencensus.io/trace/export.go | 97 + .../trace/internal/internal.go | 22 + vendor/go.opencensus.io/trace/lrumap.go | 61 + .../trace/propagation/propagation.go | 108 + vendor/go.opencensus.io/trace/sampling.go | 75 + vendor/go.opencensus.io/trace/spanbucket.go | 130 + vendor/go.opencensus.io/trace/spanstore.go | 308 + vendor/go.opencensus.io/trace/status_codes.go | 37 + vendor/go.opencensus.io/trace/trace.go | 595 + vendor/go.opencensus.io/trace/trace_api.go | 265 + vendor/go.opencensus.io/trace/trace_go11.go | 33 + .../go.opencensus.io/trace/trace_nongo11.go | 26 + .../trace/tracestate/tracestate.go | 147 + vendor/go.uber.org/atomic/.codecov.yml | 19 + vendor/go.uber.org/atomic/.gitignore | 15 + vendor/go.uber.org/atomic/CHANGELOG.md | 117 + vendor/go.uber.org/atomic/LICENSE.txt | 19 + vendor/go.uber.org/atomic/Makefile | 79 + vendor/go.uber.org/atomic/README.md | 63 + vendor/go.uber.org/atomic/bool.go | 88 + vendor/go.uber.org/atomic/bool_ext.go | 53 + vendor/go.uber.org/atomic/doc.go | 23 + vendor/go.uber.org/atomic/duration.go | 89 + vendor/go.uber.org/atomic/duration_ext.go | 40 + vendor/go.uber.org/atomic/error.go | 62 + vendor/go.uber.org/atomic/error_ext.go | 39 + vendor/go.uber.org/atomic/float32.go | 77 + vendor/go.uber.org/atomic/float32_ext.go | 76 + vendor/go.uber.org/atomic/float64.go | 77 + vendor/go.uber.org/atomic/float64_ext.go | 76 + vendor/go.uber.org/atomic/gen.go | 27 + vendor/go.uber.org/atomic/int32.go | 109 + vendor/go.uber.org/atomic/int64.go | 109 + vendor/go.uber.org/atomic/nocmp.go | 35 + vendor/go.uber.org/atomic/pointer_go118.go | 60 + vendor/go.uber.org/atomic/pointer_go119.go | 61 + vendor/go.uber.org/atomic/string.go | 65 + vendor/go.uber.org/atomic/string_ext.go | 43 + vendor/go.uber.org/atomic/time.go | 55 + vendor/go.uber.org/atomic/time_ext.go | 36 + vendor/go.uber.org/atomic/uint32.go | 109 + vendor/go.uber.org/atomic/uint64.go | 109 + vendor/go.uber.org/atomic/uintptr.go | 109 + vendor/go.uber.org/atomic/unsafe_pointer.go | 65 + vendor/go.uber.org/atomic/value.go | 31 + vendor/go.uber.org/multierr/.codecov.yml | 15 + vendor/go.uber.org/multierr/.gitignore | 4 + vendor/go.uber.org/multierr/CHANGELOG.md | 72 + vendor/go.uber.org/multierr/LICENSE.txt | 19 + vendor/go.uber.org/multierr/Makefile | 38 + vendor/go.uber.org/multierr/README.md | 23 + vendor/go.uber.org/multierr/error.go | 652 + vendor/go.uber.org/multierr/glide.yaml | 8 + vendor/go.uber.org/zap/.codecov.yml | 17 + vendor/go.uber.org/zap/.gitignore | 32 + vendor/go.uber.org/zap/.readme.tmpl | 109 + vendor/go.uber.org/zap/CHANGELOG.md | 617 + vendor/go.uber.org/zap/CODE_OF_CONDUCT.md | 75 + vendor/go.uber.org/zap/CONTRIBUTING.md | 70 + vendor/go.uber.org/zap/FAQ.md | 164 + vendor/go.uber.org/zap/LICENSE.txt | 19 + vendor/go.uber.org/zap/Makefile | 73 + vendor/go.uber.org/zap/README.md | 133 + vendor/go.uber.org/zap/array.go | 320 + vendor/go.uber.org/zap/array_go118.go | 156 + vendor/go.uber.org/zap/buffer/buffer.go | 141 + vendor/go.uber.org/zap/buffer/pool.go | 49 + vendor/go.uber.org/zap/checklicense.sh | 17 + vendor/go.uber.org/zap/config.go | 264 + vendor/go.uber.org/zap/doc.go | 117 + vendor/go.uber.org/zap/encoder.go | 79 + vendor/go.uber.org/zap/error.go | 80 + vendor/go.uber.org/zap/field.go | 549 + vendor/go.uber.org/zap/flag.go | 39 + vendor/go.uber.org/zap/glide.yaml | 34 + vendor/go.uber.org/zap/global.go | 169 + vendor/go.uber.org/zap/http_handler.go | 133 + .../zap/internal/bufferpool/bufferpool.go | 31 + .../go.uber.org/zap/internal/color/color.go | 44 + vendor/go.uber.org/zap/internal/exit/exit.go | 66 + .../go.uber.org/zap/internal/level_enabler.go | 35 + vendor/go.uber.org/zap/level.go | 152 + vendor/go.uber.org/zap/logger.go | 400 + vendor/go.uber.org/zap/options.go | 167 + vendor/go.uber.org/zap/sink.go | 179 + vendor/go.uber.org/zap/stacktrace.go | 176 + vendor/go.uber.org/zap/sugar.go | 416 + vendor/go.uber.org/zap/time.go | 27 + vendor/go.uber.org/zap/writer.go | 98 + .../zap/zapcore/buffered_write_syncer.go | 219 + vendor/go.uber.org/zap/zapcore/clock.go | 48 + .../zap/zapcore/console_encoder.go | 157 + vendor/go.uber.org/zap/zapcore/core.go | 122 + vendor/go.uber.org/zap/zapcore/doc.go | 24 + vendor/go.uber.org/zap/zapcore/encoder.go | 451 + vendor/go.uber.org/zap/zapcore/entry.go | 300 + vendor/go.uber.org/zap/zapcore/error.go | 132 + vendor/go.uber.org/zap/zapcore/field.go | 233 + vendor/go.uber.org/zap/zapcore/hook.go | 77 + .../go.uber.org/zap/zapcore/increase_level.go | 75 + .../go.uber.org/zap/zapcore/json_encoder.go | 562 + vendor/go.uber.org/zap/zapcore/level.go | 229 + .../go.uber.org/zap/zapcore/level_strings.go | 46 + vendor/go.uber.org/zap/zapcore/marshaler.go | 61 + .../go.uber.org/zap/zapcore/memory_encoder.go | 179 + .../zap/zapcore/reflected_encoder.go | 41 + vendor/go.uber.org/zap/zapcore/sampler.go | 230 + vendor/go.uber.org/zap/zapcore/tee.go | 96 + .../go.uber.org/zap/zapcore/write_syncer.go | 122 + vendor/golang.org/x/crypto/blake2b/blake2b.go | 291 + .../x/crypto/blake2b/blake2bAVX2_amd64.go | 38 + .../x/crypto/blake2b/blake2bAVX2_amd64.s | 745 + .../x/crypto/blake2b/blake2b_amd64.go | 25 + .../x/crypto/blake2b/blake2b_amd64.s | 279 + .../x/crypto/blake2b/blake2b_generic.go | 182 + .../x/crypto/blake2b/blake2b_ref.go | 12 + vendor/golang.org/x/crypto/blake2b/blake2x.go | 177 + .../golang.org/x/crypto/blake2b/register.go | 33 + vendor/golang.org/x/crypto/blowfish/block.go | 159 + vendor/golang.org/x/crypto/blowfish/cipher.go | 99 + vendor/golang.org/x/crypto/blowfish/const.go | 199 + vendor/golang.org/x/crypto/cast5/cast5.go | 536 + .../x/crypto/chacha20/chacha_arm64.go | 17 + .../x/crypto/chacha20/chacha_arm64.s | 308 + .../x/crypto/chacha20/chacha_generic.go | 398 + .../x/crypto/chacha20/chacha_noasm.go | 14 + .../x/crypto/chacha20/chacha_ppc64le.go | 17 + .../x/crypto/chacha20/chacha_ppc64le.s | 450 + .../x/crypto/chacha20/chacha_s390x.go | 28 + .../x/crypto/chacha20/chacha_s390x.s | 225 + vendor/golang.org/x/crypto/chacha20/xor.go | 42 + vendor/golang.org/x/crypto/cryptobyte/asn1.go | 816 + .../x/crypto/cryptobyte/asn1/asn1.go | 46 + .../golang.org/x/crypto/cryptobyte/builder.go | 342 + .../golang.org/x/crypto/cryptobyte/string.go | 172 + .../x/crypto/curve25519/curve25519.go | 146 + .../x/crypto/curve25519/internal/field/README | 7 + .../x/crypto/curve25519/internal/field/fe.go | 416 + .../curve25519/internal/field/fe_amd64.go | 16 + .../curve25519/internal/field/fe_amd64.s | 379 + .../internal/field/fe_amd64_noasm.go | 12 + .../curve25519/internal/field/fe_arm64.go | 16 + .../curve25519/internal/field/fe_arm64.s | 43 + .../internal/field/fe_arm64_noasm.go | 12 + .../curve25519/internal/field/fe_generic.go | 264 + .../curve25519/internal/field/sync.checkpoint | 1 + .../crypto/curve25519/internal/field/sync.sh | 19 + vendor/golang.org/x/crypto/nacl/box/box.go | 182 + .../x/crypto/openpgp/armor/armor.go | 232 + .../x/crypto/openpgp/armor/encode.go | 161 + .../x/crypto/openpgp/canonical_text.go | 59 + .../x/crypto/openpgp/elgamal/elgamal.go | 130 + .../x/crypto/openpgp/errors/errors.go | 78 + vendor/golang.org/x/crypto/openpgp/keys.go | 693 + .../x/crypto/openpgp/packet/compressed.go | 123 + .../x/crypto/openpgp/packet/config.go | 91 + .../x/crypto/openpgp/packet/encrypted_key.go | 208 + .../x/crypto/openpgp/packet/literal.go | 89 + .../x/crypto/openpgp/packet/ocfb.go | 143 + .../openpgp/packet/one_pass_signature.go | 73 + .../x/crypto/openpgp/packet/opaque.go | 161 + .../x/crypto/openpgp/packet/packet.go | 590 + .../x/crypto/openpgp/packet/private_key.go | 384 + .../x/crypto/openpgp/packet/public_key.go | 753 + .../x/crypto/openpgp/packet/public_key_v3.go | 279 + .../x/crypto/openpgp/packet/reader.go | 76 + .../x/crypto/openpgp/packet/signature.go | 731 + .../x/crypto/openpgp/packet/signature_v3.go | 146 + .../openpgp/packet/symmetric_key_encrypted.go | 155 + .../openpgp/packet/symmetrically_encrypted.go | 290 + .../x/crypto/openpgp/packet/userattribute.go | 90 + .../x/crypto/openpgp/packet/userid.go | 159 + vendor/golang.org/x/crypto/openpgp/read.go | 448 + vendor/golang.org/x/crypto/openpgp/s2k/s2k.go | 279 + vendor/golang.org/x/crypto/openpgp/write.go | 418 + .../x/crypto/pkcs12/internal/rc2/rc2.go | 53 +- .../x/crypto/salsa20/salsa/hsalsa20.go | 66 +- .../x/crypto/salsa20/salsa/salsa208.go | 66 +- .../x/crypto/salsa20/salsa/salsa20_ref.go | 66 +- vendor/golang.org/x/crypto/sha3/doc.go | 62 + vendor/golang.org/x/crypto/sha3/hashes.go | 97 + .../x/crypto/sha3/hashes_generic.go | 28 + vendor/golang.org/x/crypto/sha3/keccakf.go | 415 + .../golang.org/x/crypto/sha3/keccakf_amd64.go | 14 + .../golang.org/x/crypto/sha3/keccakf_amd64.s | 391 + vendor/golang.org/x/crypto/sha3/register.go | 19 + vendor/golang.org/x/crypto/sha3/sha3.go | 193 + vendor/golang.org/x/crypto/sha3/sha3_s390x.go | 287 + vendor/golang.org/x/crypto/sha3/sha3_s390x.s | 34 + vendor/golang.org/x/crypto/sha3/shake.go | 173 + .../golang.org/x/crypto/sha3/shake_generic.go | 20 + vendor/golang.org/x/crypto/sha3/xor.go | 24 + .../golang.org/x/crypto/sha3/xor_generic.go | 28 + .../golang.org/x/crypto/sha3/xor_unaligned.go | 68 + vendor/golang.org/x/crypto/ssh/buffer.go | 97 + vendor/golang.org/x/crypto/ssh/certs.go | 589 + vendor/golang.org/x/crypto/ssh/channel.go | 633 + vendor/golang.org/x/crypto/ssh/cipher.go | 788 + vendor/golang.org/x/crypto/ssh/client.go | 282 + vendor/golang.org/x/crypto/ssh/client_auth.go | 725 + vendor/golang.org/x/crypto/ssh/common.go | 445 + vendor/golang.org/x/crypto/ssh/connection.go | 143 + vendor/golang.org/x/crypto/ssh/doc.go | 22 + vendor/golang.org/x/crypto/ssh/handshake.go | 723 + .../ssh/internal/bcrypt_pbkdf/bcrypt_pbkdf.go | 93 + vendor/golang.org/x/crypto/ssh/kex.go | 774 + vendor/golang.org/x/crypto/ssh/keys.go | 1447 + vendor/golang.org/x/crypto/ssh/mac.go | 61 + vendor/golang.org/x/crypto/ssh/messages.go | 877 + vendor/golang.org/x/crypto/ssh/mux.go | 351 + vendor/golang.org/x/crypto/ssh/server.go | 755 + vendor/golang.org/x/crypto/ssh/session.go | 647 + vendor/golang.org/x/crypto/ssh/ssh_gss.go | 139 + vendor/golang.org/x/crypto/ssh/streamlocal.go | 116 + vendor/golang.org/x/crypto/ssh/tcpip.go | 474 + .../x/crypto/ssh/terminal/terminal.go | 76 + vendor/golang.org/x/crypto/ssh/transport.go | 357 + vendor/golang.org/x/exp/LICENSE | 27 + vendor/golang.org/x/exp/PATENTS | 22 + .../x/exp/constraints/constraints.go | 50 + vendor/golang.org/x/exp/slices/slices.go | 248 + vendor/golang.org/x/exp/slices/sort.go | 127 + vendor/golang.org/x/exp/slices/zsortfunc.go | 479 + .../golang.org/x/exp/slices/zsortordered.go | 481 + vendor/golang.org/x/mod/sumdb/note/note.go | 678 + vendor/golang.org/x/net/http2/h2c/h2c.go | 240 + .../google/internal/externalaccount/aws.go | 105 +- .../externalaccount/basecredentials.go | 4 + vendor/golang.org/x/text/encoding/encoding.go | 335 + .../internal/identifier/identifier.go | 81 + .../text/encoding/internal/identifier/mib.go | 1627 + .../x/text/encoding/internal/internal.go | 75 + .../x/text/encoding/unicode/override.go | 82 + .../x/text/encoding/unicode/unicode.go | 512 + .../x/text/internal/language/common.go | 16 + .../x/text/internal/language/compact.go | 29 + .../text/internal/language/compact/compact.go | 61 + .../internal/language/compact/language.go | 260 + .../text/internal/language/compact/parents.go | 120 + .../text/internal/language/compact/tables.go | 1015 + .../x/text/internal/language/compact/tags.go | 91 + .../x/text/internal/language/compose.go | 167 + .../x/text/internal/language/coverage.go | 28 + .../x/text/internal/language/language.go | 627 + .../x/text/internal/language/lookup.go | 412 + .../x/text/internal/language/match.go | 226 + .../x/text/internal/language/parse.go | 608 + .../x/text/internal/language/tables.go | 3472 + .../x/text/internal/language/tags.go | 48 + vendor/golang.org/x/text/internal/tag/tag.go | 100 + .../internal/utf8internal/utf8internal.go | 87 + vendor/golang.org/x/text/language/coverage.go | 187 + vendor/golang.org/x/text/language/doc.go | 98 + vendor/golang.org/x/text/language/language.go | 605 + vendor/golang.org/x/text/language/match.go | 735 + vendor/golang.org/x/text/language/parse.go | 256 + vendor/golang.org/x/text/language/tables.go | 298 + vendor/golang.org/x/text/language/tags.go | 145 + vendor/golang.org/x/time/LICENSE | 27 + vendor/golang.org/x/time/PATENTS | 22 + vendor/golang.org/x/time/rate/rate.go | 428 + vendor/golang.org/x/time/rate/sometimes.go | 67 + vendor/gomodules.xyz/jsonpatch/v2/LICENSE | 202 + .../gomodules.xyz/jsonpatch/v2/jsonpatch.go | 334 + vendor/google.golang.org/api/AUTHORS | 11 + vendor/google.golang.org/api/CONTRIBUTORS | 56 + vendor/google.golang.org/api/LICENSE | 27 + .../api/support/bundler/bundler.go | 407 + .../googleapis/api/httpbody/httpbody.pb.go | 235 + .../protobuf/field_mask/field_mask.go | 23 + .../grpc/attributes/attributes.go | 2 +- vendor/google.golang.org/grpc/backoff.go | 2 +- .../grpc/balancer/balancer.go | 23 + .../grpc/balancer/base/balancer.go | 4 +- .../grpc/balancer/conn_state_evaluator.go | 12 +- .../grpc/balancer_conn_wrappers.go | 71 +- .../grpc_binarylog_v1/binarylog.pb.go | 13 +- .../grpc/channelz/channelz.go | 2 +- vendor/google.golang.org/grpc/clientconn.go | 135 +- .../grpc/credentials/credentials.go | 20 +- .../google.golang.org/grpc/credentials/tls.go | 2 +- .../grpc/encoding/encoding.go | 5 +- .../grpc/grpclog/loggerv2.go | 2 +- .../grpc/health/grpc_health_v1/health.pb.go | 313 + .../health/grpc_health_v1/health_grpc.pb.go | 218 + .../grpc/internal/binarylog/env_config.go | 18 +- .../grpc/internal/channelz/types.go | 16 +- .../grpc/internal/envconfig/envconfig.go | 8 +- .../grpc/internal/grpclog/grpclog.go | 2 +- .../grpc/internal/grpcsync/oncefunc.go | 32 + .../grpc/internal/grpcutil/compressor.go | 47 + .../grpc/internal/grpcutil/method.go | 1 - .../internal/serviceconfig/serviceconfig.go | 8 +- .../grpc/internal/status/status.go | 10 + .../grpc/internal/transport/handler_server.go | 8 +- .../grpc/internal/transport/http2_client.go | 167 +- .../grpc/internal/transport/transport.go | 14 +- .../grpc/metadata/metadata.go | 20 +- .../google.golang.org/grpc/picker_wrapper.go | 7 +- vendor/google.golang.org/grpc/preloader.go | 2 +- .../grpc/resolver/resolver.go | 14 +- vendor/google.golang.org/grpc/rpc_util.go | 39 +- .../grpc/serviceconfig/serviceconfig.go | 2 +- .../google.golang.org/grpc/status/status.go | 12 +- vendor/google.golang.org/grpc/stream.go | 20 +- vendor/google.golang.org/grpc/tap/tap.go | 2 +- vendor/google.golang.org/grpc/version.go | 2 +- vendor/google.golang.org/grpc/vet.sh | 6 +- .../types/known/fieldmaskpb/field_mask.pb.go | 591 + .../types/known/structpb/struct.pb.go | 810 + .../types/known/wrapperspb/wrappers.pb.go | 760 + vendor/gopkg.in/inf.v0/LICENSE | 28 + vendor/gopkg.in/inf.v0/dec.go | 615 + vendor/gopkg.in/inf.v0/rounder.go | 145 + vendor/k8s.io/api/LICENSE | 202 + vendor/k8s.io/api/admission/v1/doc.go | 23 + .../k8s.io/api/admission/v1/generated.pb.go | 1783 + .../k8s.io/api/admission/v1/generated.proto | 167 + vendor/k8s.io/api/admission/v1/register.go | 53 + vendor/k8s.io/api/admission/v1/types.go | 169 + .../v1/types_swagger_doc_generated.go | 78 + .../api/admission/v1/zz_generated.deepcopy.go | 142 + .../api/admissionregistration/v1/doc.go | 26 + .../admissionregistration/v1/generated.pb.go | 3414 + .../admissionregistration/v1/generated.proto | 483 + .../api/admissionregistration/v1/register.go | 56 + .../api/admissionregistration/v1/types.go | 565 + .../v1/types_swagger_doc_generated.go | 151 + .../v1/zz_generated.deepcopy.go | 397 + .../api/admissionregistration/v1beta1/doc.go | 27 + .../v1beta1/generated.pb.go | 2883 + .../v1beta1/generated.proto | 431 + .../admissionregistration/v1beta1/register.go | 56 + .../admissionregistration/v1beta1/types.go | 533 + .../v1beta1/types_swagger_doc_generated.go | 130 + .../v1beta1/zz_generated.deepcopy.go | 340 + .../zz_generated.prerelease-lifecycle.go | 122 + .../api/apiserverinternal/v1alpha1/doc.go | 25 + .../v1alpha1/generated.pb.go | 1700 + .../v1alpha1/generated.proto | 124 + .../apiserverinternal/v1alpha1/register.go | 48 + .../api/apiserverinternal/v1alpha1/types.go | 130 + .../v1alpha1/types_swagger_doc_generated.go | 95 + .../v1alpha1/zz_generated.deepcopy.go | 176 + vendor/k8s.io/api/apps/v1/doc.go | 21 + vendor/k8s.io/api/apps/v1/generated.pb.go | 8772 ++ vendor/k8s.io/api/apps/v1/generated.proto | 802 + vendor/k8s.io/api/apps/v1/register.go | 60 + vendor/k8s.io/api/apps/v1/types.go | 951 + .../apps/v1/types_swagger_doc_generated.go | 393 + .../api/apps/v1/zz_generated.deepcopy.go | 825 + vendor/k8s.io/api/apps/v1beta1/doc.go | 22 + .../k8s.io/api/apps/v1beta1/generated.pb.go | 6748 ++ .../k8s.io/api/apps/v1beta1/generated.proto | 555 + vendor/k8s.io/api/apps/v1beta1/register.go | 58 + vendor/k8s.io/api/apps/v1beta1/types.go | 686 + .../v1beta1/types_swagger_doc_generated.go | 297 + .../api/apps/v1beta1/zz_generated.deepcopy.go | 642 + .../zz_generated.prerelease-lifecycle.go | 218 + vendor/k8s.io/api/apps/v1beta2/doc.go | 22 + .../k8s.io/api/apps/v1beta2/generated.pb.go | 9538 +++ .../k8s.io/api/apps/v1beta2/generated.proto | 844 + vendor/k8s.io/api/apps/v1beta2/register.go | 61 + vendor/k8s.io/api/apps/v1beta2/types.go | 1029 + .../v1beta2/types_swagger_doc_generated.go | 421 + .../api/apps/v1beta2/zz_generated.deepcopy.go | 892 + .../zz_generated.prerelease-lifecycle.go | 290 + vendor/k8s.io/api/authentication/v1/doc.go | 22 + .../api/authentication/v1/generated.pb.go | 2554 + .../api/authentication/v1/generated.proto | 188 + .../k8s.io/api/authentication/v1/register.go | 52 + vendor/k8s.io/api/authentication/v1/types.go | 199 + .../v1/types_swagger_doc_generated.go | 119 + .../v1/zz_generated.deepcopy.go | 245 + .../k8s.io/api/authentication/v1beta1/doc.go | 23 + .../authentication/v1beta1/generated.pb.go | 1543 + .../authentication/v1beta1/generated.proto | 120 + .../api/authentication/v1beta1/register.go | 51 + .../api/authentication/v1beta1/types.go | 115 + .../v1beta1/types_swagger_doc_generated.go | 75 + .../v1beta1/zz_generated.deepcopy.go | 153 + .../zz_generated.prerelease-lifecycle.go | 50 + vendor/k8s.io/api/authorization/v1/doc.go | 23 + .../api/authorization/v1/generated.pb.go | 4045 + .../api/authorization/v1/generated.proto | 281 + .../k8s.io/api/authorization/v1/register.go | 55 + vendor/k8s.io/api/authorization/v1/types.go | 277 + .../v1/types_swagger_doc_generated.go | 178 + .../authorization/v1/zz_generated.deepcopy.go | 386 + .../k8s.io/api/authorization/v1beta1/doc.go | 24 + .../api/authorization/v1beta1/generated.pb.go | 4045 + .../api/authorization/v1beta1/generated.proto | 281 + .../api/authorization/v1beta1/register.go | 55 + .../k8s.io/api/authorization/v1beta1/types.go | 289 + .../v1beta1/types_swagger_doc_generated.go | 178 + .../v1beta1/zz_generated.deepcopy.go | 386 + .../zz_generated.prerelease-lifecycle.go | 122 + vendor/k8s.io/api/autoscaling/v1/doc.go | 21 + .../k8s.io/api/autoscaling/v1/generated.pb.go | 6182 ++ .../k8s.io/api/autoscaling/v1/generated.proto | 495 + vendor/k8s.io/api/autoscaling/v1/register.go | 53 + vendor/k8s.io/api/autoscaling/v1/types.go | 507 + .../v1/types_swagger_doc_generated.go | 276 + .../autoscaling/v1/zz_generated.deepcopy.go | 574 + vendor/k8s.io/api/autoscaling/v2/doc.go | 21 + .../k8s.io/api/autoscaling/v2/generated.pb.go | 6599 ++ .../k8s.io/api/autoscaling/v2/generated.proto | 504 + vendor/k8s.io/api/autoscaling/v2/register.go | 50 + vendor/k8s.io/api/autoscaling/v2/types.go | 545 + .../v2/types_swagger_doc_generated.go | 299 + .../autoscaling/v2/zz_generated.deepcopy.go | 610 + vendor/k8s.io/api/autoscaling/v2beta1/doc.go | 22 + .../api/autoscaling/v2beta1/generated.pb.go | 5715 ++ .../api/autoscaling/v2beta1/generated.proto | 476 + .../api/autoscaling/v2beta1/register.go | 52 + .../k8s.io/api/autoscaling/v2beta1/types.go | 488 + .../v2beta1/types_swagger_doc_generated.go | 247 + .../v2beta1/zz_generated.deepcopy.go | 525 + .../zz_generated.prerelease-lifecycle.go | 74 + vendor/k8s.io/api/autoscaling/v2beta2/doc.go | 22 + .../api/autoscaling/v2beta2/generated.pb.go | 6599 ++ .../api/autoscaling/v2beta2/generated.proto | 494 + .../api/autoscaling/v2beta2/register.go | 50 + .../k8s.io/api/autoscaling/v2beta2/types.go | 541 + .../v2beta2/types_swagger_doc_generated.go | 297 + .../v2beta2/zz_generated.deepcopy.go | 610 + .../zz_generated.prerelease-lifecycle.go | 68 + vendor/k8s.io/api/batch/v1/doc.go | 21 + vendor/k8s.io/api/batch/v1/generated.pb.go | 4706 ++ vendor/k8s.io/api/batch/v1/generated.proto | 483 + vendor/k8s.io/api/batch/v1/register.go | 54 + vendor/k8s.io/api/batch/v1/types.go | 585 + .../batch/v1/types_swagger_doc_generated.go | 210 + .../api/batch/v1/zz_generated.deepcopy.go | 483 + vendor/k8s.io/api/batch/v1beta1/doc.go | 22 + .../k8s.io/api/batch/v1beta1/generated.pb.go | 1825 + .../k8s.io/api/batch/v1beta1/generated.proto | 155 + vendor/k8s.io/api/batch/v1beta1/register.go | 53 + vendor/k8s.io/api/batch/v1beta1/types.go | 186 + .../v1beta1/types_swagger_doc_generated.go | 98 + .../batch/v1beta1/zz_generated.deepcopy.go | 204 + .../zz_generated.prerelease-lifecycle.go | 92 + vendor/k8s.io/api/certificates/v1/doc.go | 23 + .../api/certificates/v1/generated.pb.go | 2055 + .../api/certificates/v1/generated.proto | 248 + vendor/k8s.io/api/certificates/v1/register.go | 61 + vendor/k8s.io/api/certificates/v1/types.go | 309 + .../v1/types_swagger_doc_generated.go | 89 + .../certificates/v1/zz_generated.deepcopy.go | 204 + vendor/k8s.io/api/certificates/v1beta1/doc.go | 24 + .../api/certificates/v1beta1/generated.pb.go | 2061 + .../api/certificates/v1beta1/generated.proto | 199 + .../api/certificates/v1beta1/register.go | 59 + .../k8s.io/api/certificates/v1beta1/types.go | 261 + .../v1beta1/types_swagger_doc_generated.go | 78 + .../v1beta1/zz_generated.deepcopy.go | 209 + .../zz_generated.prerelease-lifecycle.go | 74 + vendor/k8s.io/api/coordination/v1/doc.go | 23 + .../api/coordination/v1/generated.pb.go | 967 + .../api/coordination/v1/generated.proto | 80 + vendor/k8s.io/api/coordination/v1/register.go | 53 + vendor/k8s.io/api/coordination/v1/types.go | 74 + .../v1/types_swagger_doc_generated.go | 63 + .../coordination/v1/zz_generated.deepcopy.go | 125 + vendor/k8s.io/api/coordination/v1beta1/doc.go | 24 + .../api/coordination/v1beta1/generated.pb.go | 967 + .../api/coordination/v1beta1/generated.proto | 80 + .../api/coordination/v1beta1/register.go | 53 + .../k8s.io/api/coordination/v1beta1/types.go | 80 + .../v1beta1/types_swagger_doc_generated.go | 63 + .../v1beta1/zz_generated.deepcopy.go | 125 + .../zz_generated.prerelease-lifecycle.go | 74 + .../api/core/v1/annotation_key_constants.go | 151 + vendor/k8s.io/api/core/v1/doc.go | 22 + vendor/k8s.io/api/core/v1/generated.pb.go | 69696 ++++++++++++++++ vendor/k8s.io/api/core/v1/generated.proto | 5982 ++ vendor/k8s.io/api/core/v1/lifecycle.go | 37 + vendor/k8s.io/api/core/v1/objectreference.go | 33 + vendor/k8s.io/api/core/v1/register.go | 99 + vendor/k8s.io/api/core/v1/resource.go | 59 + vendor/k8s.io/api/core/v1/taint.go | 39 + vendor/k8s.io/api/core/v1/toleration.go | 59 + vendor/k8s.io/api/core/v1/types.go | 6783 ++ .../core/v1/types_swagger_doc_generated.go | 2607 + .../k8s.io/api/core/v1/well_known_labels.go | 70 + .../k8s.io/api/core/v1/well_known_taints.go | 52 + .../api/core/v1/zz_generated.deepcopy.go | 6168 ++ vendor/k8s.io/api/discovery/v1/doc.go | 22 + .../k8s.io/api/discovery/v1/generated.pb.go | 2251 + .../k8s.io/api/discovery/v1/generated.proto | 195 + vendor/k8s.io/api/discovery/v1/register.go | 56 + vendor/k8s.io/api/discovery/v1/types.go | 194 + .../v1/types_swagger_doc_generated.go | 109 + .../api/discovery/v1/well_known_labels.go | 32 + .../api/discovery/v1/zz_generated.deepcopy.go | 258 + vendor/k8s.io/api/discovery/v1beta1/doc.go | 23 + .../api/discovery/v1beta1/generated.pb.go | 2205 + .../api/discovery/v1beta1/generated.proto | 198 + .../k8s.io/api/discovery/v1beta1/register.go | 56 + vendor/k8s.io/api/discovery/v1beta1/types.go | 203 + .../v1beta1/types_swagger_doc_generated.go | 108 + .../discovery/v1beta1/well_known_labels.go | 32 + .../v1beta1/zz_generated.deepcopy.go | 253 + .../zz_generated.prerelease-lifecycle.go | 74 + vendor/k8s.io/api/events/v1/doc.go | 23 + vendor/k8s.io/api/events/v1/generated.pb.go | 1397 + vendor/k8s.io/api/events/v1/generated.proto | 128 + vendor/k8s.io/api/events/v1/register.go | 53 + vendor/k8s.io/api/events/v1/types.go | 123 + .../events/v1/types_swagger_doc_generated.go | 73 + .../api/events/v1/zz_generated.deepcopy.go | 118 + vendor/k8s.io/api/events/v1beta1/doc.go | 24 + .../k8s.io/api/events/v1beta1/generated.pb.go | 1397 + .../k8s.io/api/events/v1beta1/generated.proto | 130 + vendor/k8s.io/api/events/v1beta1/register.go | 53 + vendor/k8s.io/api/events/v1beta1/types.go | 131 + .../v1beta1/types_swagger_doc_generated.go | 73 + .../events/v1beta1/zz_generated.deepcopy.go | 118 + .../zz_generated.prerelease-lifecycle.go | 58 + vendor/k8s.io/api/extensions/v1beta1/doc.go | 22 + .../api/extensions/v1beta1/generated.pb.go | 16135 ++++ .../api/extensions/v1beta1/generated.proto | 1335 + .../k8s.io/api/extensions/v1beta1/register.go | 65 + vendor/k8s.io/api/extensions/v1beta1/types.go | 1652 + .../v1beta1/types_swagger_doc_generated.go | 701 + .../v1beta1/zz_generated.deepcopy.go | 1591 + .../zz_generated.prerelease-lifecycle.go | 350 + vendor/k8s.io/api/flowcontrol/v1alpha1/doc.go | 25 + .../api/flowcontrol/v1alpha1/generated.pb.go | 5429 ++ .../api/flowcontrol/v1alpha1/generated.proto | 469 + .../api/flowcontrol/v1alpha1/register.go | 58 + .../k8s.io/api/flowcontrol/v1alpha1/types.go | 576 + .../v1alpha1/types_swagger_doc_generated.go | 263 + .../v1alpha1/zz_generated.deepcopy.go | 552 + .../zz_generated.prerelease-lifecycle.go | 122 + vendor/k8s.io/api/flowcontrol/v1beta1/doc.go | 25 + .../api/flowcontrol/v1beta1/generated.pb.go | 5429 ++ .../api/flowcontrol/v1beta1/generated.proto | 469 + .../api/flowcontrol/v1beta1/register.go | 58 + .../k8s.io/api/flowcontrol/v1beta1/types.go | 612 + .../v1beta1/types_swagger_doc_generated.go | 263 + .../v1beta1/zz_generated.deepcopy.go | 552 + .../zz_generated.prerelease-lifecycle.go | 122 + vendor/k8s.io/api/flowcontrol/v1beta2/doc.go | 25 + .../api/flowcontrol/v1beta2/generated.pb.go | 5429 ++ .../api/flowcontrol/v1beta2/generated.proto | 469 + .../api/flowcontrol/v1beta2/register.go | 58 + .../k8s.io/api/flowcontrol/v1beta2/types.go | 612 + .../v1beta2/types_swagger_doc_generated.go | 263 + .../v1beta2/zz_generated.deepcopy.go | 552 + .../zz_generated.prerelease-lifecycle.go | 122 + vendor/k8s.io/api/networking/v1/doc.go | 22 + .../k8s.io/api/networking/v1/generated.pb.go | 6767 ++ .../k8s.io/api/networking/v1/generated.proto | 563 + vendor/k8s.io/api/networking/v1/register.go | 57 + vendor/k8s.io/api/networking/v1/types.go | 651 + .../v1/types_swagger_doc_generated.go | 317 + .../networking/v1/well_known_annotations.go | 25 + .../networking/v1/zz_generated.deepcopy.go | 752 + vendor/k8s.io/api/networking/v1alpha1/doc.go | 23 + .../api/networking/v1alpha1/generated.pb.go | 913 + .../api/networking/v1alpha1/generated.proto | 94 + .../api/networking/v1alpha1/register.go | 56 + .../k8s.io/api/networking/v1alpha1/types.go | 95 + .../v1alpha1/types_swagger_doc_generated.go | 62 + .../v1alpha1/zz_generated.deepcopy.go | 108 + .../zz_generated.prerelease-lifecycle.go | 58 + vendor/k8s.io/api/networking/v1beta1/doc.go | 23 + .../api/networking/v1beta1/generated.pb.go | 4165 + .../api/networking/v1beta1/generated.proto | 348 + .../k8s.io/api/networking/v1beta1/register.go | 58 + vendor/k8s.io/api/networking/v1beta1/types.go | 409 + .../v1beta1/types_swagger_doc_generated.go | 204 + .../v1beta1/well_known_annotations.go | 32 + .../v1beta1/zz_generated.deepcopy.go | 450 + .../zz_generated.prerelease-lifecycle.go | 122 + vendor/k8s.io/api/node/v1/doc.go | 23 + vendor/k8s.io/api/node/v1/generated.pb.go | 1400 + vendor/k8s.io/api/node/v1/generated.proto | 108 + vendor/k8s.io/api/node/v1/register.go | 52 + vendor/k8s.io/api/node/v1/types.go | 106 + .../node/v1/types_swagger_doc_generated.go | 71 + .../api/node/v1/zz_generated.deepcopy.go | 149 + vendor/k8s.io/api/node/v1alpha1/doc.go | 23 + .../k8s.io/api/node/v1alpha1/generated.pb.go | 1568 + .../k8s.io/api/node/v1alpha1/generated.proto | 118 + vendor/k8s.io/api/node/v1alpha1/register.go | 52 + vendor/k8s.io/api/node/v1alpha1/types.go | 116 + .../v1alpha1/types_swagger_doc_generated.go | 80 + .../node/v1alpha1/zz_generated.deepcopy.go | 166 + vendor/k8s.io/api/node/v1beta1/doc.go | 24 + .../k8s.io/api/node/v1beta1/generated.pb.go | 1400 + .../k8s.io/api/node/v1beta1/generated.proto | 108 + vendor/k8s.io/api/node/v1beta1/register.go | 52 + vendor/k8s.io/api/node/v1beta1/types.go | 110 + .../v1beta1/types_swagger_doc_generated.go | 71 + .../api/node/v1beta1/zz_generated.deepcopy.go | 149 + .../zz_generated.prerelease-lifecycle.go | 58 + vendor/k8s.io/api/policy/v1/doc.go | 24 + vendor/k8s.io/api/policy/v1/generated.pb.go | 1729 + vendor/k8s.io/api/policy/v1/generated.proto | 179 + vendor/k8s.io/api/policy/v1/register.go | 52 + vendor/k8s.io/api/policy/v1/types.go | 220 + .../policy/v1/types_swagger_doc_generated.go | 88 + .../api/policy/v1/zz_generated.deepcopy.go | 186 + vendor/k8s.io/api/policy/v1beta1/doc.go | 25 + .../k8s.io/api/policy/v1beta1/generated.pb.go | 5613 ++ .../k8s.io/api/policy/v1beta1/generated.proto | 456 + vendor/k8s.io/api/policy/v1beta1/register.go | 56 + vendor/k8s.io/api/policy/v1beta1/types.go | 600 + .../v1beta1/types_swagger_doc_generated.go | 248 + .../policy/v1beta1/zz_generated.deepcopy.go | 553 + .../zz_generated.prerelease-lifecycle.go | 128 + vendor/k8s.io/api/rbac/v1/doc.go | 23 + vendor/k8s.io/api/rbac/v1/generated.pb.go | 3230 + vendor/k8s.io/api/rbac/v1/generated.proto | 201 + vendor/k8s.io/api/rbac/v1/register.go | 58 + vendor/k8s.io/api/rbac/v1/types.go | 239 + .../rbac/v1/types_swagger_doc_generated.go | 158 + .../api/rbac/v1/zz_generated.deepcopy.go | 390 + vendor/k8s.io/api/rbac/v1alpha1/doc.go | 23 + .../k8s.io/api/rbac/v1alpha1/generated.pb.go | 3232 + .../k8s.io/api/rbac/v1alpha1/generated.proto | 208 + vendor/k8s.io/api/rbac/v1alpha1/register.go | 58 + vendor/k8s.io/api/rbac/v1alpha1/types.go | 246 + .../v1alpha1/types_swagger_doc_generated.go | 158 + .../rbac/v1alpha1/zz_generated.deepcopy.go | 390 + vendor/k8s.io/api/rbac/v1beta1/doc.go | 24 + .../k8s.io/api/rbac/v1beta1/generated.pb.go | 3230 + .../k8s.io/api/rbac/v1beta1/generated.proto | 208 + vendor/k8s.io/api/rbac/v1beta1/register.go | 58 + vendor/k8s.io/api/rbac/v1beta1/types.go | 277 + .../v1beta1/types_swagger_doc_generated.go | 158 + .../api/rbac/v1beta1/zz_generated.deepcopy.go | 390 + .../zz_generated.prerelease-lifecycle.go | 218 + vendor/k8s.io/api/scheduling/v1/doc.go | 23 + .../k8s.io/api/scheduling/v1/generated.pb.go | 729 + .../k8s.io/api/scheduling/v1/generated.proto | 74 + vendor/k8s.io/api/scheduling/v1/register.go | 55 + vendor/k8s.io/api/scheduling/v1/types.go | 73 + .../v1/types_swagger_doc_generated.go | 53 + .../scheduling/v1/zz_generated.deepcopy.go | 91 + vendor/k8s.io/api/scheduling/v1alpha1/doc.go | 23 + .../api/scheduling/v1alpha1/generated.pb.go | 729 + .../api/scheduling/v1alpha1/generated.proto | 75 + .../api/scheduling/v1alpha1/register.go | 52 + .../k8s.io/api/scheduling/v1alpha1/types.go | 74 + .../v1alpha1/types_swagger_doc_generated.go | 53 + .../v1alpha1/zz_generated.deepcopy.go | 91 + vendor/k8s.io/api/scheduling/v1beta1/doc.go | 24 + .../api/scheduling/v1beta1/generated.pb.go | 730 + .../api/scheduling/v1beta1/generated.proto | 75 + .../k8s.io/api/scheduling/v1beta1/register.go | 52 + vendor/k8s.io/api/scheduling/v1beta1/types.go | 82 + .../v1beta1/types_swagger_doc_generated.go | 53 + .../v1beta1/zz_generated.deepcopy.go | 91 + .../zz_generated.prerelease-lifecycle.go | 74 + vendor/k8s.io/api/storage/v1/doc.go | 22 + vendor/k8s.io/api/storage/v1/generated.pb.go | 5426 ++ vendor/k8s.io/api/storage/v1/generated.proto | 573 + vendor/k8s.io/api/storage/v1/register.go | 65 + vendor/k8s.io/api/storage/v1/types.go | 682 + .../storage/v1/types_swagger_doc_generated.go | 238 + .../api/storage/v1/zz_generated.deepcopy.go | 618 + vendor/k8s.io/api/storage/v1alpha1/doc.go | 23 + .../api/storage/v1alpha1/generated.pb.go | 2399 + .../api/storage/v1alpha1/generated.proto | 231 + .../k8s.io/api/storage/v1alpha1/register.go | 52 + vendor/k8s.io/api/storage/v1alpha1/types.go | 250 + .../v1alpha1/types_swagger_doc_generated.go | 116 + .../storage/v1alpha1/zz_generated.deepcopy.go | 256 + .../zz_generated.prerelease-lifecycle.go | 122 + vendor/k8s.io/api/storage/v1beta1/doc.go | 23 + .../api/storage/v1beta1/generated.pb.go | 5426 ++ .../api/storage/v1beta1/generated.proto | 574 + vendor/k8s.io/api/storage/v1beta1/register.go | 65 + vendor/k8s.io/api/storage/v1beta1/types.go | 710 + .../v1beta1/types_swagger_doc_generated.go | 238 + .../storage/v1beta1/zz_generated.deepcopy.go | 618 + .../zz_generated.prerelease-lifecycle.go | 266 + .../apimachinery/pkg/api/equality/semantic.go | 49 + .../k8s.io/apimachinery/pkg/api/errors/OWNERS | 17 + .../k8s.io/apimachinery/pkg/api/errors/doc.go | 18 + .../apimachinery/pkg/api/errors/errors.go | 857 + .../k8s.io/apimachinery/pkg/api/meta/OWNERS | 14 + .../apimachinery/pkg/api/meta/conditions.go | 102 + .../k8s.io/apimachinery/pkg/api/meta/doc.go | 19 + .../apimachinery/pkg/api/meta/errors.go | 132 + .../pkg/api/meta/firsthit_restmapper.go | 105 + .../k8s.io/apimachinery/pkg/api/meta/help.go | 265 + .../apimachinery/pkg/api/meta/interfaces.go | 143 + .../k8s.io/apimachinery/pkg/api/meta/lazy.go | 112 + .../k8s.io/apimachinery/pkg/api/meta/meta.go | 643 + .../pkg/api/meta/multirestmapper.go | 220 + .../apimachinery/pkg/api/meta/priority.go | 230 + .../apimachinery/pkg/api/meta/restmapper.go | 529 + .../apimachinery/pkg/api/resource/OWNERS | 11 + .../apimachinery/pkg/api/resource/amount.go | 299 + .../pkg/api/resource/generated.pb.go | 114 + .../pkg/api/resource/generated.proto | 111 + .../apimachinery/pkg/api/resource/math.go | 310 + .../apimachinery/pkg/api/resource/quantity.go | 808 + .../pkg/api/resource/quantity_proto.go | 288 + .../pkg/api/resource/scale_int.go | 95 + .../apimachinery/pkg/api/resource/suffix.go | 198 + .../pkg/api/resource/zz_generated.deepcopy.go | 45 + .../apimachinery/pkg/api/validation/doc.go | 18 + .../pkg/api/validation/generic.go | 88 + .../pkg/api/validation/objectmeta.go | 265 + .../pkg/apis/meta/internalversion/doc.go | 20 + .../pkg/apis/meta/internalversion/register.go | 88 + .../pkg/apis/meta/internalversion/types.go | 80 + .../zz_generated.conversion.go | 146 + .../internalversion/zz_generated.deepcopy.go | 97 + .../apimachinery/pkg/apis/meta/v1/OWNERS | 16 + .../pkg/apis/meta/v1/controller_ref.go | 65 + .../pkg/apis/meta/v1/conversion.go | 355 + .../apimachinery/pkg/apis/meta/v1/deepcopy.go | 46 + .../apimachinery/pkg/apis/meta/v1/doc.go | 24 + .../apimachinery/pkg/apis/meta/v1/duration.go | 65 + .../pkg/apis/meta/v1/generated.pb.go | 11530 +++ .../pkg/apis/meta/v1/generated.proto | 1177 + .../pkg/apis/meta/v1/group_version.go | 157 + .../apimachinery/pkg/apis/meta/v1/helpers.go | 298 + .../apimachinery/pkg/apis/meta/v1/labels.go | 55 + .../apimachinery/pkg/apis/meta/v1/meta.go | 176 + .../pkg/apis/meta/v1/micro_time.go | 181 + .../pkg/apis/meta/v1/micro_time_fuzz.go | 40 + .../pkg/apis/meta/v1/micro_time_proto.go | 86 + .../apimachinery/pkg/apis/meta/v1/register.go | 107 + .../apimachinery/pkg/apis/meta/v1/time.go | 182 + .../pkg/apis/meta/v1/time_fuzz.go | 40 + .../pkg/apis/meta/v1/time_proto.go | 100 + .../apimachinery/pkg/apis/meta/v1/types.go | 1510 + .../meta/v1/types_swagger_doc_generated.go | 461 + .../pkg/apis/meta/v1/unstructured/helpers.go | 501 + .../apis/meta/v1/unstructured/unstructured.go | 484 + .../meta/v1/unstructured/unstructured_list.go | 210 + .../v1/unstructured/zz_generated.deepcopy.go | 56 + .../pkg/apis/meta/v1/validation/validation.go | 320 + .../apimachinery/pkg/apis/meta/v1/watch.go | 89 + .../apis/meta/v1/zz_generated.conversion.go | 527 + .../pkg/apis/meta/v1/zz_generated.deepcopy.go | 1188 + .../pkg/apis/meta/v1/zz_generated.defaults.go | 33 + .../pkg/apis/meta/v1beta1/conversion.go | 46 + .../pkg/apis/meta/v1beta1/deepcopy.go | 17 + .../apimachinery/pkg/apis/meta/v1beta1/doc.go | 23 + .../pkg/apis/meta/v1beta1/generated.pb.go | 412 + .../pkg/apis/meta/v1beta1/generated.proto | 41 + .../pkg/apis/meta/v1beta1/register.go | 62 + .../pkg/apis/meta/v1beta1/types.go | 84 + .../v1beta1/types_swagger_doc_generated.go | 40 + .../meta/v1beta1/zz_generated.deepcopy.go | 60 + .../meta/v1beta1/zz_generated.defaults.go | 33 + .../apimachinery/pkg/conversion/converter.go | 225 + .../apimachinery/pkg/conversion/deep_equal.go | 47 + .../k8s.io/apimachinery/pkg/conversion/doc.go | 24 + .../apimachinery/pkg/conversion/helper.go | 39 + .../pkg/conversion/queryparams/convert.go | 194 + .../pkg/conversion/queryparams/doc.go | 19 + vendor/k8s.io/apimachinery/pkg/fields/doc.go | 19 + .../k8s.io/apimachinery/pkg/fields/fields.go | 62 + .../apimachinery/pkg/fields/requirements.go | 30 + .../apimachinery/pkg/fields/selector.go | 478 + .../apimachinery/pkg/runtime/allocator.go | 76 + .../k8s.io/apimachinery/pkg/runtime/codec.go | 397 + .../apimachinery/pkg/runtime/codec_check.go | 56 + .../apimachinery/pkg/runtime/conversion.go | 196 + .../apimachinery/pkg/runtime/converter.go | 858 + vendor/k8s.io/apimachinery/pkg/runtime/doc.go | 51 + .../apimachinery/pkg/runtime/embedded.go | 149 + .../k8s.io/apimachinery/pkg/runtime/error.go | 172 + .../apimachinery/pkg/runtime/extension.go | 51 + .../apimachinery/pkg/runtime/generated.pb.go | 846 + .../apimachinery/pkg/runtime/generated.proto | 134 + .../k8s.io/apimachinery/pkg/runtime/helper.go | 259 + .../apimachinery/pkg/runtime/interfaces.go | 368 + .../k8s.io/apimachinery/pkg/runtime/mapper.go | 98 + .../apimachinery/pkg/runtime/negotiate.go | 113 + .../apimachinery/pkg/runtime/register.go | 31 + .../pkg/runtime/schema/generated.pb.go | 59 + .../pkg/runtime/schema/generated.proto | 26 + .../pkg/runtime/schema/group_version.go | 307 + .../pkg/runtime/schema/interfaces.go | 40 + .../k8s.io/apimachinery/pkg/runtime/scheme.go | 707 + .../pkg/runtime/scheme_builder.go | 48 + .../pkg/runtime/serializer/codec_factory.go | 339 + .../pkg/runtime/serializer/json/json.go | 351 + .../pkg/runtime/serializer/json/meta.go | 63 + .../runtime/serializer/negotiated_codec.go | 43 + .../pkg/runtime/serializer/protobuf/doc.go | 18 + .../runtime/serializer/protobuf/protobuf.go | 495 + .../serializer/recognizer/recognizer.go | 128 + .../runtime/serializer/streaming/streaming.go | 156 + .../serializer/versioning/versioning.go | 290 + .../pkg/runtime/swagger_doc_generator.go | 262 + .../k8s.io/apimachinery/pkg/runtime/types.go | 133 + .../apimachinery/pkg/runtime/types_proto.go | 89 + .../pkg/runtime/zz_generated.deepcopy.go | 76 + vendor/k8s.io/apimachinery/pkg/types/doc.go | 18 + .../apimachinery/pkg/types/namespacedname.go | 39 + .../k8s.io/apimachinery/pkg/types/nodename.go | 43 + vendor/k8s.io/apimachinery/pkg/types/patch.go | 29 + vendor/k8s.io/apimachinery/pkg/types/uid.go | 22 + .../apimachinery/pkg/util/cache/expiring.go | 192 + .../pkg/util/cache/lruexpirecache.go | 160 + .../k8s.io/apimachinery/pkg/util/diff/diff.go | 157 + .../apimachinery/pkg/util/framer/framer.go | 170 + .../pkg/util/intstr/generated.pb.go | 369 + .../pkg/util/intstr/generated.proto | 43 + .../pkg/util/intstr/instr_fuzz.go | 43 + .../apimachinery/pkg/util/intstr/intstr.go | 227 + .../k8s.io/apimachinery/pkg/util/json/json.go | 121 + .../pkg/util/managedfields/extract.go | 108 + .../pkg/util/managedfields/gvkparser.go | 128 + .../apimachinery/pkg/util/mergepatch/OWNERS | 6 + .../pkg/util/mergepatch/errors.go | 102 + .../apimachinery/pkg/util/mergepatch/util.go | 134 + .../pkg/util/naming/from_stack.go | 93 + .../k8s.io/apimachinery/pkg/util/net/http.go | 699 + .../apimachinery/pkg/util/net/interface.go | 500 + .../apimachinery/pkg/util/net/port_range.go | 149 + .../apimachinery/pkg/util/net/port_split.go | 78 + .../k8s.io/apimachinery/pkg/util/net/util.go | 57 + .../apimachinery/pkg/util/runtime/runtime.go | 174 + .../pkg/util/strategicpatch/OWNERS | 8 + .../pkg/util/strategicpatch/errors.go | 49 + .../pkg/util/strategicpatch/meta.go | 194 + .../pkg/util/strategicpatch/patch.go | 2200 + .../pkg/util/strategicpatch/types.go | 193 + .../k8s.io/apimachinery/pkg/util/uuid/uuid.go | 27 + .../apimachinery/pkg/util/version/doc.go | 18 + .../apimachinery/pkg/util/version/version.go | 325 + .../k8s.io/apimachinery/pkg/util/wait/doc.go | 19 + .../k8s.io/apimachinery/pkg/util/wait/wait.go | 757 + .../apimachinery/pkg/util/yaml/decoder.go | 397 + vendor/k8s.io/apimachinery/pkg/version/doc.go | 20 + .../apimachinery/pkg/version/helpers.go | 88 + .../k8s.io/apimachinery/pkg/version/types.go | 37 + vendor/k8s.io/apimachinery/pkg/watch/doc.go | 19 + .../k8s.io/apimachinery/pkg/watch/filter.go | 104 + vendor/k8s.io/apimachinery/pkg/watch/mux.go | 320 + .../apimachinery/pkg/watch/streamwatcher.go | 136 + vendor/k8s.io/apimachinery/pkg/watch/watch.go | 324 + .../pkg/watch/zz_generated.deepcopy.go | 41 + .../third_party/forked/golang/LICENSE | 27 + .../third_party/forked/golang/PATENTS | 22 + .../third_party/forked/golang/json/OWNERS | 6 + .../third_party/forked/golang/json/fields.go | 513 + .../forked/golang/reflect/deep_equal.go | 434 + vendor/k8s.io/client-go/LICENSE | 202 + .../v1/mutatingwebhook.go | 141 + .../v1/mutatingwebhookconfiguration.go | 252 + .../admissionregistration/v1/rule.go | 76 + .../v1/rulewithoperations.go | 84 + .../v1/servicereference.go | 66 + .../v1/validatingwebhook.go | 132 + .../v1/validatingwebhookconfiguration.go | 252 + .../v1/webhookclientconfig.go | 59 + .../v1beta1/mutatingwebhook.go | 141 + .../v1beta1/mutatingwebhookconfiguration.go | 252 + .../admissionregistration/v1beta1/rule.go | 76 + .../v1beta1/rulewithoperations.go | 84 + .../v1beta1/servicereference.go | 66 + .../v1beta1/validatingwebhook.go | 132 + .../v1beta1/validatingwebhookconfiguration.go | 252 + .../v1beta1/webhookclientconfig.go | 59 + .../v1alpha1/serverstorageversion.go | 59 + .../v1alpha1/storageversion.go | 256 + .../v1alpha1/storageversioncondition.go | 89 + .../v1alpha1/storageversionstatus.go | 67 + .../apps/v1/controllerrevision.go | 259 + .../applyconfigurations/apps/v1/daemonset.go | 258 + .../apps/v1/daemonsetcondition.go | 81 + .../apps/v1/daemonsetspec.go | 80 + .../apps/v1/daemonsetstatus.go | 125 + .../apps/v1/daemonsetupdatestrategy.go | 52 + .../applyconfigurations/apps/v1/deployment.go | 258 + .../apps/v1/deploymentcondition.go | 90 + .../apps/v1/deploymentspec.go | 107 + .../apps/v1/deploymentstatus.go | 107 + .../apps/v1/deploymentstrategy.go | 52 + .../applyconfigurations/apps/v1/replicaset.go | 258 + .../apps/v1/replicasetcondition.go | 81 + .../apps/v1/replicasetspec.go | 71 + .../apps/v1/replicasetstatus.go | 89 + .../apps/v1/rollingupdatedaemonset.go | 52 + .../apps/v1/rollingupdatedeployment.go | 52 + .../v1/rollingupdatestatefulsetstrategy.go | 52 + .../apps/v1/statefulset.go | 258 + .../apps/v1/statefulsetcondition.go | 81 + ...setpersistentvolumeclaimretentionpolicy.go | 52 + .../apps/v1/statefulsetspec.go | 131 + .../apps/v1/statefulsetstatus.go | 125 + .../apps/v1/statefulsetupdatestrategy.go | 52 + .../apps/v1beta1/controllerrevision.go | 259 + .../apps/v1beta1/deployment.go | 258 + .../apps/v1beta1/deploymentcondition.go | 90 + .../apps/v1beta1/deploymentspec.go | 116 + .../apps/v1beta1/deploymentstatus.go | 107 + .../apps/v1beta1/deploymentstrategy.go | 52 + .../apps/v1beta1/rollbackconfig.go | 39 + .../apps/v1beta1/rollingupdatedeployment.go | 52 + .../rollingupdatestatefulsetstrategy.go | 52 + .../apps/v1beta1/statefulset.go | 258 + .../apps/v1beta1/statefulsetcondition.go | 81 + ...setpersistentvolumeclaimretentionpolicy.go | 52 + .../apps/v1beta1/statefulsetspec.go | 131 + .../apps/v1beta1/statefulsetstatus.go | 125 + .../apps/v1beta1/statefulsetupdatestrategy.go | 52 + .../apps/v1beta2/controllerrevision.go | 259 + .../apps/v1beta2/daemonset.go | 258 + .../apps/v1beta2/daemonsetcondition.go | 81 + .../apps/v1beta2/daemonsetspec.go | 80 + .../apps/v1beta2/daemonsetstatus.go | 125 + .../apps/v1beta2/daemonsetupdatestrategy.go | 52 + .../apps/v1beta2/deployment.go | 258 + .../apps/v1beta2/deploymentcondition.go | 90 + .../apps/v1beta2/deploymentspec.go | 107 + .../apps/v1beta2/deploymentstatus.go | 107 + .../apps/v1beta2/deploymentstrategy.go | 52 + .../apps/v1beta2/replicaset.go | 258 + .../apps/v1beta2/replicasetcondition.go | 81 + .../apps/v1beta2/replicasetspec.go | 71 + .../apps/v1beta2/replicasetstatus.go | 89 + .../apps/v1beta2/rollingupdatedaemonset.go | 52 + .../apps/v1beta2/rollingupdatedeployment.go | 52 + .../rollingupdatestatefulsetstrategy.go | 52 + .../applyconfigurations/apps/v1beta2/scale.go | 218 + .../apps/v1beta2/statefulset.go | 258 + .../apps/v1beta2/statefulsetcondition.go | 81 + ...setpersistentvolumeclaimretentionpolicy.go | 52 + .../apps/v1beta2/statefulsetspec.go | 131 + .../apps/v1beta2/statefulsetstatus.go | 125 + .../apps/v1beta2/statefulsetupdatestrategy.go | 52 + .../v1/crossversionobjectreference.go | 57 + .../autoscaling/v1/horizontalpodautoscaler.go | 258 + .../v1/horizontalpodautoscalerspec.go | 66 + .../v1/horizontalpodautoscalerstatus.go | 79 + .../autoscaling/v1/scale.go | 217 + .../autoscaling/v1/scalespec.go | 39 + .../autoscaling/v1/scalestatus.go | 48 + .../v2/containerresourcemetricsource.go | 61 + .../v2/containerresourcemetricstatus.go | 61 + .../v2/crossversionobjectreference.go | 57 + .../autoscaling/v2/externalmetricsource.go | 48 + .../autoscaling/v2/externalmetricstatus.go | 48 + .../autoscaling/v2/horizontalpodautoscaler.go | 258 + .../v2/horizontalpodautoscalerbehavior.go | 48 + .../v2/horizontalpodautoscalercondition.go | 81 + .../v2/horizontalpodautoscalerspec.go | 80 + .../v2/horizontalpodautoscalerstatus.go | 98 + .../autoscaling/v2/hpascalingpolicy.go | 61 + .../autoscaling/v2/hpascalingrules.go | 66 + .../autoscaling/v2/metricidentifier.go | 52 + .../autoscaling/v2/metricspec.go | 88 + .../autoscaling/v2/metricstatus.go | 88 + .../autoscaling/v2/metrictarget.go | 71 + .../autoscaling/v2/metricvaluestatus.go | 61 + .../autoscaling/v2/objectmetricsource.go | 57 + .../autoscaling/v2/objectmetricstatus.go | 57 + .../autoscaling/v2/podresourcemetricsource.go | 52 + .../autoscaling/v2/podsmetricsource.go | 48 + .../autoscaling/v2/podsmetricstatus.go | 48 + .../autoscaling/v2/resourcemetricsource.go | 52 + .../autoscaling/v2/resourcemetricstatus.go | 52 + .../v2beta1/containerresourcemetricsource.go | 71 + .../v2beta1/containerresourcemetricstatus.go | 71 + .../v2beta1/crossversionobjectreference.go | 57 + .../v2beta1/externalmetricsource.go | 71 + .../v2beta1/externalmetricstatus.go | 71 + .../v2beta1/horizontalpodautoscaler.go | 258 + .../horizontalpodautoscalercondition.go | 81 + .../v2beta1/horizontalpodautoscalerspec.go | 71 + .../v2beta1/horizontalpodautoscalerstatus.go | 98 + .../autoscaling/v2beta1/metricspec.go | 88 + .../autoscaling/v2beta1/metricstatus.go | 88 + .../autoscaling/v2beta1/objectmetricsource.go | 80 + .../autoscaling/v2beta1/objectmetricstatus.go | 80 + .../autoscaling/v2beta1/podsmetricsource.go | 62 + .../autoscaling/v2beta1/podsmetricstatus.go | 62 + .../v2beta1/resourcemetricsource.go | 62 + .../v2beta1/resourcemetricstatus.go | 62 + .../v2beta2/containerresourcemetricsource.go | 61 + .../v2beta2/containerresourcemetricstatus.go | 61 + .../v2beta2/crossversionobjectreference.go | 57 + .../v2beta2/externalmetricsource.go | 48 + .../v2beta2/externalmetricstatus.go | 48 + .../v2beta2/horizontalpodautoscaler.go | 258 + .../horizontalpodautoscalerbehavior.go | 48 + .../horizontalpodautoscalercondition.go | 81 + .../v2beta2/horizontalpodautoscalerspec.go | 80 + .../v2beta2/horizontalpodautoscalerstatus.go | 98 + .../autoscaling/v2beta2/hpascalingpolicy.go | 61 + .../autoscaling/v2beta2/hpascalingrules.go | 66 + .../autoscaling/v2beta2/metricidentifier.go | 52 + .../autoscaling/v2beta2/metricspec.go | 88 + .../autoscaling/v2beta2/metricstatus.go | 88 + .../autoscaling/v2beta2/metrictarget.go | 71 + .../autoscaling/v2beta2/metricvaluestatus.go | 61 + .../autoscaling/v2beta2/objectmetricsource.go | 57 + .../autoscaling/v2beta2/objectmetricstatus.go | 57 + .../autoscaling/v2beta2/podsmetricsource.go | 48 + .../autoscaling/v2beta2/podsmetricstatus.go | 48 + .../v2beta2/resourcemetricsource.go | 52 + .../v2beta2/resourcemetricstatus.go | 52 + .../applyconfigurations/batch/v1/cronjob.go | 258 + .../batch/v1/cronjobspec.go | 106 + .../batch/v1/cronjobstatus.go | 67 + .../applyconfigurations/batch/v1/job.go | 258 + .../batch/v1/jobcondition.go | 90 + .../applyconfigurations/batch/v1/jobspec.go | 135 + .../applyconfigurations/batch/v1/jobstatus.go | 120 + .../batch/v1/jobtemplatespec.go | 188 + .../batch/v1/podfailurepolicy.go | 44 + .../podfailurepolicyonexitcodesrequirement.go | 63 + .../podfailurepolicyonpodconditionspattern.go | 52 + .../batch/v1/podfailurepolicyrule.go | 66 + .../batch/v1/uncountedterminatedpods.go | 56 + .../batch/v1beta1/cronjob.go | 258 + .../batch/v1beta1/cronjobspec.go | 106 + .../batch/v1beta1/cronjobstatus.go | 67 + .../batch/v1beta1/jobtemplatespec.go | 189 + .../v1/certificatesigningrequest.go | 256 + .../v1/certificatesigningrequestcondition.go | 90 + .../v1/certificatesigningrequestspec.go | 118 + .../v1/certificatesigningrequeststatus.go | 55 + .../v1beta1/certificatesigningrequest.go | 256 + .../certificatesigningrequestcondition.go | 90 + .../v1beta1/certificatesigningrequestspec.go | 118 + .../certificatesigningrequeststatus.go | 55 + .../coordination/v1/lease.go | 249 + .../coordination/v1/leasespec.go | 79 + .../coordination/v1beta1/lease.go | 249 + .../coordination/v1beta1/leasespec.go | 79 + .../applyconfigurations/core/v1/affinity.go | 57 + .../core/v1/attachedvolume.go | 52 + .../v1/awselasticblockstorevolumesource.go | 66 + .../core/v1/azurediskvolumesource.go | 88 + .../v1/azurefilepersistentvolumesource.go | 66 + .../core/v1/azurefilevolumesource.go | 57 + .../core/v1/capabilities.go | 56 + .../core/v1/cephfspersistentvolumesource.go | 86 + .../core/v1/cephfsvolumesource.go | 86 + .../core/v1/cinderpersistentvolumesource.go | 66 + .../core/v1/cindervolumesource.go | 66 + .../core/v1/clientipconfig.go | 39 + .../core/v1/componentcondition.go | 70 + .../core/v1/componentstatus.go | 252 + .../applyconfigurations/core/v1/configmap.go | 279 + .../core/v1/configmapenvsource.go | 48 + .../core/v1/configmapkeyselector.go | 57 + .../core/v1/configmapnodeconfigsource.go | 79 + .../core/v1/configmapprojection.go | 62 + .../core/v1/configmapvolumesource.go | 71 + .../applyconfigurations/core/v1/container.go | 261 + .../core/v1/containerimage.go | 50 + .../core/v1/containerport.go | 79 + .../core/v1/containerstate.go | 57 + .../core/v1/containerstaterunning.go | 43 + .../core/v1/containerstateterminated.go | 97 + .../core/v1/containerstatewaiting.go | 48 + .../core/v1/containerstatus.go | 111 + .../core/v1/csipersistentvolumesource.go | 126 + .../core/v1/csivolumesource.go | 81 + .../core/v1/daemonendpoint.go | 39 + .../core/v1/downwardapiprojection.go | 44 + .../core/v1/downwardapivolumefile.go | 66 + .../core/v1/downwardapivolumesource.go | 53 + .../core/v1/emptydirvolumesource.go | 53 + .../core/v1/endpointaddress.go | 66 + .../core/v1/endpointport.go | 70 + .../applyconfigurations/core/v1/endpoints.go | 254 + .../core/v1/endpointsubset.go | 72 + .../core/v1/envfromsource.go | 57 + .../applyconfigurations/core/v1/envvar.go | 57 + .../core/v1/envvarsource.go | 66 + .../core/v1/ephemeralcontainer.go | 249 + .../core/v1/ephemeralcontainercommon.go | 261 + .../core/v1/ephemeralvolumesource.go | 39 + .../applyconfigurations/core/v1/event.go | 366 + .../core/v1/eventseries.go | 52 + .../core/v1/eventsource.go | 48 + .../applyconfigurations/core/v1/execaction.go | 41 + .../core/v1/fcvolumesource.go | 79 + .../core/v1/flexpersistentvolumesource.go | 81 + .../core/v1/flexvolumesource.go | 81 + .../core/v1/flockervolumesource.go | 48 + .../core/v1/gcepersistentdiskvolumesource.go | 66 + .../core/v1/gitrepovolumesource.go | 57 + .../v1/glusterfspersistentvolumesource.go | 66 + .../core/v1/glusterfsvolumesource.go | 57 + .../applyconfigurations/core/v1/grpcaction.go | 48 + .../applyconfigurations/core/v1/hostalias.go | 50 + .../core/v1/hostpathvolumesource.go | 52 + .../core/v1/httpgetaction.go | 85 + .../applyconfigurations/core/v1/httpheader.go | 48 + .../core/v1/iscsipersistentvolumesource.go | 131 + .../core/v1/iscsivolumesource.go | 131 + .../applyconfigurations/core/v1/keytopath.go | 57 + .../applyconfigurations/core/v1/lifecycle.go | 48 + .../core/v1/lifecyclehandler.go | 57 + .../applyconfigurations/core/v1/limitrange.go | 249 + .../core/v1/limitrangeitem.go | 88 + .../core/v1/limitrangespec.go | 44 + .../core/v1/loadbalanceringress.go | 62 + .../core/v1/loadbalancerstatus.go | 44 + .../core/v1/localobjectreference.go | 39 + .../core/v1/localvolumesource.go | 48 + .../applyconfigurations/core/v1/namespace.go | 256 + .../core/v1/namespacecondition.go | 80 + .../core/v1/namespacespec.go | 45 + .../core/v1/namespacestatus.go | 57 + .../core/v1/nfsvolumesource.go | 57 + .../applyconfigurations/core/v1/node.go | 256 + .../core/v1/nodeaddress.go | 52 + .../core/v1/nodeaffinity.go | 53 + .../core/v1/nodecondition.go | 89 + .../core/v1/nodeconfigsource.go | 39 + .../core/v1/nodeconfigstatus.go | 66 + .../core/v1/nodedaemonendpoints.go | 39 + .../core/v1/nodeselector.go | 44 + .../core/v1/nodeselectorrequirement.go | 63 + .../core/v1/nodeselectorterm.go | 58 + .../applyconfigurations/core/v1/nodespec.go | 100 + .../applyconfigurations/core/v1/nodestatus.go | 155 + .../core/v1/nodesysteminfo.go | 120 + .../core/v1/objectfieldselector.go | 48 + .../core/v1/objectreference.go | 97 + .../core/v1/persistentvolume.go | 256 + .../core/v1/persistentvolumeclaim.go | 258 + .../core/v1/persistentvolumeclaimcondition.go | 89 + .../core/v1/persistentvolumeclaimspec.go | 109 + .../core/v1/persistentvolumeclaimstatus.go | 95 + .../core/v1/persistentvolumeclaimtemplate.go | 188 + .../v1/persistentvolumeclaimvolumesource.go | 48 + .../core/v1/persistentvolumesource.go | 228 + .../core/v1/persistentvolumespec.go | 287 + .../core/v1/persistentvolumestatus.go | 61 + .../v1/photonpersistentdiskvolumesource.go | 48 + .../applyconfigurations/core/v1/pod.go | 258 + .../core/v1/podaffinity.go | 58 + .../core/v1/podaffinityterm.go | 72 + .../core/v1/podantiaffinity.go | 58 + .../core/v1/podcondition.go | 89 + .../core/v1/poddnsconfig.go | 66 + .../core/v1/poddnsconfigoption.go | 48 + .../applyconfigurations/core/v1/podip.go | 39 + .../applyconfigurations/core/v1/podos.go | 43 + .../core/v1/podreadinessgate.go | 43 + .../core/v1/podsecuritycontext.go | 131 + .../applyconfigurations/core/v1/podspec.go | 418 + .../applyconfigurations/core/v1/podstatus.go | 177 + .../core/v1/podtemplate.go | 249 + .../core/v1/podtemplatespec.go | 188 + .../applyconfigurations/core/v1/portstatus.go | 61 + .../core/v1/portworxvolumesource.go | 57 + .../core/v1/preferredschedulingterm.go | 48 + .../applyconfigurations/core/v1/probe.go | 117 + .../core/v1/probehandler.go | 66 + .../core/v1/projectedvolumesource.go | 53 + .../core/v1/quobytevolumesource.go | 84 + .../core/v1/rbdpersistentvolumesource.go | 104 + .../core/v1/rbdvolumesource.go | 104 + .../core/v1/replicationcontroller.go | 258 + .../core/v1/replicationcontrollercondition.go | 80 + .../core/v1/replicationcontrollerspec.go | 72 + .../core/v1/replicationcontrollerstatus.go | 89 + .../core/v1/resourcefieldselector.go | 61 + .../core/v1/resourcequota.go | 258 + .../core/v1/resourcequotaspec.go | 63 + .../core/v1/resourcequotastatus.go | 52 + .../core/v1/resourcerequirements.go | 52 + .../core/v1/scaleiopersistentvolumesource.go | 120 + .../core/v1/scaleiovolumesource.go | 120 + .../v1/scopedresourceselectorrequirement.go | 63 + .../core/v1/scopeselector.go | 44 + .../core/v1/seccompprofile.go | 52 + .../applyconfigurations/core/v1/secret.go | 288 + .../core/v1/secretenvsource.go | 48 + .../core/v1/secretkeyselector.go | 57 + .../core/v1/secretprojection.go | 62 + .../core/v1/secretreference.go | 48 + .../core/v1/secretvolumesource.go | 71 + .../core/v1/securitycontext.go | 133 + .../core/v1/selinuxoptions.go | 66 + .../applyconfigurations/core/v1/service.go | 258 + .../core/v1/serviceaccount.go | 277 + .../core/v1/serviceaccounttokenprojection.go | 57 + .../core/v1/serviceport.go | 89 + .../core/v1/servicespec.go | 224 + .../core/v1/servicestatus.go | 57 + .../core/v1/sessionaffinityconfig.go | 39 + .../v1/storageospersistentvolumesource.go | 75 + .../core/v1/storageosvolumesource.go | 75 + .../applyconfigurations/core/v1/sysctl.go | 48 + .../applyconfigurations/core/v1/taint.go | 71 + .../core/v1/tcpsocketaction.go | 52 + .../applyconfigurations/core/v1/toleration.go | 79 + .../v1/topologyselectorlabelrequirement.go | 50 + .../core/v1/topologyselectorterm.go | 44 + .../core/v1/topologyspreadconstraint.go | 109 + .../core/v1/typedlocalobjectreference.go | 57 + .../applyconfigurations/core/v1/volume.go | 272 + .../core/v1/volumedevice.go | 48 + .../core/v1/volumemount.go | 88 + .../core/v1/volumenodeaffinity.go | 39 + .../core/v1/volumeprojection.go | 66 + .../core/v1/volumesource.go | 291 + .../core/v1/vspherevirtualdiskvolumesource.go | 66 + .../core/v1/weightedpodaffinityterm.go | 48 + .../core/v1/windowssecuritycontextoptions.go | 66 + .../discovery/v1/endpoint.go | 114 + .../discovery/v1/endpointconditions.go | 57 + .../discovery/v1/endpointhints.go | 44 + .../discovery/v1/endpointport.go | 70 + .../discovery/v1/endpointslice.go | 277 + .../discovery/v1/forzone.go | 39 + .../discovery/v1beta1/endpoint.go | 105 + .../discovery/v1beta1/endpointconditions.go | 57 + .../discovery/v1beta1/endpointhints.go | 44 + .../discovery/v1beta1/endpointport.go | 70 + .../discovery/v1beta1/endpointslice.go | 277 + .../discovery/v1beta1/forzone.go | 39 + .../applyconfigurations/events/v1/event.go | 367 + .../events/v1/eventseries.go | 52 + .../events/v1beta1/event.go | 367 + .../events/v1beta1/eventseries.go | 52 + .../extensions/v1beta1/allowedcsidriver.go | 39 + .../extensions/v1beta1/allowedflexvolume.go | 39 + .../extensions/v1beta1/allowedhostpath.go | 48 + .../extensions/v1beta1/daemonset.go | 258 + .../extensions/v1beta1/daemonsetcondition.go | 81 + .../extensions/v1beta1/daemonsetspec.go | 89 + .../extensions/v1beta1/daemonsetstatus.go | 125 + .../v1beta1/daemonsetupdatestrategy.go | 52 + .../extensions/v1beta1/deployment.go | 258 + .../extensions/v1beta1/deploymentcondition.go | 90 + .../extensions/v1beta1/deploymentspec.go | 116 + .../extensions/v1beta1/deploymentstatus.go | 107 + .../extensions/v1beta1/deploymentstrategy.go | 52 + .../v1beta1/fsgroupstrategyoptions.go | 57 + .../extensions/v1beta1/hostportrange.go | 48 + .../extensions/v1beta1/httpingresspath.go | 61 + .../v1beta1/httpingressrulevalue.go | 44 + .../extensions/v1beta1/idrange.go | 48 + .../extensions/v1beta1/ingress.go | 258 + .../extensions/v1beta1/ingressbackend.go | 62 + .../extensions/v1beta1/ingressrule.go | 48 + .../extensions/v1beta1/ingressrulevalue.go | 39 + .../extensions/v1beta1/ingressspec.go | 76 + .../extensions/v1beta1/ingressstatus.go | 43 + .../extensions/v1beta1/ingresstls.go | 50 + .../extensions/v1beta1/ipblock.go | 50 + .../extensions/v1beta1/networkpolicy.go | 258 + .../v1beta1/networkpolicyegressrule.go | 58 + .../v1beta1/networkpolicyingressrule.go | 58 + .../extensions/v1beta1/networkpolicypeer.go | 61 + .../extensions/v1beta1/networkpolicyport.go | 62 + .../extensions/v1beta1/networkpolicyspec.go | 83 + .../extensions/v1beta1/networkpolicystatus.go | 48 + .../extensions/v1beta1/podsecuritypolicy.go | 247 + .../v1beta1/podsecuritypolicyspec.go | 285 + .../extensions/v1beta1/replicaset.go | 258 + .../extensions/v1beta1/replicasetcondition.go | 81 + .../extensions/v1beta1/replicasetspec.go | 71 + .../extensions/v1beta1/replicasetstatus.go | 89 + .../extensions/v1beta1/rollbackconfig.go | 39 + .../v1beta1/rollingupdatedaemonset.go | 52 + .../v1beta1/rollingupdatedeployment.go | 52 + .../v1beta1/runasgroupstrategyoptions.go | 57 + .../v1beta1/runasuserstrategyoptions.go | 57 + .../v1beta1/runtimeclassstrategyoptions.go | 50 + .../extensions/v1beta1/scale.go | 218 + .../v1beta1/selinuxstrategyoptions.go | 53 + .../supplementalgroupsstrategyoptions.go | 57 + .../v1alpha1/flowdistinguishermethod.go | 43 + .../flowcontrol/v1alpha1/flowschema.go | 256 + .../v1alpha1/flowschemacondition.go | 80 + .../flowcontrol/v1alpha1/flowschemaspec.go | 71 + .../flowcontrol/v1alpha1/flowschemastatus.go | 44 + .../flowcontrol/v1alpha1/groupsubject.go | 39 + .../limitedprioritylevelconfiguration.go | 48 + .../flowcontrol/v1alpha1/limitresponse.go | 52 + .../v1alpha1/nonresourcepolicyrule.go | 52 + .../v1alpha1/policyruleswithsubjects.go | 72 + .../v1alpha1/prioritylevelconfiguration.go | 256 + .../prioritylevelconfigurationcondition.go | 80 + .../prioritylevelconfigurationreference.go | 39 + .../prioritylevelconfigurationspec.go | 52 + .../prioritylevelconfigurationstatus.go | 44 + .../v1alpha1/queuingconfiguration.go | 57 + .../v1alpha1/resourcepolicyrule.go | 83 + .../v1alpha1/serviceaccountsubject.go | 48 + .../flowcontrol/v1alpha1/subject.go | 70 + .../flowcontrol/v1alpha1/usersubject.go | 39 + .../v1beta1/flowdistinguishermethod.go | 43 + .../flowcontrol/v1beta1/flowschema.go | 256 + .../v1beta1/flowschemacondition.go | 80 + .../flowcontrol/v1beta1/flowschemaspec.go | 71 + .../flowcontrol/v1beta1/flowschemastatus.go | 44 + .../flowcontrol/v1beta1/groupsubject.go | 39 + .../limitedprioritylevelconfiguration.go | 48 + .../flowcontrol/v1beta1/limitresponse.go | 52 + .../v1beta1/nonresourcepolicyrule.go | 52 + .../v1beta1/policyruleswithsubjects.go | 72 + .../v1beta1/prioritylevelconfiguration.go | 256 + .../prioritylevelconfigurationcondition.go | 80 + .../prioritylevelconfigurationreference.go | 39 + .../v1beta1/prioritylevelconfigurationspec.go | 52 + .../prioritylevelconfigurationstatus.go | 44 + .../v1beta1/queuingconfiguration.go | 57 + .../flowcontrol/v1beta1/resourcepolicyrule.go | 83 + .../v1beta1/serviceaccountsubject.go | 48 + .../flowcontrol/v1beta1/subject.go | 70 + .../flowcontrol/v1beta1/usersubject.go | 39 + .../v1beta2/flowdistinguishermethod.go | 43 + .../flowcontrol/v1beta2/flowschema.go | 256 + .../v1beta2/flowschemacondition.go | 80 + .../flowcontrol/v1beta2/flowschemaspec.go | 71 + .../flowcontrol/v1beta2/flowschemastatus.go | 44 + .../flowcontrol/v1beta2/groupsubject.go | 39 + .../limitedprioritylevelconfiguration.go | 48 + .../flowcontrol/v1beta2/limitresponse.go | 52 + .../v1beta2/nonresourcepolicyrule.go | 52 + .../v1beta2/policyruleswithsubjects.go | 72 + .../v1beta2/prioritylevelconfiguration.go | 256 + .../prioritylevelconfigurationcondition.go | 80 + .../prioritylevelconfigurationreference.go | 39 + .../v1beta2/prioritylevelconfigurationspec.go | 52 + .../prioritylevelconfigurationstatus.go | 44 + .../v1beta2/queuingconfiguration.go | 57 + .../flowcontrol/v1beta2/resourcepolicyrule.go | 83 + .../v1beta2/serviceaccountsubject.go | 48 + .../flowcontrol/v1beta2/subject.go | 70 + .../flowcontrol/v1beta2/usersubject.go | 39 + .../applyconfigurations/internal/internal.go | 11775 +++ .../applyconfigurations/meta/v1/condition.go | 88 + .../meta/v1/deleteoptions.go | 101 + .../meta/v1/labelselector.go | 59 + .../meta/v1/labelselectorrequirement.go | 63 + .../applyconfigurations/meta/v1/listmeta.go | 66 + .../meta/v1/managedfieldsentry.go | 97 + .../applyconfigurations/meta/v1/objectmeta.go | 171 + .../meta/v1/ownerreference.go | 88 + .../meta/v1/preconditions.go | 52 + .../applyconfigurations/meta/v1/typemeta.go | 48 + .../meta/v1/unstructured.go | 137 + .../networking/v1/httpingresspath.go | 61 + .../networking/v1/httpingressrulevalue.go | 44 + .../networking/v1/ingress.go | 258 + .../networking/v1/ingressbackend.go | 52 + .../networking/v1/ingressclass.go | 247 + .../v1/ingressclassparametersreference.go | 75 + .../networking/v1/ingressclassspec.go | 48 + .../networking/v1/ingressrule.go | 48 + .../networking/v1/ingressrulevalue.go | 39 + .../networking/v1/ingressservicebackend.go | 48 + .../networking/v1/ingressspec.go | 76 + .../networking/v1/ingressstatus.go | 43 + .../networking/v1/ingresstls.go | 50 + .../networking/v1/ipblock.go | 50 + .../networking/v1/networkpolicy.go | 258 + .../networking/v1/networkpolicyegressrule.go | 58 + .../networking/v1/networkpolicyingressrule.go | 58 + .../networking/v1/networkpolicypeer.go | 61 + .../networking/v1/networkpolicyport.go | 62 + .../networking/v1/networkpolicyspec.go | 83 + .../networking/v1/networkpolicystatus.go | 48 + .../networking/v1/servicebackendport.go | 48 + .../networking/v1alpha1/clustercidr.go | 247 + .../networking/v1alpha1/clustercidrspec.go | 70 + .../networking/v1beta1/httpingresspath.go | 61 + .../v1beta1/httpingressrulevalue.go | 44 + .../networking/v1beta1/ingress.go | 258 + .../networking/v1beta1/ingressbackend.go | 62 + .../networking/v1beta1/ingressclass.go | 247 + .../ingressclassparametersreference.go | 75 + .../networking/v1beta1/ingressclassspec.go | 48 + .../networking/v1beta1/ingressrule.go | 48 + .../networking/v1beta1/ingressrulevalue.go | 39 + .../networking/v1beta1/ingressspec.go | 76 + .../networking/v1beta1/ingressstatus.go | 43 + .../networking/v1beta1/ingresstls.go | 50 + .../applyconfigurations/node/v1/overhead.go | 43 + .../node/v1/runtimeclass.go | 265 + .../applyconfigurations/node/v1/scheduling.go | 63 + .../node/v1alpha1/overhead.go | 43 + .../node/v1alpha1/runtimeclass.go | 247 + .../node/v1alpha1/runtimeclassspec.go | 57 + .../node/v1alpha1/scheduling.go | 63 + .../node/v1beta1/overhead.go | 43 + .../node/v1beta1/runtimeclass.go | 265 + .../node/v1beta1/scheduling.go | 63 + .../applyconfigurations/policy/v1/eviction.go | 249 + .../policy/v1/poddisruptionbudget.go | 258 + .../policy/v1/poddisruptionbudgetspec.go | 62 + .../policy/v1/poddisruptionbudgetstatus.go | 109 + .../policy/v1beta1/allowedcsidriver.go | 39 + .../policy/v1beta1/allowedflexvolume.go | 39 + .../policy/v1beta1/allowedhostpath.go | 48 + .../policy/v1beta1/eviction.go | 249 + .../policy/v1beta1/fsgroupstrategyoptions.go | 57 + .../policy/v1beta1/hostportrange.go | 48 + .../policy/v1beta1/idrange.go | 48 + .../policy/v1beta1/poddisruptionbudget.go | 258 + .../policy/v1beta1/poddisruptionbudgetspec.go | 62 + .../v1beta1/poddisruptionbudgetstatus.go | 109 + .../policy/v1beta1/podsecuritypolicy.go | 247 + .../policy/v1beta1/podsecuritypolicyspec.go | 285 + .../v1beta1/runasgroupstrategyoptions.go | 57 + .../v1beta1/runasuserstrategyoptions.go | 57 + .../v1beta1/runtimeclassstrategyoptions.go | 50 + .../policy/v1beta1/selinuxstrategyoptions.go | 53 + .../supplementalgroupsstrategyoptions.go | 57 + .../rbac/v1/aggregationrule.go | 48 + .../rbac/v1/clusterrole.go | 261 + .../rbac/v1/clusterrolebinding.go | 261 + .../applyconfigurations/rbac/v1/policyrule.go | 85 + .../applyconfigurations/rbac/v1/role.go | 254 + .../rbac/v1/rolebinding.go | 263 + .../applyconfigurations/rbac/v1/roleref.go | 57 + .../applyconfigurations/rbac/v1/subject.go | 66 + .../rbac/v1alpha1/aggregationrule.go | 48 + .../rbac/v1alpha1/clusterrole.go | 261 + .../rbac/v1alpha1/clusterrolebinding.go | 261 + .../rbac/v1alpha1/policyrule.go | 85 + .../applyconfigurations/rbac/v1alpha1/role.go | 254 + .../rbac/v1alpha1/rolebinding.go | 263 + .../rbac/v1alpha1/roleref.go | 57 + .../rbac/v1alpha1/subject.go | 66 + .../rbac/v1beta1/aggregationrule.go | 48 + .../rbac/v1beta1/clusterrole.go | 261 + .../rbac/v1beta1/clusterrolebinding.go | 261 + .../rbac/v1beta1/policyrule.go | 85 + .../applyconfigurations/rbac/v1beta1/role.go | 254 + .../rbac/v1beta1/rolebinding.go | 263 + .../rbac/v1beta1/roleref.go | 57 + .../rbac/v1beta1/subject.go | 66 + .../scheduling/v1/priorityclass.go | 275 + .../scheduling/v1alpha1/priorityclass.go | 275 + .../scheduling/v1beta1/priorityclass.go | 275 + .../storage/v1/csidriver.go | 247 + .../storage/v1/csidriverspec.go | 113 + .../applyconfigurations/storage/v1/csinode.go | 247 + .../storage/v1/csinodedriver.go | 68 + .../storage/v1/csinodespec.go | 44 + .../storage/v1/csistoragecapacity.go | 277 + .../storage/v1/storageclass.go | 316 + .../storage/v1/tokenrequest.go | 48 + .../storage/v1/volumeattachment.go | 256 + .../storage/v1/volumeattachmentsource.go | 52 + .../storage/v1/volumeattachmentspec.go | 57 + .../storage/v1/volumeattachmentstatus.go | 72 + .../storage/v1/volumeerror.go | 52 + .../storage/v1/volumenoderesources.go | 39 + .../storage/v1alpha1/csistoragecapacity.go | 277 + .../storage/v1alpha1/volumeattachment.go | 256 + .../v1alpha1/volumeattachmentsource.go | 52 + .../storage/v1alpha1/volumeattachmentspec.go | 57 + .../v1alpha1/volumeattachmentstatus.go | 72 + .../storage/v1alpha1/volumeerror.go | 52 + .../storage/v1beta1/csidriver.go | 247 + .../storage/v1beta1/csidriverspec.go | 113 + .../storage/v1beta1/csinode.go | 247 + .../storage/v1beta1/csinodedriver.go | 68 + .../storage/v1beta1/csinodespec.go | 44 + .../storage/v1beta1/csistoragecapacity.go | 277 + .../storage/v1beta1/storageclass.go | 316 + .../storage/v1beta1/tokenrequest.go | 48 + .../storage/v1beta1/volumeattachment.go | 256 + .../storage/v1beta1/volumeattachmentsource.go | 52 + .../storage/v1beta1/volumeattachmentspec.go | 57 + .../storage/v1beta1/volumeattachmentstatus.go | 72 + .../storage/v1beta1/volumeerror.go | 52 + .../storage/v1beta1/volumenoderesources.go | 39 + .../client-go/discovery/discovery_client.go | 529 + vendor/k8s.io/client-go/discovery/doc.go | 19 + vendor/k8s.io/client-go/discovery/helper.go | 146 + vendor/k8s.io/client-go/dynamic/interface.go | 63 + vendor/k8s.io/client-go/dynamic/scheme.go | 108 + vendor/k8s.io/client-go/dynamic/simple.go | 388 + .../k8s.io/client-go/kubernetes/clientset.go | 706 + vendor/k8s.io/client-go/kubernetes/doc.go | 20 + vendor/k8s.io/client-go/kubernetes/import.go | 19 + .../k8s.io/client-go/kubernetes/scheme/doc.go | 20 + .../client-go/kubernetes/scheme/register.go | 146 + .../v1/admissionregistration_client.go | 112 + .../typed/admissionregistration/v1/doc.go | 20 + .../v1/generated_expansion.go | 23 + .../v1/mutatingwebhookconfiguration.go | 197 + .../v1/validatingwebhookconfiguration.go | 197 + .../v1beta1/admissionregistration_client.go | 112 + .../admissionregistration/v1beta1/doc.go | 20 + .../v1beta1/generated_expansion.go | 23 + .../v1beta1/mutatingwebhookconfiguration.go | 197 + .../v1beta1/validatingwebhookconfiguration.go | 197 + .../v1alpha1/apiserverinternal_client.go | 107 + .../typed/apiserverinternal/v1alpha1/doc.go | 20 + .../v1alpha1/generated_expansion.go | 21 + .../v1alpha1/storageversion.go | 243 + .../kubernetes/typed/apps/v1/apps_client.go | 127 + .../typed/apps/v1/controllerrevision.go | 208 + .../kubernetes/typed/apps/v1/daemonset.go | 256 + .../kubernetes/typed/apps/v1/deployment.go | 316 + .../client-go/kubernetes/typed/apps/v1/doc.go | 20 + .../typed/apps/v1/generated_expansion.go | 29 + .../kubernetes/typed/apps/v1/replicaset.go | 316 + .../kubernetes/typed/apps/v1/statefulset.go | 316 + .../typed/apps/v1beta1/apps_client.go | 117 + .../typed/apps/v1beta1/controllerrevision.go | 208 + .../typed/apps/v1beta1/deployment.go | 256 + .../kubernetes/typed/apps/v1beta1/doc.go | 20 + .../typed/apps/v1beta1/generated_expansion.go | 25 + .../typed/apps/v1beta1/statefulset.go | 256 + .../typed/apps/v1beta2/apps_client.go | 127 + .../typed/apps/v1beta2/controllerrevision.go | 208 + .../typed/apps/v1beta2/daemonset.go | 256 + .../typed/apps/v1beta2/deployment.go | 256 + .../kubernetes/typed/apps/v1beta2/doc.go | 20 + .../typed/apps/v1beta2/generated_expansion.go | 29 + .../typed/apps/v1beta2/replicaset.go | 256 + .../typed/apps/v1beta2/statefulset.go | 314 + .../v1/authentication_client.go | 107 + .../kubernetes/typed/authentication/v1/doc.go | 20 + .../authentication/v1/generated_expansion.go | 21 + .../typed/authentication/v1/tokenreview.go | 64 + .../v1beta1/authentication_client.go | 107 + .../typed/authentication/v1beta1/doc.go | 20 + .../v1beta1/generated_expansion.go | 21 + .../authentication/v1beta1/tokenreview.go | 64 + .../authorization/v1/authorization_client.go | 122 + .../kubernetes/typed/authorization/v1/doc.go | 20 + .../authorization/v1/generated_expansion.go | 27 + .../v1/localsubjectaccessreview.go | 67 + .../v1/selfsubjectaccessreview.go | 64 + .../v1/selfsubjectrulesreview.go | 64 + .../authorization/v1/subjectaccessreview.go | 64 + .../v1beta1/authorization_client.go | 122 + .../typed/authorization/v1beta1/doc.go | 20 + .../v1beta1/generated_expansion.go | 27 + .../v1beta1/localsubjectaccessreview.go | 67 + .../v1beta1/selfsubjectaccessreview.go | 64 + .../v1beta1/selfsubjectrulesreview.go | 64 + .../v1beta1/subjectaccessreview.go | 64 + .../autoscaling/v1/autoscaling_client.go | 107 + .../kubernetes/typed/autoscaling/v1/doc.go | 20 + .../autoscaling/v1/generated_expansion.go | 21 + .../autoscaling/v1/horizontalpodautoscaler.go | 256 + .../autoscaling/v2/autoscaling_client.go | 107 + .../kubernetes/typed/autoscaling/v2/doc.go | 20 + .../autoscaling/v2/generated_expansion.go | 21 + .../autoscaling/v2/horizontalpodautoscaler.go | 256 + .../autoscaling/v2beta1/autoscaling_client.go | 107 + .../typed/autoscaling/v2beta1/doc.go | 20 + .../v2beta1/generated_expansion.go | 21 + .../v2beta1/horizontalpodautoscaler.go | 256 + .../autoscaling/v2beta2/autoscaling_client.go | 107 + .../typed/autoscaling/v2beta2/doc.go | 20 + .../v2beta2/generated_expansion.go | 21 + .../v2beta2/horizontalpodautoscaler.go | 256 + .../kubernetes/typed/batch/v1/batch_client.go | 112 + .../kubernetes/typed/batch/v1/cronjob.go | 256 + .../kubernetes/typed/batch/v1/doc.go | 20 + .../typed/batch/v1/generated_expansion.go | 23 + .../kubernetes/typed/batch/v1/job.go | 256 + .../typed/batch/v1beta1/batch_client.go | 107 + .../kubernetes/typed/batch/v1beta1/cronjob.go | 256 + .../kubernetes/typed/batch/v1beta1/doc.go | 20 + .../batch/v1beta1/generated_expansion.go | 21 + .../certificates/v1/certificates_client.go | 107 + .../v1/certificatesigningrequest.go | 259 + .../kubernetes/typed/certificates/v1/doc.go | 20 + .../certificates/v1/generated_expansion.go | 21 + .../v1beta1/certificates_client.go | 107 + .../v1beta1/certificatesigningrequest.go | 243 + .../certificatesigningrequest_expansion.go | 42 + .../typed/certificates/v1beta1/doc.go | 20 + .../v1beta1/generated_expansion.go | 19 + .../coordination/v1/coordination_client.go | 107 + .../kubernetes/typed/coordination/v1/doc.go | 20 + .../coordination/v1/generated_expansion.go | 21 + .../kubernetes/typed/coordination/v1/lease.go | 208 + .../v1beta1/coordination_client.go | 107 + .../typed/coordination/v1beta1/doc.go | 20 + .../v1beta1/generated_expansion.go | 21 + .../typed/coordination/v1beta1/lease.go | 208 + .../typed/core/v1/componentstatus.go | 197 + .../kubernetes/typed/core/v1/configmap.go | 208 + .../kubernetes/typed/core/v1/core_client.go | 182 + .../client-go/kubernetes/typed/core/v1/doc.go | 20 + .../kubernetes/typed/core/v1/endpoints.go | 208 + .../kubernetes/typed/core/v1/event.go | 208 + .../typed/core/v1/event_expansion.go | 169 + .../typed/core/v1/generated_expansion.go | 41 + .../kubernetes/typed/core/v1/limitrange.go | 208 + .../kubernetes/typed/core/v1/namespace.go | 227 + .../typed/core/v1/namespace_expansion.go | 37 + .../kubernetes/typed/core/v1/node.go | 243 + .../typed/core/v1/node_expansion.go | 45 + .../typed/core/v1/persistentvolume.go | 243 + .../typed/core/v1/persistentvolumeclaim.go | 256 + .../client-go/kubernetes/typed/core/v1/pod.go | 273 + .../kubernetes/typed/core/v1/pod_expansion.go | 85 + .../kubernetes/typed/core/v1/podtemplate.go | 208 + .../typed/core/v1/replicationcontroller.go | 289 + .../kubernetes/typed/core/v1/resourcequota.go | 256 + .../kubernetes/typed/core/v1/secret.go | 208 + .../kubernetes/typed/core/v1/service.go | 239 + .../typed/core/v1/service_expansion.go | 41 + .../typed/core/v1/serviceaccount.go | 226 + .../typed/discovery/v1/discovery_client.go | 107 + .../kubernetes/typed/discovery/v1/doc.go | 20 + .../typed/discovery/v1/endpointslice.go | 208 + .../typed/discovery/v1/generated_expansion.go | 21 + .../discovery/v1beta1/discovery_client.go | 107 + .../kubernetes/typed/discovery/v1beta1/doc.go | 20 + .../typed/discovery/v1beta1/endpointslice.go | 208 + .../discovery/v1beta1/generated_expansion.go | 21 + .../kubernetes/typed/events/v1/doc.go | 20 + .../kubernetes/typed/events/v1/event.go | 208 + .../typed/events/v1/events_client.go | 107 + .../typed/events/v1/generated_expansion.go | 21 + .../kubernetes/typed/events/v1beta1/doc.go | 20 + .../kubernetes/typed/events/v1beta1/event.go | 208 + .../typed/events/v1beta1/event_expansion.go | 100 + .../typed/events/v1beta1/events_client.go | 107 + .../events/v1beta1/generated_expansion.go | 19 + .../typed/extensions/v1beta1/daemonset.go | 256 + .../typed/extensions/v1beta1/deployment.go | 314 + .../v1beta1/deployment_expansion.go | 35 + .../typed/extensions/v1beta1/doc.go | 20 + .../extensions/v1beta1/extensions_client.go | 132 + .../extensions/v1beta1/generated_expansion.go | 29 + .../typed/extensions/v1beta1/ingress.go | 256 + .../typed/extensions/v1beta1/networkpolicy.go | 256 + .../extensions/v1beta1/podsecuritypolicy.go | 197 + .../typed/extensions/v1beta1/replicaset.go | 314 + .../typed/flowcontrol/v1alpha1/doc.go | 20 + .../v1alpha1/flowcontrol_client.go | 112 + .../typed/flowcontrol/v1alpha1/flowschema.go | 243 + .../v1alpha1/generated_expansion.go | 23 + .../v1alpha1/prioritylevelconfiguration.go | 243 + .../typed/flowcontrol/v1beta1/doc.go | 20 + .../flowcontrol/v1beta1/flowcontrol_client.go | 112 + .../typed/flowcontrol/v1beta1/flowschema.go | 243 + .../v1beta1/generated_expansion.go | 23 + .../v1beta1/prioritylevelconfiguration.go | 243 + .../typed/flowcontrol/v1beta2/doc.go | 20 + .../flowcontrol/v1beta2/flowcontrol_client.go | 112 + .../typed/flowcontrol/v1beta2/flowschema.go | 243 + .../v1beta2/generated_expansion.go | 23 + .../v1beta2/prioritylevelconfiguration.go | 243 + .../kubernetes/typed/networking/v1/doc.go | 20 + .../networking/v1/generated_expansion.go | 25 + .../kubernetes/typed/networking/v1/ingress.go | 256 + .../typed/networking/v1/ingressclass.go | 197 + .../typed/networking/v1/networking_client.go | 117 + .../typed/networking/v1/networkpolicy.go | 256 + .../typed/networking/v1alpha1/clustercidr.go | 197 + .../typed/networking/v1alpha1/doc.go | 20 + .../v1alpha1/generated_expansion.go | 21 + .../networking/v1alpha1/networking_client.go | 107 + .../typed/networking/v1beta1/doc.go | 20 + .../networking/v1beta1/generated_expansion.go | 23 + .../typed/networking/v1beta1/ingress.go | 256 + .../typed/networking/v1beta1/ingressclass.go | 197 + .../networking/v1beta1/networking_client.go | 112 + .../client-go/kubernetes/typed/node/v1/doc.go | 20 + .../typed/node/v1/generated_expansion.go | 21 + .../kubernetes/typed/node/v1/node_client.go | 107 + .../kubernetes/typed/node/v1/runtimeclass.go | 197 + .../kubernetes/typed/node/v1alpha1/doc.go | 20 + .../node/v1alpha1/generated_expansion.go | 21 + .../typed/node/v1alpha1/node_client.go | 107 + .../typed/node/v1alpha1/runtimeclass.go | 197 + .../kubernetes/typed/node/v1beta1/doc.go | 20 + .../typed/node/v1beta1/generated_expansion.go | 21 + .../typed/node/v1beta1/node_client.go | 107 + .../typed/node/v1beta1/runtimeclass.go | 197 + .../kubernetes/typed/policy/v1/doc.go | 20 + .../kubernetes/typed/policy/v1/eviction.go | 48 + .../typed/policy/v1/eviction_expansion.go | 40 + .../typed/policy/v1/generated_expansion.go | 21 + .../typed/policy/v1/poddisruptionbudget.go | 256 + .../typed/policy/v1/policy_client.go | 112 + .../kubernetes/typed/policy/v1beta1/doc.go | 20 + .../typed/policy/v1beta1/eviction.go | 48 + .../policy/v1beta1/eviction_expansion.go | 40 + .../policy/v1beta1/generated_expansion.go | 23 + .../policy/v1beta1/poddisruptionbudget.go | 256 + .../typed/policy/v1beta1/podsecuritypolicy.go | 197 + .../typed/policy/v1beta1/policy_client.go | 117 + .../kubernetes/typed/rbac/v1/clusterrole.go | 197 + .../typed/rbac/v1/clusterrolebinding.go | 197 + .../client-go/kubernetes/typed/rbac/v1/doc.go | 20 + .../typed/rbac/v1/generated_expansion.go | 27 + .../kubernetes/typed/rbac/v1/rbac_client.go | 122 + .../kubernetes/typed/rbac/v1/role.go | 208 + .../kubernetes/typed/rbac/v1/rolebinding.go | 208 + .../typed/rbac/v1alpha1/clusterrole.go | 197 + .../typed/rbac/v1alpha1/clusterrolebinding.go | 197 + .../kubernetes/typed/rbac/v1alpha1/doc.go | 20 + .../rbac/v1alpha1/generated_expansion.go | 27 + .../typed/rbac/v1alpha1/rbac_client.go | 122 + .../kubernetes/typed/rbac/v1alpha1/role.go | 208 + .../typed/rbac/v1alpha1/rolebinding.go | 208 + .../typed/rbac/v1beta1/clusterrole.go | 197 + .../typed/rbac/v1beta1/clusterrolebinding.go | 197 + .../kubernetes/typed/rbac/v1beta1/doc.go | 20 + .../typed/rbac/v1beta1/generated_expansion.go | 27 + .../typed/rbac/v1beta1/rbac_client.go | 122 + .../kubernetes/typed/rbac/v1beta1/role.go | 208 + .../typed/rbac/v1beta1/rolebinding.go | 208 + .../kubernetes/typed/scheduling/v1/doc.go | 20 + .../scheduling/v1/generated_expansion.go | 21 + .../typed/scheduling/v1/priorityclass.go | 197 + .../typed/scheduling/v1/scheduling_client.go | 107 + .../typed/scheduling/v1alpha1/doc.go | 20 + .../v1alpha1/generated_expansion.go | 21 + .../scheduling/v1alpha1/priorityclass.go | 197 + .../scheduling/v1alpha1/scheduling_client.go | 107 + .../typed/scheduling/v1beta1/doc.go | 20 + .../scheduling/v1beta1/generated_expansion.go | 21 + .../typed/scheduling/v1beta1/priorityclass.go | 197 + .../scheduling/v1beta1/scheduling_client.go | 107 + .../kubernetes/typed/storage/v1/csidriver.go | 197 + .../kubernetes/typed/storage/v1/csinode.go | 197 + .../typed/storage/v1/csistoragecapacity.go | 208 + .../kubernetes/typed/storage/v1/doc.go | 20 + .../typed/storage/v1/generated_expansion.go | 29 + .../typed/storage/v1/storage_client.go | 127 + .../typed/storage/v1/storageclass.go | 197 + .../typed/storage/v1/volumeattachment.go | 243 + .../storage/v1alpha1/csistoragecapacity.go | 208 + .../kubernetes/typed/storage/v1alpha1/doc.go | 20 + .../storage/v1alpha1/generated_expansion.go | 23 + .../typed/storage/v1alpha1/storage_client.go | 112 + .../storage/v1alpha1/volumeattachment.go | 243 + .../typed/storage/v1beta1/csidriver.go | 197 + .../typed/storage/v1beta1/csinode.go | 197 + .../storage/v1beta1/csistoragecapacity.go | 208 + .../kubernetes/typed/storage/v1beta1/doc.go | 20 + .../storage/v1beta1/generated_expansion.go | 29 + .../typed/storage/v1beta1/storage_client.go | 127 + .../typed/storage/v1beta1/storageclass.go | 197 + .../typed/storage/v1beta1/volumeattachment.go | 243 + vendor/k8s.io/client-go/openapi/client.go | 64 + .../k8s.io/client-go/openapi/groupversion.go | 59 + .../pkg/apis/clientauthentication/OWNERS | 8 + .../pkg/apis/clientauthentication/doc.go | 20 + .../clientauthentication/install/install.go | 34 + .../pkg/apis/clientauthentication/register.go | 50 + .../pkg/apis/clientauthentication/types.go | 124 + .../pkg/apis/clientauthentication/v1/doc.go | 24 + .../apis/clientauthentication/v1/register.go | 55 + .../pkg/apis/clientauthentication/v1/types.go | 122 + .../v1/zz_generated.conversion.go | 205 + .../v1/zz_generated.deepcopy.go | 120 + .../v1/zz_generated.defaults.go | 33 + .../apis/clientauthentication/v1beta1/doc.go | 24 + .../clientauthentication/v1beta1/register.go | 55 + .../clientauthentication/v1beta1/types.go | 122 + .../v1beta1/zz_generated.conversion.go | 205 + .../v1beta1/zz_generated.deepcopy.go | 120 + .../v1beta1/zz_generated.defaults.go | 33 + .../zz_generated.deepcopy.go | 122 + vendor/k8s.io/client-go/pkg/version/base.go | 63 + vendor/k8s.io/client-go/pkg/version/doc.go | 21 + .../k8s.io/client-go/pkg/version/version.go | 42 + .../client-go/plugin/pkg/client/auth/OWNERS | 8 + .../plugin/pkg/client/auth/azure/README.md | 56 + .../plugin/pkg/client/auth/azure/azure.go | 477 + .../plugin/pkg/client/auth/exec/exec.go | 548 + .../plugin/pkg/client/auth/exec/metrics.go | 111 + .../plugin/pkg/client/auth/gcp/OWNERS | 8 + .../plugin/pkg/client/auth/gcp/gcp.go | 389 + .../plugin/pkg/client/auth/oidc/oidc.go | 380 + .../client/auth/openstack/openstack_stub.go | 36 + .../plugin/pkg/client/auth/plugins.go | 22 + .../pkg/client/auth/plugins_providers.go | 27 + vendor/k8s.io/client-go/rest/OWNERS | 14 + vendor/k8s.io/client-go/rest/client.go | 203 + vendor/k8s.io/client-go/rest/config.go | 675 + vendor/k8s.io/client-go/rest/exec.go | 84 + vendor/k8s.io/client-go/rest/plugin.go | 84 + vendor/k8s.io/client-go/rest/request.go | 1406 + vendor/k8s.io/client-go/rest/transport.go | 152 + vendor/k8s.io/client-go/rest/url_utils.go | 97 + vendor/k8s.io/client-go/rest/urlbackoff.go | 107 + vendor/k8s.io/client-go/rest/warnings.go | 147 + vendor/k8s.io/client-go/rest/watch/decoder.go | 72 + vendor/k8s.io/client-go/rest/watch/encoder.go | 56 + vendor/k8s.io/client-go/rest/with_retry.go | 361 + .../client-go/rest/zz_generated.deepcopy.go | 58 + .../third_party/forked/golang/LICENSE | 27 + .../third_party/forked/golang/PATENTS | 22 + .../forked/golang/template/exec.go | 52 + .../forked/golang/template/funcs.go | 177 + vendor/k8s.io/client-go/tools/auth/OWNERS | 8 + .../k8s.io/client-go/tools/auth/clientauth.go | 126 + vendor/k8s.io/client-go/tools/cache/OWNERS | 28 + .../client-go/tools/cache/controller.go | 495 + .../client-go/tools/cache/delta_fifo.go | 757 + vendor/k8s.io/client-go/tools/cache/doc.go | 24 + .../client-go/tools/cache/expiration_cache.go | 216 + .../tools/cache/expiration_cache_fakes.go | 57 + .../tools/cache/fake_custom_store.go | 102 + vendor/k8s.io/client-go/tools/cache/fifo.go | 374 + vendor/k8s.io/client-go/tools/cache/heap.go | 322 + vendor/k8s.io/client-go/tools/cache/index.go | 101 + .../k8s.io/client-go/tools/cache/listers.go | 183 + .../k8s.io/client-go/tools/cache/listwatch.go | 112 + .../client-go/tools/cache/mutation_cache.go | 262 + .../tools/cache/mutation_detector.go | 166 + .../k8s.io/client-go/tools/cache/reflector.go | 639 + .../tools/cache/reflector_metrics.go | 89 + .../tools/cache/retry_with_deadline.go | 78 + .../client-go/tools/cache/shared_informer.go | 855 + vendor/k8s.io/client-go/tools/cache/store.go | 276 + .../tools/cache/thread_safe_store.go | 332 + .../client-go/tools/cache/undelta_store.go | 89 + .../client-go/tools/clientcmd/api/doc.go | 19 + .../client-go/tools/clientcmd/api/helpers.go | 191 + .../tools/clientcmd/api/latest/latest.go | 61 + .../client-go/tools/clientcmd/api/register.go | 46 + .../client-go/tools/clientcmd/api/types.go | 370 + .../tools/clientcmd/api/v1/conversion.go | 174 + .../tools/clientcmd/api/v1/defaults.go | 37 + .../client-go/tools/clientcmd/api/v1/doc.go | 21 + .../tools/clientcmd/api/v1/register.go | 56 + .../client-go/tools/clientcmd/api/v1/types.go | 266 + .../api/v1/zz_generated.conversion.go | 456 + .../clientcmd/api/v1/zz_generated.deepcopy.go | 349 + .../clientcmd/api/v1/zz_generated.defaults.go | 43 + .../clientcmd/api/zz_generated.deepcopy.go | 328 + .../client-go/tools/clientcmd/auth_loaders.go | 111 + .../tools/clientcmd/client_config.go | 637 + .../client-go/tools/clientcmd/config.go | 500 + .../k8s.io/client-go/tools/clientcmd/doc.go | 37 + .../k8s.io/client-go/tools/clientcmd/flag.go | 49 + .../client-go/tools/clientcmd/helpers.go | 50 + .../client-go/tools/clientcmd/loader.go | 648 + .../tools/clientcmd/merged_client_builder.go | 172 + .../client-go/tools/clientcmd/overrides.go | 259 + .../client-go/tools/clientcmd/validation.go | 371 + .../client-go/tools/leaderelection/OWNERS | 11 + .../tools/leaderelection/healthzadaptor.go | 69 + .../tools/leaderelection/leaderelection.go | 418 + .../client-go/tools/leaderelection/metrics.go | 109 + .../resourcelock/configmaplock.go | 126 + .../resourcelock/endpointslock.go | 121 + .../leaderelection/resourcelock/interface.go | 227 + .../leaderelection/resourcelock/leaselock.go | 139 + .../leaderelection/resourcelock/multilock.go | 104 + vendor/k8s.io/client-go/tools/metrics/OWNERS | 5 + .../k8s.io/client-go/tools/metrics/metrics.go | 146 + vendor/k8s.io/client-go/tools/pager/pager.go | 250 + vendor/k8s.io/client-go/tools/record/OWNERS | 6 + vendor/k8s.io/client-go/tools/record/doc.go | 19 + vendor/k8s.io/client-go/tools/record/event.go | 394 + .../client-go/tools/record/events_cache.go | 525 + vendor/k8s.io/client-go/tools/record/fake.go | 66 + .../client-go/tools/record/util/util.go | 40 + .../k8s.io/client-go/tools/reference/ref.go | 109 + vendor/k8s.io/client-go/transport/OWNERS | 8 + vendor/k8s.io/client-go/transport/cache.go | 180 + .../client-go/transport/cert_rotation.go | 176 + vendor/k8s.io/client-go/transport/config.go | 166 + .../client-go/transport/round_trippers.go | 697 + .../client-go/transport/token_source.go | 201 + .../k8s.io/client-go/transport/transport.go | 356 + vendor/k8s.io/client-go/util/cert/OWNERS | 8 + vendor/k8s.io/client-go/util/cert/cert.go | 208 + vendor/k8s.io/client-go/util/cert/csr.go | 75 + vendor/k8s.io/client-go/util/cert/io.go | 113 + vendor/k8s.io/client-go/util/cert/pem.go | 73 + .../client-go/util/cert/server_inspection.go | 102 + .../util/connrotation/connrotation.go | 133 + .../client-go/util/flowcontrol/backoff.go | 181 + .../client-go/util/flowcontrol/throttle.go | 192 + .../k8s.io/client-go/util/homedir/homedir.go | 92 + vendor/k8s.io/client-go/util/jsonpath/doc.go | 20 + .../client-go/util/jsonpath/jsonpath.go | 579 + vendor/k8s.io/client-go/util/jsonpath/node.go | 256 + .../k8s.io/client-go/util/jsonpath/parser.go | 527 + vendor/k8s.io/client-go/util/keyutil/OWNERS | 6 + vendor/k8s.io/client-go/util/keyutil/key.go | 323 + vendor/k8s.io/client-go/util/retry/OWNERS | 4 + vendor/k8s.io/client-go/util/retry/util.go | 105 + .../util/workqueue/default_rate_limiters.go | 238 + .../util/workqueue/delaying_queue.go | 282 + vendor/k8s.io/client-go/util/workqueue/doc.go | 26 + .../client-go/util/workqueue/metrics.go | 261 + .../client-go/util/workqueue/parallelizer.go | 101 + .../k8s.io/client-go/util/workqueue/queue.go | 285 + .../util/workqueue/rate_limiting_queue.go | 78 + vendor/k8s.io/kube-openapi/LICENSE | 202 + .../kube-openapi/pkg/builder3/util/util.go | 51 + .../k8s.io/kube-openapi/pkg/common/common.go | 320 + vendor/k8s.io/kube-openapi/pkg/common/doc.go | 19 + .../kube-openapi/pkg/common/interfaces.go | 88 + .../kube-openapi/pkg/handler3/handler.go | 291 + .../k8s.io/kube-openapi/pkg/internal/flags.go | 20 + .../pkg/internal/handler/handler_cache.go | 57 + .../go-json-experiment/json/AUTHORS | 3 + .../go-json-experiment/json/CONTRIBUTORS | 3 + .../go-json-experiment/json/LICENSE | 27 + .../go-json-experiment/json/README.md | 321 + .../go-json-experiment/json/arshal.go | 506 + .../go-json-experiment/json/arshal_any.go | 219 + .../go-json-experiment/json/arshal_default.go | 1446 + .../go-json-experiment/json/arshal_funcs.go | 387 + .../go-json-experiment/json/arshal_inlined.go | 186 + .../go-json-experiment/json/arshal_methods.go | 229 + .../go-json-experiment/json/arshal_time.go | 196 + .../go-json-experiment/json/decode.go | 1655 + .../go-json-experiment/json/doc.go | 185 + .../go-json-experiment/json/encode.go | 1146 + .../go-json-experiment/json/errors.go | 183 + .../go-json-experiment/json/fields.go | 509 + .../go-json-experiment/json/fold.go | 56 + .../go-json-experiment/json/intern.go | 86 + .../go-json-experiment/json/pools.go | 150 + .../go-json-experiment/json/state.go | 747 + .../go-json-experiment/json/token.go | 522 + .../go-json-experiment/json/value.go | 375 + .../kube-openapi/pkg/openapiconv/convert.go | 322 + .../k8s.io/kube-openapi/pkg/schemaconv/smd.go | 471 + .../kube-openapi/pkg/schemamutation/walker.go | 519 + .../kube-openapi/pkg/spec3/component.go | 47 + .../k8s.io/kube-openapi/pkg/spec3/encoding.go | 64 + .../k8s.io/kube-openapi/pkg/spec3/example.go | 73 + .../pkg/spec3/external_documentation.go | 58 + .../k8s.io/kube-openapi/pkg/spec3/header.go | 90 + .../kube-openapi/pkg/spec3/media_type.go | 66 + .../kube-openapi/pkg/spec3/operation.go | 79 + .../kube-openapi/pkg/spec3/parameter.go | 94 + vendor/k8s.io/kube-openapi/pkg/spec3/path.go | 142 + .../kube-openapi/pkg/spec3/request_body.go | 73 + .../k8s.io/kube-openapi/pkg/spec3/response.go | 203 + .../pkg/spec3/security_requirement.go | 56 + .../kube-openapi/pkg/spec3/security_scheme.go | 118 + .../k8s.io/kube-openapi/pkg/spec3/server.go | 98 + vendor/k8s.io/kube-openapi/pkg/spec3/spec.go | 37 + .../k8s.io/kube-openapi/pkg/util/proto/OWNERS | 2 + .../k8s.io/kube-openapi/pkg/util/proto/doc.go | 19 + .../kube-openapi/pkg/util/proto/document.go | 362 + .../pkg/util/proto/document_v3.go | 324 + .../kube-openapi/pkg/util/proto/openapi.go | 285 + .../pkg/validation/spec/.gitignore | 2 + .../kube-openapi/pkg/validation/spec/LICENSE | 202 + .../pkg/validation/spec/contact_info.go | 24 + .../pkg/validation/spec/external_docs.go | 24 + .../kube-openapi/pkg/validation/spec/fuzz.go | 502 + .../pkg/validation/spec/gnostic.go | 1517 + .../pkg/validation/spec/header.go | 105 + .../kube-openapi/pkg/validation/spec/info.go | 222 + .../kube-openapi/pkg/validation/spec/items.go | 137 + .../pkg/validation/spec/license.go | 23 + .../pkg/validation/spec/operation.go | 120 + .../pkg/validation/spec/parameter.go | 146 + .../pkg/validation/spec/path_item.go | 105 + .../kube-openapi/pkg/validation/spec/paths.go | 144 + .../kube-openapi/pkg/validation/spec/ref.go | 167 + .../pkg/validation/spec/response.go | 113 + .../pkg/validation/spec/responses.go | 186 + .../pkg/validation/spec/schema.go | 554 + .../pkg/validation/spec/security_scheme.go | 82 + .../pkg/validation/spec/swagger.go | 393 + .../kube-openapi/pkg/validation/spec/tag.go | 82 + vendor/k8s.io/utils/buffer/ring_growing.go | 72 + vendor/k8s.io/utils/clock/README.md | 4 + vendor/k8s.io/utils/clock/clock.go | 178 + .../k8s.io/utils/clock/testing/fake_clock.go | 361 + .../clock/testing/simple_interval_clock.go | 44 + vendor/k8s.io/utils/integer/integer.go | 73 + vendor/k8s.io/utils/net/port.go | 2 +- vendor/k8s.io/utils/pointer/OWNERS | 10 + vendor/k8s.io/utils/pointer/README.md | 3 + vendor/k8s.io/utils/pointer/pointer.go | 410 + vendor/k8s.io/utils/trace/README.md | 67 + vendor/k8s.io/utils/trace/trace.go | 300 + vendor/knative.dev/pkg/LICENSE | 201 + vendor/knative.dev/pkg/apis/OWNERS | 9 + vendor/knative.dev/pkg/apis/condition_set.go | 450 + .../knative.dev/pkg/apis/condition_types.go | 125 + vendor/knative.dev/pkg/apis/contexts.go | 262 + vendor/knative.dev/pkg/apis/convert.go | 47 + vendor/knative.dev/pkg/apis/deprecated.go | 183 + vendor/knative.dev/pkg/apis/doc.go | 18 + vendor/knative.dev/pkg/apis/duck/ABOUT.md | 330 + vendor/knative.dev/pkg/apis/duck/OWNERS | 8 + vendor/knative.dev/pkg/apis/duck/README.md | 129 + vendor/knative.dev/pkg/apis/duck/cached.go | 101 + vendor/knative.dev/pkg/apis/duck/const.go | 33 + vendor/knative.dev/pkg/apis/duck/doc.go | 23 + .../pkg/apis/duck/ducktypes/ducktypes.go | 43 + vendor/knative.dev/pkg/apis/duck/enqueue.go | 46 + vendor/knative.dev/pkg/apis/duck/interface.go | 71 + vendor/knative.dev/pkg/apis/duck/patch.go | 73 + vendor/knative.dev/pkg/apis/duck/register.go | 34 + vendor/knative.dev/pkg/apis/duck/typed.go | 142 + .../knative.dev/pkg/apis/duck/unstructured.go | 62 + .../pkg/apis/duck/v1/addressable_types.go | 121 + .../pkg/apis/duck/v1/binding_types.go | 92 + .../pkg/apis/duck/v1/cronjob_defaults.go | 47 + .../pkg/apis/duck/v1/cronjob_types.go | 86 + .../pkg/apis/duck/v1/cronjob_validation.go | 50 + .../pkg/apis/duck/v1/destination.go | 79 + vendor/knative.dev/pkg/apis/duck/v1/doc.go | 23 + .../pkg/apis/duck/v1/knative_reference.go | 126 + .../pkg/apis/duck/v1/kresource_type.go | 104 + .../pkg/apis/duck/v1/podspec_defaults.go | 73 + .../pkg/apis/duck/v1/podspec_types.go | 145 + .../pkg/apis/duck/v1/podspec_validation.go | 77 + .../knative.dev/pkg/apis/duck/v1/register.go | 64 + .../pkg/apis/duck/v1/source_types.go | 222 + .../pkg/apis/duck/v1/status_types.go | 117 + .../pkg/apis/duck/v1/zz_generated.deepcopy.go | 724 + vendor/knative.dev/pkg/apis/duck/verify.go | 96 + vendor/knative.dev/pkg/apis/field_error.go | 495 + vendor/knative.dev/pkg/apis/interfaces.go | 67 + vendor/knative.dev/pkg/apis/kind2resource.go | 47 + .../pkg/apis/metadata_validation.go | 89 + vendor/knative.dev/pkg/apis/url.go | 141 + vendor/knative.dev/pkg/apis/volatile_time.go | 54 + .../pkg/apis/zz_generated.deepcopy.go | 131 + vendor/knative.dev/pkg/changeset/commit.go | 82 + vendor/knative.dev/pkg/changeset/doc.go | 19 + .../client/injection/kube/client/client.go | 18350 ++++ .../injection/kube/client/client_expansion.go | 160 + vendor/knative.dev/pkg/configmap/OWNERS | 6 + vendor/knative.dev/pkg/configmap/doc.go | 21 + vendor/knative.dev/pkg/configmap/example.go | 44 + vendor/knative.dev/pkg/configmap/filter.go | 74 + vendor/knative.dev/pkg/configmap/load.go | 57 + .../pkg/configmap/manual_watcher.go | 74 + vendor/knative.dev/pkg/configmap/parse.go | 267 + .../pkg/configmap/static_watcher.go | 58 + vendor/knative.dev/pkg/configmap/store.go | 161 + vendor/knative.dev/pkg/configmap/watcher.go | 49 + vendor/knative.dev/pkg/controller/OWNERS | 7 + .../knative.dev/pkg/controller/controller.go | 862 + vendor/knative.dev/pkg/controller/helper.go | 66 + vendor/knative.dev/pkg/controller/options.go | 54 + .../pkg/controller/stats_reporter.go | 205 + .../pkg/controller/two_lane_queue.go | 156 + .../pkg/environment/client_config.go | 86 + vendor/knative.dev/pkg/hash/OWNERS | 7 + vendor/knative.dev/pkg/hash/bucketer.go | 140 + vendor/knative.dev/pkg/hash/doc.go | 27 + vendor/knative.dev/pkg/hash/hash.go | 166 + vendor/knative.dev/pkg/injection/OWNERS | 5 + vendor/knative.dev/pkg/injection/README.md | 540 + vendor/knative.dev/pkg/injection/clients.go | 83 + .../clients/dynamicclient/dynamicclient.go | 49 + vendor/knative.dev/pkg/injection/config.go | 50 + vendor/knative.dev/pkg/injection/context.go | 85 + vendor/knative.dev/pkg/injection/doc.go | 105 + vendor/knative.dev/pkg/injection/ducks.go | 40 + vendor/knative.dev/pkg/injection/factories.go | 40 + vendor/knative.dev/pkg/injection/informers.go | 134 + vendor/knative.dev/pkg/injection/injection.go | 68 + vendor/knative.dev/pkg/injection/interface.go | 144 + vendor/knative.dev/pkg/kmap/lookup.go | 77 + vendor/knative.dev/pkg/kmap/map.go | 80 + vendor/knative.dev/pkg/kmeta/OWNERS | 5 + vendor/knative.dev/pkg/kmeta/accessor.go | 75 + vendor/knative.dev/pkg/kmeta/doc.go | 19 + vendor/knative.dev/pkg/kmeta/labels.go | 114 + vendor/knative.dev/pkg/kmeta/map.go | 34 + vendor/knative.dev/pkg/kmeta/names.go | 75 + .../knative.dev/pkg/kmeta/owner_references.go | 38 + .../pkg/kmeta/ownerrefable_accessor.go | 26 + vendor/knative.dev/pkg/kmp/diff.go | 92 + vendor/knative.dev/pkg/kmp/doc.go | 19 + vendor/knative.dev/pkg/kmp/reporters.go | 145 + .../knative.dev/pkg/leaderelection/config.go | 210 + .../knative.dev/pkg/leaderelection/context.go | 317 + vendor/knative.dev/pkg/leaderelection/doc.go | 27 + vendor/knative.dev/pkg/logging/OWNERS | 6 + vendor/knative.dev/pkg/logging/config.go | 275 + vendor/knative.dev/pkg/logging/logger.go | 57 + .../pkg/logging/logkey/constants.go | 65 + .../pkg/logging/object_encoders.go | 45 + .../pkg/logging/warning_handler.go | 33 + .../pkg/logging/zz_generated.deepcopy.go | 49 + vendor/knative.dev/pkg/metrics/OWNERS | 10 + vendor/knative.dev/pkg/metrics/README.md | 107 + vendor/knative.dev/pkg/metrics/client.go | 62 + vendor/knative.dev/pkg/metrics/config.go | 277 + .../pkg/metrics/config_observability.go | 165 + vendor/knative.dev/pkg/metrics/doc.go | 20 + vendor/knative.dev/pkg/metrics/exporter.go | 279 + vendor/knative.dev/pkg/metrics/memstats.go | 551 + vendor/knative.dev/pkg/metrics/metrics.go | 169 + .../knative.dev/pkg/metrics/metrics_worker.go | 111 + .../pkg/metrics/metricskey/constants.go | 77 + .../pkg/metrics/opencensus_exporter.go | 111 + .../pkg/metrics/prometheus_exporter.go | 91 + vendor/knative.dev/pkg/metrics/record.go | 58 + .../knative.dev/pkg/metrics/resource_view.go | 450 + vendor/knative.dev/pkg/metrics/testing.go | 30 + vendor/knative.dev/pkg/metrics/utils.go | 54 + vendor/knative.dev/pkg/metrics/workqueue.go | 177 + .../pkg/metrics/zz_generated.deepcopy.go | 38 + vendor/knative.dev/pkg/network/OWNERS | 5 + vendor/knative.dev/pkg/network/doc.go | 19 + vendor/knative.dev/pkg/network/domain.go | 79 + .../knative.dev/pkg/network/error_handler.go | 45 + vendor/knative.dev/pkg/network/h2c.go | 70 + vendor/knative.dev/pkg/network/network.go | 69 + vendor/knative.dev/pkg/network/transports.go | 176 + vendor/knative.dev/pkg/ptr/doc.go | 18 + vendor/knative.dev/pkg/ptr/ptr.go | 67 + vendor/knative.dev/pkg/ptr/value.go | 91 + vendor/knative.dev/pkg/reconciler/OWNERS | 7 + .../knative.dev/pkg/reconciler/configstore.go | 25 + vendor/knative.dev/pkg/reconciler/deletion.go | 35 + vendor/knative.dev/pkg/reconciler/events.go | 100 + vendor/knative.dev/pkg/reconciler/filter.go | 112 + vendor/knative.dev/pkg/reconciler/leader.go | 117 + .../pkg/reconciler/reconcile_common.go | 111 + vendor/knative.dev/pkg/reconciler/retry.go | 66 + vendor/knative.dev/pkg/signals/signal.go | 84 + .../knative.dev/pkg/signals/signal_posix.go | 27 + .../knative.dev/pkg/signals/signal_windows.go | 23 + vendor/knative.dev/pkg/system/env.go | 62 + vendor/knative.dev/pkg/tracker/doc.go | 23 + vendor/knative.dev/pkg/tracker/enqueue.go | 315 + vendor/knative.dev/pkg/tracker/interface.go | 181 + .../pkg/tracker/zz_generated.deepcopy.go | 47 + vendor/modules.txt | 970 +- vendor/sigs.k8s.io/json/CONTRIBUTING.md | 42 + vendor/sigs.k8s.io/json/LICENSE | 238 + vendor/sigs.k8s.io/json/Makefile | 35 + vendor/sigs.k8s.io/json/OWNERS | 6 + vendor/sigs.k8s.io/json/README.md | 40 + vendor/sigs.k8s.io/json/SECURITY.md | 22 + vendor/sigs.k8s.io/json/SECURITY_CONTACTS | 15 + vendor/sigs.k8s.io/json/code-of-conduct.md | 3 + vendor/sigs.k8s.io/json/doc.go | 17 + .../internal/golang/encoding/json/decode.go | 1437 + .../internal/golang/encoding/json/encode.go | 1419 + .../internal/golang/encoding/json/fold.go | 143 + .../internal/golang/encoding/json/fuzz.go | 42 + .../internal/golang/encoding/json/indent.go | 143 + .../golang/encoding/json/kubernetes_patch.go | 168 + .../internal/golang/encoding/json/scanner.go | 608 + .../internal/golang/encoding/json/stream.go | 519 + .../internal/golang/encoding/json/tables.go | 218 + .../internal/golang/encoding/json/tags.go | 38 + vendor/sigs.k8s.io/json/json.go | 150 + vendor/sigs.k8s.io/release-utils/LICENSE | 201 + .../release-utils/version/command.go | 72 + .../sigs.k8s.io/release-utils/version/doc.go | 27 + .../release-utils/version/version.go | 221 + .../structured-merge-diff/v4/LICENSE | 201 + .../structured-merge-diff/v4/fieldpath/doc.go | 21 + .../v4/fieldpath/element.go | 317 + .../v4/fieldpath/fromvalue.go | 134 + .../v4/fieldpath/managers.go | 144 + .../v4/fieldpath/path.go | 118 + .../v4/fieldpath/pathelementmap.go | 85 + .../v4/fieldpath/serialize-pe.go | 168 + .../v4/fieldpath/serialize.go | 238 + .../structured-merge-diff/v4/fieldpath/set.go | 505 + .../structured-merge-diff/v4/schema/doc.go | 28 + .../v4/schema/elements.go | 374 + .../structured-merge-diff/v4/schema/equals.go | 202 + .../v4/schema/schemaschema.go | 164 + .../structured-merge-diff/v4/typed/doc.go | 18 + .../structured-merge-diff/v4/typed/helpers.go | 260 + .../structured-merge-diff/v4/typed/merge.go | 412 + .../structured-merge-diff/v4/typed/parser.go | 151 + .../v4/typed/reconcile_schema.go | 290 + .../structured-merge-diff/v4/typed/remove.go | 165 + .../v4/typed/tofieldset.go | 168 + .../structured-merge-diff/v4/typed/typed.go | 322 + .../structured-merge-diff/v4/typed/union.go | 276 + .../v4/typed/validate.go | 195 + .../v4/value/allocator.go | 203 + .../structured-merge-diff/v4/value/doc.go | 21 + .../structured-merge-diff/v4/value/fields.go | 97 + .../v4/value/jsontagutil.go | 91 + .../structured-merge-diff/v4/value/list.go | 139 + .../v4/value/listreflect.go | 98 + .../v4/value/listunstructured.go | 74 + .../structured-merge-diff/v4/value/map.go | 270 + .../v4/value/mapreflect.go | 209 + .../v4/value/mapunstructured.go | 190 + .../v4/value/reflectcache.go | 467 + .../structured-merge-diff/v4/value/scalar.go | 50 + .../v4/value/structreflect.go | 208 + .../structured-merge-diff/v4/value/value.go | 347 + .../v4/value/valuereflect.go | 294 + .../v4/value/valueunstructured.go | 178 + 4588 files changed, 1406688 insertions(+), 2250 deletions(-) create mode 100644 pkg/policy/parse.go create mode 100644 pkg/policy/parse_test.go create mode 100644 pkg/policy/policy.go create mode 100644 pkg/policy/validate.go create mode 100644 pkg/policy/validate_test.go create mode 100644 pkg/policy/verifier.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/.gitignore create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/.travis.yml create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/CONTRIBUTING.md create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/LICENSE create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/README.md create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/common.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/connection.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/nodeinfo.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/ocagent.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/options.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/span_config.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/transform_spans.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/transform_stats_to_metrics.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/ocagent/version.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/.gitignore create mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/.golangci.yml create mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/.travis.yml create mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/LICENSE create mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/Makefile create mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/README.md create mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/prometheus.go create mode 100644 vendor/contrib.go.opencensus.io/exporter/prometheus/sanitize.go create mode 100644 vendor/cuelang.org/go/AUTHORS create mode 100644 vendor/cuelang.org/go/LICENSE create mode 100644 vendor/cuelang.org/go/cue/ast/ast.go create mode 100644 vendor/cuelang.org/go/cue/ast/astutil/apply.go create mode 100644 vendor/cuelang.org/go/cue/ast/astutil/file.go create mode 100644 vendor/cuelang.org/go/cue/ast/astutil/resolve.go create mode 100644 vendor/cuelang.org/go/cue/ast/astutil/sanitize.go create mode 100644 vendor/cuelang.org/go/cue/ast/astutil/util.go create mode 100644 vendor/cuelang.org/go/cue/ast/astutil/walk.go create mode 100644 vendor/cuelang.org/go/cue/ast/comments.go create mode 100644 vendor/cuelang.org/go/cue/ast/ident.go create mode 100644 vendor/cuelang.org/go/cue/ast/walk.go create mode 100644 vendor/cuelang.org/go/cue/attribute.go create mode 100644 vendor/cuelang.org/go/cue/build.go create mode 100644 vendor/cuelang.org/go/cue/build/context.go create mode 100644 vendor/cuelang.org/go/cue/build/doc.go create mode 100644 vendor/cuelang.org/go/cue/build/file.go create mode 100644 vendor/cuelang.org/go/cue/build/import.go create mode 100644 vendor/cuelang.org/go/cue/build/instance.go create mode 100644 vendor/cuelang.org/go/cue/builtin.go create mode 100644 vendor/cuelang.org/go/cue/builtinutil.go create mode 100644 vendor/cuelang.org/go/cue/context.go create mode 100644 vendor/cuelang.org/go/cue/cue.go create mode 100644 vendor/cuelang.org/go/cue/cuecontext/cuecontext.go create mode 100644 vendor/cuelang.org/go/cue/decode.go create mode 100644 vendor/cuelang.org/go/cue/errors.go create mode 100644 vendor/cuelang.org/go/cue/errors/errors.go create mode 100644 vendor/cuelang.org/go/cue/format.go create mode 100644 vendor/cuelang.org/go/cue/format/format.go create mode 100644 vendor/cuelang.org/go/cue/format/import.go create mode 100644 vendor/cuelang.org/go/cue/format/node.go create mode 100644 vendor/cuelang.org/go/cue/format/printer.go create mode 100644 vendor/cuelang.org/go/cue/format/simplify.go create mode 100644 vendor/cuelang.org/go/cue/instance.go create mode 100644 vendor/cuelang.org/go/cue/literal/doc.go create mode 100644 vendor/cuelang.org/go/cue/literal/indent.go create mode 100644 vendor/cuelang.org/go/cue/literal/num.go create mode 100644 vendor/cuelang.org/go/cue/literal/quote.go create mode 100644 vendor/cuelang.org/go/cue/literal/string.go create mode 100644 vendor/cuelang.org/go/cue/marshal.go create mode 100644 vendor/cuelang.org/go/cue/op.go create mode 100644 vendor/cuelang.org/go/cue/parser/doc.go create mode 100644 vendor/cuelang.org/go/cue/parser/fuzz.go create mode 100644 vendor/cuelang.org/go/cue/parser/interface.go create mode 100644 vendor/cuelang.org/go/cue/parser/parser.go create mode 100644 vendor/cuelang.org/go/cue/path.go create mode 100644 vendor/cuelang.org/go/cue/query.go create mode 100644 vendor/cuelang.org/go/cue/scanner/fuzz.go create mode 100644 vendor/cuelang.org/go/cue/scanner/scanner.go create mode 100644 vendor/cuelang.org/go/cue/token/position.go create mode 100644 vendor/cuelang.org/go/cue/token/token.go create mode 100644 vendor/cuelang.org/go/cue/types.go create mode 100644 vendor/cuelang.org/go/encoding/json/json.go create mode 100644 vendor/cuelang.org/go/internal/astinternal/debugstr.go create mode 100644 vendor/cuelang.org/go/internal/attrs.go create mode 100644 vendor/cuelang.org/go/internal/cli/cli.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/adt.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/binop.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/closed.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/closed2.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/composite.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/comprehension.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/context.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/decimal.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/default.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/disjunct.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/doc.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/equality.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/errors.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/eval.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/expr.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/feature.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/kind.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/op.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/optional.go create mode 100644 vendor/cuelang.org/go/internal/core/adt/simplify.go create mode 100644 vendor/cuelang.org/go/internal/core/compile/builtin.go create mode 100644 vendor/cuelang.org/go/internal/core/compile/compile.go create mode 100644 vendor/cuelang.org/go/internal/core/compile/errors.go create mode 100644 vendor/cuelang.org/go/internal/core/compile/label.go create mode 100644 vendor/cuelang.org/go/internal/core/compile/predeclared.go create mode 100644 vendor/cuelang.org/go/internal/core/convert/go.go create mode 100644 vendor/cuelang.org/go/internal/core/debug/compact.go create mode 100644 vendor/cuelang.org/go/internal/core/debug/debug.go create mode 100644 vendor/cuelang.org/go/internal/core/eval/eval.go create mode 100644 vendor/cuelang.org/go/internal/core/export/adt.go create mode 100644 vendor/cuelang.org/go/internal/core/export/bounds.go create mode 100644 vendor/cuelang.org/go/internal/core/export/export.go create mode 100644 vendor/cuelang.org/go/internal/core/export/expr.go create mode 100644 vendor/cuelang.org/go/internal/core/export/extract.go create mode 100644 vendor/cuelang.org/go/internal/core/export/label.go create mode 100644 vendor/cuelang.org/go/internal/core/export/toposort.go create mode 100644 vendor/cuelang.org/go/internal/core/export/value.go create mode 100644 vendor/cuelang.org/go/internal/core/runtime/build.go create mode 100644 vendor/cuelang.org/go/internal/core/runtime/errors.go create mode 100644 vendor/cuelang.org/go/internal/core/runtime/go.go create mode 100644 vendor/cuelang.org/go/internal/core/runtime/imports.go create mode 100644 vendor/cuelang.org/go/internal/core/runtime/index.go create mode 100644 vendor/cuelang.org/go/internal/core/runtime/resolve.go create mode 100644 vendor/cuelang.org/go/internal/core/runtime/runtime.go create mode 100644 vendor/cuelang.org/go/internal/core/subsume/structural.go create mode 100644 vendor/cuelang.org/go/internal/core/subsume/subsume.go create mode 100644 vendor/cuelang.org/go/internal/core/subsume/value.go create mode 100644 vendor/cuelang.org/go/internal/core/subsume/vertex.go create mode 100644 vendor/cuelang.org/go/internal/core/validate/validate.go create mode 100644 vendor/cuelang.org/go/internal/core/walk/walk.go create mode 100644 vendor/cuelang.org/go/internal/encoding/yaml/encode.go create mode 100644 vendor/cuelang.org/go/internal/internal.go create mode 100644 vendor/cuelang.org/go/internal/source/source.go create mode 100644 vendor/cuelang.org/go/internal/task/task.go create mode 100644 vendor/cuelang.org/go/internal/third_party/yaml/LICENSE create mode 100644 vendor/cuelang.org/go/internal/third_party/yaml/LICENSE.libyaml create mode 100644 vendor/cuelang.org/go/internal/third_party/yaml/METADATA create mode 100644 vendor/cuelang.org/go/internal/third_party/yaml/NOTICE create mode 100644 vendor/cuelang.org/go/internal/third_party/yaml/README.md create mode 100644 vendor/cuelang.org/go/internal/third_party/yaml/apic.go create mode 100644 vendor/cuelang.org/go/internal/third_party/yaml/decode.go create mode 100644 vendor/cuelang.org/go/internal/third_party/yaml/parserc.go create mode 100644 vendor/cuelang.org/go/internal/third_party/yaml/readerc.go create mode 100644 vendor/cuelang.org/go/internal/third_party/yaml/resolve.go create mode 100644 vendor/cuelang.org/go/internal/third_party/yaml/scannerc.go create mode 100644 vendor/cuelang.org/go/internal/third_party/yaml/yaml.go create mode 100644 vendor/cuelang.org/go/internal/third_party/yaml/yamlh.go create mode 100644 vendor/cuelang.org/go/internal/third_party/yaml/yamlprivateh.go create mode 100644 vendor/cuelang.org/go/internal/types/value.go create mode 100644 vendor/cuelang.org/go/internal/value/value.go create mode 100644 vendor/cuelang.org/go/pkg/crypto/ed25519/ed25519.go create mode 100644 vendor/cuelang.org/go/pkg/crypto/ed25519/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/crypto/hmac/hmac.go create mode 100644 vendor/cuelang.org/go/pkg/crypto/hmac/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/crypto/md5/md5.go create mode 100644 vendor/cuelang.org/go/pkg/crypto/md5/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/crypto/sha1/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/crypto/sha1/sha1.go create mode 100644 vendor/cuelang.org/go/pkg/crypto/sha256/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/crypto/sha256/sha256.go create mode 100644 vendor/cuelang.org/go/pkg/crypto/sha512/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/crypto/sha512/sha512.go create mode 100644 vendor/cuelang.org/go/pkg/doc.go create mode 100644 vendor/cuelang.org/go/pkg/encoding/base64/manual.go create mode 100644 vendor/cuelang.org/go/pkg/encoding/base64/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/encoding/csv/manual.go create mode 100644 vendor/cuelang.org/go/pkg/encoding/csv/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/encoding/hex/hex.go create mode 100644 vendor/cuelang.org/go/pkg/encoding/hex/manual.go create mode 100644 vendor/cuelang.org/go/pkg/encoding/hex/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/encoding/json/json.go create mode 100644 vendor/cuelang.org/go/pkg/encoding/json/manual.go create mode 100644 vendor/cuelang.org/go/pkg/encoding/json/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/encoding/yaml/manual.go create mode 100644 vendor/cuelang.org/go/pkg/encoding/yaml/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/html/html.go create mode 100644 vendor/cuelang.org/go/pkg/html/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/internal/builtin.go create mode 100644 vendor/cuelang.org/go/pkg/internal/context.go create mode 100644 vendor/cuelang.org/go/pkg/internal/errors.go create mode 100644 vendor/cuelang.org/go/pkg/internal/register.go create mode 100644 vendor/cuelang.org/go/pkg/list/list.go create mode 100644 vendor/cuelang.org/go/pkg/list/math.go create mode 100644 vendor/cuelang.org/go/pkg/list/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/list/sort.cue create mode 100644 vendor/cuelang.org/go/pkg/list/sort.go create mode 100644 vendor/cuelang.org/go/pkg/math/big.go create mode 100644 vendor/cuelang.org/go/pkg/math/bits/manual.go create mode 100644 vendor/cuelang.org/go/pkg/math/bits/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/math/manual.go create mode 100644 vendor/cuelang.org/go/pkg/math/math.go create mode 100644 vendor/cuelang.org/go/pkg/math/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/net/doc.go create mode 100644 vendor/cuelang.org/go/pkg/net/host.go create mode 100644 vendor/cuelang.org/go/pkg/net/ip.go create mode 100644 vendor/cuelang.org/go/pkg/net/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/path/match.go create mode 100644 vendor/cuelang.org/go/pkg/path/os.go create mode 100644 vendor/cuelang.org/go/pkg/path/path.go create mode 100644 vendor/cuelang.org/go/pkg/path/path_nix.go create mode 100644 vendor/cuelang.org/go/pkg/path/path_p9.go create mode 100644 vendor/cuelang.org/go/pkg/path/path_win.go create mode 100644 vendor/cuelang.org/go/pkg/path/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/regexp/manual.go create mode 100644 vendor/cuelang.org/go/pkg/regexp/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/regexp/regexp.go create mode 100644 vendor/cuelang.org/go/pkg/register.go create mode 100644 vendor/cuelang.org/go/pkg/strconv/manual.go create mode 100644 vendor/cuelang.org/go/pkg/strconv/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/strconv/strconv.go create mode 100644 vendor/cuelang.org/go/pkg/strings/manual.go create mode 100644 vendor/cuelang.org/go/pkg/strings/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/strings/strings.go create mode 100644 vendor/cuelang.org/go/pkg/struct/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/struct/struct.go create mode 100644 vendor/cuelang.org/go/pkg/text/tabwriter/manual.go create mode 100644 vendor/cuelang.org/go/pkg/text/tabwriter/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/text/template/manual.go create mode 100644 vendor/cuelang.org/go/pkg/text/template/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/text/template/template.go create mode 100644 vendor/cuelang.org/go/pkg/time/duration.go create mode 100644 vendor/cuelang.org/go/pkg/time/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/time/time.go create mode 100644 vendor/cuelang.org/go/pkg/tool/cli/cli.cue create mode 100644 vendor/cuelang.org/go/pkg/tool/cli/cli.go create mode 100644 vendor/cuelang.org/go/pkg/tool/cli/doc.go create mode 100644 vendor/cuelang.org/go/pkg/tool/cli/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/tool/doc.go create mode 100644 vendor/cuelang.org/go/pkg/tool/exec/doc.go create mode 100644 vendor/cuelang.org/go/pkg/tool/exec/exec.cue create mode 100644 vendor/cuelang.org/go/pkg/tool/exec/exec.go create mode 100644 vendor/cuelang.org/go/pkg/tool/exec/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/tool/file/doc.go create mode 100644 vendor/cuelang.org/go/pkg/tool/file/file.cue create mode 100644 vendor/cuelang.org/go/pkg/tool/file/file.go create mode 100644 vendor/cuelang.org/go/pkg/tool/file/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/tool/generate.go create mode 100644 vendor/cuelang.org/go/pkg/tool/http/doc.go create mode 100644 vendor/cuelang.org/go/pkg/tool/http/http.cue create mode 100644 vendor/cuelang.org/go/pkg/tool/http/http.go create mode 100644 vendor/cuelang.org/go/pkg/tool/http/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/tool/os/doc.go create mode 100644 vendor/cuelang.org/go/pkg/tool/os/env.go create mode 100644 vendor/cuelang.org/go/pkg/tool/os/os.cue create mode 100644 vendor/cuelang.org/go/pkg/tool/os/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/tool/tool.cue create mode 100644 vendor/cuelang.org/go/pkg/uuid/pkg.go create mode 100644 vendor/cuelang.org/go/pkg/uuid/uuid.cue create mode 100644 vendor/cuelang.org/go/pkg/uuid/uuid.go create mode 100644 vendor/github.com/AliyunContainerService/ack-ram-tool/pkg/credentials/alibabacloudsdkgo/helper/LICENSE create mode 100644 vendor/github.com/AliyunContainerService/ack-ram-tool/pkg/credentials/alibabacloudsdkgo/helper/helper.go create mode 100644 vendor/github.com/OneOfOne/xxhash/.gitignore create mode 100644 vendor/github.com/OneOfOne/xxhash/.travis.yml create mode 100644 vendor/github.com/OneOfOne/xxhash/LICENSE create mode 100644 vendor/github.com/OneOfOne/xxhash/README.md create mode 100644 vendor/github.com/OneOfOne/xxhash/xxhash.go create mode 100644 vendor/github.com/OneOfOne/xxhash/xxhash_go17.go create mode 100644 vendor/github.com/OneOfOne/xxhash/xxhash_safe.go create mode 100644 vendor/github.com/OneOfOne/xxhash/xxhash_unsafe.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/.gitignore create mode 100644 vendor/github.com/ThalesIgnite/crypto11/.travis.yml create mode 100644 vendor/github.com/ThalesIgnite/crypto11/LICENCE.txt create mode 100644 vendor/github.com/ThalesIgnite/crypto11/README.md create mode 100644 vendor/github.com/ThalesIgnite/crypto11/aead.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/attributes.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/block.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/blockmode.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/certificates.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/common.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/config create mode 100644 vendor/github.com/ThalesIgnite/crypto11/crypto11.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/dsa.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/ecdsa.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/hmac.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/keys.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/rand.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/rsa.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/sessions.go create mode 100644 vendor/github.com/ThalesIgnite/crypto11/symmetric.go create mode 100644 vendor/github.com/agnivade/levenshtein/.gitignore create mode 100644 vendor/github.com/agnivade/levenshtein/.travis.yml create mode 100644 vendor/github.com/agnivade/levenshtein/License.txt create mode 100644 vendor/github.com/agnivade/levenshtein/Makefile create mode 100644 vendor/github.com/agnivade/levenshtein/README.md create mode 100644 vendor/github.com/agnivade/levenshtein/levenshtein.go create mode 100644 vendor/github.com/alibabacloud-go/alibabacloud-gateway-spi/LICENSE create mode 100644 vendor/github.com/alibabacloud-go/alibabacloud-gateway-spi/client/client.go create mode 100644 vendor/github.com/alibabacloud-go/cr-20160607/client/client.go create mode 100644 vendor/github.com/alibabacloud-go/cr-20181201/LICENSE create mode 100644 vendor/github.com/alibabacloud-go/cr-20181201/client/client.go create mode 100644 vendor/github.com/alibabacloud-go/darabonba-openapi/LICENSE create mode 100644 vendor/github.com/alibabacloud-go/darabonba-openapi/client/client.go create mode 100644 vendor/github.com/alibabacloud-go/debug/LICENSE create mode 100644 vendor/github.com/alibabacloud-go/debug/debug/assert.go create mode 100644 vendor/github.com/alibabacloud-go/debug/debug/debug.go create mode 100644 vendor/github.com/alibabacloud-go/endpoint-util/LICENSE create mode 100644 vendor/github.com/alibabacloud-go/endpoint-util/service/service.go create mode 100644 vendor/github.com/alibabacloud-go/openapi-util/LICENSE create mode 100644 vendor/github.com/alibabacloud-go/openapi-util/service/service.go create mode 100644 vendor/github.com/alibabacloud-go/tea-utils/LICENSE create mode 100644 vendor/github.com/alibabacloud-go/tea-utils/service/service.go create mode 100644 vendor/github.com/alibabacloud-go/tea-utils/service/util.go create mode 100644 vendor/github.com/alibabacloud-go/tea-xml/service/service.go create mode 100644 vendor/github.com/alibabacloud-go/tea/LICENSE create mode 100644 vendor/github.com/alibabacloud-go/tea/tea/json_parser.go create mode 100644 vendor/github.com/alibabacloud-go/tea/tea/tea.go create mode 100644 vendor/github.com/alibabacloud-go/tea/tea/trans.go create mode 100644 vendor/github.com/alibabacloud-go/tea/utils/assert.go create mode 100644 vendor/github.com/alibabacloud-go/tea/utils/logger.go create mode 100644 vendor/github.com/alibabacloud-go/tea/utils/progress.go create mode 100644 vendor/github.com/aliyun/credentials-go/LICENSE create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/access_key_credential.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/bearer_token_credential.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/credential.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/credential_updater.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/ecs_ram_role.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/env_provider.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/instance_provider.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/oidc_credential.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/oidc_token create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/profile_provider.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/provider.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/provider_chain.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/request/common_request.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/response/common_response.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/rsa_key_pair_credential.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/session_credential.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/sts_credential.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/sts_role_arn_credential.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/uri_credential.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/utils/runtime.go create mode 100644 vendor/github.com/aliyun/credentials-go/credentials/utils/utils.go create mode 100644 vendor/github.com/aws/aws-sdk-go-v2/aws/arn/arn.go create mode 100644 vendor/github.com/beorn7/perks/LICENSE create mode 100644 vendor/github.com/beorn7/perks/quantile/exampledata.txt create mode 100644 vendor/github.com/beorn7/perks/quantile/stream.go create mode 100644 vendor/github.com/blang/semver/.travis.yml create mode 100644 vendor/github.com/blang/semver/LICENSE create mode 100644 vendor/github.com/blang/semver/README.md create mode 100644 vendor/github.com/blang/semver/json.go create mode 100644 vendor/github.com/blang/semver/package.json create mode 100644 vendor/github.com/blang/semver/range.go create mode 100644 vendor/github.com/blang/semver/semver.go create mode 100644 vendor/github.com/blang/semver/sort.go create mode 100644 vendor/github.com/blang/semver/sql.go create mode 100644 vendor/github.com/blendle/zapdriver/.gitignore create mode 100644 vendor/github.com/blendle/zapdriver/LICENSE create mode 100644 vendor/github.com/blendle/zapdriver/README.md create mode 100644 vendor/github.com/blendle/zapdriver/config.go create mode 100644 vendor/github.com/blendle/zapdriver/core.go create mode 100644 vendor/github.com/blendle/zapdriver/encoder.go create mode 100644 vendor/github.com/blendle/zapdriver/http.go create mode 100644 vendor/github.com/blendle/zapdriver/label.go create mode 100644 vendor/github.com/blendle/zapdriver/logger.go create mode 100644 vendor/github.com/blendle/zapdriver/operation.go create mode 100644 vendor/github.com/blendle/zapdriver/report.go create mode 100644 vendor/github.com/blendle/zapdriver/service.go create mode 100644 vendor/github.com/blendle/zapdriver/source.go create mode 100644 vendor/github.com/blendle/zapdriver/trace.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/AUTHORS create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/LICENSE create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1/common.pb.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1/metrics_service.pb.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1/metrics_service.pb.gw.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.gw.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1/metrics.pb.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1/resource.pb.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace.pb.go create mode 100644 vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace_config.pb.go create mode 100644 vendor/github.com/cespare/xxhash/v2/LICENSE.txt create mode 100644 vendor/github.com/cespare/xxhash/v2/README.md create mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash.go create mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_amd64.go create mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_amd64.s create mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_other.go create mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_safe.go create mode 100644 vendor/github.com/cespare/xxhash/v2/xxhash_unsafe.go create mode 100644 vendor/github.com/clbanning/mxj/v2/.travis.yml create mode 100644 vendor/github.com/clbanning/mxj/v2/LICENSE create mode 100644 vendor/github.com/clbanning/mxj/v2/anyxml.go create mode 100644 vendor/github.com/clbanning/mxj/v2/atomFeedString.xml create mode 100644 vendor/github.com/clbanning/mxj/v2/doc.go create mode 100644 vendor/github.com/clbanning/mxj/v2/escapechars.go create mode 100644 vendor/github.com/clbanning/mxj/v2/exists.go create mode 100644 vendor/github.com/clbanning/mxj/v2/files.go create mode 100644 vendor/github.com/clbanning/mxj/v2/files_test.badjson create mode 100644 vendor/github.com/clbanning/mxj/v2/files_test.badxml create mode 100644 vendor/github.com/clbanning/mxj/v2/files_test.json create mode 100644 vendor/github.com/clbanning/mxj/v2/files_test.xml create mode 100644 vendor/github.com/clbanning/mxj/v2/files_test_dup.json create mode 100644 vendor/github.com/clbanning/mxj/v2/files_test_dup.xml create mode 100644 vendor/github.com/clbanning/mxj/v2/files_test_indent.json create mode 100644 vendor/github.com/clbanning/mxj/v2/files_test_indent.xml create mode 100644 vendor/github.com/clbanning/mxj/v2/gob.go create mode 100644 vendor/github.com/clbanning/mxj/v2/json.go create mode 100644 vendor/github.com/clbanning/mxj/v2/keyvalues.go create mode 100644 vendor/github.com/clbanning/mxj/v2/leafnode.go create mode 100644 vendor/github.com/clbanning/mxj/v2/misc.go create mode 100644 vendor/github.com/clbanning/mxj/v2/mxj.go create mode 100644 vendor/github.com/clbanning/mxj/v2/newmap.go create mode 100644 vendor/github.com/clbanning/mxj/v2/readme.md create mode 100644 vendor/github.com/clbanning/mxj/v2/remove.go create mode 100644 vendor/github.com/clbanning/mxj/v2/rename.go create mode 100644 vendor/github.com/clbanning/mxj/v2/set.go create mode 100644 vendor/github.com/clbanning/mxj/v2/setfieldsep.go create mode 100644 vendor/github.com/clbanning/mxj/v2/songtext.xml create mode 100644 vendor/github.com/clbanning/mxj/v2/strict.go create mode 100644 vendor/github.com/clbanning/mxj/v2/struct.go create mode 100644 vendor/github.com/clbanning/mxj/v2/updatevalues.go create mode 100644 vendor/github.com/clbanning/mxj/v2/xml.go create mode 100644 vendor/github.com/clbanning/mxj/v2/xmlseq.go create mode 100644 vendor/github.com/clbanning/mxj/v2/xmlseq2.go create mode 100644 vendor/github.com/cockroachdb/apd/v2/.travis.yml create mode 100644 vendor/github.com/cockroachdb/apd/v2/LICENSE create mode 100644 vendor/github.com/cockroachdb/apd/v2/README.md create mode 100644 vendor/github.com/cockroachdb/apd/v2/condition.go create mode 100644 vendor/github.com/cockroachdb/apd/v2/const.go create mode 100644 vendor/github.com/cockroachdb/apd/v2/context.go create mode 100644 vendor/github.com/cockroachdb/apd/v2/decimal.go create mode 100644 vendor/github.com/cockroachdb/apd/v2/doc.go create mode 100644 vendor/github.com/cockroachdb/apd/v2/error.go create mode 100644 vendor/github.com/cockroachdb/apd/v2/form_string.go create mode 100644 vendor/github.com/cockroachdb/apd/v2/format.go create mode 100644 vendor/github.com/cockroachdb/apd/v2/loop.go create mode 100644 vendor/github.com/cockroachdb/apd/v2/round.go create mode 100644 vendor/github.com/cockroachdb/apd/v2/table.go create mode 100644 vendor/github.com/common-nighthawk/go-figure/.travis.yml create mode 100644 vendor/github.com/common-nighthawk/go-figure/LICENSE create mode 100644 vendor/github.com/common-nighthawk/go-figure/README.md create mode 100644 vendor/github.com/common-nighthawk/go-figure/bindata.go create mode 100644 vendor/github.com/common-nighthawk/go-figure/figlet-parser.go create mode 100644 vendor/github.com/common-nighthawk/go-figure/figure.go create mode 100644 vendor/github.com/common-nighthawk/go-figure/font.go create mode 100644 vendor/github.com/common-nighthawk/go-figure/public_methods.go create mode 100644 vendor/github.com/cyberphone/json-canonicalization/LICENSE create mode 100644 vendor/github.com/cyberphone/json-canonicalization/go/src/webpki.org/jsoncanonicalizer/es6numfmt.go create mode 100644 vendor/github.com/cyberphone/json-canonicalization/go/src/webpki.org/jsoncanonicalizer/jsoncanonicalizer.go create mode 100644 vendor/github.com/davecgh/go-spew/LICENSE create mode 100644 vendor/github.com/davecgh/go-spew/spew/bypass.go create mode 100644 vendor/github.com/davecgh/go-spew/spew/bypasssafe.go create mode 100644 vendor/github.com/davecgh/go-spew/spew/common.go create mode 100644 vendor/github.com/davecgh/go-spew/spew/config.go create mode 100644 vendor/github.com/davecgh/go-spew/spew/doc.go create mode 100644 vendor/github.com/davecgh/go-spew/spew/dump.go create mode 100644 vendor/github.com/davecgh/go-spew/spew/format.go create mode 100644 vendor/github.com/davecgh/go-spew/spew/spew.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/.gitignore create mode 100644 vendor/github.com/emicklei/go-restful/v3/.goconvey create mode 100644 vendor/github.com/emicklei/go-restful/v3/.travis.yml create mode 100644 vendor/github.com/emicklei/go-restful/v3/CHANGES.md create mode 100644 vendor/github.com/emicklei/go-restful/v3/LICENSE create mode 100644 vendor/github.com/emicklei/go-restful/v3/Makefile create mode 100644 vendor/github.com/emicklei/go-restful/v3/README.md create mode 100644 vendor/github.com/emicklei/go-restful/v3/SECURITY.md create mode 100644 vendor/github.com/emicklei/go-restful/v3/Srcfile create mode 100644 vendor/github.com/emicklei/go-restful/v3/bench_test.sh create mode 100644 vendor/github.com/emicklei/go-restful/v3/compress.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/compressor_cache.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/compressor_pools.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/compressors.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/constants.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/container.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/cors_filter.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/coverage.sh create mode 100644 vendor/github.com/emicklei/go-restful/v3/curly.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/curly_route.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/custom_verb.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/doc.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/entity_accessors.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/extensions.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/filter.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/filter_adapter.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/json.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/jsoniter.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/jsr311.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/log/log.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/logger.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/mime.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/options_filter.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/parameter.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/path_expression.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/path_processor.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/request.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/response.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/route.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/route_builder.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/route_reader.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/router.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/service_error.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/web_service.go create mode 100644 vendor/github.com/emicklei/go-restful/v3/web_service_container.go create mode 100644 vendor/github.com/ghodss/yaml/.gitignore create mode 100644 vendor/github.com/ghodss/yaml/.travis.yml create mode 100644 vendor/github.com/ghodss/yaml/LICENSE create mode 100644 vendor/github.com/ghodss/yaml/README.md create mode 100644 vendor/github.com/ghodss/yaml/fields.go create mode 100644 vendor/github.com/ghodss/yaml/yaml.go create mode 100644 vendor/github.com/go-chi/chi/.gitignore create mode 100644 vendor/github.com/go-chi/chi/.travis.yml create mode 100644 vendor/github.com/go-chi/chi/CHANGELOG.md create mode 100644 vendor/github.com/go-chi/chi/CONTRIBUTING.md create mode 100644 vendor/github.com/go-chi/chi/LICENSE create mode 100644 vendor/github.com/go-chi/chi/README.md create mode 100644 vendor/github.com/go-chi/chi/chain.go create mode 100644 vendor/github.com/go-chi/chi/chi.go create mode 100644 vendor/github.com/go-chi/chi/context.go create mode 100644 vendor/github.com/go-chi/chi/middleware/basic_auth.go create mode 100644 vendor/github.com/go-chi/chi/middleware/compress.go create mode 100644 vendor/github.com/go-chi/chi/middleware/content_charset.go create mode 100644 vendor/github.com/go-chi/chi/middleware/content_encoding.go create mode 100644 vendor/github.com/go-chi/chi/middleware/content_type.go create mode 100644 vendor/github.com/go-chi/chi/middleware/get_head.go create mode 100644 vendor/github.com/go-chi/chi/middleware/heartbeat.go create mode 100644 vendor/github.com/go-chi/chi/middleware/logger.go create mode 100644 vendor/github.com/go-chi/chi/middleware/middleware.go create mode 100644 vendor/github.com/go-chi/chi/middleware/nocache.go create mode 100644 vendor/github.com/go-chi/chi/middleware/profiler.go create mode 100644 vendor/github.com/go-chi/chi/middleware/realip.go create mode 100644 vendor/github.com/go-chi/chi/middleware/recoverer.go create mode 100644 vendor/github.com/go-chi/chi/middleware/request_id.go create mode 100644 vendor/github.com/go-chi/chi/middleware/route_headers.go create mode 100644 vendor/github.com/go-chi/chi/middleware/strip.go create mode 100644 vendor/github.com/go-chi/chi/middleware/terminal.go create mode 100644 vendor/github.com/go-chi/chi/middleware/throttle.go create mode 100644 vendor/github.com/go-chi/chi/middleware/timeout.go create mode 100644 vendor/github.com/go-chi/chi/middleware/url_format.go create mode 100644 vendor/github.com/go-chi/chi/middleware/value.go create mode 100644 vendor/github.com/go-chi/chi/middleware/wrap_writer.go create mode 100644 vendor/github.com/go-chi/chi/mux.go create mode 100644 vendor/github.com/go-chi/chi/tree.go create mode 100644 vendor/github.com/go-kit/log/.gitignore create mode 100644 vendor/github.com/go-kit/log/LICENSE create mode 100644 vendor/github.com/go-kit/log/README.md create mode 100644 vendor/github.com/go-kit/log/doc.go create mode 100644 vendor/github.com/go-kit/log/json_logger.go create mode 100644 vendor/github.com/go-kit/log/level/doc.go create mode 100644 vendor/github.com/go-kit/log/level/level.go create mode 100644 vendor/github.com/go-kit/log/log.go create mode 100644 vendor/github.com/go-kit/log/logfmt_logger.go create mode 100644 vendor/github.com/go-kit/log/nop_logger.go create mode 100644 vendor/github.com/go-kit/log/staticcheck.conf create mode 100644 vendor/github.com/go-kit/log/stdlib.go create mode 100644 vendor/github.com/go-kit/log/sync.go create mode 100644 vendor/github.com/go-kit/log/value.go create mode 100644 vendor/github.com/go-logfmt/logfmt/.gitignore create mode 100644 vendor/github.com/go-logfmt/logfmt/CHANGELOG.md create mode 100644 vendor/github.com/go-logfmt/logfmt/LICENSE create mode 100644 vendor/github.com/go-logfmt/logfmt/README.md create mode 100644 vendor/github.com/go-logfmt/logfmt/decode.go create mode 100644 vendor/github.com/go-logfmt/logfmt/doc.go create mode 100644 vendor/github.com/go-logfmt/logfmt/encode.go create mode 100644 vendor/github.com/go-logfmt/logfmt/jsonstring.go create mode 100644 vendor/github.com/go-openapi/runtime/client/auth_info.go create mode 100644 vendor/github.com/go-openapi/runtime/client/keepalive.go create mode 100644 vendor/github.com/go-openapi/runtime/client/opentracing.go create mode 100644 vendor/github.com/go-openapi/runtime/client/request.go create mode 100644 vendor/github.com/go-openapi/runtime/client/response.go create mode 100644 vendor/github.com/go-openapi/runtime/client/runtime.go create mode 100644 vendor/github.com/go-openapi/runtime/logger/logger.go create mode 100644 vendor/github.com/go-openapi/runtime/logger/standard.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/context.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/denco/LICENSE create mode 100644 vendor/github.com/go-openapi/runtime/middleware/denco/README.md create mode 100644 vendor/github.com/go-openapi/runtime/middleware/denco/router.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/denco/server.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/denco/util.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/doc.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/go18.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/header/header.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/negotiate.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/not_implemented.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/operation.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/parameter.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/pre_go18.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/rapidoc.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/redoc.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/request.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/router.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/security.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/spec.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/swaggerui.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/untyped/api.go create mode 100644 vendor/github.com/go-openapi/runtime/middleware/validation.go create mode 100644 vendor/github.com/go-openapi/runtime/security/authenticator.go create mode 100644 vendor/github.com/go-openapi/runtime/security/authorizer.go create mode 100644 vendor/github.com/go-openapi/runtime/yamlpc/yaml.go create mode 100644 vendor/github.com/go-playground/locales/.gitignore create mode 100644 vendor/github.com/go-playground/locales/.travis.yml create mode 100644 vendor/github.com/go-playground/locales/LICENSE create mode 100644 vendor/github.com/go-playground/locales/README.md create mode 100644 vendor/github.com/go-playground/locales/currency/currency.go create mode 100644 vendor/github.com/go-playground/locales/logo.png create mode 100644 vendor/github.com/go-playground/locales/rules.go create mode 100644 vendor/github.com/go-playground/universal-translator/.gitignore create mode 100644 vendor/github.com/go-playground/universal-translator/.travis.yml create mode 100644 vendor/github.com/go-playground/universal-translator/LICENSE create mode 100644 vendor/github.com/go-playground/universal-translator/Makefile create mode 100644 vendor/github.com/go-playground/universal-translator/README.md create mode 100644 vendor/github.com/go-playground/universal-translator/errors.go create mode 100644 vendor/github.com/go-playground/universal-translator/import_export.go create mode 100644 vendor/github.com/go-playground/universal-translator/logo.png create mode 100644 vendor/github.com/go-playground/universal-translator/translator.go create mode 100644 vendor/github.com/go-playground/universal-translator/universal_translator.go create mode 100644 vendor/github.com/go-playground/validator/v10/.gitignore create mode 100644 vendor/github.com/go-playground/validator/v10/LICENSE create mode 100644 vendor/github.com/go-playground/validator/v10/MAINTAINERS.md create mode 100644 vendor/github.com/go-playground/validator/v10/Makefile create mode 100644 vendor/github.com/go-playground/validator/v10/README.md create mode 100644 vendor/github.com/go-playground/validator/v10/baked_in.go create mode 100644 vendor/github.com/go-playground/validator/v10/cache.go create mode 100644 vendor/github.com/go-playground/validator/v10/country_codes.go create mode 100644 vendor/github.com/go-playground/validator/v10/currency_codes.go create mode 100644 vendor/github.com/go-playground/validator/v10/doc.go create mode 100644 vendor/github.com/go-playground/validator/v10/errors.go create mode 100644 vendor/github.com/go-playground/validator/v10/field_level.go create mode 100644 vendor/github.com/go-playground/validator/v10/logo.png create mode 100644 vendor/github.com/go-playground/validator/v10/postcode_regexes.go create mode 100644 vendor/github.com/go-playground/validator/v10/regexes.go create mode 100644 vendor/github.com/go-playground/validator/v10/struct_level.go create mode 100644 vendor/github.com/go-playground/validator/v10/translations.go create mode 100644 vendor/github.com/go-playground/validator/v10/util.go create mode 100644 vendor/github.com/go-playground/validator/v10/validator.go create mode 100644 vendor/github.com/go-playground/validator/v10/validator_instance.go create mode 100644 vendor/github.com/gobwas/glob/.gitignore create mode 100644 vendor/github.com/gobwas/glob/.travis.yml create mode 100644 vendor/github.com/gobwas/glob/LICENSE create mode 100644 vendor/github.com/gobwas/glob/bench.sh create mode 100644 vendor/github.com/gobwas/glob/compiler/compiler.go create mode 100644 vendor/github.com/gobwas/glob/glob.go create mode 100644 vendor/github.com/gobwas/glob/match/any.go create mode 100644 vendor/github.com/gobwas/glob/match/any_of.go create mode 100644 vendor/github.com/gobwas/glob/match/btree.go create mode 100644 vendor/github.com/gobwas/glob/match/contains.go create mode 100644 vendor/github.com/gobwas/glob/match/every_of.go create mode 100644 vendor/github.com/gobwas/glob/match/list.go create mode 100644 vendor/github.com/gobwas/glob/match/match.go create mode 100644 vendor/github.com/gobwas/glob/match/max.go create mode 100644 vendor/github.com/gobwas/glob/match/min.go create mode 100644 vendor/github.com/gobwas/glob/match/nothing.go create mode 100644 vendor/github.com/gobwas/glob/match/prefix.go create mode 100644 vendor/github.com/gobwas/glob/match/prefix_any.go create mode 100644 vendor/github.com/gobwas/glob/match/prefix_suffix.go create mode 100644 vendor/github.com/gobwas/glob/match/range.go create mode 100644 vendor/github.com/gobwas/glob/match/row.go create mode 100644 vendor/github.com/gobwas/glob/match/segments.go create mode 100644 vendor/github.com/gobwas/glob/match/single.go create mode 100644 vendor/github.com/gobwas/glob/match/suffix.go create mode 100644 vendor/github.com/gobwas/glob/match/suffix_any.go create mode 100644 vendor/github.com/gobwas/glob/match/super.go create mode 100644 vendor/github.com/gobwas/glob/match/text.go create mode 100644 vendor/github.com/gobwas/glob/readme.md create mode 100644 vendor/github.com/gobwas/glob/syntax/ast/ast.go create mode 100644 vendor/github.com/gobwas/glob/syntax/ast/parser.go create mode 100644 vendor/github.com/gobwas/glob/syntax/lexer/lexer.go create mode 100644 vendor/github.com/gobwas/glob/syntax/lexer/token.go create mode 100644 vendor/github.com/gobwas/glob/syntax/syntax.go create mode 100644 vendor/github.com/gobwas/glob/util/runes/runes.go create mode 100644 vendor/github.com/gobwas/glob/util/strings/strings.go create mode 100644 vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go create mode 100644 vendor/github.com/golang/groupcache/LICENSE create mode 100644 vendor/github.com/golang/groupcache/lru/lru.go create mode 100644 vendor/github.com/golang/snappy/.gitignore create mode 100644 vendor/github.com/golang/snappy/AUTHORS create mode 100644 vendor/github.com/golang/snappy/CONTRIBUTORS create mode 100644 vendor/github.com/golang/snappy/LICENSE create mode 100644 vendor/github.com/golang/snappy/README create mode 100644 vendor/github.com/golang/snappy/decode.go create mode 100644 vendor/github.com/golang/snappy/decode_amd64.s create mode 100644 vendor/github.com/golang/snappy/decode_arm64.s create mode 100644 vendor/github.com/golang/snappy/decode_asm.go create mode 100644 vendor/github.com/golang/snappy/decode_other.go create mode 100644 vendor/github.com/golang/snappy/encode.go create mode 100644 vendor/github.com/golang/snappy/encode_amd64.s create mode 100644 vendor/github.com/golang/snappy/encode_arm64.s create mode 100644 vendor/github.com/golang/snappy/encode_asm.go create mode 100644 vendor/github.com/golang/snappy/encode_other.go create mode 100644 vendor/github.com/golang/snappy/snappy.go create mode 100644 vendor/github.com/google/certificate-transparency-go/.gitignore create mode 100644 vendor/github.com/google/certificate-transparency-go/.golangci.yaml create mode 100644 vendor/github.com/google/certificate-transparency-go/AUTHORS create mode 100644 vendor/github.com/google/certificate-transparency-go/CHANGELOG.md create mode 100644 vendor/github.com/google/certificate-transparency-go/CODEOWNERS create mode 100644 vendor/github.com/google/certificate-transparency-go/CONTRIBUTING.md create mode 100644 vendor/github.com/google/certificate-transparency-go/CONTRIBUTORS create mode 100644 vendor/github.com/google/certificate-transparency-go/LICENSE create mode 100644 vendor/github.com/google/certificate-transparency-go/PULL_REQUEST_TEMPLATE.md create mode 100644 vendor/github.com/google/certificate-transparency-go/README.md create mode 100644 vendor/github.com/google/certificate-transparency-go/asn1/README.md create mode 100644 vendor/github.com/google/certificate-transparency-go/asn1/asn1.go create mode 100644 vendor/github.com/google/certificate-transparency-go/asn1/common.go create mode 100644 vendor/github.com/google/certificate-transparency-go/asn1/marshal.go create mode 100644 vendor/github.com/google/certificate-transparency-go/cloudbuild.yaml create mode 100644 vendor/github.com/google/certificate-transparency-go/cloudbuild_master.yaml create mode 100644 vendor/github.com/google/certificate-transparency-go/cloudbuild_tag.yaml create mode 100644 vendor/github.com/google/certificate-transparency-go/codecov.yml create mode 100644 vendor/github.com/google/certificate-transparency-go/gossip/minimal/x509ext/x509ext.go create mode 100644 vendor/github.com/google/certificate-transparency-go/proto_gen.go create mode 100644 vendor/github.com/google/certificate-transparency-go/serialization.go create mode 100644 vendor/github.com/google/certificate-transparency-go/signatures.go create mode 100644 vendor/github.com/google/certificate-transparency-go/tls/signature.go create mode 100644 vendor/github.com/google/certificate-transparency-go/tls/tls.go create mode 100644 vendor/github.com/google/certificate-transparency-go/tls/types.go create mode 100644 vendor/github.com/google/certificate-transparency-go/types.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/README.md create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/cert_pool.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/curves.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/error.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/errors.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/names.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/pem_decrypt.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/pkcs1.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/pkcs8.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/pkix/pkix.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/ptr_sysptr_windows.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/ptr_uint_windows.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/revoked.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/root.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/root_bsd.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/root_cgo_darwin.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/root_darwin.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/root_darwin_armx.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/root_js.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/root_linux.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/root_nocgo_darwin.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/root_plan9.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/root_solaris.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/root_unix.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/root_windows.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/rpki.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/sec1.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/test-dir.crt create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/test-file.crt create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/verify.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509/x509.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509util/files.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509util/fuzz.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509util/pem_cert_pool.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509util/revoked.go create mode 100644 vendor/github.com/google/certificate-transparency-go/x509util/x509util.go create mode 100644 vendor/github.com/google/gnostic/LICENSE create mode 100644 vendor/github.com/google/gnostic/compiler/README.md create mode 100644 vendor/github.com/google/gnostic/compiler/context.go create mode 100644 vendor/github.com/google/gnostic/compiler/error.go create mode 100644 vendor/github.com/google/gnostic/compiler/extensions.go create mode 100644 vendor/github.com/google/gnostic/compiler/helpers.go create mode 100644 vendor/github.com/google/gnostic/compiler/main.go create mode 100644 vendor/github.com/google/gnostic/compiler/reader.go create mode 100644 vendor/github.com/google/gnostic/extensions/README.md create mode 100644 vendor/github.com/google/gnostic/extensions/extension.pb.go create mode 100644 vendor/github.com/google/gnostic/extensions/extension.proto create mode 100644 vendor/github.com/google/gnostic/extensions/extensions.go create mode 100644 vendor/github.com/google/gnostic/jsonschema/README.md create mode 100644 vendor/github.com/google/gnostic/jsonschema/base.go create mode 100644 vendor/github.com/google/gnostic/jsonschema/display.go create mode 100644 vendor/github.com/google/gnostic/jsonschema/models.go create mode 100644 vendor/github.com/google/gnostic/jsonschema/operations.go create mode 100644 vendor/github.com/google/gnostic/jsonschema/reader.go create mode 100644 vendor/github.com/google/gnostic/jsonschema/schema.json create mode 100644 vendor/github.com/google/gnostic/jsonschema/writer.go create mode 100644 vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.go create mode 100644 vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.pb.go create mode 100644 vendor/github.com/google/gnostic/openapiv2/OpenAPIv2.proto create mode 100644 vendor/github.com/google/gnostic/openapiv2/README.md create mode 100644 vendor/github.com/google/gnostic/openapiv2/document.go create mode 100644 vendor/github.com/google/gnostic/openapiv2/openapi-2.0.json create mode 100644 vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.go create mode 100644 vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.pb.go create mode 100644 vendor/github.com/google/gnostic/openapiv3/OpenAPIv3.proto create mode 100644 vendor/github.com/google/gnostic/openapiv3/README.md create mode 100644 vendor/github.com/google/gnostic/openapiv3/annotations.pb.go create mode 100644 vendor/github.com/google/gnostic/openapiv3/annotations.proto create mode 100644 vendor/github.com/google/gnostic/openapiv3/document.go create mode 100644 vendor/github.com/google/gnostic/openapiv3/openapi-3.0.json create mode 100644 vendor/github.com/google/gnostic/openapiv3/openapi-3.1.json create mode 100644 vendor/github.com/google/go-containerregistry/pkg/authn/k8schain/LICENSE create mode 100644 vendor/github.com/google/go-containerregistry/pkg/authn/k8schain/README.md create mode 100644 vendor/github.com/google/go-containerregistry/pkg/authn/k8schain/doc.go create mode 100644 vendor/github.com/google/go-containerregistry/pkg/authn/k8schain/k8schain.go create mode 100644 vendor/github.com/google/go-containerregistry/pkg/authn/kubernetes/LICENSE create mode 100644 vendor/github.com/google/go-containerregistry/pkg/authn/kubernetes/keychain.go create mode 100644 vendor/github.com/google/go-github/v45/AUTHORS create mode 100644 vendor/github.com/google/go-github/v45/LICENSE create mode 100644 vendor/github.com/google/go-github/v45/github/actions.go create mode 100644 vendor/github.com/google/go-github/v45/github/actions_artifacts.go create mode 100644 vendor/github.com/google/go-github/v45/github/actions_runner_groups.go create mode 100644 vendor/github.com/google/go-github/v45/github/actions_runners.go create mode 100644 vendor/github.com/google/go-github/v45/github/actions_secrets.go create mode 100644 vendor/github.com/google/go-github/v45/github/actions_workflow_jobs.go create mode 100644 vendor/github.com/google/go-github/v45/github/actions_workflow_runs.go create mode 100644 vendor/github.com/google/go-github/v45/github/actions_workflows.go create mode 100644 vendor/github.com/google/go-github/v45/github/activity.go create mode 100644 vendor/github.com/google/go-github/v45/github/activity_events.go create mode 100644 vendor/github.com/google/go-github/v45/github/activity_notifications.go create mode 100644 vendor/github.com/google/go-github/v45/github/activity_star.go create mode 100644 vendor/github.com/google/go-github/v45/github/activity_watching.go create mode 100644 vendor/github.com/google/go-github/v45/github/admin.go create mode 100644 vendor/github.com/google/go-github/v45/github/admin_orgs.go create mode 100644 vendor/github.com/google/go-github/v45/github/admin_stats.go create mode 100644 vendor/github.com/google/go-github/v45/github/admin_users.go create mode 100644 vendor/github.com/google/go-github/v45/github/apps.go create mode 100644 vendor/github.com/google/go-github/v45/github/apps_hooks.go create mode 100644 vendor/github.com/google/go-github/v45/github/apps_hooks_deliveries.go create mode 100644 vendor/github.com/google/go-github/v45/github/apps_installation.go create mode 100644 vendor/github.com/google/go-github/v45/github/apps_manifest.go create mode 100644 vendor/github.com/google/go-github/v45/github/apps_marketplace.go create mode 100644 vendor/github.com/google/go-github/v45/github/authorizations.go create mode 100644 vendor/github.com/google/go-github/v45/github/billing.go create mode 100644 vendor/github.com/google/go-github/v45/github/checks.go create mode 100644 vendor/github.com/google/go-github/v45/github/code-scanning.go create mode 100644 vendor/github.com/google/go-github/v45/github/dependabot.go create mode 100644 vendor/github.com/google/go-github/v45/github/dependabot_secrets.go create mode 100644 vendor/github.com/google/go-github/v45/github/doc.go create mode 100644 vendor/github.com/google/go-github/v45/github/enterprise.go create mode 100644 vendor/github.com/google/go-github/v45/github/enterprise_actions_runners.go create mode 100644 vendor/github.com/google/go-github/v45/github/enterprise_audit_log.go create mode 100644 vendor/github.com/google/go-github/v45/github/event.go create mode 100644 vendor/github.com/google/go-github/v45/github/event_types.go create mode 100644 vendor/github.com/google/go-github/v45/github/gists.go create mode 100644 vendor/github.com/google/go-github/v45/github/gists_comments.go create mode 100644 vendor/github.com/google/go-github/v45/github/git.go create mode 100644 vendor/github.com/google/go-github/v45/github/git_blobs.go create mode 100644 vendor/github.com/google/go-github/v45/github/git_commits.go create mode 100644 vendor/github.com/google/go-github/v45/github/git_refs.go create mode 100644 vendor/github.com/google/go-github/v45/github/git_tags.go create mode 100644 vendor/github.com/google/go-github/v45/github/git_trees.go create mode 100644 vendor/github.com/google/go-github/v45/github/github-accessors.go create mode 100644 vendor/github.com/google/go-github/v45/github/github.go create mode 100644 vendor/github.com/google/go-github/v45/github/gitignore.go create mode 100644 vendor/github.com/google/go-github/v45/github/interactions.go create mode 100644 vendor/github.com/google/go-github/v45/github/interactions_orgs.go create mode 100644 vendor/github.com/google/go-github/v45/github/interactions_repos.go create mode 100644 vendor/github.com/google/go-github/v45/github/issue_import.go create mode 100644 vendor/github.com/google/go-github/v45/github/issues.go create mode 100644 vendor/github.com/google/go-github/v45/github/issues_assignees.go create mode 100644 vendor/github.com/google/go-github/v45/github/issues_comments.go create mode 100644 vendor/github.com/google/go-github/v45/github/issues_events.go create mode 100644 vendor/github.com/google/go-github/v45/github/issues_labels.go create mode 100644 vendor/github.com/google/go-github/v45/github/issues_milestones.go create mode 100644 vendor/github.com/google/go-github/v45/github/issues_timeline.go create mode 100644 vendor/github.com/google/go-github/v45/github/licenses.go create mode 100644 vendor/github.com/google/go-github/v45/github/messages.go create mode 100644 vendor/github.com/google/go-github/v45/github/migrations.go create mode 100644 vendor/github.com/google/go-github/v45/github/migrations_source_import.go create mode 100644 vendor/github.com/google/go-github/v45/github/migrations_user.go create mode 100644 vendor/github.com/google/go-github/v45/github/misc.go create mode 100644 vendor/github.com/google/go-github/v45/github/orgs.go create mode 100644 vendor/github.com/google/go-github/v45/github/orgs_actions_allowed.go create mode 100644 vendor/github.com/google/go-github/v45/github/orgs_actions_permissions.go create mode 100644 vendor/github.com/google/go-github/v45/github/orgs_audit_log.go create mode 100644 vendor/github.com/google/go-github/v45/github/orgs_custom_roles.go create mode 100644 vendor/github.com/google/go-github/v45/github/orgs_hooks.go create mode 100644 vendor/github.com/google/go-github/v45/github/orgs_hooks_deliveries.go create mode 100644 vendor/github.com/google/go-github/v45/github/orgs_members.go create mode 100644 vendor/github.com/google/go-github/v45/github/orgs_outside_collaborators.go create mode 100644 vendor/github.com/google/go-github/v45/github/orgs_packages.go create mode 100644 vendor/github.com/google/go-github/v45/github/orgs_projects.go create mode 100644 vendor/github.com/google/go-github/v45/github/orgs_users_blocking.go create mode 100644 vendor/github.com/google/go-github/v45/github/packages.go create mode 100644 vendor/github.com/google/go-github/v45/github/projects.go create mode 100644 vendor/github.com/google/go-github/v45/github/pulls.go create mode 100644 vendor/github.com/google/go-github/v45/github/pulls_comments.go create mode 100644 vendor/github.com/google/go-github/v45/github/pulls_reviewers.go create mode 100644 vendor/github.com/google/go-github/v45/github/pulls_reviews.go create mode 100644 vendor/github.com/google/go-github/v45/github/pulls_threads.go create mode 100644 vendor/github.com/google/go-github/v45/github/reactions.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_actions_allowed.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_actions_permissions.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_autolinks.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_collaborators.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_comments.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_commits.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_community_health.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_contents.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_deployments.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_environments.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_forks.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_hooks.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_hooks_deliveries.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_invitations.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_keys.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_merging.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_pages.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_prereceive_hooks.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_projects.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_releases.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_stats.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_statuses.go create mode 100644 vendor/github.com/google/go-github/v45/github/repos_traffic.go create mode 100644 vendor/github.com/google/go-github/v45/github/scim.go create mode 100644 vendor/github.com/google/go-github/v45/github/search.go create mode 100644 vendor/github.com/google/go-github/v45/github/secret_scanning.go create mode 100644 vendor/github.com/google/go-github/v45/github/strings.go create mode 100644 vendor/github.com/google/go-github/v45/github/teams.go create mode 100644 vendor/github.com/google/go-github/v45/github/teams_discussion_comments.go create mode 100644 vendor/github.com/google/go-github/v45/github/teams_discussions.go create mode 100644 vendor/github.com/google/go-github/v45/github/teams_members.go create mode 100644 vendor/github.com/google/go-github/v45/github/timestamp.go create mode 100644 vendor/github.com/google/go-github/v45/github/users.go create mode 100644 vendor/github.com/google/go-github/v45/github/users_administration.go create mode 100644 vendor/github.com/google/go-github/v45/github/users_blocking.go create mode 100644 vendor/github.com/google/go-github/v45/github/users_emails.go create mode 100644 vendor/github.com/google/go-github/v45/github/users_followers.go create mode 100644 vendor/github.com/google/go-github/v45/github/users_gpg_keys.go create mode 100644 vendor/github.com/google/go-github/v45/github/users_keys.go create mode 100644 vendor/github.com/google/go-github/v45/github/users_packages.go create mode 100644 vendor/github.com/google/go-github/v45/github/users_projects.go create mode 100644 vendor/github.com/google/go-github/v45/github/with_appengine.go create mode 100644 vendor/github.com/google/go-github/v45/github/without_appengine.go create mode 100644 vendor/github.com/google/go-querystring/LICENSE create mode 100644 vendor/github.com/google/go-querystring/query/encode.go create mode 100644 vendor/github.com/google/gofuzz/.travis.yml create mode 100644 vendor/github.com/google/gofuzz/CONTRIBUTING.md create mode 100644 vendor/github.com/google/gofuzz/LICENSE create mode 100644 vendor/github.com/google/gofuzz/README.md create mode 100644 vendor/github.com/google/gofuzz/bytesource/bytesource.go create mode 100644 vendor/github.com/google/gofuzz/doc.go create mode 100644 vendor/github.com/google/gofuzz/fuzz.go create mode 100644 vendor/github.com/google/trillian/.gitignore create mode 100644 vendor/github.com/google/trillian/.golangci.yaml create mode 100644 vendor/github.com/google/trillian/AUTHORS create mode 100644 vendor/github.com/google/trillian/BUILD.bazel create mode 100644 vendor/github.com/google/trillian/CHANGELOG.md create mode 100644 vendor/github.com/google/trillian/CODEOWNERS create mode 100644 vendor/github.com/google/trillian/CONTRIBUTING.md create mode 100644 vendor/github.com/google/trillian/CONTRIBUTORS create mode 100644 vendor/github.com/google/trillian/LICENSE create mode 100644 vendor/github.com/google/trillian/PULL_REQUEST_TEMPLATE.md create mode 100644 vendor/github.com/google/trillian/README.md create mode 100644 vendor/github.com/google/trillian/cloudbuild.yaml create mode 100644 vendor/github.com/google/trillian/cloudbuild_master.yaml create mode 100644 vendor/github.com/google/trillian/cloudbuild_pr.yaml create mode 100644 vendor/github.com/google/trillian/cloudbuild_tag.yaml create mode 100644 vendor/github.com/google/trillian/codecov.yml create mode 100644 vendor/github.com/google/trillian/gen.go create mode 100644 vendor/github.com/google/trillian/trillian.pb.go create mode 100644 vendor/github.com/google/trillian/trillian.proto create mode 100644 vendor/github.com/google/trillian/trillian_admin_api.pb.go create mode 100644 vendor/github.com/google/trillian/trillian_admin_api.proto create mode 100644 vendor/github.com/google/trillian/trillian_admin_api_grpc.pb.go create mode 100644 vendor/github.com/google/trillian/trillian_log_api.pb.go create mode 100644 vendor/github.com/google/trillian/trillian_log_api.proto create mode 100644 vendor/github.com/google/trillian/trillian_log_api_grpc.pb.go create mode 100644 vendor/github.com/google/trillian/types/internal/tls/tls.go create mode 100644 vendor/github.com/google/trillian/types/logroot.go create mode 100644 vendor/github.com/google/uuid/.travis.yml create mode 100644 vendor/github.com/google/uuid/CONTRIBUTING.md create mode 100644 vendor/github.com/google/uuid/CONTRIBUTORS create mode 100644 vendor/github.com/google/uuid/LICENSE create mode 100644 vendor/github.com/google/uuid/README.md create mode 100644 vendor/github.com/google/uuid/dce.go create mode 100644 vendor/github.com/google/uuid/doc.go create mode 100644 vendor/github.com/google/uuid/hash.go create mode 100644 vendor/github.com/google/uuid/marshal.go create mode 100644 vendor/github.com/google/uuid/node.go create mode 100644 vendor/github.com/google/uuid/node_js.go create mode 100644 vendor/github.com/google/uuid/node_net.go create mode 100644 vendor/github.com/google/uuid/null.go create mode 100644 vendor/github.com/google/uuid/sql.go create mode 100644 vendor/github.com/google/uuid/time.go create mode 100644 vendor/github.com/google/uuid/util.go create mode 100644 vendor/github.com/google/uuid/uuid.go create mode 100644 vendor/github.com/google/uuid/version1.go create mode 100644 vendor/github.com/google/uuid/version4.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/LICENSE.txt create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/BUILD.bazel create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/compile.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/fuzz.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/parse.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/internal/httprule/types.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/BUILD.bazel create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/context.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/convert.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/doc.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/errors.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/fieldmask.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/handler.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_httpbodyproto.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_json.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_jsonpb.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshal_proto.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshaler.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/marshaler_registry.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/mux.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/pattern.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/proto2_convert.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/runtime/query.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/BUILD.bazel create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/doc.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/pattern.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/readerfactory.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/string_array_flag.go create mode 100644 vendor/github.com/grpc-ecosystem/grpc-gateway/v2/utilities/trie.go create mode 100644 vendor/github.com/hashicorp/go-cleanhttp/LICENSE create mode 100644 vendor/github.com/hashicorp/go-cleanhttp/README.md create mode 100644 vendor/github.com/hashicorp/go-cleanhttp/cleanhttp.go create mode 100644 vendor/github.com/hashicorp/go-cleanhttp/doc.go create mode 100644 vendor/github.com/hashicorp/go-cleanhttp/handlers.go create mode 100644 vendor/github.com/hashicorp/go-retryablehttp/.gitignore create mode 100644 vendor/github.com/hashicorp/go-retryablehttp/LICENSE create mode 100644 vendor/github.com/hashicorp/go-retryablehttp/Makefile create mode 100644 vendor/github.com/hashicorp/go-retryablehttp/README.md create mode 100644 vendor/github.com/hashicorp/go-retryablehttp/client.go create mode 100644 vendor/github.com/hashicorp/go-retryablehttp/roundtripper.go create mode 100644 vendor/github.com/hashicorp/golang-lru/.gitignore create mode 100644 vendor/github.com/hashicorp/golang-lru/2q.go create mode 100644 vendor/github.com/hashicorp/golang-lru/LICENSE create mode 100644 vendor/github.com/hashicorp/golang-lru/README.md create mode 100644 vendor/github.com/hashicorp/golang-lru/arc.go create mode 100644 vendor/github.com/hashicorp/golang-lru/doc.go create mode 100644 vendor/github.com/hashicorp/golang-lru/lru.go create mode 100644 vendor/github.com/hashicorp/golang-lru/simplelru/lru.go create mode 100644 vendor/github.com/hashicorp/golang-lru/simplelru/lru_interface.go create mode 100644 vendor/github.com/imdario/mergo/.deepsource.toml create mode 100644 vendor/github.com/imdario/mergo/.gitignore create mode 100644 vendor/github.com/imdario/mergo/.travis.yml create mode 100644 vendor/github.com/imdario/mergo/CODE_OF_CONDUCT.md create mode 100644 vendor/github.com/imdario/mergo/LICENSE create mode 100644 vendor/github.com/imdario/mergo/README.md create mode 100644 vendor/github.com/imdario/mergo/doc.go create mode 100644 vendor/github.com/imdario/mergo/map.go create mode 100644 vendor/github.com/imdario/mergo/merge.go create mode 100644 vendor/github.com/imdario/mergo/mergo.go create mode 100644 vendor/github.com/in-toto/in-toto-golang/LICENSE create mode 100644 vendor/github.com/in-toto/in-toto-golang/in_toto/certconstraint.go create mode 100644 vendor/github.com/in-toto/in-toto-golang/in_toto/hashlib.go create mode 100644 vendor/github.com/in-toto/in-toto-golang/in_toto/keylib.go create mode 100644 vendor/github.com/in-toto/in-toto-golang/in_toto/match.go create mode 100644 vendor/github.com/in-toto/in-toto-golang/in_toto/model.go create mode 100644 vendor/github.com/in-toto/in-toto-golang/in_toto/rulelib.go create mode 100644 vendor/github.com/in-toto/in-toto-golang/in_toto/runlib.go create mode 100644 vendor/github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/common/common.go create mode 100644 vendor/github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/v0.1/provenance.go create mode 100644 vendor/github.com/in-toto/in-toto-golang/in_toto/slsa_provenance/v0.2/provenance.go create mode 100644 vendor/github.com/in-toto/in-toto-golang/in_toto/util.go create mode 100644 vendor/github.com/in-toto/in-toto-golang/in_toto/util_unix.go create mode 100644 vendor/github.com/in-toto/in-toto-golang/in_toto/util_windows.go create mode 100644 vendor/github.com/in-toto/in-toto-golang/in_toto/verifylib.go create mode 100644 vendor/github.com/jedisct1/go-minisign/.gitignore create mode 100644 vendor/github.com/jedisct1/go-minisign/LICENSE create mode 100644 vendor/github.com/jedisct1/go-minisign/README.md create mode 100644 vendor/github.com/jedisct1/go-minisign/minisign.go create mode 100644 vendor/github.com/json-iterator/go/.codecov.yml create mode 100644 vendor/github.com/json-iterator/go/.gitignore create mode 100644 vendor/github.com/json-iterator/go/.travis.yml create mode 100644 vendor/github.com/json-iterator/go/Gopkg.lock create mode 100644 vendor/github.com/json-iterator/go/Gopkg.toml create mode 100644 vendor/github.com/json-iterator/go/LICENSE create mode 100644 vendor/github.com/json-iterator/go/README.md create mode 100644 vendor/github.com/json-iterator/go/adapter.go create mode 100644 vendor/github.com/json-iterator/go/any.go create mode 100644 vendor/github.com/json-iterator/go/any_array.go create mode 100644 vendor/github.com/json-iterator/go/any_bool.go create mode 100644 vendor/github.com/json-iterator/go/any_float.go create mode 100644 vendor/github.com/json-iterator/go/any_int32.go create mode 100644 vendor/github.com/json-iterator/go/any_int64.go create mode 100644 vendor/github.com/json-iterator/go/any_invalid.go create mode 100644 vendor/github.com/json-iterator/go/any_nil.go create mode 100644 vendor/github.com/json-iterator/go/any_number.go create mode 100644 vendor/github.com/json-iterator/go/any_object.go create mode 100644 vendor/github.com/json-iterator/go/any_str.go create mode 100644 vendor/github.com/json-iterator/go/any_uint32.go create mode 100644 vendor/github.com/json-iterator/go/any_uint64.go create mode 100644 vendor/github.com/json-iterator/go/build.sh create mode 100644 vendor/github.com/json-iterator/go/config.go create mode 100644 vendor/github.com/json-iterator/go/fuzzy_mode_convert_table.md create mode 100644 vendor/github.com/json-iterator/go/iter.go create mode 100644 vendor/github.com/json-iterator/go/iter_array.go create mode 100644 vendor/github.com/json-iterator/go/iter_float.go create mode 100644 vendor/github.com/json-iterator/go/iter_int.go create mode 100644 vendor/github.com/json-iterator/go/iter_object.go create mode 100644 vendor/github.com/json-iterator/go/iter_skip.go create mode 100644 vendor/github.com/json-iterator/go/iter_skip_sloppy.go create mode 100644 vendor/github.com/json-iterator/go/iter_skip_strict.go create mode 100644 vendor/github.com/json-iterator/go/iter_str.go create mode 100644 vendor/github.com/json-iterator/go/jsoniter.go create mode 100644 vendor/github.com/json-iterator/go/pool.go create mode 100644 vendor/github.com/json-iterator/go/reflect.go create mode 100644 vendor/github.com/json-iterator/go/reflect_array.go create mode 100644 vendor/github.com/json-iterator/go/reflect_dynamic.go create mode 100644 vendor/github.com/json-iterator/go/reflect_extension.go create mode 100644 vendor/github.com/json-iterator/go/reflect_json_number.go create mode 100644 vendor/github.com/json-iterator/go/reflect_json_raw_message.go create mode 100644 vendor/github.com/json-iterator/go/reflect_map.go create mode 100644 vendor/github.com/json-iterator/go/reflect_marshaler.go create mode 100644 vendor/github.com/json-iterator/go/reflect_native.go create mode 100644 vendor/github.com/json-iterator/go/reflect_optional.go create mode 100644 vendor/github.com/json-iterator/go/reflect_slice.go create mode 100644 vendor/github.com/json-iterator/go/reflect_struct_decoder.go create mode 100644 vendor/github.com/json-iterator/go/reflect_struct_encoder.go create mode 100644 vendor/github.com/json-iterator/go/stream.go create mode 100644 vendor/github.com/json-iterator/go/stream_float.go create mode 100644 vendor/github.com/json-iterator/go/stream_int.go create mode 100644 vendor/github.com/json-iterator/go/stream_str.go create mode 100644 vendor/github.com/json-iterator/go/test.sh create mode 100644 vendor/github.com/kelseyhightower/envconfig/.travis.yml create mode 100644 vendor/github.com/kelseyhightower/envconfig/LICENSE create mode 100644 vendor/github.com/kelseyhightower/envconfig/MAINTAINERS create mode 100644 vendor/github.com/kelseyhightower/envconfig/README.md create mode 100644 vendor/github.com/kelseyhightower/envconfig/doc.go create mode 100644 vendor/github.com/kelseyhightower/envconfig/env_os.go create mode 100644 vendor/github.com/kelseyhightower/envconfig/env_syscall.go create mode 100644 vendor/github.com/kelseyhightower/envconfig/envconfig.go create mode 100644 vendor/github.com/kelseyhightower/envconfig/usage.go create mode 100644 vendor/github.com/leodido/go-urn/.gitignore create mode 100644 vendor/github.com/leodido/go-urn/.travis.yml create mode 100644 vendor/github.com/leodido/go-urn/LICENSE create mode 100644 vendor/github.com/leodido/go-urn/README.md create mode 100644 vendor/github.com/leodido/go-urn/machine.go create mode 100644 vendor/github.com/leodido/go-urn/machine.go.rl create mode 100644 vendor/github.com/leodido/go-urn/makefile create mode 100644 vendor/github.com/leodido/go-urn/urn.go create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/LICENSE create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/NOTICE create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/.gitignore create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/Makefile create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/decode.go create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/doc.go create mode 100644 vendor/github.com/matttproud/golang_protobuf_extensions/pbutil/encode.go create mode 100644 vendor/github.com/miekg/pkcs11/.gitignore create mode 100644 vendor/github.com/miekg/pkcs11/LICENSE create mode 100644 vendor/github.com/miekg/pkcs11/Makefile.release create mode 100644 vendor/github.com/miekg/pkcs11/README.md create mode 100644 vendor/github.com/miekg/pkcs11/error.go create mode 100644 vendor/github.com/miekg/pkcs11/hsm.db create mode 100644 vendor/github.com/miekg/pkcs11/params.go create mode 100644 vendor/github.com/miekg/pkcs11/pkcs11.go create mode 100644 vendor/github.com/miekg/pkcs11/pkcs11.h create mode 100644 vendor/github.com/miekg/pkcs11/pkcs11f.h create mode 100644 vendor/github.com/miekg/pkcs11/pkcs11go.h create mode 100644 vendor/github.com/miekg/pkcs11/pkcs11t.h create mode 100644 vendor/github.com/miekg/pkcs11/release.go create mode 100644 vendor/github.com/miekg/pkcs11/softhsm.conf create mode 100644 vendor/github.com/miekg/pkcs11/softhsm2.conf create mode 100644 vendor/github.com/miekg/pkcs11/types.go create mode 100644 vendor/github.com/miekg/pkcs11/vendor.go create mode 100644 vendor/github.com/miekg/pkcs11/zconst.go create mode 100644 vendor/github.com/modern-go/concurrent/.gitignore create mode 100644 vendor/github.com/modern-go/concurrent/.travis.yml create mode 100644 vendor/github.com/modern-go/concurrent/LICENSE create mode 100644 vendor/github.com/modern-go/concurrent/README.md create mode 100644 vendor/github.com/modern-go/concurrent/executor.go create mode 100644 vendor/github.com/modern-go/concurrent/go_above_19.go create mode 100644 vendor/github.com/modern-go/concurrent/go_below_19.go create mode 100644 vendor/github.com/modern-go/concurrent/log.go create mode 100644 vendor/github.com/modern-go/concurrent/test.sh create mode 100644 vendor/github.com/modern-go/concurrent/unbounded_executor.go create mode 100644 vendor/github.com/modern-go/reflect2/.gitignore create mode 100644 vendor/github.com/modern-go/reflect2/.travis.yml create mode 100644 vendor/github.com/modern-go/reflect2/Gopkg.lock create mode 100644 vendor/github.com/modern-go/reflect2/Gopkg.toml create mode 100644 vendor/github.com/modern-go/reflect2/LICENSE create mode 100644 vendor/github.com/modern-go/reflect2/README.md create mode 100644 vendor/github.com/modern-go/reflect2/go_above_118.go create mode 100644 vendor/github.com/modern-go/reflect2/go_above_19.go create mode 100644 vendor/github.com/modern-go/reflect2/go_below_118.go create mode 100644 vendor/github.com/modern-go/reflect2/reflect2.go create mode 100644 vendor/github.com/modern-go/reflect2/reflect2_amd64.s create mode 100644 vendor/github.com/modern-go/reflect2/reflect2_kind.go create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_386.s create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_amd64p32.s create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_arm.s create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_arm64.s create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_mips64x.s create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_mipsx.s create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_ppc64x.s create mode 100644 vendor/github.com/modern-go/reflect2/relfect2_s390x.s create mode 100644 vendor/github.com/modern-go/reflect2/safe_field.go create mode 100644 vendor/github.com/modern-go/reflect2/safe_map.go create mode 100644 vendor/github.com/modern-go/reflect2/safe_slice.go create mode 100644 vendor/github.com/modern-go/reflect2/safe_struct.go create mode 100644 vendor/github.com/modern-go/reflect2/safe_type.go create mode 100644 vendor/github.com/modern-go/reflect2/type_map.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_array.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_eface.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_field.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_iface.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_link.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_map.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_ptr.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_slice.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_struct.go create mode 100644 vendor/github.com/modern-go/reflect2/unsafe_type.go create mode 100644 vendor/github.com/mozillazg/docker-credential-acr-helper/LICENSE create mode 100644 vendor/github.com/mozillazg/docker-credential-acr-helper/pkg/acr/client.go create mode 100644 vendor/github.com/mozillazg/docker-credential-acr-helper/pkg/acr/ee.go create mode 100644 vendor/github.com/mozillazg/docker-credential-acr-helper/pkg/acr/openapiauth.go create mode 100644 vendor/github.com/mozillazg/docker-credential-acr-helper/pkg/acr/person.go create mode 100644 vendor/github.com/mozillazg/docker-credential-acr-helper/pkg/acr/registry.go create mode 100644 vendor/github.com/mozillazg/docker-credential-acr-helper/pkg/credhelper/helper.go create mode 100644 vendor/github.com/mozillazg/docker-credential-acr-helper/pkg/version/version.go create mode 100644 vendor/github.com/mpvl/unique/.gitignore create mode 100644 vendor/github.com/mpvl/unique/LICENSE create mode 100644 vendor/github.com/mpvl/unique/unique.go create mode 100644 vendor/github.com/munnerz/goautoneg/LICENSE create mode 100644 vendor/github.com/munnerz/goautoneg/Makefile create mode 100644 vendor/github.com/munnerz/goautoneg/README.txt create mode 100644 vendor/github.com/munnerz/goautoneg/autoneg.go create mode 100644 vendor/github.com/open-policy-agent/opa/LICENSE create mode 100644 vendor/github.com/open-policy-agent/opa/ast/annotations.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/builtins.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/capabilities.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/check.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/compare.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/compile.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/compilehelper.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/compilemetrics.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/conflicts.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/doc.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/env.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/errors.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/fuzz.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/index.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/internal/scanner/scanner.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/internal/tokens/tokens.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/location/location.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/map.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/parser.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/parser_ext.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/policy.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/pretty.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/schema.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/strings.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/term.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/transform.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/unify.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/varset.go create mode 100644 vendor/github.com/open-policy-agent/opa/ast/visit.go create mode 100644 vendor/github.com/open-policy-agent/opa/bundle/bundle.go create mode 100644 vendor/github.com/open-policy-agent/opa/bundle/file.go create mode 100644 vendor/github.com/open-policy-agent/opa/bundle/filefs.go create mode 100644 vendor/github.com/open-policy-agent/opa/bundle/hash.go create mode 100644 vendor/github.com/open-policy-agent/opa/bundle/keys.go create mode 100644 vendor/github.com/open-policy-agent/opa/bundle/sign.go create mode 100644 vendor/github.com/open-policy-agent/opa/bundle/store.go create mode 100644 vendor/github.com/open-policy-agent/opa/bundle/verify.go create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/capabilities.go create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.17.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.17.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.17.2.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.17.3.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.18.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.19.0-rc1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.19.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.19.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.19.2.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.20.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.20.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.20.2.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.20.3.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.20.4.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.20.5.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.21.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.21.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.22.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.23.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.23.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.23.2.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.24.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.25.0-rc1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.25.0-rc2.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.25.0-rc3.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.25.0-rc4.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.25.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.25.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.25.2.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.26.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.27.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.27.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.28.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.29.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.29.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.29.2.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.29.3.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.29.4.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.30.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.30.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.30.2.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.31.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.32.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.32.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.33.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.33.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.34.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.34.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.34.2.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.35.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.36.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.36.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.37.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.37.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.37.2.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.38.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.38.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.39.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.40.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.41.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.42.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.42.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.42.2.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.43.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.43.1.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.44.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/capabilities/v0.45.0.json create mode 100644 vendor/github.com/open-policy-agent/opa/format/format.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/bundle/utils.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/cidr/merge/merge.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/compiler/wasm/opa/callgraph.csv create mode 100644 vendor/github.com/open-policy-agent/opa/internal/compiler/wasm/opa/opa.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/compiler/wasm/opa/opa.wasm create mode 100644 vendor/github.com/open-policy-agent/opa/internal/compiler/wasm/optimizations.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/compiler/wasm/wasm.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/debug/debug.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/deepcopy/deepcopy.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/file/archive/tarball.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/file/url/url.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/future/filter_imports.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/future/parser_opts.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/LICENSE-APACHE-2.0.txt create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/README.md create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/draft.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/errors.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/format_checkers.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/internalLog.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/jsonContext.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/jsonLoader.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/locales.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/result.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/schema.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/schemaLoader.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/schemaPool.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/schemaReferencePool.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/schemaType.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/subSchema.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/types.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/utils.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gojsonschema/validation.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/LICENSE create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/argmap.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/collections.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/decode.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/definition.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/directive.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/document.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/dumper.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/fragment.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/operation.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/path.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/selection.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/source.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/type.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/ast/value.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/gqlerror/error.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/lexer/blockstring.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/lexer/lexer.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/lexer/lexer_test.yml create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/lexer/token.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/parser/parser.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/parser/query.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/parser/query_test.yml create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/parser/schema.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/parser/schema_test.yml create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/error.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/messaging.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/prelude.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/prelude.graphql create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/fields_on_correct_type.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/fragments_on_composite_types.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/known_argument_names.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/known_directives.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/known_fragment_names.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/known_root_type.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/known_type_names.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/lone_anonymous_operation.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/no_fragment_cycles.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/no_undefined_variables.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/no_unused_fragments.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/no_unused_variables.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/overlapping_fields_can_be_merged.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/possible_fragment_spreads.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/provided_required_arguments.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/scalar_leafs.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/single_field_subscriptions.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/unique_argument_names.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/unique_directives_per_location.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/unique_fragment_names.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/unique_input_field_names.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/unique_operation_names.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/unique_variable_names.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/values_of_correct_type.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/variables_are_input_types.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/rules/variables_in_allowed_position.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/schema.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/schema_test.yml create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/suggestionList.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/validator.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/vars.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/gqlparser/validator/walk.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/json/patch/patch.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/LICENSE create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/buffer/buffer.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jwa/elliptic.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jwa/key_type.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jwa/parameters.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jwa/signature.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jwk/ecdsa.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jwk/headers.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jwk/interface.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jwk/jwk.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jwk/key_ops.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jwk/rsa.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jwk/symmetric.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jws/headers.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jws/interface.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jws/jws.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jws/message.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jws/sign/ecdsa.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jws/sign/hmac.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jws/sign/interface.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jws/sign/rsa.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jws/sign/sign.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jws/verify/ecdsa.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jws/verify/hmac.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jws/verify/interface.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jws/verify/rsa.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/jwx/jws/verify/verify.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/lcss/README.md create mode 100644 vendor/github.com/open-policy-agent/opa/internal/lcss/lcss.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/lcss/qsufsort.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/leb128/leb128.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/merge/merge.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/planner/planner.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/planner/rules.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/planner/varstack.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/ref/ref.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/rego/opa/engine.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/rego/opa/options.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/semver/LICENSE create mode 100644 vendor/github.com/open-policy-agent/opa/internal/semver/semver.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/strings/strings.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/uuid/uuid.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/version/version.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/constant/constant.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/encoding/doc.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/encoding/reader.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/encoding/writer.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/instruction/control.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/instruction/instruction.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/instruction/memory.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/instruction/numeric.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/instruction/parametric.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/instruction/variable.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/module/module.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/module/pretty.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/opcode/opcode.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/sdk/opa/capabilities/capabilities.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/sdk/opa/capabilities/capabilities_nowasm.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/types/types.go create mode 100644 vendor/github.com/open-policy-agent/opa/internal/wasm/util/util.go create mode 100644 vendor/github.com/open-policy-agent/opa/ir/ir.go create mode 100644 vendor/github.com/open-policy-agent/opa/ir/marshal.go create mode 100644 vendor/github.com/open-policy-agent/opa/ir/pretty.go create mode 100644 vendor/github.com/open-policy-agent/opa/ir/walk.go create mode 100644 vendor/github.com/open-policy-agent/opa/keys/keys.go create mode 100644 vendor/github.com/open-policy-agent/opa/loader/errors.go create mode 100644 vendor/github.com/open-policy-agent/opa/loader/filter/filter.go create mode 100644 vendor/github.com/open-policy-agent/opa/loader/internal/embedtest/bar/bar.rego create mode 100644 vendor/github.com/open-policy-agent/opa/loader/internal/embedtest/bar/bar.yaml create mode 100644 vendor/github.com/open-policy-agent/opa/loader/internal/embedtest/baz/qux/qux.json create mode 100644 vendor/github.com/open-policy-agent/opa/loader/internal/embedtest/foo.json create mode 100644 vendor/github.com/open-policy-agent/opa/loader/loader.go create mode 100644 vendor/github.com/open-policy-agent/opa/metrics/metrics.go create mode 100644 vendor/github.com/open-policy-agent/opa/rego/errors.go create mode 100644 vendor/github.com/open-policy-agent/opa/rego/rego.go create mode 100644 vendor/github.com/open-policy-agent/opa/rego/resultset.go create mode 100644 vendor/github.com/open-policy-agent/opa/resolver/interface.go create mode 100644 vendor/github.com/open-policy-agent/opa/resolver/wasm/wasm.go create mode 100644 vendor/github.com/open-policy-agent/opa/storage/doc.go create mode 100644 vendor/github.com/open-policy-agent/opa/storage/errors.go create mode 100644 vendor/github.com/open-policy-agent/opa/storage/inmem/inmem.go create mode 100644 vendor/github.com/open-policy-agent/opa/storage/inmem/opts.go create mode 100644 vendor/github.com/open-policy-agent/opa/storage/inmem/txn.go create mode 100644 vendor/github.com/open-policy-agent/opa/storage/interface.go create mode 100644 vendor/github.com/open-policy-agent/opa/storage/internal/errors/errors.go create mode 100644 vendor/github.com/open-policy-agent/opa/storage/internal/ptr/ptr.go create mode 100644 vendor/github.com/open-policy-agent/opa/storage/path.go create mode 100644 vendor/github.com/open-policy-agent/opa/storage/storage.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/aggregates.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/arithmetic.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/array.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/binary.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/bindings.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/bits.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/builtins.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/builtins/builtins.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/cache.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/cache/cache.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/cancel.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/casts.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/cidr.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/comparison.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/copypropagation/copypropagation.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/copypropagation/unionfind.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/crypto.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/doc.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/encoding.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/errors.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/eval.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/glob.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/graphql.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/http.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/http_fixup.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/http_fixup_darwin.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/input.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/instrumentation.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/json.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/net.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/numbers.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/object.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/parse.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/parse_bytes.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/parse_units.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/print.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/print/print.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/query.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/reachable.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/regex.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/regex_template.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/resolver.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/runtime.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/save.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/semver.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/sets.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/strings.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/subset.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/time.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/tokens.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/trace.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/type.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/type_name.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/uuid.go create mode 100644 vendor/github.com/open-policy-agent/opa/topdown/walk.go create mode 100644 vendor/github.com/open-policy-agent/opa/tracing/tracing.go create mode 100644 vendor/github.com/open-policy-agent/opa/types/decode.go create mode 100644 vendor/github.com/open-policy-agent/opa/types/types.go create mode 100644 vendor/github.com/open-policy-agent/opa/util/backoff.go create mode 100644 vendor/github.com/open-policy-agent/opa/util/close.go create mode 100644 vendor/github.com/open-policy-agent/opa/util/compare.go create mode 100644 vendor/github.com/open-policy-agent/opa/util/doc.go create mode 100644 vendor/github.com/open-policy-agent/opa/util/enumflag.go create mode 100644 vendor/github.com/open-policy-agent/opa/util/graph.go create mode 100644 vendor/github.com/open-policy-agent/opa/util/hashmap.go create mode 100644 vendor/github.com/open-policy-agent/opa/util/json.go create mode 100644 vendor/github.com/open-policy-agent/opa/util/queue.go create mode 100644 vendor/github.com/open-policy-agent/opa/util/wait.go create mode 100644 vendor/github.com/open-policy-agent/opa/version/version.go create mode 100644 vendor/github.com/open-policy-agent/opa/version/version_go1.18.go create mode 100644 vendor/github.com/open-policy-agent/opa/version/wasm.go create mode 100644 vendor/github.com/opentracing/opentracing-go/.gitignore create mode 100644 vendor/github.com/opentracing/opentracing-go/.travis.yml create mode 100644 vendor/github.com/opentracing/opentracing-go/CHANGELOG.md create mode 100644 vendor/github.com/opentracing/opentracing-go/LICENSE create mode 100644 vendor/github.com/opentracing/opentracing-go/Makefile create mode 100644 vendor/github.com/opentracing/opentracing-go/README.md create mode 100644 vendor/github.com/opentracing/opentracing-go/ext.go create mode 100644 vendor/github.com/opentracing/opentracing-go/ext/field.go create mode 100644 vendor/github.com/opentracing/opentracing-go/ext/tags.go create mode 100644 vendor/github.com/opentracing/opentracing-go/globaltracer.go create mode 100644 vendor/github.com/opentracing/opentracing-go/gocontext.go create mode 100644 vendor/github.com/opentracing/opentracing-go/log/field.go create mode 100644 vendor/github.com/opentracing/opentracing-go/log/util.go create mode 100644 vendor/github.com/opentracing/opentracing-go/noop.go create mode 100644 vendor/github.com/opentracing/opentracing-go/propagation.go create mode 100644 vendor/github.com/opentracing/opentracing-go/span.go create mode 100644 vendor/github.com/opentracing/opentracing-go/tracer.go create mode 100644 vendor/github.com/prometheus/client_golang/LICENSE create mode 100644 vendor/github.com/prometheus/client_golang/NOTICE create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/.gitignore create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/README.md create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/build_info_collector.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/collector.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/counter.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/desc.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/doc.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/expvar_collector.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/fnv.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/gauge.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/get_pid.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/get_pid_gopherjs.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/go_collector.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/go_collector_go116.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/go_collector_latest.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/histogram.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/internal/difflib.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/internal/go_collector_options.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/internal/go_runtime_metrics.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/internal/metric.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/labels.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/metric.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/num_threads.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/num_threads_gopherjs.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/observer.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector_js.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector_other.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/process_collector_windows.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/promhttp/delegator.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/promhttp/http.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_client.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/promhttp/instrument_server.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/promhttp/option.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/registry.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/summary.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/timer.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/untyped.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/value.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/vec.go create mode 100644 vendor/github.com/prometheus/client_golang/prometheus/wrap.go create mode 100644 vendor/github.com/prometheus/client_model/LICENSE create mode 100644 vendor/github.com/prometheus/client_model/NOTICE create mode 100644 vendor/github.com/prometheus/client_model/go/metrics.pb.go create mode 100644 vendor/github.com/prometheus/common/LICENSE create mode 100644 vendor/github.com/prometheus/common/NOTICE create mode 100644 vendor/github.com/prometheus/common/expfmt/decode.go create mode 100644 vendor/github.com/prometheus/common/expfmt/encode.go create mode 100644 vendor/github.com/prometheus/common/expfmt/expfmt.go create mode 100644 vendor/github.com/prometheus/common/expfmt/fuzz.go create mode 100644 vendor/github.com/prometheus/common/expfmt/openmetrics_create.go create mode 100644 vendor/github.com/prometheus/common/expfmt/text_create.go create mode 100644 vendor/github.com/prometheus/common/expfmt/text_parse.go create mode 100644 vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/README.txt create mode 100644 vendor/github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg/autoneg.go create mode 100644 vendor/github.com/prometheus/common/model/alert.go create mode 100644 vendor/github.com/prometheus/common/model/fingerprinting.go create mode 100644 vendor/github.com/prometheus/common/model/fnv.go create mode 100644 vendor/github.com/prometheus/common/model/labels.go create mode 100644 vendor/github.com/prometheus/common/model/labelset.go create mode 100644 vendor/github.com/prometheus/common/model/metric.go create mode 100644 vendor/github.com/prometheus/common/model/model.go create mode 100644 vendor/github.com/prometheus/common/model/signature.go create mode 100644 vendor/github.com/prometheus/common/model/silence.go create mode 100644 vendor/github.com/prometheus/common/model/time.go create mode 100644 vendor/github.com/prometheus/common/model/value.go create mode 100644 vendor/github.com/prometheus/procfs/.gitignore create mode 100644 vendor/github.com/prometheus/procfs/.golangci.yml create mode 100644 vendor/github.com/prometheus/procfs/CODE_OF_CONDUCT.md create mode 100644 vendor/github.com/prometheus/procfs/CONTRIBUTING.md create mode 100644 vendor/github.com/prometheus/procfs/LICENSE create mode 100644 vendor/github.com/prometheus/procfs/MAINTAINERS.md create mode 100644 vendor/github.com/prometheus/procfs/Makefile create mode 100644 vendor/github.com/prometheus/procfs/Makefile.common create mode 100644 vendor/github.com/prometheus/procfs/NOTICE create mode 100644 vendor/github.com/prometheus/procfs/README.md create mode 100644 vendor/github.com/prometheus/procfs/SECURITY.md create mode 100644 vendor/github.com/prometheus/procfs/arp.go create mode 100644 vendor/github.com/prometheus/procfs/buddyinfo.go create mode 100644 vendor/github.com/prometheus/procfs/cmdline.go create mode 100644 vendor/github.com/prometheus/procfs/cpuinfo.go create mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_armx.go create mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_mipsx.go create mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_others.go create mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_ppcx.go create mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go create mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_s390x.go create mode 100644 vendor/github.com/prometheus/procfs/cpuinfo_x86.go create mode 100644 vendor/github.com/prometheus/procfs/crypto.go create mode 100644 vendor/github.com/prometheus/procfs/doc.go create mode 100644 vendor/github.com/prometheus/procfs/fs.go create mode 100644 vendor/github.com/prometheus/procfs/fscache.go create mode 100644 vendor/github.com/prometheus/procfs/internal/fs/fs.go create mode 100644 vendor/github.com/prometheus/procfs/internal/util/parse.go create mode 100644 vendor/github.com/prometheus/procfs/internal/util/readfile.go create mode 100644 vendor/github.com/prometheus/procfs/internal/util/sysreadfile.go create mode 100644 vendor/github.com/prometheus/procfs/internal/util/sysreadfile_compat.go create mode 100644 vendor/github.com/prometheus/procfs/internal/util/valueparser.go create mode 100644 vendor/github.com/prometheus/procfs/ipvs.go create mode 100644 vendor/github.com/prometheus/procfs/kernel_random.go create mode 100644 vendor/github.com/prometheus/procfs/loadavg.go create mode 100644 vendor/github.com/prometheus/procfs/mdstat.go create mode 100644 vendor/github.com/prometheus/procfs/meminfo.go create mode 100644 vendor/github.com/prometheus/procfs/mountinfo.go create mode 100644 vendor/github.com/prometheus/procfs/mountstats.go create mode 100644 vendor/github.com/prometheus/procfs/net_conntrackstat.go create mode 100644 vendor/github.com/prometheus/procfs/net_dev.go create mode 100644 vendor/github.com/prometheus/procfs/net_ip_socket.go create mode 100644 vendor/github.com/prometheus/procfs/net_protocols.go create mode 100644 vendor/github.com/prometheus/procfs/net_sockstat.go create mode 100644 vendor/github.com/prometheus/procfs/net_softnet.go create mode 100644 vendor/github.com/prometheus/procfs/net_tcp.go create mode 100644 vendor/github.com/prometheus/procfs/net_udp.go create mode 100644 vendor/github.com/prometheus/procfs/net_unix.go create mode 100644 vendor/github.com/prometheus/procfs/net_xfrm.go create mode 100644 vendor/github.com/prometheus/procfs/netstat.go create mode 100644 vendor/github.com/prometheus/procfs/proc.go create mode 100644 vendor/github.com/prometheus/procfs/proc_cgroup.go create mode 100644 vendor/github.com/prometheus/procfs/proc_cgroups.go create mode 100644 vendor/github.com/prometheus/procfs/proc_environ.go create mode 100644 vendor/github.com/prometheus/procfs/proc_fdinfo.go create mode 100644 vendor/github.com/prometheus/procfs/proc_io.go create mode 100644 vendor/github.com/prometheus/procfs/proc_limits.go create mode 100644 vendor/github.com/prometheus/procfs/proc_maps.go create mode 100644 vendor/github.com/prometheus/procfs/proc_netstat.go create mode 100644 vendor/github.com/prometheus/procfs/proc_ns.go create mode 100644 vendor/github.com/prometheus/procfs/proc_psi.go create mode 100644 vendor/github.com/prometheus/procfs/proc_smaps.go create mode 100644 vendor/github.com/prometheus/procfs/proc_snmp.go create mode 100644 vendor/github.com/prometheus/procfs/proc_snmp6.go create mode 100644 vendor/github.com/prometheus/procfs/proc_stat.go create mode 100644 vendor/github.com/prometheus/procfs/proc_status.go create mode 100644 vendor/github.com/prometheus/procfs/proc_sys.go create mode 100644 vendor/github.com/prometheus/procfs/schedstat.go create mode 100644 vendor/github.com/prometheus/procfs/slab.go create mode 100644 vendor/github.com/prometheus/procfs/softirqs.go create mode 100644 vendor/github.com/prometheus/procfs/stat.go create mode 100644 vendor/github.com/prometheus/procfs/swaps.go create mode 100644 vendor/github.com/prometheus/procfs/ttar create mode 100644 vendor/github.com/prometheus/procfs/vm.go create mode 100644 vendor/github.com/prometheus/procfs/zoneinfo.go create mode 100644 vendor/github.com/prometheus/statsd_exporter/LICENSE create mode 100644 vendor/github.com/prometheus/statsd_exporter/NOTICE create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/level/level.go create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/action.go create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/escape.go create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/README.md create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/dump.go create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/formatter.go create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/fsm.go create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/fsm.png create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/fsm/minmax.go create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper.go create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper_cache.go create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapper_defaults.go create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/mapping.go create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/match.go create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/metric_type.go create mode 100644 vendor/github.com/prometheus/statsd_exporter/pkg/mapper/observer.go create mode 100644 vendor/github.com/rcrowley/go-metrics/.gitignore create mode 100644 vendor/github.com/rcrowley/go-metrics/.travis.yml create mode 100644 vendor/github.com/rcrowley/go-metrics/LICENSE create mode 100644 vendor/github.com/rcrowley/go-metrics/README.md create mode 100644 vendor/github.com/rcrowley/go-metrics/counter.go create mode 100644 vendor/github.com/rcrowley/go-metrics/debug.go create mode 100644 vendor/github.com/rcrowley/go-metrics/ewma.go create mode 100644 vendor/github.com/rcrowley/go-metrics/gauge.go create mode 100644 vendor/github.com/rcrowley/go-metrics/gauge_float64.go create mode 100644 vendor/github.com/rcrowley/go-metrics/graphite.go create mode 100644 vendor/github.com/rcrowley/go-metrics/healthcheck.go create mode 100644 vendor/github.com/rcrowley/go-metrics/histogram.go create mode 100644 vendor/github.com/rcrowley/go-metrics/json.go create mode 100644 vendor/github.com/rcrowley/go-metrics/log.go create mode 100644 vendor/github.com/rcrowley/go-metrics/memory.md create mode 100644 vendor/github.com/rcrowley/go-metrics/meter.go create mode 100644 vendor/github.com/rcrowley/go-metrics/metrics.go create mode 100644 vendor/github.com/rcrowley/go-metrics/opentsdb.go create mode 100644 vendor/github.com/rcrowley/go-metrics/registry.go create mode 100644 vendor/github.com/rcrowley/go-metrics/runtime.go create mode 100644 vendor/github.com/rcrowley/go-metrics/runtime_cgo.go create mode 100644 vendor/github.com/rcrowley/go-metrics/runtime_gccpufraction.go create mode 100644 vendor/github.com/rcrowley/go-metrics/runtime_no_cgo.go create mode 100644 vendor/github.com/rcrowley/go-metrics/runtime_no_gccpufraction.go create mode 100644 vendor/github.com/rcrowley/go-metrics/sample.go create mode 100644 vendor/github.com/rcrowley/go-metrics/syslog.go create mode 100644 vendor/github.com/rcrowley/go-metrics/timer.go create mode 100644 vendor/github.com/rcrowley/go-metrics/validate.sh create mode 100644 vendor/github.com/rcrowley/go-metrics/writer.go create mode 100644 vendor/github.com/sassoftware/relic/LICENSE create mode 100644 vendor/github.com/sassoftware/relic/lib/pkcs7/attributes.go create mode 100644 vendor/github.com/sassoftware/relic/lib/pkcs7/builder.go create mode 100644 vendor/github.com/sassoftware/relic/lib/pkcs7/content.go create mode 100644 vendor/github.com/sassoftware/relic/lib/pkcs7/marshal.go create mode 100644 vendor/github.com/sassoftware/relic/lib/pkcs7/structs.go create mode 100644 vendor/github.com/sassoftware/relic/lib/pkcs7/verify.go create mode 100644 vendor/github.com/sassoftware/relic/lib/x509tools/certpool.go create mode 100644 vendor/github.com/sassoftware/relic/lib/x509tools/digests.go create mode 100644 vendor/github.com/sassoftware/relic/lib/x509tools/ecdsa_curves.go create mode 100644 vendor/github.com/sassoftware/relic/lib/x509tools/keylogfile.go create mode 100644 vendor/github.com/sassoftware/relic/lib/x509tools/names.go create mode 100644 vendor/github.com/sassoftware/relic/lib/x509tools/pkix.go create mode 100644 vendor/github.com/sassoftware/relic/lib/x509tools/printcert.go create mode 100644 vendor/github.com/sassoftware/relic/lib/x509tools/rsapss.go create mode 100644 vendor/github.com/sassoftware/relic/lib/x509tools/util.go create mode 100644 vendor/github.com/sassoftware/relic/lib/x509tools/x509cmd.go create mode 100644 vendor/github.com/sassoftware/relic/signers/sigerrors/errors.go create mode 100644 vendor/github.com/secure-systems-lab/go-securesystemslib/LICENSE create mode 100644 vendor/github.com/secure-systems-lab/go-securesystemslib/cjson/canonicaljson.go create mode 100644 vendor/github.com/secure-systems-lab/go-securesystemslib/dsse/sign.go create mode 100644 vendor/github.com/secure-systems-lab/go-securesystemslib/dsse/verify.go create mode 100644 vendor/github.com/shibumi/go-pathspec/.gitignore create mode 100644 vendor/github.com/shibumi/go-pathspec/GO-LICENSE create mode 100644 vendor/github.com/shibumi/go-pathspec/LICENSE create mode 100644 vendor/github.com/shibumi/go-pathspec/README.md create mode 100644 vendor/github.com/shibumi/go-pathspec/gitignore.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/fulcio/fulcioverifier/ctl/verify.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/fulcio/fulcioverifier/ctutil/ctutil.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/annotations.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/attach.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/attest.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/attest_blob.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/certificate.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/clean.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/copy.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/download.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/errors.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/experimental.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/files.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/flags.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/fulcio.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/generate.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/generate_key_pair.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/import_key_pair.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/initialize.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/key.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/load.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/oidc.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/options.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/piv_tool.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/pkcs11_tool.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/policy.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/predicate.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/public_key.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/reference.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/registry.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/rekor.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/root.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/save.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/security_key.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/sign.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/signature_digest.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/signblob.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/tree.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/triangulate.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/upload.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/useragent.go create mode 100644 vendor/github.com/sigstore/cosign/cmd/cosign/cli/options/verify.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/blob/load.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/attestation/attestation.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/certextensions.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/common.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/errors.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/fetch.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/git/git.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/git/github/github.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/git/gitlab/gitlab.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/keys.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/kubernetes/client.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/kubernetes/secret.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/pkcs11key/disabled.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/pkcs11key/pkcs11key.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/pkcs11key/util.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/rego/rego.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/rekor_factory.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/remote/index.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/remote/remote.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/tlog.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/verifiers.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/cosign/verify.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/oci/layout/index.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/oci/layout/signatures.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/oci/layout/write.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/policy/attestation.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/policy/eval.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/signature/annotations.go create mode 100644 vendor/github.com/sigstore/cosign/pkg/signature/keys.go create mode 100644 vendor/github.com/sigstore/policy-controller/COPYRIGHT.txt create mode 100644 vendor/github.com/sigstore/policy-controller/LICENSE create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/config/doc.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/config/image_policies.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/config/store.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/duck/v1beta1/doc.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/duck/v1beta1/podscalable_defaults.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/duck/v1beta1/podscalable_types.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/duck/v1beta1/podscalable_validation.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/duck/v1beta1/register.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/duck/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/glob/glob.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/common/validation.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/register.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/v1alpha1/clusterimagepolicy_conversion.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/v1alpha1/clusterimagepolicy_defaults.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/v1alpha1/clusterimagepolicy_types.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/v1alpha1/clusterimagepolicy_validation.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/v1alpha1/doc.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/v1alpha1/register.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/v1alpha1/zz_generated.deepcopy.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/v1beta1/clusterimagepolicy_conversion.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/v1beta1/clusterimagepolicy_defaults.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/v1beta1/clusterimagepolicy_types.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/v1beta1/clusterimagepolicy_validation.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/v1beta1/doc.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/v1beta1/register.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/policy/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/apis/signaturealgo/signature_digest.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/config/store.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/webhook/cache.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/webhook/clusterimagepolicy/clusterimagepolicy_types.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/webhook/nocache.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/webhook/validation.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/webhook/validator.go create mode 100644 vendor/github.com/sigstore/policy-controller/pkg/webhook/validator_result.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/client/options.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/client/rekor_client.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/entries/create_log_entry_parameters.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/entries/create_log_entry_responses.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/entries/entries_client.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_index_parameters.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_index_responses.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_uuid_parameters.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/entries/get_log_entry_by_uuid_responses.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/entries/search_log_query_parameters.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/entries/search_log_query_responses.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/index/index_client.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/index/search_index_parameters.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/index/search_index_responses.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/get_public_key_parameters.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/get_public_key_responses.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/pubkey/pubkey_client.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/rekor_client.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_info_parameters.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_info_responses.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_proof_parameters.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/get_log_proof_responses.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/client/tlog/tlog_client.go delete mode 100644 vendor/github.com/sigstore/rekor/pkg/generated/models/rekor_version.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/log/log.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/pki/factory.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/pki/minisign/minisign.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/pki/pgp/pgp.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/pki/pkcs7/pkcs7.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/pki/pki.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/pki/ssh/README.md create mode 100644 vendor/github.com/sigstore/rekor/pkg/pki/ssh/encode.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/pki/ssh/sign.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/pki/ssh/ssh.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/pki/ssh/verify.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/pki/tuf/tuf.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/pki/x509/x509.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/README.md create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/entries.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/error.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/hashedrekord/hashedrekord.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/hashedrekord/hashedrekord_schema.json create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/hashedrekord/v0.0.1/entry.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/hashedrekord/v0.0.1/hashedrekord_v0_0_1_schema.json create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/intoto/README.md create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/intoto/intoto.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/intoto/intoto_schema.json create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/intoto/v0.0.1/entry.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/intoto/v0.0.1/intoto_v0_0_1_schema.json create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/test_util.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/types.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/types/versionmap.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/util/checkpoint.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/util/fetch.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/util/pubkey.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/util/sha.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/util/signed_note.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/util/timestamp_note.go create mode 100644 vendor/github.com/sigstore/rekor/pkg/util/validate.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/cryptoutils/sans.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/fulcioroots/doc.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/fulcioroots/fulcioroots.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/doc.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/dsse/adapters.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/dsse/doc.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/dsse/dsse.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/dsse/multidsse.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/ecdsa.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/ed25519.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/kms/doc.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/kms/kms.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/message.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/options.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/options/context.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/options/digest.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/options/doc.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/options/keyversion.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/options/noop.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/options/rand.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/options/remoteverification.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/options/rpcauth.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/options/signeropts.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/payload/doc.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/payload/payload.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/publickey.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/rsapkcs1v15.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/rsapss.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/signer.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/signerverifier.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/util.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/signature/verifier.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/tuf/client.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/tuf/policy.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/tuf/repository/root.json create mode 100644 vendor/github.com/sigstore/sigstore/pkg/tuf/repository/targets/artifact.pub create mode 100644 vendor/github.com/sigstore/sigstore/pkg/tuf/repository/targets/ctfe.pub create mode 100644 vendor/github.com/sigstore/sigstore/pkg/tuf/repository/targets/fulcio.crt.pem create mode 100644 vendor/github.com/sigstore/sigstore/pkg/tuf/repository/targets/fulcio_v1.crt.pem create mode 100644 vendor/github.com/sigstore/sigstore/pkg/tuf/repository/targets/rekor.0.pub create mode 100644 vendor/github.com/sigstore/sigstore/pkg/tuf/repository/targets/rekor.json create mode 100644 vendor/github.com/sigstore/sigstore/pkg/tuf/repository/targets/rekor.pub create mode 100644 vendor/github.com/sigstore/sigstore/pkg/tuf/signer.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/tuf/status_type.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/tuf/testutils.go create mode 100644 vendor/github.com/sigstore/sigstore/pkg/tuf/usage_type.go create mode 100644 vendor/github.com/syndtr/goleveldb/LICENSE create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/batch.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/cache/cache.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/cache/lru.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/comparer.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/comparer/bytes_comparer.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/comparer/comparer.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/db.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/db_compaction.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/db_iter.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/db_snapshot.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/db_state.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/db_transaction.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/db_util.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/db_write.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/doc.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/errors.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/errors/errors.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/filter.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/filter/bloom.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/filter/filter.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/iterator/array_iter.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/iterator/indexed_iter.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/iterator/iter.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/iterator/merged_iter.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/journal/journal.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/key.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/memdb/memdb.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/opt/options.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/opt/options_darwin.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/opt/options_default.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/options.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/session.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/session_compaction.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/session_record.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/session_util.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/storage.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_nacl.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_plan9.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_solaris.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_unix.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/storage/file_storage_windows.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/storage/mem_storage.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/storage/storage.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/table.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/table/reader.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/table/table.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/table/writer.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/util.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/util/buffer.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/util/buffer_pool.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/util/crc32.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/util/hash.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/util/range.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/util/util.go create mode 100644 vendor/github.com/syndtr/goleveldb/leveldb/version.go create mode 100644 vendor/github.com/tchap/go-patricia/v2/AUTHORS create mode 100644 vendor/github.com/tchap/go-patricia/v2/LICENSE create mode 100644 vendor/github.com/tchap/go-patricia/v2/patricia/children.go create mode 100644 vendor/github.com/tchap/go-patricia/v2/patricia/patricia.go create mode 100644 vendor/github.com/tent/canonical-json-go/.travis.yml create mode 100644 vendor/github.com/tent/canonical-json-go/LICENSE create mode 100644 vendor/github.com/tent/canonical-json-go/encode.go create mode 100644 vendor/github.com/thales-e-security/pool/LICENSE create mode 100644 vendor/github.com/thales-e-security/pool/README.md create mode 100644 vendor/github.com/thales-e-security/pool/atomic.go create mode 100644 vendor/github.com/thales-e-security/pool/resource_pool.go create mode 100644 vendor/github.com/thales-e-security/pool/semaphore.go create mode 100644 vendor/github.com/thales-e-security/pool/timer.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/.gitattributes create mode 100644 vendor/github.com/theupdateframework/go-tuf/.gitignore create mode 100644 vendor/github.com/theupdateframework/go-tuf/.golangci.yml create mode 100644 vendor/github.com/theupdateframework/go-tuf/README.md create mode 100644 vendor/github.com/theupdateframework/go-tuf/client/client.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/client/delegations.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/client/errors.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/client/file_store.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/client/leveldbstore/leveldbstore.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/client/local_store.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/client/remote_store.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/data/hex_bytes.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/data/types.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/errors.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/internal/fsutil/fsutil.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/internal/fsutil/perm.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/internal/fsutil/perm_windows.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/internal/roles/roles.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/internal/sets/strings.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/internal/signer/sort.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/local_store.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/pkg/deprecated/set_ecdsa/set_ecdsa.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/pkg/keys/deprecated_ecdsa.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/pkg/keys/ecdsa.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/pkg/keys/ed25519.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/pkg/keys/keys.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/pkg/keys/pkix.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/pkg/keys/rsa.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/pkg/targets/delegation.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/pkg/targets/hash_bins.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/repo.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/requirements-test.txt create mode 100644 vendor/github.com/theupdateframework/go-tuf/sign/sign.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/util/util.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/verify/db.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/verify/errors.go create mode 100644 vendor/github.com/theupdateframework/go-tuf/verify/verify.go create mode 100644 vendor/github.com/tjfoc/gmsm/LICENSE create mode 100644 vendor/github.com/tjfoc/gmsm/sm3/ifile create mode 100644 vendor/github.com/tjfoc/gmsm/sm3/sm3.go create mode 100644 vendor/github.com/transparency-dev/merkle/CONTRIBUTING.md create mode 100644 vendor/github.com/transparency-dev/merkle/LICENSE create mode 100644 vendor/github.com/transparency-dev/merkle/README.md create mode 100644 vendor/github.com/transparency-dev/merkle/compact/nodes.go create mode 100644 vendor/github.com/transparency-dev/merkle/compact/range.go create mode 100644 vendor/github.com/transparency-dev/merkle/hasher.go create mode 100644 vendor/github.com/transparency-dev/merkle/proof/proof.go create mode 100644 vendor/github.com/transparency-dev/merkle/proof/verify.go create mode 100644 vendor/github.com/transparency-dev/merkle/rfc6962/rfc6962.go create mode 100644 vendor/github.com/xanzy/go-gitlab/.gitignore create mode 100644 vendor/github.com/xanzy/go-gitlab/.golangci.yml create mode 100644 vendor/github.com/xanzy/go-gitlab/LICENSE create mode 100644 vendor/github.com/xanzy/go-gitlab/README.md create mode 100644 vendor/github.com/xanzy/go-gitlab/access_requests.go create mode 100644 vendor/github.com/xanzy/go-gitlab/applications.go create mode 100644 vendor/github.com/xanzy/go-gitlab/audit_events.go create mode 100644 vendor/github.com/xanzy/go-gitlab/avatar.go create mode 100644 vendor/github.com/xanzy/go-gitlab/award_emojis.go create mode 100644 vendor/github.com/xanzy/go-gitlab/boards.go create mode 100644 vendor/github.com/xanzy/go-gitlab/branches.go create mode 100644 vendor/github.com/xanzy/go-gitlab/broadcast_messages.go create mode 100644 vendor/github.com/xanzy/go-gitlab/ci_yml_templates.go create mode 100644 vendor/github.com/xanzy/go-gitlab/client_options.go create mode 100644 vendor/github.com/xanzy/go-gitlab/cluster_agents.go create mode 100644 vendor/github.com/xanzy/go-gitlab/commits.go create mode 100644 vendor/github.com/xanzy/go-gitlab/container_registry.go create mode 100644 vendor/github.com/xanzy/go-gitlab/custom_attributes.go create mode 100644 vendor/github.com/xanzy/go-gitlab/deploy_keys.go create mode 100644 vendor/github.com/xanzy/go-gitlab/deploy_tokens.go create mode 100644 vendor/github.com/xanzy/go-gitlab/deployments.go create mode 100644 vendor/github.com/xanzy/go-gitlab/deployments_merge_requests.go create mode 100644 vendor/github.com/xanzy/go-gitlab/discussions.go create mode 100644 vendor/github.com/xanzy/go-gitlab/environments.go create mode 100644 vendor/github.com/xanzy/go-gitlab/epic_issues.go create mode 100644 vendor/github.com/xanzy/go-gitlab/epics.go create mode 100644 vendor/github.com/xanzy/go-gitlab/error_tracking.go create mode 100644 vendor/github.com/xanzy/go-gitlab/event_parsing.go create mode 100644 vendor/github.com/xanzy/go-gitlab/event_systemhook_types.go create mode 100644 vendor/github.com/xanzy/go-gitlab/event_webhook_types.go create mode 100644 vendor/github.com/xanzy/go-gitlab/events.go create mode 100644 vendor/github.com/xanzy/go-gitlab/external_status_checks.go create mode 100644 vendor/github.com/xanzy/go-gitlab/feature_flags.go create mode 100644 vendor/github.com/xanzy/go-gitlab/freeze_periods.go create mode 100644 vendor/github.com/xanzy/go-gitlab/generic_packages.go create mode 100644 vendor/github.com/xanzy/go-gitlab/geo_nodes.go create mode 100644 vendor/github.com/xanzy/go-gitlab/gitignore_templates.go create mode 100644 vendor/github.com/xanzy/go-gitlab/gitlab.go create mode 100644 vendor/github.com/xanzy/go-gitlab/group_access_tokens.go create mode 100644 vendor/github.com/xanzy/go-gitlab/group_badges.go create mode 100644 vendor/github.com/xanzy/go-gitlab/group_boards.go create mode 100644 vendor/github.com/xanzy/go-gitlab/group_clusters.go create mode 100644 vendor/github.com/xanzy/go-gitlab/group_hooks.go create mode 100644 vendor/github.com/xanzy/go-gitlab/group_import_export.go create mode 100644 vendor/github.com/xanzy/go-gitlab/group_iterations.go create mode 100644 vendor/github.com/xanzy/go-gitlab/group_labels.go create mode 100644 vendor/github.com/xanzy/go-gitlab/group_members.go create mode 100644 vendor/github.com/xanzy/go-gitlab/group_milestones.go create mode 100644 vendor/github.com/xanzy/go-gitlab/group_variables.go create mode 100644 vendor/github.com/xanzy/go-gitlab/group_wikis.go create mode 100644 vendor/github.com/xanzy/go-gitlab/groups.go create mode 100644 vendor/github.com/xanzy/go-gitlab/instance_clusters.go create mode 100644 vendor/github.com/xanzy/go-gitlab/instance_variables.go create mode 100644 vendor/github.com/xanzy/go-gitlab/invites.go create mode 100644 vendor/github.com/xanzy/go-gitlab/issue_links.go create mode 100644 vendor/github.com/xanzy/go-gitlab/issues.go create mode 100644 vendor/github.com/xanzy/go-gitlab/issues_statistics.go create mode 100644 vendor/github.com/xanzy/go-gitlab/jobs.go create mode 100644 vendor/github.com/xanzy/go-gitlab/keys.go create mode 100644 vendor/github.com/xanzy/go-gitlab/labels.go create mode 100644 vendor/github.com/xanzy/go-gitlab/license.go create mode 100644 vendor/github.com/xanzy/go-gitlab/license_templates.go create mode 100644 vendor/github.com/xanzy/go-gitlab/markdown.go create mode 100644 vendor/github.com/xanzy/go-gitlab/merge_request_approvals.go create mode 100644 vendor/github.com/xanzy/go-gitlab/merge_requests.go create mode 100644 vendor/github.com/xanzy/go-gitlab/milestones.go create mode 100644 vendor/github.com/xanzy/go-gitlab/namespaces.go create mode 100644 vendor/github.com/xanzy/go-gitlab/notes.go create mode 100644 vendor/github.com/xanzy/go-gitlab/notifications.go create mode 100644 vendor/github.com/xanzy/go-gitlab/packages.go create mode 100644 vendor/github.com/xanzy/go-gitlab/pages.go create mode 100644 vendor/github.com/xanzy/go-gitlab/pages_domains.go create mode 100644 vendor/github.com/xanzy/go-gitlab/personal_access_tokens.go create mode 100644 vendor/github.com/xanzy/go-gitlab/pipeline_schedules.go create mode 100644 vendor/github.com/xanzy/go-gitlab/pipeline_triggers.go create mode 100644 vendor/github.com/xanzy/go-gitlab/pipelines.go create mode 100644 vendor/github.com/xanzy/go-gitlab/plan_limits.go create mode 100644 vendor/github.com/xanzy/go-gitlab/project_access_tokens.go create mode 100644 vendor/github.com/xanzy/go-gitlab/project_badges.go create mode 100644 vendor/github.com/xanzy/go-gitlab/project_clusters.go create mode 100644 vendor/github.com/xanzy/go-gitlab/project_import_export.go create mode 100644 vendor/github.com/xanzy/go-gitlab/project_iterations.go create mode 100644 vendor/github.com/xanzy/go-gitlab/project_managed_licenses.go create mode 100644 vendor/github.com/xanzy/go-gitlab/project_members.go create mode 100644 vendor/github.com/xanzy/go-gitlab/project_mirror.go create mode 100644 vendor/github.com/xanzy/go-gitlab/project_snippets.go create mode 100644 vendor/github.com/xanzy/go-gitlab/project_variables.go create mode 100644 vendor/github.com/xanzy/go-gitlab/project_vulnerabilities.go create mode 100644 vendor/github.com/xanzy/go-gitlab/projects.go create mode 100644 vendor/github.com/xanzy/go-gitlab/protected_branches.go create mode 100644 vendor/github.com/xanzy/go-gitlab/protected_environments.go create mode 100644 vendor/github.com/xanzy/go-gitlab/protected_tags.go create mode 100644 vendor/github.com/xanzy/go-gitlab/releaselinks.go create mode 100644 vendor/github.com/xanzy/go-gitlab/releases.go create mode 100644 vendor/github.com/xanzy/go-gitlab/repositories.go create mode 100644 vendor/github.com/xanzy/go-gitlab/repository_files.go create mode 100644 vendor/github.com/xanzy/go-gitlab/repository_submodules.go create mode 100644 vendor/github.com/xanzy/go-gitlab/request_options.go create mode 100644 vendor/github.com/xanzy/go-gitlab/resource_label_events.go create mode 100644 vendor/github.com/xanzy/go-gitlab/resource_milestone_events.go create mode 100644 vendor/github.com/xanzy/go-gitlab/resource_state_events.go create mode 100644 vendor/github.com/xanzy/go-gitlab/runners.go create mode 100644 vendor/github.com/xanzy/go-gitlab/search.go create mode 100644 vendor/github.com/xanzy/go-gitlab/services.go create mode 100644 vendor/github.com/xanzy/go-gitlab/settings.go create mode 100644 vendor/github.com/xanzy/go-gitlab/sidekiq_metrics.go create mode 100644 vendor/github.com/xanzy/go-gitlab/snippets.go create mode 100644 vendor/github.com/xanzy/go-gitlab/strings.go create mode 100644 vendor/github.com/xanzy/go-gitlab/system_hooks.go create mode 100644 vendor/github.com/xanzy/go-gitlab/tags.go create mode 100644 vendor/github.com/xanzy/go-gitlab/time_stats.go create mode 100644 vendor/github.com/xanzy/go-gitlab/todos.go create mode 100644 vendor/github.com/xanzy/go-gitlab/topics.go create mode 100644 vendor/github.com/xanzy/go-gitlab/types.go create mode 100644 vendor/github.com/xanzy/go-gitlab/users.go create mode 100644 vendor/github.com/xanzy/go-gitlab/validate.go create mode 100644 vendor/github.com/xanzy/go-gitlab/version.go create mode 100644 vendor/github.com/xanzy/go-gitlab/wikis.go create mode 100644 vendor/github.com/xeipuuv/gojsonpointer/LICENSE-APACHE-2.0.txt create mode 100644 vendor/github.com/xeipuuv/gojsonpointer/README.md create mode 100644 vendor/github.com/xeipuuv/gojsonpointer/pointer.go create mode 100644 vendor/github.com/xeipuuv/gojsonreference/LICENSE-APACHE-2.0.txt create mode 100644 vendor/github.com/xeipuuv/gojsonreference/README.md create mode 100644 vendor/github.com/xeipuuv/gojsonreference/reference.go create mode 100644 vendor/github.com/yashtewari/glob-intersection/LICENSE create mode 100644 vendor/github.com/yashtewari/glob-intersection/README.md create mode 100644 vendor/github.com/yashtewari/glob-intersection/glob.go create mode 100644 vendor/github.com/yashtewari/glob-intersection/match.go create mode 100644 vendor/github.com/yashtewari/glob-intersection/non_empty.go create mode 100644 vendor/github.com/yashtewari/glob-intersection/simplify.go create mode 100644 vendor/github.com/yashtewari/glob-intersection/test_samples.go create mode 100644 vendor/github.com/yashtewari/glob-intersection/tokenize.go create mode 100644 vendor/go.opencensus.io/.gitignore create mode 100644 vendor/go.opencensus.io/AUTHORS create mode 100644 vendor/go.opencensus.io/CONTRIBUTING.md create mode 100644 vendor/go.opencensus.io/LICENSE create mode 100644 vendor/go.opencensus.io/Makefile create mode 100644 vendor/go.opencensus.io/README.md create mode 100644 vendor/go.opencensus.io/appveyor.yml create mode 100644 vendor/go.opencensus.io/internal/internal.go create mode 100644 vendor/go.opencensus.io/internal/sanitize.go create mode 100644 vendor/go.opencensus.io/internal/tagencoding/tagencoding.go create mode 100644 vendor/go.opencensus.io/internal/traceinternals.go create mode 100644 vendor/go.opencensus.io/metric/metricdata/doc.go create mode 100644 vendor/go.opencensus.io/metric/metricdata/exemplar.go create mode 100644 vendor/go.opencensus.io/metric/metricdata/label.go create mode 100644 vendor/go.opencensus.io/metric/metricdata/metric.go create mode 100644 vendor/go.opencensus.io/metric/metricdata/point.go create mode 100644 vendor/go.opencensus.io/metric/metricdata/type_string.go create mode 100644 vendor/go.opencensus.io/metric/metricdata/unit.go create mode 100644 vendor/go.opencensus.io/metric/metricexport/doc.go create mode 100644 vendor/go.opencensus.io/metric/metricexport/export.go create mode 100644 vendor/go.opencensus.io/metric/metricexport/reader.go create mode 100644 vendor/go.opencensus.io/metric/metricproducer/manager.go create mode 100644 vendor/go.opencensus.io/metric/metricproducer/producer.go create mode 100644 vendor/go.opencensus.io/opencensus.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/client.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/client_metrics.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/client_stats_handler.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/doc.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/server.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/server_metrics.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/server_stats_handler.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/stats_common.go create mode 100644 vendor/go.opencensus.io/plugin/ocgrpc/trace_common.go create mode 100644 vendor/go.opencensus.io/resource/resource.go create mode 100644 vendor/go.opencensus.io/stats/doc.go create mode 100644 vendor/go.opencensus.io/stats/internal/record.go create mode 100644 vendor/go.opencensus.io/stats/measure.go create mode 100644 vendor/go.opencensus.io/stats/measure_float64.go create mode 100644 vendor/go.opencensus.io/stats/measure_int64.go create mode 100644 vendor/go.opencensus.io/stats/record.go create mode 100644 vendor/go.opencensus.io/stats/units.go create mode 100644 vendor/go.opencensus.io/stats/view/aggregation.go create mode 100644 vendor/go.opencensus.io/stats/view/aggregation_data.go create mode 100644 vendor/go.opencensus.io/stats/view/collector.go create mode 100644 vendor/go.opencensus.io/stats/view/doc.go create mode 100644 vendor/go.opencensus.io/stats/view/export.go create mode 100644 vendor/go.opencensus.io/stats/view/view.go create mode 100644 vendor/go.opencensus.io/stats/view/view_to_metric.go create mode 100644 vendor/go.opencensus.io/stats/view/worker.go create mode 100644 vendor/go.opencensus.io/stats/view/worker_commands.go create mode 100644 vendor/go.opencensus.io/tag/context.go create mode 100644 vendor/go.opencensus.io/tag/doc.go create mode 100644 vendor/go.opencensus.io/tag/key.go create mode 100644 vendor/go.opencensus.io/tag/map.go create mode 100644 vendor/go.opencensus.io/tag/map_codec.go create mode 100644 vendor/go.opencensus.io/tag/metadata.go create mode 100644 vendor/go.opencensus.io/tag/profile_19.go create mode 100644 vendor/go.opencensus.io/tag/profile_not19.go create mode 100644 vendor/go.opencensus.io/tag/validate.go create mode 100644 vendor/go.opencensus.io/trace/basetypes.go create mode 100644 vendor/go.opencensus.io/trace/config.go create mode 100644 vendor/go.opencensus.io/trace/doc.go create mode 100644 vendor/go.opencensus.io/trace/evictedqueue.go create mode 100644 vendor/go.opencensus.io/trace/export.go create mode 100644 vendor/go.opencensus.io/trace/internal/internal.go create mode 100644 vendor/go.opencensus.io/trace/lrumap.go create mode 100644 vendor/go.opencensus.io/trace/propagation/propagation.go create mode 100644 vendor/go.opencensus.io/trace/sampling.go create mode 100644 vendor/go.opencensus.io/trace/spanbucket.go create mode 100644 vendor/go.opencensus.io/trace/spanstore.go create mode 100644 vendor/go.opencensus.io/trace/status_codes.go create mode 100644 vendor/go.opencensus.io/trace/trace.go create mode 100644 vendor/go.opencensus.io/trace/trace_api.go create mode 100644 vendor/go.opencensus.io/trace/trace_go11.go create mode 100644 vendor/go.opencensus.io/trace/trace_nongo11.go create mode 100644 vendor/go.opencensus.io/trace/tracestate/tracestate.go create mode 100644 vendor/go.uber.org/atomic/.codecov.yml create mode 100644 vendor/go.uber.org/atomic/.gitignore create mode 100644 vendor/go.uber.org/atomic/CHANGELOG.md create mode 100644 vendor/go.uber.org/atomic/LICENSE.txt create mode 100644 vendor/go.uber.org/atomic/Makefile create mode 100644 vendor/go.uber.org/atomic/README.md create mode 100644 vendor/go.uber.org/atomic/bool.go create mode 100644 vendor/go.uber.org/atomic/bool_ext.go create mode 100644 vendor/go.uber.org/atomic/doc.go create mode 100644 vendor/go.uber.org/atomic/duration.go create mode 100644 vendor/go.uber.org/atomic/duration_ext.go create mode 100644 vendor/go.uber.org/atomic/error.go create mode 100644 vendor/go.uber.org/atomic/error_ext.go create mode 100644 vendor/go.uber.org/atomic/float32.go create mode 100644 vendor/go.uber.org/atomic/float32_ext.go create mode 100644 vendor/go.uber.org/atomic/float64.go create mode 100644 vendor/go.uber.org/atomic/float64_ext.go create mode 100644 vendor/go.uber.org/atomic/gen.go create mode 100644 vendor/go.uber.org/atomic/int32.go create mode 100644 vendor/go.uber.org/atomic/int64.go create mode 100644 vendor/go.uber.org/atomic/nocmp.go create mode 100644 vendor/go.uber.org/atomic/pointer_go118.go create mode 100644 vendor/go.uber.org/atomic/pointer_go119.go create mode 100644 vendor/go.uber.org/atomic/string.go create mode 100644 vendor/go.uber.org/atomic/string_ext.go create mode 100644 vendor/go.uber.org/atomic/time.go create mode 100644 vendor/go.uber.org/atomic/time_ext.go create mode 100644 vendor/go.uber.org/atomic/uint32.go create mode 100644 vendor/go.uber.org/atomic/uint64.go create mode 100644 vendor/go.uber.org/atomic/uintptr.go create mode 100644 vendor/go.uber.org/atomic/unsafe_pointer.go create mode 100644 vendor/go.uber.org/atomic/value.go create mode 100644 vendor/go.uber.org/multierr/.codecov.yml create mode 100644 vendor/go.uber.org/multierr/.gitignore create mode 100644 vendor/go.uber.org/multierr/CHANGELOG.md create mode 100644 vendor/go.uber.org/multierr/LICENSE.txt create mode 100644 vendor/go.uber.org/multierr/Makefile create mode 100644 vendor/go.uber.org/multierr/README.md create mode 100644 vendor/go.uber.org/multierr/error.go create mode 100644 vendor/go.uber.org/multierr/glide.yaml create mode 100644 vendor/go.uber.org/zap/.codecov.yml create mode 100644 vendor/go.uber.org/zap/.gitignore create mode 100644 vendor/go.uber.org/zap/.readme.tmpl create mode 100644 vendor/go.uber.org/zap/CHANGELOG.md create mode 100644 vendor/go.uber.org/zap/CODE_OF_CONDUCT.md create mode 100644 vendor/go.uber.org/zap/CONTRIBUTING.md create mode 100644 vendor/go.uber.org/zap/FAQ.md create mode 100644 vendor/go.uber.org/zap/LICENSE.txt create mode 100644 vendor/go.uber.org/zap/Makefile create mode 100644 vendor/go.uber.org/zap/README.md create mode 100644 vendor/go.uber.org/zap/array.go create mode 100644 vendor/go.uber.org/zap/array_go118.go create mode 100644 vendor/go.uber.org/zap/buffer/buffer.go create mode 100644 vendor/go.uber.org/zap/buffer/pool.go create mode 100644 vendor/go.uber.org/zap/checklicense.sh create mode 100644 vendor/go.uber.org/zap/config.go create mode 100644 vendor/go.uber.org/zap/doc.go create mode 100644 vendor/go.uber.org/zap/encoder.go create mode 100644 vendor/go.uber.org/zap/error.go create mode 100644 vendor/go.uber.org/zap/field.go create mode 100644 vendor/go.uber.org/zap/flag.go create mode 100644 vendor/go.uber.org/zap/glide.yaml create mode 100644 vendor/go.uber.org/zap/global.go create mode 100644 vendor/go.uber.org/zap/http_handler.go create mode 100644 vendor/go.uber.org/zap/internal/bufferpool/bufferpool.go create mode 100644 vendor/go.uber.org/zap/internal/color/color.go create mode 100644 vendor/go.uber.org/zap/internal/exit/exit.go create mode 100644 vendor/go.uber.org/zap/internal/level_enabler.go create mode 100644 vendor/go.uber.org/zap/level.go create mode 100644 vendor/go.uber.org/zap/logger.go create mode 100644 vendor/go.uber.org/zap/options.go create mode 100644 vendor/go.uber.org/zap/sink.go create mode 100644 vendor/go.uber.org/zap/stacktrace.go create mode 100644 vendor/go.uber.org/zap/sugar.go create mode 100644 vendor/go.uber.org/zap/time.go create mode 100644 vendor/go.uber.org/zap/writer.go create mode 100644 vendor/go.uber.org/zap/zapcore/buffered_write_syncer.go create mode 100644 vendor/go.uber.org/zap/zapcore/clock.go create mode 100644 vendor/go.uber.org/zap/zapcore/console_encoder.go create mode 100644 vendor/go.uber.org/zap/zapcore/core.go create mode 100644 vendor/go.uber.org/zap/zapcore/doc.go create mode 100644 vendor/go.uber.org/zap/zapcore/encoder.go create mode 100644 vendor/go.uber.org/zap/zapcore/entry.go create mode 100644 vendor/go.uber.org/zap/zapcore/error.go create mode 100644 vendor/go.uber.org/zap/zapcore/field.go create mode 100644 vendor/go.uber.org/zap/zapcore/hook.go create mode 100644 vendor/go.uber.org/zap/zapcore/increase_level.go create mode 100644 vendor/go.uber.org/zap/zapcore/json_encoder.go create mode 100644 vendor/go.uber.org/zap/zapcore/level.go create mode 100644 vendor/go.uber.org/zap/zapcore/level_strings.go create mode 100644 vendor/go.uber.org/zap/zapcore/marshaler.go create mode 100644 vendor/go.uber.org/zap/zapcore/memory_encoder.go create mode 100644 vendor/go.uber.org/zap/zapcore/reflected_encoder.go create mode 100644 vendor/go.uber.org/zap/zapcore/sampler.go create mode 100644 vendor/go.uber.org/zap/zapcore/tee.go create mode 100644 vendor/go.uber.org/zap/zapcore/write_syncer.go create mode 100644 vendor/golang.org/x/crypto/blake2b/blake2b.go create mode 100644 vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.go create mode 100644 vendor/golang.org/x/crypto/blake2b/blake2bAVX2_amd64.s create mode 100644 vendor/golang.org/x/crypto/blake2b/blake2b_amd64.go create mode 100644 vendor/golang.org/x/crypto/blake2b/blake2b_amd64.s create mode 100644 vendor/golang.org/x/crypto/blake2b/blake2b_generic.go create mode 100644 vendor/golang.org/x/crypto/blake2b/blake2b_ref.go create mode 100644 vendor/golang.org/x/crypto/blake2b/blake2x.go create mode 100644 vendor/golang.org/x/crypto/blake2b/register.go create mode 100644 vendor/golang.org/x/crypto/blowfish/block.go create mode 100644 vendor/golang.org/x/crypto/blowfish/cipher.go create mode 100644 vendor/golang.org/x/crypto/blowfish/const.go create mode 100644 vendor/golang.org/x/crypto/cast5/cast5.go create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_arm64.go create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_arm64.s create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_generic.go create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_noasm.go create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.go create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_ppc64le.s create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_s390x.go create mode 100644 vendor/golang.org/x/crypto/chacha20/chacha_s390x.s create mode 100644 vendor/golang.org/x/crypto/chacha20/xor.go create mode 100644 vendor/golang.org/x/crypto/cryptobyte/asn1.go create mode 100644 vendor/golang.org/x/crypto/cryptobyte/asn1/asn1.go create mode 100644 vendor/golang.org/x/crypto/cryptobyte/builder.go create mode 100644 vendor/golang.org/x/crypto/cryptobyte/string.go create mode 100644 vendor/golang.org/x/crypto/curve25519/curve25519.go create mode 100644 vendor/golang.org/x/crypto/curve25519/internal/field/README create mode 100644 vendor/golang.org/x/crypto/curve25519/internal/field/fe.go create mode 100644 vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.go create mode 100644 vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64.s create mode 100644 vendor/golang.org/x/crypto/curve25519/internal/field/fe_amd64_noasm.go create mode 100644 vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.go create mode 100644 vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64.s create mode 100644 vendor/golang.org/x/crypto/curve25519/internal/field/fe_arm64_noasm.go create mode 100644 vendor/golang.org/x/crypto/curve25519/internal/field/fe_generic.go create mode 100644 vendor/golang.org/x/crypto/curve25519/internal/field/sync.checkpoint create mode 100644 vendor/golang.org/x/crypto/curve25519/internal/field/sync.sh create mode 100644 vendor/golang.org/x/crypto/nacl/box/box.go create mode 100644 vendor/golang.org/x/crypto/openpgp/armor/armor.go create mode 100644 vendor/golang.org/x/crypto/openpgp/armor/encode.go create mode 100644 vendor/golang.org/x/crypto/openpgp/canonical_text.go create mode 100644 vendor/golang.org/x/crypto/openpgp/elgamal/elgamal.go create mode 100644 vendor/golang.org/x/crypto/openpgp/errors/errors.go create mode 100644 vendor/golang.org/x/crypto/openpgp/keys.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/compressed.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/config.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/encrypted_key.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/literal.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/ocfb.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/one_pass_signature.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/opaque.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/packet.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/private_key.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/public_key.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/public_key_v3.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/reader.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/signature.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/signature_v3.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/symmetric_key_encrypted.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/symmetrically_encrypted.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/userattribute.go create mode 100644 vendor/golang.org/x/crypto/openpgp/packet/userid.go create mode 100644 vendor/golang.org/x/crypto/openpgp/read.go create mode 100644 vendor/golang.org/x/crypto/openpgp/s2k/s2k.go create mode 100644 vendor/golang.org/x/crypto/openpgp/write.go create mode 100644 vendor/golang.org/x/crypto/sha3/doc.go create mode 100644 vendor/golang.org/x/crypto/sha3/hashes.go create mode 100644 vendor/golang.org/x/crypto/sha3/hashes_generic.go create mode 100644 vendor/golang.org/x/crypto/sha3/keccakf.go create mode 100644 vendor/golang.org/x/crypto/sha3/keccakf_amd64.go create mode 100644 vendor/golang.org/x/crypto/sha3/keccakf_amd64.s create mode 100644 vendor/golang.org/x/crypto/sha3/register.go create mode 100644 vendor/golang.org/x/crypto/sha3/sha3.go create mode 100644 vendor/golang.org/x/crypto/sha3/sha3_s390x.go create mode 100644 vendor/golang.org/x/crypto/sha3/sha3_s390x.s create mode 100644 vendor/golang.org/x/crypto/sha3/shake.go create mode 100644 vendor/golang.org/x/crypto/sha3/shake_generic.go create mode 100644 vendor/golang.org/x/crypto/sha3/xor.go create mode 100644 vendor/golang.org/x/crypto/sha3/xor_generic.go create mode 100644 vendor/golang.org/x/crypto/sha3/xor_unaligned.go create mode 100644 vendor/golang.org/x/crypto/ssh/buffer.go create mode 100644 vendor/golang.org/x/crypto/ssh/certs.go create mode 100644 vendor/golang.org/x/crypto/ssh/channel.go create mode 100644 vendor/golang.org/x/crypto/ssh/cipher.go create mode 100644 vendor/golang.org/x/crypto/ssh/client.go create mode 100644 vendor/golang.org/x/crypto/ssh/client_auth.go create mode 100644 vendor/golang.org/x/crypto/ssh/common.go create mode 100644 vendor/golang.org/x/crypto/ssh/connection.go create mode 100644 vendor/golang.org/x/crypto/ssh/doc.go create mode 100644 vendor/golang.org/x/crypto/ssh/handshake.go create mode 100644 vendor/golang.org/x/crypto/ssh/internal/bcrypt_pbkdf/bcrypt_pbkdf.go create mode 100644 vendor/golang.org/x/crypto/ssh/kex.go create mode 100644 vendor/golang.org/x/crypto/ssh/keys.go create mode 100644 vendor/golang.org/x/crypto/ssh/mac.go create mode 100644 vendor/golang.org/x/crypto/ssh/messages.go create mode 100644 vendor/golang.org/x/crypto/ssh/mux.go create mode 100644 vendor/golang.org/x/crypto/ssh/server.go create mode 100644 vendor/golang.org/x/crypto/ssh/session.go create mode 100644 vendor/golang.org/x/crypto/ssh/ssh_gss.go create mode 100644 vendor/golang.org/x/crypto/ssh/streamlocal.go create mode 100644 vendor/golang.org/x/crypto/ssh/tcpip.go create mode 100644 vendor/golang.org/x/crypto/ssh/terminal/terminal.go create mode 100644 vendor/golang.org/x/crypto/ssh/transport.go create mode 100644 vendor/golang.org/x/exp/LICENSE create mode 100644 vendor/golang.org/x/exp/PATENTS create mode 100644 vendor/golang.org/x/exp/constraints/constraints.go create mode 100644 vendor/golang.org/x/exp/slices/slices.go create mode 100644 vendor/golang.org/x/exp/slices/sort.go create mode 100644 vendor/golang.org/x/exp/slices/zsortfunc.go create mode 100644 vendor/golang.org/x/exp/slices/zsortordered.go create mode 100644 vendor/golang.org/x/mod/sumdb/note/note.go create mode 100644 vendor/golang.org/x/net/http2/h2c/h2c.go create mode 100644 vendor/golang.org/x/text/encoding/encoding.go create mode 100644 vendor/golang.org/x/text/encoding/internal/identifier/identifier.go create mode 100644 vendor/golang.org/x/text/encoding/internal/identifier/mib.go create mode 100644 vendor/golang.org/x/text/encoding/internal/internal.go create mode 100644 vendor/golang.org/x/text/encoding/unicode/override.go create mode 100644 vendor/golang.org/x/text/encoding/unicode/unicode.go create mode 100644 vendor/golang.org/x/text/internal/language/common.go create mode 100644 vendor/golang.org/x/text/internal/language/compact.go create mode 100644 vendor/golang.org/x/text/internal/language/compact/compact.go create mode 100644 vendor/golang.org/x/text/internal/language/compact/language.go create mode 100644 vendor/golang.org/x/text/internal/language/compact/parents.go create mode 100644 vendor/golang.org/x/text/internal/language/compact/tables.go create mode 100644 vendor/golang.org/x/text/internal/language/compact/tags.go create mode 100644 vendor/golang.org/x/text/internal/language/compose.go create mode 100644 vendor/golang.org/x/text/internal/language/coverage.go create mode 100644 vendor/golang.org/x/text/internal/language/language.go create mode 100644 vendor/golang.org/x/text/internal/language/lookup.go create mode 100644 vendor/golang.org/x/text/internal/language/match.go create mode 100644 vendor/golang.org/x/text/internal/language/parse.go create mode 100644 vendor/golang.org/x/text/internal/language/tables.go create mode 100644 vendor/golang.org/x/text/internal/language/tags.go create mode 100644 vendor/golang.org/x/text/internal/tag/tag.go create mode 100644 vendor/golang.org/x/text/internal/utf8internal/utf8internal.go create mode 100644 vendor/golang.org/x/text/language/coverage.go create mode 100644 vendor/golang.org/x/text/language/doc.go create mode 100644 vendor/golang.org/x/text/language/language.go create mode 100644 vendor/golang.org/x/text/language/match.go create mode 100644 vendor/golang.org/x/text/language/parse.go create mode 100644 vendor/golang.org/x/text/language/tables.go create mode 100644 vendor/golang.org/x/text/language/tags.go create mode 100644 vendor/golang.org/x/time/LICENSE create mode 100644 vendor/golang.org/x/time/PATENTS create mode 100644 vendor/golang.org/x/time/rate/rate.go create mode 100644 vendor/golang.org/x/time/rate/sometimes.go create mode 100644 vendor/gomodules.xyz/jsonpatch/v2/LICENSE create mode 100644 vendor/gomodules.xyz/jsonpatch/v2/jsonpatch.go create mode 100644 vendor/google.golang.org/api/AUTHORS create mode 100644 vendor/google.golang.org/api/CONTRIBUTORS create mode 100644 vendor/google.golang.org/api/LICENSE create mode 100644 vendor/google.golang.org/api/support/bundler/bundler.go create mode 100644 vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go create mode 100644 vendor/google.golang.org/genproto/protobuf/field_mask/field_mask.go create mode 100644 vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go create mode 100644 vendor/google.golang.org/grpc/health/grpc_health_v1/health_grpc.pb.go create mode 100644 vendor/google.golang.org/grpc/internal/grpcsync/oncefunc.go create mode 100644 vendor/google.golang.org/grpc/internal/grpcutil/compressor.go create mode 100644 vendor/google.golang.org/protobuf/types/known/fieldmaskpb/field_mask.pb.go create mode 100644 vendor/google.golang.org/protobuf/types/known/structpb/struct.pb.go create mode 100644 vendor/google.golang.org/protobuf/types/known/wrapperspb/wrappers.pb.go create mode 100644 vendor/gopkg.in/inf.v0/LICENSE create mode 100644 vendor/gopkg.in/inf.v0/dec.go create mode 100644 vendor/gopkg.in/inf.v0/rounder.go create mode 100644 vendor/k8s.io/api/LICENSE create mode 100644 vendor/k8s.io/api/admission/v1/doc.go create mode 100644 vendor/k8s.io/api/admission/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/admission/v1/generated.proto create mode 100644 vendor/k8s.io/api/admission/v1/register.go create mode 100644 vendor/k8s.io/api/admission/v1/types.go create mode 100644 vendor/k8s.io/api/admission/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/admission/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/admissionregistration/v1/doc.go create mode 100644 vendor/k8s.io/api/admissionregistration/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/admissionregistration/v1/generated.proto create mode 100644 vendor/k8s.io/api/admissionregistration/v1/register.go create mode 100644 vendor/k8s.io/api/admissionregistration/v1/types.go create mode 100644 vendor/k8s.io/api/admissionregistration/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/admissionregistration/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/register.go create mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/types.go create mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/admissionregistration/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/doc.go create mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.pb.go create mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/generated.proto create mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/register.go create mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/types.go create mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/apiserverinternal/v1alpha1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/apps/v1/doc.go create mode 100644 vendor/k8s.io/api/apps/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/apps/v1/generated.proto create mode 100644 vendor/k8s.io/api/apps/v1/register.go create mode 100644 vendor/k8s.io/api/apps/v1/types.go create mode 100644 vendor/k8s.io/api/apps/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/apps/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/apps/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/apps/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/apps/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/apps/v1beta1/register.go create mode 100644 vendor/k8s.io/api/apps/v1beta1/types.go create mode 100644 vendor/k8s.io/api/apps/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/apps/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/apps/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/apps/v1beta2/doc.go create mode 100644 vendor/k8s.io/api/apps/v1beta2/generated.pb.go create mode 100644 vendor/k8s.io/api/apps/v1beta2/generated.proto create mode 100644 vendor/k8s.io/api/apps/v1beta2/register.go create mode 100644 vendor/k8s.io/api/apps/v1beta2/types.go create mode 100644 vendor/k8s.io/api/apps/v1beta2/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/apps/v1beta2/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/apps/v1beta2/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/authentication/v1/doc.go create mode 100644 vendor/k8s.io/api/authentication/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/authentication/v1/generated.proto create mode 100644 vendor/k8s.io/api/authentication/v1/register.go create mode 100644 vendor/k8s.io/api/authentication/v1/types.go create mode 100644 vendor/k8s.io/api/authentication/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/authentication/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/authentication/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/authentication/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/authentication/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/authentication/v1beta1/register.go create mode 100644 vendor/k8s.io/api/authentication/v1beta1/types.go create mode 100644 vendor/k8s.io/api/authentication/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/authentication/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/authentication/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/authorization/v1/doc.go create mode 100644 vendor/k8s.io/api/authorization/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/authorization/v1/generated.proto create mode 100644 vendor/k8s.io/api/authorization/v1/register.go create mode 100644 vendor/k8s.io/api/authorization/v1/types.go create mode 100644 vendor/k8s.io/api/authorization/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/authorization/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/authorization/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/authorization/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/authorization/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/authorization/v1beta1/register.go create mode 100644 vendor/k8s.io/api/authorization/v1beta1/types.go create mode 100644 vendor/k8s.io/api/authorization/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/authorization/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/authorization/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/autoscaling/v1/doc.go create mode 100644 vendor/k8s.io/api/autoscaling/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/autoscaling/v1/generated.proto create mode 100644 vendor/k8s.io/api/autoscaling/v1/register.go create mode 100644 vendor/k8s.io/api/autoscaling/v1/types.go create mode 100644 vendor/k8s.io/api/autoscaling/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/autoscaling/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/autoscaling/v2/doc.go create mode 100644 vendor/k8s.io/api/autoscaling/v2/generated.pb.go create mode 100644 vendor/k8s.io/api/autoscaling/v2/generated.proto create mode 100644 vendor/k8s.io/api/autoscaling/v2/register.go create mode 100644 vendor/k8s.io/api/autoscaling/v2/types.go create mode 100644 vendor/k8s.io/api/autoscaling/v2/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/autoscaling/v2/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/doc.go create mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/generated.proto create mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/register.go create mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/types.go create mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/autoscaling/v2beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/doc.go create mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/generated.pb.go create mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/generated.proto create mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/register.go create mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/types.go create mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/autoscaling/v2beta2/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/batch/v1/doc.go create mode 100644 vendor/k8s.io/api/batch/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/batch/v1/generated.proto create mode 100644 vendor/k8s.io/api/batch/v1/register.go create mode 100644 vendor/k8s.io/api/batch/v1/types.go create mode 100644 vendor/k8s.io/api/batch/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/batch/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/batch/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/batch/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/batch/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/batch/v1beta1/register.go create mode 100644 vendor/k8s.io/api/batch/v1beta1/types.go create mode 100644 vendor/k8s.io/api/batch/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/batch/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/batch/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/certificates/v1/doc.go create mode 100644 vendor/k8s.io/api/certificates/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/certificates/v1/generated.proto create mode 100644 vendor/k8s.io/api/certificates/v1/register.go create mode 100644 vendor/k8s.io/api/certificates/v1/types.go create mode 100644 vendor/k8s.io/api/certificates/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/certificates/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/certificates/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/certificates/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/certificates/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/certificates/v1beta1/register.go create mode 100644 vendor/k8s.io/api/certificates/v1beta1/types.go create mode 100644 vendor/k8s.io/api/certificates/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/certificates/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/certificates/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/coordination/v1/doc.go create mode 100644 vendor/k8s.io/api/coordination/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/coordination/v1/generated.proto create mode 100644 vendor/k8s.io/api/coordination/v1/register.go create mode 100644 vendor/k8s.io/api/coordination/v1/types.go create mode 100644 vendor/k8s.io/api/coordination/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/coordination/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/coordination/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/coordination/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/coordination/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/coordination/v1beta1/register.go create mode 100644 vendor/k8s.io/api/coordination/v1beta1/types.go create mode 100644 vendor/k8s.io/api/coordination/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/coordination/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/coordination/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/core/v1/annotation_key_constants.go create mode 100644 vendor/k8s.io/api/core/v1/doc.go create mode 100644 vendor/k8s.io/api/core/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/core/v1/generated.proto create mode 100644 vendor/k8s.io/api/core/v1/lifecycle.go create mode 100644 vendor/k8s.io/api/core/v1/objectreference.go create mode 100644 vendor/k8s.io/api/core/v1/register.go create mode 100644 vendor/k8s.io/api/core/v1/resource.go create mode 100644 vendor/k8s.io/api/core/v1/taint.go create mode 100644 vendor/k8s.io/api/core/v1/toleration.go create mode 100644 vendor/k8s.io/api/core/v1/types.go create mode 100644 vendor/k8s.io/api/core/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/core/v1/well_known_labels.go create mode 100644 vendor/k8s.io/api/core/v1/well_known_taints.go create mode 100644 vendor/k8s.io/api/core/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/discovery/v1/doc.go create mode 100644 vendor/k8s.io/api/discovery/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/discovery/v1/generated.proto create mode 100644 vendor/k8s.io/api/discovery/v1/register.go create mode 100644 vendor/k8s.io/api/discovery/v1/types.go create mode 100644 vendor/k8s.io/api/discovery/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/discovery/v1/well_known_labels.go create mode 100644 vendor/k8s.io/api/discovery/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/discovery/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/discovery/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/discovery/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/discovery/v1beta1/register.go create mode 100644 vendor/k8s.io/api/discovery/v1beta1/types.go create mode 100644 vendor/k8s.io/api/discovery/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/discovery/v1beta1/well_known_labels.go create mode 100644 vendor/k8s.io/api/discovery/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/discovery/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/events/v1/doc.go create mode 100644 vendor/k8s.io/api/events/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/events/v1/generated.proto create mode 100644 vendor/k8s.io/api/events/v1/register.go create mode 100644 vendor/k8s.io/api/events/v1/types.go create mode 100644 vendor/k8s.io/api/events/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/events/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/events/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/events/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/events/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/events/v1beta1/register.go create mode 100644 vendor/k8s.io/api/events/v1beta1/types.go create mode 100644 vendor/k8s.io/api/events/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/events/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/events/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/extensions/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/extensions/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/extensions/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/extensions/v1beta1/register.go create mode 100644 vendor/k8s.io/api/extensions/v1beta1/types.go create mode 100644 vendor/k8s.io/api/extensions/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/extensions/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/extensions/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/doc.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/generated.pb.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/generated.proto create mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/register.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/types.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1alpha1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/register.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/types.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/doc.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/generated.pb.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/generated.proto create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/register.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/types.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/flowcontrol/v1beta2/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/networking/v1/doc.go create mode 100644 vendor/k8s.io/api/networking/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/networking/v1/generated.proto create mode 100644 vendor/k8s.io/api/networking/v1/register.go create mode 100644 vendor/k8s.io/api/networking/v1/types.go create mode 100644 vendor/k8s.io/api/networking/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/networking/v1/well_known_annotations.go create mode 100644 vendor/k8s.io/api/networking/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/networking/v1alpha1/doc.go create mode 100644 vendor/k8s.io/api/networking/v1alpha1/generated.pb.go create mode 100644 vendor/k8s.io/api/networking/v1alpha1/generated.proto create mode 100644 vendor/k8s.io/api/networking/v1alpha1/register.go create mode 100644 vendor/k8s.io/api/networking/v1alpha1/types.go create mode 100644 vendor/k8s.io/api/networking/v1alpha1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/networking/v1alpha1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/networking/v1alpha1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/networking/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/networking/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/networking/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/networking/v1beta1/register.go create mode 100644 vendor/k8s.io/api/networking/v1beta1/types.go create mode 100644 vendor/k8s.io/api/networking/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/networking/v1beta1/well_known_annotations.go create mode 100644 vendor/k8s.io/api/networking/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/networking/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/node/v1/doc.go create mode 100644 vendor/k8s.io/api/node/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/node/v1/generated.proto create mode 100644 vendor/k8s.io/api/node/v1/register.go create mode 100644 vendor/k8s.io/api/node/v1/types.go create mode 100644 vendor/k8s.io/api/node/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/node/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/node/v1alpha1/doc.go create mode 100644 vendor/k8s.io/api/node/v1alpha1/generated.pb.go create mode 100644 vendor/k8s.io/api/node/v1alpha1/generated.proto create mode 100644 vendor/k8s.io/api/node/v1alpha1/register.go create mode 100644 vendor/k8s.io/api/node/v1alpha1/types.go create mode 100644 vendor/k8s.io/api/node/v1alpha1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/node/v1alpha1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/node/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/node/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/node/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/node/v1beta1/register.go create mode 100644 vendor/k8s.io/api/node/v1beta1/types.go create mode 100644 vendor/k8s.io/api/node/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/node/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/node/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/policy/v1/doc.go create mode 100644 vendor/k8s.io/api/policy/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/policy/v1/generated.proto create mode 100644 vendor/k8s.io/api/policy/v1/register.go create mode 100644 vendor/k8s.io/api/policy/v1/types.go create mode 100644 vendor/k8s.io/api/policy/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/policy/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/policy/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/policy/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/policy/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/policy/v1beta1/register.go create mode 100644 vendor/k8s.io/api/policy/v1beta1/types.go create mode 100644 vendor/k8s.io/api/policy/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/policy/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/policy/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/rbac/v1/doc.go create mode 100644 vendor/k8s.io/api/rbac/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/rbac/v1/generated.proto create mode 100644 vendor/k8s.io/api/rbac/v1/register.go create mode 100644 vendor/k8s.io/api/rbac/v1/types.go create mode 100644 vendor/k8s.io/api/rbac/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/rbac/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/rbac/v1alpha1/doc.go create mode 100644 vendor/k8s.io/api/rbac/v1alpha1/generated.pb.go create mode 100644 vendor/k8s.io/api/rbac/v1alpha1/generated.proto create mode 100644 vendor/k8s.io/api/rbac/v1alpha1/register.go create mode 100644 vendor/k8s.io/api/rbac/v1alpha1/types.go create mode 100644 vendor/k8s.io/api/rbac/v1alpha1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/rbac/v1alpha1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/rbac/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/rbac/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/rbac/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/rbac/v1beta1/register.go create mode 100644 vendor/k8s.io/api/rbac/v1beta1/types.go create mode 100644 vendor/k8s.io/api/rbac/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/rbac/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/rbac/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/scheduling/v1/doc.go create mode 100644 vendor/k8s.io/api/scheduling/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/scheduling/v1/generated.proto create mode 100644 vendor/k8s.io/api/scheduling/v1/register.go create mode 100644 vendor/k8s.io/api/scheduling/v1/types.go create mode 100644 vendor/k8s.io/api/scheduling/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/scheduling/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/doc.go create mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/generated.pb.go create mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/generated.proto create mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/register.go create mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/types.go create mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/scheduling/v1alpha1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/scheduling/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/scheduling/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/scheduling/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/scheduling/v1beta1/register.go create mode 100644 vendor/k8s.io/api/scheduling/v1beta1/types.go create mode 100644 vendor/k8s.io/api/scheduling/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/scheduling/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/scheduling/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/storage/v1/doc.go create mode 100644 vendor/k8s.io/api/storage/v1/generated.pb.go create mode 100644 vendor/k8s.io/api/storage/v1/generated.proto create mode 100644 vendor/k8s.io/api/storage/v1/register.go create mode 100644 vendor/k8s.io/api/storage/v1/types.go create mode 100644 vendor/k8s.io/api/storage/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/storage/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/storage/v1alpha1/doc.go create mode 100644 vendor/k8s.io/api/storage/v1alpha1/generated.pb.go create mode 100644 vendor/k8s.io/api/storage/v1alpha1/generated.proto create mode 100644 vendor/k8s.io/api/storage/v1alpha1/register.go create mode 100644 vendor/k8s.io/api/storage/v1alpha1/types.go create mode 100644 vendor/k8s.io/api/storage/v1alpha1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/storage/v1alpha1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/storage/v1alpha1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/api/storage/v1beta1/doc.go create mode 100644 vendor/k8s.io/api/storage/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/api/storage/v1beta1/generated.proto create mode 100644 vendor/k8s.io/api/storage/v1beta1/register.go create mode 100644 vendor/k8s.io/api/storage/v1beta1/types.go create mode 100644 vendor/k8s.io/api/storage/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/api/storage/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/api/storage/v1beta1/zz_generated.prerelease-lifecycle.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/equality/semantic.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/errors/OWNERS create mode 100644 vendor/k8s.io/apimachinery/pkg/api/errors/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/errors/errors.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/OWNERS create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/conditions.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/errors.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/firsthit_restmapper.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/help.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/interfaces.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/lazy.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/meta.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/multirestmapper.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/priority.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/meta/restmapper.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/OWNERS create mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/amount.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/generated.pb.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/generated.proto create mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/math.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/quantity.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/quantity_proto.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/scale_int.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/suffix.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/resource/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/validation/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/validation/generic.go create mode 100644 vendor/k8s.io/apimachinery/pkg/api/validation/objectmeta.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/register.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/types.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.conversion.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/internalversion/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/OWNERS create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/controller_ref.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/conversion.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/deepcopy.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.pb.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/group_version.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/helpers.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/labels.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_fuzz.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/micro_time_proto.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/register.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_fuzz.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/time_proto.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/helpers.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/unstructured_list.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/unstructured/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/watch.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.conversion.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1/zz_generated.defaults.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/conversion.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/deepcopy.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.pb.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/generated.proto create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/register.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/types_swagger_doc_generated.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/apimachinery/pkg/apis/meta/v1beta1/zz_generated.defaults.go create mode 100644 vendor/k8s.io/apimachinery/pkg/conversion/converter.go create mode 100644 vendor/k8s.io/apimachinery/pkg/conversion/deep_equal.go create mode 100644 vendor/k8s.io/apimachinery/pkg/conversion/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/conversion/helper.go create mode 100644 vendor/k8s.io/apimachinery/pkg/conversion/queryparams/convert.go create mode 100644 vendor/k8s.io/apimachinery/pkg/conversion/queryparams/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/fields/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/fields/fields.go create mode 100644 vendor/k8s.io/apimachinery/pkg/fields/requirements.go create mode 100644 vendor/k8s.io/apimachinery/pkg/fields/selector.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/allocator.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/codec.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/codec_check.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/conversion.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/converter.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/embedded.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/error.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/extension.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/generated.pb.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/generated.proto create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/helper.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/interfaces.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/mapper.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/negotiate.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/register.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.pb.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/schema/generated.proto create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/schema/group_version.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/schema/interfaces.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/scheme.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/scheme_builder.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/codec_factory.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/json.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/json/meta.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/negotiated_codec.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/protobuf/protobuf.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/recognizer/recognizer.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/streaming/streaming.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/serializer/versioning/versioning.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/swagger_doc_generator.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/types.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/types_proto.go create mode 100644 vendor/k8s.io/apimachinery/pkg/runtime/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/apimachinery/pkg/types/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/types/namespacedname.go create mode 100644 vendor/k8s.io/apimachinery/pkg/types/nodename.go create mode 100644 vendor/k8s.io/apimachinery/pkg/types/patch.go create mode 100644 vendor/k8s.io/apimachinery/pkg/types/uid.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/cache/expiring.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/cache/lruexpirecache.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/diff/diff.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/framer/framer.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/intstr/generated.pb.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/intstr/generated.proto create mode 100644 vendor/k8s.io/apimachinery/pkg/util/intstr/instr_fuzz.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/intstr/intstr.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/json/json.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/managedfields/extract.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/managedfields/gvkparser.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/mergepatch/OWNERS create mode 100644 vendor/k8s.io/apimachinery/pkg/util/mergepatch/errors.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/mergepatch/util.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/naming/from_stack.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/net/http.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/net/interface.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/net/port_range.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/net/port_split.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/net/util.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/strategicpatch/OWNERS create mode 100644 vendor/k8s.io/apimachinery/pkg/util/strategicpatch/errors.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/strategicpatch/meta.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/strategicpatch/patch.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/strategicpatch/types.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/uuid/uuid.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/version/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/version/version.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/wait/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/wait/wait.go create mode 100644 vendor/k8s.io/apimachinery/pkg/util/yaml/decoder.go create mode 100644 vendor/k8s.io/apimachinery/pkg/version/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/version/helpers.go create mode 100644 vendor/k8s.io/apimachinery/pkg/version/types.go create mode 100644 vendor/k8s.io/apimachinery/pkg/watch/doc.go create mode 100644 vendor/k8s.io/apimachinery/pkg/watch/filter.go create mode 100644 vendor/k8s.io/apimachinery/pkg/watch/mux.go create mode 100644 vendor/k8s.io/apimachinery/pkg/watch/streamwatcher.go create mode 100644 vendor/k8s.io/apimachinery/pkg/watch/watch.go create mode 100644 vendor/k8s.io/apimachinery/pkg/watch/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/apimachinery/third_party/forked/golang/LICENSE create mode 100644 vendor/k8s.io/apimachinery/third_party/forked/golang/PATENTS create mode 100644 vendor/k8s.io/apimachinery/third_party/forked/golang/json/OWNERS create mode 100644 vendor/k8s.io/apimachinery/third_party/forked/golang/json/fields.go create mode 100644 vendor/k8s.io/apimachinery/third_party/forked/golang/reflect/deep_equal.go create mode 100644 vendor/k8s.io/client-go/LICENSE create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhook.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/mutatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/rulewithoperations.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/servicereference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhook.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/validatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1/webhookclientconfig.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhook.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/mutatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/rule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/rulewithoperations.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/servicereference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhook.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/validatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/admissionregistration/v1beta1/webhookclientconfig.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/serverstorageversion.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversion.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversioncondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apiserverinternal/v1alpha1/storageversionstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/controllerrevision.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonset.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonsetcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonsetspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonsetstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/daemonsetupdatestrategy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/deployment.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/deploymentcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/deploymentspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/deploymentstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/deploymentstrategy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicaset.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicasetcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicasetspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/replicasetstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/rollingupdatedaemonset.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/rollingupdatedeployment.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/rollingupdatestatefulsetstrategy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulset.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulsetcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulsetpersistentvolumeclaimretentionpolicy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulsetspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulsetstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1/statefulsetupdatestrategy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/controllerrevision.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deployment.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deploymentcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deploymentspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deploymentstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/deploymentstrategy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/rollbackconfig.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/rollingupdatedeployment.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/rollingupdatestatefulsetstrategy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulset.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetpersistentvolumeclaimretentionpolicy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta1/statefulsetupdatestrategy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/controllerrevision.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonset.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonsetcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonsetspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonsetstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/daemonsetupdatestrategy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deployment.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deploymentcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deploymentspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deploymentstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/deploymentstrategy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicaset.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicasetcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicasetspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/replicasetstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/rollingupdatedaemonset.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/rollingupdatedeployment.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/rollingupdatestatefulsetstrategy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/scale.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulset.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulsetcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulsetpersistentvolumeclaimretentionpolicy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulsetspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulsetstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/apps/v1beta2/statefulsetupdatestrategy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/crossversionobjectreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscalerspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/horizontalpodautoscalerstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/scale.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/scalespec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v1/scalestatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/containerresourcemetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/containerresourcemetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/crossversionobjectreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/externalmetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/externalmetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscalerbehavior.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscalercondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscalerspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/horizontalpodautoscalerstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/hpascalingpolicy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/hpascalingrules.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricidentifier.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metrictarget.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/metricvaluestatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/objectmetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/objectmetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/podresourcemetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/podsmetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/podsmetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/resourcemetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2/resourcemetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/containerresourcemetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/containerresourcemetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/crossversionobjectreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/externalmetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/externalmetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalercondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalerspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/horizontalpodautoscalerstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/metricspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/metricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/objectmetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/objectmetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/podsmetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/podsmetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/resourcemetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta1/resourcemetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/containerresourcemetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/containerresourcemetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/crossversionobjectreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/externalmetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/externalmetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerbehavior.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalercondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/horizontalpodautoscalerstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/hpascalingpolicy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/hpascalingrules.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricidentifier.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metrictarget.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/metricvaluestatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/objectmetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/objectmetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/podsmetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/podsmetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/resourcemetricsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/autoscaling/v2beta2/resourcemetricstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/cronjob.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/cronjobspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/cronjobstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/job.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/jobtemplatespec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/podfailurepolicy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/podfailurepolicyonexitcodesrequirement.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/podfailurepolicyonpodconditionspattern.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/podfailurepolicyrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1/uncountedterminatedpods.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/cronjob.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/cronjobspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/cronjobstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/batch/v1beta1/jobtemplatespec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequest.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequestcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequestspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1/certificatesigningrequeststatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequest.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequestcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequestspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/certificates/v1beta1/certificatesigningrequeststatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/coordination/v1/lease.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/coordination/v1/leasespec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/lease.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/coordination/v1beta1/leasespec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/affinity.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/attachedvolume.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/awselasticblockstorevolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/azurediskvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/azurefilepersistentvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/azurefilevolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/capabilities.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/cephfspersistentvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/cephfsvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/cinderpersistentvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/cindervolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/clientipconfig.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/componentcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/componentstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/configmap.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapenvsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapkeyselector.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapnodeconfigsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapprojection.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/configmapvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/container.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/containerimage.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/containerport.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstate.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstaterunning.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstateterminated.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstatewaiting.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/containerstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/csipersistentvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/csivolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/daemonendpoint.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapiprojection.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapivolumefile.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/downwardapivolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/emptydirvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/endpointaddress.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/endpointport.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/endpoints.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/endpointsubset.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/envfromsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/envvar.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/envvarsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/ephemeralcontainer.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/ephemeralcontainercommon.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/ephemeralvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/event.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/eventseries.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/eventsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/execaction.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/fcvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/flexpersistentvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/flexvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/flockervolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/gcepersistentdiskvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/gitrepovolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/glusterfspersistentvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/glusterfsvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/grpcaction.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/hostalias.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/hostpathvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/httpgetaction.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/httpheader.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/iscsipersistentvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/iscsivolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/keytopath.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/lifecycle.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/lifecyclehandler.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/limitrange.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/limitrangeitem.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/limitrangespec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/loadbalanceringress.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/loadbalancerstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/localobjectreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/localvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/namespace.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/namespacecondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/namespacespec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/namespacestatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nfsvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/node.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeaddress.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeaffinity.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodecondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeconfigsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeconfigstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodedaemonendpoints.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeselector.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeselectorrequirement.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodeselectorterm.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodespec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodestatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/nodesysteminfo.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/objectfieldselector.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/objectreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolume.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaim.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimtemplate.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumeclaimvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumespec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/persistentvolumestatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/photonpersistentdiskvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/pod.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podaffinity.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podaffinityterm.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podantiaffinity.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/poddnsconfig.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/poddnsconfigoption.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podip.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podos.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podreadinessgate.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podsecuritycontext.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podtemplate.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/podtemplatespec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/portstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/portworxvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/preferredschedulingterm.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/probe.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/probehandler.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/projectedvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/quobytevolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/rbdpersistentvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/rbdvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontroller.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontrollercondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontrollerspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/replicationcontrollerstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcefieldselector.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcequota.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcequotaspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcequotastatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/resourcerequirements.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/scaleiopersistentvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/scaleiovolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/scopedresourceselectorrequirement.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/scopeselector.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/seccompprofile.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/secret.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/secretenvsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/secretkeyselector.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/secretprojection.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/secretreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/secretvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/securitycontext.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/selinuxoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/service.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceaccount.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceaccounttokenprojection.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/serviceport.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/servicespec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/servicestatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/sessionaffinityconfig.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/storageospersistentvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/storageosvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/sysctl.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/taint.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/tcpsocketaction.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/toleration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/topologyselectorlabelrequirement.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/topologyselectorterm.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/topologyspreadconstraint.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/typedlocalobjectreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/volume.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/volumedevice.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/volumemount.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/volumenodeaffinity.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/volumeprojection.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/volumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/vspherevirtualdiskvolumesource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/weightedpodaffinityterm.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/core/v1/windowssecuritycontextoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpoint.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointconditions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointhints.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointport.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1/endpointslice.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1/forzone.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpoint.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointconditions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointhints.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointport.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/endpointslice.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/discovery/v1beta1/forzone.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/events/v1/event.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/events/v1/eventseries.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/events/v1beta1/event.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/events/v1beta1/eventseries.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/allowedcsidriver.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/allowedflexvolume.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/allowedhostpath.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonset.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonsetcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonsetspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonsetstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/daemonsetupdatestrategy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deployment.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deploymentcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deploymentspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deploymentstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/deploymentstrategy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/fsgroupstrategyoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/hostportrange.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/httpingresspath.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/httpingressrulevalue.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/idrange.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingress.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressbackend.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressrulevalue.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingressstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ingresstls.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/ipblock.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicyegressrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicyingressrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicypeer.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicyport.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicyspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/networkpolicystatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/podsecuritypolicy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/podsecuritypolicyspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicaset.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicasetcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicasetspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/replicasetstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/rollbackconfig.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/rollingupdatedaemonset.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/rollingupdatedeployment.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/runasgroupstrategyoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/runasuserstrategyoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/runtimeclassstrategyoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/scale.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/selinuxstrategyoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/extensions/v1beta1/supplementalgroupsstrategyoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowdistinguishermethod.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowschema.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowschemacondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowschemaspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/flowschemastatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/groupsubject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/limitedprioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/limitresponse.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/nonresourcepolicyrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/policyruleswithsubjects.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfigurationcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfigurationreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfigurationspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/prioritylevelconfigurationstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/queuingconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/resourcepolicyrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/serviceaccountsubject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/subject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1alpha1/usersubject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowdistinguishermethod.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschema.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschemacondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschemaspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/flowschemastatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/groupsubject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/limitedprioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/limitresponse.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/nonresourcepolicyrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/policyruleswithsubjects.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/prioritylevelconfigurationstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/queuingconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/resourcepolicyrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/serviceaccountsubject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/subject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta1/usersubject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowdistinguishermethod.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschema.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschemacondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschemaspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/flowschemastatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/groupsubject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/limitedprioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/limitresponse.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/nonresourcepolicyrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/policyruleswithsubjects.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfigurationcondition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfigurationreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfigurationspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/prioritylevelconfigurationstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/queuingconfiguration.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/resourcepolicyrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/serviceaccountsubject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/subject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2/usersubject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/internal/internal.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/condition.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/deleteoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/labelselector.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/labelselectorrequirement.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/listmeta.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/managedfieldsentry.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/objectmeta.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/ownerreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/preconditions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/typemeta.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/meta/v1/unstructured.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/httpingresspath.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/httpingressrulevalue.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingress.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressbackend.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressclass.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressclassparametersreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressclassspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressrulevalue.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressservicebackend.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingressstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ingresstls.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/ipblock.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicyegressrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicyingressrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicypeer.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicyport.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicyspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/networkpolicystatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1/servicebackendport.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1alpha1/clustercidr.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1alpha1/clustercidrspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/httpingresspath.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/httpingressrulevalue.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingress.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressbackend.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressclass.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressclassparametersreference.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressclassspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressrulevalue.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingressstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/networking/v1beta1/ingresstls.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1/overhead.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1/runtimeclass.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1/scheduling.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/overhead.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/runtimeclass.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/runtimeclassspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1alpha1/scheduling.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1beta1/overhead.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1beta1/runtimeclass.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/node/v1beta1/scheduling.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1/eviction.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudget.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudgetspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1/poddisruptionbudgetstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/allowedcsidriver.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/allowedflexvolume.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/allowedhostpath.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/eviction.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/fsgroupstrategyoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/hostportrange.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/idrange.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudget.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudgetspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/poddisruptionbudgetstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/podsecuritypolicy.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/podsecuritypolicyspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/runasgroupstrategyoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/runasuserstrategyoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/runtimeclassstrategyoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/selinuxstrategyoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/policy/v1beta1/supplementalgroupsstrategyoptions.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/aggregationrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/clusterrole.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/clusterrolebinding.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/policyrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/role.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/rolebinding.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/roleref.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1/subject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/aggregationrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/clusterrole.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/clusterrolebinding.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/policyrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/role.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/rolebinding.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/roleref.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1alpha1/subject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/aggregationrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/clusterrole.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/clusterrolebinding.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/policyrule.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/role.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/rolebinding.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/roleref.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/rbac/v1beta1/subject.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1/priorityclass.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1alpha1/priorityclass.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/scheduling/v1beta1/priorityclass.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriver.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/csidriverspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinode.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinodedriver.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/csinodespec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/csistoragecapacity.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/storageclass.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/tokenrequest.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachment.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachmentsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachmentspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeattachmentstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumeerror.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1/volumenoderesources.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/csistoragecapacity.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachment.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachmentsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachmentspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeattachmentstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1alpha1/volumeerror.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriver.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csidriverspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinode.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinodedriver.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csinodespec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/csistoragecapacity.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/storageclass.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/tokenrequest.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachment.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachmentsource.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachmentspec.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeattachmentstatus.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumeerror.go create mode 100644 vendor/k8s.io/client-go/applyconfigurations/storage/v1beta1/volumenoderesources.go create mode 100644 vendor/k8s.io/client-go/discovery/discovery_client.go create mode 100644 vendor/k8s.io/client-go/discovery/doc.go create mode 100644 vendor/k8s.io/client-go/discovery/helper.go create mode 100644 vendor/k8s.io/client-go/dynamic/interface.go create mode 100644 vendor/k8s.io/client-go/dynamic/scheme.go create mode 100644 vendor/k8s.io/client-go/dynamic/simple.go create mode 100644 vendor/k8s.io/client-go/kubernetes/clientset.go create mode 100644 vendor/k8s.io/client-go/kubernetes/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/import.go create mode 100644 vendor/k8s.io/client-go/kubernetes/scheme/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/scheme/register.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/admissionregistration_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/mutatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1/validatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/admissionregistration_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/mutatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1/validatingwebhookconfiguration.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/apiserverinternal_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apiserverinternal/v1alpha1/storageversion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/apps_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/controllerrevision.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/daemonset.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/deployment.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/replicaset.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1/statefulset.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/apps_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/controllerrevision.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/deployment.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta1/statefulset.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/apps_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/controllerrevision.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/daemonset.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/deployment.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/replicaset.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/apps/v1beta2/statefulset.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/authentication_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1/tokenreview.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/authentication_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authentication/v1beta1/tokenreview.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/authorization_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/localsubjectaccessreview.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/selfsubjectaccessreview.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/selfsubjectrulesreview.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1/subjectaccessreview.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/authorization_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/localsubjectaccessreview.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/selfsubjectaccessreview.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/selfsubjectrulesreview.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/authorization/v1beta1/subjectaccessreview.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/autoscaling_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v1/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/autoscaling_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/autoscaling_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/autoscaling_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/autoscaling/v2beta2/horizontalpodautoscaler.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1/batch_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1/cronjob.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1/job.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/batch_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/cronjob.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/batch/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/certificates_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/certificatesigningrequest.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/certificates_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/certificatesigningrequest.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/certificatesigningrequest_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/certificates/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/coordination_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1/lease.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/coordination_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/coordination/v1beta1/lease.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/componentstatus.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/configmap.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/core_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/endpoints.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/event.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/event_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/limitrange.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/namespace.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/namespace_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/node.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/node_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/persistentvolume.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/persistentvolumeclaim.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/pod.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/pod_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/podtemplate.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/replicationcontroller.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/resourcequota.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/secret.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/service.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/service_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/core/v1/serviceaccount.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/discovery_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/endpointslice.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/discovery_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/endpointslice.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/discovery/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1/event.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1/events_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/event.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/event_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/events_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/events/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/daemonset.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/deployment.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/deployment_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/extensions_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/ingress.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/networkpolicy.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/podsecuritypolicy.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/replicaset.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/flowcontrol_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/flowschema.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/prioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/flowcontrol_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/flowschema.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/prioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/flowcontrol_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/flowschema.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2/prioritylevelconfiguration.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1/ingress.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1/ingressclass.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1/networking_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1/networkpolicy.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1alpha1/clustercidr.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1alpha1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1alpha1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1alpha1/networking_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/ingress.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/ingressclass.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/networking/v1beta1/networking_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1/node_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1/runtimeclass.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/node_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1alpha1/runtimeclass.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/node_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/node/v1beta1/runtimeclass.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1/eviction.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1/eviction_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1/poddisruptionbudget.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1/policy_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/eviction.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/eviction_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/poddisruptionbudget.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/podsecuritypolicy.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/policy/v1beta1/policy_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/clusterrole.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/clusterrolebinding.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/rbac_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/role.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1/rolebinding.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/clusterrole.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/clusterrolebinding.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/rbac_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/role.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1alpha1/rolebinding.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrole.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/clusterrolebinding.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rbac_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/role.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/rbac/v1beta1/rolebinding.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/priorityclass.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1/scheduling_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/priorityclass.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1/scheduling_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/priorityclass.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/scheduling/v1beta1/scheduling_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/csidriver.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/csinode.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/csistoragecapacity.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/storage_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/storageclass.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1/volumeattachment.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/csistoragecapacity.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/storage_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1alpha1/volumeattachment.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/csidriver.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/csinode.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/csistoragecapacity.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/generated_expansion.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/storage_client.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/storageclass.go create mode 100644 vendor/k8s.io/client-go/kubernetes/typed/storage/v1beta1/volumeattachment.go create mode 100644 vendor/k8s.io/client-go/openapi/client.go create mode 100644 vendor/k8s.io/client-go/openapi/groupversion.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/OWNERS create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/doc.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/install/install.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/register.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/types.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/doc.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/register.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/types.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/zz_generated.conversion.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1/zz_generated.defaults.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/doc.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/register.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/types.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/zz_generated.conversion.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/v1beta1/zz_generated.defaults.go create mode 100644 vendor/k8s.io/client-go/pkg/apis/clientauthentication/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/client-go/pkg/version/base.go create mode 100644 vendor/k8s.io/client-go/pkg/version/doc.go create mode 100644 vendor/k8s.io/client-go/pkg/version/version.go create mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/OWNERS create mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/azure/README.md create mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/azure/azure.go create mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/exec.go create mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/exec/metrics.go create mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/gcp/OWNERS create mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/gcp/gcp.go create mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/oidc/oidc.go create mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/openstack/openstack_stub.go create mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/plugins.go create mode 100644 vendor/k8s.io/client-go/plugin/pkg/client/auth/plugins_providers.go create mode 100644 vendor/k8s.io/client-go/rest/OWNERS create mode 100644 vendor/k8s.io/client-go/rest/client.go create mode 100644 vendor/k8s.io/client-go/rest/config.go create mode 100644 vendor/k8s.io/client-go/rest/exec.go create mode 100644 vendor/k8s.io/client-go/rest/plugin.go create mode 100644 vendor/k8s.io/client-go/rest/request.go create mode 100644 vendor/k8s.io/client-go/rest/transport.go create mode 100644 vendor/k8s.io/client-go/rest/url_utils.go create mode 100644 vendor/k8s.io/client-go/rest/urlbackoff.go create mode 100644 vendor/k8s.io/client-go/rest/warnings.go create mode 100644 vendor/k8s.io/client-go/rest/watch/decoder.go create mode 100644 vendor/k8s.io/client-go/rest/watch/encoder.go create mode 100644 vendor/k8s.io/client-go/rest/with_retry.go create mode 100644 vendor/k8s.io/client-go/rest/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/client-go/third_party/forked/golang/LICENSE create mode 100644 vendor/k8s.io/client-go/third_party/forked/golang/PATENTS create mode 100644 vendor/k8s.io/client-go/third_party/forked/golang/template/exec.go create mode 100644 vendor/k8s.io/client-go/third_party/forked/golang/template/funcs.go create mode 100644 vendor/k8s.io/client-go/tools/auth/OWNERS create mode 100644 vendor/k8s.io/client-go/tools/auth/clientauth.go create mode 100644 vendor/k8s.io/client-go/tools/cache/OWNERS create mode 100644 vendor/k8s.io/client-go/tools/cache/controller.go create mode 100644 vendor/k8s.io/client-go/tools/cache/delta_fifo.go create mode 100644 vendor/k8s.io/client-go/tools/cache/doc.go create mode 100644 vendor/k8s.io/client-go/tools/cache/expiration_cache.go create mode 100644 vendor/k8s.io/client-go/tools/cache/expiration_cache_fakes.go create mode 100644 vendor/k8s.io/client-go/tools/cache/fake_custom_store.go create mode 100644 vendor/k8s.io/client-go/tools/cache/fifo.go create mode 100644 vendor/k8s.io/client-go/tools/cache/heap.go create mode 100644 vendor/k8s.io/client-go/tools/cache/index.go create mode 100644 vendor/k8s.io/client-go/tools/cache/listers.go create mode 100644 vendor/k8s.io/client-go/tools/cache/listwatch.go create mode 100644 vendor/k8s.io/client-go/tools/cache/mutation_cache.go create mode 100644 vendor/k8s.io/client-go/tools/cache/mutation_detector.go create mode 100644 vendor/k8s.io/client-go/tools/cache/reflector.go create mode 100644 vendor/k8s.io/client-go/tools/cache/reflector_metrics.go create mode 100644 vendor/k8s.io/client-go/tools/cache/retry_with_deadline.go create mode 100644 vendor/k8s.io/client-go/tools/cache/shared_informer.go create mode 100644 vendor/k8s.io/client-go/tools/cache/store.go create mode 100644 vendor/k8s.io/client-go/tools/cache/thread_safe_store.go create mode 100644 vendor/k8s.io/client-go/tools/cache/undelta_store.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/doc.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/helpers.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/latest/latest.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/register.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/types.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/conversion.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/defaults.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/doc.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/register.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/types.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.conversion.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/v1/zz_generated.defaults.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/api/zz_generated.deepcopy.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/auth_loaders.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/client_config.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/config.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/doc.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/flag.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/helpers.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/loader.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/merged_client_builder.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/overrides.go create mode 100644 vendor/k8s.io/client-go/tools/clientcmd/validation.go create mode 100644 vendor/k8s.io/client-go/tools/leaderelection/OWNERS create mode 100644 vendor/k8s.io/client-go/tools/leaderelection/healthzadaptor.go create mode 100644 vendor/k8s.io/client-go/tools/leaderelection/leaderelection.go create mode 100644 vendor/k8s.io/client-go/tools/leaderelection/metrics.go create mode 100644 vendor/k8s.io/client-go/tools/leaderelection/resourcelock/configmaplock.go create mode 100644 vendor/k8s.io/client-go/tools/leaderelection/resourcelock/endpointslock.go create mode 100644 vendor/k8s.io/client-go/tools/leaderelection/resourcelock/interface.go create mode 100644 vendor/k8s.io/client-go/tools/leaderelection/resourcelock/leaselock.go create mode 100644 vendor/k8s.io/client-go/tools/leaderelection/resourcelock/multilock.go create mode 100644 vendor/k8s.io/client-go/tools/metrics/OWNERS create mode 100644 vendor/k8s.io/client-go/tools/metrics/metrics.go create mode 100644 vendor/k8s.io/client-go/tools/pager/pager.go create mode 100644 vendor/k8s.io/client-go/tools/record/OWNERS create mode 100644 vendor/k8s.io/client-go/tools/record/doc.go create mode 100644 vendor/k8s.io/client-go/tools/record/event.go create mode 100644 vendor/k8s.io/client-go/tools/record/events_cache.go create mode 100644 vendor/k8s.io/client-go/tools/record/fake.go create mode 100644 vendor/k8s.io/client-go/tools/record/util/util.go create mode 100644 vendor/k8s.io/client-go/tools/reference/ref.go create mode 100644 vendor/k8s.io/client-go/transport/OWNERS create mode 100644 vendor/k8s.io/client-go/transport/cache.go create mode 100644 vendor/k8s.io/client-go/transport/cert_rotation.go create mode 100644 vendor/k8s.io/client-go/transport/config.go create mode 100644 vendor/k8s.io/client-go/transport/round_trippers.go create mode 100644 vendor/k8s.io/client-go/transport/token_source.go create mode 100644 vendor/k8s.io/client-go/transport/transport.go create mode 100644 vendor/k8s.io/client-go/util/cert/OWNERS create mode 100644 vendor/k8s.io/client-go/util/cert/cert.go create mode 100644 vendor/k8s.io/client-go/util/cert/csr.go create mode 100644 vendor/k8s.io/client-go/util/cert/io.go create mode 100644 vendor/k8s.io/client-go/util/cert/pem.go create mode 100644 vendor/k8s.io/client-go/util/cert/server_inspection.go create mode 100644 vendor/k8s.io/client-go/util/connrotation/connrotation.go create mode 100644 vendor/k8s.io/client-go/util/flowcontrol/backoff.go create mode 100644 vendor/k8s.io/client-go/util/flowcontrol/throttle.go create mode 100644 vendor/k8s.io/client-go/util/homedir/homedir.go create mode 100644 vendor/k8s.io/client-go/util/jsonpath/doc.go create mode 100644 vendor/k8s.io/client-go/util/jsonpath/jsonpath.go create mode 100644 vendor/k8s.io/client-go/util/jsonpath/node.go create mode 100644 vendor/k8s.io/client-go/util/jsonpath/parser.go create mode 100644 vendor/k8s.io/client-go/util/keyutil/OWNERS create mode 100644 vendor/k8s.io/client-go/util/keyutil/key.go create mode 100644 vendor/k8s.io/client-go/util/retry/OWNERS create mode 100644 vendor/k8s.io/client-go/util/retry/util.go create mode 100644 vendor/k8s.io/client-go/util/workqueue/default_rate_limiters.go create mode 100644 vendor/k8s.io/client-go/util/workqueue/delaying_queue.go create mode 100644 vendor/k8s.io/client-go/util/workqueue/doc.go create mode 100644 vendor/k8s.io/client-go/util/workqueue/metrics.go create mode 100644 vendor/k8s.io/client-go/util/workqueue/parallelizer.go create mode 100644 vendor/k8s.io/client-go/util/workqueue/queue.go create mode 100644 vendor/k8s.io/client-go/util/workqueue/rate_limiting_queue.go create mode 100644 vendor/k8s.io/kube-openapi/LICENSE create mode 100644 vendor/k8s.io/kube-openapi/pkg/builder3/util/util.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/common/common.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/common/doc.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/common/interfaces.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/handler3/handler.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/flags.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/handler/handler_cache.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/AUTHORS create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/CONTRIBUTORS create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/LICENSE create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/README.md create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_any.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_default.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_funcs.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_inlined.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_methods.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/arshal_time.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/decode.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/doc.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/encode.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/errors.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/fields.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/fold.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/intern.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/pools.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/state.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/token.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/internal/third_party/go-json-experiment/json/value.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/openapiconv/convert.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/schemaconv/smd.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/schemamutation/walker.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/component.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/encoding.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/example.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/external_documentation.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/header.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/media_type.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/operation.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/parameter.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/path.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/request_body.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/response.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/security_requirement.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/security_scheme.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/server.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/spec3/spec.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/util/proto/OWNERS create mode 100644 vendor/k8s.io/kube-openapi/pkg/util/proto/doc.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/util/proto/document.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/util/proto/document_v3.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/util/proto/openapi.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/.gitignore create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/LICENSE create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/contact_info.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/external_docs.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/fuzz.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/gnostic.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/header.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/info.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/items.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/license.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/operation.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/parameter.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/path_item.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/paths.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/ref.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/response.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/responses.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/schema.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/security_scheme.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/swagger.go create mode 100644 vendor/k8s.io/kube-openapi/pkg/validation/spec/tag.go create mode 100644 vendor/k8s.io/utils/buffer/ring_growing.go create mode 100644 vendor/k8s.io/utils/clock/README.md create mode 100644 vendor/k8s.io/utils/clock/clock.go create mode 100644 vendor/k8s.io/utils/clock/testing/fake_clock.go create mode 100644 vendor/k8s.io/utils/clock/testing/simple_interval_clock.go create mode 100644 vendor/k8s.io/utils/integer/integer.go create mode 100644 vendor/k8s.io/utils/pointer/OWNERS create mode 100644 vendor/k8s.io/utils/pointer/README.md create mode 100644 vendor/k8s.io/utils/pointer/pointer.go create mode 100644 vendor/k8s.io/utils/trace/README.md create mode 100644 vendor/k8s.io/utils/trace/trace.go create mode 100644 vendor/knative.dev/pkg/LICENSE create mode 100644 vendor/knative.dev/pkg/apis/OWNERS create mode 100644 vendor/knative.dev/pkg/apis/condition_set.go create mode 100644 vendor/knative.dev/pkg/apis/condition_types.go create mode 100644 vendor/knative.dev/pkg/apis/contexts.go create mode 100644 vendor/knative.dev/pkg/apis/convert.go create mode 100644 vendor/knative.dev/pkg/apis/deprecated.go create mode 100644 vendor/knative.dev/pkg/apis/doc.go create mode 100644 vendor/knative.dev/pkg/apis/duck/ABOUT.md create mode 100644 vendor/knative.dev/pkg/apis/duck/OWNERS create mode 100644 vendor/knative.dev/pkg/apis/duck/README.md create mode 100644 vendor/knative.dev/pkg/apis/duck/cached.go create mode 100644 vendor/knative.dev/pkg/apis/duck/const.go create mode 100644 vendor/knative.dev/pkg/apis/duck/doc.go create mode 100644 vendor/knative.dev/pkg/apis/duck/ducktypes/ducktypes.go create mode 100644 vendor/knative.dev/pkg/apis/duck/enqueue.go create mode 100644 vendor/knative.dev/pkg/apis/duck/interface.go create mode 100644 vendor/knative.dev/pkg/apis/duck/patch.go create mode 100644 vendor/knative.dev/pkg/apis/duck/register.go create mode 100644 vendor/knative.dev/pkg/apis/duck/typed.go create mode 100644 vendor/knative.dev/pkg/apis/duck/unstructured.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/addressable_types.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/binding_types.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/cronjob_defaults.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/cronjob_types.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/cronjob_validation.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/destination.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/doc.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/knative_reference.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/kresource_type.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/podspec_defaults.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/podspec_types.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/podspec_validation.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/register.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/source_types.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/status_types.go create mode 100644 vendor/knative.dev/pkg/apis/duck/v1/zz_generated.deepcopy.go create mode 100644 vendor/knative.dev/pkg/apis/duck/verify.go create mode 100644 vendor/knative.dev/pkg/apis/field_error.go create mode 100644 vendor/knative.dev/pkg/apis/interfaces.go create mode 100644 vendor/knative.dev/pkg/apis/kind2resource.go create mode 100644 vendor/knative.dev/pkg/apis/metadata_validation.go create mode 100644 vendor/knative.dev/pkg/apis/url.go create mode 100644 vendor/knative.dev/pkg/apis/volatile_time.go create mode 100644 vendor/knative.dev/pkg/apis/zz_generated.deepcopy.go create mode 100644 vendor/knative.dev/pkg/changeset/commit.go create mode 100644 vendor/knative.dev/pkg/changeset/doc.go create mode 100644 vendor/knative.dev/pkg/client/injection/kube/client/client.go create mode 100644 vendor/knative.dev/pkg/client/injection/kube/client/client_expansion.go create mode 100644 vendor/knative.dev/pkg/configmap/OWNERS create mode 100644 vendor/knative.dev/pkg/configmap/doc.go create mode 100644 vendor/knative.dev/pkg/configmap/example.go create mode 100644 vendor/knative.dev/pkg/configmap/filter.go create mode 100644 vendor/knative.dev/pkg/configmap/load.go create mode 100644 vendor/knative.dev/pkg/configmap/manual_watcher.go create mode 100644 vendor/knative.dev/pkg/configmap/parse.go create mode 100644 vendor/knative.dev/pkg/configmap/static_watcher.go create mode 100644 vendor/knative.dev/pkg/configmap/store.go create mode 100644 vendor/knative.dev/pkg/configmap/watcher.go create mode 100644 vendor/knative.dev/pkg/controller/OWNERS create mode 100644 vendor/knative.dev/pkg/controller/controller.go create mode 100644 vendor/knative.dev/pkg/controller/helper.go create mode 100644 vendor/knative.dev/pkg/controller/options.go create mode 100644 vendor/knative.dev/pkg/controller/stats_reporter.go create mode 100644 vendor/knative.dev/pkg/controller/two_lane_queue.go create mode 100644 vendor/knative.dev/pkg/environment/client_config.go create mode 100644 vendor/knative.dev/pkg/hash/OWNERS create mode 100644 vendor/knative.dev/pkg/hash/bucketer.go create mode 100644 vendor/knative.dev/pkg/hash/doc.go create mode 100644 vendor/knative.dev/pkg/hash/hash.go create mode 100644 vendor/knative.dev/pkg/injection/OWNERS create mode 100644 vendor/knative.dev/pkg/injection/README.md create mode 100644 vendor/knative.dev/pkg/injection/clients.go create mode 100644 vendor/knative.dev/pkg/injection/clients/dynamicclient/dynamicclient.go create mode 100644 vendor/knative.dev/pkg/injection/config.go create mode 100644 vendor/knative.dev/pkg/injection/context.go create mode 100644 vendor/knative.dev/pkg/injection/doc.go create mode 100644 vendor/knative.dev/pkg/injection/ducks.go create mode 100644 vendor/knative.dev/pkg/injection/factories.go create mode 100644 vendor/knative.dev/pkg/injection/informers.go create mode 100644 vendor/knative.dev/pkg/injection/injection.go create mode 100644 vendor/knative.dev/pkg/injection/interface.go create mode 100644 vendor/knative.dev/pkg/kmap/lookup.go create mode 100644 vendor/knative.dev/pkg/kmap/map.go create mode 100644 vendor/knative.dev/pkg/kmeta/OWNERS create mode 100644 vendor/knative.dev/pkg/kmeta/accessor.go create mode 100644 vendor/knative.dev/pkg/kmeta/doc.go create mode 100644 vendor/knative.dev/pkg/kmeta/labels.go create mode 100644 vendor/knative.dev/pkg/kmeta/map.go create mode 100644 vendor/knative.dev/pkg/kmeta/names.go create mode 100644 vendor/knative.dev/pkg/kmeta/owner_references.go create mode 100644 vendor/knative.dev/pkg/kmeta/ownerrefable_accessor.go create mode 100644 vendor/knative.dev/pkg/kmp/diff.go create mode 100644 vendor/knative.dev/pkg/kmp/doc.go create mode 100644 vendor/knative.dev/pkg/kmp/reporters.go create mode 100644 vendor/knative.dev/pkg/leaderelection/config.go create mode 100644 vendor/knative.dev/pkg/leaderelection/context.go create mode 100644 vendor/knative.dev/pkg/leaderelection/doc.go create mode 100644 vendor/knative.dev/pkg/logging/OWNERS create mode 100644 vendor/knative.dev/pkg/logging/config.go create mode 100644 vendor/knative.dev/pkg/logging/logger.go create mode 100644 vendor/knative.dev/pkg/logging/logkey/constants.go create mode 100644 vendor/knative.dev/pkg/logging/object_encoders.go create mode 100644 vendor/knative.dev/pkg/logging/warning_handler.go create mode 100644 vendor/knative.dev/pkg/logging/zz_generated.deepcopy.go create mode 100644 vendor/knative.dev/pkg/metrics/OWNERS create mode 100644 vendor/knative.dev/pkg/metrics/README.md create mode 100644 vendor/knative.dev/pkg/metrics/client.go create mode 100644 vendor/knative.dev/pkg/metrics/config.go create mode 100644 vendor/knative.dev/pkg/metrics/config_observability.go create mode 100644 vendor/knative.dev/pkg/metrics/doc.go create mode 100644 vendor/knative.dev/pkg/metrics/exporter.go create mode 100644 vendor/knative.dev/pkg/metrics/memstats.go create mode 100644 vendor/knative.dev/pkg/metrics/metrics.go create mode 100644 vendor/knative.dev/pkg/metrics/metrics_worker.go create mode 100644 vendor/knative.dev/pkg/metrics/metricskey/constants.go create mode 100644 vendor/knative.dev/pkg/metrics/opencensus_exporter.go create mode 100644 vendor/knative.dev/pkg/metrics/prometheus_exporter.go create mode 100644 vendor/knative.dev/pkg/metrics/record.go create mode 100644 vendor/knative.dev/pkg/metrics/resource_view.go create mode 100644 vendor/knative.dev/pkg/metrics/testing.go create mode 100644 vendor/knative.dev/pkg/metrics/utils.go create mode 100644 vendor/knative.dev/pkg/metrics/workqueue.go create mode 100644 vendor/knative.dev/pkg/metrics/zz_generated.deepcopy.go create mode 100644 vendor/knative.dev/pkg/network/OWNERS create mode 100644 vendor/knative.dev/pkg/network/doc.go create mode 100644 vendor/knative.dev/pkg/network/domain.go create mode 100644 vendor/knative.dev/pkg/network/error_handler.go create mode 100644 vendor/knative.dev/pkg/network/h2c.go create mode 100644 vendor/knative.dev/pkg/network/network.go create mode 100644 vendor/knative.dev/pkg/network/transports.go create mode 100644 vendor/knative.dev/pkg/ptr/doc.go create mode 100644 vendor/knative.dev/pkg/ptr/ptr.go create mode 100644 vendor/knative.dev/pkg/ptr/value.go create mode 100644 vendor/knative.dev/pkg/reconciler/OWNERS create mode 100644 vendor/knative.dev/pkg/reconciler/configstore.go create mode 100644 vendor/knative.dev/pkg/reconciler/deletion.go create mode 100644 vendor/knative.dev/pkg/reconciler/events.go create mode 100644 vendor/knative.dev/pkg/reconciler/filter.go create mode 100644 vendor/knative.dev/pkg/reconciler/leader.go create mode 100644 vendor/knative.dev/pkg/reconciler/reconcile_common.go create mode 100644 vendor/knative.dev/pkg/reconciler/retry.go create mode 100644 vendor/knative.dev/pkg/signals/signal.go create mode 100644 vendor/knative.dev/pkg/signals/signal_posix.go create mode 100644 vendor/knative.dev/pkg/signals/signal_windows.go create mode 100644 vendor/knative.dev/pkg/system/env.go create mode 100644 vendor/knative.dev/pkg/tracker/doc.go create mode 100644 vendor/knative.dev/pkg/tracker/enqueue.go create mode 100644 vendor/knative.dev/pkg/tracker/interface.go create mode 100644 vendor/knative.dev/pkg/tracker/zz_generated.deepcopy.go create mode 100644 vendor/sigs.k8s.io/json/CONTRIBUTING.md create mode 100644 vendor/sigs.k8s.io/json/LICENSE create mode 100644 vendor/sigs.k8s.io/json/Makefile create mode 100644 vendor/sigs.k8s.io/json/OWNERS create mode 100644 vendor/sigs.k8s.io/json/README.md create mode 100644 vendor/sigs.k8s.io/json/SECURITY.md create mode 100644 vendor/sigs.k8s.io/json/SECURITY_CONTACTS create mode 100644 vendor/sigs.k8s.io/json/code-of-conduct.md create mode 100644 vendor/sigs.k8s.io/json/doc.go create mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/decode.go create mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/encode.go create mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/fold.go create mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/fuzz.go create mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/indent.go create mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/kubernetes_patch.go create mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/scanner.go create mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/stream.go create mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/tables.go create mode 100644 vendor/sigs.k8s.io/json/internal/golang/encoding/json/tags.go create mode 100644 vendor/sigs.k8s.io/json/json.go create mode 100644 vendor/sigs.k8s.io/release-utils/LICENSE create mode 100644 vendor/sigs.k8s.io/release-utils/version/command.go create mode 100644 vendor/sigs.k8s.io/release-utils/version/doc.go create mode 100644 vendor/sigs.k8s.io/release-utils/version/version.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/LICENSE create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/doc.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/element.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/fromvalue.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/managers.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/path.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/pathelementmap.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/serialize-pe.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/serialize.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/fieldpath/set.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/schema/doc.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/schema/elements.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/schema/equals.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/schema/schemaschema.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/doc.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/helpers.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/merge.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/parser.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/reconcile_schema.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/remove.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/tofieldset.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/typed.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/union.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/typed/validate.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/allocator.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/doc.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/fields.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/jsontagutil.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/list.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/listreflect.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/listunstructured.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/map.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapreflect.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/mapunstructured.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/reflectcache.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/scalar.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/structreflect.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/value.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/valuereflect.go create mode 100644 vendor/sigs.k8s.io/structured-merge-diff/v4/value/valueunstructured.go diff --git a/.ko.yaml b/.ko.yaml index fe71c7d1ca..a50c850f1f 100644 --- a/.ko.yaml +++ b/.ko.yaml @@ -1,7 +1,30 @@ baseImageOverrides: - github.com/google/ko: golang:1.19 + github.com/google/ko: cgr.dev/chainguard/go builds: - id: ko ldflags: - "{{ .Env.LDFLAGS }}" + +verification: + # Override the default of "warn" to "deny" + noMatchPolicy: deny + policies: + # Expand the default base image policy (covers static) to include + # all Chainguard images (namely Go, see above). + - data: | + apiVersion: policy.sigstore.dev/v1beta1 + kind: ClusterImagePolicy + metadata: + name: chainguard-images + spec: + images: + - glob: cgr.dev/chainguard/** + authorities: + - keyless: + url: https://fulcio.sigstore.dev + identities: + - issuer: https://token.actions.githubusercontent.com + subject: https://github.com/chainguard-images/images/.github/workflows/release.yaml@refs/heads/main + ctlog: + url: https://rekor.sigstore.dev diff --git a/go.mod b/go.mod index af4731a5ad..b633f32830 100644 --- a/go.mod +++ b/go.mod @@ -3,30 +3,38 @@ module github.com/google/ko go 1.18 require ( - github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20220517224237-e6f29200ae04 - github.com/chrismellard/docker-credential-acr-env v0.0.0-20220327082430-c57b701bfc08 + github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20221027043306-dc425bc05c64 + github.com/chrismellard/docker-credential-acr-env v0.0.0-20221002210726-e883f69e0206 github.com/containerd/stargz-snapshotter/estargz v0.13.0 github.com/docker/docker v20.10.22+incompatible github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 github.com/go-training/helloworld v0.0.0-20200225145412-ba5f4379d78b github.com/google/go-cmp v0.5.9 - github.com/google/go-containerregistry v0.12.1 + github.com/google/go-containerregistry v0.12.2-0.20221114162634-781782aa2757 github.com/opencontainers/image-spec v1.1.0-rc2 github.com/sigstore/cosign v1.13.1 + github.com/sigstore/policy-controller v0.5.2 github.com/spf13/cobra v1.6.1 github.com/spf13/viper v1.14.0 go.uber.org/automaxprocs v1.5.1 golang.org/x/sync v0.1.0 golang.org/x/tools v0.4.0 gopkg.in/yaml.v3 v3.0.1 + k8s.io/api v0.26.0 k8s.io/apimachinery v0.26.0 + knative.dev/pkg v0.0.0-20221221230956-4fd6eb8652b7 sigs.k8s.io/kind v0.17.0 + sigs.k8s.io/yaml v1.3.0 ) require ( - cloud.google.com/go/compute v1.12.1 // indirect - cloud.google.com/go/compute/metadata v0.2.1 // indirect - github.com/Azure/azure-sdk-for-go v66.0.0+incompatible // indirect + cloud.google.com/go/compute v1.13.0 // indirect + cloud.google.com/go/compute/metadata v0.2.2 // indirect + contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d // indirect + contrib.go.opencensus.io/exporter/prometheus v0.4.2 // indirect + cuelang.org/go v0.4.3 // indirect + github.com/AliyunContainerService/ack-ram-tool/pkg/credentials/alibabacloudsdkgo/helper v0.2.0 // indirect + github.com/Azure/azure-sdk-for-go v67.1.0+incompatible // indirect github.com/Azure/go-autorest v14.2.0+incompatible // indirect github.com/Azure/go-autorest/autorest v0.11.28 // indirect github.com/Azure/go-autorest/autorest/adal v0.9.21 // indirect @@ -37,31 +45,60 @@ require ( github.com/Azure/go-autorest/tracing v0.6.0 // indirect github.com/BurntSushi/toml v1.1.0 // indirect github.com/Microsoft/go-winio v0.6.0 // indirect + github.com/OneOfOne/xxhash v1.2.8 // indirect + github.com/ThalesIgnite/crypto11 v1.2.5 // indirect + github.com/agnivade/levenshtein v1.1.1 // indirect github.com/alessio/shellescape v1.4.1 // indirect + github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 // indirect + github.com/alibabacloud-go/cr-20160607 v1.0.1 // indirect + github.com/alibabacloud-go/cr-20181201 v1.0.10 // indirect + github.com/alibabacloud-go/darabonba-openapi v0.2.1 // indirect + github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect + github.com/alibabacloud-go/endpoint-util v1.1.1 // indirect + github.com/alibabacloud-go/openapi-util v0.0.11 // indirect + github.com/alibabacloud-go/tea v1.1.20 // indirect + github.com/alibabacloud-go/tea-utils v1.4.5 // indirect + github.com/alibabacloud-go/tea-xml v1.1.2 // indirect + github.com/aliyun/credentials-go v1.2.4 // indirect github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect - github.com/aws/aws-sdk-go-v2 v1.16.16 // indirect - github.com/aws/aws-sdk-go-v2/config v1.17.8 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.12.21 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.17 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.23 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.17 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.24 // indirect - github.com/aws/aws-sdk-go-v2/service/ecr v1.17.5 // indirect - github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.13.5 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.17 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.11.23 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.6 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.16.19 // indirect - github.com/aws/smithy-go v1.13.3 // indirect + github.com/aws/aws-sdk-go-v2 v1.17.2 // indirect + github.com/aws/aws-sdk-go-v2/config v1.18.4 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.13.4 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.26 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.20 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27 // indirect + github.com/aws/aws-sdk-go-v2/service/ecr v1.17.20 // indirect + github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.13.19 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.11.26 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.17.6 // indirect + github.com/aws/smithy-go v1.13.5 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/blang/semver v3.5.1+incompatible // indirect + github.com/blendle/zapdriver v1.3.1 // indirect + github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect + github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/clbanning/mxj/v2 v2.5.6 // indirect + github.com/cockroachdb/apd/v2 v2.0.2 // indirect + github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect + github.com/cyberphone/json-canonicalization v0.0.0-20220623050100-57a0ce2678a7 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/dimchansky/utfbom v1.1.1 // indirect - github.com/docker/cli v20.10.20+incompatible // indirect + github.com/docker/cli v20.10.21+incompatible // indirect github.com/docker/distribution v2.8.1+incompatible // indirect github.com/docker/docker-credential-helpers v0.7.0 // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect + github.com/emicklei/go-restful/v3 v3.9.0 // indirect github.com/evanphx/json-patch/v5 v5.6.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/ghodss/yaml v1.0.0 // indirect + github.com/go-chi/chi v4.1.2+incompatible // indirect + github.com/go-kit/log v0.2.1 // indirect + github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-logr/logr v1.2.3 // indirect github.com/go-openapi/analysis v0.21.4 // indirect github.com/go-openapi/errors v0.20.3 // indirect @@ -73,54 +110,120 @@ require ( github.com/go-openapi/strfmt v0.21.3 // indirect github.com/go-openapi/swag v0.22.3 // indirect github.com/go-openapi/validate v0.22.0 // indirect + github.com/go-playground/locales v0.14.0 // indirect + github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/go-playground/validator/v10 v10.11.1 // indirect + github.com/gobwas/glob v0.2.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.4.2 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/snappy v0.0.4 // indirect + github.com/google/certificate-transparency-go v1.1.4 // indirect + github.com/google/gnostic v0.6.9 // indirect + github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20221114162634-781782aa2757 // indirect + github.com/google/go-containerregistry/pkg/authn/kubernetes v0.0.0-20221114162634-781782aa2757 // indirect + github.com/google/go-github/v45 v45.2.0 // indirect + github.com/google/go-querystring v1.1.0 // indirect + github.com/google/gofuzz v1.2.0 // indirect github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 // indirect + github.com/google/trillian v1.5.1-0.20220819043421-0a389c4bb8d9 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-retryablehttp v0.7.1 // indirect + github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/imdario/mergo v0.3.13 // indirect + github.com/in-toto/in-toto-golang v0.5.0 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect + github.com/jedisct1/go-minisign v0.0.0-20211028175153-1c139d1cc84b // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/kelseyhightower/envconfig v1.4.0 // indirect github.com/klauspost/compress v1.15.12 // indirect - github.com/letsencrypt/boulder v0.0.0-20220929215747-76583552c2be // indirect + github.com/leodido/go-urn v1.2.1 // indirect + github.com/letsencrypt/boulder v0.0.0-20221109233200-85aa52084eaf // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-isatty v0.0.16 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect + github.com/miekg/pkcs11 v1.1.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/mozillazg/docker-credential-acr-helper v0.3.0 // indirect + github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oklog/ulid v1.3.1 // indirect + github.com/open-policy-agent/opa v0.45.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/pkg/errors v0.9.1 // indirect + github.com/prometheus/client_golang v1.13.0 // indirect + github.com/prometheus/client_model v0.3.0 // indirect + github.com/prometheus/common v0.37.0 // indirect + github.com/prometheus/procfs v0.8.0 // indirect + github.com/prometheus/statsd_exporter v0.22.8 // indirect + github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/sigstore/rekor v0.12.1-0.20220915152154-4bb6f441c1b2 // indirect - github.com/sigstore/sigstore v1.4.4 // indirect + github.com/sassoftware/relic v0.0.0-20210427151427-dfb082b79b74 // indirect + github.com/secure-systems-lab/go-securesystemslib v0.4.0 // indirect + github.com/shibumi/go-pathspec v1.3.0 // indirect + github.com/sigstore/rekor v1.0.1 // indirect + github.com/sigstore/sigstore v1.5.0 // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/spf13/afero v1.9.2 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.4.1 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect + github.com/tchap/go-patricia/v2 v2.3.1 // indirect + github.com/tent/canonical-json-go v0.0.0-20130607151641-96e4ba3a7613 // indirect + github.com/thales-e-security/pool v0.0.2 // indirect github.com/theupdateframework/go-tuf v0.5.2-0.20220930112810-3890c1e7ace4 // indirect github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 // indirect + github.com/tjfoc/gmsm v1.4.1 // indirect + github.com/transparency-dev/merkle v0.0.1 // indirect github.com/vbatts/tar-split v0.11.2 // indirect - go.mongodb.org/mongo-driver v1.10.2 // indirect - golang.org/x/crypto v0.1.0 // indirect + github.com/xanzy/go-gitlab v0.73.1 // indirect + github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect + github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect + github.com/yashtewari/glob-intersection v0.1.0 // indirect + go.mongodb.org/mongo-driver v1.10.3 // indirect + go.opencensus.io v0.24.0 // indirect + go.uber.org/atomic v1.10.0 // indirect + go.uber.org/multierr v1.8.0 // indirect + go.uber.org/zap v1.24.0 // indirect + golang.org/x/crypto v0.4.0 // indirect + golang.org/x/exp v0.0.0-20221026153819-32f3d567a233 // indirect golang.org/x/mod v0.7.0 // indirect - golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 // indirect - golang.org/x/oauth2 v0.1.0 // indirect + golang.org/x/net v0.4.0 // indirect + golang.org/x/oauth2 v0.3.0 // indirect golang.org/x/sys v0.3.0 // indirect golang.org/x/term v0.3.0 // indirect golang.org/x/text v0.5.0 // indirect + golang.org/x/time v0.3.0 // indirect + gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect + google.golang.org/api v0.104.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e // indirect - google.golang.org/grpc v1.50.1 // indirect + google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6 // indirect + google.golang.org/grpc v1.51.0 // indirect google.golang.org/protobuf v1.28.1 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/square/go-jose.v2 v2.6.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - k8s.io/klog/v2 v2.80.1 // indirect - k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect - sigs.k8s.io/yaml v1.3.0 // indirect + k8s.io/client-go v0.25.4 // indirect + k8s.io/klog/v2 v2.80.2-0.20221028030830-9ae4992afb54 // indirect + k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect + k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 // indirect + sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect + sigs.k8s.io/release-utils v0.7.3 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect ) diff --git a/go.sum b/go.sum index 75cf4b3ee8..11bdab80ab 100644 --- a/go.sum +++ b/go.sum @@ -23,10 +23,10 @@ cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvf cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/compute v1.12.1 h1:gKVJMEyqV5c/UnpzjjQbo3Rjvvqpr9B1DFSbJC4OXr0= -cloud.google.com/go/compute v1.12.1/go.mod h1:e8yNOBcBONZU1vJKCvCoDw/4JQsA0dpM4x/6PIIOocU= -cloud.google.com/go/compute/metadata v0.2.1 h1:efOwf5ymceDhK6PKMnnrTHP4pppY5L22mle96M1yP48= -cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= +cloud.google.com/go/compute v1.13.0 h1:AYrLkB8NPdDRslNp4Jxmzrhdr03fUAIDbiGFjLWowoU= +cloud.google.com/go/compute v1.13.0/go.mod h1:5aPTS0cUNMIc1CE546K+Th6weJUNQErARyZtRXDJ8GE= +cloud.google.com/go/compute/metadata v0.2.2 h1:aWKAjYaBaOSrpKl57+jnS/3fJRQnxL7TvR/u1VVbt6k= +cloud.google.com/go/compute/metadata v0.2.2/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= @@ -39,9 +39,17 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= +contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d h1:LblfooH1lKOpp1hIhukktmSAxFkqMPFk9KR6iZ0MJNI= +contrib.go.opencensus.io/exporter/ocagent v0.7.1-0.20200907061046-05415f1de66d/go.mod h1:IshRmMJBhDfFj5Y67nVhMYTTIze91RUeT73ipWKs/GY= +contrib.go.opencensus.io/exporter/prometheus v0.4.2 h1:sqfsYl5GIY/L570iT+l93ehxaWJs2/OwXtiWwew3oAg= +contrib.go.opencensus.io/exporter/prometheus v0.4.2/go.mod h1:dvEHbiKmgvbr5pjaF9fpw1KeYcjrnC1J8B+JKjsZyRQ= +cuelang.org/go v0.4.3 h1:W3oBBjDTm7+IZfCKZAmC8uDG0eYfJL4Pp/xbbCMKaVo= +cuelang.org/go v0.4.3/go.mod h1:7805vR9H+VoBNdWFdI7jyDR3QLUPp4+naHfbcgp55HI= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/Azure/azure-sdk-for-go v66.0.0+incompatible h1:bmmC38SlE8/E81nNADlgmVGurPWMHDX2YNXVQMrBpEE= -github.com/Azure/azure-sdk-for-go v66.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/AliyunContainerService/ack-ram-tool/pkg/credentials/alibabacloudsdkgo/helper v0.2.0 h1:8+4G8JaejP8Xa6W46PzJEwisNgBXMvFcz78N6zG/ARw= +github.com/AliyunContainerService/ack-ram-tool/pkg/credentials/alibabacloudsdkgo/helper v0.2.0/go.mod h1:GgeIE+1be8Ivm7Sh4RgwI42aTtC9qrcj+Y9Y6CjJhJs= +github.com/Azure/azure-sdk-for-go v67.1.0+incompatible h1:oziYcaopbnIKfM69DL05wXdypiqfrUKdxUKrKpynJTw= +github.com/Azure/azure-sdk-for-go v67.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= @@ -61,6 +69,8 @@ github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSY github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k= github.com/Azure/go-autorest/autorest/mocks v0.4.2 h1:PGN4EDXnuQbojHbU0UWoNvmu9AGVwYHG9/fkDYhtAfw= github.com/Azure/go-autorest/autorest/mocks v0.4.2/go.mod h1:Vy7OitM9Kei0i1Oj+LvyAWMXJHeKH1MVlzFugfVrmyU= +github.com/Azure/go-autorest/autorest/to v0.4.0 h1:oXVqrxakqqV1UZdSazDOPOLvOIz+XA683u8EctwboHk= +github.com/Azure/go-autorest/autorest/validation v0.3.1 h1:AgyqjAd94fwNAoTjl/WQXg4VvFeRFpO+UhNyRXqF1ac= github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+ZtXWSmf4Tg= github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= @@ -72,89 +82,188 @@ github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbi github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8= +github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= +github.com/ThalesIgnite/crypto11 v1.2.5 h1:1IiIIEqYmBvUYFeMnHqRft4bwf/O36jryEUpY+9ef8E= +github.com/ThalesIgnite/crypto11 v1.2.5/go.mod h1:ILDKtnCKiQ7zRoNxcp36Y1ZR8LBPmR2E23+wTQe/MlE= +github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8= +github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= github.com/alessio/shellescape v1.4.1/go.mod h1:PZAiSCk0LJaZkiCSkPv8qIobYglO3FPpyFjDCtHLS30= +github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.2/go.mod h1:sCavSAvdzOjul4cEqeVtvlSaSScfNsTQ+46HwlTL1hc= +github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 h1:iC9YFYKDGEy3n/FtqJnOkZsene9olVspKmkX5A2YBEo= +github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4/go.mod h1:sCavSAvdzOjul4cEqeVtvlSaSScfNsTQ+46HwlTL1hc= +github.com/alibabacloud-go/cr-20160607 v1.0.1 h1:WEnP1iPFKJU74ryUKh/YDPHoxMZawqlPajOymyNAkts= +github.com/alibabacloud-go/cr-20160607 v1.0.1/go.mod h1:QHeKZtZ3F3FOE+/uIXCBAp8POwnUYekpLwr1dtQa5r0= +github.com/alibabacloud-go/cr-20181201 v1.0.10 h1:B60f6S1imsgn2fgC6X6FrVNrONDrbCT0NwYhsJ0C9/c= +github.com/alibabacloud-go/cr-20181201 v1.0.10/go.mod h1:VN9orB/w5G20FjytoSpZROqu9ZqxwycASmGqYUJSoDc= +github.com/alibabacloud-go/darabonba-openapi v0.1.12/go.mod h1:sTAjsFJmVsmcVeklL9d9uDBlFsgl43wZ6jhI6BHqHqU= +github.com/alibabacloud-go/darabonba-openapi v0.1.14/go.mod h1:w4CosR7O/kapCtEEMBm3JsQqWBU/CnZ2o0pHorsTWDI= +github.com/alibabacloud-go/darabonba-openapi v0.2.1 h1:WyzxxKvhdVDlwpAMOHgAiCJ+NXa6g5ZWPFEzaK/ewwY= +github.com/alibabacloud-go/darabonba-openapi v0.2.1/go.mod h1:zXOqLbpIqq543oioL9IuuZYOQgHQ5B8/n5OPrnko8aY= +github.com/alibabacloud-go/darabonba-string v1.0.0/go.mod h1:93cTfV3vuPhhEwGGpKKqhVW4jLe7tDpo3LUM0i0g6mA= +github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 h1:NqugFkGxx1TXSh/pBcU00Y6bljgDPaFdh5MUSeJ7e50= +github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68/go.mod h1:6pb/Qy8c+lqua8cFpEy7g39NRRqOWc3rOwAy8m5Y2BY= +github.com/alibabacloud-go/endpoint-util v1.1.0/go.mod h1:O5FuCALmCKs2Ff7JFJMudHs0I5EBgecXXxZRyswlEjE= +github.com/alibabacloud-go/endpoint-util v1.1.1 h1:ZkBv2/jnghxtU0p+upSU0GGzW1VL9GQdZO3mcSUTUy8= +github.com/alibabacloud-go/endpoint-util v1.1.1/go.mod h1:O5FuCALmCKs2Ff7JFJMudHs0I5EBgecXXxZRyswlEjE= +github.com/alibabacloud-go/openapi-util v0.0.9/go.mod h1:sQuElr4ywwFRlCCberQwKRFhRzIyG4QTP/P4y1CJ6Ws= +github.com/alibabacloud-go/openapi-util v0.0.10/go.mod h1:sQuElr4ywwFRlCCberQwKRFhRzIyG4QTP/P4y1CJ6Ws= +github.com/alibabacloud-go/openapi-util v0.0.11 h1:iYnqOPR5hyEEnNZmebGyRMkkEJRWUEjDiiaOHZ5aNhA= +github.com/alibabacloud-go/openapi-util v0.0.11/go.mod h1:sQuElr4ywwFRlCCberQwKRFhRzIyG4QTP/P4y1CJ6Ws= +github.com/alibabacloud-go/tea v1.1.0/go.mod h1:IkGyUSX4Ba1V+k4pCtJUc6jDpZLFph9QMy2VUPTwukg= +github.com/alibabacloud-go/tea v1.1.7/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4= +github.com/alibabacloud-go/tea v1.1.8/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4= +github.com/alibabacloud-go/tea v1.1.11/go.mod h1:/tmnEaQMyb4Ky1/5D+SE1BAsa5zj/KeGOFfwYm3N/p4= +github.com/alibabacloud-go/tea v1.1.17/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A= +github.com/alibabacloud-go/tea v1.1.19/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A= +github.com/alibabacloud-go/tea v1.1.20 h1:wFK4xEbvGYMtzTyHhIju9D7ecWxvSUdoLO6y4vDLFik= +github.com/alibabacloud-go/tea v1.1.20/go.mod h1:nXxjm6CIFkBhwW4FQkNrolwbfon8Svy6cujmKFUq98A= +github.com/alibabacloud-go/tea-utils v1.3.1/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE= +github.com/alibabacloud-go/tea-utils v1.3.9/go.mod h1:EI/o33aBfj3hETm4RLiAxF/ThQdSngxrpF8rKUDJjPE= +github.com/alibabacloud-go/tea-utils v1.4.3/go.mod h1:KNcT0oXlZZxOXINnZBs6YvgOd5aYp9U67G+E3R8fcQw= +github.com/alibabacloud-go/tea-utils v1.4.5 h1:h0/6Xd2f3bPE4XHTvkpjwxowIwRCJAJOqY6Eq8f3zfA= +github.com/alibabacloud-go/tea-utils v1.4.5/go.mod h1:KNcT0oXlZZxOXINnZBs6YvgOd5aYp9U67G+E3R8fcQw= +github.com/alibabacloud-go/tea-xml v1.1.2 h1:oLxa7JUXm2EDFzMg+7oRsYc+kutgCVwm+bZlhhmvW5M= +github.com/alibabacloud-go/tea-xml v1.1.2/go.mod h1:Rq08vgCcCAjHyRi/M7xlHKUykZCEtyBy9+DPF6GgEu8= +github.com/aliyun/credentials-go v1.1.2/go.mod h1:ozcZaMR5kLM7pwtCMEpVmQ242suV6qTJya2bDq4X1Tw= +github.com/aliyun/credentials-go v1.2.4 h1:qu8c21BCvbaPJArEcsSk7GbSdxYFiACCjYzkEKCoeLA= +github.com/aliyun/credentials-go v1.2.4/go.mod h1:/KowD1cfGSLrLsH28Jr8W+xwoId0ywIy5lNzDz6O1vw= +github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= +github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= +github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= github.com/asaskevich/govalidator v0.0.0-20200907205600-7a23bdc65eef/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/aws/aws-sdk-go-v2 v1.7.1/go.mod h1:L5LuPC1ZgDr2xQS7AmIec/Jlc7O/Y1u2KxJyNVab250= -github.com/aws/aws-sdk-go-v2 v1.16.4/go.mod h1:ytwTPBG6fXTZLxxeeCCWj2/EMYp/xDUgX+OET6TLNNU= -github.com/aws/aws-sdk-go-v2 v1.16.16 h1:M1fj4FE2lB4NzRb9Y0xdWsn2P0+2UHVxwKyOa4YJNjk= -github.com/aws/aws-sdk-go-v2 v1.16.16/go.mod h1:SwiyXi/1zTUZ6KIAmLK5V5ll8SiURNUYOqTerZPaF9k= -github.com/aws/aws-sdk-go-v2/config v1.5.0/go.mod h1:RWlPOAW3E3tbtNAqTwvSW54Of/yP3oiZXMI0xfUdjyA= -github.com/aws/aws-sdk-go-v2/config v1.17.8 h1:b9LGqNnOdg9vR4Q43tBTVWk4J6F+W774MSchvKJsqnE= -github.com/aws/aws-sdk-go-v2/config v1.17.8/go.mod h1:UkCI3kb0sCdvtjiXYiU4Zx5h07BOpgBTtkPu/49r+kA= -github.com/aws/aws-sdk-go-v2/credentials v1.3.1/go.mod h1:r0n73xwsIVagq8RsxmZbGSRQFj9As3je72C2WzUIToc= -github.com/aws/aws-sdk-go-v2/credentials v1.12.21 h1:4tjlyCD0hRGNQivh5dN8hbP30qQhMLBE/FgQR1vHHWM= -github.com/aws/aws-sdk-go-v2/credentials v1.12.21/go.mod h1:O+4XyAt4e+oBAoIwNUYkRg3CVMscaIJdmZBOcPgJ8D8= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.3.0/go.mod h1:2LAuqPx1I6jNfaGDucWfA2zqQCYCOMCDHiCOciALyNw= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.17 h1:r08j4sbZu/RVi+BNxkBJwPMUYY3P8mgSDuKkZ/ZN1lE= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.17/go.mod h1:yIkQcCDYNsZfXpd5UX2Cy+sWA1jPgIhGTw9cOBzfVnQ= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.11/go.mod h1:tmUB6jakq5DFNcXsXOA/ZQ7/C8VnSKYkx58OI7Fh79g= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.23 h1:s4g/wnzMf+qepSNgTvaQQHNxyMLKSawNhKCPNy++2xY= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.23/go.mod h1:2DFxAQ9pfIRy0imBCJv+vZ2X6RKxves6fbnEuSry6b4= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.5/go.mod h1:fV1AaS2gFc1tM0RCb015FJ0pvWVUfJZANzjwoO4YakM= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.17 h1:/K482T5A3623WJgWT8w1yRAFK4RzGzEl7y39yhtn9eA= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.17/go.mod h1:pRwaTYCJemADaqCbUAxltMoHKata7hmB5PjEXeu0kfg= -github.com/aws/aws-sdk-go-v2/internal/ini v1.1.1/go.mod h1:Zy8smImhTdOETZqfyn01iNOe0CNggVbPjCajyaz6Gvg= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.24 h1:wj5Rwc05hvUSvKuOF29IYb9QrCLjU+rHAy/x/o0DK2c= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.24/go.mod h1:jULHjqqjDlbyTa7pfM7WICATnOv+iOhjletM3N0Xbu8= -github.com/aws/aws-sdk-go-v2/service/ecr v1.4.1/go.mod h1:FglZcyeiBqcbvyinl+n14aT/EWC7S1MIH+Gan2iizt0= -github.com/aws/aws-sdk-go-v2/service/ecr v1.17.5 h1:W9vzPbvX7rOa/FacbQIDfnNrwxHkn5O+DdfmiIS4cHc= -github.com/aws/aws-sdk-go-v2/service/ecr v1.17.5/go.mod h1:vk2+DbeZQFXznxJZSMnYrfnCHYxg4oT4Mdh59wSCkw4= -github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.4.1/go.mod h1:eD5Eo4drVP2FLTw0G+SMIPWNWvQRGGTtIZR2XeAagoA= -github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.13.5 h1:Y8dpvUxU4JecYktR5oNFEW+HmUWlA1Oh7mboTVyQWLg= -github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.13.5/go.mod h1:gW979HGZOrhGvwjAS6VRgav6M9AYH9Kbey6y3GfF/EA= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.2.1/go.mod h1:zceowr5Z1Nh2WVP8bf/3ikB41IZW59E4yIYbg+pC6mw= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.17 h1:Jrd/oMh0PKQc6+BowB+pLEwLIgaQF29eYbe7E1Av9Ug= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.17/go.mod h1:4nYOrY41Lrbk2170/BGkcJKBhws9Pfn8MG3aGqjjeFI= -github.com/aws/aws-sdk-go-v2/service/sso v1.3.1/go.mod h1:J3A3RGUvuCZjvSuZEcOpHDnzZP/sKbhDWV2T1EOzFIM= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.23 h1:pwvCchFUEnlceKIgPUouBJwK81aCkQ8UDMORfeFtW10= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.23/go.mod h1:/w0eg9IhFGjGyyncHIQrXtU8wvNsTJOP0R6PPj0wf80= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.6 h1:OwhhKc1P9ElfWbMKPIbMMZBV6hzJlL2JKD76wNNVzgQ= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.6/go.mod h1:csZuQY65DAdFBt1oIjO5hhBR49kQqop4+lcuCjf2arA= -github.com/aws/aws-sdk-go-v2/service/sts v1.6.0/go.mod h1:q7o0j7d7HrJk/vr9uUt3BVRASvcU7gYZB9PUgPiByXg= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.19 h1:9pPi0PsFNAGILFfPCk8Y0iyEBGc6lu6OQ97U7hmdesg= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.19/go.mod h1:h4J3oPZQbxLhzGnk+j9dfYHi5qIOVJ5kczZd658/ydM= -github.com/aws/smithy-go v1.6.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= -github.com/aws/smithy-go v1.11.2/go.mod h1:3xHYmszWVx2c0kIwQeEVf9uSm4fYZt67FBJnwub1bgM= -github.com/aws/smithy-go v1.13.3 h1:l7LYxGuzK6/K+NzJ2mC+VvLUbae0sL3bXU//04MkmnA= -github.com/aws/smithy-go v1.13.3/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= -github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20220517224237-e6f29200ae04 h1:p2I85zYI9z5/c/3Q0LiO3RtNXcmXHTtJfml/hV16zNg= -github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20220517224237-e6f29200ae04/go.mod h1:Z+bXnIbhKJYSvxNwsNnwde7pDKxuqlEZCbUBoTwAqf0= +github.com/aws/aws-sdk-go-v2 v1.17.1/go.mod h1:JLnGeGONAyi2lWXI1p0PCIOIy333JMVK1U7Hf0aRFLw= +github.com/aws/aws-sdk-go-v2 v1.17.2 h1:r0yRZInwiPBNpQ4aDy/Ssh3ROWsGtKDwar2JS8Lm+N8= +github.com/aws/aws-sdk-go-v2 v1.17.2/go.mod h1:uzbQtefpm44goOPmdKyAlXSNcwlRgF3ePWVW6EtJvvw= +github.com/aws/aws-sdk-go-v2/config v1.17.10/go.mod h1:/4np+UiJJKpWHN7Q+LZvqXYgyjgeXm5+lLfDI6TPZao= +github.com/aws/aws-sdk-go-v2/config v1.18.4 h1:VZKhr3uAADXHStS/Gf9xSYVmmaluTUfkc0dcbPiDsKE= +github.com/aws/aws-sdk-go-v2/config v1.18.4/go.mod h1:EZxMPLSdGAZ3eAmkqXfYbRppZJTzFTkv8VyEzJhKko4= +github.com/aws/aws-sdk-go-v2/credentials v1.12.23/go.mod h1:0awX9iRr/+UO7OwRQFpV1hNtXxOVuehpjVEzrIAYNcA= +github.com/aws/aws-sdk-go-v2/credentials v1.13.4 h1:nEbHIyJy7mCvQ/kzGG7VWHSBpRB4H6sJy3bWierWUtg= +github.com/aws/aws-sdk-go-v2/credentials v1.13.4/go.mod h1:/Cj5w9LRsNTLSwexsohwDME32OzJ6U81Zs33zr2ZWOM= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.19/go.mod h1:VihW95zQpeKQWVPGkwT+2+WJNQV8UXFfMTWdU6VErL8= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20 h1:tpNOglTZ8kg9T38NpcGBxudqfUAwUzyUnLQ4XSd0CHE= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.20/go.mod h1:d9xFpWd3qYwdIXM0fvu7deD08vvdRXyc/ueV+0SqaWE= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.25/go.mod h1:Zb29PYkf42vVYQY6pvSyJCJcFHlPIiY+YKdPtwnvMkY= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.26 h1:5WU31cY7m0tG+AiaXuXGoMzo2GBQ1IixtWa8Yywsgco= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.26/go.mod h1:2E0LdbJW6lbeU4uxjum99GZzI0ZjDpAb0CoSCM0oeEY= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.19/go.mod h1:6Q0546uHDp421okhmmGfbxzq2hBqbXFNpi4k+Q1JnQA= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.20 h1:WW0qSzDWoiWU2FS5DbKpxGilFVlCEJPwx4YtjdfI0Jw= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.20/go.mod h1:/+6lSiby8TBFpTVXZgKiN/rCfkYXEGvhlM4zCgPpt7w= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.26/go.mod h1:Y2OJ+P+MC1u1VKnavT+PshiEuGPyh/7DqxoDNij4/bg= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27 h1:N2eKFw2S+JWRCtTt0IhIX7uoGGQciD4p6ba+SJv4WEU= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.27/go.mod h1:RdwFVc7PBYWY33fa2+8T1mSqQ7ZEK4ILpM0wfioDC3w= +github.com/aws/aws-sdk-go-v2/service/ecr v1.17.20 h1:nJnXfQggNZdrWz/0cm2ZGyddGK+FqTiN4QJGanzKZoY= +github.com/aws/aws-sdk-go-v2/service/ecr v1.17.20/go.mod h1:kEVGiy2tACP0cegVqx4MrjsgQMSgrtgRq1fSa+Ix6F0= +github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.13.19 h1:AwWP9a5n9a6kcgpTOfZ2/AeHKdq1Cb+HwgWQ1ADqiZM= +github.com/aws/aws-sdk-go-v2/service/ecrpublic v1.13.19/go.mod h1:j3mVo8gEwXjgzf9PfORBnYUUQnnjkd4OY6y5JmubV94= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.19/go.mod h1:02CP6iuYP+IVnBX5HULVdSAku/85eHB2Y9EsFhrkEwU= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20 h1:jlgyHbkZQAgAc7VIxJDmtouH8eNjOk2REVAQfVhdaiQ= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.20/go.mod h1:Xs52xaLBqDEKRcAfX/hgjmD3YQ7c/W+BEyfamlO/W2E= +github.com/aws/aws-sdk-go-v2/service/kms v1.19.2 h1:pgOVfu7E6zBddKGks4TvL4YuFsL/oTpiWDIzs4WPLjY= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.25/go.mod h1:IARHuzTXmj1C0KS35vboR0FeJ89OkEy1M9mWbK2ifCI= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.26 h1:ActQgdTNQej/RuUJjB9uxYVLDOvRGtUreXF8L3c8wyg= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.26/go.mod h1:uB9tV79ULEZUXc6Ob18A46KSQ0JDlrplPni9XW6Ot60= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.8/go.mod h1:er2JHN+kBY6FcMfcBBKNGCT3CarImmdFzishsqBmSRI= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9 h1:wihKuqYUlA2T/Rx+yu2s6NDAns8B9DgnRooB1PVhY+Q= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.13.9/go.mod h1:2E/3D/mB8/r2J7nK42daoKP/ooCwbf0q1PznNc+DZTU= +github.com/aws/aws-sdk-go-v2/service/sts v1.17.1/go.mod h1:bXcN3koeVYiJcdDU89n3kCYILob7Y34AeLopUbZgLT4= +github.com/aws/aws-sdk-go-v2/service/sts v1.17.6 h1:VQFOLQVL3BrKM/NLO/7FiS4vcp5bqK0mGMyk09xLoAY= +github.com/aws/aws-sdk-go-v2/service/sts v1.17.6/go.mod h1:Az3OXXYGyfNwQNsK/31L4R75qFYnO641RZGAoV3uH1c= +github.com/aws/smithy-go v1.13.4/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/smithy-go v1.13.5 h1:hgz0X/DX0dGqTYpGALqXJoRKRj5oQ7150i5FdTePzO8= +github.com/aws/smithy-go v1.13.5/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20221027043306-dc425bc05c64 h1:J+6PUCOmCU9A2iZDGsTGxdycxybJMp+fbFEMWWsQUgg= +github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20221027043306-dc425bc05c64/go.mod h1:oqbjAk8VeItfKctyahGuAyU61z4d0Fi1gHmlWjHWsMM= +github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A= +github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= +github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/blendle/zapdriver v1.3.1 h1:C3dydBOWYRiOk+B8X9IVZ5IOe+7cl+tGOexN4QqHfpE= +github.com/blendle/zapdriver v1.3.1/go.mod h1:mdXfREi6u5MArG4j9fewC+FGnXaBR+T4Ox4J2u4eHCc= +github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= +github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0= +github.com/bytecodealliance/wasmtime-go v1.0.0 h1:9u9gqaUiaJeN5IoD1L7egD8atOnTGyJcNp8BhkL9cUU= +github.com/cenkalti/backoff/v3 v3.2.2 h1:cfUAAO3yvKMYKPrvhDuHSwQnhZNk/RMHKdZqKTxfm6M= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/census-instrumentation/opencensus-proto v0.4.1 h1:iKLQ0xPNFxR/2hzXZMrBo8f1j86j5WHzznCCQxV/b8g= +github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= -github.com/chrismellard/docker-credential-acr-env v0.0.0-20220327082430-c57b701bfc08 h1:9Qh4lJ/KMr5iS1zfZ8I97+3MDpiKjl+0lZVUNBhdvRs= -github.com/chrismellard/docker-credential-acr-env v0.0.0-20220327082430-c57b701bfc08/go.mod h1:MAuu1uDJNOS3T3ui0qmKdPUwm59+bO19BbTph2wZafE= +github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chrismellard/docker-credential-acr-env v0.0.0-20221002210726-e883f69e0206 h1:lG6Usi/kX/JBZzGz1H+nV+KwM97vThQeKunCbS6PutU= +github.com/chrismellard/docker-credential-acr-env v0.0.0-20221002210726-e883f69e0206/go.mod h1:1UmFRnmMnVsHwD+ZntmLkoVBB1ZLa6V+XXEbF6hZCxU= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/clbanning/mxj/v2 v2.5.5/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s= +github.com/clbanning/mxj/v2 v2.5.6 h1:Jm4VaCI/+Ug5Q57IzEoZbwx4iQFA6wkXv72juUSeK+g= +github.com/clbanning/mxj/v2 v2.5.6/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn/Qo+ve2s= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= +github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= +github.com/codahale/rfc6979 v0.0.0-20141003034818-6a90f24967eb h1:EDmT6Q9Zs+SbUoc7Ik9EfrFqcylYqgPZ9ANSbTAntnE= +github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be h1:J5BL2kskAlV9ckgEsNQXscjIaLiOYiZ75d4e94E6dcQ= +github.com/common-nighthawk/go-figure v0.0.0-20210622060536-734e95fb86be/go.mod h1:mk5IQ+Y0ZeO87b858TlA645sVcEcbiX6YqP98kt+7+w= github.com/containerd/stargz-snapshotter/estargz v0.13.0 h1:fD7AwuVV+B40p0d9qVkH/Au1qhp8hn/HWJHIYjpEcfw= github.com/containerd/stargz-snapshotter/estargz v0.13.0/go.mod h1:m+9VaGJGlhCnrcEUod8mYumTmRgblwd3rC5UCEh2Yp0= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/cyberphone/json-canonicalization v0.0.0-20220623050100-57a0ce2678a7 h1:vU+EP9ZuFUCYE0NYLwTSob+3LNEJATzNfP/DC7SWGWI= +github.com/cyberphone/json-canonicalization v0.0.0-20220623050100-57a0ce2678a7/go.mod h1:uzvlm1mxhHkdfqitSA92i7Se+S9ksOn3a3qmv/kyOCw= +github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= +github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgraph-io/badger/v3 v3.2103.2 h1:dpyM5eCJAtQCBcMCZcT4UBZchuTJgCywerHHgmxfxM8= +github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= +github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g= +github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA= github.com/dimchansky/utfbom v1.1.1 h1:vV6w1AhK4VMnhBno/TPVCoK9U/LP0PkLCS9tbxHdi/U= github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE= -github.com/docker/cli v20.10.20+incompatible h1:lWQbHSHUFs7KraSN2jOJK7zbMS2jNCHI4mt4xUFUVQ4= -github.com/docker/cli v20.10.20+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v20.10.21+incompatible h1:qVkgyYUnOLQ98LtXBrwd/duVqPT2X4SHndOuGsfwyhU= +github.com/docker/cli v20.10.21+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v20.10.22+incompatible h1:6jX4yB+NtcbldT90k7vBSaWJDB3i+zkVJT9BEK8kQkk= github.com/docker/docker v20.10.22+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y= github.com/docker/docker-credential-helpers v0.7.0 h1:xtCHsjxogADNZcdv1pKUHXryefjlVRqWqIhk/uXJp0A= github.com/docker/docker-credential-helpers v0.7.0/go.mod h1:rETQfLdHNT3foU5kuNkFR1R1V12OJRRO5lzt2D1b5X0= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= @@ -162,27 +271,55 @@ github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5Xh github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936 h1:PRxIJD8XjimM5aTknUK9w6DHLDox2r2M3DI4i2pnd3w= github.com/dprotaso/go-yit v0.0.0-20220510233725-9ba8df137936/go.mod h1:ttYvX5qlB+mlV1okblJqcSMtR4c52UKxDiX9GRBS8+Q= +github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= +github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE= +github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/proto v1.6.15 h1:XbpwxmuOPrdES97FrSfpyy67SSCV/wBIKXqgJzh6hNw= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= +github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/evanphx/json-patch/v5 v5.6.0 h1:b91NhWfaz02IuVxO9faSllyAtNXHMPkC5J8sJCLunww= github.com/evanphx/json-patch/v5 v5.6.0/go.mod h1:G79N1coSVB93tBe7j6PhzjmR3/2VvlbKOFpnXhI9Bw4= github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a h1:yDWHCSQ40h88yih2JAcL6Ls/kVkSE8GFACTGVnMPruw= github.com/facebookgo/limitgroup v0.0.0-20150612190941-6abd8d71ec01 h1:IeaD1VDVBPlx3viJT9Md8if8IxxJnO+x0JCGb054heg= github.com/facebookgo/muster v0.0.0-20150708232844-fd3d7953fd52 h1:a4DFiKFJiDRGFD1qIcqGLX/WlUMD9dyLSLDt+9QZgt8= +github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= +github.com/flowstack/go-jsonschema v0.1.1/go.mod h1:yL7fNggx1o8rm9RlgXv7hTBWxdBM0rVwpMwimd3F3N0= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= +github.com/foxcpp/go-mockdns v0.0.0-20210729171921-fb145fc6f897 h1:E52jfcE64UG42SwLmrW0QByONfGynWuzBvm86BoB9z8= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec= +github.com/go-chi/chi v4.1.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= +github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= +github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -222,9 +359,18 @@ github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+ github.com/go-openapi/validate v0.21.0/go.mod h1:rjnrwK57VJ7A8xqfpAOEKRH8yQSGUriMu5/zuPSQ1hg= github.com/go-openapi/validate v0.22.0 h1:b0QecH6VslW/TxtpKgzpO1SNG7GU2FsaqKdP1E2T50Y= github.com/go-openapi/validate v0.22.0/go.mod h1:rjnrwK57VJ7A8xqfpAOEKRH8yQSGUriMu5/zuPSQ1hg= +github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= +github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= +github.com/go-test/deep v1.0.8 h1:TDsG77qcSprGbC6vTN8OuXp5g+J+b5Pcguhf7Zt61VM= github.com/go-training/helloworld v0.0.0-20200225145412-ba5f4379d78b h1:0pOrjn0UzTcHdhDVdxrH8LwM7QLnAp8qiUtwXM04JEE= github.com/go-training/helloworld v0.0.0-20200225145412-ba5f4379d78b/go.mod h1:hGGmX3bRUkYkc9aKA6mkUxi6d+f1GmZF1je0FlVTgwU= github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= @@ -251,6 +397,11 @@ github.com/gobuffalo/packd v0.1.0/go.mod h1:M2Juc+hhDXf/PnmBANFCqx4DM3wRbgDvnVWe github.com/gobuffalo/packr/v2 v2.0.9/go.mod h1:emmyGweYTm6Kdper+iywB6YK5YzuKchGtJQZ0Odn4pQ= github.com/gobuffalo/packr/v2 v2.2.0/go.mod h1:CaAwI0GPIAv+5wKLtv8Afwl+Cm78K/I/VCm/3ptBN+0= github.com/gobuffalo/syncx v0.0.0-20190224160051-33c29581e754/go.mod h1:HhnNqWY95UYwwW3uSASeV7vtgYkT2t16hJgV3AEPUpw= +github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= +github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= +github.com/godbus/dbus v4.1.0+incompatible/go.mod h1:/YcGZj5zSblfDWMMoOzV4fas9FZnQYTkDnsGvmh2Grw= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= @@ -258,9 +409,13 @@ github.com/golang-jwt/jwt/v4 v4.2.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzw github.com/golang-jwt/jwt/v4 v4.4.2 h1:rcc4lwaZgFMCZ5jxF9ABolDcIHdBytAFgqFPbSJQAYs= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= @@ -286,8 +441,16 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/certificate-transparency-go v1.1.4 h1:hCyXHDbtqlr/lMXU0D4WgbalXL0Zk4dSWWMbPV8VrqY= +github.com/google/certificate-transparency-go v1.1.4/go.mod h1:D6lvbfwckhNrbM9WVl1EVeMOyzC19mpIjMOI4nxBHtQ= +github.com/google/flatbuffers v1.12.1 h1:MVlul7pQNoDzWRLTw5imwYsl+usrS1TXG2H4jg6ImGw= +github.com/google/gnostic v0.6.9 h1:ZK/5VhkoX835RikCHpSUJV9a+S3e1zLh59YnyWeBW+0= +github.com/google/gnostic v0.6.9/go.mod h1:Nm8234We1lq6iB9OmlgNv3nH91XLLVZHCDayfA3xq+E= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -296,15 +459,26 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-containerregistry v0.12.1 h1:W1mzdNUTx4Zla4JaixCRLhORcR7G6KxE5hHl5fkPsp8= -github.com/google/go-containerregistry v0.12.1/go.mod h1:sdIK+oHQO7B93xI8UweYdl887YhuIwg9vz8BSLH3+8k= +github.com/google/go-containerregistry v0.12.2-0.20221114162634-781782aa2757 h1:pmegaRhUKXxTUrNhRz96PiBk4Ihfi6CoejIcFSWMTmg= +github.com/google/go-containerregistry v0.12.2-0.20221114162634-781782aa2757/go.mod h1:sdIK+oHQO7B93xI8UweYdl887YhuIwg9vz8BSLH3+8k= +github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20221114162634-781782aa2757 h1:1qKTXnWK6DsOFFfjakWJKMlpfAwmykw6Jjk9SLBsZmI= +github.com/google/go-containerregistry/pkg/authn/k8schain v0.0.0-20221114162634-781782aa2757/go.mod h1:7QLaBZxN+nMCx82XO5R7qPHq0m61liEg8yca68zymHo= +github.com/google/go-containerregistry/pkg/authn/kubernetes v0.0.0-20221114162634-781782aa2757 h1:FsE9anmDCfnvZBx/PxdW8JDVJrAtx8zkWkQyHoxA3Jc= +github.com/google/go-containerregistry/pkg/authn/kubernetes v0.0.0-20221114162634-781782aa2757/go.mod h1:T6IXbpoY0IGBh0cyHZsIi/zmMBI5yInMr7ob1b+SCz0= +github.com/google/go-github/v45 v45.2.0 h1:5oRLszbrkvxDDqBCNj2hjDZMKmvexaZ1xw/FCD+K3FI= +github.com/google/go-github/v45 v45.2.0/go.mod h1:FObaZJEDSTa/WGCzZ2Z3eoCDXWJKMenWWTrd8jrta28= +github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -322,24 +496,68 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2 h1:SJ+NtwL6QaZ21U+IrK7d0gGgpjGGvd2kz+FzTHVzdqI= github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2/go.mod h1:Tv1PlzqC9t8wNnpPdctvtSUOPUUg4SHeE6vR1Ir2hmg= +github.com/google/trillian v1.5.1-0.20220819043421-0a389c4bb8d9 h1:GFmzYtwUMi1S2mjLxfrJ/CZ9gWDG+zeLtZByg/QEBkk= +github.com/google/trillian v1.5.1-0.20220819043421-0a389c4bb8d9/go.mod h1:vywkS3p2SgNmPL7oAWqU5PiiknzRMp+ol3a19jfY2PQ= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= +github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.14.6/go.mod h1:zdiPV4Yse/1gnckTHtghG4GkDEdKCRJduHpTxT3/jcw= +github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0 h1:kr3j8iIMR4ywO/O0rvksXaJvauGGCMg2zAZIiNZ9uIQ= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.12.0/go.mod h1:ummNFgdgLhhX7aIiy35vVmQNS0rWXknfPE0qe6fmFXg= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= +github.com/hashicorp/go-hclog v1.4.0 h1:ctuWFGrhFha8BnnzxqeRGidlEcQkDyL5u8J8t5eA11I= +github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-plugin v1.4.8 h1:CHGwpxYDOttQOY7HOWgETU9dyVjOXzniXDqJcYJE1zM= +github.com/hashicorp/go-retryablehttp v0.7.1 h1:sUiuQAnLlbvmExtFQs72iFW/HXeUn8Z1aJLQ4LJJbTQ= +github.com/hashicorp/go-retryablehttp v0.7.1/go.mod h1:vAew36LZh98gCBJNLH42IQ1ER/9wtLZZ8meHqQvEYWY= +github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc= +github.com/hashicorp/go-secure-stdlib/mlock v0.1.2 h1:p4AKXPPS24tO8Wc8i1gLvSKdmkiSY5xuju57czJ/IJQ= +github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 h1:UpiO20jno/eV1eVZcxqWnUohyKRe1g8FPV/xH1s/2qs= +github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9CdjCtrXrXGuOpxEA7Ts= +github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/vault/api v1.8.2 h1:C7OL9YtOtwQbTKI9ogB0A1wffRbCN+rH/LLCHO3d8HM= +github.com/hashicorp/vault/sdk v0.6.1 h1:sjZC1z4j5Rh2GXYbkxn5BLK05S1p7+MhW4AgdUmgRUA= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= github.com/honeycombio/beeline-go v1.10.0 h1:cUDe555oqvw8oD76BQJ8alk7FP0JZ/M/zXpNvOEDLDc= github.com/honeycombio/libhoney-go v1.16.0 h1:kPpqoz6vbOzgp7jC6SR7SkNj7rua7rgxvznI6M3KdHc= +github.com/howeyc/gopass v0.0.0-20190910152052-7cb4b85ec19c/go.mod h1:lADxMC39cJJqL93Duh1xhAs4I2Zs8mKS89XWXFGp9cs= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= +github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= +github.com/in-toto/in-toto-golang v0.5.0 h1:hb8bgwr0M2hGdDsLjkJ3ZqJ8JFLL/tgYdAxF/XEFBbY= +github.com/in-toto/in-toto-golang v0.5.0/go.mod h1:/Rq0IZHLV7Ku5gielPT4wPHJfH1GdHMCq8+WPxw8/BE= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jedisct1/go-minisign v0.0.0-20211028175153-1c139d1cc84b h1:ZGiXF8sz7PDk6RgkP+A/SFfUD0ZR/AgG6SpRNEDKZy8= +github.com/jedisct1/go-minisign v0.0.0-20211028175153-1c139d1cc84b/go.mod h1:hQmNrgofl+IY/8L+n20H6E6PWBBTokdsv+q49j0QhsU= +github.com/jellydator/ttlcache/v2 v2.11.1 h1:AZGME43Eh2Vv3giG6GeqeLeFXxwxn1/qHItqWZl6U64= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= @@ -347,12 +565,25 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGw github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/jmhodges/clock v0.0.0-20160418191101-880ee4c33548 h1:dYTbLf4m0a5u0KLmPfB6mgxbcV7588bOCx79hxa5Sr4= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/karrick/godirwalk v1.8.0/go.mod h1:H5KPZjojv4lE+QYImBI8xVtrBRgYrIVsaRPx4tDPEn4= github.com/karrick/godirwalk v1.10.3/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= +github.com/kelseyhightower/envconfig v1.4.0 h1:Im6hONhd3pLkfDFsbRgu68RDNkGF1r3dvMUtDTo2cv8= +github.com/kelseyhightower/envconfig v1.4.0/go.mod h1:cccZRl6mQpaq41TPp5QxidR+Sa3axMbJDNb//FQX6Gg= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= @@ -360,15 +591,25 @@ github.com/klauspost/compress v1.15.12 h1:YClS/PImqYbn+UILDnqxQCZ3RehC9N318SU3kE github.com/klauspost/compress v1.15.12/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/letsencrypt/boulder v0.0.0-20220929215747-76583552c2be h1:Cx2bsfM27RBF/45zP1xhFN9FHDxo40LdYdE5L+GWVTw= -github.com/letsencrypt/boulder v0.0.0-20220929215747-76583552c2be/go.mod h1:j/WMsOEcTSfy6VR1PkiIo20qH1V9iRRzb7ishoKkN0g= +github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/letsencrypt/boulder v0.0.0-20221109233200-85aa52084eaf h1:ndns1qx/5dL43g16EQkPV/i8+b3l5bYQwLeoSBe7tS8= +github.com/letsencrypt/boulder v0.0.0-20221109233200-85aa52084eaf/go.mod h1:aGkAgvWY/IUcVFfuly53REpfv5edu25oij+qHRFaraA= +github.com/lib/pq v1.8.0 h1:9xohqzkUwzR4Ga4ivdTcawVS89YSDVxXMa3xJX3cGzg= +github.com/lib/pq v1.8.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= @@ -378,47 +619,83 @@ github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0 github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/miekg/dns v1.1.50 h1:DQUfb9uc6smULcREF09Uc+/Gd46YWqJd5DbpPE9xkcA= +github.com/miekg/pkcs11 v1.0.3-0.20190429190417-a667d056470f/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= +github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= +github.com/miekg/pkcs11 v1.1.1 h1:Ugu9pdy6vAYku5DEpVWVFPYnzV+bxB+iRdbuFSu7TvU= +github.com/miekg/pkcs11 v1.1.1/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= 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/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/moby/term v0.0.0-20210610120745-9d4ed1856297 h1:yH0SvLzcbZxcJXho2yh7CqdENGMQe73Cw3woZBpPli0= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 h1:dcztxKSvZ4Id8iPpHERQBbIJfabdt4wUm5qy3wOL2Zc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/mozillazg/docker-credential-acr-helper v0.3.0 h1:DVWFZ3/O8BP6Ue3iS/Olw+G07u1hCq1EOVCDZZjCIBI= +github.com/mozillazg/docker-credential-acr-helper v0.3.0/go.mod h1:cZlu3tof523ujmLuiNUb6JsjtHcNA70u1jitrrdnuyA= +github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de h1:D5x39vF5KCwKQaw+OC9ZPiLVHXz3UFw2+psEX+gYcto= +github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de/go.mod h1:kJun4WP5gFuHZgRjZUWWuH1DTxCtxbHDOIJsudS8jzY= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= +github.com/onsi/ginkgo/v2 v2.4.0 h1:+Ig9nvqgS5OBSACXNk15PLdp0U9XPYROt9CFzVdFGIs= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.23.0 h1:/oxKu9c2HVap+F3PfKort2Hw5DEU+HGlW8n+tguWsys= +github.com/open-policy-agent/opa v0.45.0 h1:P5nuhVRtR+e58fk3CMMbiqr6ZFyWQPNOC3otsorGsFs= +github.com/open-policy-agent/opa v0.45.0/go.mod h1:/OnsYljNEWJ6DXeFOOnoGn8CvwZGMUS4iRqzYdJvmBI= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= +github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -427,49 +704,115 @@ github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qR 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/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= +github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.35.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE= +github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= +github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= +github.com/prometheus/statsd_exporter v0.22.7/go.mod h1:N/TevpjkIh9ccs6nuzY3jQn9dFqnUakOjnEuMPJJJnI= +github.com/prometheus/statsd_exporter v0.22.8 h1:Qo2D9ZzaQG+id9i5NYNGmbf1aa/KxKbB9aKfMS+Yib0= +github.com/prometheus/statsd_exporter v0.22.8/go.mod h1:/DzwbTEaFTE0Ojz5PqcSk6+PFHOPWGxdXVr6yC8eFOM= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/protocolbuffers/txtpbfmt v0.0.0-20201118171849-f6a6b3f636fc h1:gSVONBi2HWMFXCa9jFdYvYk7IwW/mTLxWOF7rXS4LO0= +github.com/qur/ar v0.0.0-20130629153254-282534b91770/go.mod h1:SjlYv2m9lpV0UW6K7lDqVJwEIIvSjaHbGk7nIfY8Hxw= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= +github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.2.2/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ryanuber/go-glob v1.0.0 h1:iQh3xXAumdQ+4Ufa5b25cRpC5TYKlno6hsv6Cb3pkBk= +github.com/sassoftware/go-rpmutils v0.1.1/go.mod h1:euhXULoBpvAxqrBHEyJS4Tsu3hHxUmQWNymxoJbzgUY= +github.com/sassoftware/relic v0.0.0-20210427151427-dfb082b79b74 h1:sUNzanSKA9z/h8xXl+ZJoxIYZL0Qx306MmxqRrvUgr0= +github.com/sassoftware/relic v0.0.0-20210427151427-dfb082b79b74/go.mod h1:YlB8wFIZmFLZ1JllNBfSURzz52fBxbliNgYALk1UDmk= +github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/secure-systems-lab/go-securesystemslib v0.4.0 h1:b23VGrQhTA8cN2CbBw7/FulN9fTtqYUdS5+Oxzt+DUE= +github.com/secure-systems-lab/go-securesystemslib v0.4.0/go.mod h1:FGBZgq2tXWICsxWQW1msNf49F0Pf2Op5Htayx335Qbs= +github.com/shibumi/go-pathspec v1.3.0 h1:QUyMZhFo0Md5B8zV8x2tesohbb5kfbpTi9rBnKh5dkI= +github.com/shibumi/go-pathspec v1.3.0/go.mod h1:Xutfslp817l2I1cZvgcfeMQJG5QnU2lh5tVaaMCl3jE= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sigstore/cosign v1.13.1 h1:+5oF8jisEcDw2TuXxCADC1u5//HfdnJhGbpv9Isiwu4= github.com/sigstore/cosign v1.13.1/go.mod h1:PlfJODkovUOKsLrGI7Su57Ie/Eb/Ks7hRHw3tn5hQS4= -github.com/sigstore/rekor v0.12.1-0.20220915152154-4bb6f441c1b2 h1:LD8LcwygdD2DxaINWwbkaUEBAknr205wmn66/N05s7c= -github.com/sigstore/rekor v0.12.1-0.20220915152154-4bb6f441c1b2/go.mod h1:C/jZ3EZywl/Kew48fGMWQoh+1LxOMk0BkP3DHmtB+8M= -github.com/sigstore/sigstore v1.4.4 h1:lVsnNTY8DUmy2hnwCPtimWfEqv+DIwleORkF8KyFsMs= -github.com/sigstore/sigstore v1.4.4/go.mod h1:wIqu9sN72+pds31MMu89GchxXHy17k+VZWc+HY1ZXMA= +github.com/sigstore/policy-controller v0.5.2 h1:0mJaYN71RDDpf1WoSEwXiuN6DOAFaC95ms3prHcVT3s= +github.com/sigstore/policy-controller v0.5.2/go.mod h1:yJtROa8mbBAXAov6XM36B3IlP0MCA7x4Rgp4W99VjuA= +github.com/sigstore/rekor v1.0.1 h1:rcESXSNkAPRWFYZel9rarspdvneET60F2ngNkadi89c= +github.com/sigstore/rekor v1.0.1/go.mod h1:ecTKdZWGWqE1pl3U1m1JebQJLU/hSjD9vYHOmHQ7w4g= +github.com/sigstore/sigstore v1.5.0 h1:NqstQ6SwwhQsp6Ll0wgk/d9g5MlfmEppo14aquUjJ/8= +github.com/sigstore/sigstore v1.5.0/go.mod h1:fRAaZ9xXh7ZQ0GJqZdpmNJ3pemuHBu2PgIAngmzIFSI= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= +github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= +github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw= github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g= github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU= github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+egj8As= +github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= +github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -477,53 +820,107 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stvp/go-udp-testing v0.0.0-20201019212854-469649b16807/go.mod h1:7jxmlfBCDBXRzr0eAQJ48XC1hBu1np4CS5+cHEYfwpc= github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= +github.com/tchap/go-patricia/v2 v2.3.1 h1:6rQp39lgIYZ+MHmdEq4xzuk1t7OdC35z/xm0BGhTkes= +github.com/tchap/go-patricia/v2 v2.3.1/go.mod h1:VZRHKAb53DLaG+nA9EaYYiaEx6YztwDlLElMsnSHD4k= +github.com/tent/canonical-json-go v0.0.0-20130607151641-96e4ba3a7613 h1:iGnD/q9160NWqKZZ5vY4p0dMiYMRknzctfSkqA4nBDw= +github.com/tent/canonical-json-go v0.0.0-20130607151641-96e4ba3a7613/go.mod h1:g6AnIpDSYMcphz193otpSIzN+11Rs+AAIIC6rm1enug= +github.com/thales-e-security/pool v0.0.2 h1:RAPs4q2EbWsTit6tpzuvTFlgFRJ3S8Evf5gtvVDbmPg= +github.com/thales-e-security/pool v0.0.2/go.mod h1:qtpMm2+thHtqhLzTwgDBj/OuNnMpupY8mv0Phz0gjhU= github.com/theupdateframework/go-tuf v0.5.2-0.20220930112810-3890c1e7ace4 h1:1i/Afw3rmaR1gF3sfVkG2X6ldkikQwA9zY380LrR5YI= github.com/theupdateframework/go-tuf v0.5.2-0.20220930112810-3890c1e7ace4/go.mod h1:vAqWV3zEs89byeFsAYoh/Q14vJTgJkHwnnRCWBBBINY= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs= github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 h1:e/5i7d4oYZ+C1wj2THlRK+oAhjeS/TRQwMfkIuet3w0= github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399/go.mod h1:LdwHTNJT99C5fTAzDz0ud328OgXz+gierycbcIx2fRs= +github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w= +github.com/tjfoc/gmsm v1.4.1 h1:aMe1GlZb+0bLjn+cKTPEvvn9oUEBlJitaZiiBwsbgho= +github.com/tjfoc/gmsm v1.4.1/go.mod h1:j4INPkHWMrhJb38G+J6W4Tw0AbuN8Thu3PbdVYhVcTE= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/transparency-dev/merkle v0.0.1 h1:T9/9gYB8uZl7VOJIhdwjALeRWlxUxSfDEysjfmx+L9E= +github.com/transparency-dev/merkle v0.0.1/go.mod h1:B8FIw5LTq6DaULoHsVFRzYIUDkl8yuSwCdZnOZGKL/A= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/vbatts/tar-split v0.11.2 h1:Via6XqJr0hceW4wff3QRzD5gAk/tatMw/4ZA7cTlIME= github.com/vbatts/tar-split v0.11.2/go.mod h1:vV3ZuO2yWSVsz+pfFzDG/upWH1JhjOiEaWq6kXyQ3VI= github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= +github.com/xanzy/go-gitlab v0.73.1 h1:UMagqUZLJdjss1SovIC+kJCH4k2AZWXl58gJd38Y/hI= +github.com/xanzy/go-gitlab v0.73.1/go.mod h1:d/a0vswScO7Agg1CZNz15Ic6SSvBG9vfw8egL99t4kA= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= github.com/xdg-go/scram v1.1.1/go.mod h1:RaEWvsqvNKKvBPvcKeFjrG2cJqOkHTiyTpzz23ni57g= github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg-go/stringprep v1.0.3/go.mod h1:W3f5j4i+9rC0kuIEJL0ky1VpHXQU3ocBgklLGvcBnW8= +github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= +github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= +github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= +github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yashtewari/glob-intersection v0.1.0 h1:6gJvMYQlTDOL3dMsPF6J0+26vwX9MB8/1q3uAdhmTrg= +github.com/yashtewari/glob-intersection v0.1.0/go.mod h1:LK7pIC3piUjovexikBbJ26Yml7g8xa5bsjfx2v1fwok= github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.30/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/zalando/go-keyring v0.1.0/go.mod h1:RaxNwUITJaHVdQ0VC7pELPZ3tOWn13nr0gZMZEhpVU0= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.mongodb.org/mongo-driver v1.7.3/go.mod h1:NqaYOwnXWr5Pm7AOpO5QFxKJ503nbMse/R79oO62zWg= go.mongodb.org/mongo-driver v1.7.5/go.mod h1:VXEWRZ6URJIkUq2SCAyapmhH0ZLRBP+FT4xhp5Zvxng= go.mongodb.org/mongo-driver v1.8.3/go.mod h1:0sQWfOeY63QTntERDJJ/0SuKK0T1uVSgKCuAROlKEPY= go.mongodb.org/mongo-driver v1.10.0/go.mod h1:wsihk0Kdgv8Kqu1Anit4sfK+22vSFbUrAVEYRhCXrA8= -go.mongodb.org/mongo-driver v1.10.2 h1:4Wk3cnqOrQCn0P92L3/mmurMxzdvWWs5J9jinAVKD+k= -go.mongodb.org/mongo-driver v1.10.2/go.mod h1:z4XpeoU6w+9Vht+jAFyLgVrD+jGSQQe0+CBWFHNiHt8= +go.mongodb.org/mongo-driver v1.10.3 h1:XDQEvmh6z1EUsXuIkXE9TaVeqHw6SwS1uf93jFs0HBA= +go.mongodb.org/mongo-driver v1.10.3/go.mod h1:z4XpeoU6w+9Vht+jAFyLgVrD+jGSQQe0+CBWFHNiHt8= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= +go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= +go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/automaxprocs v1.5.1 h1:e1YG66Lrk73dn4qhg8WFSvhF0JuFQF0ERIp4rpuV8Qk= go.uber.org/automaxprocs v1.5.1/go.mod h1:BF4eumQw0P9GtnuxxovUd06vwm1o18oMzFtK66vU6XU= +go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.8.0 h1:dg6GjLku4EH+249NNmoIciG9N/jURbDG+pFlTkhzIC8= +go.uber.org/multierr v1.8.0/go.mod h1:7EAYxJLBy9rStEaz58O2t4Uvip6FSURkq8/ppBp95ak= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= +go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191219195013-becbf705a915/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200930160638-afb6bcd081ae/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201012173705-84dcc777aaee/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201216223049-8b5274cf687f/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -531,8 +928,8 @@ golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5y golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.4.0 h1:UVQgzMY87xqpKNgb+kDsll2Igd33HszWHFLmpaRMq/8= +golang.org/x/crypto v0.4.0/go.mod h1:3quD/ATkf6oY+rnes5c3ExXTbLc8mueNue5/DoinL80= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -543,6 +940,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20221026153819-32f3d567a233 h1:9bNbSKT4RPLEzne0Xh1v3NaNecsa1DKjkOuTbY6V9rI= +golang.org/x/exp v0.0.0-20221026153819-32f3d567a233/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -571,16 +970,21 @@ golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -596,18 +1000,25 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200930145003-4acb6c075d10/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= +golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10 h1:Frnccbp+ok2GkUS2tC84yAq/U9Vg+0sIO7aRL3T4Xnc= -golang.org/x/net v0.3.1-0.20221206200815-1e63c2f08a10/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= +golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= +golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -617,8 +1028,10 @@ golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.1.0 h1:isLCZuhj4v+tYv7eskaN4v/TM+A1begWWgyVJDdl1+Y= -golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= +golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= +golang.org/x/oauth2 v0.3.0 h1:6l90koy8/LaBLmLu8jpHeHexzMwEita0zFfYlggy2F8= +golang.org/x/oauth2 v0.3.0/go.mod h1:rQrIauxkUhJ6CuwEXwymO2/eh4xz2ZWF1nBkcxS+tGk= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -628,14 +1041,18 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200930132711-30421366ff76/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -655,6 +1072,7 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -664,9 +1082,12 @@ golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200509044756-6aff5f38e54f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -675,15 +1096,26 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220708085239-5a0f0661e09d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -706,13 +1138,17 @@ golang.org/x/text v0.5.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220922220347-f3bd1da661af h1:Yx9k8YCG3dvF87UAn2tu2HQLf2dt/eR1bXxpLMWeH+Y= +golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190329151228-23e29df326fe/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190416151739-9c9e1878f421/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190420181800-aa740d480789/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -745,6 +1181,7 @@ golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjs golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200509030707-2212a7e161a5/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -767,6 +1204,9 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +gomodules.xyz/jsonpatch/v2 v2.2.0 h1:4pT439QV83L+G9FkcCriY6EkpcK6r6bK+A5FBUMI7qY= +gomodules.xyz/jsonpatch/v2 v2.2.0/go.mod h1:WXp+iVDkoLQqPudfQ9GBlwB2eZ5DKOnjQZCYdOS8GPY= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -780,12 +1220,15 @@ google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/ google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.25.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= +google.golang.org/api v0.104.0 h1:KBfmLRqdZEbwQleFlSLnzpQJwhjpmNOk4cKQIBDZ9mg= +google.golang.org/api v0.104.0/go.mod h1:JCspTXJbBxa5ySXw4UgUqVer7DfVxbvc/CTUFqAED5U= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -817,8 +1260,10 @@ google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -830,10 +1275,12 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e h1:S9GbmC1iCgvbLyAokVCwiO6tVIrU9Y7c5oMx1V/ki/Y= -google.golang.org/genproto v0.0.0-20221024183307-1bc688fe9f3e/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= +google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc= +google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6 h1:AGXp12e/9rItf6/4QymU7WsAUwCf+ICW75cuR91nJIc= +google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6/go.mod h1:1dOng4TWOomJrDGhpXjfCD35wQC6jnC7HpRmOFRqEV0= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -845,11 +1292,14 @@ google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3Iji google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= -google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= +google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34= +google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= +google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -862,24 +1312,37 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w= google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/alexcesaro/statsd.v2 v2.0.0 h1:FXkZSCZIH17vLCO5sO2UucTHsH9pc+17F6pl3JVCwMc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/ini.v1 v1.56.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= @@ -889,6 +1352,7 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools/v3 v3.1.0 h1:rVV8Tcg/8jHUkPUorwjaMTtemIMVXfIPKiOqnhEhakk= @@ -899,16 +1363,30 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +k8s.io/api v0.26.0 h1:IpPlZnxBpV1xl7TGk/X6lFtpgjgntCg8PJ+qrPHAC7I= +k8s.io/api v0.26.0/go.mod h1:k6HDTaIFC8yn1i6pSClSqIwLABIcLV9l5Q4EcngKnQg= k8s.io/apimachinery v0.26.0 h1:1feANjElT7MvPqp0JT6F3Ss6TWDwmcjLypwoPpEf7zg= k8s.io/apimachinery v0.26.0/go.mod h1:tnPmbONNJ7ByJNz9+n9kMjNP8ON+1qoAIIC70lztu74= -k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= -k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= -k8s.io/utils v0.0.0-20221107191617-1a15be271d1d h1:0Smp/HP1OH4Rvhe+4B8nWGERtlqAGSftbSbbmm45oFs= -k8s.io/utils v0.0.0-20221107191617-1a15be271d1d/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +k8s.io/client-go v0.25.4 h1:3RNRDffAkNU56M/a7gUfXaEzdhZlYhoW8dgViGy5fn8= +k8s.io/client-go v0.25.4/go.mod h1:8trHCAC83XKY0wsBIpbirZU4NTUpbuhc2JnI7OruGZw= +k8s.io/klog/v2 v2.80.2-0.20221028030830-9ae4992afb54 h1:hWRbsoRWt44OEBnYUd4ceLy4ofBoh+p9vauWp/I5Gdg= +k8s.io/klog/v2 v2.80.2-0.20221028030830-9ae4992afb54/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 h1:+70TFaan3hfJzs+7VK2o+OGxg8HsuBr/5f6tVAjDu6E= +k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280/go.mod h1:+Axhij7bCpeqhklhUTe3xmOn6bWxolyZEeyaFpjGtl4= +k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 h1:GfD9OzL11kvZN5iArC6oTS7RTj7oJOIfnislxYlqTj8= +k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +knative.dev/pkg v0.0.0-20221221230956-4fd6eb8652b7 h1:YaO4KgF1Kp8BTi1hxMXDRnvsxCFq/wpotOD3jzrHmzw= +knative.dev/pkg v0.0.0-20221221230956-4fd6eb8652b7/go.mod h1:IeUSNPPUpQnM35SjpnfCx0w5/V2RpEc+nmke6oPwpD0= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= +sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k= +sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= sigs.k8s.io/kind v0.17.0 h1:CScmGz/wX66puA06Gj8OZb76Wmk7JIjgWf5JDvY7msM= sigs.k8s.io/kind v0.17.0/go.mod h1:Qqp8AiwOlMZmJWs37Hgs31xcbiYXjtXlRBSftcnZXQk= +sigs.k8s.io/release-utils v0.7.3 h1:6pS8x6c5RmdUgR9qcg1LO6hjUzuE4Yo9TGZ3DemrZdM= +sigs.k8s.io/release-utils v0.7.3/go.mod h1:n0mVez/1PZYZaZUTJmxewxH3RJ/Lf7JUDh7TG1CASOE= +sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= +sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/pkg/commands/config.go b/pkg/commands/config.go index f327aee974..e0256a8f91 100644 --- a/pkg/commands/config.go +++ b/pkg/commands/config.go @@ -77,6 +77,14 @@ func getBaseImage(bo *options.BuildOptions) build.GetBase { if err != nil { return nil, err } + + if bo.Verifier != nil { + base := ref.Context().Digest(desc.Digest.String()) + if err := bo.Verifier.Verify(ctx, base, keychain); err != nil { + return nil, err + } + } + if desc.MediaType.IsIndex() { return desc.ImageIndex() } diff --git a/pkg/commands/options/build.go b/pkg/commands/options/build.go index 635958f8b4..da4ae2e7f0 100644 --- a/pkg/commands/options/build.go +++ b/pkg/commands/options/build.go @@ -17,8 +17,10 @@ limitations under the License. package options import ( + "context" "errors" "fmt" + "log" "os" "path/filepath" @@ -28,11 +30,32 @@ import ( "golang.org/x/tools/go/packages" "github.com/google/ko/pkg/build" + "github.com/google/ko/pkg/policy" ) const ( // configDefaultBaseImage is the default base image if not specified in .ko.yaml. configDefaultBaseImage = "cgr.dev/chainguard/static:latest" + + // configDefaultBaseImagePolicy is the default base image policy if not + // specified in .ko.yaml + configDefaultBaseImagePolicy = ` +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: ko-default-base-image-policy +spec: + images: + - glob: cgr.dev/chainguard/static* + authorities: + - keyless: + url: https://fulcio.sigstore.dev + identities: + - issuer: https://token.actions.githubusercontent.com + subject: https://github.com/chainguard-images/images/.github/workflows/release.yaml@refs/heads/main + ctlog: + url: https://rekor.sigstore.dev +` ) // BuildOptions represents options for the ko builder. @@ -71,6 +94,9 @@ type BuildOptions struct { // BuildConfigs stores the per-image build config from `.ko.yaml`. BuildConfigs map[string]build.Config + + // Verifier is used to check that base images satisfy configured policies. + Verifier policy.Verifier } func AddBuildOptions(cmd *cobra.Command, bo *BuildOptions) { @@ -160,7 +186,7 @@ func (bo *BuildOptions) LoadConfig() error { if len(bo.BuildConfigs) == 0 { var builds []build.Config if err := v.UnmarshalKey("builds", &builds); err != nil { - return fmt.Errorf("configuration section 'builds' cannot be parsed") + return fmt.Errorf("configuration section 'builds' cannot be parsed: %w", err) } buildConfigs, err := createBuildConfigMap(bo.WorkingDirectory, builds) if err != nil { @@ -169,9 +195,33 @@ func (bo *BuildOptions) LoadConfig() error { bo.BuildConfigs = buildConfigs } + vfy := policy.Verification{} + if err := v.UnmarshalKey("verification", &vfy); err != nil { + return fmt.Errorf("configuration section 'verification' cannot be parsed: %w", err) + } + verificationDefaults(&vfy) + vfr, err := policy.Compile(context.Background(), vfy, func(s string, i ...interface{}) { + log.Printf("WARNING: %s", fmt.Sprintf(s, i...)) + }) + if err != nil { + return fmt.Errorf("compiling verification: %w", err) + } + bo.Verifier = vfr + return nil } +func verificationDefaults(vfy *policy.Verification) { + if vfy.NoMatchPolicy == "" { + vfy.NoMatchPolicy = "warn" + } + if vfy.Policies == nil { + vfy.Policies = &[]policy.PolicyData{{ + Data: configDefaultBaseImagePolicy, + }} + } +} + func createBuildConfigMap(workingDirectory string, configs []build.Config) (map[string]build.Config, error) { buildConfigsByImportPath := make(map[string]build.Config) for i, config := range configs { diff --git a/pkg/policy/parse.go b/pkg/policy/parse.go new file mode 100644 index 0000000000..3b2133df9c --- /dev/null +++ b/pkg/policy/parse.go @@ -0,0 +1,114 @@ +// Copyright 2023 Google LLC 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 policy + +import ( + "context" + "encoding/json" + "fmt" + "strings" + + "github.com/sigstore/policy-controller/pkg/apis/policy/v1alpha1" + "github.com/sigstore/policy-controller/pkg/apis/policy/v1beta1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "knative.dev/pkg/apis" + "sigs.k8s.io/yaml" +) + +// Parse decodes a provided YAML document containing zero or more objects into +// a collection of unstructured.Unstructured objects. +func Parse(ctx context.Context, document string) ([]*unstructured.Unstructured, error) { + docs := strings.Split(document, "\n---\n") + + objs := make([]*unstructured.Unstructured, 0, len(docs)) + for i, doc := range docs { + doc = strings.TrimSpace(doc) + if doc == "" { + continue + } + var obj unstructured.Unstructured + if err := yaml.Unmarshal([]byte(doc), &obj); err != nil { + return nil, fmt.Errorf("decoding object[%d]: %w", i, err) + } + if obj.GetAPIVersion() == "" { + return nil, apis.ErrMissingField("apiVersion").ViaIndex(i) + } + if obj.GetName() == "" { + return nil, apis.ErrMissingField("metadata.name").ViaIndex(i) + } + objs = append(objs, &obj) + } + return objs, nil +} + +// ParseClusterImagePolicies returns ClusterImagePolicy objects found in the +// policy document. +func ParseClusterImagePolicies(ctx context.Context, document string) (cips []*v1alpha1.ClusterImagePolicy, warns error, err error) { + if warns, err = Validate(ctx, document); err != nil { + return nil, warns, err + } + + ol, err := Parse(ctx, document) + if err != nil { + return nil, warns, err + } + + cips = make([]*v1alpha1.ClusterImagePolicy, 0) + for _, obj := range ol { + gv, err := schema.ParseGroupVersion(obj.GetAPIVersion()) + if err != nil { + // Practically unstructured.Unstructured won't let this happen. + return nil, warns, fmt.Errorf("error parsing apiVersion of: %w", err) + } + + cip := &v1alpha1.ClusterImagePolicy{} + + switch gv.WithKind(obj.GetKind()).GroupKind() { + case v1beta1.SchemeGroupVersion.WithKind("ClusterImagePolicy").GroupKind(): + v1b1 := &v1beta1.ClusterImagePolicy{} + if err := convert(obj, v1b1); err != nil { + return nil, warns, err + } + if err := cip.ConvertFrom(ctx, v1b1); err != nil { + return nil, warns, err + } + + case v1alpha1.SchemeGroupVersion.WithKind("ClusterImagePolicy").GroupKind(): + // This is allowed, but we should convert things. + if err := convert(obj, cip); err != nil { + return nil, warns, err + } + + default: + continue + } + + cips = append(cips, cip) + } + return cips, warns, nil +} + +func convert(from interface{}, to runtime.Object) error { + bs, err := json.Marshal(from) + if err != nil { + return fmt.Errorf("Marshal() = %w", err) + } + if err := json.Unmarshal(bs, to); err != nil { + return fmt.Errorf("Unmarshal() = %w", err) + } + return nil +} diff --git a/pkg/policy/parse_test.go b/pkg/policy/parse_test.go new file mode 100644 index 0000000000..0c439dce78 --- /dev/null +++ b/pkg/policy/parse_test.go @@ -0,0 +1,189 @@ +// Copyright 2023 Google LLC 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 policy + +import ( + "context" + "errors" + "testing" + + "github.com/google/go-cmp/cmp" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "knative.dev/pkg/apis" +) + +func TestParse(t *testing.T) { + tests := []struct { + name string + doc string + want []*unstructured.Unstructured + wantErr error + }{{ + name: "good single object", + doc: ` +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: blah +spec: {} +`, + want: []*unstructured.Unstructured{{ + Object: map[string]interface{}{ + "apiVersion": "policy.sigstore.dev/v1beta1", + "kind": "ClusterImagePolicy", + "metadata": map[string]interface{}{ + "name": "blah", + }, + "spec": map[string]interface{}{}, + }, + }}, + }, { + name: "good multi-object", + doc: ` +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: blah +spec: {} +--- +--- +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: foo +spec: {} +--- +--- +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: bar +spec: {} +`, + want: []*unstructured.Unstructured{{ + Object: map[string]interface{}{ + "apiVersion": "policy.sigstore.dev/v1beta1", + "kind": "ClusterImagePolicy", + "metadata": map[string]interface{}{ + "name": "blah", + }, + "spec": map[string]interface{}{}, + }, + }, { + Object: map[string]interface{}{ + "apiVersion": "policy.sigstore.dev/v1beta1", + "kind": "ClusterImagePolicy", + "metadata": map[string]interface{}{ + "name": "foo", + }, + "spec": map[string]interface{}{}, + }, + }, { + Object: map[string]interface{}{ + "apiVersion": "policy.sigstore.dev/v1beta1", + "kind": "ClusterImagePolicy", + "metadata": map[string]interface{}{ + "name": "bar", + }, + "spec": map[string]interface{}{}, + }, + }}, + }, { + name: "bad missing apiVersion", + doc: ` +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: blah +spec: {} +--- +# Missing: apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: foo +spec: {} +--- +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: bar +spec: {} +`, + wantErr: apis.ErrMissingField("[1].apiVersion"), + }, { + name: "bad missing kind", + doc: ` +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: blah +spec: {} +--- +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: foo +spec: {} +--- +apiVersion: policy.sigstore.dev/v1beta1 +# Missing: kind: ClusterImagePolicy +metadata: + name: bar +spec: {} +`, + wantErr: errors.New(`decoding object[2]: error unmarshaling JSON: while decoding JSON: Object 'Kind' is missing in '{"apiVersion":"policy.sigstore.dev/v1beta1","metadata":{"name":"bar"},"spec":{}}'`), + }, { + name: "bad missing apiVersion", + doc: ` +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + # Missing: name: blah +sp dec: {} +--- +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: foo +spec: {} +--- +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: bar +spec: {} +`, + wantErr: apis.ErrMissingField("[0].metadata.name"), + }} + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + got, gotErr := Parse(context.Background(), test.doc) + + switch { + case (gotErr != nil) != (test.wantErr != nil): + t.Fatalf("Parse() = %v, wanted %v", gotErr, test.wantErr) + case gotErr != nil && gotErr.Error() != test.wantErr.Error(): + t.Fatalf("Parse() = %v, wanted %v", gotErr, test.wantErr) + case gotErr != nil: + return // This was an error test. + } + + if diff := cmp.Diff(got, test.want); diff != "" { + t.Errorf("Parse (-got, +want) = %s", diff) + } + }) + } +} diff --git a/pkg/policy/policy.go b/pkg/policy/policy.go new file mode 100644 index 0000000000..7622973318 --- /dev/null +++ b/pkg/policy/policy.go @@ -0,0 +1,91 @@ +// Copyright 2023 Google LLC 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 policy + +import ( + "context" + + "k8s.io/apimachinery/pkg/util/sets" + "knative.dev/pkg/apis" +) + +type Verification struct { + // NoMatchPolicy specifies the behavior when a base image doesn't match any + // of the listed policies. It allows the values: allow, deny, and warn. + NoMatchPolicy string `yaml:"no-match-policy,omitempty"` + + // Policies specifies a collection of policies to use to cover the base + // images used as part of evaluation. See "policy" below for usage. + Policies *[]PolicyData `yaml:"policies,omitempty"` +} + +// PolicyData contains a set of options for specifying a PolicyData. Exactly +// one of the fields may be specified for each PolicyData entry. +type PolicyData struct { + // Data is a collection of one or more ClusterImagePolicy resources. + Data string `yaml:"data,omitempty"` + + // TODO(mattmoor): Path support + // // Path is a path to a file or directory containing ClusterImagePolicy resources. + // // TODO(mattmoor): How do we want to handle something like -R? Perhaps we + // // don't and encourage folks to list each directory individually? + // Path string `yaml:"path,omitempty"` + + // TODO(mattmoor): URL support + // // URL links to a file containing one or more ClusterImagePolicy resources. + // URL string `yaml:"url,omitempty"` +} + +func (v *Verification) Validate(ctx context.Context) (errs *apis.FieldError) { + switch v.NoMatchPolicy { + case "allow", "deny", "warn": + // Good! + case "": + errs = errs.Also(apis.ErrMissingField("noMatchPolicy")) + default: + errs = errs.Also(apis.ErrInvalidValue(v.NoMatchPolicy, "noMatchPolicy")) + } + + if v.Policies == nil { + errs = errs.Also(apis.ErrMissingField("policies")) + } else { + for i, p := range *v.Policies { + errs = errs.Also(p.Validate(ctx).ViaFieldIndex("policies", i)) + } + } + + return errs +} + +func (pd *PolicyData) Validate(ctx context.Context) (errs *apis.FieldError) { + // Check that exactly one of the fields is set. + set := sets.NewString() + if pd.Data != "" { + set.Insert("data") + // TODO(mattmoor): Validate data. + } + // TODO(mattmoor): Check for the other fields as we add them here. + + switch set.Len() { + case 0: + // TODO: Change this to ErrMissingOneOf when we add more fields. + errs = errs.Also(apis.ErrMissingField("data")) + case 1: + // What we want. + default: + errs = errs.Also(apis.ErrMultipleOneOf(set.List()...)) + } + return errs +} diff --git a/pkg/policy/validate.go b/pkg/policy/validate.go new file mode 100644 index 0000000000..62c3ae5971 --- /dev/null +++ b/pkg/policy/validate.go @@ -0,0 +1,112 @@ +// Copyright 2023 Google LLC 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 policy + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + + "github.com/sigstore/policy-controller/pkg/apis/policy/v1alpha1" + "github.com/sigstore/policy-controller/pkg/apis/policy/v1beta1" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "knative.dev/pkg/apis" +) + +var ( + // ErrEmptyDocument is the error returned when no document body is + // specified. + ErrEmptyDocument = errors.New("document is required to create policy") + + // ErrUnknownType is the error returned when a type contained in the policy + // is unrecognized. + ErrUnknownType = errors.New("unknown type") +) + +// Validate decodes a provided YAML document containing zero or more objects +// and performs limited validation on them. +func Validate(ctx context.Context, document string) (warns error, err error) { + if len(document) == 0 { + return nil, ErrEmptyDocument + } + + uol, err := Parse(ctx, document) + if err != nil { + return nil, err + } + + for i, uo := range uol { + switch uo.GroupVersionKind() { + case v1beta1.SchemeGroupVersion.WithKind("ClusterImagePolicy"): + if warns, err = validate(ctx, uo, &v1beta1.ClusterImagePolicy{}); err != nil { + return + } + + case v1alpha1.SchemeGroupVersion.WithKind("ClusterImagePolicy"): + if warns, err = validate(ctx, uo, &v1alpha1.ClusterImagePolicy{}); err != nil { + return + } + + case corev1.SchemeGroupVersion.WithKind("Secret"): + if uo.GetNamespace() != "cosign-system" { + return warns, apis.ErrInvalidValue(uo.GetNamespace(), "metadata.namespace").ViaIndex(i) + } + // Any additional validation worth performing? Should we check the + // schema of the secret matches the expectations of cosigned? + + default: + return warns, fmt.Errorf("%w: %v", ErrUnknownType, uo.GroupVersionKind()) + } + } + return warns, nil +} + +type crd interface { + apis.Validatable + apis.Defaultable +} + +func validate(ctx context.Context, uo *unstructured.Unstructured, v crd) (warns error, err error) { + b, err := json.Marshal(uo) + if err != nil { + return nil, fmt.Errorf("unable to marshal: %w", err) + } + + dec := json.NewDecoder(bytes.NewBuffer(b)) + dec.DisallowUnknownFields() + if err := dec.Decode(v); err != nil { + return nil, fmt.Errorf("unable to unmarshal: %w", err) + } + + // Apply defaulting to simulate the defaulting webhook that runs prior + // to validation. + v.SetDefaults(ctx) + + // We can't just return v.Validate(ctx) because of Go's typed nils. + // nolint:revive + if ve := v.Validate(ctx); ve != nil { + // Separate validation warnings from errors so the caller can discern between them. + if warnFE := ve.Filter(apis.WarningLevel); warnFE != nil { + warns = warnFE + } + if errorFE := ve.Filter(apis.ErrorLevel); errorFE != nil { + err = errorFE + } + } + return +} diff --git a/pkg/policy/validate_test.go b/pkg/policy/validate_test.go new file mode 100644 index 0000000000..3172aa9d8d --- /dev/null +++ b/pkg/policy/validate_test.go @@ -0,0 +1,203 @@ +// Copyright 2023 Google LLC 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 policy + +import ( + "context" + "errors" + "testing" + + policycontrollerconfig "github.com/sigstore/policy-controller/pkg/config" + "knative.dev/pkg/apis" +) + +func TestValidate(t *testing.T) { + tests := []struct { + name string + doc string + wantWarns error + wantErr error + allowEmptyAuthorities bool + }{{ + name: "good single object", + doc: ` +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: blah +spec: + images: + - glob: '*' + authorities: + - keyless: + identities: + - issuer: https://issuer.example.com + subject: foo@example.com + url: https://fulcio.sigstore.dev +`, + wantErr: nil, + }, { + name: "good CIP and Secret", + doc: ` +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: blah +spec: + images: + - glob: '*' + authorities: + - keyless: + identities: + - issuer: https://issuer.example.com + subject: foo@example.com + url: https://fulcio.sigstore.dev +--- +apiVersion: v1 +kind: Secret +metadata: + name: foo + namespace: cosign-system +stringData: + foo: bar +`, + wantErr: nil, + }, { + name: "bad secret namespace", + doc: ` +apiVersion: v1 +kind: Secret +metadata: + name: foo + namespace: something-system +stringData: + foo: bar +`, + wantErr: errors.New(`invalid value: something-system: [0].metadata.namespace`), + }, { + name: "bad image policy", + doc: ` +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: blah +spec: + images: + - glob: '*' + authorities: + - key: {} +`, + wantErr: apis.ErrMissingOneOf("data", "kms", "secretref").ViaField("key").ViaFieldIndex("authorities", 0).ViaField("spec"), + }, { + name: "empty document", + doc: ``, + wantErr: ErrEmptyDocument, + }, { + name: "object missing kind", + doc: ` +apiVersion: policy.sigstore.dev/v1beta1 +# Missing: kind: ClusterImagePolicy +metadata: + name: blah +spec: {} +`, + wantErr: errors.New(`decoding object[0]: error unmarshaling JSON: while decoding JSON: Object 'Kind' is missing in '{"apiVersion":"policy.sigstore.dev/v1beta1","metadata":{"name":"blah"},"spec":{}}'`), + }, { + name: "unknown field", + doc: ` +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: blah +spec: + asdf: dfsadf +`, + wantErr: errors.New(`unable to unmarshal: json: unknown field "asdf"`), + }, { + name: "unknown type", + doc: ` +apiVersion: unknown.dev/v1 +kind: OtherPolicy +metadata: + name: blah +spec: {} +`, + wantErr: errors.New(`unknown type: unknown.dev/v1, Kind=OtherPolicy`), + }, { + name: "warning - missing field", + doc: ` +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: blah +spec: + images: + - glob: '*' + authorities: + - keyless: + url: https://fulcio.sigstore.dev +`, + wantWarns: errors.New("missing field(s): spec.authorities[0].keyless.identities"), + wantErr: nil, + }, + { + name: "admit - missing authorities", + doc: ` +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: blah +spec: + images: + - glob: '*' +`, + wantErr: nil, + allowEmptyAuthorities: true, + }, { + name: "deny - missing authorities", + doc: ` +apiVersion: policy.sigstore.dev/v1beta1 +kind: ClusterImagePolicy +metadata: + name: blah +spec: + images: + - glob: '*' +`, + wantErr: errors.New("missing field(s): spec.authorities"), + }} + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + testContext := context.Background() + if test.allowEmptyAuthorities { + testContext = policycontrollerconfig.ToContext(testContext, &policycontrollerconfig.PolicyControllerConfig{FailOnEmptyAuthorities: false}) + } + gotWarns, gotErr := Validate(testContext, test.doc) + if (gotErr != nil) != (test.wantErr != nil) { + t.Fatalf("Parse() = %v, wanted %v", gotErr, test.wantErr) + } + if (gotWarns != nil) != (test.wantWarns != nil) { + t.Fatalf("Parse() = %v, wanted %v", gotWarns, test.wantWarns) + } + if gotErr != nil && gotErr.Error() != test.wantErr.Error() { + t.Fatalf("Parse() = %v, wanted %v", gotErr, test.wantErr) + } + if gotWarns != nil && gotWarns.Error() != test.wantWarns.Error() { + t.Fatalf("Parse() = %v, wanted %v", gotWarns, test.wantWarns) + } + }) + } +} diff --git a/pkg/policy/verifier.go b/pkg/policy/verifier.go new file mode 100644 index 0000000000..4d7a0941f0 --- /dev/null +++ b/pkg/policy/verifier.go @@ -0,0 +1,147 @@ +// Copyright 2023 Google LLC 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 policy + +import ( + "context" + "errors" + "fmt" + + "github.com/google/go-containerregistry/pkg/authn" + "github.com/google/go-containerregistry/pkg/name" + "github.com/google/go-containerregistry/pkg/v1/remote" + ociremote "github.com/sigstore/cosign/pkg/oci/remote" + "github.com/sigstore/policy-controller/pkg/apis/config" + "github.com/sigstore/policy-controller/pkg/webhook" + webhookcip "github.com/sigstore/policy-controller/pkg/webhook/clusterimagepolicy" + "knative.dev/pkg/apis" +) + +// Verifier is the interface for checking that a given image digest satisfies +// the policies backing this interface. +type Verifier interface { + // Verify checks that the provided digest satisfies the backing policies. + Verify(context.Context, name.Digest, authn.Keychain) error +} + +// WarningWriter is used to surface warning messages in a manner that +// is customizable by callers that's suitable for their execution +// environment. +type WarningWriter func(string, ...interface{}) + +// Compile turns a Verification into an executable Verifier. +// Any compilation errors are returned here. +func Compile(ctx context.Context, v Verification, ww WarningWriter) (Verifier, error) { + // TODO(mattmoor): Validate NoMatchPolicy. + // TODO(mattmoor): Validate Policies. + + ipc, err := gather(context.Background(), v, ww) + if err != nil { + return nil, err + } + + return &impl{ + verification: v, + ipc: ipc, + ww: ww, + }, nil +} + +func gather(ctx context.Context, v Verification, ww WarningWriter) (*config.ImagePolicyConfig, error) { + pol := *v.Policies + ipc := &config.ImagePolicyConfig{ + Policies: make(map[string]webhookcip.ClusterImagePolicy, len(pol)), + } + + for i, p := range pol { + switch { + case p.Data != "": + l, warns, err := ParseClusterImagePolicies(ctx, p.Data) + if err != nil { + return nil, fmt.Errorf("parsing policies: %w", err) + } + if warns != nil { + ww("policy %d: %v", i, warns) + } + + // TODO(mattmoor): Add additional checks for unsupported things, + // like Match, IncludeSpec, etc. + + for _, cip := range l { + cip.SetDefaults(ctx) + if _, ok := ipc.Policies[cip.Name]; ok { + ww("duplicate policy named %q, skipping.", cip.Name) + continue + } + ipc.Policies[cip.Name] = *webhookcip.ConvertClusterImagePolicyV1alpha1ToWebhook(cip) + } + default: + return nil, fmt.Errorf("unsupported policy shape: %v", p) + } + } + + return ipc, nil +} + +type impl struct { + verification Verification + + ipc *config.ImagePolicyConfig + ww WarningWriter +} + +// Check that impl implements Verifier +var _ Verifier = (*impl)(nil) + +// Verify implements Verifier +func (i *impl) Verify(ctx context.Context, d name.Digest, kc authn.Keychain) error { + matches, err := i.ipc.GetMatchingPolicies(d.Name(), "" /* kind */, "" /* apiVersion */, nil /* labels */) + if err != nil { + return err + } + + if len(matches) == 0 { + switch i.verification.NoMatchPolicy { + case "allow": + return nil + case "warn": + i.ww("%s is uncovered by policy", d) + case "deny": + return fmt.Errorf("%s is uncovered by policy", d) + default: + return fmt.Errorf("unsupported noMatchPolicy: %q", i.verification.NoMatchPolicy) + } + } + + for _, p := range matches { + _, errs := webhook.ValidatePolicy(ctx, "" /* namespace */, d, p, + kc, ociremote.WithRemoteOptions(remote.WithAuthFromKeychain(kc))) + for _, err := range errs { + var fe *apis.FieldError + if errors.As(err, &fe) { + if warnFE := fe.Filter(apis.WarningLevel); warnFE != nil { + i.ww("%v", warnFE) + } + if errorFE := fe.Filter(apis.ErrorLevel); errorFE != nil { + return errorFE + } + } else { + return err + } + } + } + + return nil +} diff --git a/vendor/cloud.google.com/go/compute/internal/version.go b/vendor/cloud.google.com/go/compute/internal/version.go index 5ac4a843e1..efedadbea2 100644 --- a/vendor/cloud.google.com/go/compute/internal/version.go +++ b/vendor/cloud.google.com/go/compute/internal/version.go @@ -15,4 +15,4 @@ package internal // Version is the current tagged release of the library. -const Version = "1.12.1" +const Version = "1.13.0" diff --git a/vendor/cloud.google.com/go/compute/metadata/CHANGES.md b/vendor/cloud.google.com/go/compute/metadata/CHANGES.md index 8631b6d6d2..6e3ee8d6ab 100644 --- a/vendor/cloud.google.com/go/compute/metadata/CHANGES.md +++ b/vendor/cloud.google.com/go/compute/metadata/CHANGES.md @@ -1,5 +1,12 @@ # Changes +## [0.2.2](https://github.com/googleapis/google-cloud-go/compare/compute/metadata/v0.2.1...compute/metadata/v0.2.2) (2022-12-01) + + +### Bug Fixes + +* **compute/metadata:** Set IdleConnTimeout for http.Client ([#7084](https://github.com/googleapis/google-cloud-go/issues/7084)) ([766516a](https://github.com/googleapis/google-cloud-go/commit/766516aaf3816bfb3159efeea65aa3d1d205a3e2)), refs [#5430](https://github.com/googleapis/google-cloud-go/issues/5430) + ## [0.1.0] (2022-10-26) Initial release of metadata being it's own module. diff --git a/vendor/cloud.google.com/go/compute/metadata/metadata.go b/vendor/cloud.google.com/go/compute/metadata/metadata.go index 50538b1d34..d4aad9bf39 100644 --- a/vendor/cloud.google.com/go/compute/metadata/metadata.go +++ b/vendor/cloud.google.com/go/compute/metadata/metadata.go @@ -70,6 +70,7 @@ func newDefaultHTTPClient() *http.Client { Timeout: 2 * time.Second, KeepAlive: 30 * time.Second, }).Dial, + IdleConnTimeout: 60 * time.Second, }, Timeout: 5 * time.Second, } diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/.gitignore b/vendor/contrib.go.opencensus.io/exporter/ocagent/.gitignore new file mode 100644 index 0000000000..c435b7ebb6 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/.gitignore @@ -0,0 +1,17 @@ +# IntelliJ IDEA +.idea +*.iml +.editorconfig + +# VS Code +.vscode + +# OS X +.DS_Store + +# Emacs +*~ +\#*\# + +# Vim +.swp diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/.travis.yml b/vendor/contrib.go.opencensus.io/exporter/ocagent/.travis.yml new file mode 100644 index 0000000000..f53103b1a3 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/.travis.yml @@ -0,0 +1,20 @@ +language: go + +go: + - 1.11.x + +go_import_path: contrib.go.opencensus.io/exporter/ocagent + +install: skip + +before_script: + - GO_FILES=$(find . -iname '*.go' | grep -v /vendor/) # All the .go files, excluding vendor/ if any + - PKGS=$(go list ./... | grep -v /vendor/) # All the import paths, excluding vendor/ if any + - GO111MODULE=on # Depend on go.mod for dependencies + +script: + - go build ./... # Ensure dependency updates don't break build + - if [ -n "$(gofmt -s -l $GO_FILES)" ]; then echo "gofmt the following files:"; gofmt -s -l $GO_FILES; exit 1; fi + - go vet ./... + - go test -v -race $PKGS # Run all the tests with the race detector enabled + - 'if [[ $TRAVIS_GO_VERSION = 1.8* ]]; then ! golint ./... | grep -vE "(_mock|_string|\.pb)\.go:"; fi' diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/CONTRIBUTING.md b/vendor/contrib.go.opencensus.io/exporter/ocagent/CONTRIBUTING.md new file mode 100644 index 0000000000..0786fdf434 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/CONTRIBUTING.md @@ -0,0 +1,24 @@ +# How to contribute + +We'd love to accept your patches and contributions to this project. There are +just a few small guidelines you need to follow. + +## Contributor License Agreement + +Contributions to this project must be accompanied by a Contributor License +Agreement. You (or your employer) retain the copyright to your contribution, +this simply gives us permission to use and redistribute your contributions as +part of the project. Head over to to see +your current agreements on file or to sign a new one. + +You generally only need to submit a CLA once, so if you've already submitted one +(even if it was for a different project), you probably don't need to do it +again. + +## Code reviews + +All submissions, including submissions by project members, require review. We +use GitHub pull requests for this purpose. Consult [GitHub Help] for more +information on using pull requests. + +[GitHub Help]: https://help.github.com/articles/about-pull-requests/ diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/LICENSE b/vendor/contrib.go.opencensus.io/exporter/ocagent/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/LICENSE @@ -0,0 +1,201 @@ + 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/contrib.go.opencensus.io/exporter/ocagent/README.md b/vendor/contrib.go.opencensus.io/exporter/ocagent/README.md new file mode 100644 index 0000000000..3b9e908f59 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/README.md @@ -0,0 +1,61 @@ +# OpenCensus Agent Go Exporter + +[![Build Status][travis-image]][travis-url] [![GoDoc][godoc-image]][godoc-url] + + +This repository contains the Go implementation of the OpenCensus Agent (OC-Agent) Exporter. +OC-Agent is a deamon process running in a VM that can retrieve spans/stats/metrics from +OpenCensus Library, export them to other backends and possibly push configurations back to +Library. See more details on [OC-Agent Readme][OCAgentReadme]. + +Note: This is an experimental repository and is likely to get backwards-incompatible changes. +Ultimately we may want to move the OC-Agent Go Exporter to [OpenCensus Go core library][OpenCensusGo]. + +## Installation + +```bash +$ go get -u contrib.go.opencensus.io/exporter/ocagent +``` + +## Usage + +```go +import ( + "context" + "fmt" + "log" + "time" + + "contrib.go.opencensus.io/exporter/ocagent" + "go.opencensus.io/trace" +) + +func Example() { + exp, err := ocagent.NewExporter(ocagent.WithInsecure(), ocagent.WithServiceName("your-service-name")) + if err != nil { + log.Fatalf("Failed to create the agent exporter: %v", err) + } + defer exp.Stop() + + // Now register it as a trace exporter. + trace.RegisterExporter(exp) + + // Then use the OpenCensus tracing library, like we normally would. + ctx, span := trace.StartSpan(context.Background(), "AgentExporter-Example") + defer span.End() + + for i := 0; i < 10; i++ { + _, iSpan := trace.StartSpan(ctx, fmt.Sprintf("Sample-%d", i)) + <-time.After(6 * time.Millisecond) + iSpan.End() + } +} +``` + +[OCAgentReadme]: https://github.com/census-instrumentation/opencensus-proto/tree/master/opencensus/proto/agent#opencensus-agent-proto +[OpenCensusGo]: https://github.com/census-instrumentation/opencensus-go +[godoc-image]: https://godoc.org/contrib.go.opencensus.io/exporter/ocagent?status.svg +[godoc-url]: https://godoc.org/contrib.go.opencensus.io/exporter/ocagent +[travis-image]: https://travis-ci.org/census-ecosystem/opencensus-go-exporter-ocagent.svg?branch=master +[travis-url]: https://travis-ci.org/census-ecosystem/opencensus-go-exporter-ocagent + diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/common.go b/vendor/contrib.go.opencensus.io/exporter/ocagent/common.go new file mode 100644 index 0000000000..297e44b6e7 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/common.go @@ -0,0 +1,38 @@ +// Copyright 2018, OpenCensus Authors +// +// 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 ocagent + +import ( + "math/rand" + "time" +) + +var randSrc = rand.New(rand.NewSource(time.Now().UnixNano())) + +// retries function fn upto n times, if fn returns an error lest it returns nil early. +// It applies exponential backoff in units of (1< 0 { + ctx = metadata.NewOutgoingContext(ctx, metadata.New(ae.headers)) + } + traceExporter, err := traceSvcClient.Export(ctx) + if err != nil { + return fmt.Errorf("Exporter.Start:: TraceServiceClient: %v", err) + } + + firstTraceMessage := &agenttracepb.ExportTraceServiceRequest{ + Node: node, + Resource: ae.resource, + } + if err := traceExporter.Send(firstTraceMessage); err != nil { + return fmt.Errorf("Exporter.Start:: Failed to initiate the Config service: %v", err) + } + + ae.mu.Lock() + ae.traceExporter = traceExporter + ae.mu.Unlock() + + // Initiate the config service by sending over node identifier info. + configStream, err := traceSvcClient.Config(context.Background()) + if err != nil { + return fmt.Errorf("Exporter.Start:: ConfigStream: %v", err) + } + firstCfgMessage := &agenttracepb.CurrentLibraryConfig{Node: node} + if err := configStream.Send(firstCfgMessage); err != nil { + return fmt.Errorf("Exporter.Start:: Failed to initiate the Config service: %v", err) + } + + // In the background, handle trace configurations that are beamed down + // by the agent, but also reply to it with the applied configuration. + go ae.handleConfigStreaming(configStream) + + return nil +} + +func (ae *Exporter) createMetricsServiceConnection(cc *grpc.ClientConn, node *commonpb.Node) error { + metricsSvcClient := agentmetricspb.NewMetricsServiceClient(cc) + metricsExporter, err := metricsSvcClient.Export(context.Background()) + if err != nil { + return fmt.Errorf("MetricsExporter: failed to start the service client: %v", err) + } + // Initiate the metrics service by sending over the first message just containing the Node and Resource. + firstMetricsMessage := &agentmetricspb.ExportMetricsServiceRequest{ + Node: node, + Resource: ae.resource, + } + if err := metricsExporter.Send(firstMetricsMessage); err != nil { + return fmt.Errorf("MetricsExporter:: failed to send the first message: %v", err) + } + + ae.mu.Lock() + ae.metricsExporter = metricsExporter + ae.mu.Unlock() + + // With that we are good to go and can start sending metrics + return nil +} + +func (ae *Exporter) dialToAgent() (*grpc.ClientConn, error) { + addr := ae.prepareAgentAddress() + var dialOpts []grpc.DialOption + if ae.clientTransportCredentials != nil { + dialOpts = append(dialOpts, grpc.WithTransportCredentials(ae.clientTransportCredentials)) + } else if ae.canDialInsecure { + dialOpts = append(dialOpts, grpc.WithInsecure()) + } + if ae.compressor != "" { + dialOpts = append(dialOpts, grpc.WithDefaultCallOptions(grpc.UseCompressor(ae.compressor))) + } + dialOpts = append(dialOpts, grpc.WithStatsHandler(&ocgrpc.ClientHandler{})) + if len(ae.grpcDialOptions) != 0 { + dialOpts = append(dialOpts, ae.grpcDialOptions...) + } + + ctx := context.Background() + if len(ae.headers) > 0 { + ctx = metadata.NewOutgoingContext(ctx, metadata.New(ae.headers)) + } + return grpc.DialContext(ctx, addr, dialOpts...) +} + +func (ae *Exporter) handleConfigStreaming(configStream agenttracepb.TraceService_ConfigClient) error { + // Note: We haven't yet implemented configuration sending so we + // should NOT be changing connection states within this function for now. + for { + recv, err := configStream.Recv() + if err != nil { + // TODO: Check if this is a transient error or exponential backoff-able. + return err + } + cfg := recv.Config + if cfg == nil { + continue + } + + // Otherwise now apply the trace configuration sent down from the agent + if psamp := cfg.GetProbabilitySampler(); psamp != nil { + trace.ApplyConfig(trace.Config{DefaultSampler: trace.ProbabilitySampler(psamp.SamplingProbability)}) + } else if csamp := cfg.GetConstantSampler(); csamp != nil { + alwaysSample := csamp.Decision == tracepb.ConstantSampler_ALWAYS_ON + if alwaysSample { + trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()}) + } else { + trace.ApplyConfig(trace.Config{DefaultSampler: trace.NeverSample()}) + } + } else { // TODO: Add the rate limiting sampler here + } + + // Then finally send back to upstream the newly applied configuration + err = configStream.Send(&agenttracepb.CurrentLibraryConfig{Config: &tracepb.TraceConfig{Sampler: cfg.Sampler}}) + if err != nil { + return err + } + } +} + +// Stop shuts down all the connections and resources +// related to the exporter. +func (ae *Exporter) Stop() error { + ae.mu.RLock() + cc := ae.grpcClientConn + started := ae.started + stopped := ae.stopped + ae.mu.RUnlock() + + if !started { + return errNotStarted + } + if stopped { + // TODO: tell the user that we've already stopped, so perhaps a sentinel error? + return nil + } + + ae.Flush() + + // Now close the underlying gRPC connection. + var err error + if cc != nil { + err = cc.Close() + } + + // At this point we can change the state variables: started and stopped + ae.mu.Lock() + ae.started = false + ae.stopped = true + ae.mu.Unlock() + close(ae.stopCh) + + // Ensure that the backgroundConnector returns + <-ae.backgroundConnectionDoneCh + + return err +} + +func (ae *Exporter) ExportSpan(sd *trace.SpanData) { + if sd == nil { + return + } + _ = ae.traceBundler.Add(sd, 1) +} + +func (ae *Exporter) ExportTraceServiceRequest(batch *agenttracepb.ExportTraceServiceRequest) error { + if batch == nil || len(batch.Spans) == 0 { + return nil + } + + select { + case <-ae.stopCh: + return errStopped + + default: + if lastConnectErr := ae.lastConnectError(); lastConnectErr != nil { + return fmt.Errorf("ExportTraceServiceRequest: no active connection, last connection error: %v", lastConnectErr) + } + + ae.senderMu.Lock() + err := ae.traceExporter.Send(batch) + ae.senderMu.Unlock() + if err != nil { + if err == io.EOF { + ae.recvMu.Lock() + // Perform a .Recv to try to find out why the RPC actually ended. + // See: + // * https://github.com/grpc/grpc-go/blob/d389f9fac68eea0dcc49957d0b4cca5b3a0a7171/stream.go#L98-L100 + // * https://groups.google.com/forum/#!msg/grpc-io/XcN4hA9HonI/F_UDiejTAwAJ + for { + _, err = ae.traceExporter.Recv() + if err != nil { + break + } + } + ae.recvMu.Unlock() + } + + ae.setStateDisconnected(err) + if err != io.EOF { + return err + } + } + return nil + } +} + +func (ae *Exporter) ExportView(vd *view.Data) { + if vd == nil { + return + } + _ = ae.viewDataBundler.Add(vd, 1) +} + +// ExportMetricsServiceRequest sends proto metrics with the metrics service client. +func (ae *Exporter) ExportMetricsServiceRequest(batch *agentmetricspb.ExportMetricsServiceRequest) error { + if batch == nil || len(batch.Metrics) == 0 { + return nil + } + + select { + case <-ae.stopCh: + return errStopped + + default: + if lastConnectErr := ae.lastConnectError(); lastConnectErr != nil { + return fmt.Errorf("ExportMetricsServiceRequest: no active connection, last connection error: %v", lastConnectErr) + } + + ae.senderMu.Lock() + err := ae.metricsExporter.Send(batch) + ae.senderMu.Unlock() + if err != nil { + if err == io.EOF { + ae.recvMu.Lock() + // Perform a .Recv to try to find out why the RPC actually ended. + // See: + // * https://github.com/grpc/grpc-go/blob/d389f9fac68eea0dcc49957d0b4cca5b3a0a7171/stream.go#L98-L100 + // * https://groups.google.com/forum/#!msg/grpc-io/XcN4hA9HonI/F_UDiejTAwAJ + for { + _, err = ae.metricsExporter.Recv() + if err != nil { + break + } + } + ae.recvMu.Unlock() + } + + ae.setStateDisconnected(err) + if err != io.EOF { + return err + } + } + return nil + } +} + +func ocSpanDataToPbSpans(sdl []*trace.SpanData, spanConfig SpanConfig) []*tracepb.Span { + if len(sdl) == 0 { + return nil + } + protoSpans := make([]*tracepb.Span, 0, len(sdl)) + for _, sd := range sdl { + if sd != nil { + protoSpans = append(protoSpans, ocSpanToProtoSpan(sd, spanConfig)) + } + } + return protoSpans +} + +func (ae *Exporter) uploadTraces(sdl []*trace.SpanData) { + select { + case <-ae.stopCh: + return + + default: + if !ae.connected() { + return + } + + protoSpans := ocSpanDataToPbSpans(sdl, ae.spanConfig) + if len(protoSpans) == 0 { + return + } + ae.senderMu.Lock() + err := ae.traceExporter.Send(&agenttracepb.ExportTraceServiceRequest{ + Spans: protoSpans, + Resource: ae.resource, + }) + ae.senderMu.Unlock() + if err != nil { + ae.setStateDisconnected(err) + } + } +} + +func ocViewDataToPbMetrics(vdl []*view.Data, metricNamePrefix string) []*metricspb.Metric { + if len(vdl) == 0 { + return nil + } + metrics := make([]*metricspb.Metric, 0, len(vdl)) + for _, vd := range vdl { + if vd != nil { + vmetric, err := viewDataToMetric(vd, metricNamePrefix) + // TODO: (@odeke-em) somehow report this error, if it is non-nil. + if err == nil && vmetric != nil { + metrics = append(metrics, vmetric) + } + } + } + return metrics +} + +func (ae *Exporter) uploadViewData(vdl []*view.Data) { + protoMetrics := ocViewDataToPbMetrics(vdl, ae.metricNamePerfix) + if len(protoMetrics) == 0 { + return + } + req := &agentmetricspb.ExportMetricsServiceRequest{ + Metrics: protoMetrics, + Resource: ae.resource, + // TODO:(@odeke-em) + // a) Figure out how to derive a Node from the environment + // or better letting users of the exporter configure it. + } + ae.ExportMetricsServiceRequest(req) +} + +func (ae *Exporter) Flush() { + ae.traceBundler.Flush() + ae.viewDataBundler.Flush() +} + +func resourceProtoFromEnv() *resourcepb.Resource { + rs, _ := resource.FromEnv(context.Background()) + if rs == nil { + return nil + } + return resourceToResourcePb(rs) +} + +func resourceToResourcePb(rs *resource.Resource) *resourcepb.Resource { + rprs := &resourcepb.Resource{ + Type: rs.Type, + } + if rs.Labels != nil { + rprs.Labels = make(map[string]string) + for k, v := range rs.Labels { + rprs.Labels[k] = v + } + } + return rprs +} diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/options.go b/vendor/contrib.go.opencensus.io/exporter/ocagent/options.go new file mode 100644 index 0000000000..148a564575 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/options.go @@ -0,0 +1,206 @@ +// Copyright 2018, OpenCensus Authors +// +// 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 ocagent + +import ( + "time" + + "go.opencensus.io/resource" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" +) + +const ( + DefaultAgentPort uint16 = 55678 + DefaultAgentHost string = "localhost" +) + +type ExporterOption interface { + withExporter(e *Exporter) +} + +type resourceDetector resource.Detector + +var _ ExporterOption = (*resourceDetector)(nil) + +func (rd resourceDetector) withExporter(e *Exporter) { + e.resourceDetector = resource.Detector(rd) +} + +// WithResourceDetector allows one to register a resource detector. Resource Detector is used +// to detect resources associated with the application. Detected resource is exported +// along with the metrics. If the detector fails then it panics. +// If a resource detector is not provided then by default it detects from the environment. +func WithResourceDetector(rd resource.Detector) ExporterOption { + return resourceDetector(rd) +} + +type insecureGrpcConnection int + +var _ ExporterOption = (*insecureGrpcConnection)(nil) + +func (igc *insecureGrpcConnection) withExporter(e *Exporter) { + e.canDialInsecure = true +} + +// WithInsecure disables client transport security for the exporter's gRPC connection +// just like grpc.WithInsecure() https://godoc.org/google.golang.org/grpc#WithInsecure +// does. Note, by default, client security is required unless WithInsecure is used. +func WithInsecure() ExporterOption { return new(insecureGrpcConnection) } + +type addressSetter string + +func (as addressSetter) withExporter(e *Exporter) { + e.agentAddress = string(as) +} + +var _ ExporterOption = (*addressSetter)(nil) + +// WithAddress allows one to set the address that the exporter will +// connect to the agent on. If unset, it will instead try to use +// connect to DefaultAgentHost:DefaultAgentPort +func WithAddress(addr string) ExporterOption { + return addressSetter(addr) +} + +type serviceNameSetter string + +func (sns serviceNameSetter) withExporter(e *Exporter) { + e.serviceName = string(sns) +} + +var _ ExporterOption = (*serviceNameSetter)(nil) + +// WithServiceName allows one to set/override the service name +// that the exporter will report to the agent. +func WithServiceName(serviceName string) ExporterOption { + return serviceNameSetter(serviceName) +} + +type reconnectionPeriod time.Duration + +func (rp reconnectionPeriod) withExporter(e *Exporter) { + e.reconnectionPeriod = time.Duration(rp) +} + +func WithReconnectionPeriod(rp time.Duration) ExporterOption { + return reconnectionPeriod(rp) +} + +type compressorSetter string + +func (c compressorSetter) withExporter(e *Exporter) { + e.compressor = string(c) +} + +// UseCompressor will set the compressor for the gRPC client to use when sending requests. +// It is the responsibility of the caller to ensure that the compressor set has been registered +// with google.golang.org/grpc/encoding. This can be done by encoding.RegisterCompressor. Some +// compressors auto-register on import, such as gzip, which can be registered by calling +// `import _ "google.golang.org/grpc/encoding/gzip"` +func UseCompressor(compressorName string) ExporterOption { + return compressorSetter(compressorName) +} + +type headerSetter map[string]string + +func (h headerSetter) withExporter(e *Exporter) { + e.headers = map[string]string(h) +} + +// WithHeaders will send the provided headers when the gRPC stream connection +// is instantiated +func WithHeaders(headers map[string]string) ExporterOption { + return headerSetter(headers) +} + +type clientCredentials struct { + credentials.TransportCredentials +} + +var _ ExporterOption = (*clientCredentials)(nil) + +// WithTLSCredentials allows the connection to use TLS credentials +// when talking to the server. It takes in grpc.TransportCredentials instead +// of say a Certificate file or a tls.Certificate, because the retrieving +// these credentials can be done in many ways e.g. plain file, in code tls.Config +// or by certificate rotation, so it is up to the caller to decide what to use. +func WithTLSCredentials(creds credentials.TransportCredentials) ExporterOption { + return &clientCredentials{TransportCredentials: creds} +} + +func (cc *clientCredentials) withExporter(e *Exporter) { + e.clientTransportCredentials = cc.TransportCredentials +} + +type grpcDialOptions []grpc.DialOption + +var _ ExporterOption = (*grpcDialOptions)(nil) + +// WithGRPCDialOption opens support to any grpc.DialOption to be used. If it conflicts +// with some other configuration the GRPC specified via the agent the ones here will +// take preference since they are set last. +func WithGRPCDialOption(opts ...grpc.DialOption) ExporterOption { + return grpcDialOptions(opts) +} + +func (opts grpcDialOptions) withExporter(e *Exporter) { + e.grpcDialOptions = opts +} + +type metricNamePrefixSetter string + +var _ ExporterOption = (*metricNamePrefixSetter)(nil) + +func (p metricNamePrefixSetter) withExporter(e *Exporter) { + e.metricNamePerfix = string(p) +} + +// WithMetricNamePrefix provides an option for the caller to add a prefix to metric names. +func WithMetricNamePrefix(prefix string) ExporterOption { + return metricNamePrefixSetter(prefix) +} + +type dataBundlerOptions struct { + delay time.Duration + count int +} + +var _ ExporterOption = (*dataBundlerOptions)(nil) + +func (b dataBundlerOptions) withExporter(e *Exporter) { + if b.delay > 0 { + e.viewDataDelay = b.delay + } + if b.count > 0 { + e.viewDataBundleCount = b.count + } +} + +// WithDataBundlerOptions provides an option for the caller to configure the metrics data bundler. +func WithDataBundlerOptions(delay time.Duration, count int) ExporterOption { + return dataBundlerOptions{delay, count} +} + +func (spanConfig SpanConfig) withExporter(e *Exporter) { + e.spanConfig = spanConfig +} + +var _ ExporterOption = (*SpanConfig)(nil) + +// WithSpanConfig allows one to set the AnnotationEventsPerSpan and MessageEventsPerSpan +func WithSpanConfig(spanConfig SpanConfig) ExporterOption { + return spanConfig +} diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/span_config.go b/vendor/contrib.go.opencensus.io/exporter/ocagent/span_config.go new file mode 100644 index 0000000000..8d3d60b1d8 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/span_config.go @@ -0,0 +1,25 @@ +package ocagent + +const ( + maxAnnotationEventsPerSpan = 32 + maxMessageEventsPerSpan = 128 +) + +type SpanConfig struct { + AnnotationEventsPerSpan int + MessageEventsPerSpan int +} + +func (spanConfig SpanConfig) GetAnnotationEventsPerSpan() int { + if spanConfig.AnnotationEventsPerSpan <= 0 { + return maxAnnotationEventsPerSpan + } + return spanConfig.AnnotationEventsPerSpan +} + +func (spanConfig SpanConfig) GetMessageEventsPerSpan() int { + if spanConfig.MessageEventsPerSpan <= 0 { + return maxMessageEventsPerSpan + } + return spanConfig.MessageEventsPerSpan +} diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/transform_spans.go b/vendor/contrib.go.opencensus.io/exporter/ocagent/transform_spans.go new file mode 100644 index 0000000000..409afe1edb --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/transform_spans.go @@ -0,0 +1,243 @@ +// Copyright 2018, OpenCensus Authors +// +// 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 ocagent + +import ( + "math" + "time" + + "go.opencensus.io/trace" + "go.opencensus.io/trace/tracestate" + + tracepb "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1" + "github.com/golang/protobuf/ptypes/timestamp" +) + +func ocSpanToProtoSpan(sd *trace.SpanData, spanConfig SpanConfig) *tracepb.Span { + if sd == nil { + return nil + } + var namePtr *tracepb.TruncatableString + if sd.Name != "" { + namePtr = &tracepb.TruncatableString{Value: sd.Name} + } + return &tracepb.Span{ + TraceId: sd.TraceID[:], + SpanId: sd.SpanID[:], + ParentSpanId: sd.ParentSpanID[:], + Status: ocStatusToProtoStatus(sd.Status), + StartTime: timeToTimestamp(sd.StartTime), + EndTime: timeToTimestamp(sd.EndTime), + Links: ocLinksToProtoLinks(sd.Links), + Kind: ocSpanKindToProtoSpanKind(sd.SpanKind), + Name: namePtr, + Attributes: ocAttributesToProtoAttributes(sd.Attributes), + TimeEvents: ocTimeEventsToProtoTimeEvents(sd.Annotations, sd.MessageEvents, spanConfig), + Tracestate: ocTracestateToProtoTracestate(sd.Tracestate), + } +} + +var blankStatus trace.Status + +func ocStatusToProtoStatus(status trace.Status) *tracepb.Status { + if status == blankStatus { + return nil + } + return &tracepb.Status{ + Code: status.Code, + Message: status.Message, + } +} + +func ocLinksToProtoLinks(links []trace.Link) *tracepb.Span_Links { + if len(links) == 0 { + return nil + } + + sl := make([]*tracepb.Span_Link, 0, len(links)) + for _, ocLink := range links { + // This redefinition is necessary to prevent ocLink.*ID[:] copies + // being reused -- in short we need a new ocLink per iteration. + ocLink := ocLink + + sl = append(sl, &tracepb.Span_Link{ + TraceId: ocLink.TraceID[:], + SpanId: ocLink.SpanID[:], + Type: ocLinkTypeToProtoLinkType(ocLink.Type), + }) + } + + return &tracepb.Span_Links{ + Link: sl, + } +} + +func ocLinkTypeToProtoLinkType(oct trace.LinkType) tracepb.Span_Link_Type { + switch oct { + case trace.LinkTypeChild: + return tracepb.Span_Link_CHILD_LINKED_SPAN + case trace.LinkTypeParent: + return tracepb.Span_Link_PARENT_LINKED_SPAN + default: + return tracepb.Span_Link_TYPE_UNSPECIFIED + } +} + +func ocAttributesToProtoAttributes(attrs map[string]interface{}) *tracepb.Span_Attributes { + if len(attrs) == 0 { + return nil + } + outMap := make(map[string]*tracepb.AttributeValue) + for k, v := range attrs { + switch v := v.(type) { + case bool: + outMap[k] = &tracepb.AttributeValue{Value: &tracepb.AttributeValue_BoolValue{BoolValue: v}} + + case int: + outMap[k] = &tracepb.AttributeValue{Value: &tracepb.AttributeValue_IntValue{IntValue: int64(v)}} + + case int64: + outMap[k] = &tracepb.AttributeValue{Value: &tracepb.AttributeValue_IntValue{IntValue: v}} + + case string: + outMap[k] = &tracepb.AttributeValue{ + Value: &tracepb.AttributeValue_StringValue{ + StringValue: &tracepb.TruncatableString{Value: v}, + }, + } + } + } + return &tracepb.Span_Attributes{ + AttributeMap: outMap, + } +} + +// This code is mostly copied from +// https://github.com/census-ecosystem/opencensus-go-exporter-stackdriver/blob/master/trace_proto.go#L46 +func ocTimeEventsToProtoTimeEvents(as []trace.Annotation, es []trace.MessageEvent, spanConfig SpanConfig) *tracepb.Span_TimeEvents { + if len(as) == 0 && len(es) == 0 { + return nil + } + + timeEvents := &tracepb.Span_TimeEvents{} + var annotations, droppedAnnotationsCount int + var messageEvents, droppedMessageEventsCount int + + // Transform annotations + for i, a := range as { + if annotations >= spanConfig.GetAnnotationEventsPerSpan() { + droppedAnnotationsCount = len(as) - i + break + } + annotations++ + timeEvents.TimeEvent = append(timeEvents.TimeEvent, + &tracepb.Span_TimeEvent{ + Time: timeToTimestamp(a.Time), + Value: transformAnnotationToTimeEvent(&a), + }, + ) + } + + // Transform message events + for i, e := range es { + if messageEvents >= spanConfig.GetMessageEventsPerSpan() { + droppedMessageEventsCount = len(es) - i + break + } + messageEvents++ + timeEvents.TimeEvent = append(timeEvents.TimeEvent, + &tracepb.Span_TimeEvent{ + Time: timeToTimestamp(e.Time), + Value: transformMessageEventToTimeEvent(&e), + }, + ) + } + + // Process dropped counter + timeEvents.DroppedAnnotationsCount = clip32(droppedAnnotationsCount) + timeEvents.DroppedMessageEventsCount = clip32(droppedMessageEventsCount) + + return timeEvents +} + +func transformAnnotationToTimeEvent(a *trace.Annotation) *tracepb.Span_TimeEvent_Annotation_ { + return &tracepb.Span_TimeEvent_Annotation_{ + Annotation: &tracepb.Span_TimeEvent_Annotation{ + Description: &tracepb.TruncatableString{Value: a.Message}, + Attributes: ocAttributesToProtoAttributes(a.Attributes), + }, + } +} + +func transformMessageEventToTimeEvent(e *trace.MessageEvent) *tracepb.Span_TimeEvent_MessageEvent_ { + return &tracepb.Span_TimeEvent_MessageEvent_{ + MessageEvent: &tracepb.Span_TimeEvent_MessageEvent{ + Type: tracepb.Span_TimeEvent_MessageEvent_Type(e.EventType), + Id: uint64(e.MessageID), + UncompressedSize: uint64(e.UncompressedByteSize), + CompressedSize: uint64(e.CompressedByteSize), + }, + } +} + +// clip32 clips an int to the range of an int32. +func clip32(x int) int32 { + if x < math.MinInt32 { + return math.MinInt32 + } + if x > math.MaxInt32 { + return math.MaxInt32 + } + return int32(x) +} + +func timeToTimestamp(t time.Time) *timestamp.Timestamp { + nanoTime := t.UnixNano() + return ×tamp.Timestamp{ + Seconds: nanoTime / 1e9, + Nanos: int32(nanoTime % 1e9), + } +} + +func ocSpanKindToProtoSpanKind(kind int) tracepb.Span_SpanKind { + switch kind { + case trace.SpanKindClient: + return tracepb.Span_CLIENT + case trace.SpanKindServer: + return tracepb.Span_SERVER + default: + return tracepb.Span_SPAN_KIND_UNSPECIFIED + } +} + +func ocTracestateToProtoTracestate(ts *tracestate.Tracestate) *tracepb.Span_Tracestate { + if ts == nil { + return nil + } + return &tracepb.Span_Tracestate{ + Entries: ocTracestateEntriesToProtoTracestateEntries(ts.Entries()), + } +} + +func ocTracestateEntriesToProtoTracestateEntries(entries []tracestate.Entry) []*tracepb.Span_Tracestate_Entry { + protoEntries := make([]*tracepb.Span_Tracestate_Entry, 0, len(entries)) + for _, entry := range entries { + protoEntries = append(protoEntries, &tracepb.Span_Tracestate_Entry{ + Key: entry.Key, + Value: entry.Value, + }) + } + return protoEntries +} diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/transform_stats_to_metrics.go b/vendor/contrib.go.opencensus.io/exporter/ocagent/transform_stats_to_metrics.go new file mode 100644 index 0000000000..4516091252 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/transform_stats_to_metrics.go @@ -0,0 +1,278 @@ +// Copyright 2018, OpenCensus Authors +// +// 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 ocagent + +import ( + "errors" + "time" + + "go.opencensus.io/stats" + "go.opencensus.io/stats/view" + "go.opencensus.io/tag" + + "github.com/golang/protobuf/ptypes/timestamp" + + metricspb "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1" +) + +var ( + errNilMeasure = errors.New("expecting a non-nil stats.Measure") + errNilView = errors.New("expecting a non-nil view.View") + errNilViewData = errors.New("expecting a non-nil view.Data") +) + +func viewDataToMetric(vd *view.Data, metricNamePrefix string) (*metricspb.Metric, error) { + if vd == nil { + return nil, errNilViewData + } + + descriptor, err := viewToMetricDescriptor(vd.View, metricNamePrefix) + if err != nil { + return nil, err + } + + timeseries, err := viewDataToTimeseries(vd) + if err != nil { + return nil, err + } + + metric := &metricspb.Metric{ + MetricDescriptor: descriptor, + Timeseries: timeseries, + } + return metric, nil +} + +func viewToMetricDescriptor(v *view.View, metricNamePrefix string) (*metricspb.MetricDescriptor, error) { + if v == nil { + return nil, errNilView + } + if v.Measure == nil { + return nil, errNilMeasure + } + + name := stringOrCall(v.Name, v.Measure.Name) + if len(metricNamePrefix) > 0 { + name = metricNamePrefix + "/" + name + } + desc := &metricspb.MetricDescriptor{ + Name: name, + Description: stringOrCall(v.Description, v.Measure.Description), + Unit: v.Measure.Unit(), + Type: aggregationToMetricDescriptorType(v), + LabelKeys: tagKeysToLabelKeys(v.TagKeys), + } + return desc, nil +} + +func stringOrCall(first string, call func() string) string { + if first != "" { + return first + } + return call() +} + +type measureType uint + +const ( + measureUnknown measureType = iota + measureInt64 + measureFloat64 +) + +func measureTypeFromMeasure(m stats.Measure) measureType { + switch m.(type) { + default: + return measureUnknown + case *stats.Float64Measure: + return measureFloat64 + case *stats.Int64Measure: + return measureInt64 + } +} + +func aggregationToMetricDescriptorType(v *view.View) metricspb.MetricDescriptor_Type { + if v == nil || v.Aggregation == nil { + return metricspb.MetricDescriptor_UNSPECIFIED + } + if v.Measure == nil { + return metricspb.MetricDescriptor_UNSPECIFIED + } + + switch v.Aggregation.Type { + case view.AggTypeCount: + // Cumulative on int64 + return metricspb.MetricDescriptor_CUMULATIVE_INT64 + + case view.AggTypeDistribution: + // Cumulative types + return metricspb.MetricDescriptor_CUMULATIVE_DISTRIBUTION + + case view.AggTypeLastValue: + // Gauge types + switch measureTypeFromMeasure(v.Measure) { + case measureFloat64: + return metricspb.MetricDescriptor_GAUGE_DOUBLE + case measureInt64: + return metricspb.MetricDescriptor_GAUGE_INT64 + } + + case view.AggTypeSum: + // Cumulative types + switch measureTypeFromMeasure(v.Measure) { + case measureFloat64: + return metricspb.MetricDescriptor_CUMULATIVE_DOUBLE + case measureInt64: + return metricspb.MetricDescriptor_CUMULATIVE_INT64 + } + } + + // For all other cases, return unspecified. + return metricspb.MetricDescriptor_UNSPECIFIED +} + +func tagKeysToLabelKeys(tagKeys []tag.Key) []*metricspb.LabelKey { + labelKeys := make([]*metricspb.LabelKey, 0, len(tagKeys)) + for _, tagKey := range tagKeys { + labelKeys = append(labelKeys, &metricspb.LabelKey{ + Key: tagKey.Name(), + }) + } + return labelKeys +} + +func viewDataToTimeseries(vd *view.Data) ([]*metricspb.TimeSeries, error) { + if vd == nil || len(vd.Rows) == 0 { + return nil, nil + } + + // Given that view.Data only contains Start, End + // the timestamps for all the row data will be the exact same + // per aggregation. However, the values will differ. + // Each row has its own tags. + startTimestamp := timeToProtoTimestamp(vd.Start) + endTimestamp := timeToProtoTimestamp(vd.End) + + mType := measureTypeFromMeasure(vd.View.Measure) + timeseries := make([]*metricspb.TimeSeries, 0, len(vd.Rows)) + // It is imperative that the ordering of "LabelValues" matches those + // of the Label keys in the metric descriptor. + for _, row := range vd.Rows { + labelValues := labelValuesFromTags(row.Tags) + point := rowToPoint(vd.View, row, endTimestamp, mType) + timeseries = append(timeseries, &metricspb.TimeSeries{ + StartTimestamp: startTimestamp, + LabelValues: labelValues, + Points: []*metricspb.Point{point}, + }) + } + + if len(timeseries) == 0 { + return nil, nil + } + + return timeseries, nil +} + +func timeToProtoTimestamp(t time.Time) *timestamp.Timestamp { + unixNano := t.UnixNano() + return ×tamp.Timestamp{ + Seconds: int64(unixNano / 1e9), + Nanos: int32(unixNano % 1e9), + } +} + +func rowToPoint(v *view.View, row *view.Row, endTimestamp *timestamp.Timestamp, mType measureType) *metricspb.Point { + pt := &metricspb.Point{ + Timestamp: endTimestamp, + } + + switch data := row.Data.(type) { + case *view.CountData: + pt.Value = &metricspb.Point_Int64Value{Int64Value: data.Value} + + case *view.DistributionData: + pt.Value = &metricspb.Point_DistributionValue{ + DistributionValue: &metricspb.DistributionValue{ + Count: data.Count, + Sum: float64(data.Count) * data.Mean, // because Mean := Sum/Count + // TODO: Add Exemplar + Buckets: bucketsToProtoBuckets(data.CountPerBucket), + BucketOptions: &metricspb.DistributionValue_BucketOptions{ + Type: &metricspb.DistributionValue_BucketOptions_Explicit_{ + Explicit: &metricspb.DistributionValue_BucketOptions_Explicit{ + Bounds: v.Aggregation.Buckets, + }, + }, + }, + SumOfSquaredDeviation: data.SumOfSquaredDev, + }} + + case *view.LastValueData: + setPointValue(pt, data.Value, mType) + + case *view.SumData: + setPointValue(pt, data.Value, mType) + } + + return pt +} + +// Not returning anything from this function because metricspb.Point.is_Value is an unexported +// interface hence we just have to set its value by pointer. +func setPointValue(pt *metricspb.Point, value float64, mType measureType) { + if mType == measureInt64 { + pt.Value = &metricspb.Point_Int64Value{Int64Value: int64(value)} + } else { + pt.Value = &metricspb.Point_DoubleValue{DoubleValue: value} + } +} + +func bucketsToProtoBuckets(countPerBucket []int64) []*metricspb.DistributionValue_Bucket { + distBuckets := make([]*metricspb.DistributionValue_Bucket, len(countPerBucket)) + for i := 0; i < len(countPerBucket); i++ { + count := countPerBucket[i] + + distBuckets[i] = &metricspb.DistributionValue_Bucket{ + Count: count, + } + } + + return distBuckets +} + +func labelValuesFromTags(tags []tag.Tag) []*metricspb.LabelValue { + if len(tags) == 0 { + return nil + } + + labelValues := make([]*metricspb.LabelValue, 0, len(tags)) + for _, tag_ := range tags { + labelValues = append(labelValues, &metricspb.LabelValue{ + Value: tag_.Value, + + // It is imperative that we set the "HasValue" attribute, + // in order to distinguish missing a label from the empty string. + // https://godoc.org/github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1#LabelValue.HasValue + // + // OpenCensus-Go uses non-pointers for tags as seen by this function's arguments, + // so the best case that we can use to distinguish missing labels/tags from the + // empty string is by checking if the Tag.Key.Name() != "" to indicate that we have + // a value. + HasValue: tag_.Key.Name() != "", + }) + } + return labelValues +} diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/version.go b/vendor/contrib.go.opencensus.io/exporter/ocagent/version.go new file mode 100644 index 0000000000..68be4c75bd --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/version.go @@ -0,0 +1,17 @@ +// Copyright 2018, OpenCensus Authors +// +// 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 ocagent + +const Version = "0.0.1" diff --git a/vendor/contrib.go.opencensus.io/exporter/prometheus/.gitignore b/vendor/contrib.go.opencensus.io/exporter/prometheus/.gitignore new file mode 100644 index 0000000000..85e7c1dfcb --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/prometheus/.gitignore @@ -0,0 +1 @@ +/.idea/ diff --git a/vendor/contrib.go.opencensus.io/exporter/prometheus/.golangci.yml b/vendor/contrib.go.opencensus.io/exporter/prometheus/.golangci.yml new file mode 100644 index 0000000000..0aa9844f42 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/prometheus/.golangci.yml @@ -0,0 +1,123 @@ +# options for analysis running +run: + # default concurrency is a available CPU number + concurrency: 4 + + # timeout for analysis, e.g. 30s, 5m, default is 1m + timeout: 10m + + # exit code when at least one issue was found, default is 1 + issues-exit-code: 1 + + # include test files or not, default is true + tests: true + + # which dirs to skip: issues from them won't be reported; + # can use regexp here: generated.*, regexp is applied on full path; + # default value is empty list, but default dirs are skipped independently + # from this option's value (see skip-dirs-use-default). + skip-dirs: + + # default is true. Enables skipping of directories: + # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ + skip-dirs-use-default: false + + # which files to skip: they will be analyzed, but issues from them + # won't be reported. Default value is empty list, but there is + # no need to include all autogenerated files, we confidently recognize + # autogenerated files. If it's not please let us know. + skip-files: + + # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules": + # If invoked with -mod=readonly, the go command is disallowed from the implicit + # automatic updating of go.mod described above. Instead, it fails when any changes + # to go.mod are needed. This setting is most useful to check that go.mod does + # not need updates, such as in a continuous integration and testing system. + # If invoked with -mod=vendor, the go command assumes that the vendor + # directory holds the correct copies of dependencies and ignores + # the dependency descriptions in go.mod. + modules-download-mode: readonly + +# output configuration options +output: + # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number" + format: colored-line-number + + # print lines of code with issue, default is true + print-issued-lines: true + + # print linter name in the end of issue text, default is true + print-linter-name: true + +# all available settings of specific linters +linters-settings: + govet: + # report about shadowed variables + check-shadowing: true + + # settings per analyzer + settings: + printf: # analyzer name, run `go tool vet help` to see all analyzers + funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf + - (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf + + enable-all: true + # TODO: Enable this and fix the alignment issues. + disable: + - fieldalignment + + golint: + # minimal confidence for issues, default is 0.8 + min-confidence: 0.8 + + gofmt: + # simplify code: gofmt with `-s` option, true by default + simplify: true + + goimports: + # put imports beginning with prefix after 3rd-party packages; + # it's a comma-separated list of prefixes + local-prefixes: contrib.go.opencensus.io/exporter/prometheus + + misspell: + # Correct spellings using locale preferences for US or UK. + # Default is to use a neutral variety of English. + # Setting locale to US will correct the British spelling of 'colour' to 'color'. + locale: US + ignore-words: + - cancelled + - metre + - meter + - metres + - kilometre + - kilometres + +linters: + disable: + - errcheck + enable: + - gofmt + - goimports + - golint + - gosec + - govet + - staticcheck + - misspell + - scopelint + - unconvert + - gocritic + - unparam + +issues: + # Excluding configuration per-path, per-linter, per-text and per-source + exclude-rules: + # Exclude some linters from running on tests files. + - path: _test\.go + linters: + - scopelint + - text: "G404:" + linters: + - gosec diff --git a/vendor/contrib.go.opencensus.io/exporter/prometheus/.travis.yml b/vendor/contrib.go.opencensus.io/exporter/prometheus/.travis.yml new file mode 100644 index 0000000000..17afafec2b --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/prometheus/.travis.yml @@ -0,0 +1,17 @@ +language: go + +go_import_path: contrib.go.opencensus.io + +go: + - 1.15.x + +env: + global: + GO111MODULE=on + +before_script: + - make install-tools + +script: + - make travis-ci + diff --git a/vendor/contrib.go.opencensus.io/exporter/prometheus/LICENSE b/vendor/contrib.go.opencensus.io/exporter/prometheus/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/prometheus/LICENSE @@ -0,0 +1,201 @@ + 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/contrib.go.opencensus.io/exporter/prometheus/Makefile b/vendor/contrib.go.opencensus.io/exporter/prometheus/Makefile new file mode 100644 index 0000000000..cf4d613281 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/prometheus/Makefile @@ -0,0 +1,50 @@ +# TODO: Fix this on windows. +ALL_SRC := $(shell find . -name '*.go' \ + -not -path './vendor/*' \ + -not -path '*/gen-go/*' \ + -type f | sort) +ALL_PKGS := $(shell go list $(sort $(dir $(ALL_SRC)))) + +GOTEST_OPT?=-v -race -timeout 30s +GOTEST_OPT_WITH_COVERAGE = $(GOTEST_OPT) -coverprofile=coverage.txt -covermode=atomic +GOTEST=go test +LINT=golangci-lint +# TODO decide if we need to change these names. +README_FILES := $(shell find . -name '*README.md' | sort | tr '\n' ' ') + +.DEFAULT_GOAL := lint-test + +.PHONY: lint-test +lint-test: lint test + +# TODO enable test-with-coverage in travis +.PHONY: travis-ci +travis-ci: lint test test-386 + +all-pkgs: + @echo $(ALL_PKGS) | tr ' ' '\n' | sort + +all-srcs: + @echo $(ALL_SRC) | tr ' ' '\n' | sort + +.PHONY: test +test: + $(GOTEST) $(GOTEST_OPT) $(ALL_PKGS) + +.PHONY: test-386 +test-386: + GOARCH=386 $(GOTEST) -v -timeout 30s $(ALL_PKGS) + +.PHONY: test-with-coverage +test-with-coverage: + $(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) $(ALL_PKGS) + +.PHONY: lint +lint: + $(LINT) run --allow-parallel-runners + +.PHONY: install-tools +install-tools: + cd internal/tools && go install golang.org/x/tools/cmd/cover + cd internal/tools && go install github.com/golangci/golangci-lint/cmd/golangci-lint + diff --git a/vendor/contrib.go.opencensus.io/exporter/prometheus/README.md b/vendor/contrib.go.opencensus.io/exporter/prometheus/README.md new file mode 100644 index 0000000000..3a9c5d3c8e --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/prometheus/README.md @@ -0,0 +1,14 @@ +# OpenCensus Go Prometheus Exporter + +[![Build Status](https://travis-ci.org/census-ecosystem/opencensus-go-exporter-prometheus.svg?branch=master)](https://travis-ci.org/census-ecosystem/opencensus-go-exporter-prometheus) [![GoDoc][godoc-image]][godoc-url] + +Provides OpenCensus metrics export support for Prometheus. + +## Installation + +``` +$ go get -u contrib.go.opencensus.io/exporter/prometheus +``` + +[godoc-image]: https://godoc.org/contrib.go.opencensus.io/exporter/prometheus?status.svg +[godoc-url]: https://godoc.org/contrib.go.opencensus.io/exporter/prometheus diff --git a/vendor/contrib.go.opencensus.io/exporter/prometheus/prometheus.go b/vendor/contrib.go.opencensus.io/exporter/prometheus/prometheus.go new file mode 100644 index 0000000000..b94c6d3991 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/prometheus/prometheus.go @@ -0,0 +1,303 @@ +// Copyright 2017, OpenCensus Authors +// +// 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 prometheus contains a Prometheus exporter that supports exporting +// OpenCensus views as Prometheus metrics. +package prometheus // import "contrib.go.opencensus.io/exporter/prometheus" + +import ( + "context" + "fmt" + "log" + "net/http" + "sync" + + "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/promhttp" + "go.opencensus.io/metric/metricdata" + "go.opencensus.io/metric/metricexport" + "go.opencensus.io/stats/view" +) + +// Exporter exports stats to Prometheus, users need +// to register the exporter as an http.Handler to be +// able to export. +type Exporter struct { + opts Options + g prometheus.Gatherer + c *collector + handler http.Handler +} + +// Options contains options for configuring the exporter. +type Options struct { + Namespace string + Registry *prometheus.Registry + Registerer prometheus.Registerer + Gatherer prometheus.Gatherer + OnError func(err error) + ConstLabels prometheus.Labels // ConstLabels will be set as labels on all views. +} + +// NewExporter returns an exporter that exports stats to Prometheus. +func NewExporter(o Options) (*Exporter, error) { + if o.Registry == nil { + o.Registry = prometheus.NewRegistry() + } + if o.Registerer == nil { + o.Registerer = o.Registry + } + if o.Gatherer == nil { + o.Gatherer = o.Registry + } + + collector := newCollector(o, o.Registerer) + e := &Exporter{ + opts: o, + g: o.Gatherer, + c: collector, + handler: promhttp.HandlerFor(o.Gatherer, promhttp.HandlerOpts{}), + } + collector.ensureRegisteredOnce() + + return e, nil +} + +var _ http.Handler = (*Exporter)(nil) + +// ensureRegisteredOnce invokes reg.Register on the collector itself +// exactly once to ensure that we don't get errors such as +// cannot register the collector: descriptor Desc{fqName: *} +// already exists with the same fully-qualified name and const label values +// which is documented by Prometheus at +// https://github.com/prometheus/client_golang/blob/fcc130e101e76c5d303513d0e28f4b6d732845c7/prometheus/registry.go#L89-L101 +func (c *collector) ensureRegisteredOnce() { + c.registerOnce.Do(func() { + if err := c.reg.Register(c); err != nil { + c.opts.onError(fmt.Errorf("cannot register the collector: %v", err)) + } + }) + +} + +func (o *Options) onError(err error) { + if o.OnError != nil { + o.OnError(err) + } else { + log.Printf("Failed to export to Prometheus: %v", err) + } +} + +// ExportView exports to the Prometheus if view data has one or more rows. +// Each OpenCensus AggregationData will be converted to +// corresponding Prometheus Metric: SumData will be converted +// to Untyped Metric, CountData will be a Counter Metric, +// DistributionData will be a Histogram Metric. +// +// Deprecated: in lieu of metricexport.Reader interface. +func (e *Exporter) ExportView(vd *view.Data) { +} + +// ServeHTTP serves the Prometheus endpoint. +func (e *Exporter) ServeHTTP(w http.ResponseWriter, r *http.Request) { + e.handler.ServeHTTP(w, r) +} + +// collector implements prometheus.Collector +type collector struct { + opts Options + + registerOnce sync.Once + + // reg helps collector register views dynamically. + reg prometheus.Registerer + + // reader reads metrics from all registered producers. + reader *metricexport.Reader +} + +func (c *collector) Describe(ch chan<- *prometheus.Desc) { + de := &descExporter{c: c, descCh: ch} + c.reader.ReadAndExport(de) +} + +// Collect fetches the statistics from OpenCensus +// and delivers them as Prometheus Metrics. +// Collect is invoked every time a prometheus.Gatherer is run +// for example when the HTTP endpoint is invoked by Prometheus. +func (c *collector) Collect(ch chan<- prometheus.Metric) { + me := &metricExporter{c: c, metricCh: ch} + c.reader.ReadAndExport(me) +} + +func newCollector(opts Options, registrar prometheus.Registerer) *collector { + return &collector{ + reg: registrar, + opts: opts, + reader: metricexport.NewReader()} +} + +func (c *collector) toDesc(metric *metricdata.Metric) *prometheus.Desc { + var labels prometheus.Labels + switch { + case metric.Resource == nil: + labels = c.opts.ConstLabels + case c.opts.ConstLabels == nil: + labels = metric.Resource.Labels + default: + labels = prometheus.Labels{} + for k, v := range c.opts.ConstLabels { + labels[k] = v + } + // Resource labels overwrite const labels. + for k, v := range metric.Resource.Labels { + labels[k] = v + } + } + + return prometheus.NewDesc( + metricName(c.opts.Namespace, metric), + metric.Descriptor.Description, + toPromLabels(metric.Descriptor.LabelKeys), + labels) +} + +type metricExporter struct { + c *collector + metricCh chan<- prometheus.Metric +} + +// ExportMetrics exports to the Prometheus. +// Each OpenCensus Metric will be converted to +// corresponding Prometheus Metric: +// TypeCumulativeInt64 and TypeCumulativeFloat64 will be a Counter Metric, +// TypeCumulativeDistribution will be a Histogram Metric. +// TypeGaugeFloat64 and TypeGaugeInt64 will be a Gauge Metric +func (me *metricExporter) ExportMetrics(ctx context.Context, metrics []*metricdata.Metric) error { + for _, metric := range metrics { + desc := me.c.toDesc(metric) + for _, ts := range metric.TimeSeries { + tvs := toLabelValues(ts.LabelValues) + for _, point := range ts.Points { + metric, err := toPromMetric(desc, metric, point, tvs) + if err != nil { + me.c.opts.onError(err) + } else if metric != nil { + me.metricCh <- metric + } + } + } + } + return nil +} + +type descExporter struct { + c *collector + descCh chan<- *prometheus.Desc +} + +// ExportMetrics exports descriptor to the Prometheus. +// It is invoked when request to scrape descriptors is received. +func (me *descExporter) ExportMetrics(ctx context.Context, metrics []*metricdata.Metric) error { + for _, metric := range metrics { + desc := me.c.toDesc(metric) + me.descCh <- desc + } + return nil +} + +func toPromLabels(mls []metricdata.LabelKey) (labels []string) { + for _, ml := range mls { + labels = append(labels, sanitize(ml.Key)) + } + return labels +} + +func metricName(namespace string, m *metricdata.Metric) string { + var name string + if namespace != "" { + name = namespace + "_" + } + return name + sanitize(m.Descriptor.Name) +} + +func toPromMetric( + desc *prometheus.Desc, + metric *metricdata.Metric, + point metricdata.Point, + labelValues []string) (prometheus.Metric, error) { + switch metric.Descriptor.Type { + case metricdata.TypeCumulativeFloat64, metricdata.TypeCumulativeInt64: + pv, err := toPromValue(point) + if err != nil { + return nil, err + } + return prometheus.NewConstMetric(desc, prometheus.CounterValue, pv, labelValues...) + + case metricdata.TypeGaugeFloat64, metricdata.TypeGaugeInt64: + pv, err := toPromValue(point) + if err != nil { + return nil, err + } + return prometheus.NewConstMetric(desc, prometheus.GaugeValue, pv, labelValues...) + + case metricdata.TypeCumulativeDistribution: + switch v := point.Value.(type) { + case *metricdata.Distribution: + points := make(map[float64]uint64) + // Histograms are cumulative in Prometheus. + // Get cumulative bucket counts. + cumCount := uint64(0) + for i, b := range v.BucketOptions.Bounds { + cumCount += uint64(v.Buckets[i].Count) + points[b] = cumCount + } + return prometheus.NewConstHistogram(desc, uint64(v.Count), v.Sum, points, labelValues...) + default: + return nil, typeMismatchError(point) + } + case metricdata.TypeSummary: + // TODO: [rghetia] add support for TypeSummary. + return nil, nil + default: + return nil, fmt.Errorf("aggregation %T is not yet supported", metric.Descriptor.Type) + } +} + +func toLabelValues(labelValues []metricdata.LabelValue) (values []string) { + for _, lv := range labelValues { + if lv.Present { + values = append(values, lv.Value) + } else { + values = append(values, "") + } + } + return values +} + +func typeMismatchError(point metricdata.Point) error { + return fmt.Errorf("point type %T does not match metric type", point) + +} + +func toPromValue(point metricdata.Point) (float64, error) { + switch v := point.Value.(type) { + case float64: + return v, nil + case int64: + return float64(v), nil + default: + return 0.0, typeMismatchError(point) + } +} diff --git a/vendor/contrib.go.opencensus.io/exporter/prometheus/sanitize.go b/vendor/contrib.go.opencensus.io/exporter/prometheus/sanitize.go new file mode 100644 index 0000000000..9c9a9c4dd7 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/prometheus/sanitize.go @@ -0,0 +1,38 @@ +// Copyright 2017, OpenCensus Authors +// +// 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 prometheus + +import ( + "github.com/prometheus/statsd_exporter/pkg/mapper" +) + +const labelKeySizeLimit = 100 + +// sanitize returns a string that is trunacated to 100 characters if it's too +// long, and replaces non-alphanumeric characters to underscores. +func sanitize(s string) string { + if len(s) == 0 { + return s + } + if len(s) > labelKeySizeLimit { + s = s[:labelKeySizeLimit] + } + + s = mapper.EscapeMetricName(s) + if s[0] == '_' { + s = "key" + s + } + return s +} diff --git a/vendor/cuelang.org/go/AUTHORS b/vendor/cuelang.org/go/AUTHORS new file mode 100644 index 0000000000..884392fca0 --- /dev/null +++ b/vendor/cuelang.org/go/AUTHORS @@ -0,0 +1,6 @@ +# This is the list of CUE authors for copyright purposes. +# +# This does not necessarily list everyone who has contributed code, since in +# some cases, their employer may be the copyright holder. To see the full list +# of contributors, see the revision history in source control. +Google LLC diff --git a/vendor/cuelang.org/go/LICENSE b/vendor/cuelang.org/go/LICENSE new file mode 100644 index 0000000000..d645695673 --- /dev/null +++ b/vendor/cuelang.org/go/LICENSE @@ -0,0 +1,202 @@ + + 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/cuelang.org/go/cue/ast/ast.go b/vendor/cuelang.org/go/cue/ast/ast.go new file mode 100644 index 0000000000..6018808abd --- /dev/null +++ b/vendor/cuelang.org/go/cue/ast/ast.go @@ -0,0 +1,1057 @@ +// Copyright 2018 The CUE Authors +// +// 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 ast declares the types used to represent syntax trees for CUE +// packages. +package ast // import "cuelang.org/go/cue/ast" + +import ( + "fmt" + "strings" + + "cuelang.org/go/cue/literal" + "cuelang.org/go/cue/token" +) + +// ---------------------------------------------------------------------------- +// Interfaces +// +// There are three main classes of nodes: expressions, clauses, and declaration +// nodes. The node names usually match the corresponding CUE spec production +// names to which they correspond. The node fields correspond to the individual +// parts of the respective productions. +// +// All nodes contain position information marking the beginning of the +// corresponding source text segment; it is accessible via the Pos accessor +// method. Nodes may contain additional position info for language constructs +// where comments may be found between parts of the construct (typically any +// larger, parenthesized subpart). That position information is needed to +// properly position comments when printing the construct. + +// A Node represents any node in the abstract syntax tree. +type Node interface { + Pos() token.Pos // position of first character belonging to the node + End() token.Pos // position of first character immediately after the node + + // pos reports the pointer to the position of first character belonging to + // the node or nil if there is no such position. + pos() *token.Pos + + // Deprecated: use ast.Comments + Comments() []*CommentGroup + + // Deprecated: use ast.AddComment + AddComment(*CommentGroup) + commentInfo() *comments +} + +// Name describes the type of n. +func Name(n Node) string { + s := fmt.Sprintf("%T", n) + return strings.ToLower(s[strings.Index(s, "ast.")+4:]) +} + +func getPos(n Node) token.Pos { + p := n.pos() + if p == nil { + return token.NoPos + } + return *p +} + +// SetPos sets a node to the given position, if possible. +func SetPos(n Node, p token.Pos) { + ptr := n.pos() + if ptr == nil { + return + } + *ptr = p +} + +// SetRelPos sets the relative position of a node without modifying its +// file position. Setting it to token.NoRelPos allows a node to adopt default +// formatting. +func SetRelPos(n Node, p token.RelPos) { + ptr := n.pos() + if ptr == nil { + return + } + pos := *ptr + *ptr = pos.WithRel(p) +} + +// An Expr is implemented by all expression nodes. +type Expr interface { + Node + declNode() // An expression can be used as a declaration. + exprNode() +} + +type expr struct{ decl } + +func (expr) exprNode() {} + +// A Decl node is implemented by all declarations. +type Decl interface { + Node + declNode() +} + +type decl struct{} + +func (decl) declNode() {} + +// A Label is any production that can be used as a LHS label. +type Label interface { + Node + labelNode() +} + +type label struct{} + +func (l label) labelNode() {} + +// Clause nodes are part of comprehensions. +type Clause interface { + Node + clauseNode() +} + +type clause struct{} + +func (clause) clauseNode() {} + +func (x *ForClause) clauseNode() {} +func (x *IfClause) clauseNode() {} +func (x *Alias) clauseNode() {} + +// Comments + +type comments struct { + groups *[]*CommentGroup +} + +func (c *comments) commentInfo() *comments { return c } + +func (c *comments) Comments() []*CommentGroup { + if c.groups == nil { + return []*CommentGroup{} + } + return *c.groups +} + +// // AddComment adds the given comments to the fields. +// // If line is true the comment is inserted at the preceding token. + +func (c *comments) AddComment(cg *CommentGroup) { + if cg == nil { + return + } + if c.groups == nil { + a := []*CommentGroup{cg} + c.groups = &a + return + } + + *c.groups = append(*c.groups, cg) + a := *c.groups + for i := len(a) - 2; i >= 0 && a[i].Position > cg.Position; i-- { + a[i], a[i+1] = a[i+1], a[i] + } +} + +func (c *comments) SetComments(cgs []*CommentGroup) { + if c.groups == nil { + a := cgs + c.groups = &a + return + } + *c.groups = cgs +} + +// A Comment node represents a single //-style or /*-style comment. +type Comment struct { + Slash token.Pos // position of "/" starting the comment + Text string // comment text (excluding '\n' for //-style comments) +} + +func (c *Comment) Comments() []*CommentGroup { return nil } +func (c *Comment) AddComment(*CommentGroup) {} +func (c *Comment) commentInfo() *comments { return nil } + +func (c *Comment) Pos() token.Pos { return c.Slash } +func (c *Comment) pos() *token.Pos { return &c.Slash } +func (c *Comment) End() token.Pos { return c.Slash.Add(len(c.Text)) } + +// A CommentGroup represents a sequence of comments +// with no other tokens and no empty lines between. +type CommentGroup struct { + // TODO: remove and use the token position of the first comment. + Doc bool + Line bool // true if it is on the same line as the node's end pos. + + // Position indicates where a comment should be attached if a node has + // multiple tokens. 0 means before the first token, 1 means before the + // second, etc. For instance, for a field, the positions are: + // <0> Label <1> ":" <2> Expr <3> "," <4> + Position int8 + List []*Comment // len(List) > 0 + + decl +} + +func (g *CommentGroup) Pos() token.Pos { return getPos(g) } +func (g *CommentGroup) pos() *token.Pos { return g.List[0].pos() } +func (g *CommentGroup) End() token.Pos { return g.List[len(g.List)-1].End() } + +func (g *CommentGroup) Comments() []*CommentGroup { return nil } +func (g *CommentGroup) AddComment(*CommentGroup) {} +func (g *CommentGroup) commentInfo() *comments { return nil } + +func isWhitespace(ch byte) bool { return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' } + +func stripTrailingWhitespace(s string) string { + i := len(s) + for i > 0 && isWhitespace(s[i-1]) { + i-- + } + return s[0:i] +} + +// Text returns the text of the comment. +// Comment markers (//, /*, and */), the first space of a line comment, and +// leading and trailing empty lines are removed. Multiple empty lines are +// reduced to one, and trailing space on lines is trimmed. Unless the result +// is empty, it is newline-terminated. +func (g *CommentGroup) Text() string { + if g == nil { + return "" + } + comments := make([]string, len(g.List)) + for i, c := range g.List { + comments[i] = c.Text + } + + lines := make([]string, 0, 10) // most comments are less than 10 lines + for _, c := range comments { + // Remove comment markers. + // The parser has given us exactly the comment text. + switch c[1] { + case '/': + //-style comment (no newline at the end) + c = c[2:] + // strip first space - required for Example tests + if len(c) > 0 && c[0] == ' ' { + c = c[1:] + } + case '*': + /*-style comment */ + c = c[2 : len(c)-2] + } + + // Split on newlines. + cl := strings.Split(c, "\n") + + // Walk lines, stripping trailing white space and adding to list. + for _, l := range cl { + lines = append(lines, stripTrailingWhitespace(l)) + } + } + + // Remove leading blank lines; convert runs of + // interior blank lines to a single blank line. + n := 0 + for _, line := range lines { + if line != "" || n > 0 && lines[n-1] != "" { + lines[n] = line + n++ + } + } + lines = lines[0:n] + + // Add final "" entry to get trailing newline from Join. + if n > 0 && lines[n-1] != "" { + lines = append(lines, "") + } + + return strings.Join(lines, "\n") +} + +// An Attribute provides meta data about a field. +type Attribute struct { + At token.Pos + Text string // must be a valid attribute format. + + comments + decl +} + +func (a *Attribute) Pos() token.Pos { return a.At } +func (a *Attribute) pos() *token.Pos { return &a.At } +func (a *Attribute) End() token.Pos { return a.At.Add(len(a.Text)) } + +func (a *Attribute) Split() (key, body string) { + s := a.Text + p := strings.IndexByte(s, '(') + if p < 0 || !strings.HasPrefix(s, "@") || !strings.HasSuffix(s, ")") { + return "", "" + } + return a.Text[1:p], a.Text[p+1 : len(s)-1] +} + +// A Field represents a field declaration in a struct. +type Field struct { + Label Label // must have at least one element. + Optional token.Pos + + // No TokenPos: Value must be an StructLit with one field. + TokenPos token.Pos + Token token.Token // ':' or '::', ILLEGAL implies ':' + + Value Expr // the value associated with this field. + + Attrs []*Attribute + + comments + decl +} + +func (d *Field) Pos() token.Pos { return d.Label.Pos() } +func (d *Field) pos() *token.Pos { return d.Label.pos() } +func (d *Field) End() token.Pos { + if len(d.Attrs) > 0 { + return d.Attrs[len(d.Attrs)-1].End() + } + return d.Value.End() +} + +// TODO: make Alias a type of Field. This is possible now we have different +// separator types. + +// An Alias binds another field to the alias name in the current struct. +type Alias struct { + Ident *Ident // field name, always an Ident + Equal token.Pos // position of "=" + Expr Expr // An Ident or SelectorExpr + + comments + decl + expr + label +} + +func (a *Alias) Pos() token.Pos { return a.Ident.Pos() } +func (a *Alias) pos() *token.Pos { return a.Ident.pos() } +func (a *Alias) End() token.Pos { return a.Expr.End() } + +// A Comprehension node represents a comprehension declaration. +type Comprehension struct { + Clauses []Clause // There must be at least one clause. + Value Expr // Must be a struct TODO: change to Struct + + comments + decl + expr // TODO: only allow Comprehension in "Embedding" productions. +} + +func (x *Comprehension) Pos() token.Pos { return getPos(x) } +func (x *Comprehension) pos() *token.Pos { return x.Clauses[0].pos() } +func (x *Comprehension) End() token.Pos { + return x.Value.End() +} + +// ---------------------------------------------------------------------------- +// Expressions and types +// +// An expression is represented by a tree consisting of one +// or more of the following concrete expression nodes. + +// A BadExpr node is a placeholder for expressions containing +// syntax errors for which no correct expression nodes can be +// created. This is different from an ErrorExpr which represents +// an explicitly marked error in the source. +type BadExpr struct { + From, To token.Pos // position range of bad expression + + comments + expr +} + +// A BottomLit indicates an error. +type BottomLit struct { + Bottom token.Pos + + comments + expr +} + +// An Ident node represents an left-hand side identifier. +type Ident struct { + NamePos token.Pos // identifier position + + // This LHS path element may be an identifier. Possible forms: + // foo: a normal identifier + // "foo": JSON compatible + Name string + + Scope Node // scope in which node was found or nil if referring directly + Node Node + + comments + label + expr +} + +// A BasicLit node represents a literal of basic type. +type BasicLit struct { + ValuePos token.Pos // literal position + Kind token.Token // INT, FLOAT, DURATION, or STRING + Value string // literal string; e.g. 42, 0x7f, 3.14, 1_234_567, 1e-9, 2.4i, 'a', '\x7f', "foo", or '\m\n\o' + + comments + expr + label +} + +// TODO: introduce and use NewLabel and NewBytes and perhaps NewText (in the +// later case NewString would return a string or bytes type) to distinguish from +// NewString. Consider how to pass indentation information. + +// NewString creates a new BasicLit with a string value without position. +// It quotes the given string. +// Useful for ASTs generated by code other than the CUE parser. +func NewString(str string) *BasicLit { + str = literal.String.Quote(str) + return &BasicLit{Kind: token.STRING, ValuePos: token.NoPos, Value: str} +} + +// NewNull creates a new BasicLit configured to be a null value. +// Useful for ASTs generated by code other than the CUE parser. +func NewNull() *BasicLit { + return &BasicLit{Kind: token.NULL, Value: "null"} +} + +// NewLit creates a new BasicLit with from a token type and string without +// position. +// Useful for ASTs generated by code other than the CUE parser. +func NewLit(tok token.Token, s string) *BasicLit { + return &BasicLit{Kind: tok, Value: s} +} + +// NewBool creates a new BasicLit with a bool value without position. +// Useful for ASTs generated by code other than the CUE parser. +func NewBool(b bool) *BasicLit { + x := &BasicLit{} + if b { + x.Kind = token.TRUE + x.Value = "true" + } else { + x.Kind = token.FALSE + x.Value = "false" + } + return x +} + +// TODO: +// - use CUE-specific quoting (hoist functionality in export) +// - NewBytes + +// A Interpolation node represents a string or bytes interpolation. +type Interpolation struct { + Elts []Expr // interleaving of strings and expressions. + + comments + expr + label +} + +// A StructLit node represents a literal struct. +type StructLit struct { + Lbrace token.Pos // position of "{" + Elts []Decl // list of elements; or nil + Rbrace token.Pos // position of "}" + + comments + expr +} + +// NewStruct creates a struct from the given fields. +// +// A field is either a *Field, an *Elipsis, *LetClause, a *CommentGroup, or a +// Label, optionally followed by a a token.OPTION to indicate the field is +// optional, optionally followed by a token.ISA to indicate the field is a +// definition followed by an expression for the field value. +// +// It will panic if a values not matching these patterns are given. Useful for +// ASTs generated by code other than the CUE parser. +func NewStruct(fields ...interface{}) *StructLit { + s := &StructLit{ + // Set default positions so that comment attachment is as expected. + Lbrace: token.NoSpace.Pos(), + } + for i := 0; i < len(fields); i++ { + var ( + label Label + optional = token.NoPos + tok = token.ILLEGAL + expr Expr + ) + + switch x := fields[i].(type) { + case *Field: + s.Elts = append(s.Elts, x) + continue + case *CommentGroup: + s.Elts = append(s.Elts, x) + continue + case *Ellipsis: + s.Elts = append(s.Elts, x) + continue + case *LetClause: + s.Elts = append(s.Elts, x) + continue + case *embedding: + s.Elts = append(s.Elts, (*EmbedDecl)(x)) + continue + case Label: + label = x + case string: + label = NewString(x) + default: + panic(fmt.Sprintf("unsupported label type %T", x)) + } + + inner: + for i++; i < len(fields); i++ { + switch x := (fields[i]).(type) { + case Expr: + expr = x + break inner + case token.Token: + switch x { + case token.ISA: + tok = x + case token.OPTION: + optional = token.Blank.Pos() + case token.COLON, token.ILLEGAL: + default: + panic(fmt.Sprintf("invalid token %s", x)) + } + default: + panic(fmt.Sprintf("unsupported expression type %T", x)) + } + } + if expr == nil { + panic("label not matched with expression") + } + s.Elts = append(s.Elts, &Field{ + Label: label, + Optional: optional, + Token: tok, + Value: expr, + }) + } + return s +} + +// Embed can be used in conjunction with NewStruct to embed values. +func Embed(x Expr) *embedding { + return (*embedding)(&EmbedDecl{Expr: x}) +} + +type embedding EmbedDecl + +// A ListLit node represents a literal list. +type ListLit struct { + Lbrack token.Pos // position of "[" + + // TODO: change to embedding or similar. + Elts []Expr // list of composite elements; or nil + Rbrack token.Pos // position of "]" + + comments + expr + label +} + +// NewList creates a list of Expressions. +// Useful for ASTs generated by code other than the CUE parser. +func NewList(exprs ...Expr) *ListLit { + return &ListLit{Elts: exprs} +} + +type Ellipsis struct { + Ellipsis token.Pos // open list if set + Type Expr // type for the remaining elements + + comments + decl + expr +} + +// A ForClause node represents a for clause in a comprehension. +type ForClause struct { + For token.Pos + Key *Ident // allow pattern matching? + // TODO: change to Comma + Colon token.Pos + Value *Ident // allow pattern matching? + In token.Pos + Source Expr + + comments + clause +} + +// A IfClause node represents an if guard clause in a comprehension. +type IfClause struct { + If token.Pos + Condition Expr + + comments + clause +} + +// A LetClause node represents a let clause in a comprehension. +type LetClause struct { + Let token.Pos + Ident *Ident + Equal token.Pos + Expr Expr + + comments + clause + decl +} + +// A ParenExpr node represents a parenthesized expression. +type ParenExpr struct { + Lparen token.Pos // position of "(" + X Expr // parenthesized expression + Rparen token.Pos // position of ")" + + comments + expr + label +} + +// A SelectorExpr node represents an expression followed by a selector. +type SelectorExpr struct { + X Expr // expression + Sel Label // field selector + + comments + expr +} + +// NewSel creates a sequence of selectors. +// Useful for ASTs generated by code other than the CUE parser. +func NewSel(x Expr, sel ...string) Expr { + for _, s := range sel { + x = &SelectorExpr{X: x, Sel: NewIdent(s)} + } + return x +} + +// An IndexExpr node represents an expression followed by an index. +type IndexExpr struct { + X Expr // expression + Lbrack token.Pos // position of "[" + Index Expr // index expression + Rbrack token.Pos // position of "]" + + comments + expr +} + +// An SliceExpr node represents an expression followed by slice indices. +type SliceExpr struct { + X Expr // expression + Lbrack token.Pos // position of "[" + Low Expr // begin of slice range; or nil + High Expr // end of slice range; or nil + Rbrack token.Pos // position of "]" + + comments + expr +} + +// A CallExpr node represents an expression followed by an argument list. +type CallExpr struct { + Fun Expr // function expression + Lparen token.Pos // position of "(" + Args []Expr // function arguments; or nil + Rparen token.Pos // position of ")" + + comments + expr +} + +// NewCall creates a new CallExpr. +// Useful for ASTs generated by code other than the CUE parser. +func NewCall(fun Expr, args ...Expr) *CallExpr { + return &CallExpr{Fun: fun, Args: args} +} + +// A UnaryExpr node represents a unary expression. +type UnaryExpr struct { + OpPos token.Pos // position of Op + Op token.Token // operator + X Expr // operand + + comments + expr +} + +// A BinaryExpr node represents a binary expression. +type BinaryExpr struct { + X Expr // left operand + OpPos token.Pos // position of Op + Op token.Token // operator + Y Expr // right operand + + comments + expr +} + +// NewBinExpr creates for list of expressions of length 2 or greater a chained +// binary expression of the form (((x1 op x2) op x3) ...). For lists of length +// 1 it returns the expression itself. It panics for empty lists. +// Useful for ASTs generated by code other than the CUE parser. +func NewBinExpr(op token.Token, operands ...Expr) Expr { + if len(operands) == 0 { + return nil + } + expr := operands[0] + for _, e := range operands[1:] { + expr = &BinaryExpr{X: expr, Op: op, Y: e} + } + return expr +} + +// token.Pos and End implementations for expression/type nodes. + +func (x *BadExpr) Pos() token.Pos { return x.From } +func (x *BadExpr) pos() *token.Pos { return &x.From } +func (x *Ident) Pos() token.Pos { return x.NamePos } +func (x *Ident) pos() *token.Pos { return &x.NamePos } +func (x *BasicLit) Pos() token.Pos { return x.ValuePos } +func (x *BasicLit) pos() *token.Pos { return &x.ValuePos } +func (x *Interpolation) Pos() token.Pos { return x.Elts[0].Pos() } +func (x *Interpolation) pos() *token.Pos { return x.Elts[0].pos() } +func (x *StructLit) Pos() token.Pos { return getPos(x) } +func (x *StructLit) pos() *token.Pos { + if x.Lbrace == token.NoPos && len(x.Elts) > 0 { + return x.Elts[0].pos() + } + return &x.Lbrace +} + +func (x *ListLit) Pos() token.Pos { return x.Lbrack } +func (x *ListLit) pos() *token.Pos { return &x.Lbrack } +func (x *Ellipsis) Pos() token.Pos { return x.Ellipsis } +func (x *Ellipsis) pos() *token.Pos { return &x.Ellipsis } +func (x *LetClause) Pos() token.Pos { return x.Let } +func (x *LetClause) pos() *token.Pos { return &x.Let } +func (x *ForClause) Pos() token.Pos { return x.For } +func (x *ForClause) pos() *token.Pos { return &x.For } +func (x *IfClause) Pos() token.Pos { return x.If } +func (x *IfClause) pos() *token.Pos { return &x.If } +func (x *ParenExpr) Pos() token.Pos { return x.Lparen } +func (x *ParenExpr) pos() *token.Pos { return &x.Lparen } +func (x *SelectorExpr) Pos() token.Pos { return x.X.Pos() } +func (x *SelectorExpr) pos() *token.Pos { return x.X.pos() } +func (x *IndexExpr) Pos() token.Pos { return x.X.Pos() } +func (x *IndexExpr) pos() *token.Pos { return x.X.pos() } +func (x *SliceExpr) Pos() token.Pos { return x.X.Pos() } +func (x *SliceExpr) pos() *token.Pos { return x.X.pos() } +func (x *CallExpr) Pos() token.Pos { return x.Fun.Pos() } +func (x *CallExpr) pos() *token.Pos { return x.Fun.pos() } +func (x *UnaryExpr) Pos() token.Pos { return x.OpPos } +func (x *UnaryExpr) pos() *token.Pos { return &x.OpPos } +func (x *BinaryExpr) Pos() token.Pos { return x.X.Pos() } +func (x *BinaryExpr) pos() *token.Pos { return x.X.pos() } +func (x *BottomLit) Pos() token.Pos { return x.Bottom } +func (x *BottomLit) pos() *token.Pos { return &x.Bottom } + +func (x *BadExpr) End() token.Pos { return x.To } +func (x *Ident) End() token.Pos { + return x.NamePos.Add(len(x.Name)) +} +func (x *BasicLit) End() token.Pos { return x.ValuePos.Add(len(x.Value)) } + +func (x *Interpolation) End() token.Pos { return x.Elts[len(x.Elts)-1].Pos() } +func (x *StructLit) End() token.Pos { + if x.Rbrace == token.NoPos && len(x.Elts) > 0 { + return x.Elts[len(x.Elts)-1].Pos() + } + return x.Rbrace.Add(1) +} +func (x *ListLit) End() token.Pos { return x.Rbrack.Add(1) } +func (x *Ellipsis) End() token.Pos { + if x.Type != nil { + return x.Type.End() + } + return x.Ellipsis.Add(3) // len("...") +} +func (x *LetClause) End() token.Pos { return x.Expr.End() } +func (x *ForClause) End() token.Pos { return x.Source.End() } +func (x *IfClause) End() token.Pos { return x.Condition.End() } +func (x *ParenExpr) End() token.Pos { return x.Rparen.Add(1) } +func (x *SelectorExpr) End() token.Pos { return x.Sel.End() } +func (x *IndexExpr) End() token.Pos { return x.Rbrack.Add(1) } +func (x *SliceExpr) End() token.Pos { return x.Rbrack.Add(1) } +func (x *CallExpr) End() token.Pos { return x.Rparen.Add(1) } +func (x *UnaryExpr) End() token.Pos { return x.X.End() } +func (x *BinaryExpr) End() token.Pos { return x.Y.End() } +func (x *BottomLit) End() token.Pos { return x.Bottom.Add(1) } + +// ---------------------------------------------------------------------------- +// Convenience functions for Idents + +// NewIdent creates a new Ident without position. +// Useful for ASTs generated by code other than the CUE parser. +func NewIdent(name string) *Ident { + return &Ident{token.NoPos, name, nil, nil, comments{}, label{}, expr{}} +} + +func (id *Ident) String() string { + if id != nil { + return id.Name + } + return "" +} + +// ---------------------------------------------------------------------------- +// Declarations + +// An ImportSpec node represents a single package import. +type ImportSpec struct { + Name *Ident // local package name (including "."); or nil + Path *BasicLit // import path + EndPos token.Pos // end of spec (overrides Path.Pos if nonzero) + + comments +} + +func (*ImportSpec) specNode() {} + +func NewImport(name *Ident, importPath string) *ImportSpec { + importPath = literal.String.Quote(importPath) + path := &BasicLit{Kind: token.STRING, Value: importPath} + return &ImportSpec{Name: name, Path: path} +} + +// Pos and End implementations for spec nodes. + +func (s *ImportSpec) Pos() token.Pos { return getPos(s) } +func (s *ImportSpec) pos() *token.Pos { + if s.Name != nil { + return s.Name.pos() + } + return s.Path.pos() +} + +// func (s *AliasSpec) Pos() token.Pos { return s.Name.Pos() } +// func (s *ValueSpec) Pos() token.Pos { return s.Names[0].Pos() } +// func (s *TypeSpec) Pos() token.Pos { return s.Name.Pos() } + +func (s *ImportSpec) End() token.Pos { + if s.EndPos != token.NoPos { + return s.EndPos + } + return s.Path.End() +} + +// A BadDecl node is a placeholder for declarations containing +// syntax errors for which no correct declaration nodes can be +// created. +type BadDecl struct { + From, To token.Pos // position range of bad declaration + + comments + decl +} + +// A ImportDecl node represents a series of import declarations. A valid +// Lparen position (Lparen.Line > 0) indicates a parenthesized declaration. +type ImportDecl struct { + Import token.Pos + Lparen token.Pos // position of '(', if any + Specs []*ImportSpec + Rparen token.Pos // position of ')', if any + + comments + decl +} + +type Spec interface { + Node + specNode() +} + +// An EmbedDecl node represents a single expression used as a declaration. +// The expressions in this declaration is what will be emitted as +// configuration output. +// +// An EmbedDecl may only appear at the top level. +type EmbedDecl struct { + Expr Expr + + comments + decl +} + +// Pos and End implementations for declaration nodes. + +func (d *BadDecl) Pos() token.Pos { return d.From } +func (d *BadDecl) pos() *token.Pos { return &d.From } +func (d *ImportDecl) Pos() token.Pos { return d.Import } +func (d *ImportDecl) pos() *token.Pos { return &d.Import } +func (d *EmbedDecl) Pos() token.Pos { return d.Expr.Pos() } +func (d *EmbedDecl) pos() *token.Pos { return d.Expr.pos() } + +func (d *BadDecl) End() token.Pos { return d.To } +func (d *ImportDecl) End() token.Pos { + if d.Rparen.IsValid() { + return d.Rparen.Add(1) + } + if len(d.Specs) == 0 { + return token.NoPos + } + return d.Specs[0].End() +} +func (d *EmbedDecl) End() token.Pos { return d.Expr.End() } + +// ---------------------------------------------------------------------------- +// Files and packages + +// A File node represents a Go source file. +// +// The Comments list contains all comments in the source file in order of +// appearance, including the comments that are pointed to from other nodes +// via Doc and Comment fields. +type File struct { + Filename string + Decls []Decl // top-level declarations; or nil + + Imports []*ImportSpec // imports in this file + Unresolved []*Ident // unresolved identifiers in this file + + comments +} + +// Preamble returns the declarations of the preamble. +func (f *File) Preamble() []Decl { + p := 0 +outer: + for i, d := range f.Decls { + switch d.(type) { + default: + break outer + + case *Package: + p = i + 1 + case *CommentGroup: + case *Attribute: + case *ImportDecl: + p = i + 1 + } + } + return f.Decls[:p] +} + +func (f *File) VisitImports(fn func(d *ImportDecl)) { + for _, d := range f.Decls { + switch x := d.(type) { + case *CommentGroup: + case *Package: + case *Attribute: + case *ImportDecl: + fn(x) + default: + return + } + } +} + +// PackageName returns the package name associated with this file or "" if no +// package is associated. +func (f *File) PackageName() string { + for _, d := range f.Decls { + switch x := d.(type) { + case *Package: + return x.Name.Name + case *CommentGroup, *Attribute: + default: + return "" + } + } + return "" +} + +func (f *File) Pos() token.Pos { + if len(f.Decls) > 0 { + return f.Decls[0].Pos() + } + if f.Filename != "" { + // TODO. Do something more principled and efficient. + return token.NewFile(f.Filename, -1, 1).Pos(0, 0) + } + return token.NoPos +} + +func (f *File) pos() *token.Pos { + if len(f.Decls) > 0 { + return f.Decls[0].pos() + } + if f.Filename != "" { + return nil + } + return nil +} + +func (f *File) End() token.Pos { + if n := len(f.Decls); n > 0 { + return f.Decls[n-1].End() + } + return token.NoPos +} + +// A Package represents a package clause. +type Package struct { + PackagePos token.Pos // position of "package" pseudo-keyword + Name *Ident // package name + + comments + decl +} + +func (p *Package) Pos() token.Pos { return getPos(p) } +func (p *Package) pos() *token.Pos { + if p.PackagePos != token.NoPos { + return &p.PackagePos + } + if p.Name != nil { + return p.Name.pos() + } + return nil +} + +func (p *Package) End() token.Pos { + if p.Name != nil { + return p.Name.End() + } + return token.NoPos +} diff --git a/vendor/cuelang.org/go/cue/ast/astutil/apply.go b/vendor/cuelang.org/go/cue/ast/astutil/apply.go new file mode 100644 index 0000000000..22d12c60f3 --- /dev/null +++ b/vendor/cuelang.org/go/cue/ast/astutil/apply.go @@ -0,0 +1,512 @@ +// Copyright 2018 The CUE Authors +// +// 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 astutil + +import ( + "encoding/hex" + "fmt" + "hash/fnv" + "reflect" + + "cuelang.org/go/cue/ast" +) + +// A Cursor describes a node encountered during Apply. +// Information about the node and its parent is available +// from the Node, Parent, and Index methods. +// +// The methods Replace, Delete, InsertBefore, and InsertAfter +// can be used to change the AST without disrupting Apply. +// Delete, InsertBefore, and InsertAfter are only defined for modifying +// a StructLit and will panic in any other context. +type Cursor interface { + // Node returns the current Node. + Node() ast.Node + + // Parent returns the parent of the current Node. + Parent() Cursor + + // Index reports the index >= 0 of the current Node in the slice of Nodes + // that contains it, or a value < 0 if the current Node is not part of a + // list. + Index() int + + // Import reports an opaque identifier that refers to the given package. It + // may only be called if the input to apply was an ast.File. If the import + // does not exist, it will be added. + Import(path string) *ast.Ident + + // Replace replaces the current Node with n. + // The replacement node is not walked by Apply. Comments of the old node + // are copied to the new node if it has not yet an comments associated + // with it. + Replace(n ast.Node) + + // Delete deletes the current Node from its containing struct. + // If the current Node is not part of a struct, Delete panics. + Delete() + + // InsertAfter inserts n after the current Node in its containing struct. + // If the current Node is not part of a struct, InsertAfter panics. + // Unless n is wrapped by ApplyRecursively, Apply does not walk n. + InsertAfter(n ast.Node) + + // InsertBefore inserts n before the current Node in its containing struct. + // If the current Node is not part of a struct, InsertBefore panics. + // Unless n is wrapped by ApplyRecursively, Apply does not walk n. + InsertBefore(n ast.Node) + + self() *cursor +} + +// ApplyRecursively indicates that a node inserted with InsertBefore, +// or InsertAfter should be processed recursively. +func ApplyRecursively(n ast.Node) ast.Node { + return recursive{n} +} + +type recursive struct { + ast.Node +} + +type info struct { + f *ast.File + current *declsCursor + + importPatch []*ast.Ident +} + +type cursor struct { + file *info + parent Cursor + node ast.Node + typ interface{} // the type of the node + index int // position of any of the sub types. + replaced bool +} + +func newCursor(parent Cursor, n ast.Node, typ interface{}) *cursor { + return &cursor{ + parent: parent, + typ: typ, + node: n, + index: -1, + } +} + +func fileInfo(c Cursor) (info *info) { + for ; c != nil; c = c.Parent() { + if i := c.self().file; i != nil { + return i + } + } + return nil +} + +func (c *cursor) self() *cursor { return c } +func (c *cursor) Parent() Cursor { return c.parent } +func (c *cursor) Index() int { return c.index } +func (c *cursor) Node() ast.Node { return c.node } + +func (c *cursor) Import(importPath string) *ast.Ident { + info := fileInfo(c) + if info == nil { + return nil + } + + name := ImportPathName(importPath) + + // TODO: come up with something much better. + // For instance, hoist the uniquer form cue/export.go to + // here and make export.go use this. + hash := fnv.New32() + name += hex.EncodeToString(hash.Sum([]byte(importPath)))[:6] + + spec := insertImport(&info.current.decls, &ast.ImportSpec{ + Name: ast.NewIdent(name), + Path: ast.NewString(importPath), + }) + + ident := &ast.Ident{Node: spec} // Name is set later. + info.importPatch = append(info.importPatch, ident) + + ident.Name = name + + return ident +} + +func (c *cursor) Replace(n ast.Node) { + // panic if the value cannot convert to the original type. + reflect.ValueOf(n).Convert(reflect.TypeOf(c.typ).Elem()) + if ast.Comments(n) != nil { + CopyComments(n, c.node) + } + if r, ok := n.(recursive); ok { + n = r.Node + } else { + c.replaced = true + } + c.node = n +} + +func (c *cursor) InsertAfter(n ast.Node) { panic("unsupported") } +func (c *cursor) InsertBefore(n ast.Node) { panic("unsupported") } +func (c *cursor) Delete() { panic("unsupported") } + +// Apply traverses a syntax tree recursively, starting with root, +// and calling pre and post for each node as described below. +// Apply returns the syntax tree, possibly modified. +// +// If pre is not nil, it is called for each node before the node's +// children are traversed (pre-order). If pre returns false, no +// children are traversed, and post is not called for that node. +// +// If post is not nil, and a prior call of pre didn't return false, +// post is called for each node after its children are traversed +// (post-order). If post returns false, traversal is terminated and +// Apply returns immediately. +// +// Only fields that refer to AST nodes are considered children; +// i.e., token.Pos, Scopes, Objects, and fields of basic types +// (strings, etc.) are ignored. +// +// Children are traversed in the order in which they appear in the +// respective node's struct definition. +// +func Apply(node ast.Node, before, after func(Cursor) bool) ast.Node { + apply(&applier{before: before, after: after}, nil, &node) + return node +} + +// A applyVisitor's before method is invoked for each node encountered by Walk. +// If the result applyVisitor w is true, Walk visits each of the children +// of node with the applyVisitor w, followed by a call of w.After. +type applyVisitor interface { + Before(Cursor) applyVisitor + After(Cursor) bool +} + +// Helper functions for common node lists. They may be empty. + +func applyExprList(v applyVisitor, parent Cursor, ptr interface{}, list []ast.Expr) { + c := newCursor(parent, nil, nil) + for i, x := range list { + c.index = i + c.node = x + c.typ = &list[i] + applyCursor(v, c) + if x != c.node { + list[i] = c.node.(ast.Expr) + } + } +} + +type declsCursor struct { + *cursor + decls, after, process []ast.Decl + delete bool +} + +func (c *declsCursor) InsertAfter(n ast.Node) { + if r, ok := n.(recursive); ok { + n = r.Node + c.process = append(c.process, n.(ast.Decl)) + } + c.after = append(c.after, n.(ast.Decl)) +} + +func (c *declsCursor) InsertBefore(n ast.Node) { + if r, ok := n.(recursive); ok { + n = r.Node + c.process = append(c.process, n.(ast.Decl)) + } + c.decls = append(c.decls, n.(ast.Decl)) +} + +func (c *declsCursor) Delete() { c.delete = true } + +func applyDeclList(v applyVisitor, parent Cursor, list []ast.Decl) []ast.Decl { + c := &declsCursor{ + cursor: newCursor(parent, nil, nil), + decls: make([]ast.Decl, 0, len(list)), + } + if file, ok := parent.Node().(*ast.File); ok { + c.cursor.file = &info{f: file, current: c} + } + for i, x := range list { + c.node = x + c.typ = &list[i] + applyCursor(v, c) + if !c.delete { + c.decls = append(c.decls, c.node.(ast.Decl)) + } + c.delete = false + for i := 0; i < len(c.process); i++ { + x := c.process[i] + c.node = x + c.typ = &c.process[i] + applyCursor(v, c) + if c.delete { + panic("cannot delete a node that was added with InsertBefore or InsertAfter") + } + } + c.decls = append(c.decls, c.after...) + c.after = c.after[:0] + c.process = c.process[:0] + } + + // TODO: ultimately, programmatically linked nodes have to be resolved + // at the end. + // if info := c.cursor.file; info != nil { + // done := map[*ast.ImportSpec]bool{} + // for _, ident := range info.importPatch { + // spec := ident.Node.(*ast.ImportSpec) + // if done[spec] { + // continue + // } + // done[spec] = true + + // path, _ := strconv.Unquote(spec.Path) + + // ident.Name = + // } + // } + + return c.decls +} + +func apply(v applyVisitor, parent Cursor, nodePtr interface{}) { + res := reflect.Indirect(reflect.ValueOf(nodePtr)) + n := res.Interface() + node := n.(ast.Node) + c := newCursor(parent, node, nodePtr) + applyCursor(v, c) + if node != c.node { + res.Set(reflect.ValueOf(c.node)) + } +} + +// applyCursor traverses an AST in depth-first order: It starts by calling +// v.Visit(node); node must not be nil. If the visitor w returned by +// v.Visit(node) is not nil, apply is invoked recursively with visitor +// w for each of the non-nil children of node, followed by a call of +// w.Visit(nil). +// +func applyCursor(v applyVisitor, c Cursor) { + if v = v.Before(c); v == nil { + return + } + + node := c.Node() + + // TODO: record the comment groups and interleave with the values like for + // parsing and printing? + comments := node.Comments() + for _, cm := range comments { + apply(v, c, &cm) + } + + // apply children + // (the order of the cases matches the order + // of the corresponding node types in go) + switch n := node.(type) { + // Comments and fields + case *ast.Comment: + // nothing to do + + case *ast.CommentGroup: + for _, cg := range n.List { + apply(v, c, &cg) + } + + case *ast.Attribute: + // nothing to do + + case *ast.Field: + apply(v, c, &n.Label) + if n.Value != nil { + apply(v, c, &n.Value) + } + for _, a := range n.Attrs { + apply(v, c, &a) + } + + case *ast.StructLit: + n.Elts = applyDeclList(v, c, n.Elts) + + // Expressions + case *ast.BottomLit, *ast.BadExpr, *ast.Ident, *ast.BasicLit: + // nothing to do + + case *ast.Interpolation: + applyExprList(v, c, &n, n.Elts) + + case *ast.ListLit: + applyExprList(v, c, &n, n.Elts) + + case *ast.Ellipsis: + if n.Type != nil { + apply(v, c, &n.Type) + } + + case *ast.ParenExpr: + apply(v, c, &n.X) + + case *ast.SelectorExpr: + apply(v, c, &n.X) + apply(v, c, &n.Sel) + + case *ast.IndexExpr: + apply(v, c, &n.X) + apply(v, c, &n.Index) + + case *ast.SliceExpr: + apply(v, c, &n.X) + if n.Low != nil { + apply(v, c, &n.Low) + } + if n.High != nil { + apply(v, c, &n.High) + } + + case *ast.CallExpr: + apply(v, c, &n.Fun) + applyExprList(v, c, &n, n.Args) + + case *ast.UnaryExpr: + apply(v, c, &n.X) + + case *ast.BinaryExpr: + apply(v, c, &n.X) + apply(v, c, &n.Y) + + // Declarations + case *ast.ImportSpec: + if n.Name != nil { + apply(v, c, &n.Name) + } + apply(v, c, &n.Path) + + case *ast.BadDecl: + // nothing to do + + case *ast.ImportDecl: + for _, s := range n.Specs { + apply(v, c, &s) + } + + case *ast.EmbedDecl: + apply(v, c, &n.Expr) + + case *ast.LetClause: + apply(v, c, &n.Ident) + apply(v, c, &n.Expr) + + case *ast.Alias: + apply(v, c, &n.Ident) + apply(v, c, &n.Expr) + + case *ast.Comprehension: + clauses := n.Clauses + for i := range n.Clauses { + apply(v, c, &clauses[i]) + } + apply(v, c, &n.Value) + + // Files and packages + case *ast.File: + n.Decls = applyDeclList(v, c, n.Decls) + + case *ast.Package: + apply(v, c, &n.Name) + + case *ast.ForClause: + if n.Key != nil { + apply(v, c, &n.Key) + } + apply(v, c, &n.Value) + apply(v, c, &n.Source) + + case *ast.IfClause: + apply(v, c, &n.Condition) + + default: + panic(fmt.Sprintf("Walk: unexpected node type %T", n)) + } + + v.After(c) +} + +type applier struct { + before func(Cursor) bool + after func(Cursor) bool + + commentStack []commentFrame + current commentFrame +} + +type commentFrame struct { + cg []*ast.CommentGroup + pos int8 +} + +func (f *applier) Before(c Cursor) applyVisitor { + node := c.Node() + if f.before == nil || (f.before(c) && node == c.Node()) { + f.commentStack = append(f.commentStack, f.current) + f.current = commentFrame{cg: node.Comments()} + f.visitComments(c, f.current.pos) + return f + } + return nil +} + +func (f *applier) After(c Cursor) bool { + f.visitComments(c, 127) + p := len(f.commentStack) - 1 + f.current = f.commentStack[p] + f.commentStack = f.commentStack[:p] + f.current.pos++ + if f.after != nil { + f.after(c) + } + return true +} + +func (f *applier) visitComments(p Cursor, pos int8) { + c := &f.current + for i := 0; i < len(c.cg); i++ { + cg := c.cg[i] + if cg.Position == pos { + continue + } + cursor := newCursor(p, cg, cg) + if f.before == nil || (f.before(cursor) && !cursor.replaced) { + for j, c := range cg.List { + cursor := newCursor(p, c, &c) + if f.before == nil || (f.before(cursor) && !cursor.replaced) { + if f.after != nil { + f.after(cursor) + } + } + cg.List[j] = cursor.node.(*ast.Comment) + } + if f.after != nil { + f.after(cursor) + } + } + c.cg[i] = cursor.node.(*ast.CommentGroup) + } +} diff --git a/vendor/cuelang.org/go/cue/ast/astutil/file.go b/vendor/cuelang.org/go/cue/ast/astutil/file.go new file mode 100644 index 0000000000..e060b71194 --- /dev/null +++ b/vendor/cuelang.org/go/cue/ast/astutil/file.go @@ -0,0 +1,38 @@ +// Copyright 2020 CUE Authors +// +// 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 astutil + +import ( + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/token" +) + +// ToFile converts an expression to a File. It will create an import section for +// any of the identifiers in x that refer to an import and will unshadow +// references as appropriate. +func ToFile(x ast.Expr) (*ast.File, error) { + var f *ast.File + if st, ok := x.(*ast.StructLit); ok { + f = &ast.File{Decls: st.Elts} + } else { + ast.SetRelPos(x, token.NoSpace) + f = &ast.File{Decls: []ast.Decl{&ast.EmbedDecl{Expr: x}}} + } + + if err := Sanitize(f); err != nil { + return nil, err + } + return f, nil +} diff --git a/vendor/cuelang.org/go/cue/ast/astutil/resolve.go b/vendor/cuelang.org/go/cue/ast/astutil/resolve.go new file mode 100644 index 0000000000..5043e16b20 --- /dev/null +++ b/vendor/cuelang.org/go/cue/ast/astutil/resolve.go @@ -0,0 +1,461 @@ +// Copyright 2018 The CUE Authors +// +// 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. + +// This file implements scopes and the objects they contain. + +package astutil + +import ( + "bytes" + "fmt" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/token" +) + +// An ErrFunc processes errors. +type ErrFunc func(pos token.Pos, msg string, args ...interface{}) + +// TODO: future development +// +// Resolution currently assigns values along the table below. This is based on +// Go's resolver and is not quite convenient for CUE's purposes. For one, CUE +// allows manually setting resolution and than call astutil.Sanitize to +// normalize the ast.File. Manually assigning resolutions according to the +// below table is rather tedious though. +// +// Instead of using the Scope and Node fields in identifiers, we suggest the +// following assignments: +// +// Reference Node // an Decl or Clause +// Ident *Ident // The identifier in References (optional) +// +// References always refers to the direct element in the scope in which the +// identifier occurs, not the final value, so: *Field, *LetClause, *ForClause, +// etc. In case Ident is defined, it must be the same pointer as the +// referencing identifier. In case it is not defined, the Name of the +// referencing identifier can be used to locate the proper identifier in the +// referenced node. +// +// The Scope field in the original design then loses its function. +// +// Type of reference Scope Node +// Let Clause File/Struct LetClause +// Alias declaration File/Struct Alias (deprecated) +// Illegal Reference File/Struct +// Value +// X in a: X=y Field Alias +// Fields +// X in X: y File/Struct Expr (y) +// X in X=x: y File/Struct Field +// X in X=(x): y File/Struct Field +// X in X="\(x)": y File/Struct Field +// X in [X=x]: y Field Expr (x) +// X in X=[x]: y Field Field +// +// for k, v in ForClause Ident +// let x = y LetClause Ident +// +// Fields inside lambda +// Label Field Expr +// Value Field Field +// Pkg nil ImportSpec + +// Resolve resolves all identifiers in a file. Unresolved identifiers are +// recorded in Unresolved. It will not overwrite already resolved values. +func Resolve(f *ast.File, errFn ErrFunc) { + walk(&scope{errFn: errFn, identFn: resolveIdent}, f) +} + +// Resolve resolves all identifiers in an expression. +// It will not overwrite already resolved values. +func ResolveExpr(e ast.Expr, errFn ErrFunc) { + f := &ast.File{} + walk(&scope{file: f, errFn: errFn, identFn: resolveIdent}, e) +} + +// A Scope maintains the set of named language entities declared +// in the scope and a link to the immediately surrounding (outer) +// scope. +// +type scope struct { + file *ast.File + outer *scope + node ast.Node + index map[string]entry + inField bool + + identFn func(s *scope, n *ast.Ident) bool + nameFn func(name string) + errFn func(p token.Pos, msg string, args ...interface{}) +} + +type entry struct { + node ast.Node + link ast.Node // Alias, LetClause, or Field +} + +func newScope(f *ast.File, outer *scope, node ast.Node, decls []ast.Decl) *scope { + const n = 4 // initial scope capacity + s := &scope{ + file: f, + outer: outer, + node: node, + index: make(map[string]entry, n), + identFn: outer.identFn, + nameFn: outer.nameFn, + errFn: outer.errFn, + } + for _, d := range decls { + switch x := d.(type) { + case *ast.Field: + label := x.Label + + if a, ok := x.Label.(*ast.Alias); ok { + // TODO(legacy): use name := a.Ident.Name once quoted + // identifiers are no longer supported. + label, _ = a.Expr.(ast.Label) + if name, _, _ := ast.LabelName(a.Ident); name != "" { + if _, ok := label.(*ast.ListLit); !ok { + s.insert(name, x, a) + } + } + } + + // default: + name, isIdent, _ := ast.LabelName(label) + if isIdent { + v := x.Value + // Avoid interpreting value aliases at this point. + if a, ok := v.(*ast.Alias); ok { + v = a.Expr + } + s.insert(name, v, x) + } + case *ast.LetClause: + name, isIdent, _ := ast.LabelName(x.Ident) + if isIdent { + s.insert(name, x, x) + } + case *ast.Alias: + name, isIdent, _ := ast.LabelName(x.Ident) + if isIdent { + s.insert(name, x, x) + } + case *ast.ImportDecl: + for _, spec := range x.Specs { + info, _ := ParseImportSpec(spec) + s.insert(info.Ident, spec, spec) + } + } + } + return s +} + +func (s *scope) isLet(n ast.Node) bool { + if _, ok := s.node.(*ast.Field); ok { + return true + } + switch n.(type) { + case *ast.LetClause, *ast.Alias, *ast.Field: + return true + } + return false +} + +func (s *scope) mustBeUnique(n ast.Node) bool { + if _, ok := s.node.(*ast.Field); ok { + return true + } + switch n.(type) { + // TODO: add *ast.ImportSpec when some implementations are moved over to + // Sanitize. + case *ast.ImportSpec, *ast.LetClause, *ast.Alias, *ast.Field: + return true + } + return false +} + +func (s *scope) insert(name string, n, link ast.Node) { + if name == "" { + return + } + if s.nameFn != nil { + s.nameFn(name) + } + // TODO: record both positions. + if outer, _, existing := s.lookup(name); existing.node != nil { + if s.isLet(n) != outer.isLet(existing.node) { + s.errFn(n.Pos(), "cannot have both alias and field with name %q in same scope", name) + return + } else if s.mustBeUnique(n) || outer.mustBeUnique(existing.node) { + if outer == s { + if _, ok := existing.node.(*ast.ImportSpec); ok { + return + // TODO: + s.errFn(n.Pos(), "conflicting declaration %s\n"+ + "\tprevious declaration at %s", + name, existing.node.Pos()) + } else { + s.errFn(n.Pos(), "alias %q redeclared in same scope", name) + } + return + } + // TODO: Should we disallow shadowing of aliases? + // This was the case, but it complicates the transition to + // square brackets. The spec says allow it. + // s.errFn(n.Pos(), "alias %q already declared in enclosing scope", name) + } + } + s.index[name] = entry{node: n, link: link} +} + +func (s *scope) resolveScope(name string, node ast.Node) (scope ast.Node, e entry, ok bool) { + last := s + for s != nil { + if n, ok := s.index[name]; ok && node == n.node { + if last.node == n.node { + return nil, n, true + } + return s.node, n, true + } + s, last = s.outer, s + } + return nil, entry{}, false +} + +func (s *scope) lookup(name string) (p *scope, obj ast.Node, node entry) { + // TODO(#152): consider returning nil for obj if it is a reference to root. + // last := s + if name == "_" { + return nil, nil, entry{} + } + for s != nil { + if n, ok := s.index[name]; ok { + if _, ok := n.node.(*ast.ImportSpec); ok { + return s, nil, n + } + return s, s.node, n + } + // s, last = s.outer, s + s = s.outer + } + return nil, nil, entry{} +} + +func (s *scope) After(n ast.Node) {} +func (s *scope) Before(n ast.Node) (w visitor) { + switch x := n.(type) { + case *ast.File: + s := newScope(x, s, x, x.Decls) + // Support imports. + for _, d := range x.Decls { + walk(s, d) + } + return nil + + case *ast.StructLit: + return newScope(s.file, s, x, x.Elts) + + case *ast.Comprehension: + s = scopeClauses(s, x.Clauses) + walk(s, x.Value) + return nil + + case *ast.Field: + var n ast.Node = x.Label + alias, ok := x.Label.(*ast.Alias) + if ok { + n = alias.Expr + } + + switch label := n.(type) { + case *ast.ParenExpr: + walk(s, label) + + case *ast.Interpolation: + walk(s, label) + + case *ast.ListLit: + if len(label.Elts) != 1 { + break + } + s = newScope(s.file, s, x, nil) + if alias != nil { + if name, _, _ := ast.LabelName(alias.Ident); name != "" { + s.insert(name, x, alias) + } + } + + expr := label.Elts[0] + + if a, ok := expr.(*ast.Alias); ok { + expr = a.Expr + + // Add to current scope, instead of the value's, and allow + // references to bind to these illegally. + // We need this kind of administration anyway to detect + // illegal name clashes, and it allows giving better error + // messages. This puts the burdon on clients of this library + // to detect illegal usage, though. + name, err := ast.ParseIdent(a.Ident) + if err == nil { + s.insert(name, a.Expr, a) + } + } + + ast.Walk(expr, nil, func(n ast.Node) { + if x, ok := n.(*ast.Ident); ok { + for s := s; s != nil && !s.inField; s = s.outer { + if _, ok := s.index[x.Name]; ok { + s.errFn(n.Pos(), + "reference %q in label expression refers to field against which it would be matched", x.Name) + } + } + } + }) + walk(s, expr) + } + + if n := x.Value; n != nil { + if alias, ok := x.Value.(*ast.Alias); ok { + // TODO: this should move into Before once decl attributes + // have been fully deprecated and embed attributes are introduced. + s = newScope(s.file, s, x, nil) + s.insert(alias.Ident.Name, alias, x) + n = alias.Expr + } + s.inField = true + walk(s, n) + s.inField = false + } + + return nil + + case *ast.LetClause: + // Disallow referring to the current LHS name. + name := x.Ident.Name + saved := s.index[name] + delete(s.index, name) // The same name may still appear in another scope + + if x.Expr != nil { + walk(s, x.Expr) + } + s.index[name] = saved + return nil + + case *ast.Alias: + // Disallow referring to the current LHS name. + name := x.Ident.Name + saved := s.index[name] + delete(s.index, name) // The same name may still appear in another scope + + if x.Expr != nil { + walk(s, x.Expr) + } + s.index[name] = saved + return nil + + case *ast.ImportSpec: + return nil + + case *ast.Attribute: + // TODO: tokenize attributes, resolve identifiers and store the ones + // that resolve in a list. + + case *ast.SelectorExpr: + walk(s, x.X) + return nil + + case *ast.Ident: + if s.identFn(s, x) { + return nil + } + } + return s +} + +func resolveIdent(s *scope, x *ast.Ident) bool { + name, ok, _ := ast.LabelName(x) + if !ok { + // TODO: generate error + return false + } + if _, obj, node := s.lookup(name); node.node != nil { + switch { + case x.Node == nil: + x.Node = node.node + x.Scope = obj + + case x.Node == node.node: + x.Scope = obj + + default: // x.Node != node + scope, _, ok := s.resolveScope(name, x.Node) + if !ok { + s.file.Unresolved = append(s.file.Unresolved, x) + } + x.Scope = scope + } + } else { + s.file.Unresolved = append(s.file.Unresolved, x) + } + return true +} + +func scopeClauses(s *scope, clauses []ast.Clause) *scope { + for _, c := range clauses { + switch x := c.(type) { + case *ast.ForClause: + walk(s, x.Source) + s = newScope(s.file, s, x, nil) + if x.Key != nil { + name, err := ast.ParseIdent(x.Key) + if err == nil { + s.insert(name, x.Key, x) + } + } + name, err := ast.ParseIdent(x.Value) + if err == nil { + s.insert(name, x.Value, x) + } + + case *ast.LetClause: + walk(s, x.Expr) + s = newScope(s.file, s, x, nil) + name, err := ast.ParseIdent(x.Ident) + if err == nil { + s.insert(name, x.Ident, x) + } + + default: + walk(s, c) + } + } + return s +} + +// Debugging support +func (s *scope) String() string { + var buf bytes.Buffer + fmt.Fprintf(&buf, "scope %p {", s) + if s != nil && len(s.index) > 0 { + fmt.Fprintln(&buf) + for name := range s.index { + fmt.Fprintf(&buf, "\t%v\n", name) + } + } + fmt.Fprintf(&buf, "}\n") + return buf.String() +} diff --git a/vendor/cuelang.org/go/cue/ast/astutil/sanitize.go b/vendor/cuelang.org/go/cue/ast/astutil/sanitize.go new file mode 100644 index 0000000000..061a46b6f1 --- /dev/null +++ b/vendor/cuelang.org/go/cue/ast/astutil/sanitize.go @@ -0,0 +1,354 @@ +// Copyright 2020 CUE Authors +// +// 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 astutil + +import ( + "fmt" + "math/rand" + "strings" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/token" +) + +// TODO: +// - handle comprehensions +// - change field from foo to "foo" if it isn't referenced, rather than +// relying on introducing a unique alias. +// - change a predeclared identifier reference to use the __ident form, +// instead of introducing an alias. + +// Sanitize rewrites File f in place to be well formed after automated +// construction of an AST. +// +// Rewrites: +// - auto inserts imports associated with Idents +// - unshadows imports associated with idents +// - unshadows references for identifiers that were already resolved. +// +func Sanitize(f *ast.File) error { + z := &sanitizer{ + file: f, + rand: rand.New(rand.NewSource(808)), + + names: map[string]bool{}, + importMap: map[string]*ast.ImportSpec{}, + referenced: map[ast.Node]bool{}, + altMap: map[ast.Node]string{}, + } + + // Gather all names. + walk(&scope{ + errFn: z.errf, + nameFn: z.addName, + identFn: z.markUsed, + }, f) + if z.errs != nil { + return z.errs + } + + // Add imports and unshadow. + s := &scope{ + file: f, + errFn: z.errf, + identFn: z.handleIdent, + index: make(map[string]entry), + } + z.fileScope = s + walk(s, f) + if z.errs != nil { + return z.errs + } + + z.cleanImports() + + return z.errs +} + +type sanitizer struct { + file *ast.File + fileScope *scope + + rand *rand.Rand + + // names is all used names. Can be used to determine a new unique name. + names map[string]bool + referenced map[ast.Node]bool + + // altMap defines an alternative name for an existing entry link (a field, + // alias or let clause). As new names are globally unique, they can be + // safely reused for any unshadowing. + altMap map[ast.Node]string + importMap map[string]*ast.ImportSpec + + errs errors.Error +} + +func (z *sanitizer) errf(p token.Pos, msg string, args ...interface{}) { + z.errs = errors.Append(z.errs, errors.Newf(p, msg, args...)) +} + +func (z *sanitizer) addName(name string) { + z.names[name] = true +} + +func (z *sanitizer) addRename(base string, n ast.Node) (alt string, new bool) { + if name, ok := z.altMap[n]; ok { + return name, false + } + + name := z.uniqueName(base, false) + z.altMap[n] = name + return name, true +} + +func (z *sanitizer) unshadow(parent ast.Node, base string, link ast.Node) string { + name, ok := z.altMap[link] + if !ok { + name = z.uniqueName(base, false) + z.altMap[link] = name + + // Insert new let clause at top to refer to a declaration in possible + // other files. + let := &ast.LetClause{ + Ident: ast.NewIdent(name), + Expr: ast.NewIdent(base), + } + + var decls *[]ast.Decl + + switch x := parent.(type) { + case *ast.File: + decls = &x.Decls + case *ast.StructLit: + decls = &x.Elts + default: + panic(fmt.Sprintf("impossible scope type %T", parent)) + } + + i := 0 + for ; i < len(*decls); i++ { + if (*decls)[i] == link { + break + } + if f, ok := (*decls)[i].(*ast.Field); ok && f.Label == link { + break + } + } + + if i > 0 { + ast.SetRelPos(let, token.NewSection) + } + + a := append((*decls)[:i:i], let) + *decls = append(a, (*decls)[i:]...) + } + return name +} + +func (z *sanitizer) markUsed(s *scope, n *ast.Ident) bool { + if n.Node != nil { + return false + } + _, _, entry := s.lookup(n.String()) + z.referenced[entry.link] = true + return true +} + +func (z *sanitizer) cleanImports() { + z.file.VisitImports(func(d *ast.ImportDecl) { + k := 0 + for _, s := range d.Specs { + if _, ok := z.referenced[s]; ok { + d.Specs[k] = s + k++ + } + } + d.Specs = d.Specs[:k] + }) +} + +func (z *sanitizer) handleIdent(s *scope, n *ast.Ident) bool { + if n.Node == nil { + return true + } + + _, _, node := s.lookup(n.Name) + if node.node == nil { + spec, ok := n.Node.(*ast.ImportSpec) + if !ok { + // Clear node. A reference may have been moved to a different + // file. If not, it should be an error. + n.Node = nil + n.Scope = nil + return false + } + + _ = z.addImport(spec) + info, _ := ParseImportSpec(spec) + z.fileScope.insert(info.Ident, spec, spec) + return true + } + + if x, ok := n.Node.(*ast.ImportSpec); ok { + xi, _ := ParseImportSpec(x) + + if y, ok := node.node.(*ast.ImportSpec); ok { + yi, _ := ParseImportSpec(y) + if xi.ID == yi.ID { // name must be identical as a result of lookup. + z.referenced[y] = true + n.Node = x + n.Scope = nil + return false + } + } + + // Either: + // - the import is shadowed + // - an incorrect import is matched + // In all cases we need to create a new import with a unique name or + // use a previously created one. + spec := z.importMap[xi.ID] + if spec == nil { + name := z.uniqueName(xi.Ident, false) + spec = z.addImport(&ast.ImportSpec{ + Name: ast.NewIdent(name), + Path: x.Path, + }) + z.importMap[xi.ID] = spec + z.fileScope.insert(name, spec, spec) + } + + info, _ := ParseImportSpec(spec) + // TODO(apply): replace n itself directly + n.Name = info.Ident + n.Node = spec + n.Scope = nil + return false + } + + if node.node == n.Node { + return true + } + + // n.Node != node and are both not nil and n.Node is not an ImportSpec. + // This means that either n.Node is illegal or shadowed. + // Look for the scope in which n.Node is defined and add an alias or let. + + parent, e, ok := s.resolveScope(n.Name, n.Node) + if !ok { + // The node isn't within a legal scope within this file. It may only + // possibly shadow a value of another file. We add a top-level let + // clause to refer to this value. + + // TODO(apply): better would be to have resolve use Apply so that we can replace + // the entire ast.Ident, rather than modifying it. + // TODO: resolve to new node or rely on another pass of Resolve? + n.Name = z.unshadow(z.file, n.Name, n) + n.Node = nil + n.Scope = nil + + return false + } + + var name string + // var isNew bool + switch x := e.link.(type) { + case *ast.Field: // referring to regular field. + name, ok = z.altMap[x] + if ok { + break + } + // If this field has not alias, introduce one with a unique name. + // If this has an alias, also introduce a new name. There is a + // possibility that the alias can be used, but it is easier to just + // assign a new name, assuming this case is rather rare. + switch y := x.Label.(type) { + case *ast.Alias: + name = z.unshadow(parent, y.Ident.Name, y) + + case *ast.Ident: + var isNew bool + name, isNew = z.addRename(y.Name, x) + if isNew { + ident := ast.NewIdent(name) + // Move formatting and comments from original label to alias + // identifier. + CopyMeta(ident, y) + ast.SetRelPos(y, token.NoRelPos) + ast.SetComments(y, nil) + x.Label = &ast.Alias{Ident: ident, Expr: y} + } + + default: + // This is an illegal reference. + return false + } + + case *ast.LetClause: + name = z.unshadow(parent, x.Ident.Name, x) + + case *ast.Alias: + name = z.unshadow(parent, x.Ident.Name, x) + + default: + panic(fmt.Sprintf("unexpected link type %T", e.link)) + } + + // TODO(apply): better would be to have resolve use Apply so that we can replace + // the entire ast.Ident, rather than modifying it. + n.Name = name + n.Node = nil + n.Scope = nil + + return true +} + +// uniqueName returns a new name globally unique name of the form +// base_XX ... base_XXXXXXXXXXXXXX or _base or the same pattern with a '_' +// prefix if hidden is true. +// +// It prefers short extensions over large ones, while ensuring the likelihood of +// fast termination is high. There are at least two digits to make it visually +// clearer this concerns a generated number. +// +func (z *sanitizer) uniqueName(base string, hidden bool) string { + if hidden && !strings.HasPrefix(base, "_") { + base = "_" + base + if !z.names[base] { + z.names[base] = true + return base + } + } + + // TODO(go1.13): const mask = 0xff_ffff_ffff_ffff + const mask = 0xffffffffffffff // max bits; stay clear of int64 overflow + const shift = 4 // rate of growth + for n := int64(0x10); ; n = int64(mask&((n< 0 { + name = name[p+1:] + } + return name +} + +// ImportInfo describes the information contained in an ImportSpec. +type ImportInfo struct { + Ident string // identifier used to refer to the import + PkgName string // name of the package + ID string // full import path, including the name + Dir string // import path, excluding the name +} + +// ParseImportSpec returns the name and full path of an ImportSpec. +func ParseImportSpec(spec *ast.ImportSpec) (info ImportInfo, err error) { + str, err := strconv.Unquote(spec.Path.Value) + if err != nil { + return info, err + } + + info.ID = str + + if p := strings.LastIndexByte(str, ':'); p > 0 { + info.Dir = str[:p] + info.PkgName = str[p+1:] + } else { + info.Dir = str + info.PkgName = path.Base(str) + } + + if spec.Name != nil { + info.Ident = spec.Name.Name + } else { + info.Ident = info.PkgName + } + + return info, nil +} + +// CopyComments associates comments of one node with another. +// It may change the relative position of comments. +func CopyComments(to, from ast.Node) { + if from == nil { + return + } + ast.SetComments(to, from.Comments()) +} + +// CopyPosition sets the position of one node to another. +func CopyPosition(to, from ast.Node) { + if from == nil { + return + } + ast.SetPos(to, from.Pos()) +} + +// CopyMeta copies comments and position information from one node to another. +// It returns the destination node. +func CopyMeta(to, from ast.Node) ast.Node { + if from == nil { + return to + } + ast.SetComments(to, from.Comments()) + ast.SetPos(to, from.Pos()) + return to +} + +// insertImport looks up an existing import with the given name and path or will +// add spec if it doesn't exist. It returns a spec in decls matching spec. +func insertImport(decls *[]ast.Decl, spec *ast.ImportSpec) *ast.ImportSpec { + x, _ := ParseImportSpec(spec) + + a := *decls + + var imports *ast.ImportDecl + var orig *ast.ImportSpec + + p := 0 +outer: + for i := 0; i < len(a); i++ { + d := a[i] + switch t := d.(type) { + default: + break outer + + case *ast.Package: + p = i + 1 + case *ast.CommentGroup: + p = i + 1 + case *ast.Attribute: + continue + case *ast.ImportDecl: + p = i + 1 + imports = t + for _, s := range t.Specs { + y, _ := ParseImportSpec(s) + if y.ID != x.ID { + continue + } + orig = s + if x.Ident == "" || y.Ident == x.Ident { + return s + } + } + } + } + + // Import not found, add one. + if imports == nil { + imports = &ast.ImportDecl{} + preamble := append(a[:p:p], imports) + a = append(preamble, a[p:]...) + *decls = a + } + + if orig != nil { + CopyComments(spec, orig) + } + imports.Specs = append(imports.Specs, spec) + ast.SetRelPos(imports.Specs[0], token.NoRelPos) + + return spec +} diff --git a/vendor/cuelang.org/go/cue/ast/astutil/walk.go b/vendor/cuelang.org/go/cue/ast/astutil/walk.go new file mode 100644 index 0000000000..2de73d6e91 --- /dev/null +++ b/vendor/cuelang.org/go/cue/ast/astutil/walk.go @@ -0,0 +1,196 @@ +// Copyright 2018 The CUE Authors +// +// 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 astutil + +import ( + "fmt" + + "cuelang.org/go/cue/ast" +) + +// TODO: use ast.Walk or adopt that version to allow visitors. + +// A visitor's before method is invoked for each node encountered by Walk. +// If the result visitor w is not nil, Walk visits each of the children +// of node with the visitor w, followed by a call of w.After. +type visitor interface { + Before(node ast.Node) (w visitor) + After(node ast.Node) +} + +// Helper functions for common node lists. They may be empty. + +func walkExprList(v visitor, list []ast.Expr) { + for _, x := range list { + walk(v, x) + } +} + +func walkDeclList(v visitor, list []ast.Decl) { + for _, x := range list { + walk(v, x) + } +} + +// walk traverses an AST in depth-first order: It starts by calling +// v.Visit(node); node must not be nil. If the visitor w returned by +// v.Visit(node) is not nil, walk is invoked recursively with visitor +// w for each of the non-nil children of node, followed by a call of +// w.Visit(nil). +// +func walk(v visitor, node ast.Node) { + if v = v.Before(node); v == nil { + return + } + + // TODO: record the comment groups and interleave with the values like for + // parsing and printing? + for _, c := range node.Comments() { + walk(v, c) + } + + // walk children + // (the order of the cases matches the order + // of the corresponding node types in go) + switch n := node.(type) { + // Comments and fields + case *ast.Comment: + // nothing to do + + case *ast.CommentGroup: + for _, c := range n.List { + walk(v, c) + } + + case *ast.Attribute: + // nothing to do + + case *ast.Field: + walk(v, n.Label) + if n.Value != nil { + walk(v, n.Value) + } + for _, a := range n.Attrs { + walk(v, a) + } + + case *ast.StructLit: + for _, f := range n.Elts { + walk(v, f) + } + + // Expressions + case *ast.BottomLit, *ast.BadExpr, *ast.Ident, *ast.BasicLit: + // nothing to do + + case *ast.Interpolation: + for _, e := range n.Elts { + walk(v, e) + } + + case *ast.ListLit: + walkExprList(v, n.Elts) + + case *ast.Ellipsis: + if n.Type != nil { + walk(v, n.Type) + } + + case *ast.ParenExpr: + walk(v, n.X) + + case *ast.SelectorExpr: + walk(v, n.X) + walk(v, n.Sel) + + case *ast.IndexExpr: + walk(v, n.X) + walk(v, n.Index) + + case *ast.SliceExpr: + walk(v, n.X) + if n.Low != nil { + walk(v, n.Low) + } + if n.High != nil { + walk(v, n.High) + } + + case *ast.CallExpr: + walk(v, n.Fun) + walkExprList(v, n.Args) + + case *ast.UnaryExpr: + walk(v, n.X) + + case *ast.BinaryExpr: + walk(v, n.X) + walk(v, n.Y) + + // Declarations + case *ast.ImportSpec: + if n.Name != nil { + walk(v, n.Name) + } + walk(v, n.Path) + + case *ast.BadDecl: + // nothing to do + + case *ast.ImportDecl: + for _, s := range n.Specs { + walk(v, s) + } + + case *ast.EmbedDecl: + walk(v, n.Expr) + + case *ast.Alias: + walk(v, n.Ident) + walk(v, n.Expr) + + case *ast.Comprehension: + for _, c := range n.Clauses { + walk(v, c) + } + walk(v, n.Value) + + // Files and packages + case *ast.File: + walkDeclList(v, n.Decls) + + case *ast.Package: + // The package identifier isn't really an identifier. Skip it. + + case *ast.LetClause: + walk(v, n.Ident) + walk(v, n.Expr) + + case *ast.ForClause: + if n.Key != nil { + walk(v, n.Key) + } + walk(v, n.Value) + walk(v, n.Source) + + case *ast.IfClause: + walk(v, n.Condition) + + default: + panic(fmt.Sprintf("Walk: unexpected node type %T", n)) + } + + v.After(node) +} diff --git a/vendor/cuelang.org/go/cue/ast/comments.go b/vendor/cuelang.org/go/cue/ast/comments.go new file mode 100644 index 0000000000..09d5402c88 --- /dev/null +++ b/vendor/cuelang.org/go/cue/ast/comments.go @@ -0,0 +1,46 @@ +// Copyright 2019 CUE Authors +// +// 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 ast + +// Comments returns all comments associated with a given node. +func Comments(n Node) []*CommentGroup { + c := n.commentInfo() + if c == nil { + return nil + } + return c.Comments() +} + +// AddComment adds the given comment to the node if it supports it. +// If a node does not support comments, such as for CommentGroup or Comment, +// this call has no effect. +func AddComment(n Node, cg *CommentGroup) { + c := n.commentInfo() + if c == nil { + return + } + c.AddComment(cg) +} + +// SetComments replaces all comments of n with the given set of comments. +// If a node does not support comments, such as for CommentGroup or Comment, +// this call has no effect. +func SetComments(n Node, cgs []*CommentGroup) { + c := n.commentInfo() + if c == nil { + return + } + c.SetComments(cgs) +} diff --git a/vendor/cuelang.org/go/cue/ast/ident.go b/vendor/cuelang.org/go/cue/ast/ident.go new file mode 100644 index 0000000000..1f400b2869 --- /dev/null +++ b/vendor/cuelang.org/go/cue/ast/ident.go @@ -0,0 +1,195 @@ +// Copyright 2019 CUE Authors +// +// 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 ast + +import ( + "strconv" + "strings" + "unicode" + "unicode/utf8" + + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/token" +) + +func isLetter(ch rune) bool { + return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch >= utf8.RuneSelf && unicode.IsLetter(ch) +} + +func isDigit(ch rune) bool { + // TODO(mpvl): Is this correct? + return '0' <= ch && ch <= '9' || ch >= utf8.RuneSelf && unicode.IsDigit(ch) +} + +// IsValidIdent reports whether str is a valid identifier. +func IsValidIdent(ident string) bool { + if ident == "" { + return false + } + + // TODO: use consumed again to allow #0. + // consumed := false + if strings.HasPrefix(ident, "_") { + ident = ident[1:] + // consumed = true + if len(ident) == 0 { + return true + } + } + if strings.HasPrefix(ident, "#") { + ident = ident[1:] + // consumed = true + } + + // if !consumed { + if r, _ := utf8.DecodeRuneInString(ident); isDigit(r) { + return false + } + // } + + for _, r := range ident { + if isLetter(r) || isDigit(r) || r == '_' || r == '$' { + continue + } + return false + } + return true +} + +// ParseIdent unquotes a possibly quoted identifier and validates +// if the result is valid. +// +// Deprecated: quoted identifiers are deprecated. Use aliases. +func ParseIdent(n *Ident) (string, error) { + return parseIdent(n.NamePos, n.Name) +} + +func parseIdent(pos token.Pos, ident string) (string, error) { + if ident == "" { + return "", errors.Newf(pos, "empty identifier") + } + quoted := false + if ident[0] == '`' { + u, err := strconv.Unquote(ident) + if err != nil { + return "", errors.Newf(pos, "invalid quoted identifier") + } + ident = u + quoted = true + } + + p := 0 + if strings.HasPrefix(ident, "_") { + p++ + if len(ident) == 1 { + return ident, nil + } + } + if strings.HasPrefix(ident[p:], "#") { + p++ + // if len(ident) == p { + // return "", errors.Newf(pos, "invalid identifier '_#'") + // } + } + + if p == 0 || ident[p-1] == '#' { + if r, _ := utf8.DecodeRuneInString(ident[p:]); isDigit(r) { + return "", errors.Newf(pos, "invalid character '%s' in identifier", string(r)) + } + } + + for _, r := range ident[p:] { + if isLetter(r) || isDigit(r) || r == '_' || r == '$' { + continue + } + if r == '-' && quoted { + continue + } + return "", errors.Newf(pos, "invalid character '%s' in identifier", string(r)) + } + + return ident, nil +} + +// LabelName reports the name of a label, whether it is an identifier +// (it binds a value to a scope), and whether it is valid. +// Keywords that are allowed in label positions are interpreted accordingly. +// +// Examples: +// +// Label Result +// foo "foo" true nil +// true "true" true nil +// "foo" "foo" false nil +// "x-y" "x-y" false nil +// "foo "" false invalid string +// "\(x)" "" false errors.Is(err, ErrIsExpression) +// X=foo "foo" true nil +// +func LabelName(l Label) (name string, isIdent bool, err error) { + if a, ok := l.(*Alias); ok { + l, _ = a.Expr.(Label) + } + switch n := l.(type) { + case *ListLit: + // An expression, but not one that can evaluated. + return "", false, errors.Newf(l.Pos(), + "cannot reference fields with square brackets labels outside the field value") + + case *Ident: + // TODO(legacy): use name = n.Name + name, err = ParseIdent(n) + if err != nil { + return "", false, err + } + isIdent = true + // TODO(legacy): remove this return once quoted identifiers are removed. + return name, isIdent, err + + case *BasicLit: + switch n.Kind { + case token.STRING: + // Use strconv to only allow double-quoted, single-line strings. + name, err = strconv.Unquote(n.Value) + if err != nil { + err = errors.Newf(l.Pos(), "invalid") + } + + case token.NULL, token.TRUE, token.FALSE: + name = n.Value + isIdent = true + + default: + // TODO: allow numbers to be fields + // This includes interpolation and template labels. + return "", false, errors.Wrapf(ErrIsExpression, l.Pos(), + "cannot use numbers as fields") + } + + default: + // This includes interpolation and template labels. + return "", false, errors.Wrapf(ErrIsExpression, l.Pos(), + "label is an expression") + } + if !IsValidIdent(name) { + isIdent = false + } + return name, isIdent, err + +} + +// ErrIsExpression reports whether a label is an expression. +// This error is never returned directly. Use errors.Is. +var ErrIsExpression = errors.New("not a concrete label") diff --git a/vendor/cuelang.org/go/cue/ast/walk.go b/vendor/cuelang.org/go/cue/ast/walk.go new file mode 100644 index 0000000000..a23fce454d --- /dev/null +++ b/vendor/cuelang.org/go/cue/ast/walk.go @@ -0,0 +1,265 @@ +// Copyright 2018 The CUE Authors +// +// 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 ast + +import ( + "fmt" + + "cuelang.org/go/cue/token" +) + +// Walk traverses an AST in depth-first order: It starts by calling f(node); +// node must not be nil. If before returns true, Walk invokes f recursively for +// each of the non-nil children of node, followed by a call of after. Both +// functions may be nil. If before is nil, it is assumed to always return true. +// +func Walk(node Node, before func(Node) bool, after func(Node)) { + walk(&inspector{before: before, after: after}, node) +} + +// A visitor's before method is invoked for each node encountered by Walk. +// If the result visitor w is true, Walk visits each of the children +// of node with the visitor w, followed by a call of w.After. +type visitor interface { + Before(node Node) (w visitor) + After(node Node) +} + +// Helper functions for common node lists. They may be empty. + +func walkExprList(v visitor, list []Expr) { + for _, x := range list { + walk(v, x) + } +} + +func walkDeclList(v visitor, list []Decl) { + for _, x := range list { + walk(v, x) + } +} + +// walk traverses an AST in depth-first order: It starts by calling +// v.Visit(node); node must not be nil. If the visitor w returned by +// v.Visit(node) is not nil, walk is invoked recursively with visitor +// w for each of the non-nil children of node, followed by a call of +// w.Visit(nil). +// +func walk(v visitor, node Node) { + if v = v.Before(node); v == nil { + return + } + + // TODO: record the comment groups and interleave with the values like for + // parsing and printing? + for _, c := range Comments(node) { + walk(v, c) + } + + // walk children + // (the order of the cases matches the order + // of the corresponding node types in go) + switch n := node.(type) { + // Comments and fields + case *Comment: + // nothing to do + + case *CommentGroup: + for _, c := range n.List { + walk(v, c) + } + + case *Attribute: + // nothing to do + + case *Field: + walk(v, n.Label) + if n.Value != nil { + walk(v, n.Value) + } + for _, a := range n.Attrs { + walk(v, a) + } + + case *StructLit: + walkDeclList(v, n.Elts) + + // Expressions + case *BottomLit, *BadExpr, *Ident, *BasicLit: + // nothing to do + + case *Interpolation: + for _, e := range n.Elts { + walk(v, e) + } + + case *ListLit: + walkExprList(v, n.Elts) + + case *Ellipsis: + if n.Type != nil { + walk(v, n.Type) + } + + case *ParenExpr: + walk(v, n.X) + + case *SelectorExpr: + walk(v, n.X) + walk(v, n.Sel) + + case *IndexExpr: + walk(v, n.X) + walk(v, n.Index) + + case *SliceExpr: + walk(v, n.X) + if n.Low != nil { + walk(v, n.Low) + } + if n.High != nil { + walk(v, n.High) + } + + case *CallExpr: + walk(v, n.Fun) + walkExprList(v, n.Args) + + case *UnaryExpr: + walk(v, n.X) + + case *BinaryExpr: + walk(v, n.X) + walk(v, n.Y) + + // Declarations + case *ImportSpec: + if n.Name != nil { + walk(v, n.Name) + } + walk(v, n.Path) + + case *BadDecl: + // nothing to do + + case *ImportDecl: + for _, s := range n.Specs { + walk(v, s) + } + + case *EmbedDecl: + walk(v, n.Expr) + + case *LetClause: + walk(v, n.Ident) + walk(v, n.Expr) + + case *Alias: + walk(v, n.Ident) + walk(v, n.Expr) + + case *Comprehension: + for _, c := range n.Clauses { + walk(v, c) + } + walk(v, n.Value) + + // Files and packages + case *File: + walkDeclList(v, n.Decls) + + case *Package: + walk(v, n.Name) + + case *ForClause: + if n.Key != nil { + walk(v, n.Key) + } + walk(v, n.Value) + walk(v, n.Source) + + case *IfClause: + walk(v, n.Condition) + + default: + panic(fmt.Sprintf("Walk: unexpected node type %T", n)) + } + + v.After(node) +} + +type inspector struct { + before func(Node) bool + after func(Node) + + commentStack []commentFrame + current commentFrame +} + +type commentFrame struct { + cg []*CommentGroup + pos int8 +} + +func (f *inspector) Before(node Node) visitor { + if f.before == nil || f.before(node) { + f.commentStack = append(f.commentStack, f.current) + f.current = commentFrame{cg: Comments(node)} + f.visitComments(f.current.pos) + return f + } + return nil +} + +func (f *inspector) After(node Node) { + f.visitComments(127) + p := len(f.commentStack) - 1 + f.current = f.commentStack[p] + f.commentStack = f.commentStack[:p] + f.current.pos++ + if f.after != nil { + f.after(node) + } +} + +func (f *inspector) Token(t token.Token) { + f.current.pos++ +} + +func (f *inspector) setPos(i int8) { + f.current.pos = i +} + +func (f *inspector) visitComments(pos int8) { + c := &f.current + for ; len(c.cg) > 0; c.cg = c.cg[1:] { + cg := c.cg[0] + if cg.Position == pos { + continue + } + if f.before == nil || f.before(cg) { + for _, c := range cg.List { + if f.before == nil || f.before(c) { + if f.after != nil { + f.after(c) + } + } + } + if f.after != nil { + f.after(cg) + } + } + } +} diff --git a/vendor/cuelang.org/go/cue/attribute.go b/vendor/cuelang.org/go/cue/attribute.go new file mode 100644 index 0000000000..dd874d6b39 --- /dev/null +++ b/vendor/cuelang.org/go/cue/attribute.go @@ -0,0 +1,200 @@ +// Copyright 2021 CUE Authors +// +// 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 cue + +import ( + "fmt" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/token" + "cuelang.org/go/internal" + "cuelang.org/go/internal/core/export" +) + +// Attribute returns the attribute data for the given key. +// The returned attribute will return an error for any of its methods if there +// is no attribute for the requested key. +func (v Value) Attribute(key string) Attribute { + // look up the attributes + if v.v == nil { + return nonExistAttr(key) + } + // look up the attributes + for _, a := range export.ExtractFieldAttrs(v.v) { + k, _ := a.Split() + if key != k { + continue + } + return newAttr(internal.FieldAttr, a) + } + + return nonExistAttr(key) +} + +func newAttr(k internal.AttrKind, a *ast.Attribute) Attribute { + key, body := a.Split() + x := internal.ParseAttrBody(token.NoPos, body) + x.Name = key + x.Kind = k + return Attribute{x} +} + +func nonExistAttr(key string) Attribute { + a := internal.NewNonExisting(key) + a.Name = key + a.Kind = internal.FieldAttr + return Attribute{a} +} + +// Attributes reports all field attributes for the Value. +// +// To retrieve attributes of multiple kinds, you can bitwise-or kinds together. +// Use ValueKind to query attributes associated with a value. +func (v Value) Attributes(mask AttrKind) []Attribute { + if v.v == nil { + return nil + } + + attrs := []Attribute{} + + if mask&FieldAttr != 0 { + for _, a := range export.ExtractFieldAttrs(v.v) { + attrs = append(attrs, newAttr(internal.FieldAttr, a)) + } + } + + if mask&DeclAttr != 0 { + for _, a := range export.ExtractDeclAttrs(v.v) { + attrs = append(attrs, newAttr(internal.DeclAttr, a)) + } + } + + return attrs +} + +// AttrKind indicates the location of an attribute within CUE source. +type AttrKind int + +const ( + // FieldAttr indicates a field attribute. + // foo: bar @attr() + FieldAttr AttrKind = AttrKind(internal.FieldAttr) + + // DeclAttr indicates a declaration attribute. + // foo: { + // @attr() + // } + DeclAttr AttrKind = AttrKind(internal.DeclAttr) + + // A ValueAttr is a bit mask to request any attribute that is locally + // associated with a field, instead of, for instance, an entire file. + ValueAttr AttrKind = FieldAttr | DeclAttr + + // TODO: Possible future attr kinds + // ElemAttr (is a ValueAttr) + // FileAttr (not a ValueAttr) + + // TODO: Merge: merge namesake attributes. +) + +// An Attribute contains meta data about a field. +type Attribute struct { + attr internal.Attr +} + +// Format implements fmt.Formatter. +func (a Attribute) Format(w fmt.State, verb rune) { + fmt.Fprintf(w, "@%s(%s)", a.attr.Name, a.attr.Body) +} + +var _ fmt.Formatter = &Attribute{} + +// Name returns the name of the attribute, for instance, "json" for @json(...). +func (a *Attribute) Name() string { + return a.attr.Name +} + +// Contents reports the full contents of an attribute within parentheses, so +// contents in @attr(contents). +func (a *Attribute) Contents() string { + return a.attr.Body +} + +// NumArgs reports the number of arguments parsed for this attribute. +func (a *Attribute) NumArgs() int { + return len(a.attr.Fields) +} + +// Arg reports the contents of the ith comma-separated argument of a. +// +// If the argument contains an unescaped equals sign, it returns a key-value +// pair. Otherwise it returns the contents in value. +func (a *Attribute) Arg(i int) (key, value string) { + f := a.attr.Fields[i] + return f.Key(), f.Value() +} + +// RawArg reports the raw contents of the ith comma-separated argument of a, +// including surrounding spaces. +func (a *Attribute) RawArg(i int) string { + return a.attr.Fields[i].Text() +} + +// Kind reports the type of location within CUE source where the attribute +// was specified. +func (a *Attribute) Kind() AttrKind { + return AttrKind(a.attr.Kind) +} + +// Err returns the error associated with this Attribute or nil if this +// attribute is valid. +func (a *Attribute) Err() error { + return a.attr.Err +} + +// String reports the possibly empty string value at the given position or +// an error the attribute is invalid or if the position does not exist. +func (a *Attribute) String(pos int) (string, error) { + return a.attr.String(pos) +} + +// Int reports the integer at the given position or an error if the attribute is +// invalid, the position does not exist, or the value at the given position is +// not an integer. +func (a *Attribute) Int(pos int) (int64, error) { + return a.attr.Int(pos) +} + +// Flag reports whether an entry with the given name exists at position pos or +// onwards or an error if the attribute is invalid or if the first pos-1 entries +// are not defined. +func (a *Attribute) Flag(pos int, key string) (bool, error) { + return a.attr.Flag(pos, key) +} + +// Lookup searches for an entry of the form key=value from position pos onwards +// and reports the value if found. It reports an error if the attribute is +// invalid or if the first pos-1 entries are not defined. +func (a *Attribute) Lookup(pos int, key string) (val string, found bool, err error) { + val, found, err = a.attr.Lookup(pos, key) + + // TODO: remove at some point. This is an ugly hack to simulate the old + // behavior of protobufs. + if !found && a.attr.Name == "protobuf" && key == "type" { + val, err = a.String(1) + found = err == nil + } + return val, found, err +} diff --git a/vendor/cuelang.org/go/cue/build.go b/vendor/cuelang.org/go/cue/build.go new file mode 100644 index 0000000000..82863ee014 --- /dev/null +++ b/vendor/cuelang.org/go/cue/build.go @@ -0,0 +1,157 @@ +// Copyright 2018 The CUE Authors +// +// 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 cue + +import ( + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/ast/astutil" + "cuelang.org/go/cue/build" + "cuelang.org/go/cue/errors" + "cuelang.org/go/internal/core/adt" + "cuelang.org/go/internal/core/runtime" +) + +// A Runtime is used for creating CUE Values. +// +// Any operation that involves two Values or Instances should originate from +// the same Runtime. +// +// The zero value of Runtime works for legacy reasons, but +// should not be used. It may panic at some point. +// +// Deprecated: use Context. +type Runtime runtime.Runtime + +func (r *Runtime) runtime() *runtime.Runtime { + rt := (*runtime.Runtime)(r) + rt.Init() + return rt +} + +type hiddenRuntime = Runtime + +func (r *Runtime) complete(p *build.Instance, v *adt.Vertex) (*Instance, error) { + idx := r.runtime() + inst := getImportFromBuild(idx, p, v) + inst.ImportPath = p.ImportPath + if inst.Err != nil { + return nil, inst.Err + } + return inst, nil +} + +// Compile compiles the given source into an Instance. The source code may be +// provided as a string, byte slice, io.Reader. The name is used as the file +// name in position information. The source may import builtin packages. Use +// Build to allow importing non-builtin packages. +// +// Deprecated: use Parse or ParseBytes. The use of Instance is being phased out. +func (r *hiddenRuntime) Compile(filename string, source interface{}) (*Instance, error) { + cfg := &runtime.Config{Filename: filename} + v, p := r.runtime().Compile(cfg, source) + return r.complete(p, v) +} + +// CompileFile compiles the given source file into an Instance. The source may +// import builtin packages. Use Build to allow importing non-builtin packages. +// +// Deprecated: use BuildFile. The use of Instance is being phased out. +func (r *hiddenRuntime) CompileFile(file *ast.File) (*Instance, error) { + v, p := r.runtime().CompileFile(nil, file) + return r.complete(p, v) +} + +// CompileExpr compiles the given source expression into an Instance. The source +// may import builtin packages. Use Build to allow importing non-builtin +// packages. +// +// Deprecated: use BuildExpr. The use of Instance is being phased out. +func (r *hiddenRuntime) CompileExpr(expr ast.Expr) (*Instance, error) { + f, err := astutil.ToFile(expr) + if err != nil { + return nil, err + } + v := (*Context)(r).BuildExpr(expr) + err = v.Err() + inst := &Instance{ + index: r.runtime(), + root: v.v, + inst: &build.Instance{ + Files: []*ast.File{f}, + }, + Err: errors.Promote(err, ""), + Incomplete: err != nil, + } + return inst, err +} + +// Parse parses a CUE source value into a CUE Instance. The source code may be +// provided as a string, byte slice, or io.Reader. The name is used as the file +// name in position information. The source may import builtin packages. +// +// Deprecated: use CompileString or CompileBytes. The use of Instance is being +// phased out. +func (r *hiddenRuntime) Parse(name string, source interface{}) (*Instance, error) { + return r.Compile(name, source) +} + +// Build creates an Instance from the given build.Instance. A returned Instance +// may be incomplete, in which case its Err field is set. +// +// Deprecated: use Context.BuildInstance. The use of Instance is being phased +// out. +func (r *hiddenRuntime) Build(p *build.Instance) (*Instance, error) { + v, _ := r.runtime().Build(nil, p) + return r.complete(p, v) +} + +// Deprecated: use cuecontext.Context.BuildInstances. The use of Instance is +// being phased out. +func Build(instances []*build.Instance) []*Instance { + if len(instances) == 0 { + panic("cue: list of instances must not be empty") + } + var r Runtime + a, _ := r.build(instances) + return a +} + +func (r *hiddenRuntime) build(instances []*build.Instance) ([]*Instance, error) { + index := r.runtime() + + loaded := []*Instance{} + + var errs errors.Error + + for _, p := range instances { + v, _ := index.Build(nil, p) + i := getImportFromBuild(index, p, v) + errs = errors.Append(errs, i.Err) + loaded = append(loaded, i) + } + + // TODO: insert imports + return loaded, errs +} + +// FromExpr creates an instance from an expression. +// Any references must be resolved beforehand. +// +// Deprecated: use CompileExpr +func (r *hiddenRuntime) FromExpr(expr ast.Expr) (*Instance, error) { + return r.CompileFile(&ast.File{ + Decls: []ast.Decl{&ast.EmbedDecl{Expr: expr}}, + }) +} diff --git a/vendor/cuelang.org/go/cue/build/context.go b/vendor/cuelang.org/go/cue/build/context.go new file mode 100644 index 0000000000..664326eeef --- /dev/null +++ b/vendor/cuelang.org/go/cue/build/context.go @@ -0,0 +1,128 @@ +// Copyright 2018 The CUE Authors +// +// 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 build defines data types and utilities for defining CUE configuration +// instances. +// +// This package enforces the rules regarding packages and instances as defined +// in the spec, but it leaves any other details, as well as handling of modules, +// up to the implementation. +// +// A full implementation of instance loading can be found in the loader package. +// +// WARNING: this packages may change. It is fine to use load and cue, who both +// use this package. +package build + +import ( + "context" + + "cuelang.org/go/cue/ast" +) + +// A Context keeps track of state of building instances and caches work. +type Context struct { + ctxt context.Context + + loader LoadFunc + parseFunc func(str string, src interface{}) (*ast.File, error) + + initialized bool + + imports map[string]*Instance +} + +// NewInstance creates an instance for this Context. +func (c *Context) NewInstance(dir string, f LoadFunc) *Instance { + if c == nil { + c = &Context{} + } + if f == nil { + f = c.loader + } + return &Instance{ + ctxt: c, + loadFunc: f, + Dir: dir, + } +} + +// Complete finishes the initialization of an instance. All files must have +// been added with AddFile before this call. +func (inst *Instance) Complete() error { + if inst.done { + return inst.Err + } + inst.done = true + + err := inst.complete() + if err != nil { + inst.ReportError(err) + } + if inst.Err != nil { + inst.Incomplete = true + return inst.Err + } + return nil +} + +func (c *Context) init() { + if !c.initialized { + c.initialized = true + c.ctxt = context.Background() + c.imports = map[string]*Instance{} + } +} + +// Options: +// - certain parse modes +// - parallellism +// - error handler (allows cancelling the context) +// - file set. + +// NewContext creates a new build context. +// +// All instances must be created with a context. +func NewContext(opts ...Option) *Context { + c := &Context{} + for _, o := range opts { + o(c) + } + c.init() + return c +} + +// Option define build options. +type Option func(c *Context) + +// Loader sets parsing options. +func Loader(f LoadFunc) Option { + return func(c *Context) { c.loader = f } +} + +// ParseFile is called to read and parse each file +// when building syntax tree. +// It must be safe to call ParseFile simultaneously from multiple goroutines. +// If ParseFile is nil, the loader will uses parser.ParseFile. +// +// ParseFile should parse the source from src and use filename only for +// recording position information. +// +// An application may supply a custom implementation of ParseFile +// to change the effective file contents or the behavior of the parser, +// or to modify the syntax tree. For example, changing the backwards +// compatibility. +func ParseFile(f func(filename string, src interface{}) (*ast.File, error)) Option { + return func(c *Context) { c.parseFunc = f } +} diff --git a/vendor/cuelang.org/go/cue/build/doc.go b/vendor/cuelang.org/go/cue/build/doc.go new file mode 100644 index 0000000000..52421c65d8 --- /dev/null +++ b/vendor/cuelang.org/go/cue/build/doc.go @@ -0,0 +1,16 @@ +// Copyright 2018 The CUE Authors +// +// 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 build defines collections of CUE files to build an instance. +package build // import "cuelang.org/go/cue/build" diff --git a/vendor/cuelang.org/go/cue/build/file.go b/vendor/cuelang.org/go/cue/build/file.go new file mode 100644 index 0000000000..7b22d2eda6 --- /dev/null +++ b/vendor/cuelang.org/go/cue/build/file.go @@ -0,0 +1,86 @@ +// Copyright 2020 CUE Authors +// +// 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 build + +import "cuelang.org/go/cue/errors" + +// A File represents a file that is part of the build process. +type File struct { + Filename string `json:"filename"` + + Encoding Encoding `json:"encoding,omitempty"` + Interpretation Interpretation `json:"interpretation,omitempty"` + Form Form `json:"form,omitempty"` + Tags map[string]string `json:"tags,omitempty"` // code=go + + ExcludeReason errors.Error `json:"-"` + Source interface{} `json:"-"` // TODO: swap out with concrete type. +} + +// A Encoding indicates a file format for representing a program. +type Encoding string + +const ( + CUE Encoding = "cue" + JSON Encoding = "json" + YAML Encoding = "yaml" + JSONL Encoding = "jsonl" + Text Encoding = "text" + Binary Encoding = "binary" + Protobuf Encoding = "proto" + TextProto Encoding = "textproto" + BinaryProto Encoding = "pb" + + // TODO: + // TOML + + Code Encoding = "code" // Programming languages +) + +// An Interpretation determines how a certain program should be interpreted. +// For instance, data may be interpreted as describing a schema, which itself +// can be converted to a CUE schema. +type Interpretation string + +const ( + // Auto interprets the underlying data file as data, JSON Schema or OpenAPI, + // depending on the existence of certain marker fields. + // + // JSON Schema is identified by a top-level "$schema" field with a URL + // of the form "https?://json-schema.org/.*schema#?". + // + // OpenAPI is identified by the existence of a top-level field "openapi" + // with a major semantic version of 3, as well as the existence of + // the info.title and info.version fields. + // + // In all other cases, the underlying data is interpreted as is. + Auto Interpretation = "auto" + JSONSchema Interpretation = "jsonschema" + OpenAPI Interpretation = "openapi" + ProtobufJSON Interpretation = "pb" +) + +// A Form specifies the form in which a program should be represented. +type Form string + +const ( + Full Form = "full" + Schema Form = "schema" + Struct Form = "struct" + Final Form = "final" // picking default values, may be non-concrete + Graph Form = "graph" // Data only, but allow references + DAG Form = "dag" // Like graph, but don't allow cycles + Data Form = "data" // always final +) diff --git a/vendor/cuelang.org/go/cue/build/import.go b/vendor/cuelang.org/go/cue/build/import.go new file mode 100644 index 0000000000..996edb0afe --- /dev/null +++ b/vendor/cuelang.org/go/cue/build/import.go @@ -0,0 +1,170 @@ +// Copyright 2018 The CUE Authors +// +// 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 build + +import ( + "sort" + "strconv" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/token" +) + +type LoadFunc func(pos token.Pos, path string) *Instance + +type cueError = errors.Error + +type buildError struct { + cueError + inputs []token.Pos +} + +func (e *buildError) InputPositions() []token.Pos { + return e.inputs +} + +func (inst *Instance) complete() errors.Error { + // TODO: handle case-insensitive collisions. + // dir := inst.Dir + // names := []string{} + // for _, src := range sources { + // names = append(names, src.path) + // } + // f1, f2 := str.FoldDup(names) + // if f1 != "" { + // return nil, fmt.Errorf("case-insensitive file name collision: %q and %q", f1, f2) + // } + + var ( + c = inst.ctxt + imported = map[string][]token.Pos{} + ) + + for _, f := range inst.Files { + for _, decl := range f.Decls { + d, ok := decl.(*ast.ImportDecl) + if !ok { + continue + } + for _, spec := range d.Specs { + quoted := spec.Path.Value + path, err := strconv.Unquote(quoted) + if err != nil { + inst.Err = errors.Append(inst.Err, + errors.Newf( + spec.Path.Pos(), + "%s: parser returned invalid quoted string: <%s>", + f.Filename, quoted)) + } + imported[path] = append(imported[path], spec.Pos()) + } + } + } + + paths := make([]string, 0, len(imported)) + for path := range imported { + paths = append(paths, path) + if path == "" { + return &buildError{ + errors.Newf(token.NoPos, "empty import path"), + imported[path], + } + } + } + + sort.Strings(paths) + + if inst.loadFunc != nil { + for i, path := range paths { + isLocal := IsLocalImport(path) + if isLocal { + // path = dirToImportPath(filepath.Join(dir, path)) + } + + imp := c.imports[path] + if imp == nil { + pos := token.NoPos + if len(imported[path]) > 0 { + pos = imported[path][0] + } + imp = inst.loadFunc(pos, path) + if imp == nil { + continue + } + if imp.Err != nil { + return errors.Wrapf(imp.Err, pos, "import failed") + } + imp.ImportPath = path + // imp.parent = inst + c.imports[path] = imp + // imp.parent = nil + } else if imp.parent != nil { + // TODO: report a standard cycle message. + // cycle is now handled explicitly in loader + } + paths[i] = imp.ImportPath + + inst.addImport(imp) + if imp.Incomplete { + inst.Incomplete = true + } + } + } + + inst.ImportPaths = paths + inst.ImportPos = imported + + // Build full dependencies + deps := make(map[string]*Instance) + var q []*Instance + q = append(q, inst.Imports...) + for i := 0; i < len(q); i++ { + p1 := q[i] + path := p1.ImportPath + // The same import path could produce an error or not, + // depending on what tries to import it. + // Prefer to record entries with errors, so we can report them. + // p0 := deps[path] + // if err0, err1 := lastError(p0), lastError(p1); p0 == nil || err1 != nil && (err0 == nil || len(err0.ImportStack) > len(err1.ImportStack)) { + // deps[path] = p1 + // for _, p2 := range p1.Imports { + // if deps[p2.ImportPath] != p2 { + // q = append(q, p2) + // } + // } + // } + if _, ok := deps[path]; !ok { + deps[path] = p1 + } + } + inst.Deps = make([]string, 0, len(deps)) + for dep := range deps { + inst.Deps = append(inst.Deps, dep) + } + sort.Strings(inst.Deps) + + for _, dep := range inst.Deps { + p1 := deps[dep] + if p1 == nil { + panic("impossible: missing entry in package cache for " + dep + " imported by " + inst.ImportPath) + } + if p1.Err != nil { + inst.DepsErrors = append(inst.DepsErrors, p1.Err) + } + } + + return nil +} diff --git a/vendor/cuelang.org/go/cue/build/instance.go b/vendor/cuelang.org/go/cue/build/instance.go new file mode 100644 index 0000000000..cc0abb8ae0 --- /dev/null +++ b/vendor/cuelang.org/go/cue/build/instance.go @@ -0,0 +1,287 @@ +// Copyright 2018 The CUE Authors +// +// 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 build + +import ( + "fmt" + pathpkg "path" + "path/filepath" + "strings" + "unicode" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/ast/astutil" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/parser" + "cuelang.org/go/cue/token" + "cuelang.org/go/internal" +) + +// An Instance describes the collection of files, and its imports, necessary +// to build a CUE instance. +// +// A typical way to create an Instance is to use the cue/load package. +type Instance struct { + ctxt *Context + + BuildFiles []*File // files to be included in the build + IgnoredFiles []*File // files excluded for this build + OrphanedFiles []*File // recognized file formats not part of any build + InvalidFiles []*File // could not parse these files + UnknownFiles []*File // unknown file types + + User bool // True if package was created from individual files. + + // Files contains the AST for all files part of this instance. + // TODO: the intent is to deprecate this in favor of BuildFiles. + Files []*ast.File + + loadFunc LoadFunc + done bool + + // PkgName is the name specified in the package clause. + PkgName string + hasName bool + + // ImportPath returns the unique path to identify an imported instance. + // + // Instances created with NewInstance do not have an import path. + ImportPath string + + // Imports lists the instances of all direct imports of this instance. + Imports []*Instance + + // The Err for loading this package or nil on success. This does not + // include any errors of dependencies. Incomplete will be set if there + // were any errors in dependencies. + Err errors.Error + + parent *Instance // TODO: for cycle detection + + // The following fields are for informative purposes and are not used by + // the cue package to create an instance. + + // DisplayPath is a user-friendly version of the package or import path. + DisplayPath string + + // Module defines the module name of a package. It must be defined if + // the packages within the directory structure of the module are to be + // imported by other packages, including those within the module. + Module string + + // Root is the root of the directory hierarchy, it may be "" if this an + // instance has no imports. + // If Module != "", this corresponds to the module root. + // Root/pkg is the directory that holds third-party packages. + Root string // root directory of hierarchy ("" if unknown) + + // Dir is the package directory. A package may also include files from + // ancestor directories, up to the module file. + Dir string + + // NOTICE: the below tags may change in the future. + + // ImportComment is the path in the import comment on the package statement. + ImportComment string `api:"alpha"` + + // AllTags are the build tags that can influence file selection in this + // directory. + AllTags []string `api:"alpha"` + + // Incomplete reports whether any dependencies had an error. + Incomplete bool `api:"alpha"` + + // Dependencies + // ImportPaths gives the transitive dependencies of all imports. + ImportPaths []string `api:"alpha"` + ImportPos map[string][]token.Pos `api:"alpha"` // line information for Imports + + Deps []string `api:"alpha"` + DepsErrors []error `api:"alpha"` + Match []string `api:"alpha"` +} + +// RelPath reports the path of f relative to the root of the instance's module +// directory. The full path is returned if a relative path could not be found. +func (inst *Instance) RelPath(f *File) string { + p, err := filepath.Rel(inst.Root, f.Filename) + if err != nil { + return f.Filename + } + return p +} + +// ID returns the package ID unique for this module. +func (inst *Instance) ID() string { + if s := inst.ImportPath; s != "" { + return s + } + if inst.PkgName == "" { + return "_" + } + s := fmt.Sprintf("%s:%s", inst.Module, inst.PkgName) + return s +} + +// Dependencies reports all Instances on which this instance depends. +func (inst *Instance) Dependencies() []*Instance { + // TODO: as cyclic dependencies are not allowed, we could just not check. + // Do for safety now and remove later if needed. + return appendDependencies(nil, inst, map[*Instance]bool{}) +} + +func appendDependencies(a []*Instance, inst *Instance, done map[*Instance]bool) []*Instance { + for _, d := range inst.Imports { + if done[d] { + continue + } + a = append(a, d) + done[d] = true + a = appendDependencies(a, d, done) + } + return a +} + +// Abs converts relative path used in the one of the file fields to an +// absolute one. +func (inst *Instance) Abs(path string) string { + if filepath.IsAbs(path) { + return path + } + return filepath.Join(inst.Root, path) +} + +func (inst *Instance) setPkg(pkg string) bool { + if !inst.hasName { + inst.hasName = true + inst.PkgName = pkg + return true + } + return false +} + +// ReportError reports an error processing this instance. +func (inst *Instance) ReportError(err errors.Error) { + inst.Err = errors.Append(inst.Err, err) +} + +// Context defines the build context for this instance. All files defined +// in Syntax as well as all imported instances must be created using the +// same build context. +func (inst *Instance) Context() *Context { + return inst.ctxt +} + +func (inst *Instance) parse(name string, src interface{}) (*ast.File, error) { + if inst.ctxt != nil && inst.ctxt.parseFunc != nil { + return inst.ctxt.parseFunc(name, src) + } + return parser.ParseFile(name, src, parser.ParseComments) +} + +// LookupImport defines a mapping from an ImportSpec's ImportPath to Instance. +func (inst *Instance) LookupImport(path string) *Instance { + path = inst.expandPath(path) + for _, inst := range inst.Imports { + if inst.ImportPath == path { + return inst + } + } + return nil +} + +func (inst *Instance) addImport(imp *Instance) { + for _, inst := range inst.Imports { + if inst.ImportPath == imp.ImportPath { + if inst != imp { + panic("import added multiple times with different instances") + } + return + } + } + inst.Imports = append(inst.Imports, imp) +} + +// AddFile adds the file with the given name to the list of files for this +// instance. The file may be loaded from the cache of the instance's context. +// It does not process the file's imports. The package name of the file must +// match the package name of the instance. +// +// Deprecated: use AddSyntax or wait for this to be renamed using a new +// signature. +func (inst *Instance) AddFile(filename string, src interface{}) error { + file, err := inst.parse(filename, src) + if err != nil { + // should always be an errors.List, but just in case. + err := errors.Promote(err, "error adding file") + inst.ReportError(err) + return err + } + + return inst.AddSyntax(file) +} + +// AddSyntax adds the given file to list of files for this instance. The package +// name of the file must match the package name of the instance. +func (inst *Instance) AddSyntax(file *ast.File) errors.Error { + astutil.Resolve(file, func(pos token.Pos, msg string, args ...interface{}) { + inst.Err = errors.Append(inst.Err, errors.Newf(pos, msg, args...)) + }) + _, pkg, pos := internal.PackageInfo(file) + if pkg != "" && pkg != "_" && !inst.setPkg(pkg) && pkg != inst.PkgName { + err := errors.Newf(pos, + "package name %q conflicts with previous package name %q", + pkg, inst.PkgName) + inst.ReportError(err) + return err + } + inst.Files = append(inst.Files, file) + return nil +} + +func (inst *Instance) expandPath(path string) string { + isLocal := IsLocalImport(path) + if isLocal { + path = dirToImportPath(filepath.Join(inst.Dir, path)) + } + return path +} + +// dirToImportPath returns the pseudo-import path we use for a package +// outside the CUE path. It begins with _/ and then contains the full path +// to the directory. If the package lives in c:\home\gopher\my\pkg then +// the pseudo-import path is _/c_/home/gopher/my/pkg. +// Using a pseudo-import path like this makes the ./ imports no longer +// a special case, so that all the code to deal with ordinary imports works +// automatically. +func dirToImportPath(dir string) string { + return pathpkg.Join("_", strings.Map(makeImportValid, filepath.ToSlash(dir))) +} + +func makeImportValid(r rune) rune { + // Should match Go spec, compilers, and ../../go/parser/parser.go:/isValidImport. + const illegalChars = `!"#$%&'()*,:;<=>?[\]^{|}` + "`\uFFFD" + if !unicode.IsGraphic(r) || unicode.IsSpace(r) || strings.ContainsRune(illegalChars, r) { + return '_' + } + return r +} + +// IsLocalImport reports whether the import path is +// a local import path, like ".", "..", "./foo", or "../foo". +func IsLocalImport(path string) bool { + return path == "." || path == ".." || + strings.HasPrefix(path, "./") || strings.HasPrefix(path, "../") +} diff --git a/vendor/cuelang.org/go/cue/builtin.go b/vendor/cuelang.org/go/cue/builtin.go new file mode 100644 index 0000000000..74aa56bbf7 --- /dev/null +++ b/vendor/cuelang.org/go/cue/builtin.go @@ -0,0 +1,31 @@ +// Copyright 2018 The CUE Authors +// +// 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 cue + +import ( + "cuelang.org/go/cue/token" + "cuelang.org/go/internal/core/adt" +) + +func pos(n adt.Node) (p token.Pos) { + if n == nil { + return + } + src := n.Source() + if src == nil { + return + } + return src.Pos() +} diff --git a/vendor/cuelang.org/go/cue/builtinutil.go b/vendor/cuelang.org/go/cue/builtinutil.go new file mode 100644 index 0000000000..2bfd8adf74 --- /dev/null +++ b/vendor/cuelang.org/go/cue/builtinutil.go @@ -0,0 +1,45 @@ +// Copyright 2019 CUE Authors +// +// 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 cue + +// TODO: this code could be generated, but currently isn't. + +type valueSorter struct { + a []Value + cmp Value + err error +} + +func (s *valueSorter) ret() ([]Value, error) { + if s.err != nil { + return nil, s.err + } + // The input slice is already a copy and that we can modify it safely. + return s.a, nil +} + +func (s *valueSorter) Len() int { return len(s.a) } +func (s *valueSorter) Swap(i, j int) { s.a[i], s.a[j] = s.a[j], s.a[i] } +func (s *valueSorter) Less(i, j int) bool { + v := s.cmp.Fill(s.a[i], "x") + v = v.Fill(s.a[j], "y") + + isLess, err := v.Lookup("less").Bool() + if err != nil && s.err == nil { + s.err = err + return true + } + return isLess +} diff --git a/vendor/cuelang.org/go/cue/context.go b/vendor/cuelang.org/go/cue/context.go new file mode 100644 index 0000000000..3da628f581 --- /dev/null +++ b/vendor/cuelang.org/go/cue/context.go @@ -0,0 +1,473 @@ +// Copyright 2018 The CUE Authors +// +// 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 cue + +import ( + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/ast/astutil" + "cuelang.org/go/cue/build" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/token" + "cuelang.org/go/internal/core/adt" + "cuelang.org/go/internal/core/compile" + "cuelang.org/go/internal/core/convert" + "cuelang.org/go/internal/core/debug" + "cuelang.org/go/internal/core/eval" + "cuelang.org/go/internal/core/runtime" +) + +// A Context is used for creating CUE Values. +// +// A Context keeps track of loaded instances, indices of internal +// representations of values, and defines the set of supported builtins. Any +// operation that involves two Values should originate from the same Context. +// +// Use +// +// ctx := cuecontext.New() +// +// to create a new Context. +type Context runtime.Runtime + +func (c *Context) runtime() *runtime.Runtime { + rt := (*runtime.Runtime)(c) + return rt +} + +func (c *Context) ctx() *adt.OpContext { + return newContext(c.runtime()) +} + +// Context reports the Context with which this value was created. +func (v Value) Context() *Context { + return (*Context)(v.idx) +} + +// A BuildOption defines options for the various build-related methods of +// Context. +type BuildOption func(o *runtime.Config) + +// Scope defines a context in which to resolve unresolved identifiers. +// +// Only one scope may be given. It panics if more than one scope is given +// or if the Context in which scope was created differs from the one where +// this option is used. +func Scope(scope Value) BuildOption { + return func(o *runtime.Config) { + if o.Runtime != scope.idx { + panic("incompatible runtime") + } + if o.Scope != nil { + panic("more than one scope is given") + } + o.Scope = valueScope(scope) + } +} + +// Filename assigns a filename to parsed content. +func Filename(filename string) BuildOption { + return func(o *runtime.Config) { o.Filename = filename } +} + +// ImportPath defines the import path to use for building CUE. The import path +// influences the scope in which identifiers occurring in the input CUE are +// defined. Passing the empty string is equal to not specifying this option. +// +// This option is typically not necessary when building using a build.Instance, +// but takes precedence otherwise. +func ImportPath(path string) BuildOption { + return func(o *runtime.Config) { o.ImportPath = path } +} + +// InferBuiltins allows unresolved references to bind to builtin packages with a +// unique package name. +// +// This option is intended for evaluating expressions in a context where import +// statements cannot be used. It is not recommended to use this for evaluating +// CUE files. +func InferBuiltins(elide bool) BuildOption { + return func(o *runtime.Config) { + o.Imports = func(x *ast.Ident) (pkgPath string) { + return o.Runtime.BuiltinPackagePath(x.Name) + } + } +} + +func (c *Context) parseOptions(options []BuildOption) (cfg runtime.Config) { + cfg.Runtime = (*runtime.Runtime)(c) + for _, f := range options { + f(&cfg) + } + return cfg +} + +// BuildInstance creates a Value from the given build.Instance. +// +// The returned Value will represent an error, accessible through Err, if any +// error occurred. +func (c *Context) BuildInstance(i *build.Instance, options ...BuildOption) Value { + cfg := c.parseOptions(options) + v, err := c.runtime().Build(&cfg, i) + if err != nil { + return c.makeError(err) + } + return c.make(v) +} + +func (c *Context) makeError(err errors.Error) Value { + b := &adt.Bottom{Err: err} + node := &adt.Vertex{BaseValue: b} + node.UpdateStatus(adt.Finalized) + node.AddConjunct(adt.MakeRootConjunct(nil, b)) + return c.make(node) +} + +// BuildInstances creates a Value for each of the given instances and reports +// the combined errors or nil if there were no errors. +func (c *Context) BuildInstances(instances []*build.Instance) ([]Value, error) { + var errs errors.Error + var a []Value + for _, b := range instances { + v, err := c.runtime().Build(nil, b) + if err != nil { + errs = errors.Append(errs, err) + a = append(a, c.makeError(err)) + } else { + a = append(a, c.make(v)) + } + } + return a, errs +} + +// BuildFile creates a Value from f. +// +// The returned Value will represent an error, accessible through Err, if any +// error occurred. +func (c *Context) BuildFile(f *ast.File, options ...BuildOption) Value { + cfg := c.parseOptions(options) + return c.compile(c.runtime().CompileFile(&cfg, f)) +} + +func (c *Context) compile(v *adt.Vertex, p *build.Instance) Value { + if p.Err != nil { + return c.makeError(p.Err) + } + return c.make(v) +} + +// BuildExpr creates a Value from x. +// +// The returned Value will represent an error, accessible through Err, if any +// error occurred. +func (c *Context) BuildExpr(x ast.Expr, options ...BuildOption) Value { + r := c.runtime() + cfg := c.parseOptions(options) + + ctx := c.ctx() + + // TODO: move to runtime?: it probably does not make sense to treat BuildExpr + // and the expression resulting from CompileString differently. + astutil.ResolveExpr(x, errFn) + + pkgPath := cfg.ImportPath + if pkgPath == "" { + pkgPath = anonymousPkg + } + + conjunct, err := compile.Expr(&cfg.Config, r, pkgPath, x) + if err != nil { + return c.makeError(err) + } + v := adt.Resolve(ctx, conjunct) + + return c.make(v) +} + +func errFn(pos token.Pos, msg string, args ...interface{}) {} + +// resolveExpr binds unresolved expressions to values in the expression or v. +func resolveExpr(ctx *adt.OpContext, v Value, x ast.Expr) adt.Value { + cfg := &compile.Config{Scope: valueScope(v)} + + astutil.ResolveExpr(x, errFn) + + c, err := compile.Expr(cfg, ctx, anonymousPkg, x) + if err != nil { + return &adt.Bottom{Err: err} + } + return adt.Resolve(ctx, c) +} + +// anonymousPkg reports a package path that can never resolve to a valid package. +const anonymousPkg = "_" + +// CompileString parses and build a Value from the given source string. +// +// The returned Value will represent an error, accessible through Err, if any +// error occurred. +func (c *Context) CompileString(src string, options ...BuildOption) Value { + cfg := c.parseOptions(options) + return c.compile(c.runtime().Compile(&cfg, src)) +} + +// CompileBytes parses and build a Value from the given source bytes. +// +// The returned Value will represent an error, accessible through Err, if any +// error occurred. +func (c *Context) CompileBytes(b []byte, options ...BuildOption) Value { + cfg := c.parseOptions(options) + return c.compile(c.runtime().Compile(&cfg, b)) +} + +// TODO: fs.FS or custom wrapper? +// // CompileFile parses and build a Value from the given source bytes. +// // +// // The returned Value will represent an error, accessible through Err, if any +// // error occurred. +// func (c *Context) CompileFile(f fs.File, options ...BuildOption) Value { +// b, err := io.ReadAll(f) +// if err != nil { +// return c.makeError(errors.Promote(err, "parsing file system file")) +// } +// return c.compile(c.runtime().Compile("", b)) +// } + +func (c *Context) make(v *adt.Vertex) Value { + return newValueRoot(c.runtime(), newContext(c.runtime()), v) +} + +// An EncodeOption defines options for the various encoding-related methods of +// Context. +type EncodeOption func(*encodeOptions) + +type encodeOptions struct { + nilIsTop bool +} + +func (o *encodeOptions) process(option []EncodeOption) { + for _, f := range option { + f(o) + } +} + +// NilIsAny indicates whether a nil value is interpreted as null or _. +// +// The default is to interpret nil as _. +func NilIsAny(isAny bool) EncodeOption { + return func(o *encodeOptions) { o.nilIsTop = isAny } +} + +// Encode converts a Go value to a CUE value. +// +// The returned Value will represent an error, accessible through Err, if any +// error occurred. +// +// Encode traverses the value v recursively. If an encountered value implements +// the json.Marshaler interface and is not a nil pointer, Encode calls its +// MarshalJSON method to produce JSON and convert that to CUE instead. If no +// MarshalJSON method is present but the value implements encoding.TextMarshaler +// instead, Encode calls its MarshalText method and encodes the result as a +// string. +// +// Otherwise, Encode uses the following type-dependent default encodings: +// +// Boolean values encode as CUE booleans. +// +// Floating point, integer, and *big.Int and *big.Float values encode as CUE +// numbers. +// +// String values encode as CUE strings coerced to valid UTF-8, replacing +// sequences of invalid bytes with the Unicode replacement rune as per Unicode's +// and W3C's recommendation. +// +// Array and slice values encode as CUE lists, except that []byte encodes as a +// bytes value, and a nil slice encodes as the null. +// +// Struct values encode as CUE structs. Each exported struct field becomes a +// member of the object, using the field name as the object key, unless the +// field is omitted for one of the reasons given below. +// +// The encoding of each struct field can be customized by the format string +// stored under the "json" key in the struct field's tag. The format string +// gives the name of the field, possibly followed by a comma-separated list of +// options. The name may be empty in order to specify options without overriding +// the default field name. +// +// The "omitempty" option specifies that the field should be omitted from the +// encoding if the field has an empty value, defined as false, 0, a nil pointer, +// a nil interface value, and any empty array, slice, map, or string. +// +// See the documentation for Go's json.Marshal for more details on the field +// tags and their meaning. +// +// Anonymous struct fields are usually encoded as if their inner exported +// fields were fields in the outer struct, subject to the usual Go visibility +// rules amended as described in the next paragraph. An anonymous struct field +// with a name given in its JSON tag is treated as having that name, rather than +// being anonymous. An anonymous struct field of interface type is treated the +// same as having that type as its name, rather than being anonymous. +// +// The Go visibility rules for struct fields are amended for when deciding which +// field to encode or decode. If there are multiple fields at the same level, +// and that level is the least nested (and would therefore be the nesting level +// selected by the usual Go rules), the following extra rules apply: +// +// 1) Of those fields, if any are JSON-tagged, only tagged fields are +// considered, even if there are multiple untagged fields that would otherwise +// conflict. +// +// 2) If there is exactly one field (tagged or not according to the first rule), +// that is selected. +// +// 3) Otherwise there are multiple fields, and all are ignored; no error occurs. +// +// Map values encode as CUE structs. The map's key type must either be a string, +// an integer type, or implement encoding.TextMarshaler. The map keys are sorted +// and used as CUE struct field names by applying the following rules, subject +// to the UTF-8 coercion described for string values above: +// +// - keys of any string type are used directly +// - encoding.TextMarshalers are marshaled +// - integer keys are converted to strings +// +// Pointer values encode as the value pointed to. A nil pointer encodes as the +// null CUE value. +// +// Interface values encode as the value contained in the interface. A nil +// interface value encodes as the null CUE value. The NilIsAny EncodingOption +// can be used to interpret nil as any (_) instead. +// +// Channel, complex, and function values cannot be encoded in CUE. Attempting to +// encode such a value results in the returned value being an error, accessible +// through the Err method. +// +func (c *Context) Encode(x interface{}, option ...EncodeOption) Value { + switch v := x.(type) { + case adt.Value: + return newValueRoot(c.runtime(), c.ctx(), v) + } + var options encodeOptions + options.process(option) + + ctx := c.ctx() + // TODO: is true the right default? + expr := convert.GoValueToValue(ctx, x, options.nilIsTop) + n := &adt.Vertex{} + n.AddConjunct(adt.MakeRootConjunct(nil, expr)) + n.Finalize(ctx) + return c.make(n) +} + +// Encode converts a Go type to a CUE value. +// +// The returned Value will represent an error, accessible through Err, if any +// error occurred. +func (c *Context) EncodeType(x interface{}, option ...EncodeOption) Value { + switch v := x.(type) { + case *adt.Vertex: + return c.make(v) + } + + ctx := c.ctx() + expr, err := convert.GoTypeToExpr(ctx, x) + if err != nil { + return c.makeError(err) + } + n := &adt.Vertex{} + n.AddConjunct(adt.MakeRootConjunct(nil, expr)) + n.Finalize(ctx) + return c.make(n) +} + +// NewList creates a Value that is a list of the given values. +// +// All Values must be created by c. +func (c *Context) NewList(v ...Value) Value { + a := make([]adt.Value, len(v)) + for i, x := range v { + if x.idx != (*runtime.Runtime)(c) { + panic("values must be from same Context") + } + a[i] = x.v + } + return c.make(c.ctx().NewList(a...)) +} + +// TODO: + +// func (c *Context) NewExpr(op Op, v ...Value) Value { +// return Value{} +// } + +// func (c *Context) NewValue(v ...ValueElem) Value { +// return Value{} +// } + +// func NewAttr(key string, values ...string) *Attribute { +// return &Attribute{} +// } + +// // Clear unloads all previously-loaded imports. +// func (c *Context) Clear() { +// } + +// // Values created up to the point of the Fork will be valid in both runtimes. +// func (c *Context) Fork() *Context { +// return nil +// } + +// type ValueElem interface { +// } + +// func NewField(sel Selector, value Value, attrs ...Attribute) ValueElem { +// return nil +// } + +// func NewDocComment(text string) ValueElem { +// return nil +// } + +// newContext returns a new evaluation context. +func newContext(idx *runtime.Runtime) *adt.OpContext { + if idx == nil { + return nil + } + return eval.NewContext(idx, nil) +} + +func debugStr(ctx *adt.OpContext, v adt.Node) string { + return debug.NodeString(ctx, v, nil) +} + +func str(c *adt.OpContext, v adt.Node) string { + return debugStr(c, v) +} + +// eval returns the evaluated value. This may not be the vertex. +// +// Deprecated: use ctx.value +func (v Value) eval(ctx *adt.OpContext) adt.Value { + if v.v == nil { + panic("undefined value") + } + x := manifest(ctx, v.v) + return x.Value() +} + +// TODO: change from Vertex to Vertex. +func manifest(ctx *adt.OpContext, v *adt.Vertex) *adt.Vertex { + v.Finalize(ctx) + return v +} diff --git a/vendor/cuelang.org/go/cue/cue.go b/vendor/cuelang.org/go/cue/cue.go new file mode 100644 index 0000000000..6f9622f644 --- /dev/null +++ b/vendor/cuelang.org/go/cue/cue.go @@ -0,0 +1,43 @@ +// Copyright 2020 CUE Authors +// +// 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 cue is the main API for CUE evaluation. +// +// Value is the main type that represents CUE evaluations. Values are created +// with a cue.Context. Only values created from the same Context can be +// involved in the same operation. +// +// A Context defines the set of active packages, the translations of field +// names to unique codes, as well as the set of builtins. Use +// +// import "cuelang.org/go/cue/cuecontext" +// +// ctx := cuecontext.New() +// +// to obtain a context. +// +// +// Note that the following types are DEPRECATED and their usage should be +// avoided if possible: +// +// FieldInfo +// Instance +// Runtime +// Struct +// +// Many types also have deprecated methods. Code that already uses deprecated +// methods can keep using them for at least some time. We aim to provide a +// go or cue fix solution to automatically rewrite code using the new API. +// +package cue diff --git a/vendor/cuelang.org/go/cue/cuecontext/cuecontext.go b/vendor/cuelang.org/go/cue/cuecontext/cuecontext.go new file mode 100644 index 0000000000..06080793e3 --- /dev/null +++ b/vendor/cuelang.org/go/cue/cuecontext/cuecontext.go @@ -0,0 +1,31 @@ +// Copyright 2021 CUE Authors +// +// 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 cuecontext + +import ( + "cuelang.org/go/cue" + "cuelang.org/go/internal/core/runtime" + + _ "cuelang.org/go/pkg" +) + +// Option controls a build context. +type Option interface{ buildOption() } + +// New creates a new Context. +func New(options ...Option) *cue.Context { + r := runtime.New() + return (*cue.Context)(r) +} diff --git a/vendor/cuelang.org/go/cue/decode.go b/vendor/cuelang.org/go/cue/decode.go new file mode 100644 index 0000000000..f4adc5bd11 --- /dev/null +++ b/vendor/cuelang.org/go/cue/decode.go @@ -0,0 +1,943 @@ +// Copyright 2021 CUE Authors +// +// 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 cue + +import ( + "bytes" + "encoding" + "encoding/json" + "reflect" + "sort" + "strconv" + "strings" + "sync" + "unicode" + "unicode/utf8" + + "cuelang.org/go/cue/errors" + "cuelang.org/go/internal/core/adt" +) + +// Decode initializes x with Value v. If x is a struct, it will validate the +// constraints specified in the field tags. +func (v Value) Decode(x interface{}) error { + var d decoder + w := reflect.ValueOf(x) + switch { + case !reflect.Indirect(w).CanSet(): + d.addErr(errors.Newf(v.Pos(), "cannot decode into unsettable value")) + + default: + if w.Kind() == reflect.Ptr { + w = w.Elem() + } + d.decode(w, v, false) + } + return d.errs +} + +type decoder struct { + errs errors.Error +} + +func (d *decoder) addErr(err error) { + if err != nil { + d.errs = errors.Append(d.errs, errors.Promote(err, "")) + } +} + +func incompleteError(v Value) errors.Error { + return &valueError{ + v: v, + err: &adt.Bottom{ + Code: adt.IncompleteError, + Err: errors.Newf(v.Pos(), + "cannot convert non-concrete value %v", v)}, + } +} + +func (d *decoder) clear(x reflect.Value) { + if x.CanSet() { + x.Set(reflect.Zero(x.Type())) + } +} + +func (d *decoder) decode(x reflect.Value, v Value, isPtr bool) { + if !x.IsValid() { + d.addErr(errors.Newf(v.Pos(), "cannot decode into invalid value")) + return + } + + v, _ = v.Default() + if v.v == nil { + d.clear(x) + return + } + + if err := v.Err(); err != nil { + d.addErr(err) + return + } + + switch x.Kind() { + case reflect.Ptr, reflect.Map, reflect.Slice, reflect.Interface: + // nullable types + if v.Null() == nil || !v.IsConcrete() { + d.clear(x) + return + } + + default: + // TODO: allow incomplete values. + if !v.IsConcrete() { + d.addErr(incompleteError(v)) + return + } + } + + ij, it, x := indirect(x, v.Null() == nil) + + if ij != nil { + b, err := v.marshalJSON() + d.addErr(err) + d.addErr(ij.UnmarshalJSON(b)) + return + } + + if it != nil { + b, err := v.Bytes() + if err != nil { + err = errors.Wrapf(err, v.Pos(), "Decode") + d.addErr(err) + return + } + d.addErr(it.UnmarshalText(b)) + return + } + + kind := x.Kind() + + if kind == reflect.Interface { + value := d.interfaceValue(v) + x.Set(reflect.ValueOf(value)) + return + } + + switch kind { + case reflect.Ptr: + d.decode(x.Elem(), v, true) + + case reflect.Bool: + b, err := v.Bool() + d.addErr(err) + x.SetBool(b) + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + i, err := v.Int64() + d.addErr(err) + if x.OverflowInt(i) { + d.addErr(errors.Newf(v.Pos(), "integer %d overflows %s", i, kind)) + break + } + x.SetInt(i) + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + i, err := v.Uint64() + d.addErr(err) + if x.OverflowUint(i) { + d.addErr(errors.Newf(v.Pos(), "integer %d overflows %s", i, kind)) + break + } + x.SetUint(i) + + case reflect.Float32, reflect.Float64: + f, err := v.Float64() + d.addErr(err) + if x.OverflowFloat(f) { + d.addErr(errors.Newf(v.Pos(), "float %g overflows %s", f, kind)) + break + } + x.SetFloat(f) + + case reflect.String: + s, err := v.String() + d.addErr(err) + x.SetString(s) + + case reflect.Array: + d.clear(x) + + t := x.Type() + n := x.Len() + + if t.Elem().Kind() == reflect.Uint8 && v.Kind() == BytesKind { + b, err := v.Bytes() + d.addErr(err) + for i, c := range b { + if i >= n { + break + } + x.Index(i).SetUint(uint64(c)) + } + break + } + + var a []Value + list, err := v.List() + d.addErr(err) + for list.Next() { + a = append(a, list.Value()) + } + + for i, v := range a { + if i >= n { + break + } + d.decode(x.Index(i), v, false) + } + + case reflect.Slice: + t := x.Type() + if t.Elem().Kind() == reflect.Uint8 && v.Kind() == BytesKind { + b, err := v.Bytes() + d.addErr(err) + x.SetBytes(b) + break + } + + var a []Value + list, err := v.List() + d.addErr(err) + for list.Next() { + a = append(a, list.Value()) + } + + switch cap := x.Cap(); { + case cap == 0, // force a non-nil list + cap < len(a): + x.Set(reflect.MakeSlice(t, len(a), len(a))) + + default: + x.SetLen(len(a)) + } + + for i, v := range a { + d.decode(x.Index(i), v, false) + } + + case reflect.Struct: + d.convertStruct(x, v) + + case reflect.Map: + d.convertMap(x, v) + + default: + d.clear(x) + } +} + +func (d *decoder) interfaceValue(v Value) (x interface{}) { + var err error + v, _ = v.Default() + switch v.Kind() { + case NullKind: + return nil + + case BoolKind: + x, err = v.Bool() + + case IntKind: + if i, err := v.Int64(); err == nil { + return int(i) + } + x, err = v.Int(nil) + + case FloatKind: + x, err = v.Float64() // or big int or + + case StringKind: + x, err = v.String() + + case BytesKind: + x, err = v.Bytes() + + case ListKind: + var a []interface{} + list, err := v.List() + d.addErr(err) + for list.Next() { + a = append(a, d.interfaceValue(list.Value())) + } + x = a + + case StructKind: + m := map[string]interface{}{} + iter, err := v.Fields() + d.addErr(err) + for iter.Next() { + m[iter.Label()] = d.interfaceValue(iter.Value()) + } + x = m + + default: + err = incompleteError(v) + } + + d.addErr(err) + return x +} + +var textUnmarshalerType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem() + +// convertMap keeps an existing map and overwrites any entry found in v, +// keeping other preexisting entries. +func (d *decoder) convertMap(x reflect.Value, v Value) { + // Delete existing elements + t := x.Type() + + // Map key must either have string kind, have an integer kind, + // or be an encoding.TextUnmarshaler. + switch t.Key().Kind() { + case reflect.String, + reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, + reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + default: + if !reflect.PtrTo(t.Key()).Implements(textUnmarshalerType) { + d.addErr(errors.Newf(v.Pos(), "unsupported key type %v", t.Key())) + return + } + } + + if x.IsNil() { + x.Set(reflect.MakeMap(t)) + } + + var mapElem reflect.Value + + iter, err := v.Fields() + d.addErr(err) + for iter.Next() { + key := iter.Label() + + var kv reflect.Value + kt := t.Key() + switch { + case reflect.PtrTo(kt).Implements(textUnmarshalerType): + kv = reflect.New(kt) + err := kv.Interface().(encoding.TextUnmarshaler).UnmarshalText([]byte(key)) + d.addErr(err) + kv = kv.Elem() + + case kt.Kind() == reflect.String: + kv = reflect.ValueOf(key).Convert(kt) + + default: + switch kt.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + s := string(key) + n, err := strconv.ParseInt(s, 10, 64) + d.addErr(err) + if reflect.Zero(kt).OverflowInt(n) { + d.addErr(errors.Newf(v.Pos(), "key integer %d overflows %s", n, kt)) + break + } + kv = reflect.ValueOf(n).Convert(kt) + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + s := string(key) + n, err := strconv.ParseUint(s, 10, 64) + d.addErr(err) + if reflect.Zero(kt).OverflowUint(n) { + d.addErr(errors.Newf(v.Pos(), "key integer %d overflows %s", n, kt)) + break + } + kv = reflect.ValueOf(n).Convert(kt) + + default: + panic("json: Unexpected key type") // should never occur + } + } + + elemType := t.Elem() + if !mapElem.IsValid() { + mapElem = reflect.New(elemType).Elem() + } else { + mapElem.Set(reflect.Zero(elemType)) + } + d.decode(mapElem, iter.Value(), false) + + if kv.IsValid() { + x.SetMapIndex(kv, mapElem) + } + } +} + +func (d *decoder) convertStruct(x reflect.Value, v Value) { + t := x.Type() + fields := cachedTypeFields(t) + + iter, err := v.Fields() + d.addErr(err) + for iter.Next() { + + var f *goField + key := iter.Label() + if i, ok := fields.nameIndex[key]; ok { + // Found an exact name match. + f = &fields.list[i] + } else { + // Fall back to the expensive case-insensitive + // linear search. + key := []byte(key) + for i := range fields.list { + ff := &fields.list[i] + if ff.equalFold(ff.nameBytes, key) { + f = ff + break + } + } + } + + if f == nil { + continue + } + + // Figure out field corresponding to key. + subv := x + for _, i := range f.index { + if subv.Kind() == reflect.Ptr { + if subv.IsNil() { + // If a struct embeds a pointer to an unexported type, + // it is not possible to set a newly allocated value + // since the field is unexported. + // + // See https://golang.org/issue/21357 + if !subv.CanSet() { + d.addErr(errors.Newf(v.Pos(), + "cannot set embedded pointer to unexported struct: %v", + subv.Type().Elem())) + subv = reflect.Value{} + break + } + subv.Set(reflect.New(subv.Type().Elem())) + } + subv = subv.Elem() + } + subv = subv.Field(i) + } + + // TODO: make this an option + // else if d.disallowUnknownFields { + // d.saveError(fmt.Errorf("json: unknown field %q", key)) + // } + + d.decode(subv, iter.Value(), false) + } +} + +type structFields struct { + list []goField + nameIndex map[string]int +} + +func isValidTag(s string) bool { + if s == "" { + return false + } + for _, c := range s { + switch { + case strings.ContainsRune("!#$%&()*+-./:;<=>?@[]^_{|}~ ", c): + // Backslash and quote chars are reserved, but + // otherwise any punctuation chars are allowed + // in a tag name. + case !unicode.IsLetter(c) && !unicode.IsDigit(c): + return false + } + } + return true +} + +// A field represents a single Go field found in a struct. +type goField struct { + name string + nameBytes []byte // []byte(name) + equalFold func(s, t []byte) bool // bytes.EqualFold or equivalent + + nameNonEsc string // `"` + name + `":` + nameEscHTML string // `"` + HTMLEscape(name) + `":` + + tag bool + index []int + typ reflect.Type + omitEmpty bool +} + +// byIndex sorts goField by index sequence. +type byIndex []goField + +func (x byIndex) Len() int { return len(x) } + +func (x byIndex) Swap(i, j int) { x[i], x[j] = x[j], x[i] } + +func (x byIndex) Less(i, j int) bool { + for k, xik := range x[i].index { + if k >= len(x[j].index) { + return false + } + if xik != x[j].index[k] { + return xik < x[j].index[k] + } + } + return len(x[i].index) < len(x[j].index) +} + +// typeFields returns a list of fields that JSON should recognize for the given type. +// The algorithm is breadth-first search over the set of structs to include - the top struct +// and then any reachable anonymous structs. +func typeFields(t reflect.Type) structFields { + // Anonymous fields to explore at the current level and the next. + current := []goField{} + next := []goField{{typ: t}} + + // Count of queued names for current level and the next. + var count, nextCount map[reflect.Type]int + + // Types already visited at an earlier level. + visited := map[reflect.Type]bool{} + + // Fields found. + var fields []goField + + // Buffer to run HTMLEscape on field names. + var nameEscBuf bytes.Buffer + + for len(next) > 0 { + current, next = next, current[:0] + count, nextCount = nextCount, map[reflect.Type]int{} + + for _, f := range current { + if visited[f.typ] { + continue + } + visited[f.typ] = true + + // Scan f.typ for fields to include. + for i := 0; i < f.typ.NumField(); i++ { + sf := f.typ.Field(i) + isUnexported := sf.PkgPath != "" + if sf.Anonymous { + t := sf.Type + if t.Kind() == reflect.Ptr { + t = t.Elem() + } + if isUnexported && t.Kind() != reflect.Struct { + // Ignore embedded fields of unexported non-struct types. + continue + } + // Do not ignore embedded fields of unexported struct types + // since they may have exported fields. + } else if isUnexported { + // Ignore unexported non-embedded fields. + continue + } + tag := sf.Tag.Get("json") + if tag == "-" { + continue + } + name, opts := parseTag(tag) + if !isValidTag(name) { + name = "" + } + index := make([]int, len(f.index)+1) + copy(index, f.index) + index[len(f.index)] = i + + ft := sf.Type + if ft.Name() == "" && ft.Kind() == reflect.Ptr { + // Follow pointer. + ft = ft.Elem() + } + + // Record found field and index sequence. + if name != "" || !sf.Anonymous || ft.Kind() != reflect.Struct { + tagged := name != "" + if name == "" { + name = sf.Name + } + field := goField{ + name: name, + tag: tagged, + index: index, + typ: ft, + omitEmpty: opts.Contains("omitempty"), + } + field.nameBytes = []byte(field.name) + field.equalFold = foldFunc(field.nameBytes) + + // Build nameEscHTML and nameNonEsc ahead of time. + nameEscBuf.Reset() + nameEscBuf.WriteString(`"`) + json.HTMLEscape(&nameEscBuf, field.nameBytes) + nameEscBuf.WriteString(`":`) + field.nameEscHTML = nameEscBuf.String() + field.nameNonEsc = `"` + field.name + `":` + + fields = append(fields, field) + if count[f.typ] > 1 { + // If there were multiple instances, add a second, + // so that the annihilation code will see a duplicate. + // It only cares about the distinction between 1 or 2, + // so don't bother generating any more copies. + fields = append(fields, fields[len(fields)-1]) + } + continue + } + + // Record new anonymous struct to explore in next round. + nextCount[ft]++ + if nextCount[ft] == 1 { + next = append(next, goField{name: ft.Name(), index: index, typ: ft}) + } + } + } + } + + sort.Slice(fields, func(i, j int) bool { + x := fields + // sort field by name, breaking ties with depth, then + // breaking ties with "name came from json tag", then + // breaking ties with index sequence. + if x[i].name != x[j].name { + return x[i].name < x[j].name + } + if len(x[i].index) != len(x[j].index) { + return len(x[i].index) < len(x[j].index) + } + if x[i].tag != x[j].tag { + return x[i].tag + } + return byIndex(x).Less(i, j) + }) + + // Delete all fields that are hidden by the Go rules for embedded fields, + // except that fields with JSON tags are promoted. + + // The fields are sorted in primary order of name, secondary order + // of field index length. Loop over names; for each name, delete + // hidden fields by choosing the one dominant field that survives. + out := fields[:0] + for advance, i := 0, 0; i < len(fields); i += advance { + // One iteration per name. + // Find the sequence of fields with the name of this first field. + fi := fields[i] + name := fi.name + for advance = 1; i+advance < len(fields); advance++ { + fj := fields[i+advance] + if fj.name != name { + break + } + } + if advance == 1 { // Only one field with this name + out = append(out, fi) + continue + } + dominant, ok := dominantField(fields[i : i+advance]) + if ok { + out = append(out, dominant) + } + } + + fields = out + sort.Sort(byIndex(fields)) + + nameIndex := make(map[string]int, len(fields)) + for i, field := range fields { + nameIndex[field.name] = i + } + return structFields{fields, nameIndex} +} + +// dominantField looks through the fields, all of which are known to +// have the same name, to find the single field that dominates the +// others using Go's embedding rules, modified by the presence of +// JSON tags. If there are multiple top-level fields, the boolean +// will be false: This condition is an error in Go and we skip all +// the fields. +func dominantField(fields []goField) (goField, bool) { + // The fields are sorted in increasing index-length order, then by presence of tag. + // That means that the first field is the dominant one. We need only check + // for error cases: two fields at top level, either both tagged or neither tagged. + if len(fields) > 1 && len(fields[0].index) == len(fields[1].index) && fields[0].tag == fields[1].tag { + return goField{}, false + } + return fields[0], true +} + +var fieldCache sync.Map // map[reflect.Type]structFields + +// cachedTypeFields is like typeFields but uses a cache to avoid repeated work. +func cachedTypeFields(t reflect.Type) structFields { + if f, ok := fieldCache.Load(t); ok { + return f.(structFields) + } + f, _ := fieldCache.LoadOrStore(t, typeFields(t)) + return f.(structFields) +} + +// tagOptions is the string following a comma in a struct field's "json" +// tag, or the empty string. It does not include the leading comma. +type tagOptions string + +// parseTag splits a struct field's json tag into its name and +// comma-separated options. +func parseTag(tag string) (string, tagOptions) { + if idx := strings.Index(tag, ","); idx != -1 { + return tag[:idx], tagOptions(tag[idx+1:]) + } + return tag, tagOptions("") +} + +// Contains reports whether a comma-separated list of options +// contains a particular substr flag. substr must be surrounded by a +// string boundary or commas. +func (o tagOptions) Contains(optionName string) bool { + if len(o) == 0 { + return false + } + s := string(o) + for s != "" { + var next string + i := strings.Index(s, ",") + if i >= 0 { + s, next = s[:i], s[i+1:] + } + if s == optionName { + return true + } + s = next + } + return false +} + +// foldFunc returns one of four different case folding equivalence +// functions, from most general (and slow) to fastest: +// +// 1) bytes.EqualFold, if the key s contains any non-ASCII UTF-8 +// 2) equalFoldRight, if s contains special folding ASCII ('k', 'K', 's', 'S') +// 3) asciiEqualFold, no special, but includes non-letters (including _) +// 4) simpleLetterEqualFold, no specials, no non-letters. +// +// The letters S and K are special because they map to 3 runes, not just 2: +// * S maps to s and to U+017F 'ſ' Latin small letter long s +// * k maps to K and to U+212A 'K' Kelvin sign +// See https://play.golang.org/p/tTxjOc0OGo +// +// The returned function is specialized for matching against s and +// should only be given s. It's not curried for performance reasons. +func foldFunc(s []byte) func(s, t []byte) bool { + nonLetter := false + special := false // special letter + for _, b := range s { + if b >= utf8.RuneSelf { + return bytes.EqualFold + } + upper := b & caseMask + if upper < 'A' || upper > 'Z' { + nonLetter = true + } else if upper == 'K' || upper == 'S' { + // See above for why these letters are special. + special = true + } + } + if special { + return equalFoldRight + } + if nonLetter { + return asciiEqualFold + } + return simpleLetterEqualFold +} + +const ( + caseMask = ^byte(0x20) // Mask to ignore case in ASCII. + kelvin = '\u212a' + smallLongEss = '\u017f' +) + +// equalFoldRight is a specialization of bytes.EqualFold when s is +// known to be all ASCII (including punctuation), but contains an 's', +// 'S', 'k', or 'K', requiring a Unicode fold on the bytes in t. +// See comments on foldFunc. +func equalFoldRight(s, t []byte) bool { + for _, sb := range s { + if len(t) == 0 { + return false + } + tb := t[0] + if tb < utf8.RuneSelf { + if sb != tb { + sbUpper := sb & caseMask + if 'A' <= sbUpper && sbUpper <= 'Z' { + if sbUpper != tb&caseMask { + return false + } + } else { + return false + } + } + t = t[1:] + continue + } + // sb is ASCII and t is not. t must be either kelvin + // sign or long s; sb must be s, S, k, or K. + tr, size := utf8.DecodeRune(t) + switch sb { + case 's', 'S': + if tr != smallLongEss { + return false + } + case 'k', 'K': + if tr != kelvin { + return false + } + default: + return false + } + t = t[size:] + + } + if len(t) > 0 { + return false + } + return true +} + +// asciiEqualFold is a specialization of bytes.EqualFold for use when +// s is all ASCII (but may contain non-letters) and contains no +// special-folding letters. +// See comments on foldFunc. +func asciiEqualFold(s, t []byte) bool { + if len(s) != len(t) { + return false + } + for i, sb := range s { + tb := t[i] + if sb == tb { + continue + } + if ('a' <= sb && sb <= 'z') || ('A' <= sb && sb <= 'Z') { + if sb&caseMask != tb&caseMask { + return false + } + } else { + return false + } + } + return true +} + +// simpleLetterEqualFold is a specialization of bytes.EqualFold for +// use when s is all ASCII letters (no underscores, etc) and also +// doesn't contain 'k', 'K', 's', or 'S'. +// See comments on foldFunc. +func simpleLetterEqualFold(s, t []byte) bool { + if len(s) != len(t) { + return false + } + for i, b := range s { + if b&caseMask != t[i]&caseMask { + return false + } + } + return true +} + +// indirect walks down v allocating pointers as needed, +// until it gets to a non-pointer. +// If it encounters an Unmarshaler, indirect stops and returns that. +// If decodingNull is true, indirect stops at the first settable pointer so it +// can be set to nil. +func indirect(v reflect.Value, decodingNull bool) (json.Unmarshaler, encoding.TextUnmarshaler, reflect.Value) { + // Issue #24153 indicates that it is generally not a guaranteed property + // that you may round-trip a reflect.Value by calling Value.Addr().Elem() + // and expect the value to still be settable for values derived from + // unexported embedded struct fields. + // + // The logic below effectively does this when it first addresses the value + // (to satisfy possible pointer methods) and continues to dereference + // subsequent pointers as necessary. + // + // After the first round-trip, we set v back to the original value to + // preserve the original RW flags contained in reflect.Value. + v0 := v + haveAddr := false + + // If v is a named type and is addressable, + // start with its address, so that if the type has pointer methods, + // we find them. + if v.Kind() != reflect.Ptr && v.Type().Name() != "" && v.CanAddr() { + haveAddr = true + v = v.Addr() + } + for { + // Load value from interface, but only if the result will be + // usefully addressable. + if v.Kind() == reflect.Interface && !v.IsNil() { + e := v.Elem() + if e.Kind() == reflect.Ptr && !e.IsNil() && (!decodingNull || e.Elem().Kind() == reflect.Ptr) { + haveAddr = false + v = e + continue + } + } + + if v.Kind() != reflect.Ptr { + break + } + + if decodingNull && v.CanSet() { + break + } + + // Prevent infinite loop if v is an interface pointing to its own address: + // var v interface{} + // v = &v + if v.Elem().Kind() == reflect.Interface && v.Elem().Elem() == v { + v = v.Elem() + break + } + if v.IsNil() { + v.Set(reflect.New(v.Type().Elem())) + } + if v.Type().NumMethod() > 0 && v.CanInterface() { + if u, ok := v.Interface().(json.Unmarshaler); ok { + return u, nil, reflect.Value{} + } + if !decodingNull { + if u, ok := v.Interface().(encoding.TextUnmarshaler); ok { + return nil, u, reflect.Value{} + } + } + } + + if haveAddr { + v = v0 // restore original value after round-trip Value.Addr().Elem() + haveAddr = false + } else { + v = v.Elem() + } + } + return nil, nil, v +} diff --git a/vendor/cuelang.org/go/cue/errors.go b/vendor/cuelang.org/go/cue/errors.go new file mode 100644 index 0000000000..d079b970ac --- /dev/null +++ b/vendor/cuelang.org/go/cue/errors.go @@ -0,0 +1,134 @@ +// Copyright 2018 The CUE Authors +// +// 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 cue + +import ( + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/token" + "cuelang.org/go/internal/core/adt" + "cuelang.org/go/internal/core/runtime" +) + +func (v Value) toErr(b *adt.Bottom) (err errors.Error) { + errs := errors.Errors(b.Err) + if len(errs) > 1 { + for _, e := range errs { + bb := *b + bb.Err = e + err = errors.Append(err, &valueError{v: v, err: &bb}) + } + return err + } + return &valueError{v: v, err: b} +} + +var _ errors.Error = &valueError{} + +// A valueError is returned as a result of evaluating a value. +type valueError struct { + v Value + err *adt.Bottom +} + +func (e *valueError) Unwrap() error { + if e.err.Err == nil { + return nil + } + return errors.Unwrap(e.err.Err) +} + +func (e *valueError) Bottom() *adt.Bottom { return e.err } + +func (e *valueError) Error() string { + return errors.String(e) +} + +func (e *valueError) Position() token.Pos { + if e.err.Err != nil { + return e.err.Err.Position() + } + src := e.err.Source() + if src == nil { + return token.NoPos + } + return src.Pos() +} + +func (e *valueError) InputPositions() []token.Pos { + if e.err.Err == nil { + return nil + } + return e.err.Err.InputPositions() +} + +func (e *valueError) Msg() (string, []interface{}) { + if e.err.Err == nil { + return "", nil + } + return e.err.Err.Msg() +} + +func (e *valueError) Path() (a []string) { + if e.err.Err != nil { + a = e.err.Err.Path() + if a != nil { + return a + } + } + return pathToStrings(e.v.Path()) +} + +var errNotExists = &adt.Bottom{ + Code: adt.IncompleteError, + NotExists: true, + Err: errors.Newf(token.NoPos, "undefined value"), +} + +func mkErr(idx *runtime.Runtime, src adt.Node, args ...interface{}) *adt.Bottom { + var e *adt.Bottom + var code adt.ErrorCode = -1 +outer: + for i, a := range args { + switch x := a.(type) { + case adt.ErrorCode: + code = x + case *adt.Bottom: + e = adt.CombineErrors(nil, e, x) + case []*adt.Bottom: + for _, b := range x { + e = adt.CombineErrors(nil, e, b) + } + case errors.Error: + e = adt.CombineErrors(nil, e, &adt.Bottom{Err: x}) + case adt.Expr: + case string: + args := args[i+1:] + // Do not expand message so that errors can be localized. + pos := pos(src) + if code < 0 { + code = 0 + } + e = adt.CombineErrors(nil, e, &adt.Bottom{ + Code: code, + Err: errors.Newf(pos, x, args...), + }) + break outer + } + } + if code >= 0 { + e.Code = code + } + return e +} diff --git a/vendor/cuelang.org/go/cue/errors/errors.go b/vendor/cuelang.org/go/cue/errors/errors.go new file mode 100644 index 0000000000..af5038c22b --- /dev/null +++ b/vendor/cuelang.org/go/cue/errors/errors.go @@ -0,0 +1,651 @@ +// Copyright 2018 The CUE Authors +// +// 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 errors defines shared types for handling CUE errors. +// +// The pivotal error type in CUE packages is the interface type Error. +// The information available in such errors can be most easily retrieved using +// the Path, Positions, and Print functions. +package errors // import "cuelang.org/go/cue/errors" + +import ( + "bytes" + "errors" + "fmt" + "io" + "path/filepath" + "sort" + "strings" + + "github.com/mpvl/unique" + + "cuelang.org/go/cue/token" +) + +// New is a convenience wrapper for errors.New in the core library. +// It does not return a CUE error. +func New(msg string) error { + return errors.New(msg) +} + +// Unwrap returns the result of calling the Unwrap method on err, if err +// implements Unwrap. Otherwise, Unwrap returns nil. +func Unwrap(err error) error { + return errors.Unwrap(err) +} + +// Is reports whether any error in err's chain matches target. +// +// An error is considered to match a target if it is equal to that target or if +// it implements a method Is(error) bool such that Is(target) returns true. +func Is(err, target error) bool { + return errors.Is(err, target) +} + +// As finds the first error in err's chain that matches the type to which target +// points, and if so, sets the target to its value and returns true. An error +// matches a type if it is assignable to the target type, or if it has a method +// As(interface{}) bool such that As(target) returns true. As will panic if +// target is not a non-nil pointer to a type which implements error or is of +// interface type. +// +// The As method should set the target to its value and return true if err +// matches the type to which target points. +func As(err error, target interface{}) bool { + return errors.As(err, target) +} + +// A Message implements the error interface as well as Message to allow +// internationalized messages. A Message is typically used as an embedding +// in a CUE message. +type Message struct { + format string + args []interface{} +} + +// NewMessage creates an error message for human consumption. The arguments +// are for later consumption, allowing the message to be localized at a later +// time. The passed argument list should not be modified. +func NewMessage(format string, args []interface{}) Message { + return Message{format: format, args: args} +} + +// Msg returns a printf-style format string and its arguments for human +// consumption. +func (m *Message) Msg() (format string, args []interface{}) { + return m.format, m.args +} + +func (m *Message) Error() string { + return fmt.Sprintf(m.format, m.args...) +} + +// Error is the common error message. +type Error interface { + // Position returns the primary position of an error. If multiple positions + // contribute equally, this reflects one of them. + Position() token.Pos + + // InputPositions reports positions that contributed to an error, including + // the expressions resulting in the conflict, as well as values that were + // the input to this expression. + InputPositions() []token.Pos + + // Error reports the error message without position information. + Error() string + + // Path returns the path into the data tree where the error occurred. + // This path may be nil if the error is not associated with such a location. + Path() []string + + // Msg returns the unformatted error message and its arguments for human + // consumption. + Msg() (format string, args []interface{}) +} + +// Positions returns all positions returned by an error, sorted +// by relevance when possible and with duplicates removed. +func Positions(err error) []token.Pos { + e := Error(nil) + if !errors.As(err, &e) { + return nil + } + + a := make([]token.Pos, 0, 3) + + sortOffset := 0 + pos := e.Position() + if pos.IsValid() { + a = append(a, pos) + sortOffset = 1 + } + + for _, p := range e.InputPositions() { + if p.IsValid() && p != pos { + a = append(a, p) + } + } + + byPos := byPos(a[sortOffset:]) + sort.Sort(byPos) + k := unique.ToFront(byPos) + return a[:k+sortOffset] +} + +type byPos []token.Pos + +func (s *byPos) Truncate(n int) { (*s) = (*s)[:n] } +func (s byPos) Len() int { return len(s) } +func (s byPos) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s byPos) Less(i, j int) bool { return comparePos(s[i], s[j]) == -1 } + +// Path returns the path of an Error if err is of that type. +func Path(err error) []string { + if e := Error(nil); errors.As(err, &e) { + return e.Path() + } + return nil +} + +// Newf creates an Error with the associated position and message. +func Newf(p token.Pos, format string, args ...interface{}) Error { + return &posError{ + pos: p, + Message: NewMessage(format, args), + } +} + +// Wrapf creates an Error with the associated position and message. The provided +// error is added for inspection context. +func Wrapf(err error, p token.Pos, format string, args ...interface{}) Error { + pErr := &posError{ + pos: p, + Message: NewMessage(format, args), + } + return Wrap(pErr, err) +} + +// Wrap creates a new error where child is a subordinate error of parent. +// If child is list of Errors, the result will itself be a list of errors +// where child is a subordinate error of each parent. +func Wrap(parent Error, child error) Error { + if child == nil { + return parent + } + a, ok := child.(list) + if !ok { + return &wrapped{parent, child} + } + b := make(list, len(a)) + for i, err := range a { + b[i] = &wrapped{parent, err} + } + return b +} + +type wrapped struct { + main Error + wrap error +} + +// Error implements the error interface. +func (e *wrapped) Error() string { + switch msg := e.main.Error(); { + case e.wrap == nil: + return msg + case msg == "": + return e.wrap.Error() + default: + return fmt.Sprintf("%s: %s", msg, e.wrap) + } +} + +func (e *wrapped) Is(target error) bool { + return Is(e.main, target) +} + +func (e *wrapped) As(target interface{}) bool { + return As(e.main, target) +} + +func (e *wrapped) Msg() (format string, args []interface{}) { + return e.main.Msg() +} + +func (e *wrapped) Path() []string { + if p := Path(e.main); p != nil { + return p + } + return Path(e.wrap) +} + +func (e *wrapped) InputPositions() []token.Pos { + return append(e.main.InputPositions(), Positions(e.wrap)...) +} + +func (e *wrapped) Position() token.Pos { + if p := e.main.Position(); p != token.NoPos { + return p + } + if wrap, ok := e.wrap.(Error); ok { + return wrap.Position() + } + return token.NoPos +} + +func (e *wrapped) Unwrap() error { return e.wrap } + +func (e *wrapped) Cause() error { return e.wrap } + +// Promote converts a regular Go error to an Error if it isn't already one. +func Promote(err error, msg string) Error { + switch x := err.(type) { + case Error: + return x + default: + return Wrapf(err, token.NoPos, msg) + } +} + +var _ Error = &posError{} + +// In an List, an error is represented by an *posError. +// The position Pos, if valid, points to the beginning of +// the offending token, and the error condition is described +// by Msg. +type posError struct { + pos token.Pos + inputs []token.Pos + Message +} + +func (e *posError) Path() []string { return nil } +func (e *posError) InputPositions() []token.Pos { return e.inputs } +func (e *posError) Position() token.Pos { return e.pos } + +// Append combines two errors, flattening Lists as necessary. +func Append(a, b Error) Error { + switch x := a.(type) { + case nil: + return b + case list: + return appendToList(x, b) + } + // Preserve order of errors. + list := appendToList(nil, a) + list = appendToList(list, b) + return list +} + +// Errors reports the individual errors associated with an error, which is +// the error itself if there is only one or, if the underlying type is List, +// its individual elements. If the given error is not an Error, it will be +// promoted to one. +func Errors(err error) []Error { + switch x := err.(type) { + case nil: + return nil + case list: + return []Error(x) + case Error: + return []Error{x} + default: + return []Error{Promote(err, "")} + } +} + +func appendToList(a list, err Error) list { + switch x := err.(type) { + case nil: + return a + case list: + if a == nil { + return x + } + return append(a, x...) + default: + return append(a, err) + } +} + +// list is a list of Errors. +// The zero value for an list is an empty list ready to use. +type list []Error + +func (p list) Is(err, target error) bool { + for _, e := range p { + if errors.Is(e, target) { + return true + } + } + return false +} + +func (p list) As(err error, target interface{}) bool { + for _, e := range p { + if errors.As(e, target) { + return true + } + } + return false +} + +// AddNewf adds an Error with given position and error message to an List. +func (p *list) AddNewf(pos token.Pos, msg string, args ...interface{}) { + err := &posError{pos: pos, Message: Message{format: msg, args: args}} + *p = append(*p, err) +} + +// Add adds an Error with given position and error message to an List. +func (p *list) Add(err Error) { + *p = appendToList(*p, err) +} + +// Reset resets an List to no errors. +func (p *list) Reset() { *p = (*p)[:0] } + +// List implements the sort Interface. +func (p list) Len() int { return len(p) } +func (p list) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +func (p list) Less(i, j int) bool { + if c := comparePos(p[i].Position(), p[j].Position()); c != 0 { + return c == -1 + } + // Note that it is not sufficient to simply compare file offsets because + // the offsets do not reflect modified line information (through //line + // comments). + + if !equalPath(p[i].Path(), p[j].Path()) { + return lessPath(p[i].Path(), p[j].Path()) + } + return p[i].Error() < p[j].Error() +} + +func lessOrMore(isLess bool) int { + if isLess { + return -1 + } + return 1 +} + +func comparePos(a, b token.Pos) int { + if a.Filename() != b.Filename() { + return lessOrMore(a.Filename() < b.Filename()) + } + if a.Line() != b.Line() { + return lessOrMore(a.Line() < b.Line()) + } + if a.Column() != b.Column() { + return lessOrMore(a.Column() < b.Column()) + } + return 0 +} + +func lessPath(a, b []string) bool { + for i, x := range a { + if i >= len(b) { + return false + } + if x != b[i] { + return x < b[i] + } + } + return len(a) < len(b) +} + +func equalPath(a, b []string) bool { + if len(a) != len(b) { + return false + } + for i, x := range a { + if x != b[i] { + return false + } + } + return true +} + +// Sanitize sorts multiple errors and removes duplicates on a best effort basis. +// If err represents a single or no error, it returns the error as is. +func Sanitize(err Error) Error { + if l, ok := err.(list); ok && err != nil { + a := make(list, len(l)) + copy(a, l) + a.Sort() + a.RemoveMultiples() + return a + } + return err +} + +// Sort sorts an List. *posError entries are sorted by position, +// other errors are sorted by error message, and before any *posError +// entry. +// +func (p list) Sort() { + sort.Sort(p) +} + +// RemoveMultiples sorts an List and removes all but the first error per line. +func (p *list) RemoveMultiples() { + p.Sort() + var last Error + i := 0 + for _, e := range *p { + if last == nil || !approximateEqual(last, e) { + last = e + (*p)[i] = e + i++ + } + } + (*p) = (*p)[0:i] +} + +func approximateEqual(a, b Error) bool { + aPos := a.Position() + bPos := b.Position() + if aPos == token.NoPos || bPos == token.NoPos { + return a.Error() == b.Error() + } + return aPos.Filename() == bPos.Filename() && + aPos.Line() == bPos.Line() && + equalPath(a.Path(), b.Path()) +} + +// An List implements the error interface. +func (p list) Error() string { + format, args := p.Msg() + return fmt.Sprintf(format, args...) +} + +// Msg reports the unformatted error message for the first error, if any. +func (p list) Msg() (format string, args []interface{}) { + switch len(p) { + case 0: + return "no errors", nil + case 1: + return p[0].Msg() + } + return "%s (and %d more errors)", []interface{}{p[0], len(p) - 1} +} + +// Position reports the primary position for the first error, if any. +func (p list) Position() token.Pos { + if len(p) == 0 { + return token.NoPos + } + return p[0].Position() +} + +// InputPositions reports the input positions for the first error, if any. +func (p list) InputPositions() []token.Pos { + if len(p) == 0 { + return nil + } + return p[0].InputPositions() +} + +// Path reports the path location of the first error, if any. +func (p list) Path() []string { + if len(p) == 0 { + return nil + } + return p[0].Path() +} + +// Err returns an error equivalent to this error list. +// If the list is empty, Err returns nil. +func (p list) Err() error { + if len(p) == 0 { + return nil + } + return p +} + +// A Config defines parameters for printing. +type Config struct { + // Format formats the given string and arguments and writes it to w. + // It is used for all printing. + Format func(w io.Writer, format string, args ...interface{}) + + // Cwd is the current working directory. Filename positions are taken + // relative to this path. + Cwd string + + // ToSlash sets whether to use Unix paths. Mostly used for testing. + ToSlash bool +} + +// Print is a utility function that prints a list of errors to w, +// one error per line, if the err parameter is an List. Otherwise +// it prints the err string. +// +func Print(w io.Writer, err error, cfg *Config) { + if cfg == nil { + cfg = &Config{} + } + if e, ok := err.(Error); ok { + err = Sanitize(e) + } + for _, e := range Errors(err) { + printError(w, e, cfg) + } +} + +// Details is a convenience wrapper for Print to return the error text as a +// string. +func Details(err error, cfg *Config) string { + w := &bytes.Buffer{} + Print(w, err, cfg) + return w.String() +} + +// String generates a short message from a given Error. +func String(err Error) string { + w := &strings.Builder{} + writeErr(w, err) + return w.String() +} + +func writeErr(w io.Writer, err Error) { + if path := strings.Join(err.Path(), "."); path != "" { + _, _ = io.WriteString(w, path) + _, _ = io.WriteString(w, ": ") + } + + for { + u := errors.Unwrap(err) + + printed := false + msg, args := err.Msg() + if msg != "" || u == nil { // print at least something + fmt.Fprintf(w, msg, args...) + printed = true + } + + if u == nil { + break + } + + if printed { + _, _ = io.WriteString(w, ": ") + } + err, _ = u.(Error) + if err == nil { + fmt.Fprint(w, u) + break + } + } +} + +func defaultFprintf(w io.Writer, format string, args ...interface{}) { + fmt.Fprintf(w, format, args...) +} + +func printError(w io.Writer, err error, cfg *Config) { + if err == nil { + return + } + fprintf := cfg.Format + if fprintf == nil { + fprintf = defaultFprintf + } + + positions := []string{} + for _, p := range Positions(err) { + pos := p.Position() + s := pos.Filename + if cfg.Cwd != "" { + if p, err := filepath.Rel(cfg.Cwd, s); err == nil { + s = p + // Some IDEs (e.g. VSCode) only recognize a path if it start + // with a dot. This also helps to distinguish between local + // files and builtin packages. + if !strings.HasPrefix(s, ".") { + s = fmt.Sprintf(".%s%s", string(filepath.Separator), s) + } + } + } + if cfg.ToSlash { + s = filepath.ToSlash(s) + } + if pos.IsValid() { + if s != "" { + s += ":" + } + s += fmt.Sprintf("%d:%d", pos.Line, pos.Column) + } + if s == "" { + s = "-" + } + positions = append(positions, s) + } + + if e, ok := err.(Error); ok { + writeErr(w, e) + } else { + fprintf(w, "%v", err) + } + + if len(positions) == 0 { + fprintf(w, "\n") + return + } + + fprintf(w, ":\n") + for _, pos := range positions { + fprintf(w, " %s\n", pos) + } +} diff --git a/vendor/cuelang.org/go/cue/format.go b/vendor/cuelang.org/go/cue/format.go new file mode 100644 index 0000000000..707a7990ef --- /dev/null +++ b/vendor/cuelang.org/go/cue/format.go @@ -0,0 +1,201 @@ +// Copyright 2021 CUE Authors +// +// 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 cue + +import ( + "bytes" + "fmt" + "math/big" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/format" + "cuelang.org/go/internal/core/export" +) + +// TODO: +// * allow '-' to strip outer curly braces? +// - simplify output; can be used in combination with other flags +// * advertise: +// c like v, but print comments +// a like c, but print attributes and package-local hidden fields as well + +// Format prints a CUE value. +// +// WARNING: +// although we are narrowing down the semantics, the verbs and options +// are still subject to change. this API is experimental although it is +// likely getting close to the final design. +// +// It recognizes the following verbs: +// +// v print CUE value +// +// The verbs support the following flags: +// # print as schema and include definitions. +// The result is printed as a self-contained file, instead of an the +// expression format. +// + evaluate: resolve defaults and error on incomplete errors +// +// Indentation can be controlled as follows: +// width indent the cue block by tab stops (e.g. %2v) +// precision convert tabs to spaces (e.g. %.2v), where +// a value of 0 means no indentation or newlines (TODO). +// +// If the value kind corresponds to one of the following Go types, the +// usual Go formatting verbs for that type can be used: +// +// Int: b,d,o,O,q,x,X +// Float: f,e,E,g,G +// String/Bytes: s,q,x,X +// +// The %v directive will be used if the type is not supported for that verb. +// +func (v Value) Format(state fmt.State, verb rune) { + if v.v == nil { + fmt.Fprint(state, "") + return + } + + switch verb { + case 'a': + formatCUE(state, v, true, true) + case 'c': + formatCUE(state, v, true, false) + case 'v': + formatCUE(state, v, false, false) + + case 'd', 'o', 'O', 'U': + var i big.Int + if _, err := v.Int(&i); err != nil { + formatCUE(state, v, false, false) + return + } + i.Format(state, verb) + + case 'f', 'e', 'E', 'g', 'G': + d, err := v.Decimal() + if err != nil { + formatCUE(state, v, false, false) + return + } + d.Format(state, verb) + + case 's', 'q': + // TODO: this drops other formatting directives + msg := "%s" + if verb == 'q' { + msg = "%q" + } + + if b, err := v.Bytes(); err == nil { + fmt.Fprintf(state, msg, b) + } else { + s := fmt.Sprintf("%+v", v) + fmt.Fprintf(state, msg, s) + } + + case 'x', 'X': + switch v.Kind() { + case StringKind, BytesKind: + b, _ := v.Bytes() + // TODO: this drops other formatting directives + msg := "%x" + if verb == 'X' { + msg = "%X" + } + fmt.Fprintf(state, msg, b) + + case IntKind, NumberKind: + var i big.Int + _, _ = v.Int(&i) + i.Format(state, verb) + + case FloatKind: + dec, _ := v.Decimal() + dec.Format(state, verb) + + default: + formatCUE(state, v, false, false) + } + + default: + formatCUE(state, v, false, false) + } +} + +func formatCUE(state fmt.State, v Value, showDocs, showAll bool) { + + pkgPath := v.instance().ID() + + p := *export.Simplified + + isDef := false + switch { + case state.Flag('#'): + isDef = true + p = export.Profile{ + ShowOptional: true, + ShowDefinitions: true, + ShowHidden: true, + } + + case state.Flag('+'): + p = *export.Final + fallthrough + + default: + p.ShowHidden = showAll + } + + p.ShowDocs = showDocs + p.ShowAttributes = showAll + + var n ast.Node + if isDef { + n, _ = p.Def(v.idx, pkgPath, v.v) + } else { + n, _ = p.Value(v.idx, pkgPath, v.v) + } + + formatExpr(state, n) +} + +func formatExpr(state fmt.State, n ast.Node) { + opts := make([]format.Option, 0, 3) + if state.Flag('-') { + opts = append(opts, format.Simplify()) + } + // TODO: handle verbs to allow formatting based on type: + if width, ok := state.Width(); ok { + opts = append(opts, format.IndentPrefix(width)) + } + // TODO: consider this: should tabs or spaces be the default? + if tabwidth, ok := state.Precision(); ok { + // TODO: 0 means no newlines. + opts = append(opts, + format.UseSpaces(tabwidth), + format.TabIndent(false)) + } + // TODO: consider this. + // else if state.Flag(' ') { + // opts = append(opts, + // format.UseSpaces(4), + // format.TabIndent(false)) + // } + + b, _ := format.Node(n, opts...) + b = bytes.Trim(b, "\n\r") + _, _ = state.Write(b) +} diff --git a/vendor/cuelang.org/go/cue/format/format.go b/vendor/cuelang.org/go/cue/format/format.go new file mode 100644 index 0000000000..5e81eb3591 --- /dev/null +++ b/vendor/cuelang.org/go/cue/format/format.go @@ -0,0 +1,350 @@ +// Copyright 2018 The CUE Authors +// +// 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 format implements standard formatting of CUE configurations. +package format // import "cuelang.org/go/cue/format" + +// TODO: this package is in need of a rewrite. When doing so, the API should +// allow for reformatting an AST, without actually writing bytes. +// +// In essence, formatting determines the relative spacing to tokens. It should +// be possible to have an abstract implementation providing such information +// that can be used to either format or update an AST in a single walk. + +import ( + "bytes" + "fmt" + "strings" + "text/tabwriter" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/parser" + "cuelang.org/go/cue/token" +) + +// An Option sets behavior of the formatter. +type Option func(c *config) + +// Simplify allows the formatter to simplify output, such as removing +// unnecessary quotes. +func Simplify() Option { + return func(c *config) { c.simplify = true } +} + +// UseSpaces specifies that tabs should be converted to spaces and sets the +// default tab width. +func UseSpaces(tabwidth int) Option { + return func(c *config) { + c.UseSpaces = true + c.Tabwidth = tabwidth + } +} + +// TabIndent specifies whether to use tabs for indentation independent of +// UseSpaces. +func TabIndent(indent bool) Option { + return func(c *config) { c.TabIndent = indent } +} + +// IndentPrefix specifies the number of tabstops to use as a prefix for every +// line. +func IndentPrefix(n int) Option { + return func(c *config) { c.Indent = n } +} + +// TODO: make public +// sortImportsOption causes import declarations to be sorted. +func sortImportsOption() Option { + return func(c *config) { c.sortImports = true } +} + +// TODO: other options: +// +// const ( +// RawFormat Mode = 1 << iota // do not use a tabwriter; if set, UseSpaces is ignored +// TabIndent // use tabs for indentation independent of UseSpaces +// UseSpaces // use spaces instead of tabs for alignment +// SourcePos // emit //line comments to preserve original source positions +// ) + +// Node formats node in canonical cue fmt style and writes the result to dst. +// +// The node type must be *ast.File, []syntax.Decl, syntax.Expr, syntax.Decl, or +// syntax.Spec. Node does not modify node. Imports are not sorted for nodes +// representing partial source files (for instance, if the node is not an +// *ast.File). +// +// The function may return early (before the entire result is written) and +// return a formatting error, for instance due to an incorrect AST. +// +func Node(node ast.Node, opt ...Option) ([]byte, error) { + cfg := newConfig(opt) + return cfg.fprint(node) +} + +// Source formats src in canonical cue fmt style and returns the result or an +// (I/O or syntax) error. src is expected to be a syntactically correct CUE +// source file, or a list of CUE declarations or statements. +// +// If src is a partial source file, the leading and trailing space of src is +// applied to the result (such that it has the same leading and trailing space +// as src), and the result is indented by the same amount as the first line of +// src containing code. Imports are not sorted for partial source files. +// +// Caution: Tools relying on consistent formatting based on the installed +// version of cue (for instance, such as for presubmit checks) should execute +// that cue binary instead of calling Source. +// +func Source(b []byte, opt ...Option) ([]byte, error) { + cfg := newConfig(opt) + + f, err := parser.ParseFile("", b, parser.ParseComments) + if err != nil { + return nil, fmt.Errorf("parse: %s", err) + } + + // print AST + return cfg.fprint(f) +} + +type config struct { + UseSpaces bool + TabIndent bool + Tabwidth int // default: 4 + Indent int // default: 0 (all code is indented at least by this much) + + simplify bool + sortImports bool +} + +func newConfig(opt []Option) *config { + cfg := &config{ + Tabwidth: 8, + TabIndent: true, + UseSpaces: true, + } + for _, o := range opt { + o(cfg) + } + return cfg +} + +// Config defines the output of Fprint. +func (cfg *config) fprint(node interface{}) (out []byte, err error) { + var p printer + p.init(cfg) + if err = printNode(node, &p); err != nil { + return p.output, err + } + + padchar := byte('\t') + if cfg.UseSpaces { + padchar = byte(' ') + } + + twmode := tabwriter.StripEscape | tabwriter.TabIndent | tabwriter.DiscardEmptyColumns + if cfg.TabIndent { + twmode |= tabwriter.TabIndent + } + + buf := &bytes.Buffer{} + tw := tabwriter.NewWriter(buf, 0, cfg.Tabwidth, 1, padchar, twmode) + + // write printer result via tabwriter/trimmer to output + if _, err = tw.Write(p.output); err != nil { + return + } + + err = tw.Flush() + if err != nil { + return buf.Bytes(), err + } + + b := buf.Bytes() + if !cfg.TabIndent { + b = bytes.ReplaceAll(b, []byte{'\t'}, bytes.Repeat([]byte{' '}, cfg.Tabwidth)) + } + return b, nil +} + +// A formatter walks a syntax.Node, interspersed with comments and spacing +// directives, in the order that they would occur in printed form. +type formatter struct { + *printer + + stack []frame + current frame + nestExpr int +} + +func newFormatter(p *printer) *formatter { + f := &formatter{ + printer: p, + current: frame{ + settings: settings{ + nodeSep: newline, + parentSep: newline, + }, + }, + } + return f +} + +type whiteSpace int + +const ( + ignore whiteSpace = 0 + + // write a space, or disallow it + blank whiteSpace = 1 << iota + vtab // column marker + noblank + + nooverride + + comma // print a comma, unless trailcomma overrides it + trailcomma // print a trailing comma unless closed on same line + declcomma // write a comma when not at the end of line + + newline // write a line in a table + formfeed // next line is not part of the table + newsection // add two newlines + + indent // request indent an extra level after the next newline + unindent // unindent a level after the next newline + indented // element was indented. +) + +type frame struct { + cg []*ast.CommentGroup + pos int8 + + settings +} + +type settings struct { + // separator is blank if the current node spans a single line and newline + // otherwise. + nodeSep whiteSpace + parentSep whiteSpace + override whiteSpace +} + +// suppress spurious linter warning: field is actually used. +func init() { + s := settings{} + _ = s.override +} + +func (f *formatter) print(a ...interface{}) { + for _, x := range a { + f.Print(x) + switch x.(type) { + case string, token.Token: // , *syntax.BasicLit, *syntax.Ident: + f.current.pos++ + } + } + f.visitComments(f.current.pos) +} + +func (f *formatter) formfeed() whiteSpace { + if f.current.nodeSep == blank { + return blank + } + return formfeed +} + +func (f *formatter) wsOverride(def whiteSpace) whiteSpace { + if f.current.override == ignore { + return def + } + return f.current.override +} + +func (f *formatter) onOneLine(node ast.Node) bool { + a := node.Pos() + b := node.End() + if a.IsValid() && b.IsValid() { + return f.lineFor(a) == f.lineFor(b) + } + // TODO: walk and look at relative positions to determine the same? + return false +} + +func (f *formatter) before(node ast.Node) bool { + f.stack = append(f.stack, f.current) + f.current = frame{settings: f.current.settings} + f.current.parentSep = f.current.nodeSep + + if node != nil { + s, ok := node.(*ast.StructLit) + if ok && len(s.Elts) <= 1 && f.current.nodeSep != blank && f.onOneLine(node) { + f.current.nodeSep = blank + } + f.current.cg = node.Comments() + f.visitComments(f.current.pos) + return true + } + return false +} + +func (f *formatter) after(node ast.Node) { + f.visitComments(127) + p := len(f.stack) - 1 + f.current = f.stack[p] + f.stack = f.stack[:p] + f.current.pos++ + f.visitComments(f.current.pos) +} + +func (f *formatter) visitComments(until int8) { + c := &f.current + + printed := false + for ; len(c.cg) > 0 && c.cg[0].Position <= until; c.cg = c.cg[1:] { + if printed { + f.Print(newsection) + } + printed = true + f.printComment(c.cg[0]) + } +} + +func (f *formatter) printComment(cg *ast.CommentGroup) { + f.Print(cg) + + printBlank := false + if cg.Doc && len(f.output) > 0 { + f.Print(newline) + printBlank = true + } + for _, c := range cg.List { + isEnd := strings.HasPrefix(c.Text, "//") + if !printBlank { + if isEnd { + f.Print(vtab) + } else { + f.Print(blank) + } + } + f.Print(c.Slash) + f.Print(c) + if isEnd { + f.Print(newline) + if cg.Doc { + f.Print(nooverride) + } + } + } +} diff --git a/vendor/cuelang.org/go/cue/format/import.go b/vendor/cuelang.org/go/cue/format/import.go new file mode 100644 index 0000000000..873de2c7f6 --- /dev/null +++ b/vendor/cuelang.org/go/cue/format/import.go @@ -0,0 +1,167 @@ +// Copyright 2018 The CUE Authors +// +// 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 format + +import ( + "sort" + "strconv" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/token" +) + +// sortImports sorts runs of consecutive import lines in import blocks in f. +// It also removes duplicate imports when it is possible to do so without data +// loss. +func sortImports(d *ast.ImportDecl) { + if !d.Lparen.IsValid() || len(d.Specs) == 0 { + // Not a block: sorted by default. + return + } + + // Identify and sort runs of specs on successive lines. + i := 0 + specs := d.Specs[:0] + for j, s := range d.Specs { + if j > i && (s.Pos().RelPos() >= token.NewSection || hasDoc(s)) { + setRelativePos(s, token.Newline) + // j begins a new run. End this one. + block := sortSpecs(d.Specs[i:j]) + specs = append(specs, block...) + i = j + } + } + specs = append(specs, sortSpecs(d.Specs[i:])...) + setRelativePos(specs[0], token.Newline) + d.Specs = specs +} + +func setRelativePos(s *ast.ImportSpec, r token.RelPos) { + if hasDoc(s) { + return + } + pos := s.Pos().WithRel(r) + if s.Name != nil { + s.Name.NamePos = pos + } else { + s.Path.ValuePos = pos + } +} + +func hasDoc(s *ast.ImportSpec) bool { + for _, doc := range s.Comments() { + if doc.Doc { + return true + } + } + return false +} + +func importPath(s *ast.ImportSpec) string { + t, err := strconv.Unquote(s.Path.Value) + if err == nil { + return t + } + return "" +} + +func importName(s *ast.ImportSpec) string { + n := s.Name + if n == nil { + return "" + } + return n.Name +} + +func importComment(s *ast.ImportSpec) string { + for _, c := range s.Comments() { + if c.Line { + return c.Text() + } + } + return "" +} + +// collapse indicates whether prev may be removed, leaving only next. +func collapse(prev, next *ast.ImportSpec) bool { + if importPath(next) != importPath(prev) || importName(next) != importName(prev) { + return false + } + for _, c := range prev.Comments() { + if !c.Doc { + return false + } + } + return true +} + +type posSpan struct { + Start token.Pos + End token.Pos +} + +func sortSpecs(specs []*ast.ImportSpec) []*ast.ImportSpec { + // Can't short-circuit here even if specs are already sorted, + // since they might yet need deduplication. + // A lone import, however, may be safely ignored. + if len(specs) <= 1 { + setRelativePos(specs[0], token.NewSection) + return specs + } + + // Record positions for specs. + pos := make([]posSpan, len(specs)) + for i, s := range specs { + pos[i] = posSpan{s.Pos(), s.End()} + } + + // Sort the import specs by import path. + // Remove duplicates, when possible without data loss. + // Reassign the import paths to have the same position sequence. + // Reassign each comment to abut the end of its spec. + // Sort the comments by new position. + sort.Sort(byImportSpec(specs)) + + // Dedup. Thanks to our sorting, we can just consider + // adjacent pairs of imports. + deduped := specs[:0] + for i, s := range specs { + if i == len(specs)-1 || !collapse(s, specs[i+1]) { + deduped = append(deduped, s) + } + } + specs = deduped + + setRelativePos(specs[0], token.NewSection) + return specs +} + +type byImportSpec []*ast.ImportSpec + +func (x byImportSpec) Len() int { return len(x) } +func (x byImportSpec) Swap(i, j int) { x[i], x[j] = x[j], x[i] } +func (x byImportSpec) Less(i, j int) bool { + ipath := importPath(x[i]) + jpath := importPath(x[j]) + if ipath != jpath { + return ipath < jpath + } + iname := importName(x[i]) + jname := importName(x[j]) + if iname != jname { + return iname < jname + } + return importComment(x[i]) < importComment(x[j]) +} diff --git a/vendor/cuelang.org/go/cue/format/node.go b/vendor/cuelang.org/go/cue/format/node.go new file mode 100644 index 0000000000..6d06ae4123 --- /dev/null +++ b/vendor/cuelang.org/go/cue/format/node.go @@ -0,0 +1,916 @@ +// Copyright 2018 The CUE Authors +// +// 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 format + +import ( + "fmt" + "strings" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/literal" + "cuelang.org/go/cue/scanner" + "cuelang.org/go/cue/token" + "cuelang.org/go/internal" +) + +func printNode(node interface{}, f *printer) error { + s := newFormatter(f) + + ls := labelSimplifier{scope: map[string]bool{}} + + // format node + f.allowed = nooverride // gobble initial whitespace. + switch x := node.(type) { + case *ast.File: + if f.cfg.simplify { + ls.markReferences(x) + } + s.file(x) + case ast.Expr: + if f.cfg.simplify { + ls.markReferences(x) + } + s.expr(x) + case ast.Decl: + if f.cfg.simplify { + ls.markReferences(x) + } + s.decl(x) + // case ast.Node: // TODO: do we need this? + // s.walk(x) + case []ast.Decl: + if f.cfg.simplify { + ls.processDecls(x) + } + s.walkDeclList(x) + default: + goto unsupported + } + + return s.errs + +unsupported: + return fmt.Errorf("cue/format: unsupported node type %T", node) +} + +func isRegularField(tok token.Token) bool { + return tok == token.ILLEGAL || tok == token.COLON +} + +// Helper functions for common node lists. They may be empty. + +func nestDepth(f *ast.Field) int { + d := 1 + if s, ok := f.Value.(*ast.StructLit); ok { + switch { + case len(s.Elts) != 1: + d = 0 + default: + if f, ok := s.Elts[0].(*ast.Field); ok { + d += nestDepth(f) + } + } + } + return d +} + +// TODO: be more accurate and move to astutil +func hasDocComments(d ast.Decl) bool { + if len(d.Comments()) > 0 { + return true + } + switch x := d.(type) { + case *ast.Field: + return len(x.Label.Comments()) > 0 + case *ast.Alias: + return len(x.Ident.Comments()) > 0 + case *ast.LetClause: + return len(x.Ident.Comments()) > 0 + } + return false +} + +func (f *formatter) walkDeclList(list []ast.Decl) { + f.before(nil) + d := 0 + hasEllipsis := false + for i, x := range list { + if i > 0 { + f.print(declcomma) + nd := 0 + if f, ok := x.(*ast.Field); ok { + nd = nestDepth(f) + } + if f.current.parentSep == newline && (d == 0 || nd != d) { + f.print(f.formfeed()) + } + if hasDocComments(x) { + switch x := list[i-1].(type) { + case *ast.Field: + if x.Token == token.ISA || internal.IsDefinition(x.Label) { + f.print(newsection) + } + + default: + f.print(newsection) + } + } + } + if f.printer.cfg.simplify && internal.IsEllipsis(x) { + hasEllipsis = true + continue + } + f.decl(x) + d = 0 + if f, ok := x.(*ast.Field); ok { + d = nestDepth(f) + } + if j := i + 1; j < len(list) { + switch x := list[j].(type) { + case *ast.Field: + switch x := x.Value.(type) { + case *ast.StructLit: + // TODO: not entirely correct: could have multiple elements, + // not have a valid Lbrace, and be marked multiline. This + // cannot occur for ASTs resulting from a parse, though. + if x.Lbrace.IsValid() || len(x.Elts) != 1 { + f.print(f.formfeed()) + continue + } + case *ast.ListLit: + f.print(f.formfeed()) + continue + } + } + } + f.print(f.current.parentSep) + } + if hasEllipsis { + f.decl(&ast.Ellipsis{}) + f.print(f.current.parentSep) + } + f.after(nil) +} + +func (f *formatter) walkSpecList(list []*ast.ImportSpec) { + f.before(nil) + for _, x := range list { + f.before(x) + f.importSpec(x) + f.after(x) + } + f.after(nil) +} + +func (f *formatter) walkClauseList(list []ast.Clause, ws whiteSpace) { + f.before(nil) + for _, x := range list { + f.before(x) + f.print(ws) + f.clause(x) + f.after(x) + } + f.after(nil) +} + +func (f *formatter) walkListElems(list []ast.Expr) { + f.before(nil) + for _, x := range list { + f.before(x) + switch n := x.(type) { + case *ast.Comprehension: + f.walkClauseList(n.Clauses, blank) + f.print(blank, nooverride) + f.expr(n.Value) + + case *ast.Ellipsis: + f.ellipsis(n) + + case *ast.Alias: + f.expr(n.Ident) + f.print(n.Equal, token.BIND) + f.expr(n.Expr) + + // TODO: ast.CommentGroup: allows comment groups in ListLits. + + case ast.Expr: + f.exprRaw(n, token.LowestPrec, 1) + } + f.print(comma, blank) + f.after(x) + } + f.after(nil) +} + +func (f *formatter) walkArgsList(list []ast.Expr, depth int) { + f.before(nil) + for _, x := range list { + f.before(x) + f.exprRaw(x, token.LowestPrec, depth) + f.print(comma, blank) + f.after(x) + } + f.after(nil) +} + +func (f *formatter) file(file *ast.File) { + f.before(file) + f.walkDeclList(file.Decls) + f.after(file) + f.print(token.EOF) +} + +func (f *formatter) inlineField(n *ast.Field) *ast.Field { + regular := internal.IsRegularField(n) + // shortcut single-element structs. + // If the label has a valid position, we assume that an unspecified + // Lbrace signals the intend to collapse fields. + if !n.Label.Pos().IsValid() && !(f.printer.cfg.simplify && regular) { + return nil + } + + obj, ok := n.Value.(*ast.StructLit) + if !ok || len(obj.Elts) != 1 || + (obj.Lbrace.IsValid() && !f.printer.cfg.simplify) || + (obj.Lbrace.IsValid() && hasDocComments(n)) || + len(n.Attrs) > 0 { + return nil + } + + mem, ok := obj.Elts[0].(*ast.Field) + if !ok || len(mem.Attrs) > 0 { + return nil + } + + if hasDocComments(mem) { + // TODO: this inserts curly braces even in spaces where this + // may not be desirable, such as: + // a: + // // foo + // b: 3 + return nil + } + return mem +} + +func (f *formatter) decl(decl ast.Decl) { + if decl == nil { + return + } + defer f.after(decl) + if !f.before(decl) { + return + } + + switch n := decl.(type) { + case *ast.Field: + f.label(n.Label, n.Optional != token.NoPos) + + regular := isRegularField(n.Token) + if regular { + f.print(noblank, nooverride, n.TokenPos, token.COLON) + } else { + f.print(blank, nooverride, n.Token) + } + + if mem := f.inlineField(n); mem != nil { + switch { + default: + fallthrough + + case regular && f.cfg.simplify: + f.print(blank, nooverride) + f.decl(mem) + + case mem.Label.Pos().IsNewline(): + f.print(indent, formfeed) + f.decl(mem) + f.indent-- + } + return + } + + nextFF := f.nextNeedsFormfeed(n.Value) + tab := vtab + if nextFF { + tab = blank + } + + f.print(tab) + + if n.Value != nil { + switch n.Value.(type) { + case *ast.ListLit, *ast.StructLit: + f.expr(n.Value) + default: + f.print(indent) + f.expr(n.Value) + f.markUnindentLine() + } + } else { + f.current.pos++ + f.visitComments(f.current.pos) + } + + space := tab + for _, a := range n.Attrs { + if f.before(a) { + f.print(space, a.At, a) + } + f.after(a) + space = blank + } + + if nextFF { + f.print(formfeed) + } + + case *ast.BadDecl: + f.print(n.From, "*bad decl*", declcomma) + + case *ast.Package: + f.print(n.PackagePos, "package") + f.print(blank, n.Name, newsection, nooverride) + + case *ast.ImportDecl: + f.print(n.Import, "import") + if len(n.Specs) == 0 { + f.print(blank, n.Lparen, token.LPAREN, n.Rparen, token.RPAREN, newline) + break + } + switch { + case len(n.Specs) == 1 && len(n.Specs[0].Comments()) == 0: + if !n.Lparen.IsValid() { + f.print(blank) + f.walkSpecList(n.Specs) + break + } + fallthrough + default: + f.print(blank, n.Lparen, token.LPAREN, newline, indent) + f.walkSpecList(n.Specs) + f.print(unindent, newline, n.Rparen, token.RPAREN, newline) + } + f.print(newsection, nooverride) + + case *ast.LetClause: + if !decl.Pos().HasRelPos() || decl.Pos().RelPos() >= token.Newline { + f.print(formfeed) + } + f.print(n.Let, token.LET, blank, nooverride) + f.expr(n.Ident) + f.print(blank, nooverride, n.Equal, token.BIND, blank) + f.expr(n.Expr) + f.print(declcomma) // implied + + case *ast.EmbedDecl: + if !n.Pos().HasRelPos() || n.Pos().RelPos() >= token.Newline { + f.print(formfeed) + } + f.expr(n.Expr) + f.print(newline, noblank) + + case *ast.Attribute: + f.print(n.At, n) + + case *ast.CommentGroup: + f.printComment(n) + f.print(newsection) + + case ast.Expr: + f.embedding(n) + } +} + +func (f *formatter) embedding(decl ast.Expr) { + switch n := decl.(type) { + case *ast.Comprehension: + if !n.Pos().HasRelPos() || n.Pos().RelPos() >= token.Newline { + f.print(formfeed) + } + f.walkClauseList(n.Clauses, blank) + f.print(blank, nooverride) + f.expr(n.Value) + + case *ast.Ellipsis: + f.ellipsis(n) + + case *ast.Alias: + if !decl.Pos().HasRelPos() || decl.Pos().RelPos() >= token.Newline { + f.print(formfeed) + } + f.expr(n.Ident) + f.print(blank, n.Equal, token.BIND, blank) + f.expr(n.Expr) + f.print(declcomma) // implied + + // TODO: ast.CommentGroup: allows comment groups in ListLits. + + case ast.Expr: + f.exprRaw(n, token.LowestPrec, 1) + } +} + +func (f *formatter) nextNeedsFormfeed(n ast.Expr) bool { + switch x := n.(type) { + case *ast.StructLit: + return true + case *ast.BasicLit: + return strings.IndexByte(x.Value, '\n') >= 0 + case *ast.ListLit: + return true + } + return false +} + +func (f *formatter) importSpec(x *ast.ImportSpec) { + if x.Name != nil { + f.label(x.Name, false) + f.print(blank) + } else { + f.current.pos++ + f.visitComments(f.current.pos) + } + f.expr(x.Path) + f.print(newline) +} + +func isValidIdent(ident string) bool { + var scan scanner.Scanner + scan.Init(token.NewFile("check", -1, len(ident)), []byte(ident), nil, 0) + + _, tok, lit := scan.Scan() + if tok == token.IDENT || tok.IsKeyword() { + return lit == ident + } + return false +} + +func (f *formatter) label(l ast.Label, optional bool) { + f.before(l) + defer f.after(l) + switch n := l.(type) { + case *ast.Alias: + f.expr(n) + + case *ast.Ident: + // Escape an identifier that has invalid characters. This may happen, + // if the AST is not generated by the parser. + name := n.Name + if !ast.IsValidIdent(name) { + name = literal.String.Quote(n.Name) + } + f.print(n.NamePos, name) + + case *ast.BasicLit: + str := n.Value + // Allow any CUE string in the AST, but ensure it is formatted + // according to spec. + if strings.HasPrefix(str, `"""`) || strings.HasPrefix(str, "#") { + if u, err := literal.Unquote(str); err == nil { + str = literal.String.Quote(u) + } + } + f.print(n.ValuePos, str) + + case *ast.ListLit: + f.expr(n) + + case *ast.ParenExpr: + f.expr(n) + + case *ast.Interpolation: + f.expr(n) + + default: + panic(fmt.Sprintf("unknown label type %T", n)) + } + if optional { + f.print(token.OPTION) + } +} + +func (f *formatter) ellipsis(x *ast.Ellipsis) { + f.print(x.Ellipsis, token.ELLIPSIS) + if x.Type != nil && !isTop(x.Type) { + f.expr(x.Type) + } +} + +func (f *formatter) expr(x ast.Expr) { + const depth = 1 + f.expr1(x, token.LowestPrec, depth) +} + +func (f *formatter) expr0(x ast.Expr, depth int) { + f.expr1(x, token.LowestPrec, depth) +} + +func (f *formatter) expr1(expr ast.Expr, prec1, depth int) { + if f.before(expr) { + f.exprRaw(expr, prec1, depth) + } + f.after(expr) +} + +func (f *formatter) exprRaw(expr ast.Expr, prec1, depth int) { + + switch x := expr.(type) { + case *ast.BadExpr: + f.print(x.From, "_|_") + + case *ast.BottomLit: + f.print(x.Bottom, token.BOTTOM) + + case *ast.Alias: + // Aliases in expression positions are printed in short form. + f.label(x.Ident, false) + f.print(x.Equal, token.BIND) + f.expr(x.Expr) + + case *ast.Ident: + f.print(x.NamePos, x) + + case *ast.BinaryExpr: + if depth < 1 { + f.internalError("depth < 1:", depth) + depth = 1 + } + f.binaryExpr(x, prec1, cutoff(x, depth), depth) + + case *ast.UnaryExpr: + const prec = token.UnaryPrec + if prec < prec1 { + // parenthesis needed + f.print(token.LPAREN, nooverride) + f.expr(x) + f.print(token.RPAREN) + } else { + // no parenthesis needed + f.print(x.OpPos, x.Op, nooverride) + f.expr1(x.X, prec, depth) + } + + case *ast.BasicLit: + f.print(x.ValuePos, x) + + case *ast.Interpolation: + f.before(nil) + for _, x := range x.Elts { + f.expr0(x, depth+1) + } + f.after(nil) + + case *ast.ParenExpr: + if _, hasParens := x.X.(*ast.ParenExpr); hasParens { + // don't print parentheses around an already parenthesized expression + // TODO: consider making this more general and incorporate precedence levels + f.expr0(x.X, depth) + } else { + f.print(x.Lparen, token.LPAREN) + f.expr0(x.X, reduceDepth(depth)) // parentheses undo one level of depth + f.print(x.Rparen, token.RPAREN) + } + + case *ast.SelectorExpr: + f.selectorExpr(x, depth) + + case *ast.IndexExpr: + f.expr1(x.X, token.HighestPrec, 1) + f.print(x.Lbrack, token.LBRACK) + f.expr0(x.Index, depth+1) + f.print(x.Rbrack, token.RBRACK) + + case *ast.SliceExpr: + f.expr1(x.X, token.HighestPrec, 1) + f.print(x.Lbrack, token.LBRACK) + indices := []ast.Expr{x.Low, x.High} + for i, y := range indices { + if i > 0 { + // blanks around ":" if both sides exist and either side is a binary expression + x := indices[i-1] + if depth <= 1 && x != nil && y != nil && (isBinary(x) || isBinary(y)) { + f.print(blank, token.COLON, blank) + } else { + f.print(token.COLON) + } + } + if y != nil { + f.expr0(y, depth+1) + } + } + f.print(x.Rbrack, token.RBRACK) + + case *ast.CallExpr: + if len(x.Args) > 1 { + depth++ + } + wasIndented := f.possibleSelectorExpr(x.Fun, token.HighestPrec, depth) + f.print(x.Lparen, token.LPAREN) + f.walkArgsList(x.Args, depth) + f.print(trailcomma, noblank, x.Rparen, token.RPAREN) + if wasIndented { + f.print(unindent) + } + + case *ast.StructLit: + var l line + ws := noblank + ff := f.formfeed() + + switch { + case len(x.Elts) == 0: + if !x.Rbrace.HasRelPos() { + // collapse curly braces if the body is empty. + ffAlt := blank | nooverride + for _, c := range x.Comments() { + if c.Position == 1 { + ffAlt = ff + } + } + ff = ffAlt + } + case !x.Rbrace.HasRelPos() || !x.Elts[0].Pos().HasRelPos(): + ws |= newline | nooverride + } + f.print(x.Lbrace, token.LBRACE, &l, ws, ff, indent) + + f.walkDeclList(x.Elts) + f.matchUnindent() + + ws = noblank + if f.lineout != l { + ws |= newline + if f.lastTok != token.RBRACE && f.lastTok != token.RBRACK { + ws |= nooverride + } + } + f.print(ws, x.Rbrace, token.RBRACE) + + case *ast.ListLit: + f.print(x.Lbrack, token.LBRACK, indent) + f.walkListElems(x.Elts) + f.print(trailcomma, noblank) + f.visitComments(f.current.pos) + f.matchUnindent() + f.print(noblank, x.Rbrack, token.RBRACK) + + case *ast.Ellipsis: + f.ellipsis(x) + + default: + panic(fmt.Sprintf("unimplemented type %T", x)) + } +} + +func (f *formatter) clause(clause ast.Clause) { + switch n := clause.(type) { + case *ast.ForClause: + f.print(n.For, "for", blank) + f.print(indent) + if n.Key != nil { + f.label(n.Key, false) + f.print(n.Colon, token.COMMA, blank) + } else { + f.current.pos++ + f.visitComments(f.current.pos) + } + f.label(n.Value, false) + f.print(blank, n.In, "in", blank) + f.expr(n.Source) + f.markUnindentLine() + + case *ast.IfClause: + f.print(n.If, "if", blank) + f.print(indent) + f.expr(n.Condition) + f.markUnindentLine() + + case *ast.LetClause: + f.print(n.Let, token.LET, blank, nooverride) + f.print(indent) + f.expr(n.Ident) + f.print(blank, nooverride, n.Equal, token.BIND, blank) + f.expr(n.Expr) + f.markUnindentLine() + + default: + panic("unknown clause type") + } +} + +func walkBinary(e *ast.BinaryExpr) (has6, has7, has8 bool, maxProblem int) { + switch e.Op.Precedence() { + case 6: + has6 = true + case 7: + has7 = true + case 8: + has8 = true + } + + switch l := e.X.(type) { + case *ast.BinaryExpr: + if l.Op.Precedence() < e.Op.Precedence() { + // parens will be inserted. + // pretend this is an *syntax.ParenExpr and do nothing. + break + } + h6, h7, h8, mp := walkBinary(l) + has6 = has6 || h6 + has7 = has7 || h7 + has8 = has8 || h8 + if maxProblem < mp { + maxProblem = mp + } + } + + switch r := e.Y.(type) { + case *ast.BinaryExpr: + if r.Op.Precedence() <= e.Op.Precedence() { + // parens will be inserted. + // pretend this is an *syntax.ParenExpr and do nothing. + break + } + h6, h7, h8, mp := walkBinary(r) + has6 = has6 || h6 + has7 = has7 || h7 + has8 = has8 || h8 + if maxProblem < mp { + maxProblem = mp + } + + case *ast.UnaryExpr: + switch e.Op.String() + r.Op.String() { + case "/*": + maxProblem = 8 + case "++", "--": + if maxProblem < 6 { + maxProblem = 6 + } + } + } + return +} + +func cutoff(e *ast.BinaryExpr, depth int) int { + has6, has7, has8, maxProblem := walkBinary(e) + if maxProblem > 0 { + return maxProblem + 1 + } + if (has6 || has7) && has8 { + if depth == 1 { + return 8 + } + if has7 { + return 7 + } + return 6 + } + if has6 && has7 { + if depth == 1 { + return 7 + } + return 6 + } + if depth == 1 { + return 8 + } + return 6 +} + +func diffPrec(expr ast.Expr, prec int) int { + x, ok := expr.(*ast.BinaryExpr) + if !ok || prec != x.Op.Precedence() { + return 1 + } + return 0 +} + +func reduceDepth(depth int) int { + depth-- + if depth < 1 { + depth = 1 + } + return depth +} + +// Format the binary expression: decide the cutoff and then format. +// Let's call depth == 1 Normal mode, and depth > 1 Compact mode. +// (Algorithm suggestion by Russ Cox.) +// +// The precedences are: +// 7 * / % quo rem div mod +// 6 + - +// 5 == != < <= > >= +// 4 && +// 3 || +// 2 & +// 1 | +// +// The only decision is whether there will be spaces around levels 6 and 7. +// There are never spaces at level 8 (unary), and always spaces at levels 5 and below. +// +// To choose the cutoff, look at the whole expression but excluding primary +// expressions (function calls, parenthesized exprs), and apply these rules: +// +// 1) If there is a binary operator with a right side unary operand +// that would clash without a space, the cutoff must be (in order): +// +// /* 8 +// ++ 7 // not necessary, but to avoid confusion +// -- 7 +// +// (Comparison operators always have spaces around them.) +// +// 2) If there is a mix of level 7 and level 6 operators, then the cutoff +// is 7 (use spaces to distinguish precedence) in Normal mode +// and 6 (never use spaces) in Compact mode. +// +// 3) If there are no level 6 operators or no level 7 operators, then the +// cutoff is 8 (always use spaces) in Normal mode +// and 6 (never use spaces) in Compact mode. +// +func (f *formatter) binaryExpr(x *ast.BinaryExpr, prec1, cutoff, depth int) { + f.nestExpr++ + defer func() { f.nestExpr-- }() + + prec := x.Op.Precedence() + if prec < prec1 { + // parenthesis needed + // Note: The parser inserts an syntax.ParenExpr node; thus this case + // can only occur if the AST is created in a different way. + // defer p.pushComment(nil).pop() + f.print(token.LPAREN, nooverride) + f.expr0(x, reduceDepth(depth)) // parentheses undo one level of depth + f.print(token.RPAREN) + return + } + + printBlank := prec < cutoff + + f.expr1(x.X, prec, depth+diffPrec(x.X, prec)) + f.print(nooverride) + if printBlank { + f.print(blank) + } + f.print(x.OpPos, x.Op) + if x.Y.Pos().IsNewline() { + // at least one line break, but respect an extra empty line + // in the source + f.print(formfeed) + printBlank = false // no blank after line break + } else { + f.print(nooverride) + } + if printBlank { + f.print(blank) + } + f.expr1(x.Y, prec+1, depth+1) +} + +func isBinary(expr ast.Expr) bool { + _, ok := expr.(*ast.BinaryExpr) + return ok +} + +func (f *formatter) possibleSelectorExpr(expr ast.Expr, prec1, depth int) bool { + if x, ok := expr.(*ast.SelectorExpr); ok { + return f.selectorExpr(x, depth) + } + f.expr1(expr, prec1, depth) + return false +} + +// selectorExpr handles an *syntax.SelectorExpr node and returns whether x spans +// multiple lines. +func (f *formatter) selectorExpr(x *ast.SelectorExpr, depth int) bool { + f.expr1(x.X, token.HighestPrec, depth) + f.print(token.PERIOD) + if x.Sel.Pos().IsNewline() { + f.print(indent, formfeed) + f.expr(x.Sel.(ast.Expr)) + f.print(unindent) + return true + } + f.print(noblank) + f.expr(x.Sel.(ast.Expr)) + return false +} + +func isTop(e ast.Expr) bool { + ident, ok := e.(*ast.Ident) + return ok && ident.Name == "_" +} diff --git a/vendor/cuelang.org/go/cue/format/printer.go b/vendor/cuelang.org/go/cue/format/printer.go new file mode 100644 index 0000000000..a43154fa6c --- /dev/null +++ b/vendor/cuelang.org/go/cue/format/printer.go @@ -0,0 +1,424 @@ +// Copyright 2018 The CUE Authors +// +// 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 format + +import ( + "fmt" + "os" + "strings" + "text/tabwriter" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/literal" + "cuelang.org/go/cue/token" +) + +// A printer takes the stream of formatting tokens and spacing directives +// produced by the formatter and adjusts the spacing based on the original +// source code. +type printer struct { + cfg *config + + allowed whiteSpace + requested whiteSpace + indentStack []whiteSpace + + pos token.Position // current pos in AST + lineout line + + lastTok token.Token // last token printed (syntax.ILLEGAL if it's whitespace) + + output []byte + indent int + spaceBefore bool + + errs errors.Error +} + +type line int + +func (p *printer) init(cfg *config) { + p.cfg = cfg + p.pos = token.Position{Line: 1, Column: 1} +} + +func (p *printer) errf(n ast.Node, format string, args ...interface{}) { + p.errs = errors.Append(p.errs, errors.Newf(n.Pos(), format, args...)) +} + +const debug = false + +func (p *printer) internalError(msg ...interface{}) { + if debug { + fmt.Print(p.pos.String() + ": ") + fmt.Println(msg...) + panic("go/printer") + } +} + +func (p *printer) lineFor(pos token.Pos) int { + return pos.Line() +} + +func (p *printer) Print(v interface{}) { + var ( + impliedComma = false + isLit bool + data string + nextWS whiteSpace + ) + switch x := v.(type) { + case *line: + *x = p.lineout + + case token.Token: + s := x.String() + before, after := mayCombine(p.lastTok, x) + if before && !p.spaceBefore { + // the previous and the current token must be + // separated by a blank otherwise they combine + // into a different incorrect token sequence + // (except for syntax.INT followed by a '.' this + // should never happen because it is taken care + // of via binary expression formatting) + if p.allowed&blank != 0 { + p.internalError("whitespace buffer not empty") + } + p.allowed |= blank + } + if after { + nextWS = blank + } + data = s + switch x { + case token.EOF: + data = "" + p.allowed = newline + p.allowed &^= newsection + case token.LPAREN, token.LBRACK, token.LBRACE: + case token.RPAREN, token.RBRACK, token.RBRACE: + impliedComma = true + } + p.lastTok = x + + case *ast.BasicLit: + data = x.Value + switch x.Kind { + case token.STRING: + // TODO: only do this when simplifying. Right now this does not + // give the right result, but it should be better if: + // 1) simplification is done as a separate step + // 2) simplified structs are explicitly referenced separately + // in the AST. + if p.indent < 6 { + data = literal.IndentTabs(data, p.cfg.Indent+p.indent+1) + } + + case token.INT: + if len(data) > 1 && + data[0] == '0' && + data[1] >= '0' && data[1] <= '9' { + data = "0o" + data[1:] + } + // Pad trailing dot before multiplier. + if p := strings.IndexByte(data, '.'); p >= 0 && data[p+1] > '9' { + data = data[:p+1] + "0" + data[p+1:] + } + // Lowercase E, but only if it is not the last character: in the + // future we may use E for Exa. + if p := strings.IndexByte(data, 'E'); p != -1 && p < len(data)-1 { + data = strings.ToLower(data) + } + + case token.FLOAT: + // Pad leading or trailing dots. + switch p := strings.IndexByte(data, '.'); { + case p < 0: + case p == 0: + data = "0" + data + case p == len(data)-1: + data += "0" + case data[p+1] > '9': + data = data[:p+1] + "0" + data[p+1:] + } + if strings.IndexByte(data, 'E') != -1 { + data = strings.ToLower(data) + } + } + + isLit = true + impliedComma = true + p.lastTok = x.Kind + + case *ast.Ident: + data = x.Name + if !ast.IsValidIdent(data) { + p.errf(x, "invalid identifier %q", x.Name) + data = "*bad identifier*" + } + impliedComma = true + p.lastTok = token.IDENT + + case string: + data = x + impliedComma = true + p.lastTok = token.STRING + + case *ast.CommentGroup: + rel := x.Pos().RelPos() + if x.Line { // TODO: we probably don't need this. + rel = token.Blank + } + switch rel { + case token.NoRelPos: + case token.Newline, token.NewSection: + case token.Blank, token.Elided: + p.allowed |= blank + fallthrough + case token.NoSpace: + p.allowed &^= newline | newsection | formfeed | declcomma + } + return + + case *ast.Attribute: + data = x.Text + impliedComma = true + p.lastTok = token.ATTRIBUTE + + case *ast.Comment: + // TODO: if implied comma, postpone comment + data = x.Text + p.lastTok = token.COMMENT + + case whiteSpace: + p.allowed |= x + return + + case token.Pos: + // TODO: should we use a known file position to synchronize? Go does, + // but we don't really have to. + // pos := x + if x.HasRelPos() { + if p.allowed&nooverride == 0 { + requested := p.allowed + switch x.RelPos() { + case token.NoSpace: + requested &^= newline | newsection | formfeed + case token.Blank: + requested |= blank + requested &^= newline | newsection | formfeed + case token.Newline: + requested |= newline + case token.NewSection: + requested |= newsection + } + p.writeWhitespace(requested) + p.allowed = 0 + p.requested = 0 + } + // p.pos = pos + } + return + + default: + fmt.Fprintf(os.Stderr, "print: unsupported argument %v (%T)\n", x, x) + panic("go/printer type") + } + + p.writeWhitespace(p.allowed) + p.allowed = 0 + p.requested = 0 + p.writeString(data, isLit) + p.allowed = nextWS + _ = impliedComma // TODO: delay comment printings +} + +func (p *printer) writeWhitespace(ws whiteSpace) { + if ws&comma != 0 { + switch { + case ws&(newsection|newline|formfeed) != 0, + ws&trailcomma == 0: + p.writeByte(',', 1) + } + } + if ws&indent != 0 { + p.markLineIndent(ws) + } + if ws&unindent != 0 { + p.markUnindentLine() + } + switch { + case ws&newsection != 0: + p.maybeIndentLine(ws) + p.writeByte('\f', 2) + p.lineout += 2 + p.spaceBefore = true + case ws&formfeed != 0: + p.maybeIndentLine(ws) + p.writeByte('\f', 1) + p.lineout++ + p.spaceBefore = true + case ws&newline != 0: + p.maybeIndentLine(ws) + p.writeByte('\n', 1) + p.lineout++ + p.spaceBefore = true + case ws&declcomma != 0: + p.writeByte(',', 1) + p.writeByte(' ', 1) + p.spaceBefore = true + case ws&noblank != 0: + case ws&vtab != 0: + p.writeByte('\v', 1) + p.spaceBefore = true + case ws&blank != 0: + p.writeByte(' ', 1) + p.spaceBefore = true + } +} + +func (p *printer) markLineIndent(ws whiteSpace) { + p.indentStack = append(p.indentStack, ws) +} + +func (p *printer) markUnindentLine() (wasUnindented bool) { + last := len(p.indentStack) - 1 + if ws := p.indentStack[last]; ws&indented != 0 { + p.indent-- + wasUnindented = true + } + p.indentStack = p.indentStack[:last] + return wasUnindented +} + +func (p *printer) maybeIndentLine(ws whiteSpace) { + if ws&unindent == 0 && len(p.indentStack) > 0 { + last := len(p.indentStack) - 1 + if ws := p.indentStack[last]; ws&indented != 0 || ws&indent == 0 { + return + } + p.indentStack[last] |= indented + p.indent++ + } +} + +func (f *formatter) matchUnindent() whiteSpace { + f.allowed |= unindent + // TODO: make this work. Whitespace from closing bracket should match that + // of opening if there is no position information. + // f.allowed &^= nooverride | newline | newsection | formfeed | blank | noblank + // ws := f.indentStack[len(f.indentStack)-1] + // mask := blank | noblank | vtab + // f.allowed |= unindent | blank | noblank + // if ws&newline != 0 || ws*indented != 0 { + // f.allowed |= newline + // } + return 0 +} + +// writeString writes the string s to p.output and updates p.pos, p.out, +// and p.last. If isLit is set, s is escaped w/ tabwriter.Escape characters +// to protect s from being interpreted by the tabwriter. +// +// Note: writeString is only used to write Go tokens, literals, and +// comments, all of which must be written literally. Thus, it is correct +// to always set isLit = true. However, setting it explicitly only when +// needed (i.e., when we don't know that s contains no tabs or line breaks) +// avoids processing extra escape characters and reduces run time of the +// printer benchmark by up to 10%. +// +func (p *printer) writeString(s string, isLit bool) { + if s != "" { + p.spaceBefore = false + } + + if isLit { + // Protect s such that is passes through the tabwriter + // unchanged. Note that valid Go programs cannot contain + // tabwriter.Escape bytes since they do not appear in legal + // UTF-8 sequences. + p.output = append(p.output, tabwriter.Escape) + } + + p.output = append(p.output, s...) + + if isLit { + p.output = append(p.output, tabwriter.Escape) + } + // update positions + nLines := 0 + var li int // index of last newline; valid if nLines > 0 + for i := 0; i < len(s); i++ { + // CUE tokens cannot contain '\f' - no need to look for it + if s[i] == '\n' { + nLines++ + li = i + } + } + p.pos.Offset += len(s) + if nLines > 0 { + p.pos.Line += nLines + c := len(s) - li + p.pos.Column = c + } else { + p.pos.Column += len(s) + } +} + +func (p *printer) writeByte(ch byte, n int) { + for i := 0; i < n; i++ { + p.output = append(p.output, ch) + } + + // update positions + p.pos.Offset += n + if ch == '\n' || ch == '\f' { + p.pos.Line += n + p.pos.Column = 1 + + n := p.cfg.Indent + p.indent // include base indentation + for i := 0; i < n; i++ { + p.output = append(p.output, '\t') + } + + // update positions + p.pos.Offset += n + p.pos.Column += n + + return + } + p.pos.Column += n +} + +func mayCombine(prev, next token.Token) (before, after bool) { + s := next.String() + if 'a' <= s[0] && s[0] < 'z' { + return true, true + } + switch prev { + case token.IQUO, token.IREM, token.IDIV, token.IMOD: + return false, false + case token.INT: + before = next == token.PERIOD // 1. + case token.ADD: + before = s[0] == '+' // ++ + case token.SUB: + before = s[0] == '-' // -- + case token.QUO: + before = s[0] == '*' // /* + } + return before, false +} diff --git a/vendor/cuelang.org/go/cue/format/simplify.go b/vendor/cuelang.org/go/cue/format/simplify.go new file mode 100644 index 0000000000..f4981978cc --- /dev/null +++ b/vendor/cuelang.org/go/cue/format/simplify.go @@ -0,0 +1,113 @@ +// Copyright 2019 CUE Authors +// +// 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 format + +import ( + "strconv" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/ast/astutil" + "cuelang.org/go/internal" +) + +// labelSimplifier rewrites string labels to identifiers if +// no identifiers will subsequently bind to the exposed label. +// In other words, string labels are only replaced if this does +// not change the semantics of the CUE code. +type labelSimplifier struct { + parent *labelSimplifier + scope map[string]bool +} + +func (s *labelSimplifier) processDecls(decls []ast.Decl) { + sc := labelSimplifier{parent: s, scope: map[string]bool{}} + for _, d := range decls { + switch x := d.(type) { + case *ast.Field: + ast.Walk(x.Label, sc.markStrings, nil) + } + } + + for _, d := range decls { + switch x := d.(type) { + case *ast.Field: + ast.Walk(x.Value, sc.markReferences, nil) + default: + ast.Walk(x, sc.markReferences, nil) + } + } + + for _, d := range decls { + switch x := d.(type) { + case *ast.Field: + x.Label = astutil.Apply(x.Label, sc.replace, nil).(ast.Label) + } + } +} + +func (s *labelSimplifier) markReferences(n ast.Node) bool { + // Record strings at this level. + switch x := n.(type) { + case *ast.File: + s.processDecls(x.Decls) + return false + + case *ast.StructLit: + s.processDecls(x.Elts) + return false + + case *ast.SelectorExpr: + ast.Walk(x.X, s.markReferences, nil) + return false + + case *ast.Ident: + for c := s; c != nil; c = c.parent { + if _, ok := c.scope[x.Name]; ok { + c.scope[x.Name] = false + break + } + } + } + return true +} + +func (s *labelSimplifier) markStrings(n ast.Node) bool { + switch x := n.(type) { + case *ast.BasicLit: + str, err := strconv.Unquote(x.Value) + if err != nil || !ast.IsValidIdent(str) || internal.IsDefOrHidden(str) { + return false + } + s.scope[str] = true + + case *ast.Ident: + s.scope[x.Name] = true + + case *ast.ListLit, *ast.Interpolation: + return false + } + return true +} + +func (s *labelSimplifier) replace(c astutil.Cursor) bool { + switch x := c.Node().(type) { + case *ast.BasicLit: + str, err := strconv.Unquote(x.Value) + if err == nil && s.scope[str] && !internal.IsDefOrHidden(str) { + c.Replace(ast.NewIdent(str)) + } + } + return true +} diff --git a/vendor/cuelang.org/go/cue/instance.go b/vendor/cuelang.org/go/cue/instance.go new file mode 100644 index 0000000000..0fe93c49fd --- /dev/null +++ b/vendor/cuelang.org/go/cue/instance.go @@ -0,0 +1,357 @@ +// Copyright 2018 The CUE Authors +// +// 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 cue + +import ( + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/build" + "cuelang.org/go/cue/errors" + "cuelang.org/go/internal" + "cuelang.org/go/internal/core/adt" + "cuelang.org/go/internal/core/compile" + "cuelang.org/go/internal/core/runtime" +) + +// An InstanceOrValue is implemented by Value and *Instance. +// +// This is a placeholder type that is used to allow Instance-based APIs to +// transition to Value-based APIs. The goals is to get rid of the Instance +// type before v1.0.0. +type InstanceOrValue interface { + Value() Value + + internal() +} + +func (Value) internal() {} +func (*Instance) internal() {} + +// Value implements value.Instance. +func (v hiddenValue) Value() Value { return v } + +// An Instance defines a single configuration based on a collection of +// underlying CUE files. +type Instance struct { + index *runtime.Runtime + + root *adt.Vertex + + ImportPath string + Dir string + PkgName string + DisplayName string + + Incomplete bool // true if Pkg and all its dependencies are free of errors + Err errors.Error // non-nil if the package had errors + + inst *build.Instance +} + +type hiddenInstance = Instance + +func addInst(x *runtime.Runtime, p *Instance) *Instance { + if p.inst == nil { + p.inst = &build.Instance{ + ImportPath: p.ImportPath, + PkgName: p.PkgName, + } + } + x.AddInst(p.ImportPath, p.root, p.inst) + x.SetBuildData(p.inst, p) + p.index = x + return p +} + +func lookupInstance(x *runtime.Runtime, p *build.Instance) *Instance { + if x, ok := x.BuildData(p); ok { + return x.(*Instance) + } + return nil +} + +func getImportFromBuild(x *runtime.Runtime, p *build.Instance, v *adt.Vertex) *Instance { + inst := lookupInstance(x, p) + + if inst != nil { + return inst + } + + inst = &Instance{ + ImportPath: p.ImportPath, + Dir: p.Dir, + PkgName: p.PkgName, + DisplayName: p.ImportPath, + root: v, + inst: p, + index: x, + } + if p.Err != nil { + inst.setListOrError(p.Err) + } + + x.SetBuildData(p, inst) + + return inst +} + +func getImportFromNode(x *runtime.Runtime, v *adt.Vertex) *Instance { + p := x.GetInstanceFromNode(v) + if p == nil { + return nil + } + + return getImportFromBuild(x, p, v) +} + +func getImportFromPath(x *runtime.Runtime, id string) *Instance { + node := x.LoadImport(id) + if node == nil { + return nil + } + b := x.GetInstanceFromNode(node) + inst := lookupInstance(x, b) + if inst == nil { + inst = &Instance{ + ImportPath: b.ImportPath, + PkgName: b.PkgName, + root: node, + inst: b, + index: x, + } + } + return inst +} + +func init() { + internal.MakeInstance = func(value interface{}) interface{} { + v := value.(Value) + x := v.eval(v.ctx()) + st, ok := x.(*adt.Vertex) + if !ok { + st = &adt.Vertex{} + st.AddConjunct(adt.MakeRootConjunct(nil, x)) + } + return addInst(v.idx, &Instance{ + root: st, + }) + } +} + +// newInstance creates a new instance. Use Insert to populate the instance. +func newInstance(x *runtime.Runtime, p *build.Instance, v *adt.Vertex) *Instance { + // TODO: associate root source with structLit. + inst := &Instance{ + root: v, + inst: p, + } + if p != nil { + inst.ImportPath = p.ImportPath + inst.Dir = p.Dir + inst.PkgName = p.PkgName + inst.DisplayName = p.ImportPath + if p.Err != nil { + inst.setListOrError(p.Err) + } + } + + x.AddInst(p.ImportPath, v, p) + x.SetBuildData(p, inst) + inst.index = x + return inst +} + +func (inst *Instance) setListOrError(err errors.Error) { + inst.Incomplete = true + inst.Err = errors.Append(inst.Err, err) +} + +func (inst *Instance) setError(err errors.Error) { + inst.Incomplete = true + inst.Err = errors.Append(inst.Err, err) +} + +func (inst *Instance) eval(ctx *adt.OpContext) adt.Value { + // TODO: remove manifest here? + v := manifest(ctx, inst.root) + return v +} + +// ID returns the package identifier that uniquely qualifies module and +// package name. +func (inst *Instance) ID() string { + if inst == nil || inst.inst == nil { + return "" + } + return inst.inst.ID() +} + +// Doc returns the package comments for this instance. +// +// Deprecated: use inst.Value().Doc() +func (inst *hiddenInstance) Doc() []*ast.CommentGroup { + return inst.Value().Doc() +} + +// Value returns the root value of the configuration. If the configuration +// defines in emit value, it will be that value. Otherwise it will be all +// top-level values. +func (inst *Instance) Value() Value { + ctx := newContext(inst.index) + inst.root.Finalize(ctx) + return newVertexRoot(inst.index, ctx, inst.root) +} + +// Eval evaluates an expression within an existing instance. +// +// Expressions may refer to builtin packages if they can be uniquely identified. +// +// Deprecated: use +// inst.Value().Context().BuildExpr(expr, Scope(inst.Value), InferBuiltins(true)) +func (inst *hiddenInstance) Eval(expr ast.Expr) Value { + v := inst.Value() + return v.Context().BuildExpr(expr, Scope(v), InferBuiltins(true)) +} + +// DO NOT USE. +// +// Deprecated: do not use. +func Merge(inst ...*Instance) *Instance { + v := &adt.Vertex{} + + i := inst[0] + ctx := newContext(i.index) + + // TODO: interesting test: use actual unification and then on K8s corpus. + + for _, i := range inst { + w := i.Value() + v.AddConjunct(adt.MakeRootConjunct(nil, w.v.ToDataAll())) + } + v.Finalize(ctx) + + p := addInst(i.index, &Instance{ + root: v, + }) + return p +} + +// Build creates a new instance from the build instances, allowing unbound +// identifier to bind to the top-level field in inst. The top-level fields in +// inst take precedence over predeclared identifier and builtin functions. +// +// Deprecated: use Context.Build +func (inst *hiddenInstance) Build(p *build.Instance) *Instance { + p.Complete() + + idx := inst.index + r := inst.index + + rErr := r.ResolveFiles(p) + + cfg := &compile.Config{Scope: valueScope(Value{idx: r, v: inst.root})} + v, err := compile.Files(cfg, r, p.ID(), p.Files...) + + v.AddConjunct(adt.MakeRootConjunct(nil, inst.root)) + + i := newInstance(idx, p, v) + if rErr != nil { + i.setListOrError(rErr) + } + if i.Err != nil { + i.setListOrError(i.Err) + } + + if err != nil { + i.setListOrError(err) + } + + return i +} + +func (inst *Instance) value() Value { + return newVertexRoot(inst.index, newContext(inst.index), inst.root) +} + +// Lookup reports the value at a path starting from the top level struct. The +// Exists method of the returned value will report false if the path did not +// exist. The Err method reports if any error occurred during evaluation. The +// empty path returns the top-level configuration struct. Use LookupDef for definitions or LookupField for +// any kind of field. +// +// Deprecated: use Value.LookupPath +func (inst *hiddenInstance) Lookup(path ...string) Value { + return inst.value().Lookup(path...) +} + +// LookupDef reports the definition with the given name within struct v. The +// Exists method of the returned value will report false if the definition did +// not exist. The Err method reports if any error occurred during evaluation. +// +// Deprecated: use Value.LookupPath +func (inst *hiddenInstance) LookupDef(path string) Value { + return inst.value().LookupDef(path) +} + +// LookupField reports a Field at a path starting from v, or an error if the +// path is not. The empty path returns v itself. +// +// It cannot look up hidden or unexported fields. +// +// Deprecated: this API does not work with new-style definitions. Use +// FieldByName defined on inst.Value(). +// +// Deprecated: use Value.LookupPath +func (inst *hiddenInstance) LookupField(path ...string) (f FieldInfo, err error) { + v := inst.value() + for _, k := range path { + s, err := v.Struct() + if err != nil { + return f, err + } + + f, err = s.FieldByName(k, true) + if err != nil { + return f, err + } + if f.IsHidden { + return f, errNotFound + } + v = f.Value + } + return f, err +} + +// Fill creates a new instance with the values of the old instance unified with +// the given value. It is not possible to update the emit value. +// +// Values may be any Go value that can be converted to CUE, an ast.Expr or +// a Value. In the latter case, it will panic if the Value is not from the same +// Runtime. +// +// Deprecated: use Value.FillPath() +func (inst *hiddenInstance) Fill(x interface{}, path ...string) (*Instance, error) { + v := inst.Value().Fill(x, path...) + + inst = addInst(inst.index, &Instance{ + root: v.v, + inst: nil, + + // Omit ImportPath to indicate this is not an importable package. + Dir: inst.Dir, + PkgName: inst.PkgName, + Incomplete: inst.Incomplete, + }) + return inst, nil +} diff --git a/vendor/cuelang.org/go/cue/literal/doc.go b/vendor/cuelang.org/go/cue/literal/doc.go new file mode 100644 index 0000000000..3d3095c6ce --- /dev/null +++ b/vendor/cuelang.org/go/cue/literal/doc.go @@ -0,0 +1,17 @@ +// Copyright 2019 CUE Authors +// +// 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 literal implements conversions to and from string representations of +// basic data types. +package literal diff --git a/vendor/cuelang.org/go/cue/literal/indent.go b/vendor/cuelang.org/go/cue/literal/indent.go new file mode 100644 index 0000000000..193ca3b440 --- /dev/null +++ b/vendor/cuelang.org/go/cue/literal/indent.go @@ -0,0 +1,33 @@ +// Copyright 2020 CUE Authors +// +// 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 literal + +import "strings" + +// IndentTabs takes a quoted string and reindents it for the given indentation. +// If a string is not a multiline string it will return the string as is. +func IndentTabs(s string, n int) string { + indent := tabs(n) + + qi, _, _, err := ParseQuotes(s, s) + if err != nil || !qi.multiline || qi.whitespace == indent { + return s + } + + search := "\n" + qi.whitespace + replace := "\n" + indent + + return strings.ReplaceAll(s, search, replace) +} diff --git a/vendor/cuelang.org/go/cue/literal/num.go b/vendor/cuelang.org/go/cue/literal/num.go new file mode 100644 index 0000000000..bb77d5b2f2 --- /dev/null +++ b/vendor/cuelang.org/go/cue/literal/num.go @@ -0,0 +1,357 @@ +// Copyright 2020 CUE Authors +// +// 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 literal + +import ( + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/token" + "github.com/cockroachdb/apd/v2" +) + +var baseContext apd.Context + +func init() { + baseContext = apd.BaseContext + baseContext.Precision = 24 +} + +// NumInfo contains information about a parsed numbers. +// +// Reusing a NumInfo across parses may avoid memory allocations. +type NumInfo struct { + pos token.Pos + src string + p int + ch byte + buf []byte + + mul Multiplier + base byte + neg bool + UseSep bool + isFloat bool + err error +} + +// String returns a canonical string representation of the number so that +// it can be parsed with math.Float.Parse. +func (p *NumInfo) String() string { + if len(p.buf) > 0 && p.base == 10 && p.mul == 0 { + return string(p.buf) + } + var d apd.Decimal + _ = p.decimal(&d) + return d.String() +} + +type decimal = apd.Decimal + +// Decimal is for internal use. +func (p *NumInfo) Decimal(v *decimal) error { + return p.decimal(v) +} + +func (p *NumInfo) decimal(v *apd.Decimal) error { + if p.base != 10 { + _, _, _ = v.SetString("0") + b := p.buf + if p.buf[0] == '-' { + v.Negative = p.neg + b = p.buf[1:] + } + v.Coeff.SetString(string(b), int(p.base)) + return nil + } + _ = v.UnmarshalText(p.buf) + if p.mul != 0 { + _, _ = baseContext.Mul(v, v, mulToRat[p.mul]) + cond, _ := baseContext.RoundToIntegralExact(v, v) + if cond.Inexact() { + return p.errorf("number cannot be represented as int") + } + } + return nil +} + +// Multiplier reports which multiplier was used in an integral number. +func (p *NumInfo) Multiplier() Multiplier { + return p.mul +} + +// IsInt reports whether the number is an integral number. +func (p *NumInfo) IsInt() bool { + return !p.isFloat +} + +// ParseNum parses s and populates NumInfo with the result. +func ParseNum(s string, n *NumInfo) error { + *n = NumInfo{pos: n.pos, src: s, buf: n.buf[:0]} + if !n.next() { + return n.errorf("invalid number %q", s) + } + if n.ch == '-' { + n.neg = true + n.buf = append(n.buf, '-') + n.next() + } + seenDecimalPoint := false + if n.ch == '.' { + n.next() + seenDecimalPoint = true + } + err := n.scanNumber(seenDecimalPoint) + if err != nil { + return err + } + if n.err != nil { + return n.err + } + if n.p < len(n.src) { + return n.errorf("invalid number %q", s) + } + if len(n.buf) == 0 { + n.buf = append(n.buf, '0') + } + return nil +} + +func (p *NumInfo) errorf(format string, args ...interface{}) error { + return errors.Newf(p.pos, format, args...) +} + +// A Multiplier indicates a multiplier indicator used in the literal. +type Multiplier byte + +const ( + mul1 Multiplier = 1 + iota + mul2 + mul3 + mul4 + mul5 + mul6 + mul7 + mul8 + + mulBin = 0x10 + mulDec = 0x20 + + K = mulDec | mul1 + M = mulDec | mul2 + G = mulDec | mul3 + T = mulDec | mul4 + P = mulDec | mul5 + E = mulDec | mul6 + Z = mulDec | mul7 + Y = mulDec | mul8 + + Ki = mulBin | mul1 + Mi = mulBin | mul2 + Gi = mulBin | mul3 + Ti = mulBin | mul4 + Pi = mulBin | mul5 + Ei = mulBin | mul6 + Zi = mulBin | mul7 + Yi = mulBin | mul8 +) + +func (p *NumInfo) next() bool { + if p.p >= len(p.src) { + p.ch = 0 + return false + } + p.ch = p.src[p.p] + p.p++ + if p.ch == '.' { + if len(p.buf) == 0 { + p.buf = append(p.buf, '0') + } + p.buf = append(p.buf, '.') + } + return true +} + +func (p *NumInfo) digitVal(ch byte) (d int) { + switch { + case '0' <= ch && ch <= '9': + d = int(ch - '0') + case ch == '_': + p.UseSep = true + return 0 + case 'a' <= ch && ch <= 'f': + d = int(ch - 'a' + 10) + case 'A' <= ch && ch <= 'F': + d = int(ch - 'A' + 10) + default: + return 16 // larger than any legal digit val + } + return d +} + +func (p *NumInfo) scanMantissa(base int) bool { + hasDigit := false + var last byte + for p.digitVal(p.ch) < base { + if p.ch != '_' { + p.buf = append(p.buf, p.ch) + hasDigit = true + } + last = p.ch + p.next() + } + if last == '_' { + p.err = p.errorf("illegal '_' in number") + } + return hasDigit +} + +func (p *NumInfo) scanNumber(seenDecimalPoint bool) error { + p.base = 10 + + if seenDecimalPoint { + p.isFloat = true + if !p.scanMantissa(10) { + return p.errorf("illegal fraction %q", p.src) + } + goto exponent + } + + if p.ch == '0' { + // int or float + p.next() + switch p.ch { + case 'x', 'X': + p.base = 16 + // hexadecimal int + p.next() + if !p.scanMantissa(16) { + // only scanned "0x" or "0X" + return p.errorf("illegal hexadecimal number %q", p.src) + } + case 'b': + p.base = 2 + // binary int + p.next() + if !p.scanMantissa(2) { + // only scanned "0b" + return p.errorf("illegal binary number %q", p.src) + } + case 'o': + p.base = 8 + // octal int + p.next() + if !p.scanMantissa(8) { + // only scanned "0o" + return p.errorf("illegal octal number %q", p.src) + } + default: + // int (base 8 or 10) or float + p.scanMantissa(8) + if p.ch == '8' || p.ch == '9' { + p.scanMantissa(10) + if p.ch != '.' && p.ch != 'e' && p.ch != 'E' { + return p.errorf("illegal integer number %q", p.src) + } + } + switch p.ch { + case 'e', 'E': + if len(p.buf) == 0 { + p.buf = append(p.buf, '0') + } + fallthrough + case '.': + goto fraction + } + if len(p.buf) > 0 { + p.base = 8 + } + } + goto exit + } + + // decimal int or float + if !p.scanMantissa(10) { + return p.errorf("illegal number start %q", p.src) + } + +fraction: + if p.ch == '.' { + p.isFloat = true + p.next() + p.scanMantissa(10) + } + +exponent: + switch p.ch { + case 'K', 'M', 'G', 'T', 'P': + p.mul = charToMul[p.ch] + p.next() + if p.ch == 'i' { + p.mul |= mulBin + p.next() + } else { + p.mul |= mulDec + } + var v apd.Decimal + p.isFloat = false + return p.decimal(&v) + + case 'e', 'E': + p.isFloat = true + p.next() + p.buf = append(p.buf, 'e') + if p.ch == '-' || p.ch == '+' { + p.buf = append(p.buf, p.ch) + p.next() + } + if !p.scanMantissa(10) { + return p.errorf("illegal exponent %q", p.src) + } + } + +exit: + return nil +} + +var charToMul = map[byte]Multiplier{ + 'K': mul1, + 'M': mul2, + 'G': mul3, + 'T': mul4, + 'P': mul5, + 'E': mul6, + 'Z': mul7, + 'Y': mul8, +} + +var mulToRat = map[Multiplier]*apd.Decimal{} + +func init() { + d := apd.New(1, 0) + b := apd.New(1, 0) + dm := apd.New(1000, 0) + bm := apd.New(1024, 0) + + c := apd.BaseContext + for i := Multiplier(1); int(i) < len(charToMul); i++ { + // TODO: may we write to one of the sources? + var bn, dn apd.Decimal + _, _ = c.Mul(&dn, d, dm) + d = &dn + _, _ = c.Mul(&bn, b, bm) + b = &bn + mulToRat[mulDec|i] = d + mulToRat[mulBin|i] = b + } +} diff --git a/vendor/cuelang.org/go/cue/literal/quote.go b/vendor/cuelang.org/go/cue/literal/quote.go new file mode 100644 index 0000000000..9cbe6e82f9 --- /dev/null +++ b/vendor/cuelang.org/go/cue/literal/quote.go @@ -0,0 +1,370 @@ +// Copyright 2020 CUE Authors +// +// 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 literal + +import ( + "strconv" + "strings" + "unicode/utf8" +) + +// Form defines how to quote a string or bytes literal. +type Form struct { + hashCount int + quote byte + multiline bool + auto bool + exact bool + asciiOnly bool + graphicOnly bool + indent string + tripleQuote string +} + +// TODO: +// - Fixed or max level of escape modifiers (#""#). +// - Option to fall back to bytes if value cannot be represented as string. +// E.g. ExactString. +// - QuoteExact that fails with an error if a string cannot be represented +// without loss. +// - Handle auto-breaking for long lines (Swift-style, \-terminated lines). +// This is not supported yet in CUE, but may, and should be considered as +// a possibility in API design. +// - Other possible convenience forms: Blob (auto-break bytes), String (bytes +// or string), Label. + +// WithTabIndent returns a new Form with indentation set to the given number +// of tabs. The result will be a multiline string. +func (f Form) WithTabIndent(n int) Form { + f.indent = tabs(n) + f.multiline = true + return f +} + +const tabIndent = "\t\t\t\t\t\t\t\t\t\t\t\t" + +func tabs(n int) string { + if n < len(tabIndent) { + return tabIndent[:n] + } + return strings.Repeat("\t", n) +} + +// WithOptionalIndent is like WithTabIndent, but only returns a multiline +// strings if it doesn't contain any newline characters. +func (f Form) WithOptionalTabIndent(tabs int) Form { + if tabs < len(tabIndent) { + f.indent = tabIndent[:tabs] + } else { + f.indent = strings.Repeat("\t", tabs) + } + f.auto = true + return f +} + +// WithASCIIOnly ensures the quoted strings consists solely of valid ASCII +// characters. +func (f Form) WithASCIIOnly() Form { + f.asciiOnly = true + return f +} + +// WithGraphicOnly ensures the quoted strings consists solely of printable +// characters. +func (f Form) WithGraphicOnly() Form { + f.graphicOnly = true + return f +} + +var ( + // String defines the format of a CUE string. Conversions may be lossy. + String Form = stringForm + + // TODO: ExactString: quotes to bytes type if the string cannot be + // represented without loss of accuracy. + + // Label is like Text, but optimized for labels. + Label Form = stringForm + + // Bytes defines the format of bytes literal. + Bytes Form = bytesForm + + stringForm = Form{ + quote: '"', + tripleQuote: `"""`, + } + bytesForm = Form{ + quote: '\'', + tripleQuote: `'''`, + exact: true, + } +) + +// Quote returns CUE string literal representing s. The returned string uses CUE +// escape sequences (\t, \n, \u00FF, \u0100) for control characters and +// non-printable characters as defined by strconv.IsPrint. +// +// It reports an error if the string cannot be converted to the desired form. +func (f Form) Quote(s string) string { + return string(f.Append(make([]byte, 0, 3*len(s)/2), s)) +} + +const ( + lowerhex = "0123456789abcdef" +) + +// Append appends a CUE string literal representing s, as generated by Quote, to +// buf and returns the extended buffer. +func (f Form) Append(buf []byte, s string) []byte { + if f.auto && strings.ContainsRune(s, '\n') { + f.multiline = true + } + if f.multiline { + f.hashCount = f.requiredHashCount(s) + } + + // Often called with big strings, so preallocate. If there's quoting, + // this is conservative but still helps a lot. + if cap(buf)-len(buf) < len(s) { + nBuf := make([]byte, len(buf), len(buf)+1+len(s)+1) + copy(nBuf, buf) + buf = nBuf + } + for i := 0; i < f.hashCount; i++ { + buf = append(buf, '#') + } + if f.multiline { + buf = append(buf, f.quote, f.quote, f.quote, '\n') + if s == "" { + buf = append(buf, f.indent...) + buf = append(buf, f.quote, f.quote, f.quote) + return buf + } + if len(s) > 0 && s[0] != '\n' { + buf = append(buf, f.indent...) + } + } else { + buf = append(buf, f.quote) + } + + buf = f.appendEscaped(buf, s) + + if f.multiline { + buf = append(buf, '\n') + buf = append(buf, f.indent...) + buf = append(buf, f.quote, f.quote, f.quote) + } else { + buf = append(buf, f.quote) + } + for i := 0; i < f.hashCount; i++ { + buf = append(buf, '#') + } + + return buf +} + +// AppendEscaped appends a CUE string literal representing s, as generated by +// Quote but without the quotes, to buf and returns the extended buffer. +// +// It does not include the last indentation. +func (f Form) AppendEscaped(buf []byte, s string) []byte { + if f.auto && strings.ContainsRune(s, '\n') { + f.multiline = true + } + + // Often called with big strings, so preallocate. If there's quoting, + // this is conservative but still helps a lot. + if cap(buf)-len(buf) < len(s) { + nBuf := make([]byte, len(buf), len(buf)+1+len(s)+1) + copy(nBuf, buf) + buf = nBuf + } + + buf = f.appendEscaped(buf, s) + + return buf +} + +func (f Form) appendEscaped(buf []byte, s string) []byte { + for width := 0; len(s) > 0; s = s[width:] { + r := rune(s[0]) + width = 1 + if r >= utf8.RuneSelf { + r, width = utf8.DecodeRuneInString(s) + } + if f.exact && width == 1 && r == utf8.RuneError { + buf = append(buf, `\x`...) + buf = append(buf, lowerhex[s[0]>>4]) + buf = append(buf, lowerhex[s[0]&0xF]) + continue + } + if f.multiline && r == '\n' { + buf = append(buf, '\n') + if len(s) > 1 && s[1] != '\n' { + buf = append(buf, f.indent...) + } + continue + } + buf = f.appendEscapedRune(buf, r) + } + return buf +} + +func (f *Form) appendEscapedRune(buf []byte, r rune) []byte { + var runeTmp [utf8.UTFMax]byte + if (!f.multiline && r == rune(f.quote)) || r == '\\' { // always backslashed + buf = f.appendEscape(buf) + buf = append(buf, byte(r)) + return buf + } + if f.asciiOnly { + if r < utf8.RuneSelf && strconv.IsPrint(r) { + buf = append(buf, byte(r)) + return buf + } + } else if strconv.IsPrint(r) || f.graphicOnly && isInGraphicList(r) { + n := utf8.EncodeRune(runeTmp[:], r) + buf = append(buf, runeTmp[:n]...) + return buf + } + buf = f.appendEscape(buf) + switch r { + case '\a': + buf = append(buf, 'a') + case '\b': + buf = append(buf, 'b') + case '\f': + buf = append(buf, 'f') + case '\n': + buf = append(buf, 'n') + case '\r': + buf = append(buf, 'r') + case '\t': + buf = append(buf, 't') + case '\v': + buf = append(buf, 'v') + default: + switch { + case r < ' ' && f.exact: + buf = append(buf, 'x') + buf = append(buf, lowerhex[byte(r)>>4]) + buf = append(buf, lowerhex[byte(r)&0xF]) + case r > utf8.MaxRune: + r = 0xFFFD + fallthrough + case r < 0x10000: + buf = append(buf, 'u') + for s := 12; s >= 0; s -= 4 { + buf = append(buf, lowerhex[r>>uint(s)&0xF]) + } + default: + buf = append(buf, 'U') + for s := 28; s >= 0; s -= 4 { + buf = append(buf, lowerhex[r>>uint(s)&0xF]) + } + } + } + return buf +} + +func (f *Form) appendEscape(buf []byte) []byte { + buf = append(buf, '\\') + for i := 0; i < f.hashCount; i++ { + buf = append(buf, '#') + } + return buf +} + +// requiredHashCount returns the number of # characters +// that are required to quote the multiline string s. +func (f *Form) requiredHashCount(s string) int { + hashCount := 0 + i := 0 + // Find all occurrences of the triple-quote and count + // the maximum number of succeeding # characters. + for { + j := strings.Index(s[i:], f.tripleQuote) + if j == -1 { + break + } + i += j + 3 + // Absorb all extra quotes, so we + // get to the end of the sequence. + for ; i < len(s); i++ { + if s[i] != f.quote { + break + } + } + e := i - 1 + // Count succeeding # characters. + for ; i < len(s); i++ { + if s[i] != '#' { + break + } + } + if nhash := i - e; nhash > hashCount { + hashCount = nhash + } + } + return hashCount +} + +// isInGraphicList reports whether the rune is in the isGraphic list. This separation +// from IsGraphic allows quoteWith to avoid two calls to IsPrint. +// Should be called only if IsPrint fails. +func isInGraphicList(r rune) bool { + // We know r must fit in 16 bits - see makeisprint.go. + if r > 0xFFFF { + return false + } + rr := uint16(r) + i := bsearch16(isGraphic, rr) + return i < len(isGraphic) && rr == isGraphic[i] +} + +// bsearch16 returns the smallest i such that a[i] >= x. +// If there is no such i, bsearch16 returns len(a). +func bsearch16(a []uint16, x uint16) int { + i, j := 0, len(a) + for i < j { + h := i + (j-i)/2 + if a[h] < x { + i = h + 1 + } else { + j = h + } + } + return i +} + +// isGraphic lists the graphic runes not matched by IsPrint. +var isGraphic = []uint16{ + 0x00a0, + 0x1680, + 0x2000, + 0x2001, + 0x2002, + 0x2003, + 0x2004, + 0x2005, + 0x2006, + 0x2007, + 0x2008, + 0x2009, + 0x200a, + 0x202f, + 0x205f, + 0x3000, +} diff --git a/vendor/cuelang.org/go/cue/literal/string.go b/vendor/cuelang.org/go/cue/literal/string.go new file mode 100644 index 0000000000..59fae0a60e --- /dev/null +++ b/vendor/cuelang.org/go/cue/literal/string.go @@ -0,0 +1,421 @@ +// Copyright 2019 CUE Authors +// +// 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 literal + +import ( + "errors" + "strings" + "unicode" + "unicode/utf8" +) + +var ( + errSyntax = errors.New("invalid syntax") + errInvalidWhitespace = errors.New("invalid string: invalid whitespace") + errMissingNewline = errors.New( + "invalid string: opening quote of multiline string must be followed by newline") + errUnmatchedQuote = errors.New("invalid string: unmatched quote") + // TODO: making this an error is optional according to RFC 4627. But we + // could make it not an error if this ever results in an issue. + errSurrogate = errors.New("unmatched surrogate pair") +) + +// Unquote interprets s as a single- or double-quoted, single- or multi-line +// string, possibly with custom escape delimiters, returning the string value +// that s quotes. +func Unquote(s string) (string, error) { + info, nStart, _, err := ParseQuotes(s, s) + if err != nil { + return "", err + } + s = s[nStart:] + return info.Unquote(s) +} + +// QuoteInfo describes the type of quotes used for a string. +type QuoteInfo struct { + quote string + whitespace string + numHash int + multiline bool + char byte + numChar byte +} + +// IsDouble reports whether the literal uses double quotes. +func (q QuoteInfo) IsDouble() bool { + return q.char == '"' +} + +// IsMulti reports whether a multi-line string was parsed. +func (q QuoteInfo) IsMulti() bool { + return q.multiline +} + +// Whitespace returns prefix whitespace for multiline strings. +func (q QuoteInfo) Whitespace() string { + return q.whitespace +} + +// ParseQuotes checks if the opening quotes in start matches the ending quotes +// in end and reports its type as q or an error if they do not matching or are +// invalid. nStart indicates the number of bytes used for the opening quote. +func ParseQuotes(start, end string) (q QuoteInfo, nStart, nEnd int, err error) { + for i, c := range start { + if c != '#' { + break + } + q.numHash = i + 1 + } + s := start[q.numHash:] + switch s[0] { + case '"', '\'': + q.char = s[0] + if len(s) > 3 && s[1] == s[0] && s[2] == s[0] { + switch s[3] { + case '\n': + q.quote = start[:3+q.numHash] + case '\r': + if len(s) > 4 && s[4] == '\n' { + q.quote = start[:4+q.numHash] + break + } + fallthrough + default: + return q, 0, 0, errMissingNewline + } + q.multiline = true + q.numChar = 3 + nStart = len(q.quote) + 1 // add whitespace later + } else { + q.quote = start[:1+q.numHash] + q.numChar = 1 + nStart = len(q.quote) + } + default: + return q, 0, 0, errSyntax + } + quote := start[:int(q.numChar)+q.numHash] + for i := 0; i < len(quote); i++ { + if j := len(end) - i - 1; j < 0 || quote[i] != end[j] { + return q, 0, 0, errUnmatchedQuote + } + } + if q.multiline { + i := len(end) - len(quote) + for i > 0 { + r, size := utf8.DecodeLastRuneInString(end[:i]) + if r == '\n' || !unicode.IsSpace(r) { + break + } + i -= size + } + q.whitespace = end[i : len(end)-len(quote)] + + if len(start) > nStart && start[nStart] != '\n' { + if !strings.HasPrefix(start[nStart:], q.whitespace) { + return q, 0, 0, errInvalidWhitespace + } + nStart += len(q.whitespace) + } + } + + return q, nStart, int(q.numChar) + q.numHash, nil +} + +// Unquote unquotes the given string. It must be terminated with a quote or an +// interpolation start. Escape sequences are expanded and surrogates +// are replaced with the corresponding non-surrogate code points. +func (q QuoteInfo) Unquote(s string) (string, error) { + if len(s) > 0 && !q.multiline { + if contains(s, '\n') || contains(s, '\r') { + return "", errSyntax + } + + // Is it trivial? Avoid allocation. + if s[len(s)-1] == q.char && q.numHash == 0 { + if s := s[:len(s)-1]; isSimple(s, rune(q.char)) { + return s, nil + } + } + } + + var runeTmp [utf8.UTFMax]byte + buf := make([]byte, 0, 3*len(s)/2) // Try to avoid more allocations. + stripNL := false + for len(s) > 0 { + switch s[0] { + case '\r': + s = s[1:] + continue + case '\n': + switch { + case !q.multiline: + fallthrough + default: + return "", errInvalidWhitespace + case strings.HasPrefix(s[1:], q.whitespace): + s = s[1+len(q.whitespace):] + case strings.HasPrefix(s[1:], "\n"): + s = s[1:] + } + stripNL = true + buf = append(buf, '\n') + continue + } + c, multibyte, ss, err := unquoteChar(s, q) + if surHigh <= c && c < surEnd { + if c >= surLow { + return "", errSurrogate + } + var cl rune + cl, _, ss, err = unquoteChar(ss, q) + if cl < surLow || surEnd <= cl { + return "", errSurrogate + } + c = 0x10000 + (c-surHigh)*0x400 + (cl - surLow) + } + + if err != nil { + return "", err + } + + s = ss + if c < 0 { + if c == -2 { + stripNL = false + } + if stripNL { + // Strip the last newline, but only if it came from a closing + // quote. + buf = buf[:len(buf)-1] + } + return string(buf), nil + } + stripNL = false + if c < utf8.RuneSelf || !multibyte { + buf = append(buf, byte(c)) + } else { + n := utf8.EncodeRune(runeTmp[:], c) + buf = append(buf, runeTmp[:n]...) + } + } + // allow unmatched quotes if already checked. + return "", errUnmatchedQuote +} + +const ( + surHigh = 0xD800 + surLow = 0xDC00 + surEnd = 0xE000 +) + +func isSimple(s string, quote rune) bool { + // TODO(perf): check if using a simple DFA to detect surrogate pairs is + // faster than converting to code points. At the very least there should + // be an ASCII fast path. + for _, r := range s { + if r == quote || r == '\\' { + return false + } + if surHigh <= r && r < surEnd { + return false + } + } + return true +} + +// contains reports whether the string contains the byte c. +func contains(s string, c byte) bool { + for i := 0; i < len(s); i++ { + if s[i] == c { + return true + } + } + return false +} + +// unquoteChar decodes the first character or byte in the escaped string. +// It returns four values: +// +// 1) value, the decoded Unicode code point or byte value; the special value +// of -1 indicates terminated by quotes and -2 means terminated by \(. +// 2) multibyte, a boolean indicating whether the decoded character requires a multibyte UTF-8 representation; +// 3) tail, the remainder of the string after the character; and +// 4) an error that will be nil if the character is syntactically valid. +// +// The second argument, kind, specifies the type of literal being parsed +// and therefore which kind of escape sequences are permitted. +// For kind 's' only JSON escapes and \u{ are permitted. +// For kind 'b' also hexadecimal and octal escape sequences are permitted. +// +// The third argument, quote, specifies that an ASCII quoting character that +// is not permitted in the output. +func unquoteChar(s string, info QuoteInfo) (value rune, multibyte bool, tail string, err error) { + // easy cases + switch c := s[0]; { + case c == info.char && info.char != 0: + for i := 1; byte(i) < info.numChar; i++ { + if i >= len(s) || s[i] != info.char { + return rune(info.char), false, s[1:], nil + } + } + for i := 0; i < info.numHash; i++ { + if i+int(info.numChar) >= len(s) || s[i+int(info.numChar)] != '#' { + return rune(info.char), false, s[1:], nil + } + } + if ln := int(info.numChar) + info.numHash; len(s) != ln { + // TODO: terminating quote in middle of string + return 0, false, s[ln:], errSyntax + } + return -1, false, "", nil + case c >= utf8.RuneSelf: + // TODO: consider handling surrogate values. These are discarded by + // DecodeRuneInString. It is technically correct to disallow it, but + // some JSON parsers allow this anyway. + r, size := utf8.DecodeRuneInString(s) + return r, true, s[size:], nil + case c != '\\': + return rune(s[0]), false, s[1:], nil + } + + if len(s) <= 1+info.numHash { + return '\\', false, s[1:], nil + } + for i := 1; i <= info.numHash && i < len(s); i++ { + if s[i] != '#' { + return '\\', false, s[1:], nil + } + } + + c := s[1+info.numHash] + s = s[2+info.numHash:] + + switch c { + case 'a': + value = '\a' + case 'b': + value = '\b' + case 'f': + value = '\f' + case 'n': + value = '\n' + case 'r': + value = '\r' + case 't': + value = '\t' + case 'v': + value = '\v' + case '/': + value = '/' + case 'x', 'u', 'U': + n := 0 + switch c { + case 'x': + n = 2 + case 'u': + n = 4 + case 'U': + n = 8 + } + var v rune + if len(s) < n { + err = errSyntax + return + } + for j := 0; j < n; j++ { + x, ok := unhex(s[j]) + if !ok { + err = errSyntax + return + } + v = v<<4 | x + } + s = s[n:] + if c == 'x' { + if info.char == '"' { + err = errSyntax + return + } + // single-byte string, possibly not UTF-8 + value = v + break + } + if v > utf8.MaxRune { + err = errSyntax + return + } + value = v + multibyte = true + case '0', '1', '2', '3', '4', '5', '6', '7': + if info.char == '"' { + err = errSyntax + return + } + v := rune(c) - '0' + if len(s) < 2 { + err = errSyntax + return + } + for j := 0; j < 2; j++ { // one digit already; two more + x := rune(s[j]) - '0' + if x < 0 || x > 7 { + err = errSyntax + return + } + v = (v << 3) | x + } + s = s[2:] + if v > 255 { + err = errSyntax + return + } + value = v + case '\\': + value = '\\' + case '\'', '"': + // TODO: should we allow escaping of quotes regardless? + if c != info.char { + err = errSyntax + return + } + value = rune(c) + case '(': + if s != "" { + // TODO: terminating quote in middle of string + return 0, false, s, errSyntax + } + value = -2 + default: + err = errSyntax + return + } + tail = s + return +} + +func unhex(b byte) (v rune, ok bool) { + c := rune(b) + switch { + case '0' <= c && c <= '9': + return c - '0', true + case 'a' <= c && c <= 'f': + return c - 'a' + 10, true + case 'A' <= c && c <= 'F': + return c - 'A' + 10, true + } + return +} diff --git a/vendor/cuelang.org/go/cue/marshal.go b/vendor/cuelang.org/go/cue/marshal.go new file mode 100644 index 0000000000..43ca6d4639 --- /dev/null +++ b/vendor/cuelang.org/go/cue/marshal.go @@ -0,0 +1,221 @@ +// Copyright 2019 CUE Authors +// +// 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 cue + +import ( + "bytes" + "compress/gzip" + "encoding/gob" + "path/filepath" + "strings" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/ast/astutil" + "cuelang.org/go/cue/build" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/format" + "cuelang.org/go/cue/token" + "cuelang.org/go/internal" + "cuelang.org/go/internal/core/export" +) + +// root. +type instanceData struct { + Root bool + Path string + Files []fileData +} + +type fileData struct { + Name string + Data []byte +} + +const version = 1 + +type unmarshaller struct { + ctxt *build.Context + imports map[string]*instanceData +} + +func (b *unmarshaller) load(pos token.Pos, path string) *build.Instance { + bi := b.imports[path] + if bi == nil { + return nil + } + return b.build(bi) +} + +func (b *unmarshaller) build(bi *instanceData) *build.Instance { + p := b.ctxt.NewInstance(bi.Path, b.load) + p.ImportPath = bi.Path + for _, f := range bi.Files { + _ = p.AddFile(f.Name, f.Data) + } + p.Complete() + return p +} + +func compileInstances(r *Runtime, data []*instanceData) (instances []*Instance, err error) { + b := unmarshaller{ + ctxt: build.NewContext(), + imports: map[string]*instanceData{}, + } + for _, i := range data { + if i.Path == "" { + if !i.Root { + return nil, errors.Newf(token.NoPos, + "data contains non-root package without import path") + } + continue + } + b.imports[i.Path] = i + } + + builds := []*build.Instance{} + for _, i := range data { + if !i.Root { + continue + } + builds = append(builds, b.build(i)) + } + + return r.build(builds) +} + +// Unmarshal creates an Instance from bytes generated by the MarshalBinary +// method of an instance. +func (r *Runtime) Unmarshal(b []byte) ([]*Instance, error) { + if len(b) == 0 { + return nil, errors.Newf(token.NoPos, "unmarshal failed: empty buffer") + } + + switch b[0] { + case version: + default: + return nil, errors.Newf(token.NoPos, + "unmarshal failed: unsupported version %d, regenerate data", b[0]) + } + + reader, err := gzip.NewReader(bytes.NewReader(b[1:])) + if err != nil { + return nil, errors.Newf(token.NoPos, "unmarshal failed: %v", err) + } + + data := []*instanceData{} + err = gob.NewDecoder(reader).Decode(&data) + if err != nil { + return nil, errors.Newf(token.NoPos, "unmarshal failed: %v", err) + } + + return compileInstances(r, data) +} + +// Marshal creates bytes from a group of instances. Imported instances will +// be included in the emission. +// +// The stored instances are functionally the same, but preserving of file +// information is only done on a best-effort basis. +func (r *Runtime) Marshal(instances ...*Instance) (b []byte, err error) { + staged := []instanceData{} + done := map[string]int{} + + var errs errors.Error + + var stageInstance func(i *Instance) (pos int) + stageInstance = func(i *Instance) (pos int) { + if p, ok := done[i.ImportPath]; ok { + return p + } + // TODO: support exporting instance + file, _ := export.Def(r.runtime(), i.inst.ID(), i.root) + imports := []string{} + file.VisitImports(func(i *ast.ImportDecl) { + for _, spec := range i.Specs { + info, _ := astutil.ParseImportSpec(spec) + imports = append(imports, info.ID) + } + }) + + if i.PkgName != "" { + p, name, _ := internal.PackageInfo(file) + if p == nil { + pkg := &ast.Package{Name: ast.NewIdent(i.PkgName)} + file.Decls = append([]ast.Decl{pkg}, file.Decls...) + } else if name != i.PkgName { + // p is guaranteed to be generated by Def, so it is "safe" to + // modify. + p.Name = ast.NewIdent(i.PkgName) + } + } + + b, err := format.Node(file) + errs = errors.Append(errs, errors.Promote(err, "marshal")) + + filename := "unmarshal" + if i.inst != nil && len(i.inst.Files) == 1 { + filename = i.inst.Files[0].Filename + + dir := i.Dir + if i.inst != nil && i.inst.Root != "" { + dir = i.inst.Root + } + if dir != "" { + filename = filepath.FromSlash(filename) + filename, _ = filepath.Rel(dir, filename) + filename = filepath.ToSlash(filename) + } + } + // TODO: this should probably be changed upstream, but as the path + // is for reference purposes only, this is safe. + importPath := filepath.ToSlash(i.ImportPath) + + staged = append(staged, instanceData{ + Path: importPath, + Files: []fileData{{filename, b}}, + }) + + p := len(staged) - 1 + + for _, imp := range imports { + i := getImportFromPath(r.runtime(), imp) + if i == nil || !strings.Contains(imp, ".") { + continue // a builtin package. + } + stageInstance(i) + } + + return p + } + + for _, i := range instances { + staged[stageInstance(i)].Root = true + } + + buf := &bytes.Buffer{} + buf.WriteByte(version) + + zw := gzip.NewWriter(buf) + if err := gob.NewEncoder(zw).Encode(staged); err != nil { + return nil, err + } + + if err := zw.Close(); err != nil { + return nil, err + } + + return buf.Bytes(), nil + +} diff --git a/vendor/cuelang.org/go/cue/op.go b/vendor/cuelang.org/go/cue/op.go new file mode 100644 index 0000000000..22b31a5d12 --- /dev/null +++ b/vendor/cuelang.org/go/cue/op.go @@ -0,0 +1,182 @@ +// Copyright 2018 The CUE Authors +// +// 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 cue + +import ( + "cuelang.org/go/cue/token" + "cuelang.org/go/internal/core/adt" +) + +// Op indicates the operation at the top of an expression tree of the expression +// use to evaluate a value. +type Op = adt.Op + +// Values of Op. +const ( + NoOp Op = adt.NoOp + + AndOp Op = adt.AndOp + OrOp Op = adt.OrOp + + SelectorOp Op = adt.SelectorOp + IndexOp Op = adt.IndexOp + SliceOp Op = adt.SliceOp + CallOp Op = adt.CallOp + + BooleanAndOp Op = adt.BoolAndOp + BooleanOrOp Op = adt.BoolOrOp + + EqualOp Op = adt.EqualOp + NotOp Op = adt.NotOp + NotEqualOp Op = adt.NotEqualOp + LessThanOp Op = adt.LessThanOp + LessThanEqualOp Op = adt.LessEqualOp + GreaterThanOp Op = adt.GreaterThanOp + GreaterThanEqualOp Op = adt.GreaterEqualOp + + RegexMatchOp Op = adt.MatchOp + NotRegexMatchOp Op = adt.NotMatchOp + + AddOp Op = adt.AddOp + SubtractOp Op = adt.SubtractOp + MultiplyOp Op = adt.MultiplyOp + FloatQuotientOp Op = adt.FloatQuotientOp + IntQuotientOp Op = adt.IntQuotientOp + IntRemainderOp Op = adt.IntRemainderOp + IntDivideOp Op = adt.IntDivideOp + IntModuloOp Op = adt.IntModuloOp + + InterpolationOp Op = adt.InterpolationOp +) + +// isCmp reports whether an op is a comparator. +func (op op) isCmp() bool { + return opEql <= op && op <= opGeq +} + +func (op op) unifyType() (unchecked, ok bool) { + if op == opUnifyUnchecked { + return true, true + } + return false, op == opUnify +} + +type op uint16 + +const ( + opUnknown op = iota + + opUnify + opUnifyUnchecked + opDisjunction + + opLand + opLor + opNot + + opEql + opNeq + opMat + opNMat + + opLss + opGtr + opLeq + opGeq + + opAdd + opSub + opMul + opQuo + opRem + + opIDiv + opIMod + opIQuo + opIRem +) + +var opStrings = []string{ + opUnknown: "??", + + opUnify: "&", + // opUnifyUnchecked is internal only. Syntactically this is + // represented as embedding. + opUnifyUnchecked: "&!", + opDisjunction: "|", + + opLand: "&&", + opLor: "||", + opNot: "!", + + opEql: "==", + opNeq: "!=", + opMat: "=~", + opNMat: "!~", + + opLss: "<", + opGtr: ">", + opLeq: "<=", + opGeq: ">=", + + opAdd: "+", + opSub: "-", + opMul: "*", + opQuo: "/", + + opIDiv: "div", + opIMod: "mod", + opIQuo: "quo", + opIRem: "rem", +} + +func (op op) String() string { return opStrings[op] } + +var tokenMap = map[token.Token]op{ + token.OR: opDisjunction, // | + token.AND: opUnify, // & + + token.ADD: opAdd, // + + token.SUB: opSub, // - + token.MUL: opMul, // * + token.QUO: opQuo, // / + + token.IDIV: opIDiv, // div + token.IMOD: opIMod, // mod + token.IQUO: opIQuo, // quo + token.IREM: opIRem, // rem + + token.LAND: opLand, // && + token.LOR: opLor, // || + + token.EQL: opEql, // == + token.LSS: opLss, // < + token.GTR: opGtr, // > + token.NOT: opNot, // ! + + token.NEQ: opNeq, // != + token.LEQ: opLeq, // <= + token.GEQ: opGeq, // >= + token.MAT: opMat, // =~ + token.NMAT: opNMat, // !~ +} + +var opMap = map[op]token.Token{} + +func init() { + for t, o := range tokenMap { + opMap[o] = t + } +} diff --git a/vendor/cuelang.org/go/cue/parser/doc.go b/vendor/cuelang.org/go/cue/parser/doc.go new file mode 100644 index 0000000000..adde13989b --- /dev/null +++ b/vendor/cuelang.org/go/cue/parser/doc.go @@ -0,0 +1,23 @@ +// Copyright 2018 The CUE Authors +// +// 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 parser implements a parser for CUE source files. Input may be +// provided in a variety of forms (see the various Parse* functions); the output +// is an abstract syntax tree (AST) representing the CUE source. The parser is +// invoked through one of the Parse* functions. +// +// The parser accepts a larger language than is syntactically permitted by the +// CUE spec, for simplicity, and for improved robustness in the presence of +// syntax errors. +package parser // import "cuelang.org/go/cue/parser" diff --git a/vendor/cuelang.org/go/cue/parser/fuzz.go b/vendor/cuelang.org/go/cue/parser/fuzz.go new file mode 100644 index 0000000000..21a1d087d6 --- /dev/null +++ b/vendor/cuelang.org/go/cue/parser/fuzz.go @@ -0,0 +1,26 @@ +// Copyright 2019 CUE Authors +// +// 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. + +//go:build gofuzz +// +build gofuzz + +package parser + +func Fuzz(b []byte) int { + _, err := ParseFile("go-fuzz", b) + if err != nil { + return 0 + } + return 1 +} diff --git a/vendor/cuelang.org/go/cue/parser/interface.go b/vendor/cuelang.org/go/cue/parser/interface.go new file mode 100644 index 0000000000..8695a6c34a --- /dev/null +++ b/vendor/cuelang.org/go/cue/parser/interface.go @@ -0,0 +1,232 @@ +// Copyright 2018 The CUE Authors +// +// 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. + +// This file contains the exported entry points for invoking the + +package parser + +import ( + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/ast/astutil" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/token" + "cuelang.org/go/internal/source" +) + +// Option specifies a parse option. +type Option func(p *parser) + +var ( + // PackageClauseOnly causes parsing to stop after the package clause. + PackageClauseOnly Option = packageClauseOnly + packageClauseOnly = func(p *parser) { + p.mode |= packageClauseOnlyMode + } + + // ImportsOnly causes parsing to stop parsing after the import declarations. + ImportsOnly Option = importsOnly + importsOnly = func(p *parser) { + p.mode |= importsOnlyMode + } + + // ParseComments causes comments to be parsed. + ParseComments Option = parseComments + parseComments = func(p *parser) { + p.mode |= parseCommentsMode + } + + // Trace causes parsing to print a trace of parsed productions. + Trace Option = traceOpt + traceOpt = func(p *parser) { + p.mode |= traceMode + } + + // DeclarationErrors causes parsing to report declaration errors. + DeclarationErrors Option = declarationErrors + declarationErrors = func(p *parser) { + p.mode |= declarationErrorsMode + } + + // AllErrors causes all errors to be reported (not just the first 10 on different lines). + AllErrors Option = allErrors + allErrors = func(p *parser) { + p.mode |= allErrorsMode + } + + // AllowPartial allows the parser to be used on a prefix buffer. + AllowPartial Option = allowPartial + allowPartial = func(p *parser) { + p.mode |= partialMode + } +) + +// FromVersion specifies until which legacy version the parser should provide +// backwards compatibility. +func FromVersion(version int) Option { + if version >= 0 { + version++ + } + // Versions: + // <0: major version 0 (counting -1000 + x, where x = 100*m+p in 0.m.p + // >=0: x+1 in 1.x.y + return func(p *parser) { p.version = version } +} + +func version0(minor, patch int) int { + return -1000 + 100*minor + patch +} + +// DeprecationError is a sentinel error to indicate that an error is +// related to an unsupported old CUE syntax. +type DeprecationError struct { + Version int +} + +func (e *DeprecationError) Error() string { + return "try running `cue fix` (possibly with an earlier version, like v0.2.2) to upgrade" +} + +// Latest specifies the latest version of the parser, effectively setting +// the strictest implementation. +const Latest = latest + +const latest = -600 + +// FileOffset specifies the File position info to use. +func FileOffset(pos int) Option { + return func(p *parser) { p.offset = pos } +} + +// A mode value is a set of flags (or 0). +// They control the amount of source code parsed and other optional +// parser functionality. +type mode uint + +const ( + packageClauseOnlyMode mode = 1 << iota // stop parsing after package clause + importsOnlyMode // stop parsing after import declarations + parseCommentsMode // parse comments and add them to AST + partialMode + traceMode // print a trace of parsed productions + declarationErrorsMode // report declaration errors + allErrorsMode // report all errors (not just the first 10 on different lines) +) + +// ParseFile parses the source code of a single CUE source file and returns +// the corresponding File node. The source code may be provided via +// the filename of the source file, or via the src parameter. +// +// If src != nil, ParseFile parses the source from src and the filename is +// only used when recording position information. The type of the argument +// for the src parameter must be string, []byte, or io.Reader. +// If src == nil, ParseFile parses the file specified by filename. +// +// The mode parameter controls the amount of source text parsed and other +// optional parser functionality. Position information is recorded in the +// file set fset, which must not be nil. +// +// If the source couldn't be read, the returned AST is nil and the error +// indicates the specific failure. If the source was read but syntax +// errors were found, the result is a partial AST (with Bad* nodes +// representing the fragments of erroneous source code). Multiple errors +// are returned via a ErrorList which is sorted by file position. +func ParseFile(filename string, src interface{}, mode ...Option) (f *ast.File, err error) { + + // get source + text, err := source.Read(filename, src) + if err != nil { + return nil, err + } + + var pp parser + defer func() { + if pp.panicking { + _ = recover() + } + + // set result values + if f == nil { + // source is not a valid Go source file - satisfy + // ParseFile API and return a valid (but) empty + // *File + f = &ast.File{ + // Scope: NewScope(nil), + } + } + + err = errors.Sanitize(pp.errors) + }() + + // parse source + pp.init(filename, text, mode) + f = pp.parseFile() + if f == nil { + return nil, pp.errors + } + f.Filename = filename + astutil.Resolve(f, pp.errf) + + return f, pp.errors +} + +// ParseExpr is a convenience function for parsing an expression. +// The arguments have the same meaning as for Parse, but the source must +// be a valid CUE (type or value) expression. Specifically, fset must not +// be nil. +func ParseExpr(filename string, src interface{}, mode ...Option) (ast.Expr, error) { + // get source + text, err := source.Read(filename, src) + if err != nil { + return nil, err + } + + var p parser + defer func() { + if p.panicking { + _ = recover() + } + err = errors.Sanitize(p.errors) + }() + + // parse expr + p.init(filename, text, mode) + // Set up pkg-level scopes to avoid nil-pointer errors. + // This is not needed for a correct expression x as the + // parser will be ok with a nil topScope, but be cautious + // in case of an erroneous x. + e := p.parseRHS() + + // If a comma was inserted, consume it; + // report an error if there's more tokens. + if p.tok == token.COMMA && p.lit == "\n" { + p.next() + } + if p.mode&partialMode == 0 { + p.expect(token.EOF) + } + + if p.errors != nil { + return nil, p.errors + } + astutil.ResolveExpr(e, p.errf) + + return e, p.errors +} + +// parseExprString is a convenience function for obtaining the AST of an +// expression x. The position information recorded in the AST is undefined. The +// filename used in error messages is the empty string. +func parseExprString(x string) (ast.Expr, error) { + return ParseExpr("", []byte(x)) +} diff --git a/vendor/cuelang.org/go/cue/parser/parser.go b/vendor/cuelang.org/go/cue/parser/parser.go new file mode 100644 index 0000000000..e91b3014e8 --- /dev/null +++ b/vendor/cuelang.org/go/cue/parser/parser.go @@ -0,0 +1,1669 @@ +// Copyright 2018 The CUE Authors +// +// 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 parser + +import ( + "fmt" + "strings" + "unicode" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/literal" + "cuelang.org/go/cue/scanner" + "cuelang.org/go/cue/token" + "cuelang.org/go/internal/astinternal" +) + +var debugStr = astinternal.DebugStr + +// The parser structure holds the parser's internal state. +type parser struct { + file *token.File + offset int + errors errors.Error + scanner scanner.Scanner + + // Tracing/debugging + mode mode // parsing mode + trace bool // == (mode & Trace != 0) + panicking bool // set if we are bailing out due to too many errors. + indent int // indentation used for tracing output + + // Comments + leadComment *ast.CommentGroup + comments *commentState + + // Next token + pos token.Pos // token position + tok token.Token // one token look-ahead + lit string // token literal + + // Error recovery + // (used to limit the number of calls to syncXXX functions + // w/o making scanning progress - avoids potential endless + // loops across multiple parser functions during error recovery) + syncPos token.Pos // last synchronization position + syncCnt int // number of calls to syncXXX without progress + + // Non-syntactic parser control + exprLev int // < 0: in control clause, >= 0: in expression + + imports []*ast.ImportSpec // list of imports + + version int +} + +func (p *parser) init(filename string, src []byte, mode []Option) { + p.offset = -1 + for _, f := range mode { + f(p) + } + p.file = token.NewFile(filename, p.offset, len(src)) + + var m scanner.Mode + if p.mode&parseCommentsMode != 0 { + m = scanner.ScanComments + } + eh := func(pos token.Pos, msg string, args []interface{}) { + p.errors = errors.Append(p.errors, errors.Newf(pos, msg, args...)) + } + p.scanner.Init(p.file, src, eh, m) + + p.trace = p.mode&traceMode != 0 // for convenience (p.trace is used frequently) + + p.comments = &commentState{pos: -1} + + p.next() +} + +type commentState struct { + parent *commentState + pos int8 + groups []*ast.CommentGroup + + // lists are not attached to nodes themselves. Enclosed expressions may + // miss a comment due to commas and line termination. closeLists ensures + // that comments will be passed to someone. + isList int + lastChild ast.Node + lastPos int8 +} + +// openComments reserves the next doc comment for the caller and flushes +func (p *parser) openComments() *commentState { + child := &commentState{ + parent: p.comments, + } + if c := p.comments; c != nil && c.isList > 0 { + if c.lastChild != nil { + var groups []*ast.CommentGroup + for _, cg := range c.groups { + if cg.Position == 0 { + groups = append(groups, cg) + } + } + groups = append(groups, c.lastChild.Comments()...) + for _, cg := range c.groups { + if cg.Position != 0 { + cg.Position = c.lastPos + groups = append(groups, cg) + } + } + ast.SetComments(c.lastChild, groups) + c.groups = nil + } else { + c.lastChild = nil + // attach before next + for _, cg := range c.groups { + cg.Position = 0 + } + child.groups = c.groups + c.groups = nil + } + } + if p.leadComment != nil { + child.groups = append(child.groups, p.leadComment) + p.leadComment = nil + } + p.comments = child + return child +} + +// openList is used to treat a list of comments as a single comment +// position in a production. +func (p *parser) openList() { + if p.comments.isList > 0 { + p.comments.isList++ + return + } + c := &commentState{ + parent: p.comments, + isList: 1, + } + p.comments = c +} + +func (c *commentState) add(g *ast.CommentGroup) { + g.Position = c.pos + c.groups = append(c.groups, g) +} + +func (p *parser) closeList() { + c := p.comments + if c.lastChild != nil { + for _, cg := range c.groups { + cg.Position = c.lastPos + c.lastChild.AddComment(cg) + } + c.groups = nil + } + switch c.isList--; { + case c.isList < 0: + if !p.panicking { + err := errors.Newf(p.pos, "unmatched close list") + p.errors = errors.Append(p.errors, err) + p.panicking = true + panic(err) + } + case c.isList == 0: + parent := c.parent + if len(c.groups) > 0 { + parent.groups = append(parent.groups, c.groups...) + } + parent.pos++ + p.comments = parent + } +} + +func (c *commentState) closeNode(p *parser, n ast.Node) ast.Node { + if p.comments != c { + if !p.panicking { + err := errors.Newf(p.pos, "unmatched comments") + p.errors = errors.Append(p.errors, err) + p.panicking = true + panic(err) + } + return n + } + p.comments = c.parent + if c.parent != nil { + c.parent.lastChild = n + c.parent.lastPos = c.pos + c.parent.pos++ + } + for _, cg := range c.groups { + if n != nil { + if cg != nil { + n.AddComment(cg) + } + } + } + c.groups = nil + return n +} + +func (c *commentState) closeExpr(p *parser, n ast.Expr) ast.Expr { + c.closeNode(p, n) + return n +} + +func (c *commentState) closeClause(p *parser, n ast.Clause) ast.Clause { + c.closeNode(p, n) + return n +} + +// ---------------------------------------------------------------------------- +// Parsing support + +func (p *parser) printTrace(a ...interface{}) { + const dots = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " + const n = len(dots) + pos := p.file.Position(p.pos) + fmt.Printf("%5d:%3d: ", pos.Line, pos.Column) + i := 2 * p.indent + for i > n { + fmt.Print(dots) + i -= n + } + // i <= n + fmt.Print(dots[0:i]) + fmt.Println(a...) +} + +func trace(p *parser, msg string) *parser { + p.printTrace(msg, "(") + p.indent++ + return p +} + +// Usage pattern: defer un(trace(p, "...")) +func un(p *parser) { + p.indent-- + p.printTrace(")") +} + +// Advance to the next +func (p *parser) next0() { + // Because of one-token look-ahead, print the previous token + // when tracing as it provides a more readable output. The + // very first token (!p.pos.IsValid()) is not initialized + // (it is ILLEGAL), so don't print it . + if p.trace && p.pos.IsValid() { + s := p.tok.String() + switch { + case p.tok.IsLiteral(): + p.printTrace(s, p.lit) + case p.tok.IsOperator(), p.tok.IsKeyword(): + p.printTrace("\"" + s + "\"") + default: + p.printTrace(s) + } + } + + p.pos, p.tok, p.lit = p.scanner.Scan() +} + +// Consume a comment and return it and the line on which it ends. +func (p *parser) consumeComment() (comment *ast.Comment, endline int) { + // /*-style comments may end on a different line than where they start. + // Scan the comment for '\n' chars and adjust endline accordingly. + endline = p.file.Line(p.pos) + if p.lit[1] == '*' { + p.assertV0(p.pos, 0, 10, "block quotes") + + // don't use range here - no need to decode Unicode code points + for i := 0; i < len(p.lit); i++ { + if p.lit[i] == '\n' { + endline++ + } + } + } + + comment = &ast.Comment{Slash: p.pos, Text: p.lit} + p.next0() + + return +} + +// Consume a group of adjacent comments, add it to the parser's +// comments list, and return it together with the line at which +// the last comment in the group ends. A non-comment token or n +// empty lines terminate a comment group. +func (p *parser) consumeCommentGroup(prevLine, n int) (comments *ast.CommentGroup, endline int) { + var list []*ast.Comment + var rel token.RelPos + endline = p.file.Line(p.pos) + switch endline - prevLine { + case 0: + rel = token.Blank + case 1: + rel = token.Newline + default: + rel = token.NewSection + } + for p.tok == token.COMMENT && p.file.Line(p.pos) <= endline+n { + var comment *ast.Comment + comment, endline = p.consumeComment() + list = append(list, comment) + } + + cg := &ast.CommentGroup{List: list} + ast.SetRelPos(cg, rel) + comments = cg + return +} + +// Advance to the next non-comment In the process, collect +// any comment groups encountered, and refield the last lead and +// and line comments. +// +// A lead comment is a comment group that starts and ends in a +// line without any other tokens and that is followed by a non-comment +// token on the line immediately after the comment group. +// +// A line comment is a comment group that follows a non-comment +// token on the same line, and that has no tokens after it on the line +// where it ends. +// +// Lead and line comments may be considered documentation that is +// stored in the AST. +func (p *parser) next() { + // A leadComment may not be consumed if it leads an inner token of a node. + if p.leadComment != nil { + p.comments.add(p.leadComment) + } + p.leadComment = nil + prev := p.pos + p.next0() + p.comments.pos++ + + if p.tok == token.COMMENT { + var comment *ast.CommentGroup + var endline int + + currentLine := p.file.Line(p.pos) + prevLine := p.file.Line(prev) + if prevLine == currentLine { + // The comment is on same line as the previous token; it + // cannot be a lead comment but may be a line comment. + comment, endline = p.consumeCommentGroup(prevLine, 0) + if p.file.Line(p.pos) != endline { + // The next token is on a different line, thus + // the last comment group is a line comment. + comment.Line = true + } + } + + // consume successor comments, if any + endline = -1 + for p.tok == token.COMMENT { + if comment != nil { + p.comments.add(comment) + } + comment, endline = p.consumeCommentGroup(prevLine, 1) + prevLine = currentLine + currentLine = p.file.Line(p.pos) + + } + + if endline+1 == p.file.Line(p.pos) && p.tok != token.EOF { + // The next token is following on the line immediately after the + // comment group, thus the last comment group is a lead comment. + comment.Doc = true + p.leadComment = comment + } else { + p.comments.add(comment) + } + } +} + +// assertV0 indicates the last version at which a certain feature was +// supported. +func (p *parser) assertV0(pos token.Pos, minor, patch int, name string) { + v := version0(minor, patch) + if p.version != 0 && p.version > v { + p.errors = errors.Append(p.errors, + errors.Wrapf(&DeprecationError{v}, pos, + "use of deprecated %s (deprecated as of v0.%d.%d)", name, minor, patch+1)) + } +} + +func (p *parser) errf(pos token.Pos, msg string, args ...interface{}) { + // ePos := p.file.Position(pos) + ePos := pos + + // If AllErrors is not set, discard errors reported on the same line + // as the last recorded error and stop parsing if there are more than + // 10 errors. + if p.mode&allErrorsMode == 0 { + errors := errors.Errors(p.errors) + n := len(errors) + if n > 0 && errors[n-1].Position().Line() == ePos.Line() { + return // discard - likely a spurious error + } + if n > 10 { + p.panicking = true + panic("too many errors") + } + } + + p.errors = errors.Append(p.errors, errors.Newf(ePos, msg, args...)) +} + +func (p *parser) errorExpected(pos token.Pos, obj string) { + if pos != p.pos { + p.errf(pos, "expected %s", obj) + return + } + // the error happened at the current position; + // make the error message more specific + if p.tok == token.COMMA && p.lit == "\n" { + p.errf(pos, "expected %s, found newline", obj) + return + } + + if p.tok.IsLiteral() { + p.errf(pos, "expected %s, found '%s' %s", obj, p.tok, p.lit) + } else { + p.errf(pos, "expected %s, found '%s'", obj, p.tok) + } +} + +func (p *parser) expect(tok token.Token) token.Pos { + pos := p.pos + if p.tok != tok { + p.errorExpected(pos, "'"+tok.String()+"'") + } + p.next() // make progress + return pos +} + +// expectClosing is like expect but provides a better error message +// for the common case of a missing comma before a newline. +func (p *parser) expectClosing(tok token.Token, context string) token.Pos { + if p.tok != tok && p.tok == token.COMMA && p.lit == "\n" { + p.errf(p.pos, "missing ',' before newline in %s", context) + p.next() + } + return p.expect(tok) +} + +func (p *parser) expectComma() { + // semicolon is optional before a closing ')', ']', '}', or newline + if p.tok != token.RPAREN && p.tok != token.RBRACE && p.tok != token.EOF { + switch p.tok { + case token.COMMA: + p.next() + default: + p.errorExpected(p.pos, "','") + syncExpr(p) + } + } +} + +func (p *parser) atComma(context string, follow ...token.Token) bool { + if p.tok == token.COMMA { + return true + } + for _, t := range follow { + if p.tok == t { + return false + } + } + // TODO: find a way to detect crossing lines now we don't have a semi. + if p.lit == "\n" { + p.errf(p.pos, "missing ',' before newline") + } else { + p.errf(p.pos, "missing ',' in %s", context) + } + return true // "insert" comma and continue +} + +// syncExpr advances to the next field in a field list. +// Used for synchronization after an error. +func syncExpr(p *parser) { + for { + switch p.tok { + case token.COMMA: + // Return only if parser made some progress since last + // sync or if it has not reached 10 sync calls without + // progress. Otherwise consume at least one token to + // avoid an endless parser loop (it is possible that + // both parseOperand and parseStmt call syncStmt and + // correctly do not advance, thus the need for the + // invocation limit p.syncCnt). + if p.pos == p.syncPos && p.syncCnt < 10 { + p.syncCnt++ + return + } + if p.syncPos.Before(p.pos) { + p.syncPos = p.pos + p.syncCnt = 0 + return + } + // Reaching here indicates a parser bug, likely an + // incorrect token list in this function, but it only + // leads to skipping of possibly correct code if a + // previous error is present, and thus is preferred + // over a non-terminating parse. + case token.EOF: + return + } + p.next() + } +} + +// safePos returns a valid file position for a given position: If pos +// is valid to begin with, safePos returns pos. If pos is out-of-range, +// safePos returns the EOF position. +// +// This is hack to work around "artificial" end positions in the AST which +// are computed by adding 1 to (presumably valid) token positions. If the +// token positions are invalid due to parse errors, the resulting end position +// may be past the file's EOF position, which would lead to panics if used +// later on. +func (p *parser) safePos(pos token.Pos) (res token.Pos) { + defer func() { + if recover() != nil { + res = p.file.Pos(p.file.Base()+p.file.Size(), pos.RelPos()) // EOF position + } + }() + _ = p.file.Offset(pos) // trigger a panic if position is out-of-range + return pos +} + +// ---------------------------------------------------------------------------- +// Identifiers + +func (p *parser) parseIdent() *ast.Ident { + c := p.openComments() + pos := p.pos + name := "_" + if p.tok == token.IDENT { + name = p.lit + p.next() + } else { + p.expect(token.IDENT) // use expect() error handling + } + ident := &ast.Ident{NamePos: pos, Name: name} + c.closeNode(p, ident) + return ident +} + +func (p *parser) parseKeyIdent() *ast.Ident { + c := p.openComments() + pos := p.pos + name := p.lit + p.next() + ident := &ast.Ident{NamePos: pos, Name: name} + c.closeNode(p, ident) + return ident +} + +// ---------------------------------------------------------------------------- +// Expressions + +// parseOperand returns an expression. +// Callers must verify the result. +func (p *parser) parseOperand() (expr ast.Expr) { + if p.trace { + defer un(trace(p, "Operand")) + } + + switch p.tok { + case token.IDENT: + return p.parseIdent() + + case token.LBRACE: + return p.parseStruct() + + case token.LBRACK: + return p.parseList() + + case token.BOTTOM: + c := p.openComments() + x := &ast.BottomLit{Bottom: p.pos} + p.next() + return c.closeExpr(p, x) + + case token.NULL, token.TRUE, token.FALSE, token.INT, token.FLOAT, token.STRING: + c := p.openComments() + x := &ast.BasicLit{ValuePos: p.pos, Kind: p.tok, Value: p.lit} + p.next() + return c.closeExpr(p, x) + + case token.INTERPOLATION: + return p.parseInterpolation() + + case token.LPAREN: + c := p.openComments() + defer func() { c.closeNode(p, expr) }() + lparen := p.pos + p.next() + p.exprLev++ + p.openList() + x := p.parseRHS() // types may be parenthesized: (some type) + p.closeList() + p.exprLev-- + rparen := p.expect(token.RPAREN) + return &ast.ParenExpr{ + Lparen: lparen, + X: x, + Rparen: rparen} + + default: + if p.tok.IsKeyword() { + return p.parseKeyIdent() + } + } + + // we have an error + c := p.openComments() + pos := p.pos + p.errorExpected(pos, "operand") + syncExpr(p) + return c.closeExpr(p, &ast.BadExpr{From: pos, To: p.pos}) +} + +func (p *parser) parseIndexOrSlice(x ast.Expr) (expr ast.Expr) { + if p.trace { + defer un(trace(p, "IndexOrSlice")) + } + + c := p.openComments() + defer func() { c.closeNode(p, expr) }() + c.pos = 1 + + const N = 2 + lbrack := p.expect(token.LBRACK) + + p.exprLev++ + var index [N]ast.Expr + var colons [N - 1]token.Pos + if p.tok != token.COLON { + index[0] = p.parseRHS() + } + nColons := 0 + for p.tok == token.COLON && nColons < len(colons) { + colons[nColons] = p.pos + nColons++ + p.next() + if p.tok != token.COLON && p.tok != token.RBRACK && p.tok != token.EOF { + index[nColons] = p.parseRHS() + } + } + p.exprLev-- + rbrack := p.expect(token.RBRACK) + + if nColons > 0 { + return &ast.SliceExpr{ + X: x, + Lbrack: lbrack, + Low: index[0], + High: index[1], + Rbrack: rbrack} + } + + return &ast.IndexExpr{ + X: x, + Lbrack: lbrack, + Index: index[0], + Rbrack: rbrack} +} + +func (p *parser) parseCallOrConversion(fun ast.Expr) (expr *ast.CallExpr) { + if p.trace { + defer un(trace(p, "CallOrConversion")) + } + c := p.openComments() + defer func() { c.closeNode(p, expr) }() + + p.openList() + defer p.closeList() + + lparen := p.expect(token.LPAREN) + + p.exprLev++ + var list []ast.Expr + for p.tok != token.RPAREN && p.tok != token.EOF { + list = append(list, p.parseRHS()) // builtins may expect a type: make(some type, ...) + if !p.atComma("argument list", token.RPAREN) { + break + } + p.next() + } + p.exprLev-- + rparen := p.expectClosing(token.RPAREN, "argument list") + + return &ast.CallExpr{ + Fun: fun, + Lparen: lparen, + Args: list, + Rparen: rparen} +} + +// TODO: inline this function in parseFieldList once we no longer user comment +// position information in parsing. +func (p *parser) consumeDeclComma() { + if p.atComma("struct literal", token.RBRACE, token.EOF) { + p.next() + } +} + +func (p *parser) parseFieldList() (list []ast.Decl) { + if p.trace { + defer un(trace(p, "FieldList")) + } + p.openList() + defer p.closeList() + + for p.tok != token.RBRACE && p.tok != token.EOF { + switch p.tok { + case token.ATTRIBUTE: + list = append(list, p.parseAttribute()) + p.consumeDeclComma() + + case token.ELLIPSIS: + c := p.openComments() + ellipsis := &ast.Ellipsis{Ellipsis: p.pos} + p.next() + c.closeNode(p, ellipsis) + list = append(list, ellipsis) + p.consumeDeclComma() + + default: + list = append(list, p.parseField()) + } + + // TODO: handle next comma here, after disallowing non-colon separator + // and we have eliminated the need comment positions. + } + + return +} + +func (p *parser) parseLetDecl() (decl ast.Decl, ident *ast.Ident) { + if p.trace { + defer un(trace(p, "Field")) + } + + c := p.openComments() + + letPos := p.expect(token.LET) + if p.tok != token.IDENT { + c.closeNode(p, ident) + return nil, &ast.Ident{ + NamePos: letPos, + Name: "let", + } + } + defer func() { c.closeNode(p, decl) }() + + ident = p.parseIdent() + assign := p.expect(token.BIND) + expr := p.parseRHS() + + p.consumeDeclComma() + + return &ast.LetClause{ + Let: letPos, + Ident: ident, + Equal: assign, + Expr: expr, + }, nil +} + +func (p *parser) parseComprehension() (decl ast.Decl, ident *ast.Ident) { + if p.trace { + defer un(trace(p, "Comprehension")) + } + + c := p.openComments() + defer func() { c.closeNode(p, decl) }() + + tok := p.tok + pos := p.pos + clauses, fc := p.parseComprehensionClauses(true) + if fc != nil { + ident = &ast.Ident{ + NamePos: pos, + Name: tok.String(), + } + fc.closeNode(p, ident) + return nil, ident + } + + sc := p.openComments() + expr := p.parseStruct() + sc.closeExpr(p, expr) + + if p.atComma("struct literal", token.RBRACE) { // TODO: may be EOF + p.next() + } + + return &ast.Comprehension{ + Clauses: clauses, + Value: expr, + }, nil +} + +func (p *parser) parseField() (decl ast.Decl) { + if p.trace { + defer un(trace(p, "Field")) + } + + c := p.openComments() + defer func() { c.closeNode(p, decl) }() + + pos := p.pos + + this := &ast.Field{Label: nil} + m := this + + tok := p.tok + + label, expr, decl, ok := p.parseLabel(false) + if decl != nil { + return decl + } + m.Label = label + + if !ok { + if expr == nil { + expr = p.parseRHS() + } + if a, ok := expr.(*ast.Alias); ok { + p.assertV0(a.Pos(), 1, 3, `old-style alias; use "let X = expr" instead`) + p.consumeDeclComma() + return a + } + e := &ast.EmbedDecl{Expr: expr} + p.consumeDeclComma() + return e + } + + if p.tok == token.OPTION { + m.Optional = p.pos + p.next() + } + + // TODO: consider disallowing comprehensions with more than one label. + // This can be a bit awkward in some cases, but it would naturally + // enforce the proper style that a comprehension be defined in the + // smallest possible scope. + // allowComprehension = false + + switch p.tok { + case token.COLON, token.ISA: + case token.COMMA: + p.expectComma() // sync parser. + fallthrough + + case token.RBRACE, token.EOF: + if a, ok := expr.(*ast.Alias); ok { + p.assertV0(a.Pos(), 1, 3, `old-style alias; use "let X = expr" instead`) + return a + } + switch tok { + case token.IDENT, token.LBRACK, token.LPAREN, + token.STRING, token.INTERPOLATION, + token.NULL, token.TRUE, token.FALSE, + token.FOR, token.IF, token.LET, token.IN: + return &ast.EmbedDecl{Expr: expr} + } + fallthrough + + default: + p.errorExpected(p.pos, "label or ':'") + return &ast.BadDecl{From: pos, To: p.pos} + } + + m.TokenPos = p.pos + m.Token = p.tok + if p.tok == token.ISA { + p.assertV0(p.pos, 2, 0, "'::'") + } + if p.tok != token.COLON && p.tok != token.ISA { + p.errorExpected(pos, "':' or '::'") + } + p.next() // : or :: + + for { + if l, ok := m.Label.(*ast.ListLit); ok && len(l.Elts) != 1 { + p.errf(l.Pos(), "square bracket must have exactly one element") + } + + tok := p.tok + label, expr, _, ok := p.parseLabel(true) + if !ok || (p.tok != token.COLON && p.tok != token.ISA && p.tok != token.OPTION) { + if expr == nil { + expr = p.parseRHS() + } + m.Value = expr + break + } + field := &ast.Field{Label: label} + m.Value = &ast.StructLit{Elts: []ast.Decl{field}} + m = field + + if tok != token.LSS && p.tok == token.OPTION { + m.Optional = p.pos + p.next() + } + + m.TokenPos = p.pos + m.Token = p.tok + if p.tok == token.ISA { + p.assertV0(p.pos, 2, 0, "'::'") + } + if p.tok != token.COLON && p.tok != token.ISA { + if p.tok.IsLiteral() { + p.errf(p.pos, "expected ':' or '::'; found %s", p.lit) + } else { + p.errf(p.pos, "expected ':' or '::'; found %s", p.tok) + } + break + } + p.next() + } + + if attrs := p.parseAttributes(); attrs != nil { + m.Attrs = attrs + } + + p.consumeDeclComma() + + return this +} + +func (p *parser) parseAttributes() (attrs []*ast.Attribute) { + p.openList() + for p.tok == token.ATTRIBUTE { + attrs = append(attrs, p.parseAttribute()) + } + p.closeList() + return attrs +} + +func (p *parser) parseAttribute() *ast.Attribute { + c := p.openComments() + a := &ast.Attribute{At: p.pos, Text: p.lit} + p.next() + c.closeNode(p, a) + return a +} + +func (p *parser) parseLabel(rhs bool) (label ast.Label, expr ast.Expr, decl ast.Decl, ok bool) { + tok := p.tok + switch tok { + + case token.FOR, token.IF: + if rhs { + expr = p.parseExpr() + break + } + comp, ident := p.parseComprehension() + if comp != nil { + return nil, nil, comp, false + } + expr = ident + + case token.LET: + let, ident := p.parseLetDecl() + if let != nil { + return nil, nil, let, false + } + expr = ident + + case token.IDENT, token.STRING, token.INTERPOLATION, token.LPAREN, + token.NULL, token.TRUE, token.FALSE, token.IN: + expr = p.parseExpr() + + case token.LBRACK: + expr = p.parseRHS() + switch x := expr.(type) { + case *ast.ListLit: + // Note: caller must verify this list is suitable as a label. + label, ok = x, true + } + } + + switch x := expr.(type) { + case *ast.BasicLit: + switch x.Kind { + case token.STRING, token.NULL, token.TRUE, token.FALSE: + // Keywords that represent operands. + + // Allowing keywords to be used as a labels should not interfere with + // generating good errors: any keyword can only appear on the RHS of a + // field (after a ':'), whereas labels always appear on the LHS. + + label, ok = x, true + } + + case *ast.Ident: + if strings.HasPrefix(x.Name, "__") { + p.errf(x.NamePos, "identifiers starting with '__' are reserved") + } + + expr = p.parseAlias(x) + if a, ok := expr.(*ast.Alias); ok { + if _, ok = a.Expr.(ast.Label); !ok { + break + } + label = a + } else { + label = x + } + ok = true + + case ast.Label: + label, ok = x, true + } + return label, expr, nil, ok +} + +func (p *parser) parseStruct() (expr ast.Expr) { + lbrace := p.expect(token.LBRACE) + + if p.trace { + defer un(trace(p, "StructLit")) + } + + elts := p.parseStructBody() + rbrace := p.expectClosing(token.RBRACE, "struct literal") + return &ast.StructLit{ + Lbrace: lbrace, + Elts: elts, + Rbrace: rbrace, + } +} + +func (p *parser) parseStructBody() []ast.Decl { + if p.trace { + defer un(trace(p, "StructBody")) + } + + p.exprLev++ + var elts []ast.Decl + + // TODO: consider "stealing" non-lead comments. + // for _, cg := range p.comments.groups { + // if cg != nil { + // elts = append(elts, cg) + // } + // } + // p.comments.groups = p.comments.groups[:0] + + if p.tok != token.RBRACE { + elts = p.parseFieldList() + } + p.exprLev-- + + return elts +} + +// parseComprehensionClauses parses either new-style (first==true) +// or old-style (first==false). +// Should we now disallow keywords as identifiers? If not, we need to +// return a list of discovered labels as the alternative. +func (p *parser) parseComprehensionClauses(first bool) (clauses []ast.Clause, c *commentState) { + // TODO: reuse Template spec, which is possible if it doesn't check the + // first is an identifier. + + for { + switch p.tok { + case token.FOR: + c := p.openComments() + forPos := p.expect(token.FOR) + if first { + switch p.tok { + case token.COLON, token.ISA, token.BIND, token.OPTION, + token.COMMA, token.EOF: + return nil, c + } + } + + var key, value *ast.Ident + var colon token.Pos + value = p.parseIdent() + if p.tok == token.COMMA { + colon = p.expect(token.COMMA) + key = value + value = p.parseIdent() + } + c.pos = 4 + // params := p.parseParams(nil, ARROW) + clauses = append(clauses, c.closeClause(p, &ast.ForClause{ + For: forPos, + Key: key, + Colon: colon, + Value: value, + In: p.expect(token.IN), + Source: p.parseRHS(), + })) + + case token.IF: + c := p.openComments() + ifPos := p.expect(token.IF) + if first { + switch p.tok { + case token.COLON, token.ISA, token.BIND, token.OPTION, + token.COMMA, token.EOF: + return nil, c + } + } + + clauses = append(clauses, c.closeClause(p, &ast.IfClause{ + If: ifPos, + Condition: p.parseRHS(), + })) + + case token.LET: + c := p.openComments() + letPos := p.expect(token.LET) + + ident := p.parseIdent() + assign := p.expect(token.BIND) + expr := p.parseRHS() + + clauses = append(clauses, c.closeClause(p, &ast.LetClause{ + Let: letPos, + Ident: ident, + Equal: assign, + Expr: expr, + })) + + default: + return clauses, nil + } + if p.tok == token.COMMA { + p.next() + } + + first = false + } +} + +func (p *parser) parseList() (expr ast.Expr) { + lbrack := p.expect(token.LBRACK) + + if p.trace { + defer un(trace(p, "ListLiteral")) + } + + elts := p.parseListElements() + + if p.tok == token.ELLIPSIS { + ellipsis := &ast.Ellipsis{ + Ellipsis: p.pos, + } + elts = append(elts, ellipsis) + p.next() + if p.tok != token.COMMA && p.tok != token.RBRACK { + ellipsis.Type = p.parseRHS() + } + if p.atComma("list literal", token.RBRACK) { + p.next() + } + } + + rbrack := p.expectClosing(token.RBRACK, "list literal") + return &ast.ListLit{ + Lbrack: lbrack, + Elts: elts, + Rbrack: rbrack} +} + +func (p *parser) parseListElements() (list []ast.Expr) { + if p.trace { + defer un(trace(p, "ListElements")) + } + p.openList() + defer p.closeList() + + for p.tok != token.RBRACK && p.tok != token.ELLIPSIS && p.tok != token.EOF { + expr, ok := p.parseListElement() + list = append(list, expr) + if !ok { + break + } + } + + return +} + +func (p *parser) parseListElement() (expr ast.Expr, ok bool) { + if p.trace { + defer un(trace(p, "ListElement")) + } + c := p.openComments() + defer func() { c.closeNode(p, expr) }() + + switch p.tok { + case token.FOR, token.IF: + tok := p.tok + pos := p.pos + clauses, fc := p.parseComprehensionClauses(true) + if clauses != nil { + sc := p.openComments() + expr := p.parseStruct() + sc.closeExpr(p, expr) + + if p.atComma("list literal", token.RBRACK) { // TODO: may be EOF + p.next() + } + + return &ast.Comprehension{ + Clauses: clauses, + Value: expr, + }, true + } + + expr = &ast.Ident{ + NamePos: pos, + Name: tok.String(), + } + fc.closeNode(p, expr) + + default: + expr = p.parseUnaryExpr() + } + + expr = p.parseBinaryExprTail(token.LowestPrec+1, expr) + expr = p.parseAlias(expr) + + // Enforce there is an explicit comma. We could also allow the + // omission of commas in lists, but this gives rise to some ambiguities + // with list comprehensions. + if p.tok == token.COMMA && p.lit != "," { + p.next() + // Allow missing comma for last element, though, to be compliant + // with JSON. + if p.tok == token.RBRACK || p.tok == token.FOR || p.tok == token.IF { + return expr, false + } + p.errf(p.pos, "missing ',' before newline in list literal") + } else if !p.atComma("list literal", token.RBRACK, token.FOR, token.IF) { + return expr, false + } + p.next() + + return expr, true +} + +// parseAlias turns an expression into an alias. +func (p *parser) parseAlias(lhs ast.Expr) (expr ast.Expr) { + if p.tok != token.BIND { + return lhs + } + pos := p.pos + p.next() + expr = p.parseRHS() + if expr == nil { + panic("empty return") + } + switch x := lhs.(type) { + case *ast.Ident: + return &ast.Alias{Ident: x, Equal: pos, Expr: expr} + } + p.errf(p.pos, "expected identifier for alias") + return expr +} + +// checkExpr checks that x is an expression (and not a type). +func (p *parser) checkExpr(x ast.Expr) ast.Expr { + switch unparen(x).(type) { + case *ast.BadExpr: + case *ast.BottomLit: + case *ast.Ident: + case *ast.BasicLit: + case *ast.Interpolation: + case *ast.StructLit: + case *ast.ListLit: + case *ast.ParenExpr: + panic("unreachable") + case *ast.SelectorExpr: + case *ast.IndexExpr: + case *ast.SliceExpr: + case *ast.CallExpr: + case *ast.UnaryExpr: + case *ast.BinaryExpr: + default: + // all other nodes are not proper expressions + p.errorExpected(x.Pos(), "expression") + x = &ast.BadExpr{ + From: x.Pos(), To: p.safePos(x.End()), + } + } + return x +} + +// If x is of the form (T), unparen returns unparen(T), otherwise it returns x. +func unparen(x ast.Expr) ast.Expr { + if p, isParen := x.(*ast.ParenExpr); isParen { + x = unparen(p.X) + } + return x +} + +// If lhs is set and the result is an identifier, it is not resolved. +func (p *parser) parsePrimaryExpr() ast.Expr { + if p.trace { + defer un(trace(p, "PrimaryExpr")) + } + + return p.parsePrimaryExprTail(p.parseOperand()) +} + +func (p *parser) parsePrimaryExprTail(operand ast.Expr) ast.Expr { + x := operand +L: + for { + switch p.tok { + case token.PERIOD: + c := p.openComments() + c.pos = 1 + p.next() + switch p.tok { + case token.IDENT: + x = &ast.SelectorExpr{ + X: p.checkExpr(x), + Sel: p.parseIdent(), + } + case token.STRING: + if strings.HasPrefix(p.lit, `"`) && !strings.HasPrefix(p.lit, `""`) { + str := &ast.BasicLit{ + ValuePos: p.pos, + Kind: token.STRING, + Value: p.lit, + } + p.next() + x = &ast.SelectorExpr{ + X: p.checkExpr(x), + Sel: str, + } + break + } + fallthrough + default: + pos := p.pos + p.errorExpected(pos, "selector") + p.next() // make progress + x = &ast.SelectorExpr{X: x, Sel: &ast.Ident{NamePos: pos, Name: "_"}} + } + c.closeNode(p, x) + case token.LBRACK: + x = p.parseIndexOrSlice(p.checkExpr(x)) + case token.LPAREN: + x = p.parseCallOrConversion(p.checkExpr(x)) + default: + break L + } + } + + return x +} + +// If lhs is set and the result is an identifier, it is not resolved. +func (p *parser) parseUnaryExpr() ast.Expr { + if p.trace { + defer un(trace(p, "UnaryExpr")) + } + + switch p.tok { + case token.ADD, token.SUB, token.NOT, token.MUL, + token.LSS, token.LEQ, token.GEQ, token.GTR, + token.NEQ, token.MAT, token.NMAT: + pos, op := p.pos, p.tok + c := p.openComments() + p.next() + return c.closeExpr(p, &ast.UnaryExpr{ + OpPos: pos, + Op: op, + X: p.checkExpr(p.parseUnaryExpr()), + }) + } + + return p.parsePrimaryExpr() +} + +func (p *parser) tokPrec() (token.Token, int) { + tok := p.tok + if tok == token.IDENT { + switch p.lit { + case "quo": + return token.IQUO, 7 + case "rem": + return token.IREM, 7 + case "div": + return token.IDIV, 7 + case "mod": + return token.IMOD, 7 + default: + return tok, 0 + } + } + return tok, tok.Precedence() +} + +// If lhs is set and the result is an identifier, it is not resolved. +func (p *parser) parseBinaryExpr(prec1 int) ast.Expr { + if p.trace { + defer un(trace(p, "BinaryExpr")) + } + p.openList() + defer p.closeList() + + return p.parseBinaryExprTail(prec1, p.parseUnaryExpr()) +} + +func (p *parser) parseBinaryExprTail(prec1 int, x ast.Expr) ast.Expr { + for { + op, prec := p.tokPrec() + if prec < prec1 { + return x + } + c := p.openComments() + c.pos = 1 + pos := p.expect(p.tok) + x = c.closeExpr(p, &ast.BinaryExpr{ + X: p.checkExpr(x), + OpPos: pos, + Op: op, + // Treat nested expressions as RHS. + Y: p.checkExpr(p.parseBinaryExpr(prec + 1))}) + } +} + +func (p *parser) parseInterpolation() (expr ast.Expr) { + c := p.openComments() + defer func() { c.closeNode(p, expr) }() + + p.openList() + defer p.closeList() + + cc := p.openComments() + + lit := p.lit + pos := p.pos + p.next() + last := &ast.BasicLit{ValuePos: pos, Kind: token.STRING, Value: lit} + exprs := []ast.Expr{last} + + for p.tok == token.LPAREN { + c.pos = 1 + p.expect(token.LPAREN) + cc.closeExpr(p, last) + + exprs = append(exprs, p.parseRHS()) + + cc = p.openComments() + if p.tok != token.RPAREN { + p.errf(p.pos, "expected ')' for string interpolation") + } + lit = p.scanner.ResumeInterpolation() + pos = p.pos + p.next() + last = &ast.BasicLit{ + ValuePos: pos, + Kind: token.STRING, + Value: lit, + } + exprs = append(exprs, last) + } + cc.closeExpr(p, last) + return &ast.Interpolation{Elts: exprs} +} + +// Callers must check the result (using checkExpr), depending on context. +func (p *parser) parseExpr() (expr ast.Expr) { + if p.trace { + defer un(trace(p, "Expression")) + } + + c := p.openComments() + defer func() { c.closeExpr(p, expr) }() + + return p.parseBinaryExpr(token.LowestPrec + 1) +} + +func (p *parser) parseRHS() ast.Expr { + x := p.checkExpr(p.parseExpr()) + return x +} + +// ---------------------------------------------------------------------------- +// Declarations + +func isValidImport(lit string) bool { + const illegalChars = `!"#$%&'()*,:;<=>?[\]^{|}` + "`\uFFFD" + s, _ := literal.Unquote(lit) // go/scanner returns a legal string literal + if p := strings.LastIndexByte(s, ':'); p >= 0 { + s = s[:p] + } + for _, r := range s { + if !unicode.IsGraphic(r) || unicode.IsSpace(r) || strings.ContainsRune(illegalChars, r) { + return false + } + } + return s != "" +} + +func (p *parser) parseImportSpec(_ int) *ast.ImportSpec { + if p.trace { + defer un(trace(p, "ImportSpec")) + } + + c := p.openComments() + + var ident *ast.Ident + if p.tok == token.IDENT { + ident = p.parseIdent() + } + + pos := p.pos + var path string + if p.tok == token.STRING { + path = p.lit + if !isValidImport(path) { + p.errf(pos, "invalid import path: %s", path) + } + p.next() + p.expectComma() // call before accessing p.linecomment + } else { + p.expect(token.STRING) // use expect() error handling + if p.tok == token.COMMA { + p.expectComma() // call before accessing p.linecomment + } + } + // collect imports + spec := &ast.ImportSpec{ + Name: ident, + Path: &ast.BasicLit{ValuePos: pos, Kind: token.STRING, Value: path}, + } + c.closeNode(p, spec) + p.imports = append(p.imports, spec) + + return spec +} + +func (p *parser) parseImports() *ast.ImportDecl { + if p.trace { + defer un(trace(p, "Imports")) + } + c := p.openComments() + + ident := p.parseIdent() + var lparen, rparen token.Pos + var list []*ast.ImportSpec + if p.tok == token.LPAREN { + lparen = p.pos + p.next() + p.openList() + for iota := 0; p.tok != token.RPAREN && p.tok != token.EOF; iota++ { + list = append(list, p.parseImportSpec(iota)) + } + p.closeList() + rparen = p.expect(token.RPAREN) + p.expectComma() + } else { + list = append(list, p.parseImportSpec(0)) + } + + d := &ast.ImportDecl{ + Import: ident.Pos(), + Lparen: lparen, + Specs: list, + Rparen: rparen, + } + c.closeNode(p, d) + return d +} + +// ---------------------------------------------------------------------------- +// Source files + +func (p *parser) parseFile() *ast.File { + if p.trace { + defer un(trace(p, "File")) + } + + c := p.comments + + // Don't bother parsing the rest if we had errors scanning the first + // Likely not a Go source file at all. + if p.errors != nil { + return nil + } + p.openList() + + var decls []ast.Decl + + for p.tok == token.ATTRIBUTE { + decls = append(decls, p.parseAttribute()) + p.consumeDeclComma() + } + + // The package clause is not a declaration: it does not appear in any + // scope. + if p.tok == token.IDENT && p.lit == "package" { + c := p.openComments() + + pos := p.pos + var name *ast.Ident + p.expect(token.IDENT) + name = p.parseIdent() + if name.Name == "_" && p.mode&declarationErrorsMode != 0 { + p.errf(p.pos, "invalid package name _") + } + + pkg := &ast.Package{ + PackagePos: pos, + Name: name, + } + decls = append(decls, pkg) + p.expectComma() + c.closeNode(p, pkg) + } + + for p.tok == token.ATTRIBUTE { + decls = append(decls, p.parseAttribute()) + p.consumeDeclComma() + } + + if p.mode&packageClauseOnlyMode == 0 { + // import decls + for p.tok == token.IDENT && p.lit == "import" { + decls = append(decls, p.parseImports()) + } + + if p.mode&importsOnlyMode == 0 { + // rest of package decls + // TODO: loop and allow multiple expressions. + decls = append(decls, p.parseFieldList()...) + p.expect(token.EOF) + } + } + p.closeList() + + f := &ast.File{ + Imports: p.imports, + Decls: decls, + } + c.closeNode(p, f) + return f +} diff --git a/vendor/cuelang.org/go/cue/path.go b/vendor/cuelang.org/go/cue/path.go new file mode 100644 index 0000000000..8054107848 --- /dev/null +++ b/vendor/cuelang.org/go/cue/path.go @@ -0,0 +1,520 @@ +// Copyright 2020 CUE Authors +// +// 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 cue + +import ( + "fmt" + "strconv" + "strings" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/literal" + "cuelang.org/go/cue/parser" + "cuelang.org/go/cue/token" + "cuelang.org/go/internal/astinternal" + "cuelang.org/go/internal/core/adt" + "github.com/cockroachdb/apd/v2" +) + +// A Selector is a component of a path. +type Selector struct { + sel selector +} + +// String reports the CUE representation of a selector. +func (sel Selector) String() string { + return sel.sel.String() +} + +// IsString reports whether sel is a regular label type. +func (sel Selector) IsString() bool { + return sel.sel.kind() == adt.StringLabel +} + +// IsDefinition reports whether sel is a non-hidden definition label type. +func (sel Selector) IsDefinition() bool { + return sel.sel.kind() == adt.DefinitionLabel +} + +// PkgPath reports the package path associated with a hidden label or "" if +// this is not a hidden label. +func (sel Selector) PkgPath() string { + h, _ := sel.sel.(scopedSelector) + return h.pkg +} + +var ( + + // AnyDefinition can be used to ask for any definition. + // + // In paths it is used to select constraints that apply to all elements. + // AnyDefinition = anyDefinition + anyDefinition = Selector{sel: anySelector(adt.AnyDefinition)} + + // AnyIndex can be used to ask for any index. + // + // In paths it is used to select constraints that apply to all elements. + AnyIndex = anyIndex + anyIndex = Selector{sel: anySelector(adt.AnyIndex)} + + // AnyString can be used to ask for any regular string field. + // + // In paths it is used to select constraints that apply to all elements. + AnyString = anyString + anyString = Selector{sel: anySelector(adt.AnyString)} +) + +// Optional converts sel into an optional equivalent. +// foo -> foo? +func (sel Selector) Optional() Selector { + return wrapOptional(sel) +} + +type selector interface { + String() string + + feature(ctx adt.Runtime) adt.Feature + kind() adt.FeatureType + optional() bool +} + +// A Path is series of selectors to query a CUE value. +type Path struct { + path []Selector +} + +// MakePath creates a Path from a sequence of selectors. +func MakePath(selectors ...Selector) Path { + return Path{path: selectors} +} + +// pathToString is a utility function for creating debugging info. +func pathToStrings(p Path) (a []string) { + for _, sel := range p.Selectors() { + a = append(a, sel.String()) + } + return a +} + +// ParsePath parses a CUE expression into a Path. Any error resulting from +// this conversion can be obtained by calling Err on the result. +// +// Unlike with normal CUE expressions, the first element of the path may be +// a string literal. +// +// A path may not contain hidden fields. To create a path with hidden fields, +// use MakePath and Ident. +func ParsePath(s string) Path { + if s == "" { + return Path{} + } + expr, err := parser.ParseExpr("", s) + if err != nil { + return MakePath(Selector{pathError{errors.Promote(err, "invalid path")}}) + } + + p := Path{path: toSelectors(expr)} + for _, sel := range p.path { + if sel.sel.kind().IsHidden() { + return MakePath(Selector{pathError{errors.Newf(token.NoPos, + "invalid path: hidden fields not allowed in path %s", s)}}) + } + } + return p +} + +// Selectors reports the individual selectors of a path. +func (p Path) Selectors() []Selector { + return p.path +} + +// String reports the CUE representation of p. +func (p Path) String() string { + if err := p.Err(); err != nil { + return "_|_" + } + + b := &strings.Builder{} + for i, sel := range p.path { + x := sel.sel + // TODO: use '.' in all cases, once supported. + _, isAny := x.(anySelector) + switch { + case x.kind() == adt.IntLabel && !isAny: + b.WriteByte('[') + b.WriteString(x.String()) + b.WriteByte(']') + continue + case i > 0: + b.WriteByte('.') + } + + b.WriteString(x.String()) + } + return b.String() +} + +// Optional returns the optional form of a Path. For instance, +// foo.bar --> foo?.bar? +// +func (p Path) Optional() Path { + q := make([]Selector, 0, len(p.path)) + for _, s := range p.path { + q = appendSelector(q, wrapOptional(s)) + } + return Path{path: q} +} + +func toSelectors(expr ast.Expr) []Selector { + switch x := expr.(type) { + case *ast.Ident: + return []Selector{Label(x)} + + case *ast.BasicLit: + return []Selector{basicLitSelector(x)} + + case *ast.IndexExpr: + a := toSelectors(x.X) + var sel Selector + if b, ok := x.Index.(*ast.BasicLit); !ok { + sel = Selector{pathError{ + errors.Newf(token.NoPos, "non-constant expression %s", + astinternal.DebugStr(x.Index))}} + } else { + sel = basicLitSelector(b) + } + return appendSelector(a, sel) + + case *ast.SelectorExpr: + a := toSelectors(x.X) + return appendSelector(a, Label(x.Sel)) + + default: + return []Selector{{pathError{ + errors.Newf(token.NoPos, "invalid label %s ", astinternal.DebugStr(x)), + }}} + } +} + +// appendSelector is like append(a, sel), except that it collects errors +// in a one-element slice. +func appendSelector(a []Selector, sel Selector) []Selector { + err, isErr := sel.sel.(pathError) + if len(a) == 1 { + if p, ok := a[0].sel.(pathError); ok { + if isErr { + p.Error = errors.Append(p.Error, err.Error) + } + return a + } + } + if isErr { + return []Selector{sel} + } + return append(a, sel) +} + +func basicLitSelector(b *ast.BasicLit) Selector { + switch b.Kind { + case token.INT: + var n literal.NumInfo + if err := literal.ParseNum(b.Value, &n); err != nil { + return Selector{pathError{ + errors.Newf(token.NoPos, "invalid string index %s", b.Value), + }} + } + var d apd.Decimal + _ = n.Decimal(&d) + i, err := d.Int64() + if err != nil { + return Selector{pathError{ + errors.Newf(token.NoPos, "integer %s out of range", b.Value), + }} + } + return Index(int(i)) + + case token.STRING: + info, _, _, _ := literal.ParseQuotes(b.Value, b.Value) + if !info.IsDouble() { + return Selector{pathError{ + errors.Newf(token.NoPos, "invalid string index %s", b.Value)}} + } + s, _ := literal.Unquote(b.Value) + return Selector{stringSelector(s)} + + default: + return Selector{pathError{ + errors.Newf(token.NoPos, "invalid literal %s", b.Value), + }} + } +} + +// Label converts an AST label to a Selector. +func Label(label ast.Label) Selector { + switch x := label.(type) { + case *ast.Ident: + switch s := x.Name; { + case strings.HasPrefix(s, "_"): + // TODO: extract package from a bound identifier. + return Selector{pathError{errors.Newf(token.NoPos, + "invalid path: hidden label %s not allowed", s), + }} + case strings.HasPrefix(s, "#"): + return Selector{definitionSelector(x.Name)} + default: + return Selector{stringSelector(x.Name)} + } + + case *ast.BasicLit: + return basicLitSelector(x) + + default: + return Selector{pathError{ + errors.Newf(token.NoPos, "invalid label %s ", astinternal.DebugStr(x)), + }} + } +} + +// Err reports errors that occurred when generating the path. +func (p Path) Err() error { + var errs errors.Error + for _, x := range p.path { + if err, ok := x.sel.(pathError); ok { + errs = errors.Append(errs, err.Error) + } + } + return errs +} + +func isHiddenOrDefinition(s string) bool { + return strings.HasPrefix(s, "#") || strings.HasPrefix(s, "_") +} + +// Hid returns a selector for a hidden field. It panics is pkg is empty. +// Hidden fields are scoped by package, and pkg indicates for which package +// the hidden field must apply.For anonymous packages, it must be set to "_". +func Hid(name, pkg string) Selector { + if !ast.IsValidIdent(name) { + panic(fmt.Sprintf("invalid identifier %s", name)) + } + if !strings.HasPrefix(name, "_") { + panic(fmt.Sprintf("%s is not a hidden field identifier", name)) + } + if pkg == "" { + panic(fmt.Sprintf("missing package for hidden identifier %s", name)) + } + return Selector{scopedSelector{name, pkg}} +} + +type scopedSelector struct { + name, pkg string +} + +// String returns the CUE representation of the definition. +func (s scopedSelector) String() string { + return s.name +} +func (scopedSelector) optional() bool { return false } + +func (s scopedSelector) kind() adt.FeatureType { + switch { + case strings.HasPrefix(s.name, "#"): + return adt.DefinitionLabel + case strings.HasPrefix(s.name, "_#"): + return adt.HiddenDefinitionLabel + case strings.HasPrefix(s.name, "_"): + return adt.HiddenLabel + default: + return adt.StringLabel + } +} + +func (s scopedSelector) feature(r adt.Runtime) adt.Feature { + return adt.MakeIdentLabel(r, s.name, s.pkg) +} + +// A Def marks a string as a definition label. An # will be added if a string is +// not prefixed with a #. It will panic if s cannot be written as a valid +// identifier. +func Def(s string) Selector { + if !strings.HasPrefix(s, "#") && !strings.HasPrefix(s, "_#") { + s = "#" + s + } + if !ast.IsValidIdent(s) { + panic(fmt.Sprintf("invalid definition %s", s)) + } + return Selector{definitionSelector(s)} +} + +type definitionSelector string + +// String returns the CUE representation of the definition. +func (d definitionSelector) String() string { + return string(d) +} + +func (d definitionSelector) optional() bool { return false } + +func (d definitionSelector) kind() adt.FeatureType { + return adt.DefinitionLabel +} + +func (d definitionSelector) feature(r adt.Runtime) adt.Feature { + return adt.MakeIdentLabel(r, string(d), "") +} + +// A Str is a CUE string label. Definition selectors are defined with Def. +func Str(s string) Selector { + return Selector{stringSelector(s)} +} + +type stringSelector string + +func (s stringSelector) String() string { + str := string(s) + if isHiddenOrDefinition(str) || !ast.IsValidIdent(str) { + return literal.Label.Quote(str) + } + return str +} + +func (s stringSelector) optional() bool { return false } +func (s stringSelector) kind() adt.FeatureType { return adt.StringLabel } + +func (s stringSelector) feature(r adt.Runtime) adt.Feature { + return adt.MakeStringLabel(r, string(s)) +} + +// An Index selects a list element by index. +func Index(x int) Selector { + f, err := adt.MakeLabel(nil, int64(x), adt.IntLabel) + if err != nil { + return Selector{pathError{err}} + } + return Selector{indexSelector(f)} +} + +type indexSelector adt.Feature + +func (s indexSelector) String() string { + return strconv.Itoa(adt.Feature(s).Index()) +} + +func (s indexSelector) kind() adt.FeatureType { return adt.IntLabel } +func (s indexSelector) optional() bool { return false } + +func (s indexSelector) feature(r adt.Runtime) adt.Feature { + return adt.Feature(s) +} + +// an anySelector represents a wildcard option of a particular type. +type anySelector adt.Feature + +func (s anySelector) String() string { return "[_]" } +func (s anySelector) optional() bool { return true } +func (s anySelector) kind() adt.FeatureType { return adt.Feature(s).Typ() } + +func (s anySelector) feature(r adt.Runtime) adt.Feature { + return adt.Feature(s) +} + +// TODO: allow import paths to be represented? +// +// // ImportPath defines a lookup at the root of an instance. It must be the first +// // element of a Path. +// func ImportPath(s string) Selector { +// return importSelector(s) +// } +type optionalSelector struct { + selector +} + +func wrapOptional(sel Selector) Selector { + if !sel.sel.optional() { + sel = Selector{optionalSelector{sel.sel}} + } + return sel +} + +// func isOptional(sel selector) bool { +// _, ok := sel.(optionalSelector) +// return ok +// } + +func (s optionalSelector) optional() bool { return true } + +func (s optionalSelector) String() string { + return s.selector.String() + "?" +} + +// TODO: allow looking up in parent scopes? + +// // Parent returns a Selector for looking up in the parent of a current node. +// // Parent selectors may only occur at the start of a Path. +// func Parent() Selector { +// return parentSelector{} +// } + +// type parentSelector struct{} + +// func (p parentSelector) String() string { return "__up" } +// func (p parentSelector) feature(r adt.Runtime) adt.Feature { +// return adt.InvalidLabel +// } + +type pathError struct { + errors.Error +} + +func (p pathError) String() string { return "" } +func (p pathError) optional() bool { return false } +func (p pathError) kind() adt.FeatureType { return 0 } +func (p pathError) feature(r adt.Runtime) adt.Feature { + return adt.InvalidLabel +} + +func valueToSel(v adt.Value) Selector { + switch x := adt.Unwrap(v).(type) { + case *adt.Num: + i, err := x.X.Int64() + if err != nil { + return Selector{&pathError{errors.Promote(err, "invalid number")}} + } + return Index(int(i)) + case *adt.String: + return Str(x.Str) + default: + return Selector{pathError{errors.Newf(token.NoPos, "dynamic selector")}} + } +} + +func featureToSel(f adt.Feature, r adt.Runtime) Selector { + switch f.Typ() { + case adt.StringLabel: + return Str(f.StringValue(r)) + case adt.IntLabel: + return Index(f.Index()) + case adt.DefinitionLabel: + return Def(f.IdentString(r)) + case adt.HiddenLabel, adt.HiddenDefinitionLabel: + ident := f.IdentString(r) + pkg := f.PkgID(r) + return Hid(ident, pkg) + } + return Selector{pathError{ + errors.Newf(token.NoPos, "unexpected feature type %v", f.Typ()), + }} +} diff --git a/vendor/cuelang.org/go/cue/query.go b/vendor/cuelang.org/go/cue/query.go new file mode 100644 index 0000000000..af046ee86f --- /dev/null +++ b/vendor/cuelang.org/go/cue/query.go @@ -0,0 +1,84 @@ +// Copyright 2021 CUE Authors +// +// 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 cue + +import ( + "cuelang.org/go/internal/core/adt" +) + +// This file contains query-related code. + +// getScopePrefix finds the Vertex that exists in v for the longest prefix of p. +// +// It is used to make the parent scopes visible when resolving expressions. +func getScopePrefix(v Value, p Path) Value { + for _, sel := range p.Selectors() { + w := v.LookupPath(MakePath(sel)) + if !w.Exists() { + break + } + v = w + } + return v +} + +// LookupPath reports the value for path p relative to v. +func (v Value) LookupPath(p Path) Value { + if v.v == nil { + return Value{} + } + n := v.v + parent := v.parent_ + ctx := v.ctx() + +outer: + for _, sel := range p.path { + f := sel.sel.feature(v.idx) + for _, a := range n.Arcs { + if a.Label == f { + parent = linkParent(parent, n, a) + n = a + continue outer + } + } + if sel.sel.optional() { + x := &adt.Vertex{ + Parent: n, + Label: sel.sel.feature(ctx), + } + n.MatchAndInsert(ctx, x) + if len(x.Conjuncts) > 0 { + x.Finalize(ctx) + parent = linkParent(parent, n, x) + n = x + continue + } + } + + var x *adt.Bottom + if err, ok := sel.sel.(pathError); ok { + x = &adt.Bottom{Err: err.Error} + } else { + x = mkErr(v.idx, n, adt.EvalError, "field not found: %v", sel.sel) + if n.Accept(ctx, f) { + x.Code = adt.IncompleteError + } + x.NotExists = true + } + v := makeValue(v.idx, n, parent) + return newErrValue(v, x) + } + return makeValue(v.idx, n, parent) +} diff --git a/vendor/cuelang.org/go/cue/scanner/fuzz.go b/vendor/cuelang.org/go/cue/scanner/fuzz.go new file mode 100644 index 0000000000..376a57e419 --- /dev/null +++ b/vendor/cuelang.org/go/cue/scanner/fuzz.go @@ -0,0 +1,40 @@ +// Copyright 2019 CUE Authors +// +// 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. + +//go:build gofuzz +// +build gofuzz + +package scanner + +import ( + "cuelang.org/go/cue/token" +) + +func Fuzz(b []byte) int { + retCode := 1 + eh := func(_ token.Pos, msg string, args []interface{}) { + retCode = 0 + } + + var s Scanner + s.Init(token.NewFile("", 1, len(b)), b, eh, ScanComments) + + for { + _, tok, _ := s.Scan() + if tok == token.EOF { + break + } + } + return retCode +} diff --git a/vendor/cuelang.org/go/cue/scanner/scanner.go b/vendor/cuelang.org/go/cue/scanner/scanner.go new file mode 100644 index 0000000000..84b3643d32 --- /dev/null +++ b/vendor/cuelang.org/go/cue/scanner/scanner.go @@ -0,0 +1,991 @@ +// Copyright 2018 The CUE Authors +// +// 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 scanner implements a scanner for CUE source text. It takes a []byte +// as source which can then be tokenized through repeated calls to the Scan +// method. +package scanner // import "cuelang.org/go/cue/scanner" + +import ( + "bytes" + "fmt" + "path/filepath" + "strconv" + "strings" + "unicode" + "unicode/utf8" + + "cuelang.org/go/cue/token" +) + +// An ErrorHandler is a generic error handler used throughout CUE packages. +// +// The position points to the beginning of the offending value. +type ErrorHandler func(pos token.Pos, msg string, args []interface{}) + +// A Scanner holds the Scanner's internal state while processing +// a given text. It can be allocated as part of another data +// structure but must be initialized via Init before use. +type Scanner struct { + // immutable state + file *token.File // source file handle + dir string // directory portion of file.Name() + src []byte // source + errh ErrorHandler // error reporting; or nil + mode Mode // scanning mode + + // scanning state + ch rune // current character + offset int // character offset + rdOffset int // reading offset (position after current character) + lineOffset int // current line offset + linesSinceLast int + spacesSinceLast int + insertEOL bool // insert a comma before next newline + + quoteStack []quoteInfo + + // public state - ok to modify + ErrorCount int // number of errors encountered +} + +type quoteInfo struct { + char rune + numChar int + numHash int +} + +const bom = 0xFEFF // byte order mark, only permitted as very first character + +// Read the next Unicode char into s.ch. +// s.ch < 0 means end-of-file. +func (s *Scanner) next() { + if s.rdOffset < len(s.src) { + s.offset = s.rdOffset + if s.ch == '\n' { + s.lineOffset = s.offset + s.file.AddLine(s.offset) + } + r, w := rune(s.src[s.rdOffset]), 1 + switch { + case r == 0: + s.errf(s.offset, "illegal character NUL") + case r >= utf8.RuneSelf: + // not ASCII + r, w = utf8.DecodeRune(s.src[s.rdOffset:]) + if r == utf8.RuneError && w == 1 { + s.errf(s.offset, "illegal UTF-8 encoding") + } else if r == bom && s.offset > 0 { + s.errf(s.offset, "illegal byte order mark") + } + } + s.rdOffset += w + s.ch = r + } else { + s.offset = len(s.src) + if s.ch == '\n' { + s.lineOffset = s.offset + s.file.AddLine(s.offset) + } + s.ch = -1 // eof + } +} + +// A Mode value is a set of flags (or 0). +// They control scanner behavior. +type Mode uint + +// These constants are options to the Init function. +const ( + ScanComments Mode = 1 << iota // return comments as COMMENT tokens + dontInsertCommas // do not automatically insert commas - for testing only +) + +// Init prepares the scanner s to tokenize the text src by setting the +// scanner at the beginning of src. The scanner uses the file set file +// for position information and it adds line information for each line. +// It is ok to re-use the same file when re-scanning the same file as +// line information which is already present is ignored. Init causes a +// panic if the file size does not match the src size. +// +// Calls to Scan will invoke the error handler err if they encounter a +// syntax error and err is not nil. Also, for each error encountered, +// the Scanner field ErrorCount is incremented by one. The mode parameter +// determines how comments are handled. +// +// Note that Init may call err if there is an error in the first character +// of the file. +func (s *Scanner) Init(file *token.File, src []byte, eh ErrorHandler, mode Mode) { + // Explicitly initialize all fields since a scanner may be reused. + if file.Size() != len(src) { + panic(fmt.Sprintf("file size (%d) does not match src len (%d)", file.Size(), len(src))) + } + s.file = file + s.dir, _ = filepath.Split(file.Name()) + s.src = src + s.errh = eh + s.mode = mode + + s.ch = ' ' + s.offset = 0 + s.rdOffset = 0 + s.lineOffset = 0 + s.insertEOL = false + s.ErrorCount = 0 + + s.next() + if s.ch == bom { + s.next() // ignore BOM at file beginning + } +} + +func (s *Scanner) errf(offs int, msg string, args ...interface{}) { + if s.errh != nil { + s.errh(s.file.Pos(offs, 0), msg, args) + } + s.ErrorCount++ +} + +var prefix = []byte("//line ") + +func (s *Scanner) interpretLineComment(text []byte) { + if bytes.HasPrefix(text, prefix) { + // get filename and line number, if any + if i := bytes.LastIndex(text, []byte{':'}); i > 0 { + if line, err := strconv.Atoi(string(text[i+1:])); err == nil && line > 0 { + // valid //line filename:line comment + filename := string(bytes.TrimSpace(text[len(prefix):i])) + if filename != "" { + filename = filepath.Clean(filename) + if !filepath.IsAbs(filename) { + // make filename relative to current directory + filename = filepath.Join(s.dir, filename) + } + } + // update scanner position + s.file.AddLineInfo(s.lineOffset+len(text)+1, filename, line) // +len(text)+1 since comment applies to next line + } + } + } +} + +func (s *Scanner) scanComment() string { + // initial '/' already consumed; s.ch == '/' || s.ch == '*' + offs := s.offset - 1 // position of initial '/' + hasCR := false + + if s.ch == '/' { + //-style comment + s.next() + for s.ch != '\n' && s.ch >= 0 { + if s.ch == '\r' { + hasCR = true + } + s.next() + } + if offs == s.lineOffset { + // comment starts at the beginning of the current line + s.interpretLineComment(s.src[offs:s.offset]) + } + goto exit + } + + s.errf(offs, "comment not terminated") + +exit: + lit := s.src[offs:s.offset] + if hasCR { + // TODO: preserve /r/n + lit = stripCR(lit) + } + + return string(lit) +} + +func (s *Scanner) findLineEnd() bool { + // initial '/' already consumed + + defer func(offs int) { + // reset scanner state to where it was upon calling findLineEnd + s.ch = '/' + s.offset = offs + s.rdOffset = offs + 1 + s.next() // consume initial '/' again + }(s.offset - 1) + + // read ahead until a newline, EOF, or non-comment token is found + for s.ch == '/' || s.ch == '*' { + if s.ch == '/' { + //-style comment always contains a newline + return true + } + /*-style comment: look for newline */ + s.next() + for s.ch >= 0 { + ch := s.ch + if ch == '\n' { + return true + } + s.next() + if ch == '*' && s.ch == '/' { + s.next() + break + } + } + s.skipWhitespace(0) // s.insertSemi is set + if s.ch < 0 || s.ch == '\n' { + return true + } + if s.ch != '/' { + // non-comment token + return false + } + s.next() // consume '/' + } + + return false +} + +func isLetter(ch rune) bool { + return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch >= utf8.RuneSelf && unicode.IsLetter(ch) +} + +func isDigit(ch rune) bool { + // TODO(mpvl): Is this correct? + return '0' <= ch && ch <= '9' || ch >= utf8.RuneSelf && unicode.IsDigit(ch) +} + +func (s *Scanner) scanFieldIdentifier() string { + offs := s.offset + if s.ch == '_' { + s.next() + } + if s.ch == '#' { + s.next() + // TODO: remove this block to allow # + if isDigit(s.ch) { + return string(s.src[offs:s.offset]) + } + } + for isLetter(s.ch) || isDigit(s.ch) || s.ch == '_' || s.ch == '$' { + s.next() + } + return string(s.src[offs:s.offset]) +} + +func (s *Scanner) scanIdentifier() string { + offs := s.offset + for isLetter(s.ch) || isDigit(s.ch) || s.ch == '_' || s.ch == '$' { + s.next() + } + return string(s.src[offs:s.offset]) +} + +func isExtendedIdent(r rune) bool { + return strings.IndexRune("-_#$%. ", r) >= 0 +} + +func digitVal(ch rune) int { + switch { + case '0' <= ch && ch <= '9': + return int(ch - '0') + case ch == '_': + return 0 + case 'a' <= ch && ch <= 'f': + return int(ch - 'a' + 10) + case 'A' <= ch && ch <= 'F': + return int(ch - 'A' + 10) + } + return 16 // larger than any legal digit val +} + +func (s *Scanner) scanMantissa(base int) { + var last rune + for digitVal(s.ch) < base { + if last == '_' && s.ch == '_' { + s.errf(s.offset, "illegal '_' in number") + } + last = s.ch + s.next() + } + if last == '_' { + s.errf(s.offset-1, "illegal '_' in number") + } +} + +func (s *Scanner) scanNumber(seenDecimalPoint bool) (token.Token, string) { + // digitVal(s.ch) < 10 + offs := s.offset + tok := token.INT + + if seenDecimalPoint { + offs-- + tok = token.FLOAT + s.scanMantissa(10) + goto exponent + } + + if s.ch == '0' { + // int or float + offs := s.offset + s.next() + if s.ch == 'x' || s.ch == 'X' { + // hexadecimal int + s.next() + s.scanMantissa(16) + if s.offset-offs <= 2 { + // only scanned "0x" or "0X" + s.errf(offs, "illegal hexadecimal number") + } + } else if s.ch == 'b' { + // binary int + s.next() + s.scanMantissa(2) + if s.offset-offs <= 2 { + // only scanned "0b" + s.errf(offs, "illegal binary number") + } + } else if s.ch == 'o' { + // octal int + s.next() + s.scanMantissa(8) + if s.offset-offs <= 2 { + // only scanned "0o" + s.errf(offs, "illegal octal number") + } + } else { + // 0 or float + seenDigits := false + if s.ch >= '0' && s.ch <= '9' { + seenDigits = true + s.scanMantissa(10) + } + if s.ch == '.' || s.ch == 'e' || s.ch == 'E' { + goto fraction + } + if seenDigits { + // integer other than 0 may not start with 0 + s.errf(offs, "illegal integer number") + } + } + goto exit + } + + // decimal int or float + s.scanMantissa(10) + + // TODO: allow 3h4s, etc. + // switch s.ch { + // case 'h', 'm', 's', "µ"[0], 'u', 'n': + // } + +fraction: + if s.ch == '.' { + if p := s.offset + 1; p < len(s.src) && s.src[p] == '.' { + // interpret dot as part of a range. + goto exit + } + tok = token.FLOAT + s.next() + s.scanMantissa(10) + } + +exponent: + switch s.ch { + case 'K', 'M', 'G', 'T', 'P': + tok = token.INT // TODO: Or should we allow this to be a float? + s.next() + if s.ch == 'i' { + s.next() + } + goto exit + } + + if s.ch == 'e' || s.ch == 'E' { + tok = token.FLOAT + s.next() + if s.ch == '-' || s.ch == '+' { + s.next() + } + s.scanMantissa(10) + } + +exit: + return tok, string(s.src[offs:s.offset]) +} + +// scanEscape parses an escape sequence where rune is the accepted +// escaped quote. In case of a syntax error, it stops at the offending +// character (without consuming it) and returns false. Otherwise +// it returns true. +// +// Must be compliant with https://tools.ietf.org/html/rfc4627. +func (s *Scanner) scanEscape(quote quoteInfo) (ok, interpolation bool) { + for i := 0; i < quote.numHash; i++ { + if s.ch != '#' { + return true, false + } + s.next() + } + + offs := s.offset + + var n int + var base, max uint32 + switch s.ch { + case '(': + return true, true + case 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', '/', quote.char: + s.next() + return true, false + case '0', '1', '2', '3', '4', '5', '6', '7': + n, base, max = 3, 8, 255 + case 'x': + s.next() + n, base, max = 2, 16, 255 + case 'u': + s.next() + n, base, max = 4, 16, unicode.MaxRune + case 'U': + s.next() + n, base, max = 8, 16, unicode.MaxRune + default: + msg := "unknown escape sequence" + if s.ch < 0 { + msg = "escape sequence not terminated" + } + s.errf(offs, msg) + return false, false + } + + var x uint32 + for n > 0 { + d := uint32(digitVal(s.ch)) + if d >= base { + if s.ch < 0 { + s.errf(s.offset, "escape sequence not terminated") + } else { + s.errf(s.offset, "illegal character %#U in escape sequence", s.ch) + } + return false, false + } + x = x*base + d + s.next() + n-- + } + + // TODO: this is valid JSON, so remove, but normalize and report an error + // if for unmatched surrogate pairs . + if x > max { + s.errf(offs, "escape sequence is invalid Unicode code point") + return false, false + } + + return true, false +} + +func (s *Scanner) scanString(offs int, quote quoteInfo) (token.Token, string) { + // ", """, ', or ''' opening already consumed + + tok := token.STRING + + hasCR := false + extra := 0 + for { + ch := s.ch + if (quote.numChar != 3 && ch == '\n') || ch < 0 { + s.errf(offs, "string literal not terminated") + lit := s.src[offs:s.offset] + if hasCR { + lit = stripCR(lit) + } + return tok, string(lit) + } + + s.next() + ch, ok := s.consumeStringClose(ch, quote) + if ok { + break + } + if ch == '\r' && quote.numChar == 3 { + hasCR = true + } + if ch == '\\' { + if _, interpolation := s.scanEscape(quote); interpolation { + tok = token.INTERPOLATION + extra = 1 + s.quoteStack = append(s.quoteStack, quote) + break + } + } + } + lit := s.src[offs : s.offset+extra] + if hasCR { + lit = stripCR(lit) + } + return tok, string(lit) +} + +func (s *Scanner) consumeQuotes(quote rune, max int) (next rune, n int) { + for ; n < max; n++ { + if s.ch != quote { + return s.ch, n + } + s.next() + } + return s.ch, n +} + +func (s *Scanner) consumeStringClose(ch rune, quote quoteInfo) (next rune, atEnd bool) { + if quote.char != ch { + return ch, false + } + numChar := quote.numChar + n := numChar + quote.numHash + want := quote.char + for i := 1; i < n; i++ { + if i == numChar { + want = '#' + } + if want != s.ch { + return ch, false + } + ch = s.ch + s.next() + } + return s.ch, true +} + +func (s *Scanner) checkHashCount(offs int, quote quoteInfo) { + for i := 0; i < quote.numHash; i++ { + if s.ch != '#' { + s.errf(offs, "string literal not terminated") + return + } + s.next() + } +} + +func stripCR(b []byte) []byte { + c := make([]byte, len(b)) + i := 0 + for _, ch := range b { + if ch != '\r' { + c[i] = ch + i++ + } + } + return c[:i] +} + +// scanAttribute scans aa full attribute of the form @foo(str). An attribute +// is a lexical entry and as such whitespace is treated as normal characters +// within the attribute. +func (s *Scanner) scanAttribute() (tok token.Token, lit string) { + offs := s.offset - 1 // @ already consumed + + s.scanIdentifier() + + if _, tok, _ := s.Scan(); tok == token.LPAREN { + s.scanAttributeTokens(token.RPAREN) + } else { + s.errf(s.offset, "invalid attribute: expected '('") + } + return token.ATTRIBUTE, string(s.src[offs:s.offset]) +} + +func (s *Scanner) scanAttributeTokens(close token.Token) { + for { + switch _, tok, _ := s.Scan(); tok { + case close: + return + case token.EOF: + s.errf(s.offset, "attribute missing '%s'", close) + return + + case token.INTERPOLATION: + s.errf(s.offset, "interpolation not allowed in attribute") + s.popInterpolation() + s.recoverParen(1) + case token.LPAREN: + s.scanAttributeTokens(token.RPAREN) + case token.LBRACE: + s.scanAttributeTokens(token.RBRACE) + case token.LBRACK: + s.scanAttributeTokens(token.RBRACK) + case token.RPAREN, token.RBRACK, token.RBRACE: + s.errf(s.offset, "unexpected '%s'", tok) + } + } +} + +// recoverParen is an approximate recovery mechanism to recover from invalid +// attributes. +func (s *Scanner) recoverParen(open int) { + for { + switch s.ch { + case '\n', -1: + return + case '(': + open++ + case ')': + if open--; open == 0 { + return + } + } + s.next() + } +} + +func (s *Scanner) skipWhitespace(inc int) { + for { + switch s.ch { + case ' ', '\t': + s.spacesSinceLast += inc + case '\n': + s.linesSinceLast += inc + if s.insertEOL { + return + } + case '\r': + default: + return + } + s.next() + } +} + +// Helper functions for scanning multi-byte tokens such as >> += >>= . +// Different routines recognize different length tok_i based on matches +// of ch_i. If a token ends in '=', the result is tok1 or tok3 +// respectively. Otherwise, the result is tok0 if there was no other +// matching character, or tok2 if the matching character was ch2. + +func (s *Scanner) switch2(tok0, tok1 token.Token) token.Token { + if s.ch == '=' { + s.next() + return tok1 + } + return tok0 +} + +func (s *Scanner) popInterpolation() quoteInfo { + quote := s.quoteStack[len(s.quoteStack)-1] + s.quoteStack = s.quoteStack[:len(s.quoteStack)-1] + return quote +} + +// ResumeInterpolation resumes scanning of a string interpolation. +func (s *Scanner) ResumeInterpolation() string { + quote := s.popInterpolation() + _, str := s.scanString(s.offset-1, quote) + return str +} + +// Scan scans the next token and returns the token position, the token, +// and its literal string if applicable. The source end is indicated by +// EOF. +// +// If the returned token is a literal (IDENT, INT, FLOAT, +// IMAG, CHAR, STRING) or COMMENT, the literal string +// has the corresponding value. +// +// If the returned token is a keyword, the literal string is the keyword. +// +// If the returned token is Comma, the corresponding +// literal string is "," if the comma was present in the source, +// and "\n" if the semicolon was inserted because of a newline or +// at EOF. +// +// If the returned token is ILLEGAL, the literal string is the +// offending character. +// +// In all other cases, Scan returns an empty literal string. +// +// For more tolerant parsing, Scan will return a valid token if +// possible even if a syntax error was encountered. Thus, even +// if the resulting token sequence contains no illegal tokens, +// a client may not assume that no error occurred. Instead it +// must check the scanner's ErrorCount or the number of calls +// of the error handler, if there was one installed. +// +// Scan adds line information to the file added to the file +// set with Init. Token positions are relative to that file +// and thus relative to the file set. +func (s *Scanner) Scan() (pos token.Pos, tok token.Token, lit string) { +scanAgain: + s.skipWhitespace(1) + + var rel token.RelPos + switch { + case s.linesSinceLast > 1: + rel = token.NewSection + case s.linesSinceLast == 1: + rel = token.Newline + case s.spacesSinceLast > 0: + rel = token.Blank + default: + rel = token.NoSpace + } + // current token start + offset := s.offset + pos = s.file.Pos(offset, rel) + + // determine token value + insertEOL := false + var quote quoteInfo + switch ch := s.ch; { + case '0' <= ch && ch <= '9': + insertEOL = true + tok, lit = s.scanNumber(false) + case isLetter(ch), ch == '$', ch == '#': + lit = s.scanFieldIdentifier() + if len(lit) > 1 { + // keywords are longer than one letter - avoid lookup otherwise + tok = token.Lookup(lit) + insertEOL = true + break + } + if ch != '#' || (s.ch != '\'' && s.ch != '"' && s.ch != '#') { + tok = token.IDENT + insertEOL = true + break + } + quote.numHash = 1 + ch = s.ch + fallthrough + default: + s.next() // always make progress + switch ch { + case -1: + if s.insertEOL { + s.insertEOL = false // EOF consumed + return s.file.Pos(offset, token.Elided), token.COMMA, "\n" + } + tok = token.EOF + case '_': + if s.ch == '|' { + // Unconditionally require this to be followed by another + // underscore to avoid needing an extra lookahead. + // Note that `_|x` is always equal to _. + s.next() + if s.ch != '_' { + s.errf(s.file.Offset(pos), "illegal token '_|'; expected '_'") + insertEOL = s.insertEOL // preserve insertComma info + tok = token.ILLEGAL + lit = "_|" + break + } + s.next() + tok = token.BOTTOM + lit = "_|_" + } else { + tok = token.IDENT + lit = "_" + s.scanFieldIdentifier() + } + insertEOL = true + + case '\n': + // we only reach here if s.insertComma was + // set in the first place and exited early + // from s.skipWhitespace() + s.insertEOL = false // newline consumed + p := s.file.Pos(offset, token.Elided) + s.skipWhitespace(1) + // Don't elide comma before a ',' or ':' to ensure JSON + // conformance. Note that cue fmt should immediately undo those. + if s.ch == ',' || s.ch == ':' { + return s.Scan() + } + return p, token.COMMA, "\n" + + case '#': + for quote.numHash++; s.ch == '#'; quote.numHash++ { + s.next() + } + ch = s.ch + if ch != '\'' && ch != '"' { + break + } + s.next() + fallthrough + case '"', '\'': + insertEOL = true + quote.char = ch + quote.numChar = 1 + offs := s.offset - 1 - quote.numHash + switch _, n := s.consumeQuotes(ch, 2); n { + case 0: + quote.numChar = 1 + tok, lit = s.scanString(offs, quote) + case 1: + s.checkHashCount(offs, quote) + tok, lit = token.STRING, string(s.src[offs:s.offset]) + case 2: + quote.numChar = 3 + switch s.ch { + case '\n': + s.next() + tok, lit = s.scanString(offs, quote) + case '\r': + s.next() + if s.ch == '\n' { + s.next() + tok, lit = s.scanString(offs, quote) + break + } + fallthrough + default: + s.errf(offs, "expected newline after multiline quote %s", + s.src[offs:s.offset]) + tok, lit = token.STRING, string(s.src[offs:s.offset]) + } + } + case '@': + insertEOL = true + tok, lit = s.scanAttribute() + case ':': + if s.ch == ':' { + s.next() + tok = token.ISA + } else { + tok = token.COLON + } + case ';': + tok = token.SEMICOLON + insertEOL = true + case '?': + tok = token.OPTION + insertEOL = true + case '.': + if '0' <= s.ch && s.ch <= '9' { + insertEOL = true + tok, lit = s.scanNumber(true) + } else if s.ch == '.' { + s.next() + if s.ch == '.' { + s.next() + tok = token.ELLIPSIS + insertEOL = true + } else { + s.errf(s.file.Offset(pos), "illegal token '..'; expected '.'") + } + } else { + tok = token.PERIOD + } + case ',': + tok = token.COMMA + lit = "," + case '(': + tok = token.LPAREN + case ')': + insertEOL = true + tok = token.RPAREN + case '[': + tok = token.LBRACK + case ']': + insertEOL = true + tok = token.RBRACK + case '{': + tok = token.LBRACE + case '}': + insertEOL = true + tok = token.RBRACE + case '+': + tok = token.ADD // Consider ++ for list concatenate. + case '-': + tok = token.SUB + case '*': + tok = token.MUL + case '/': + if s.ch == '/' { + // comment + if s.insertEOL && s.findLineEnd() { + // reset position to the beginning of the comment + s.ch = '/' + s.offset = s.file.Offset(pos) + s.rdOffset = s.offset + 1 + s.insertEOL = false // newline consumed + return s.file.Pos(offset, token.Elided), token.COMMA, "\n" + } + comment := s.scanComment() + if s.mode&ScanComments == 0 { + // skip comment + s.insertEOL = false // newline consumed + goto scanAgain + } + tok = token.COMMENT + lit = comment + } else { + tok = token.QUO + } + // We no longer use %, but seems like a useful token to use for + // something else at some point. + // case '%': + case '<': + if s.ch == '-' { + s.next() + tok = token.ARROW + } else { + tok = s.switch2(token.LSS, token.LEQ) + } + case '>': + tok = s.switch2(token.GTR, token.GEQ) + case '=': + if s.ch == '~' { + s.next() + tok = token.MAT + } else { + tok = s.switch2(token.BIND, token.EQL) + } + case '!': + if s.ch == '~' { + s.next() + tok = token.NMAT + } else { + tok = s.switch2(token.NOT, token.NEQ) + } + case '&': + switch s.ch { + case '&': + s.next() + tok = token.LAND + default: + tok = token.AND + } + case '|': + if s.ch == '|' { + s.next() + tok = token.LOR + } else { + tok = token.OR + } + default: + // next reports unexpected BOMs - don't repeat + if ch != bom { + s.errf(s.file.Offset(pos), "illegal character %#U", ch) + } + insertEOL = s.insertEOL // preserve insertSemi info + tok = token.ILLEGAL + lit = string(ch) + } + } + if s.mode&dontInsertCommas == 0 { + s.insertEOL = insertEOL + } + + s.linesSinceLast = 0 + s.spacesSinceLast = 0 + return +} diff --git a/vendor/cuelang.org/go/cue/token/position.go b/vendor/cuelang.org/go/cue/token/position.go new file mode 100644 index 0000000000..937108382b --- /dev/null +++ b/vendor/cuelang.org/go/cue/token/position.go @@ -0,0 +1,472 @@ +// Copyright 2018 The CUE Authors +// +// 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 token + +import ( + "fmt" + "sort" + "sync" +) + +// ----------------------------------------------------------------------------- +// Positions + +// Position describes an arbitrary source position +// including the file, line, and column location. +// A Position is valid if the line number is > 0. +type Position struct { + Filename string // filename, if any + Offset int // offset, starting at 0 + Line int // line number, starting at 1 + Column int // column number, starting at 1 (byte count) + // RelPos Pos // relative position information +} + +// IsValid reports whether the position is valid. +func (pos *Position) IsValid() bool { return pos.Line > 0 } + +// String returns a string in one of several forms: +// +// file:line:column valid position with file name +// line:column valid position without file name +// file invalid position with file name +// - invalid position without file name +// +func (pos Position) String() string { + s := pos.Filename + if pos.IsValid() { + if s != "" { + s += ":" + } + s += fmt.Sprintf("%d:%d", pos.Line, pos.Column) + } + if s == "" { + s = "-" + } + return s +} + +// Pos is a compact encoding of a source position within a file, as well as +// relative positioning information. It can be converted into a Position for a +// more convenient, but much larger, representation. +// +type Pos struct { + file *File + offset int +} + +// File returns the file that contains the position p or nil if there is no +// such file (for instance for p == NoPos). +// +func (p Pos) File() *File { + if p.index() == 0 { + return nil + } + return p.file +} + +func (p Pos) Line() int { + if p.file == nil { + return 0 + } + return p.Position().Line +} + +func (p Pos) Column() int { + if p.file == nil { + return 0 + } + return p.Position().Column +} + +func (p Pos) Filename() string { + if p.file == nil { + return "" + } + return p.Position().Filename +} + +func (p Pos) Position() Position { + if p.file == nil { + return Position{} + } + return p.file.Position(p) +} + +func (p Pos) String() string { + return p.Position().String() +} + +// NoPos is the zero value for Pos; there is no file and line information +// associated with it, and NoPos().IsValid() is false. NoPos is always +// smaller than any other Pos value. The corresponding Position value +// for NoPos is the zero value for Position. +var NoPos = Pos{} + +// RelPos indicates the relative position of token to the previous token. +type RelPos int + +const ( + // NoRelPos indicates no relative position is specified. + NoRelPos RelPos = iota + + // Elided indicates that the token for which this position is defined is + // not rendered at all. + Elided + + // NoSpace indicates there is no whitespace after this token. + NoSpace + + // Blank means there is horizontal space after this token. + Blank + + // Newline means there is a single newline after this token. + Newline + + // NewSection means there are two or more newlines after this token. + NewSection + + relMask = 0xf + relShift = 4 +) + +var relNames = []string{ + "invalid", "elided", "nospace", "blank", "newline", "section", +} + +func (p RelPos) String() string { return relNames[p] } + +func (p RelPos) Pos() Pos { + return Pos{nil, int(p)} +} + +// HasRelPos repors whether p has a relative position. +func (p Pos) HasRelPos() bool { + return p.offset&relMask != 0 + +} + +func (p Pos) Before(q Pos) bool { + return p.file == q.file && p.Offset() < q.Offset() +} + +// Offset reports the byte offset relative to the file. +func (p Pos) Offset() int { + return p.Position().Offset +} + +// Add creates a new position relative to the p offset by n. +func (p Pos) Add(n int) Pos { + return Pos{p.file, p.offset + toPos(index(n))} +} + +// IsValid reports whether the position is valid. +func (p Pos) IsValid() bool { + return p != NoPos +} + +// IsNewline reports whether the relative information suggests this node should +// be printed on a new lien. +func (p Pos) IsNewline() bool { + return p.RelPos() >= Newline +} + +func (p Pos) WithRel(rel RelPos) Pos { + return Pos{p.file, p.offset&^relMask | int(rel)} +} + +func (p Pos) RelPos() RelPos { + return RelPos(p.offset & relMask) +} + +func (p Pos) index() index { + return index(p.offset) >> relShift +} + +func toPos(x index) int { + return (int(x) << relShift) +} + +// ----------------------------------------------------------------------------- +// File + +type index int + +// A File has a name, size, and line offset table. +type File struct { + mutex sync.RWMutex + name string // file name as provided to AddFile + base index // Pos index range for this file is [base...base+size] + size index // file size as provided to AddFile + + // lines and infos are protected by set.mutex + lines []index // lines contains the offset of the first character for each line (the first entry is always 0) + infos []lineInfo +} + +// NewFile returns a new file. +func NewFile(filename string, base, size int) *File { + if base < 0 { + base = 1 + } + return &File{sync.RWMutex{}, filename, index(base), index(size), []index{0}, nil} +} + +// Name returns the file name of file f as registered with AddFile. +func (f *File) Name() string { + return f.name +} + +// Base returns the base offset of file f as registered with AddFile. +func (f *File) Base() int { + return int(f.base) +} + +// Size returns the size of file f as registered with AddFile. +func (f *File) Size() int { + return int(f.size) +} + +// LineCount returns the number of lines in file f. +func (f *File) LineCount() int { + f.mutex.RLock() + n := len(f.lines) + f.mutex.RUnlock() + return n +} + +// AddLine adds the line offset for a new line. +// The line offset must be larger than the offset for the previous line +// and smaller than the file size; otherwise the line offset is ignored. +// +func (f *File) AddLine(offset int) { + x := index(offset) + f.mutex.Lock() + if i := len(f.lines); (i == 0 || f.lines[i-1] < x) && x < f.size { + f.lines = append(f.lines, x) + } + f.mutex.Unlock() +} + +// MergeLine merges a line with the following line. It is akin to replacing +// the newline character at the end of the line with a space (to not change the +// remaining offsets). To obtain the line number, consult e.g. Position.Line. +// MergeLine will panic if given an invalid line number. +// +func (f *File) MergeLine(line int) { + if line <= 0 { + panic("illegal line number (line numbering starts at 1)") + } + f.mutex.Lock() + defer f.mutex.Unlock() + if line >= len(f.lines) { + panic("illegal line number") + } + // To merge the line numbered with the line numbered , + // we need to remove the entry in lines corresponding to the line + // numbered . The entry in lines corresponding to the line + // numbered is located at index , since indices in lines + // are 0-based and line numbers are 1-based. + copy(f.lines[line:], f.lines[line+1:]) + f.lines = f.lines[:len(f.lines)-1] +} + +// SetLines sets the line offsets for a file and reports whether it succeeded. +// The line offsets are the offsets of the first character of each line; +// for instance for the content "ab\nc\n" the line offsets are {0, 3}. +// An empty file has an empty line offset table. +// Each line offset must be larger than the offset for the previous line +// and smaller than the file size; otherwise SetLines fails and returns +// false. +// Callers must not mutate the provided slice after SetLines returns. +// +func (f *File) SetLines(lines []int) bool { + // verify validity of lines table + size := f.size + for i, offset := range lines { + if i > 0 && offset <= lines[i-1] || size <= index(offset) { + return false + } + } + + // set lines table + f.mutex.Lock() + f.lines = f.lines[:0] + for _, l := range lines { + f.lines = append(f.lines, index(l)) + } + f.mutex.Unlock() + return true +} + +// SetLinesForContent sets the line offsets for the given file content. +// It ignores position-altering //line comments. +func (f *File) SetLinesForContent(content []byte) { + var lines []index + line := index(0) + for offset, b := range content { + if line >= 0 { + lines = append(lines, line) + } + line = -1 + if b == '\n' { + line = index(offset) + 1 + } + } + + // set lines table + f.mutex.Lock() + f.lines = lines + f.mutex.Unlock() +} + +// A lineInfo object describes alternative file and line number +// information (such as provided via a //line comment in a .go +// file) for a given file offset. +type lineInfo struct { + // fields are exported to make them accessible to gob + Offset int + Filename string + Line int +} + +// AddLineInfo adds alternative file and line number information for +// a given file offset. The offset must be larger than the offset for +// the previously added alternative line info and smaller than the +// file size; otherwise the information is ignored. +// +// AddLineInfo is typically used to register alternative position +// information for //line filename:line comments in source files. +// +func (f *File) AddLineInfo(offset int, filename string, line int) { + x := index(offset) + f.mutex.Lock() + if i := len(f.infos); i == 0 || index(f.infos[i-1].Offset) < x && x < f.size { + f.infos = append(f.infos, lineInfo{offset, filename, line}) + } + f.mutex.Unlock() +} + +// Pos returns the Pos value for the given file offset; +// the offset must be <= f.Size(). +// f.Pos(f.Offset(p)) == p. +// +func (f *File) Pos(offset int, rel RelPos) Pos { + if index(offset) > f.size { + panic("illegal file offset") + } + return Pos{f, toPos(f.base+index(offset)) + int(rel)} +} + +// Offset returns the offset for the given file position p; +// p must be a valid Pos value in that file. +// f.Offset(f.Pos(offset)) == offset. +// +func (f *File) Offset(p Pos) int { + x := p.index() + if x < f.base || x > f.base+index(f.size) { + panic("illegal Pos value") + } + return int(x - f.base) +} + +// Line returns the line number for the given file position p; +// p must be a Pos value in that file or NoPos. +// +func (f *File) Line(p Pos) int { + return f.Position(p).Line +} + +func searchLineInfos(a []lineInfo, x int) int { + return sort.Search(len(a), func(i int) bool { return a[i].Offset > x }) - 1 +} + +// unpack returns the filename and line and column number for a file offset. +// If adjusted is set, unpack will return the filename and line information +// possibly adjusted by //line comments; otherwise those comments are ignored. +// +func (f *File) unpack(offset index, adjusted bool) (filename string, line, column int) { + filename = f.name + if i := searchInts(f.lines, offset); i >= 0 { + line, column = int(i+1), int(offset-f.lines[i]+1) + } + if adjusted && len(f.infos) > 0 { + // almost no files have extra line infos + if i := searchLineInfos(f.infos, int(offset)); i >= 0 { + alt := &f.infos[i] + filename = alt.Filename + if i := searchInts(f.lines, index(alt.Offset)); i >= 0 { + line += alt.Line - i - 1 + } + } + } + return +} + +func (f *File) position(p Pos, adjusted bool) (pos Position) { + offset := p.index() - f.base + pos.Offset = int(offset) + pos.Filename, pos.Line, pos.Column = f.unpack(offset, adjusted) + return +} + +// PositionFor returns the Position value for the given file position p. +// If adjusted is set, the position may be adjusted by position-altering +// //line comments; otherwise those comments are ignored. +// p must be a Pos value in f or NoPos. +// +func (f *File) PositionFor(p Pos, adjusted bool) (pos Position) { + x := p.index() + if p != NoPos { + if x < f.base || x > f.base+f.size { + panic("illegal Pos value") + } + pos = f.position(p, adjusted) + } + return +} + +// Position returns the Position value for the given file position p. +// Calling f.Position(p) is equivalent to calling f.PositionFor(p, true). +// +func (f *File) Position(p Pos) (pos Position) { + return f.PositionFor(p, true) +} + +// ----------------------------------------------------------------------------- +// Helper functions + +func searchInts(a []index, x index) int { + // This function body is a manually inlined version of: + // + // return sort.Search(len(a), func(i int) bool { return a[i] > x }) - 1 + // + // With better compiler optimizations, this may not be needed in the + // future, but at the moment this change improves the go/printer + // benchmark performance by ~30%. This has a direct impact on the + // speed of gofmt and thus seems worthwhile (2011-04-29). + // TODO(gri): Remove this when compilers have caught up. + i, j := 0, len(a) + for i < j { + h := i + (j-i)/2 // avoid overflow when computing h + // i ≤ h < j + if a[h] <= x { + i = h + 1 + } else { + j = h + } + } + return i - 1 +} diff --git a/vendor/cuelang.org/go/cue/token/token.go b/vendor/cuelang.org/go/cue/token/token.go new file mode 100644 index 0000000000..5e15443449 --- /dev/null +++ b/vendor/cuelang.org/go/cue/token/token.go @@ -0,0 +1,266 @@ +// Copyright 2018 The CUE Authors +// +// 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 token defines constants representing the lexical tokens of the Go +// programming language and basic operations on tokens (printing, predicates). +package token // import "cuelang.org/go/cue/token" + +import "strconv" + +// Token is the set of lexical tokens of the CUE configuration language. +type Token int + +// The list of tokens. +const ( + // Special tokens + ILLEGAL Token = iota + EOF + COMMENT + ATTRIBUTE // @foo(bar,baz=4) + + literalBeg + // Identifiers and basic type literals + // (these tokens stand for classes of literals) + IDENT // main, _tmp + INT // 12_345Mi, 0700, 0xdeadbeef, 1.2M + FLOAT // 123.45, + // DURATION // 3m4s TODO + STRING // "abc" + INTERPOLATION // a part of a template string, e.g. `"age: \(` + BOTTOM // _|_ + + literalEnd + + operatorBeg + // Operators and delimiters + ADD // + + SUB // - + MUL // * + POW // ^ + QUO // / + + IQUO // quo + IREM // rem + IDIV // div + IMOD // mod + + AND // & + OR // | + + LAND // && + LOR // || + + BIND // = + EQL // == + LSS // < + GTR // > + NOT // ! + ARROW // <- + + NEQ // != + LEQ // <= + GEQ // >= + + MAT // =~ + NMAT // !~ + + LPAREN // ( + LBRACK // [ + LBRACE // { + COMMA // , + PERIOD // . + ELLIPSIS // ... + + RPAREN // ) + RBRACK // ] + RBRACE // } + SEMICOLON // ; + COLON // : + ISA // :: + OPTION // ? + operatorEnd + + keywordBeg + + IF + FOR + IN + LET + + TRUE + FALSE + NULL + + keywordEnd +) + +var tokens = [...]string{ + ILLEGAL: "ILLEGAL", + + EOF: "EOF", + COMMENT: "COMMENT", + + IDENT: "IDENT", + INT: "INT", + FLOAT: "FLOAT", + STRING: "STRING", + INTERPOLATION: "INTERPOLATION", + ATTRIBUTE: "ATTRIBUTE", + + ADD: "+", + SUB: "-", + MUL: "*", + POW: "^", + QUO: "/", + + IQUO: "quo", + IREM: "rem", + IDIV: "div", + IMOD: "mod", + + AND: "&", + OR: "|", + + LAND: "&&", + LOR: "||", + + BIND: "=", + EQL: "==", + LSS: "<", + GTR: ">", + NOT: "!", + ARROW: "<-", + + NEQ: "!=", + LEQ: "<=", + GEQ: ">=", + + MAT: "=~", + NMAT: "!~", + + LPAREN: "(", + LBRACK: "[", + LBRACE: "{", + COMMA: ",", + PERIOD: ".", + ELLIPSIS: "...", + + RPAREN: ")", + RBRACK: "]", + RBRACE: "}", + SEMICOLON: ";", + COLON: ":", + ISA: "::", + OPTION: "?", + + BOTTOM: "_|_", + + FALSE: "false", + TRUE: "true", + NULL: "null", + + FOR: "for", + IF: "if", + IN: "in", + LET: "let", +} + +// String returns the string corresponding to the token tok. +// For operators, delimiters, and keywords the string is the actual +// token character sequence (e.g., for the token ADD, the string is +// "+"). For all other tokens the string corresponds to the token +// constant name (e.g. for the token IDENT, the string is "IDENT"). +func (tok Token) String() string { + s := "" + if 0 <= tok && tok < Token(len(tokens)) { + s = tokens[tok] + } + if s == "" { + s = "token(" + strconv.Itoa(int(tok)) + ")" + } + return s +} + +// A set of constants for precedence-based expression parsing. +// Non-operators have lowest precedence, followed by operators +// starting with precedence 1 up to unary operators. The highest +// precedence serves as "catch-all" precedence for selector, +// indexing, and other operator and delimiter tokens. +const ( + LowestPrec = lowestPrec + UnaryPrec = unaryPrec + HighestPrec = highestPrec +) + +const ( + lowestPrec = 0 // non-operators + unaryPrec = 8 + highestPrec = 9 +) + +// Precedence returns the operator precedence of the binary +// operator op. If op is not a binary operator, the result +// is LowestPrecedence. +// +func (tok Token) Precedence() int { + switch tok { + case OR: + return 1 + case AND: + return 2 + case LOR: + return 3 + case LAND: + return 4 + case EQL, NEQ, LSS, LEQ, GTR, GEQ, MAT, NMAT: + return 5 + case ADD, SUB: + return 6 + case MUL, QUO, IDIV, IMOD, IQUO, IREM: + return 7 + } + return lowestPrec +} + +var keywords map[string]Token + +func init() { + keywords = make(map[string]Token) + for i := keywordBeg + 1; i < keywordEnd; i++ { + keywords[tokens[i]] = i + } +} + +// Lookup maps an identifier to its keyword token or IDENT (if not a keyword). +// +func Lookup(ident string) Token { + if tok, isKeyword := keywords[ident]; isKeyword { + return tok + } + return IDENT +} + +// Predicates + +// IsLiteral returns true for tokens corresponding to identifiers +// and basic type literals; it returns false otherwise. +func (tok Token) IsLiteral() bool { return literalBeg < tok && tok < literalEnd } + +// IsOperator returns true for tokens corresponding to operators and +// delimiters; it returns false otherwise. +func (tok Token) IsOperator() bool { return operatorBeg < tok && tok < operatorEnd } + +// IsKeyword returns true for tokens corresponding to keywords; +// it returns false otherwise. +func (tok Token) IsKeyword() bool { return keywordBeg < tok && tok < keywordEnd } diff --git a/vendor/cuelang.org/go/cue/types.go b/vendor/cuelang.org/go/cue/types.go new file mode 100644 index 0000000000..11528bef19 --- /dev/null +++ b/vendor/cuelang.org/go/cue/types.go @@ -0,0 +1,2536 @@ +// Copyright 2018 The CUE Authors +// +// 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 cue + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "math" + "math/big" + "strings" + + "github.com/cockroachdb/apd/v2" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/ast/astutil" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/token" + "cuelang.org/go/internal" + "cuelang.org/go/internal/core/adt" + "cuelang.org/go/internal/core/compile" + "cuelang.org/go/internal/core/convert" + "cuelang.org/go/internal/core/eval" + "cuelang.org/go/internal/core/export" + "cuelang.org/go/internal/core/runtime" + "cuelang.org/go/internal/core/subsume" + "cuelang.org/go/internal/core/validate" + "cuelang.org/go/internal/types" +) + +// Kind determines the underlying type of a Value. +type Kind = adt.Kind + +const ( + // BottomKind represents the bottom value. + BottomKind Kind = adt.BottomKind + + // NullKind indicates a null value. + NullKind Kind = adt.NullKind + + // BoolKind indicates a boolean value. + BoolKind Kind = adt.BoolKind + + // IntKind represents an integral number. + IntKind Kind = adt.IntKind + + // FloatKind represents a decimal float point number that cannot be + // converted to an integer. The underlying number may still be integral, + // but resulting from an operation that enforces the float type. + FloatKind Kind = adt.FloatKind + + // StringKind indicates any kind of string. + StringKind Kind = adt.StringKind + + // BytesKind is a blob of data. + BytesKind Kind = adt.BytesKind + + // StructKind is a kev-value map. + StructKind Kind = adt.StructKind + + // ListKind indicates a list of values. + ListKind Kind = adt.ListKind + + // _numberKind is used as a implementation detail inside + // Kind.String to indicate NumberKind. + + // NumberKind represents any kind of number. + NumberKind Kind = IntKind | FloatKind + + // TopKind represents the top value. + TopKind Kind = adt.TopKind +) + +// An structValue represents a JSON object. +// +// TODO: remove +type structValue struct { + ctx *adt.OpContext + v Value + obj *adt.Vertex + features []adt.Feature +} + +type hiddenStructValue = structValue + +// Len reports the number of fields in this struct. +func (o *hiddenStructValue) Len() int { + if o.obj == nil { + return 0 + } + return len(o.features) +} + +// At reports the key and value of the ith field, i < o.Len(). +func (o *hiddenStructValue) At(i int) (key string, v Value) { + f := o.features[i] + return o.v.idx.LabelStr(f), newChildValue(o, i) +} + +func (o *hiddenStructValue) at(i int) (v *adt.Vertex, isOpt bool) { + f := o.features[i] + arc := o.obj.Lookup(f) + if arc == nil { + arc = &adt.Vertex{ + Parent: o.v.v, + Label: f, + } + o.obj.MatchAndInsert(o.ctx, arc) + arc.Finalize(o.ctx) + isOpt = true + } + return arc, isOpt +} + +// Lookup reports the field for the given key. The returned Value is invalid +// if it does not exist. +func (o *hiddenStructValue) Lookup(key string) Value { + f := o.v.idx.StrLabel(key) + i := 0 + len := o.Len() + for ; i < len; i++ { + if o.features[i] == f { + break + } + } + if i == len { + x := mkErr(o.v.idx, o.obj, 0, "field not found: %v", key) + x.NotExists = true + // TODO: more specifically we should test whether the values that + // are addressable from the root of the configuration can support the + // looked up value. This will avoid false positives such as when + // an open literal struct is passed to a builtin. + if o.obj.Accept(o.ctx, f) { + x.Code = adt.IncompleteError + } + return newErrValue(o.v, x) + } + return newChildValue(o, i) +} + +// MarshalJSON returns a valid JSON encoding or reports an error if any of the +// fields is invalid. +func (o *structValue) marshalJSON() (b []byte, err errors.Error) { + b = append(b, '{') + n := o.Len() + for i := 0; i < n; i++ { + k, v := o.At(i) + s, err := json.Marshal(k) + if err != nil { + return nil, unwrapJSONError(err) + } + b = append(b, s...) + b = append(b, ':') + bb, err := json.Marshal(v) + if err != nil { + return nil, unwrapJSONError(err) + } + b = append(b, bb...) + if i < n-1 { + b = append(b, ',') + } + } + b = append(b, '}') + return b, nil +} + +var _ errors.Error = &marshalError{} + +type marshalError struct { + err errors.Error + b *adt.Bottom +} + +func toMarshalErr(v Value, b *adt.Bottom) error { + return &marshalError{v.toErr(b), b} +} + +func marshalErrf(v Value, src adt.Node, code adt.ErrorCode, msg string, args ...interface{}) error { + arguments := append([]interface{}{code, msg}, args...) + b := mkErr(v.idx, src, arguments...) + return toMarshalErr(v, b) +} + +func (e *marshalError) Error() string { + return fmt.Sprintf("cue: marshal error: %v", e.err) +} + +func (e *marshalError) Bottom() *adt.Bottom { return e.b } +func (e *marshalError) Path() []string { return e.err.Path() } +func (e *marshalError) Msg() (string, []interface{}) { return e.err.Msg() } +func (e *marshalError) Position() token.Pos { return e.err.Position() } +func (e *marshalError) InputPositions() []token.Pos { + return e.err.InputPositions() +} + +func unwrapJSONError(err error) errors.Error { + switch x := err.(type) { + case *json.MarshalerError: + return unwrapJSONError(x.Err) + case *marshalError: + return x + case errors.Error: + return &marshalError{x, nil} + default: + return &marshalError{errors.Wrapf(err, token.NoPos, "json error"), nil} + } +} + +// An Iterator iterates over values. +// +type Iterator struct { + val Value + idx *runtime.Runtime + ctx *adt.OpContext + arcs []field + p int + cur Value + f adt.Feature + isOpt bool +} + +type hiddenIterator = Iterator + +type field struct { + arc *adt.Vertex + isOptional bool +} + +// Next advances the iterator to the next value and reports whether there was +// any. It must be called before the first call to Value or Key. +func (i *Iterator) Next() bool { + if i.p >= len(i.arcs) { + i.cur = Value{} + return false + } + f := i.arcs[i.p] + f.arc.Finalize(i.ctx) + p := linkParent(i.val.parent_, i.val.v, f.arc) + i.cur = makeValue(i.val.idx, f.arc, p) + i.f = f.arc.Label + i.isOpt = f.isOptional + i.p++ + return true +} + +// Value returns the current value in the list. It will panic if Next advanced +// past the last entry. +func (i *Iterator) Value() Value { + return i.cur +} + +// Selector reports the field label of this iteration. +func (i *Iterator) Selector() Selector { + return featureToSel(i.f, i.idx) +} + +// Label reports the label of the value if i iterates over struct fields and "" +// otherwise. +// +// +// Slated to be deprecated: use i.Selector().String(). Note that this will give +// more accurate string representations. +func (i *hiddenIterator) Label() string { + if i.f == 0 { + return "" + } + return i.idx.LabelStr(i.f) +} + +// IsHidden reports if a field is hidden from the data model. +// +// Deprecated: use i.Selector().PkgPath() != "" +func (i *hiddenIterator) IsHidden() bool { + return i.f.IsHidden() +} + +// IsOptional reports if a field is optional. +func (i *Iterator) IsOptional() bool { + return i.isOpt +} + +// IsDefinition reports if a field is a definition. +// +// Deprecated: use i.Selector().IsDefinition() +func (i *hiddenIterator) IsDefinition() bool { + return i.f.IsDef() +} + +// marshalJSON iterates over the list and generates JSON output. HasNext +// will return false after this operation. +func marshalList(l *Iterator) (b []byte, err errors.Error) { + b = append(b, '[') + if l.Next() { + for i := 0; ; i++ { + x, err := json.Marshal(l.Value()) + if err != nil { + return nil, unwrapJSONError(err) + } + b = append(b, x...) + if !l.Next() { + break + } + b = append(b, ',') + } + } + b = append(b, ']') + return b, nil +} + +func (v Value) getNum(k adt.Kind) (*adt.Num, errors.Error) { + v, _ = v.Default() + ctx := v.ctx() + if err := v.checkKind(ctx, k); err != nil { + return nil, v.toErr(err) + } + n, _ := v.eval(ctx).(*adt.Num) + return n, nil +} + +// MantExp breaks x into its mantissa and exponent components and returns the +// exponent. If a non-nil mant argument is provided its value is set to the +// mantissa of x. The components satisfy x == mant × 10**exp. It returns an +// error if v is not a number. +// +// The components are not normalized. For instance, 2.00 is represented mant == +// 200 and exp == -2. Calling MantExp with a nil argument is an efficient way to +// get the exponent of the receiver. +func (v Value) MantExp(mant *big.Int) (exp int, err error) { + n, err := v.getNum(adt.NumKind) + if err != nil { + return 0, err + } + if n.X.Form != 0 { + return 0, ErrInfinite + } + if mant != nil { + mant.Set(&n.X.Coeff) + if n.X.Negative { + mant.Neg(mant) + } + } + return int(n.X.Exponent), nil +} + +// Decimal is for internal use only. The Decimal type that is returned is +// subject to change. +func (v hiddenValue) Decimal() (d *internal.Decimal, err error) { + n, err := v.getNum(adt.NumKind) + if err != nil { + return nil, err + } + return &n.X, nil +} + +// AppendInt appends the string representation of x in the given base to buf and +// returns the extended buffer, or an error if the underlying number was not +// an integer. +func (v Value) AppendInt(buf []byte, base int) ([]byte, error) { + i, err := v.Int(nil) + if err != nil { + return nil, err + } + return i.Append(buf, base), nil +} + +// AppendFloat appends to buf the string form of the floating-point number x. +// It returns an error if v is not a number. +func (v Value) AppendFloat(buf []byte, fmt byte, prec int) ([]byte, error) { + n, err := v.getNum(adt.NumKind) + if err != nil { + return nil, err + } + ctx := apd.BaseContext + nd := int(apd.NumDigits(&n.X.Coeff)) + int(n.X.Exponent) + if n.X.Form == apd.Infinite { + if n.X.Negative { + buf = append(buf, '-') + } + return append(buf, string('∞')...), nil + } + if fmt == 'f' && nd > 0 { + ctx.Precision = uint32(nd + prec) + } else { + ctx.Precision = uint32(prec) + } + var d apd.Decimal + ctx.Round(&d, &n.X) + return d.Append(buf, fmt), nil +} + +var ( + // ErrBelow indicates that a value was rounded down in a conversion. + ErrBelow = errors.New("value was rounded down") + + // ErrAbove indicates that a value was rounded up in a conversion. + ErrAbove = errors.New("value was rounded up") + + // ErrInfinite indicates that a value is infinite. + ErrInfinite = errors.New("infinite") +) + +// Int converts the underlying integral number to an big.Int. It reports an +// error if the underlying value is not an integer type. If a non-nil *Int +// argument z is provided, Int stores the result in z instead of allocating a +// new Int. +func (v Value) Int(z *big.Int) (*big.Int, error) { + n, err := v.getNum(adt.IntKind) + if err != nil { + return nil, err + } + if z == nil { + z = &big.Int{} + } + if n.X.Exponent != 0 { + panic("cue: exponent should always be nil for integer types") + } + z.Set(&n.X.Coeff) + if n.X.Negative { + z.Neg(z) + } + return z, nil +} + +// Int64 converts the underlying integral number to int64. It reports an +// error if the underlying value is not an integer type or cannot be represented +// as an int64. The result is (math.MinInt64, ErrAbove) for x < math.MinInt64, +// and (math.MaxInt64, ErrBelow) for x > math.MaxInt64. +func (v Value) Int64() (int64, error) { + n, err := v.getNum(adt.IntKind) + if err != nil { + return 0, err + } + if !n.X.Coeff.IsInt64() { + if n.X.Negative { + return math.MinInt64, ErrAbove + } + return math.MaxInt64, ErrBelow + } + i := n.X.Coeff.Int64() + if n.X.Negative { + i = -i + } + return i, nil +} + +// Uint64 converts the underlying integral number to uint64. It reports an +// error if the underlying value is not an integer type or cannot be represented +// as a uint64. The result is (0, ErrAbove) for x < 0, and +// (math.MaxUint64, ErrBelow) for x > math.MaxUint64. +func (v Value) Uint64() (uint64, error) { + n, err := v.getNum(adt.IntKind) + if err != nil { + return 0, err + } + if n.X.Negative { + return 0, ErrAbove + } + if !n.X.Coeff.IsUint64() { + return math.MaxUint64, ErrBelow + } + i := n.X.Coeff.Uint64() + return i, nil +} + +// trimZeros trims 0's for better JSON respresentations. +func trimZeros(s string) string { + n1 := len(s) + s2 := strings.TrimRight(s, "0") + n2 := len(s2) + if p := strings.IndexByte(s2, '.'); p != -1 { + if p == n2-1 { + return s[:len(s2)+1] + } + return s2 + } + if n1-n2 <= 4 { + return s + } + return fmt.Sprint(s2, "e+", n1-n2) +} + +var ( + smallestPosFloat64 *apd.Decimal + smallestNegFloat64 *apd.Decimal + maxPosFloat64 *apd.Decimal + maxNegFloat64 *apd.Decimal +) + +func init() { + const ( + // math.SmallestNonzeroFloat64: 1 / 2**(1023 - 1 + 52) + smallest = "4.940656458412465441765687928682213723651e-324" + // math.MaxFloat64: 2**1023 * (2**53 - 1) / 2**52 + max = "1.797693134862315708145274237317043567981e+308" + ) + ctx := apd.BaseContext + ctx.Precision = 40 + + var err error + smallestPosFloat64, _, err = ctx.NewFromString(smallest) + if err != nil { + panic(err) + } + smallestNegFloat64, _, err = ctx.NewFromString("-" + smallest) + if err != nil { + panic(err) + } + maxPosFloat64, _, err = ctx.NewFromString(max) + if err != nil { + panic(err) + } + maxNegFloat64, _, err = ctx.NewFromString("-" + max) + if err != nil { + panic(err) + } +} + +// Float64 returns the float64 value nearest to x. It reports an error if v is +// not a number. If x is too small to be represented by a float64 (|x| < +// math.SmallestNonzeroFloat64), the result is (0, ErrBelow) or (-0, ErrAbove), +// respectively, depending on the sign of x. If x is too large to be represented +// by a float64 (|x| > math.MaxFloat64), the result is (+Inf, ErrAbove) or +// (-Inf, ErrBelow), depending on the sign of x. +func (v Value) Float64() (float64, error) { + n, err := v.getNum(adt.NumKind) + if err != nil { + return 0, err + } + if n.X.Negative { + if n.X.Cmp(smallestNegFloat64) == 1 { + return -0, ErrAbove + } + if n.X.Cmp(maxNegFloat64) == -1 { + return math.Inf(-1), ErrBelow + } + } else { + if n.X.Cmp(smallestPosFloat64) == -1 { + return 0, ErrBelow + } + if n.X.Cmp(maxPosFloat64) == 1 { + return math.Inf(1), ErrAbove + } + } + f, _ := n.X.Float64() + return f, nil +} + +// Value holds any value, which may be a Boolean, Error, List, Null, Number, +// Struct, or String. +type Value struct { + idx *runtime.Runtime + v *adt.Vertex + // Parent keeps track of the parent if the value corresponding to v.Parent + // differs, recursively. + parent_ *parent +} + +// parent is a distinct type from Value to ensure more type safety: Value +// is typically used by value, so taking a pointer to it has a high risk +// or globbering the contents. +type parent struct { + v *adt.Vertex + p *parent +} + +func (v Value) parent() Value { + switch { + case v.v == nil: + return Value{} + case v.parent_ != nil: + return Value{v.idx, v.parent_.v, v.parent_.p} + default: + return Value{v.idx, v.v.Parent, nil} + } +} + +type valueScope Value + +func (v valueScope) Vertex() *adt.Vertex { return v.v } +func (v valueScope) Parent() compile.Scope { + p := Value(v).parent() + if p.v == nil { + return nil + } + return valueScope(p) +} + +type hiddenValue = Value + +// Core is for internal use only. +func (v hiddenValue) Core(x *types.Value) { + x.V = v.v + x.R = v.idx +} + +func newErrValue(v Value, b *adt.Bottom) Value { + node := &adt.Vertex{BaseValue: b} + if v.v != nil { + node.Label = v.v.Label + node.Parent = v.v.Parent + } + node.UpdateStatus(adt.Finalized) + node.AddConjunct(adt.MakeRootConjunct(nil, b)) + return makeChildValue(v.parent(), node) +} + +func newVertexRoot(idx *runtime.Runtime, ctx *adt.OpContext, x *adt.Vertex) Value { + if ctx != nil { + // This is indicative of an zero Value. In some cases this is called + // with an error value. + x.Finalize(ctx) + } else { + x.UpdateStatus(adt.Finalized) + } + return makeValue(idx, x, nil) +} + +func newValueRoot(idx *runtime.Runtime, ctx *adt.OpContext, x adt.Expr) Value { + if n, ok := x.(*adt.Vertex); ok { + return newVertexRoot(idx, ctx, n) + } + node := &adt.Vertex{} + node.AddConjunct(adt.MakeRootConjunct(nil, x)) + return newVertexRoot(idx, ctx, node) +} + +func newChildValue(o *structValue, i int) Value { + arc, _ := o.at(i) + return makeValue(o.v.idx, arc, linkParent(o.v.parent_, o.v.v, arc)) +} + +// Dereference reports the value v refers to if v is a reference or v itself +// otherwise. +func Dereference(v Value) Value { + n := v.v + if n == nil || len(n.Conjuncts) != 1 { + return v + } + + c := n.Conjuncts[0] + r, _ := c.Expr().(adt.Resolver) + if r == nil { + return v + } + + ctx := v.ctx() + n, b := ctx.Resolve(c.Env, r) + if b != nil { + return newErrValue(v, b) + } + n.Finalize(ctx) + // NOTE: due to structure sharing, the path of the referred node may end + // up different from the one explicitly pointed to. The value will be the + // same, but the scope may differ. + // TODO(structureshare): see if we can construct the original path. This + // only has to be done if structures are being shared. + return makeValue(v.idx, n, nil) +} + +func makeValue(idx *runtime.Runtime, v *adt.Vertex, p *parent) Value { + if v.Status() == 0 || v.BaseValue == nil { + panic(fmt.Sprintf("not properly initialized (state: %v, value: %T)", + v.Status(), v.BaseValue)) + } + return Value{idx, v, p} +} + +// makeChildValue makes a new value, of which p is the parent, and links the +// parent pointer to p if necessary. +func makeChildValue(p Value, arc *adt.Vertex) Value { + return makeValue(p.idx, arc, linkParent(p.parent_, p.v, arc)) +} + +// linkParent creates the parent struct for an arc, if necessary. +// +// The parent struct is necessary if the parent struct also has a parent struct, +// or if arc is (structurally) shared and does not have node as a parent. +func linkParent(p *parent, node, arc *adt.Vertex) *parent { + if p == nil && node == arc.Parent { + return nil + } + return &parent{node, p} +} + +func remakeValue(base Value, env *adt.Environment, v adt.Expr) Value { + // TODO: right now this is necessary because disjunctions do not have + // populated conjuncts. + if v, ok := v.(*adt.Vertex); ok && v.Status() >= adt.Partial { + return Value{base.idx, v, nil} + } + n := &adt.Vertex{Label: base.v.Label} + n.AddConjunct(adt.MakeRootConjunct(env, v)) + n = manifest(base.ctx(), n) + n.Parent = base.v.Parent + return makeChildValue(base.parent(), n) +} + +func remakeFinal(base Value, env *adt.Environment, v adt.Value) Value { + n := &adt.Vertex{Parent: base.v.Parent, Label: base.v.Label, BaseValue: v} + n.UpdateStatus(adt.Finalized) + return makeChildValue(base.parent(), n) +} + +func (v Value) ctx() *adt.OpContext { + return newContext(v.idx) +} + +// Eval resolves the references of a value and returns the result. +// This method is not necessary to obtain concrete values. +func (v Value) Eval() Value { + if v.v == nil { + return v + } + x := v.v + // x = eval.FinalizeValue(v.idx.Runtime, v.v) + // x.Finalize(v.ctx()) + x = x.ToDataSingle() + return makeValue(v.idx, x, v.parent_) + // return remakeValue(v, nil, ctx.value(x)) +} + +// Default reports the default value and whether it existed. It returns the +// normal value if there is no default. +func (v Value) Default() (Value, bool) { + if v.v == nil { + return v, false + } + + d := v.v.Default() + if d == v.v { + return v, false + } + return makeValue(v.idx, d, v.parent_), true + + // d, ok := v.v.Value.(*adt.Disjunction) + // if !ok { + // return v, false + // } + + // var w *adt.Vertex + + // switch d.NumDefaults { + // case 0: + // return v, false + + // case 1: + // w = d.Values[0] + + // default: + // x := *v.v + // x.Value = &adt.Disjunction{ + // Src: d.Src, + // Values: d.Values[:d.NumDefaults], + // NumDefaults: 0, + // } + // w = &x + // } + + // w.Conjuncts = nil + // for _, c := range v.v.Conjuncts { + // // TODO: preserve field information. + // expr, _ := stripNonDefaults(c.Expr()) + // w.AddConjunct(adt.MakeConjunct(c.Env, expr)) + // } + + // return makeValue(v.idx, w), true + + // if !stripped { + // return v, false + // } + + // n := *v.v + // n.Conjuncts = conjuncts + // return Value{v.idx, &n}, true + + // isDefault := false + // for _, c := range v.v.Conjuncts { + // if hasDisjunction(c.Expr()) { + // isDefault = true + // break + // } + // } + + // if !isDefault { + // return v, false + // } + + // TODO: record expanded disjunctions in output. + // - Rename Disjunction to DisjunctionExpr + // - Introduce Disjuncts with Values. + // - In Expr introduce Star + // - Don't pick default by default? + + // Evaluate the value. + // x := eval.FinalizeValue(v.idx.Runtime, v.v) + // if b, _ := x.Value.(*adt.Bottom); b != nil { // && b.IsIncomplete() { + // return v, false + // } + // // Finalize and return here. + // return Value{v.idx, x}, isDefault +} + +// TODO: this should go: record preexpanded disjunctions in Vertex. +func hasDisjunction(expr adt.Expr) bool { + switch x := expr.(type) { + case *adt.DisjunctionExpr: + return true + case *adt.Conjunction: + for _, v := range x.Values { + if hasDisjunction(v) { + return true + } + } + case *adt.BinaryExpr: + switch x.Op { + case adt.OrOp: + return true + case adt.AndOp: + return hasDisjunction(x.X) || hasDisjunction(x.Y) + } + } + return false +} + +// TODO: this should go: record preexpanded disjunctions in Vertex. +func stripNonDefaults(expr adt.Expr) (r adt.Expr, stripped bool) { + switch x := expr.(type) { + case *adt.DisjunctionExpr: + if !x.HasDefaults { + return x, false + } + d := *x + d.Values = []adt.Disjunct{} + for _, v := range x.Values { + if v.Default { + d.Values = append(d.Values, v) + } + } + if len(d.Values) == 1 { + return d.Values[0].Val, true + } + return &d, true + + case *adt.BinaryExpr: + if x.Op != adt.AndOp { + return x, false + } + a, sa := stripNonDefaults(x.X) + b, sb := stripNonDefaults(x.Y) + if sa || sb { + bin := *x + bin.X = a + bin.Y = b + return &bin, true + } + return x, false + + default: + return x, false + } +} + +// Label reports he label used to obtain this value from the enclosing struct. +// +// TODO: get rid of this somehow. Probably by including a FieldInfo struct +// or the like. +func (v hiddenValue) Label() (string, bool) { + if v.v == nil || v.v.Label == 0 { + return "", false + } + return v.idx.LabelStr(v.v.Label), true +} + +// Kind returns the kind of value. It returns BottomKind for atomic values that +// are not concrete. For instance, it will return BottomKind for the bounds +// >=0. +func (v Value) Kind() Kind { + if v.v == nil { + return BottomKind + } + c := v.v.BaseValue + if !v.v.IsConcrete() { + return BottomKind + } + // TODO: perhaps we should not consider open lists as "incomplete". + if v.IncompleteKind() == adt.ListKind && !v.v.IsClosedList() { + return BottomKind + } + return c.Kind() +} + +// IncompleteKind returns a mask of all kinds that this value may be. +func (v Value) IncompleteKind() Kind { + if v.v == nil { + return BottomKind + } + return v.v.Kind() +} + +// MarshalJSON marshalls this value into valid JSON. +func (v Value) MarshalJSON() (b []byte, err error) { + b, err = v.marshalJSON() + if err != nil { + return nil, unwrapJSONError(err) + } + return b, nil +} + +func (v Value) marshalJSON() (b []byte, err error) { + v, _ = v.Default() + if v.v == nil { + return json.Marshal(nil) + } + ctx := newContext(v.idx) + x := v.eval(ctx) + + if _, ok := x.(adt.Resolver); ok { + return nil, marshalErrf(v, x, adt.IncompleteError, "value %q contains unresolved references", str(ctx, x)) + } + if !adt.IsConcrete(x) { + return nil, marshalErrf(v, x, adt.IncompleteError, "cannot convert incomplete value %q to JSON", str(ctx, x)) + } + + // TODO: implement marshalles in value. + switch k := x.Kind(); k { + case adt.NullKind: + return json.Marshal(nil) + case adt.BoolKind: + return json.Marshal(x.(*adt.Bool).B) + case adt.IntKind, adt.FloatKind, adt.NumKind: + b, err := x.(*adt.Num).X.MarshalText() + b = bytes.TrimLeft(b, "+") + return b, err + case adt.StringKind: + return json.Marshal(x.(*adt.String).Str) + case adt.BytesKind: + return json.Marshal(x.(*adt.Bytes).B) + case adt.ListKind: + i, _ := v.List() + return marshalList(&i) + case adt.StructKind: + obj, err := v.structValData(ctx) + if err != nil { + return nil, toMarshalErr(v, err) + } + return obj.marshalJSON() + case adt.BottomKind: + return nil, toMarshalErr(v, x.(*adt.Bottom)) + default: + return nil, marshalErrf(v, x, 0, "cannot convert value %q of type %T to JSON", str(ctx, x), x) + } +} + +// Syntax converts the possibly partially evaluated value into syntax. This +// can use used to print the value with package format. +func (v Value) Syntax(opts ...Option) ast.Node { + // TODO: the default should ideally be simplified representation that + // exactly represents the value. The latter can currently only be + // ensured with Raw(). + if v.v == nil { + return nil + } + var o options = getOptions(opts) + // var inst *Instance + + p := export.Profile{ + Simplify: !o.raw, + TakeDefaults: o.final, + ShowOptional: !o.omitOptional && !o.concrete, + ShowDefinitions: !o.omitDefinitions && !o.concrete, + ShowHidden: !o.omitHidden && !o.concrete, + ShowAttributes: !o.omitAttrs, + ShowDocs: o.docs, + ShowErrors: o.showErrors, + } + + pkgID := v.instance().ID() + + bad := func(name string, err error) ast.Node { + const format = `"%s: internal error +Error: %s + +Profile: +%#v + +Value: +%v + +You could file a bug with the above information at: + https://cuelang.org/issues/new?assignees=&labels=NeedsInvestigation&template=bug_report.md&title=. +` + cg := &ast.CommentGroup{Doc: true} + msg := fmt.Sprintf(format, name, err, p, v) + for _, line := range strings.Split(msg, "\n") { + cg.List = append(cg.List, &ast.Comment{Text: "// " + line}) + } + x := &ast.BadExpr{} + ast.AddComment(x, cg) + return x + } + + // var expr ast.Expr + var err error + var f *ast.File + if o.concrete || o.final || o.resolveReferences { + // inst = v.instance() + var expr ast.Expr + expr, err = p.Value(v.idx, pkgID, v.v) + if err != nil { + return bad(`"cuelang.org/go/internal/core/export".Value`, err) + } + + // This introduces gratuitous unshadowing! + f, err = astutil.ToFile(expr) + if err != nil { + return bad(`"cuelang.org/go/ast/astutil".ToFile`, err) + } + // return expr + } else { + f, err = p.Def(v.idx, pkgID, v.v) + if err != nil { + return bad(`"cuelang.org/go/internal/core/export".Def`, err) + } + } + +outer: + for _, d := range f.Decls { + switch d.(type) { + case *ast.Package, *ast.ImportDecl: + return f + case *ast.CommentGroup, *ast.Attribute: + default: + break outer + } + } + + if len(f.Decls) == 1 { + if e, ok := f.Decls[0].(*ast.EmbedDecl); ok { + return e.Expr + } + } + return &ast.StructLit{ + Elts: f.Decls, + } +} + +// Doc returns all documentation comments associated with the field from which +// the current value originates. +func (v Value) Doc() []*ast.CommentGroup { + if v.v == nil { + return nil + } + return export.ExtractDoc(v.v) +} + +// Split returns a list of values from which v originated such that +// the unification of all these values equals v and for all returned values. +// It will also split unchecked unifications (embeddings), so unifying the +// split values may fail if actually unified. +// Source returns a non-nil value. +// +// Deprecated: use Expr. +func (v hiddenValue) Split() []Value { + if v.v == nil { + return nil + } + a := []Value{} + for _, x := range v.v.Conjuncts { + a = append(a, remakeValue(v, x.Env, x.Expr())) + } + return a +} + +// Source returns the original node for this value. The return value may not +// be a syntax.Expr. For instance, a struct kind may be represented by a +// struct literal, a field comprehension, or a file. It returns nil for +// computed nodes. Use Split to get all source values that apply to a field. +func (v Value) Source() ast.Node { + if v.v == nil { + return nil + } + if len(v.v.Conjuncts) == 1 { + return v.v.Conjuncts[0].Source() + } + return v.v.Value().Source() +} + +// Err returns the error represented by v or nil v is not an error. +func (v Value) Err() error { + if err := v.checkKind(v.ctx(), adt.BottomKind); err != nil { + return v.toErr(err) + } + return nil +} + +// Pos returns position information. +// +// Use v.Expr to get positions for all conjuncts and disjuncts. +func (v Value) Pos() token.Pos { + if v.v == nil { + return token.NoPos + } + + if src := v.Source(); src != nil { + if pos := src.Pos(); pos != token.NoPos { + return pos + } + } + // Pick the most-concrete field. + var p token.Pos + for _, c := range v.v.Conjuncts { + x := c.Elem() + pp := pos(x) + if pp == token.NoPos { + continue + } + p = pp + // Prefer struct conjuncts with actual fields. + if s, ok := x.(*adt.StructLit); ok && len(s.Fields) > 0 { + break + } + } + return p +} + +// TODO: IsFinal: this value can never be changed. + +// IsClosed reports whether a list of struct is closed. It reports false when +// when the value is not a list or struct. +// +// Deprecated: use Allows(AnyString) and Allows(AnyIndex) or Kind/IncompleteKind. +func (v hiddenValue) IsClosed() bool { + if v.v == nil { + return false + } + switch v.Kind() { + case ListKind: + return v.v.IsClosedList() + case StructKind: + return !v.Allows(AnyString) + } + return false +} + +// Allows reports whether a field with the given selector could be added to v. +// +// Allows does not take into account validators like list.MaxItems(4). This may +// change in the future. +func (v Value) Allows(sel Selector) bool { + c := v.ctx() + f := sel.sel.feature(c) + return v.v.Accept(c, f) +} + +// IsConcrete reports whether the current value is a concrete scalar value +// (not relying on default values), a terminal error, a list, or a struct. +// It does not verify that values of lists or structs are concrete themselves. +// To check whether there is a concrete default, use v.Default().IsConcrete(). +func (v Value) IsConcrete() bool { + if v.v == nil { + return false // any is neither concrete, not a list or struct. + } + if b, ok := v.v.BaseValue.(*adt.Bottom); ok { + return !b.IsIncomplete() + } + if !adt.IsConcrete(v.v) { + return false + } + if v.IncompleteKind() == adt.ListKind && !v.v.IsClosedList() { + return false + } + return true +} + +// // Deprecated: IsIncomplete +// // +// // It indicates that the value cannot be fully evaluated due to +// // insufficient information. +// func (v Value) IsIncomplete() bool { +// panic("deprecated") +// } + +// Exists reports whether this value existed in the configuration. +func (v Value) Exists() bool { + if v.v == nil { + return false + } + if err, ok := v.v.BaseValue.(*adt.Bottom); ok { + return !err.NotExists + } + return true +} + +func (v Value) checkKind(ctx *adt.OpContext, want adt.Kind) *adt.Bottom { + if v.v == nil { + return errNotExists + } + // TODO: use checkKind + x := v.eval(ctx) + if b, ok := x.(*adt.Bottom); ok { + return b + } + k := x.Kind() + if want != adt.BottomKind { + if k&want == adt.BottomKind { + return mkErr(v.idx, x, "cannot use value %v (type %s) as %s", + ctx.Str(x), k, want) + } + if !adt.IsConcrete(x) { + return mkErr(v.idx, x, adt.IncompleteError, "non-concrete value %v", k) + } + } + return nil +} + +func makeInt(v Value, x int64) Value { + n := &adt.Num{K: adt.IntKind} + n.X.SetInt64(int64(x)) + return remakeFinal(v, nil, n) +} + +// Len returns the number of items of the underlying value. +// For lists it reports the capacity of the list. For structs it indicates the +// number of fields, for bytes the number of bytes. +func (v Value) Len() Value { + if v.v != nil { + switch x := v.eval(v.ctx()).(type) { + case *adt.Vertex: + if x.IsList() { + n := &adt.Num{K: adt.IntKind} + n.X.SetInt64(int64(len(x.Elems()))) + if x.IsClosedList() { + return remakeFinal(v, nil, n) + } + // Note: this HAS to be a Conjunction value and cannot be + // an adt.BinaryExpr, as the expressions would be considered + // to be self-contained and unresolvable when evaluated + // (can never become concrete). + c := &adt.Conjunction{Values: []adt.Value{ + &adt.BasicType{K: adt.IntKind}, + &adt.BoundValue{Op: adt.GreaterEqualOp, Value: n}, + }} + return remakeFinal(v, nil, c) + + } + case *adt.Bytes: + return makeInt(v, int64(len(x.B))) + case *adt.String: + return makeInt(v, int64(len([]rune(x.Str)))) + } + } + const msg = "len not supported for type %v" + return remakeValue(v, nil, mkErr(v.idx, v.v, msg, v.Kind())) + +} + +// Elem returns the value of undefined element types of lists and structs. +// +// Deprecated: use LookupPath in combination with "AnyString" or "AnyIndex". +func (v hiddenValue) Elem() (Value, bool) { + sel := AnyString + if v.v.IsList() { + sel = AnyIndex + } + x := v.LookupPath(MakePath(sel)) + return x, x.Exists() +} + +// List creates an iterator over the values of a list or reports an error if +// v is not a list. +func (v Value) List() (Iterator, error) { + v, _ = v.Default() + ctx := v.ctx() + if err := v.checkKind(ctx, adt.ListKind); err != nil { + return Iterator{idx: v.idx, ctx: ctx}, v.toErr(err) + } + arcs := []field{} + for _, a := range v.v.Elems() { + if a.Label.IsInt() { + arcs = append(arcs, field{arc: a}) + } + } + return Iterator{idx: v.idx, ctx: ctx, val: v, arcs: arcs}, nil +} + +// Null reports an error if v is not null. +func (v Value) Null() error { + v, _ = v.Default() + if err := v.checkKind(v.ctx(), adt.NullKind); err != nil { + return v.toErr(err) + } + return nil +} + +// // IsNull reports whether v is null. +// func (v Value) IsNull() bool { +// return v.Null() == nil +// } + +// Bool returns the bool value of v or false and an error if v is not a boolean. +func (v Value) Bool() (bool, error) { + v, _ = v.Default() + ctx := v.ctx() + if err := v.checkKind(ctx, adt.BoolKind); err != nil { + return false, v.toErr(err) + } + return v.eval(ctx).(*adt.Bool).B, nil +} + +// String returns the string value if v is a string or an error otherwise. +func (v Value) String() (string, error) { + v, _ = v.Default() + ctx := v.ctx() + if err := v.checkKind(ctx, adt.StringKind); err != nil { + return "", v.toErr(err) + } + return v.eval(ctx).(*adt.String).Str, nil +} + +// Bytes returns a byte slice if v represents a list of bytes or an error +// otherwise. +func (v Value) Bytes() ([]byte, error) { + v, _ = v.Default() + ctx := v.ctx() + switch x := v.eval(ctx).(type) { + case *adt.Bytes: + return append([]byte(nil), x.B...), nil + case *adt.String: + return []byte(x.Str), nil + } + return nil, v.toErr(v.checkKind(ctx, adt.BytesKind|adt.StringKind)) +} + +// Reader returns a new Reader if v is a string or bytes type and an error +// otherwise. +func (v hiddenValue) Reader() (io.Reader, error) { + v, _ = v.Default() + ctx := v.ctx() + switch x := v.eval(ctx).(type) { + case *adt.Bytes: + return bytes.NewReader(x.B), nil + case *adt.String: + return strings.NewReader(x.Str), nil + } + return nil, v.toErr(v.checkKind(ctx, adt.StringKind|adt.BytesKind)) +} + +// TODO: distinguish between optional, hidden, etc. Probably the best approach +// is to mark options in context and have a single function for creating +// a structVal. + +// structVal returns an structVal or an error if v is not a struct. +func (v Value) structValData(ctx *adt.OpContext) (structValue, *adt.Bottom) { + return v.structValOpts(ctx, options{ + omitHidden: true, + omitDefinitions: true, + omitOptional: true, + }) +} + +func (v Value) structValFull(ctx *adt.OpContext) (structValue, *adt.Bottom) { + return v.structValOpts(ctx, options{allowScalar: true}) +} + +// structVal returns an structVal or an error if v is not a struct. +func (v Value) structValOpts(ctx *adt.OpContext, o options) (s structValue, err *adt.Bottom) { + v, _ = v.Default() + + obj := v.v + + switch b, ok := v.v.BaseValue.(*adt.Bottom); { + case ok && b.IsIncomplete() && !o.concrete && !o.final: + + // TODO: + // case o.allowScalar, !o.omitHidden, !o.omitDefinitions: + // Allow scalar values if hidden or definition fields are requested? + case o.allowScalar: + default: + obj, err = v.getStruct() + if err != nil { + return structValue{}, err + } + } + + features := export.VertexFeatures(ctx, obj) + + k := 0 + for _, f := range features { + if f.IsDef() && (o.omitDefinitions || o.concrete) { + continue + } + if f.IsHidden() && o.omitHidden { + continue + } + if arc := obj.Lookup(f); arc == nil { + if o.omitOptional { + continue + } + // ensure it really exists. + v := adt.Vertex{ + Parent: obj, + Label: f, + } + obj.MatchAndInsert(ctx, &v) + if len(v.Conjuncts) == 0 { + continue + } + } + features[k] = f + k++ + } + features = features[:k] + return structValue{ctx, v, obj, features}, nil +} + +// Struct returns the underlying struct of a value or an error if the value +// is not a struct. +func (v hiddenValue) Struct() (*Struct, error) { + // TODO: deprecate + ctx := v.ctx() + obj, err := v.structValOpts(ctx, options{}) + if err != nil { + return nil, v.toErr(err) + } + return &Struct{obj}, nil +} + +func (v Value) getStruct() (*adt.Vertex, *adt.Bottom) { + ctx := v.ctx() + if err := v.checkKind(ctx, adt.StructKind); err != nil { + if !err.ChildError { + return nil, err + } + } + return v.v, nil +} + +// Struct represents a CUE struct value. +type Struct struct { + structValue +} + +type hiddenStruct = Struct + +// FieldInfo contains information about a struct field. +type FieldInfo struct { + Selector string + Name string // Deprecated: use Selector + Pos int + Value Value + + IsDefinition bool + IsOptional bool + IsHidden bool +} + +func (s *hiddenStruct) Len() int { + return s.structValue.Len() +} + +// field reports information about the ith field, i < o.Len(). +func (s *hiddenStruct) Field(i int) FieldInfo { + a, opt := s.at(i) + ctx := s.v.ctx() + + v := makeChildValue(s.v, a) + name := s.v.idx.LabelStr(a.Label) + str := a.Label.SelectorString(ctx) + return FieldInfo{str, name, i, v, a.Label.IsDef(), opt, a.Label.IsHidden()} +} + +// FieldByName looks up a field for the given name. If isIdent is true, it will +// look up a definition or hidden field (starting with `_` or `_#`). Otherwise +// it interprets name as an arbitrary string for a regular field. +func (s *hiddenStruct) FieldByName(name string, isIdent bool) (FieldInfo, error) { + f := s.v.idx.Label(name, isIdent) + for i, a := range s.features { + if a == f { + return s.Field(i), nil + } + } + return FieldInfo{}, errNotFound +} + +// Fields creates an iterator over the Struct's fields. +func (s *hiddenStruct) Fields(opts ...Option) *Iterator { + iter, _ := s.v.Fields(opts...) + return iter +} + +// Fields creates an iterator over v's fields if v is a struct or an error +// otherwise. +func (v Value) Fields(opts ...Option) (*Iterator, error) { + o := options{omitDefinitions: true, omitHidden: true, omitOptional: true} + o.updateOptions(opts) + ctx := v.ctx() + obj, err := v.structValOpts(ctx, o) + if err != nil { + return &Iterator{idx: v.idx, ctx: ctx}, v.toErr(err) + } + + arcs := []field{} + for i := range obj.features { + arc, isOpt := obj.at(i) + arcs = append(arcs, field{arc: arc, isOptional: isOpt}) + } + return &Iterator{idx: v.idx, ctx: ctx, val: v, arcs: arcs}, nil +} + +// Lookup reports the value at a path starting from v. The empty path returns v +// itself. +// +// The Exists() method can be used to verify if the returned value existed. +// Lookup cannot be used to look up hidden or optional fields or definitions. +// +// Deprecated: use LookupPath. At some point before v1.0.0, this method will +// be removed to be reused eventually for looking up a selector. +func (v hiddenValue) Lookup(path ...string) Value { + ctx := v.ctx() + for _, k := range path { + // TODO(eval) TODO(error): always search in full data and change error + // message if a field is found but is of the incorrect type. + obj, err := v.structValData(ctx) + if err != nil { + // TODO: return a Value at the same location and a new error? + return newErrValue(v, err) + } + v = obj.Lookup(k) + } + return v +} + +// Path returns the path to this value from the root of an Instance. +// +// This is currently only defined for values that have a fixed path within +// a configuration, and thus not those that are derived from Elem, Template, +// or programmatically generated values such as those returned by Unify. +func (v Value) Path() Path { + if v.v == nil { + return Path{} + } + return Path{path: appendPath(nil, v)} +} + +// Path computes the sequence of Features leading from the root to of the +// instance to this Vertex. +func appendPath(a []Selector, v Value) []Selector { + if p := v.parent(); p.v != nil { + a = appendPath(a, p) + } + + if v.v.Label == 0 { + // A Label may be 0 for programmatically inserted nodes. + return a + } + + f := v.v.Label + if index := f.Index(); index == adt.MaxIndex { + return append(a, Selector{anySelector(f)}) + } + + var sel selector + switch f.Typ() { + case adt.IntLabel: + sel = indexSelector(f) + case adt.DefinitionLabel: + sel = definitionSelector(f.SelectorString(v.idx)) + + case adt.HiddenDefinitionLabel, adt.HiddenLabel: + sel = scopedSelector{ + name: f.IdentString(v.idx), + pkg: f.PkgID(v.idx), + } + + case adt.StringLabel: + sel = stringSelector(f.StringValue(v.idx)) + } + return append(a, Selector{sel}) +} + +// LookupDef is equal to LookupPath(MakePath(Def(name))). +// +// Deprecated: use LookupPath. +func (v hiddenValue) LookupDef(name string) Value { + return v.LookupPath(MakePath(Def(name))) +} + +var errNotFound = errors.Newf(token.NoPos, "field not found") + +// FieldByName looks up a field for the given name. If isIdent is true, it will +// look up a definition or hidden field (starting with `_` or `_#`). Otherwise +// it interprets name as an arbitrary string for a regular field. +// +// Deprecated: use LookupPath. +func (v hiddenValue) FieldByName(name string, isIdent bool) (f FieldInfo, err error) { + s, err := v.Struct() + if err != nil { + return f, err + } + return s.FieldByName(name, isIdent) +} + +// LookupField reports information about a field of v. +// +// Deprecated: use LookupPath +func (v hiddenValue) LookupField(name string) (FieldInfo, error) { + s, err := v.Struct() + if err != nil { + // TODO: return a Value at the same location and a new error? + return FieldInfo{}, err + } + f, err := s.FieldByName(name, true) + if err != nil { + return f, err + } + if f.IsHidden { + return f, errNotFound + } + return f, err +} + +// TODO: expose this API? +// +// // EvalExpr evaluates an expression within the scope of v, which must be +// // a struct. +// // +// // Expressions may refer to builtin packages if they can be uniquely identified. +// func (v Value) EvalExpr(expr ast.Expr) Value { +// ctx := v.ctx() +// result := evalExpr(ctx, v.eval(ctx), expr) +// return newValueRoot(ctx, result) +// } + +// Fill creates a new value by unifying v with the value of x at the given path. +// +// Values may be any Go value that can be converted to CUE, an ast.Expr or +// a Value. In the latter case, it will panic if the Value is not from the same +// Runtime. +// +// Any reference in v referring to the value at the given path will resolve +// to x in the newly created value. The resulting value is not validated. +// +// Deprecated: use FillPath. +func (v hiddenValue) Fill(x interface{}, path ...string) Value { + if v.v == nil { + return v + } + selectors := make([]Selector, len(path)) + for i, p := range path { + selectors[i] = Str(p) + } + return v.FillPath(MakePath(selectors...), x) +} + +// FillPath creates a new value by unifying v with the value of x at the given +// path. +// +// If x is an cue/ast.Expr, it will be evaluated within the context of the +// given path: identifiers that are not resolved within the expression are +// resolved as if they were defined at the path position. +// +// If x is a Value, it will be used as is. It panics if x is not created +// from the same Runtime as v. +// +// Otherwise, the given Go value will be converted to CUE using the same rules +// as Context.Encode. +// +// Any reference in v referring to the value at the given path will resolve to x +// in the newly created value. The resulting value is not validated. +// +func (v Value) FillPath(p Path, x interface{}) Value { + if v.v == nil { + // TODO: panic here? + return v + } + ctx := v.ctx() + if err := p.Err(); err != nil { + return newErrValue(v, mkErr(v.idx, nil, 0, "invalid path: %v", err)) + } + var expr adt.Expr + switch x := x.(type) { + case Value: + if v.idx != x.idx { + panic("values are not from the same runtime") + } + expr = x.v + case ast.Expr: + n := getScopePrefix(v, p) + // TODO: inject import path of current package? + expr = resolveExpr(ctx, n, x) + default: + expr = convert.GoValueToValue(ctx, x, true) + } + for i := len(p.path) - 1; i >= 0; i-- { + switch sel := p.path[i].sel; { + case sel == AnyString.sel: + expr = &adt.StructLit{Decls: []adt.Decl{ + &adt.BulkOptionalField{ + Filter: &adt.BasicType{K: adt.StringKind}, + Value: expr, + }, + }} + + case sel == anyIndex.sel: + expr = &adt.ListLit{Elems: []adt.Elem{ + &adt.Ellipsis{Value: expr}, + }} + + case sel == anyDefinition.sel: + expr = &adt.Bottom{Err: errors.Newf(token.NoPos, + "AnyDefinition not supported")} + + case sel.kind() == adt.IntLabel: + i := sel.feature(ctx.Runtime).Index() + list := &adt.ListLit{} + any := &adt.Top{} + // TODO(perf): make this a constant thing. This will be possible with the query extension. + for k := 0; k < i; k++ { + list.Elems = append(list.Elems, any) + } + list.Elems = append(list.Elems, expr, &adt.Ellipsis{}) + expr = list + + default: + var d adt.Decl + if sel.optional() { + d = &adt.OptionalField{ + Label: sel.feature(v.idx), + Value: expr, + } + } else { + d = &adt.Field{ + Label: sel.feature(v.idx), + Value: expr, + } + } + expr = &adt.StructLit{Decls: []adt.Decl{d}} + } + } + n := &adt.Vertex{} + n.AddConjunct(adt.MakeRootConjunct(nil, expr)) + n.Finalize(ctx) + w := makeValue(v.idx, n, v.parent_) + return v.Unify(w) +} + +// Template returns a function that represents the template definition for a +// struct in a configuration file. It returns nil if v is not a struct kind or +// if there is no template associated with the struct. +// +// The returned function returns the value that would be unified with field +// given its name. +// +// Deprecated: use LookupPath in combination with using optional selectors. +func (v hiddenValue) Template() func(label string) Value { + if v.v == nil { + return nil + } + + types := v.v.OptionalTypes() + if types&(adt.HasAdditional|adt.HasPattern) == 0 { + return nil + } + + return func(label string) Value { + return v.LookupPath(MakePath(Str(label).Optional())) + } +} + +// Subsume reports nil when w is an instance of v or an error otherwise. +// +// Without options, the entire value is considered for assumption, which means +// Subsume tests whether v is a backwards compatible (newer) API version of w. +// +// Use the Final option to check subsumption if a w is known to be final, and +// should assumed to be closed. +// +// Use the Raw option to do a low-level subsumption, taking defaults into +// account. +// +// Value v and w must be obtained from the same build. TODO: remove this +// requirement. +func (v Value) Subsume(w Value, opts ...Option) error { + o := getOptions(opts) + p := subsume.CUE + switch { + case o.final && o.ignoreClosedness: + p = subsume.FinalOpen + case o.final: + p = subsume.Final + case o.ignoreClosedness: + p = subsume.API + } + if !o.raw { + p.Defaults = true + } + ctx := v.ctx() + return p.Value(ctx, v.v, w.v) +} + +// Deprecated: use Subsume. +// +// Subsumes reports whether w is an instance of v. +// +// Without options, Subsumes checks whether v is a backwards compatbile schema +// of w. +// +// By default, Subsumes tests whether two values are compatible +// Value v and w must be obtained from the same build. +// TODO: remove this requirement. +func (v hiddenValue) Subsumes(w Value) bool { + ctx := v.ctx() + p := subsume.Profile{Defaults: true} + return p.Check(ctx, v.v, w.v) +} + +func allowed(ctx *adt.OpContext, parent, n *adt.Vertex) *adt.Bottom { + if !parent.IsClosedList() && !parent.IsClosedStruct() { + return nil + } + + for _, a := range n.Arcs { + if !parent.Accept(ctx, a.Label) { + defer ctx.PopArc(ctx.PushArc(parent)) + label := a.Label.SelectorString(ctx) + parent.Accept(ctx, a.Label) + return ctx.NewErrf("field not allowed: %s", label) + } + } + return nil +} + +func addConjuncts(dst, src *adt.Vertex) { + c := adt.MakeRootConjunct(nil, src) + if src.Closed { + var root adt.CloseInfo + c.CloseInfo = root.SpawnRef(src, src.Closed, nil) + } + dst.AddConjunct(c) +} + +// Unify reports the greatest lower bound of v and w. +// +// Value v and w must be obtained from the same build. +// TODO: remove this requirement. +func (v Value) Unify(w Value) Value { + if v.v == nil { + return w + } + if w.v == nil || w.v == v.v { + return v + } + + n := &adt.Vertex{} + addConjuncts(n, v.v) + addConjuncts(n, w.v) + + ctx := newContext(v.idx) + n.Finalize(ctx) + + n.Parent = v.v.Parent + n.Label = v.v.Label + n.Closed = v.v.Closed || w.v.Closed + + if err := n.Err(ctx, adt.Finalized); err != nil { + return makeValue(v.idx, n, v.parent_) + } + if err := allowed(ctx, v.v, n); err != nil { + return newErrValue(w, err) + } + if err := allowed(ctx, w.v, n); err != nil { + return newErrValue(v, err) + } + + return makeValue(v.idx, n, v.parent_) +} + +// UnifyAccept is as v.Unify(w), but will disregard any field that is allowed +// in the Value accept. +func (v Value) UnifyAccept(w Value, accept Value) Value { + if v.v == nil { + return w + } + if w.v == nil { + return v + } + if accept.v == nil { + panic("accept must exist") + } + + n := &adt.Vertex{} + n.AddConjunct(adt.MakeRootConjunct(nil, v.v)) + n.AddConjunct(adt.MakeRootConjunct(nil, w.v)) + + ctx := newContext(v.idx) + n.Finalize(ctx) + + n.Parent = v.v.Parent + n.Label = v.v.Label + + if err := n.Err(ctx, adt.Finalized); err != nil { + return makeValue(v.idx, n, v.parent_) + } + if err := allowed(ctx, accept.v, n); err != nil { + return newErrValue(accept, err) + } + + return makeValue(v.idx, n, v.parent_) +} + +// Equals reports whether two values are equal, ignoring optional fields. +// The result is undefined for incomplete values. +func (v Value) Equals(other Value) bool { + if v.v == nil || other.v == nil { + return false + } + return adt.Equal(v.ctx(), v.v, other.v, 0) +} + +func (v Value) instance() *Instance { + if v.v == nil { + return nil + } + return getImportFromNode(v.idx, v.v) +} + +// Reference returns the instance and path referred to by this value such that +// inst.Lookup(path) resolves to the same value, or no path if this value is not +// a reference. If a reference contains index selection (foo[bar]), it will +// only return a reference if the index resolves to a concrete value. +// +// Deprecated: use ReferencePath +func (v hiddenValue) Reference() (inst *Instance, path []string) { + root, p := v.ReferencePath() + if !root.Exists() { + return nil, nil + } + + inst = getImportFromNode(v.idx, root.v) + for _, sel := range p.Selectors() { + switch x := sel.sel.(type) { + case stringSelector: + path = append(path, string(x)) + default: + path = append(path, sel.String()) + } + } + + return inst, path +} + +// ReferencePath returns the value and path referred to by this value such that +// value.LookupPath(path) resolves to the same value, or no path if this value +// is not a reference. +func (v Value) ReferencePath() (root Value, p Path) { + // TODO: don't include references to hidden fields. + if v.v == nil || len(v.v.Conjuncts) != 1 { + return Value{}, Path{} + } + ctx := v.ctx() + c := v.v.Conjuncts[0] + + x, path := reference(v.idx, ctx, c.Env, c.Expr()) + if x == nil { + return Value{}, Path{} + } + // NOTE: due to structure sharing, the path of the referred node may end + // up different from the one explicitly pointed to. The value will be the + // same, but the scope may differ. + // TODO(structureshare): see if we can construct the original path. This + // only has to be done if structures are being shared. + return makeValue(v.idx, x, nil), Path{path: path} +} + +func reference(rt *runtime.Runtime, c *adt.OpContext, env *adt.Environment, r adt.Expr) (inst *adt.Vertex, path []Selector) { + ctx := c + defer ctx.PopState(ctx.PushState(env, r.Source())) + + switch x := r.(type) { + // TODO: do we need to handle Vertex as well, in case this is hard-wired? + // Probably not, as this results from dynamic content. + + case *adt.NodeLink: + // TODO: consider getting rid of NodeLink. + inst, path = mkPath(rt, nil, x.Node) + + case *adt.FieldReference: + env := ctx.Env(x.UpCount) + inst, path = mkPath(rt, nil, env.Vertex) + path = appendSelector(path, featureToSel(x.Label, rt)) + + case *adt.LabelReference: + env := ctx.Env(x.UpCount) + return mkPath(rt, nil, env.Vertex) + + case *adt.DynamicReference: + env := ctx.Env(x.UpCount) + inst, path = mkPath(rt, nil, env.Vertex) + v, _ := ctx.Evaluate(env, x.Label) + path = appendSelector(path, valueToSel(v)) + + case *adt.ImportReference: + inst = rt.LoadImport(rt.LabelStr(x.ImportPath)) + + case *adt.SelectorExpr: + inst, path = reference(rt, c, env, x.X) + path = appendSelector(path, featureToSel(x.Sel, rt)) + + case *adt.IndexExpr: + inst, path = reference(rt, c, env, x.X) + v, _ := ctx.Evaluate(env, x.Index) + path = appendSelector(path, valueToSel(v)) + } + if inst == nil { + return nil, nil + } + return inst, path +} + +func mkPath(r *runtime.Runtime, a []Selector, v *adt.Vertex) (root *adt.Vertex, path []Selector) { + if v.Parent == nil { + return v, a + } + root, path = mkPath(r, a, v.Parent) + path = appendSelector(path, featureToSel(v.Label, r)) + return root, path +} + +type options struct { + concrete bool // enforce that values are concrete + raw bool // show original values + hasHidden bool + omitHidden bool + omitDefinitions bool + omitOptional bool + omitAttrs bool + resolveReferences bool + showErrors bool + final bool + ignoreClosedness bool // used for comparing APIs + docs bool + disallowCycles bool // implied by concrete + allowScalar bool +} + +// An Option defines modes of evaluation. +type Option option + +type option func(p *options) + +// Final indicates a value is final. It implicitly closes all structs and lists +// in a value and selects defaults. +func Final() Option { + return func(o *options) { + o.final = true + o.omitDefinitions = true + o.omitOptional = true + o.omitHidden = true + } +} + +// Schema specifies the input is a Schema. Used by Subsume. +func Schema() Option { + return func(o *options) { + o.ignoreClosedness = true + } +} + +// Concrete ensures that all values are concrete. +// +// For Validate this means it returns an error if this is not the case. +// In other cases a non-concrete value will be replaced with an error. +func Concrete(concrete bool) Option { + return func(p *options) { + if concrete { + p.concrete = true + p.final = true + if !p.hasHidden { + p.omitHidden = true + p.omitDefinitions = true + } + } + } +} + +// DisallowCycles forces validation in the precense of cycles, even if +// non-concrete values are allowed. This is implied by Concrete(true). +func DisallowCycles(disallow bool) Option { + return func(p *options) { p.disallowCycles = disallow } +} + +// ResolveReferences forces the evaluation of references when outputting. +// This implies the input cannot have cycles. +func ResolveReferences(resolve bool) Option { + return func(p *options) { + p.resolveReferences = resolve + + // ResolveReferences is implemented as a Value printer, rather than + // a definition printer, even though it should be more like the latter. + // To reflect this we convert incomplete errors to their original + // expression. + // + // TODO: ShowErrors mostly shows incomplete errors, even though this is + // just an approximation. There seems to be some inconsistencies as to + // when child errors are marked as such, making the conversion somewhat + // inconsistent. This option is conservative, though. + p.showErrors = true + } +} + +// Raw tells Syntax to generate the value as is without any simplifications. +func Raw() Option { + return func(p *options) { p.raw = true } +} + +// All indicates that all fields and values should be included in processing +// even if they can be elided or omitted. +func All() Option { + return func(p *options) { + p.omitAttrs = false + p.omitHidden = false + p.omitDefinitions = false + p.omitOptional = false + } +} + +// Docs indicates whether docs should be included. +func Docs(include bool) Option { + return func(p *options) { p.docs = true } +} + +// Definitions indicates whether definitions should be included. +// +// Definitions may still be included for certain functions if they are referred +// to by other other values. +func Definitions(include bool) Option { + return func(p *options) { + p.hasHidden = true + p.omitDefinitions = !include + } +} + +// Hidden indicates that definitions and hidden fields should be included. +func Hidden(include bool) Option { + return func(p *options) { + p.hasHidden = true + p.omitHidden = !include + p.omitDefinitions = !include + } +} + +// Optional indicates that optional fields should be included. +func Optional(include bool) Option { + return func(p *options) { p.omitOptional = !include } +} + +// Attributes indicates that attributes should be included. +func Attributes(include bool) Option { + return func(p *options) { p.omitAttrs = !include } +} + +func getOptions(opts []Option) (o options) { + o.updateOptions(opts) + return +} + +func (o *options) updateOptions(opts []Option) { + for _, fn := range opts { + fn(o) + } +} + +// Validate reports any errors, recursively. The returned error may represent +// more than one error, retrievable with errors.Errors, if more than one +// exists. +func (v Value) Validate(opts ...Option) error { + o := options{} + o.updateOptions(opts) + + cfg := &validate.Config{ + Concrete: o.concrete, + DisallowCycles: o.disallowCycles, + AllErrors: true, + } + + b := validate.Validate(v.ctx(), v.v, cfg) + if b != nil { + return b.Err + } + return nil +} + +// Walk descends into all values of v, calling f. If f returns false, Walk +// will not descent further. It only visits values that are part of the data +// model, so this excludes optional fields, hidden fields, and definitions. +func (v Value) Walk(before func(Value) bool, after func(Value)) { + ctx := v.ctx() + switch v.Kind() { + case StructKind: + if before != nil && !before(v) { + return + } + obj, _ := v.structValData(ctx) + for i := 0; i < obj.Len(); i++ { + _, v := obj.At(i) + v.Walk(before, after) + } + case ListKind: + if before != nil && !before(v) { + return + } + list, _ := v.List() + for list.Next() { + list.Value().Walk(before, after) + } + default: + if before != nil { + before(v) + } + } + if after != nil { + after(v) + } +} + +// Expr reports the operation of the underlying expression and the values it +// operates on. +// +// For unary expressions, it returns the single value of the expression. +// +// For binary expressions it returns first the left and right value, in that +// order. For associative operations however, (for instance '&' and '|'), it may +// return more than two values, where the operation is to be applied in +// sequence. +// +// For selector and index expressions it returns the subject and then the index. +// For selectors, the index is the string value of the identifier. +// +// For interpolations it returns a sequence of values to be concatenated, some +// of which will be literal strings and some unevaluated expressions. +// +// A builtin call expression returns the value of the builtin followed by the +// args of the call. +func (v Value) Expr() (Op, []Value) { + // TODO: return v if this is complete? Yes for now + if v.v == nil { + return NoOp, nil + } + + var expr adt.Expr + var env *adt.Environment + + if v.v.IsData() { + expr = v.v.Value() + + } else { + switch len(v.v.Conjuncts) { + case 0: + if v.v.BaseValue == nil { + return NoOp, []Value{makeValue(v.idx, v.v, v.parent_)} // TODO: v? + } + expr = v.v.Value() + + case 1: + // the default case, processed below. + c := v.v.Conjuncts[0] + env = c.Env + expr = c.Expr() + if w, ok := expr.(*adt.Vertex); ok { + return Value{v.idx, w, v.parent_}.Expr() + } + + default: + a := []Value{} + ctx := v.ctx() + for _, c := range v.v.Conjuncts { + // Keep parent here. TODO: do we need remove the requirement + // from other conjuncts? + n := &adt.Vertex{ + Parent: v.v.Parent, + Label: v.v.Label, + } + n.AddConjunct(c) + n.Finalize(ctx) + a = append(a, makeValue(v.idx, n, v.parent_)) + } + return adt.AndOp, a + } + } + + // TODO: replace appends with []Value{}. For not leave. + a := []Value{} + op := NoOp + switch x := expr.(type) { + case *adt.BinaryExpr: + a = append(a, remakeValue(v, env, x.X)) + a = append(a, remakeValue(v, env, x.Y)) + op = x.Op + case *adt.UnaryExpr: + a = append(a, remakeValue(v, env, x.X)) + op = x.Op + case *adt.BoundExpr: + a = append(a, remakeValue(v, env, x.Expr)) + op = x.Op + case *adt.BoundValue: + a = append(a, remakeValue(v, env, x.Value)) + op = x.Op + case *adt.Conjunction: + // pre-expanded unification + for _, conjunct := range x.Values { + a = append(a, remakeValue(v, env, conjunct)) + } + op = AndOp + case *adt.Disjunction: + count := 0 + outer: + for i, disjunct := range x.Values { + if i < x.NumDefaults { + for _, n := range x.Values[x.NumDefaults:] { + if subsume.Simplify.Value(v.ctx(), n, disjunct) == nil { + continue outer + } + } + } + count++ + a = append(a, remakeValue(v, env, disjunct)) + } + if count > 1 { + op = OrOp + } + + case *adt.DisjunctionExpr: + // Filter defaults that are subsumed by another value. + count := 0 + outerExpr: + for _, disjunct := range x.Values { + if disjunct.Default { + for _, n := range x.Values { + a := adt.Vertex{ + Label: v.v.Label, + } + b := a + a.AddConjunct(adt.MakeRootConjunct(env, n.Val)) + b.AddConjunct(adt.MakeRootConjunct(env, disjunct.Val)) + + ctx := eval.NewContext(v.idx, nil) + ctx.Unify(&a, adt.Finalized) + ctx.Unify(&b, adt.Finalized) + if allowed(ctx, v.v, &b) != nil { + // Everything subsumed bottom + continue outerExpr + } + if allowed(ctx, v.v, &a) != nil { + // An error doesn't subsume anything except another error. + continue + } + a.Parent = v.v.Parent + if !n.Default && subsume.Simplify.Value(ctx, &a, &b) == nil { + continue outerExpr + } + } + } + count++ + a = append(a, remakeValue(v, env, disjunct.Val)) + } + if count > 1 { + op = adt.OrOp + } + + case *adt.Interpolation: + for _, p := range x.Parts { + a = append(a, remakeValue(v, env, p)) + } + op = InterpolationOp + + case *adt.FieldReference: + // TODO: allow hard link + ctx := v.ctx() + f := ctx.PushState(env, x.Src) + env := ctx.Env(x.UpCount) + a = append(a, remakeValue(v, nil, &adt.NodeLink{Node: env.Vertex})) + a = append(a, remakeValue(v, nil, ctx.NewString(x.Label.SelectorString(ctx)))) + _ = ctx.PopState(f) + op = SelectorOp + + case *adt.SelectorExpr: + a = append(a, remakeValue(v, env, x.X)) + // A string selector is quoted. + a = append(a, remakeValue(v, env, &adt.String{ + Str: x.Sel.SelectorString(v.idx), + })) + op = SelectorOp + + case *adt.IndexExpr: + a = append(a, remakeValue(v, env, x.X)) + a = append(a, remakeValue(v, env, x.Index)) + op = IndexOp + case *adt.SliceExpr: + a = append(a, remakeValue(v, env, x.X)) + a = append(a, remakeValue(v, env, x.Lo)) + a = append(a, remakeValue(v, env, x.Hi)) + op = SliceOp + case *adt.CallExpr: + // Interpret "and" and "or" builtin semantically. + if fn, ok := x.Fun.(*adt.Builtin); ok && len(x.Args) == 1 && + (fn.Name == "or" || fn.Name == "and") { + + iter, _ := remakeValue(v, env, x.Args[0]).List() + for iter.Next() { + a = append(a, iter.Value()) + } + + op = OrOp + if fn.Name == "and" { + op = AndOp + } + + if len(a) == 0 { + // Mimic semantics of builtin. + switch op { + case AndOp: + a = append(a, remakeValue(v, env, &adt.Top{})) + case OrOp: + a = append(a, remakeValue(v, env, &adt.Bottom{ + Code: adt.IncompleteError, + Err: errors.Newf(x.Src.Fun.Pos(), "empty list in call to or"), + })) + } + op = NoOp + } + break + } + a = append(a, remakeValue(v, env, x.Fun)) + for _, arg := range x.Args { + a = append(a, remakeValue(v, env, arg)) + } + op = CallOp + case *adt.BuiltinValidator: + a = append(a, remakeValue(v, env, x.Builtin)) + for _, arg := range x.Args { + a = append(a, remakeValue(v, env, arg)) + } + op = CallOp + + case *adt.StructLit: + hasEmbed := false + fields := []adt.Decl{} + for _, d := range x.Decls { + switch d.(type) { + default: + fields = append(fields, d) + case adt.Value: + fields = append(fields, d) + case adt.Expr: + hasEmbed = true + } + } + + if !hasEmbed { + a = append(a, v) + break + } + + ctx := v.ctx() + + n := v.v + + if len(fields) > 0 { + n = &adt.Vertex{ + Parent: v.v.Parent, + Label: v.v.Label, + } + + s := &adt.StructLit{} + if k := v.v.Kind(); k != adt.StructKind && k != BottomKind { + // TODO: we should also add such a declaration for embeddings + // of structs with definitions. However, this is currently + // also not supported at the CUE level. If we do, it may be + // best handled with a special mode of unification. + s.Decls = append(s.Decls, &adt.BasicType{K: k}) + } + s.Decls = append(s.Decls, fields...) + c := adt.MakeRootConjunct(env, s) + n.AddConjunct(c) + n.Finalize(ctx) + n.Parent = v.v.Parent + } + + // Simulate old embeddings. + envEmbed := &adt.Environment{ + Up: env, + Vertex: n, + } + + for _, d := range x.Decls { + switch x := d.(type) { + case adt.Value: + case adt.Expr: + // embedding + n := &adt.Vertex{Label: v.v.Label} + c := adt.MakeRootConjunct(envEmbed, x) + n.AddConjunct(c) + n.Finalize(ctx) + n.Parent = v.v.Parent + a = append(a, makeValue(v.idx, n, v.parent_)) + } + } + + // Could be done earlier, but keep struct with fields at end. + if len(fields) > 0 { + a = append(a, makeValue(v.idx, n, v.parent_)) + } + + if len(a) == 1 { + return a[0].Expr() + } + op = adt.AndOp + + default: + a = append(a, v) + } + return op, a +} diff --git a/vendor/cuelang.org/go/encoding/json/json.go b/vendor/cuelang.org/go/encoding/json/json.go new file mode 100644 index 0000000000..0e2c7f7cf1 --- /dev/null +++ b/vendor/cuelang.org/go/encoding/json/json.go @@ -0,0 +1,265 @@ +// Copyright 2019 CUE Authors +// +// 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 json converts JSON to and from CUE. +package json + +import ( + "encoding/json" + "fmt" + "io" + "strings" + + "cuelang.org/go/cue" + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/ast/astutil" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/literal" + "cuelang.org/go/cue/parser" + "cuelang.org/go/cue/token" + "cuelang.org/go/internal/value" +) + +// Valid reports whether data is a valid JSON encoding. +func Valid(b []byte) bool { + return json.Valid(b) +} + +// Validate validates JSON and confirms it matches the constraints +// specified by v. +func Validate(b []byte, v cue.Value) error { + if !json.Valid(b) { + return fmt.Errorf("json: invalid JSON") + } + r := value.ConvertToRuntime(v.Context()) + inst, err := r.Compile("json.Validate", b) + if err != nil { + return err + } + + v = v.Unify(inst.Value()) + if v.Err() != nil { + return v.Err() + } + return nil +} + +// Extract parses JSON-encoded data to a CUE expression, using path for +// position information. +func Extract(path string, data []byte) (ast.Expr, error) { + expr, err := extract(path, data) + if err != nil { + return nil, err + } + patchExpr(expr) + return expr, nil +} + +// Decode parses JSON-encoded data to a CUE value, using path for position +// information. +// +// Deprecated: use Extract and build using cue.Context.BuildExpr. +func Decode(r *cue.Runtime, path string, data []byte) (*cue.Instance, error) { + expr, err := extract(path, data) + if err != nil { + return nil, err + } + return r.CompileExpr(expr) +} + +func extract(path string, b []byte) (ast.Expr, error) { + expr, err := parser.ParseExpr(path, b) + if err != nil || !json.Valid(b) { + p := token.NoPos + if pos := errors.Positions(err); len(pos) > 0 { + p = pos[0] + } + var x interface{} + err := json.Unmarshal(b, &x) + return nil, errors.Wrapf(err, p, "invalid JSON for file %q", path) + } + return expr, nil +} + +// NewDecoder configures a JSON decoder. The path is used to associate position +// information with each node. The runtime may be nil if the decoder +// is only used to extract to CUE ast objects. +// +// The runtime may be nil if Decode isn't used. +func NewDecoder(r *cue.Runtime, path string, src io.Reader) *Decoder { + return &Decoder{ + r: r, + path: path, + dec: json.NewDecoder(src), + offset: 1, + } +} + +// A Decoder converts JSON values to CUE. +type Decoder struct { + r *cue.Runtime + path string + dec *json.Decoder + offset int +} + +// Extract converts the current JSON value to a CUE ast. It returns io.EOF +// if the input has been exhausted. +func (d *Decoder) Extract() (ast.Expr, error) { + expr, err := d.extract() + if err != nil { + return expr, err + } + patchExpr(expr) + return expr, nil +} + +func (d *Decoder) extract() (ast.Expr, error) { + var raw json.RawMessage + err := d.dec.Decode(&raw) + if err == io.EOF { + return nil, err + } + offset := d.offset + d.offset += len(raw) + if err != nil { + pos := token.NewFile(d.path, offset, len(raw)).Pos(0, 0) + return nil, errors.Wrapf(err, pos, "invalid JSON for file %q", d.path) + } + expr, err := parser.ParseExpr(d.path, []byte(raw), parser.FileOffset(offset)) + if err != nil { + return nil, err + } + return expr, nil +} + +// Decode converts the current JSON value to a CUE instance. It returns io.EOF +// if the input has been exhausted. +// +// Deprecated: use Extract and build with cue.Context.BuildExpr. +func (d *Decoder) Decode() (*cue.Instance, error) { + expr, err := d.Extract() + if err != nil { + return nil, err + } + return d.r.CompileExpr(expr) +} + +// patchExpr simplifies the AST parsed from JSON. +// TODO: some of the modifications are already done in format, but are +// a package deal of a more aggressive simplify. Other pieces of modification +// should probably be moved to format. +func patchExpr(n ast.Node) { + type info struct { + reflow bool + } + stack := []info{{true}} + + afterFn := func(n ast.Node) { + switch n.(type) { + case *ast.ListLit, *ast.StructLit: + stack = stack[:len(stack)-1] + } + } + + var beforeFn func(n ast.Node) bool + + beforeFn = func(n ast.Node) bool { + isLarge := n.End().Offset()-n.Pos().Offset() > 50 + descent := true + + switch x := n.(type) { + case *ast.ListLit: + reflow := true + if !isLarge { + for _, e := range x.Elts { + if hasSpaces(e) { + reflow = false + break + } + } + } + stack = append(stack, info{reflow}) + if reflow { + x.Lbrack = x.Lbrack.WithRel(token.NoRelPos) + x.Rbrack = x.Rbrack.WithRel(token.NoRelPos) + } + return true + + case *ast.StructLit: + reflow := true + if !isLarge { + for _, e := range x.Elts { + if f, ok := e.(*ast.Field); !ok || hasSpaces(f) || hasSpaces(f.Value) { + reflow = false + break + } + } + } + stack = append(stack, info{reflow}) + if reflow { + x.Lbrace = x.Lbrace.WithRel(token.NoRelPos) + x.Rbrace = x.Rbrace.WithRel(token.NoRelPos) + } + return true + + case *ast.Field: + // label is always a string for JSON. + switch { + case true: + s, ok := x.Label.(*ast.BasicLit) + if !ok || s.Kind != token.STRING { + break // should not happen: implies invalid JSON + } + + u, err := literal.Unquote(s.Value) + if err != nil { + break // should not happen: implies invalid JSON + } + + // TODO(legacy): remove checking for '_' prefix once hidden + // fields are removed. + if !ast.IsValidIdent(u) || strings.HasPrefix(u, "_") { + break // keep string + } + + x.Label = ast.NewIdent(u) + astutil.CopyMeta(x.Label, s) + } + ast.Walk(x.Value, beforeFn, afterFn) + descent = false + + case *ast.BasicLit: + if x.Kind == token.STRING && len(x.Value) > 10 { + s, err := literal.Unquote(x.Value) + if err != nil { + break // should not happen: implies invalid JSON + } + + x.Value = literal.String.WithOptionalTabIndent(len(stack)).Quote(s) + } + } + + if stack[len(stack)-1].reflow { + ast.SetRelPos(n, token.NoRelPos) + } + return descent + } + + ast.Walk(n, beforeFn, afterFn) +} + +func hasSpaces(n ast.Node) bool { + return n.Pos().RelPos() > token.NoSpace +} diff --git a/vendor/cuelang.org/go/internal/astinternal/debugstr.go b/vendor/cuelang.org/go/internal/astinternal/debugstr.go new file mode 100644 index 0000000000..0121b458ea --- /dev/null +++ b/vendor/cuelang.org/go/internal/astinternal/debugstr.go @@ -0,0 +1,281 @@ +// Copyright 2021 CUE Authors +// +// 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 astinternal + +import ( + "fmt" + "strconv" + "strings" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/token" +) + +func DebugStr(x interface{}) (out string) { + if n, ok := x.(ast.Node); ok { + comments := "" + for _, g := range n.Comments() { + comments += DebugStr(g) + } + if comments != "" { + defer func() { out = "<" + comments + out + ">" }() + } + } + switch v := x.(type) { + case *ast.File: + out := "" + out += DebugStr(v.Decls) + return out + + case *ast.Package: + out := "package " + out += DebugStr(v.Name) + return out + + case *ast.LetClause: + out := "let " + out += DebugStr(v.Ident) + out += "=" + out += DebugStr(v.Expr) + return out + + case *ast.Alias: + out := DebugStr(v.Ident) + out += "=" + out += DebugStr(v.Expr) + return out + + case *ast.BottomLit: + return "_|_" + + case *ast.BasicLit: + return v.Value + + case *ast.Interpolation: + for _, e := range v.Elts { + out += DebugStr(e) + } + return out + + case *ast.EmbedDecl: + out += DebugStr(v.Expr) + return out + + case *ast.ImportDecl: + out := "import " + if v.Lparen != token.NoPos { + out += "( " + out += DebugStr(v.Specs) + out += " )" + } else { + out += DebugStr(v.Specs) + } + return out + + case *ast.Comprehension: + out := DebugStr(v.Clauses) + out += DebugStr(v.Value) + return out + + case *ast.StructLit: + out := "{" + out += DebugStr(v.Elts) + out += "}" + return out + + case *ast.ListLit: + out := "[" + out += DebugStr(v.Elts) + out += "]" + return out + + case *ast.Ellipsis: + out := "..." + if v.Type != nil { + out += DebugStr(v.Type) + } + return out + + case *ast.ForClause: + out := "for " + if v.Key != nil { + out += DebugStr(v.Key) + out += ": " + } + out += DebugStr(v.Value) + out += " in " + out += DebugStr(v.Source) + return out + + case *ast.IfClause: + out := "if " + out += DebugStr(v.Condition) + return out + + case *ast.Field: + out := DebugStr(v.Label) + if v.Optional != token.NoPos { + out += "?" + } + if v.Value != nil { + switch v.Token { + case token.ILLEGAL, token.COLON: + out += ": " + default: + out += fmt.Sprintf(" %s ", v.Token) + } + out += DebugStr(v.Value) + for _, a := range v.Attrs { + out += " " + out += DebugStr(a) + } + } + return out + + case *ast.Attribute: + return v.Text + + case *ast.Ident: + return v.Name + + case *ast.SelectorExpr: + return DebugStr(v.X) + "." + DebugStr(v.Sel) + + case *ast.CallExpr: + out := DebugStr(v.Fun) + out += "(" + out += DebugStr(v.Args) + out += ")" + return out + + case *ast.ParenExpr: + out := "(" + out += DebugStr(v.X) + out += ")" + return out + + case *ast.UnaryExpr: + return v.Op.String() + DebugStr(v.X) + + case *ast.BinaryExpr: + out := DebugStr(v.X) + op := v.Op.String() + if 'a' <= op[0] && op[0] <= 'z' { + op = fmt.Sprintf(" %s ", op) + } + out += op + out += DebugStr(v.Y) + return out + + case []*ast.CommentGroup: + var a []string + for _, c := range v { + a = append(a, DebugStr(c)) + } + return strings.Join(a, "\n") + + case *ast.CommentGroup: + str := "[" + if v.Doc { + str += "d" + } + if v.Line { + str += "l" + } + str += strconv.Itoa(int(v.Position)) + var a = []string{} + for _, c := range v.List { + a = append(a, c.Text) + } + return str + strings.Join(a, " ") + "] " + + case *ast.IndexExpr: + out := DebugStr(v.X) + out += "[" + out += DebugStr(v.Index) + out += "]" + return out + + case *ast.SliceExpr: + out := DebugStr(v.X) + out += "[" + out += DebugStr(v.Low) + out += ":" + out += DebugStr(v.High) + out += "]" + return out + + case *ast.ImportSpec: + out := "" + if v.Name != nil { + out += DebugStr(v.Name) + out += " " + } + out += DebugStr(v.Path) + return out + + case []ast.Decl: + if len(v) == 0 { + return "" + } + out := "" + for _, d := range v { + out += DebugStr(d) + out += sep + } + return out[:len(out)-len(sep)] + + case []ast.Clause: + if len(v) == 0 { + return "" + } + out := "" + for _, c := range v { + out += DebugStr(c) + out += " " + } + return out + + case []ast.Expr: + if len(v) == 0 { + return "" + } + out := "" + for _, d := range v { + out += DebugStr(d) + out += sep + } + return out[:len(out)-len(sep)] + + case []*ast.ImportSpec: + if len(v) == 0 { + return "" + } + out := "" + for _, d := range v { + out += DebugStr(d) + out += sep + } + return out[:len(out)-len(sep)] + + default: + if v == nil { + return "" + } + return fmt.Sprintf("<%T>", x) + } +} + +const sep = ", " diff --git a/vendor/cuelang.org/go/internal/attrs.go b/vendor/cuelang.org/go/internal/attrs.go new file mode 100644 index 0000000000..058948012f --- /dev/null +++ b/vendor/cuelang.org/go/internal/attrs.go @@ -0,0 +1,252 @@ +// Copyright 2020 CUE Authors +// +// 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 internal + +import ( + "fmt" + "strconv" + "strings" + "unicode" + + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/literal" + "cuelang.org/go/cue/token" +) + +// AttrKind indicates the location of an attribute within CUE source. +type AttrKind uint8 + +const ( + // FieldAttr indicates an attribute is a field attribute. + // foo: bar @attr() + FieldAttr AttrKind = 1 << iota + + // DeclAttr indicates an attribute was specified at a declaration position. + // foo: { + // @attr() + // } + DeclAttr + + // TODO: Possible future attr kinds + // ElemAttr + // FileAttr + // ValueAttr = FieldAttr|DeclAttr|ElemAttr +) + +// Attr holds positional information for a single Attr. +type Attr struct { + Name string // e.g. "json" or "protobuf" + Body string + Kind AttrKind + Fields []KeyValue + Err error +} + +// NewNonExisting creates a non-existing attribute. +func NewNonExisting(key string) Attr { + const msgNotExist = "attribute %q does not exist" + return Attr{Err: errors.Newf(token.NoPos, msgNotExist, key)} +} + +type KeyValue struct { + data string + equal int // index of equal sign or 0 if non-existing +} + +func (kv *KeyValue) Text() string { return kv.data } +func (kv *KeyValue) Key() string { + if kv.equal == 0 { + return kv.data + } + s := kv.data[:kv.equal] + s = strings.TrimSpace(s) + return s +} +func (kv *KeyValue) Value() string { + if kv.equal == 0 { + return "" + } + return strings.TrimSpace(kv.data[kv.equal+1:]) +} + +func (a *Attr) hasPos(p int) error { + if a.Err != nil { + return a.Err + } + if p >= len(a.Fields) { + return fmt.Errorf("field does not exist") + } + return nil +} + +// String reports the possibly empty string value at the given position or +// an error the attribute is invalid or if the position does not exist. +func (a *Attr) String(pos int) (string, error) { + if err := a.hasPos(pos); err != nil { + return "", err + } + return a.Fields[pos].Text(), nil +} + +// Int reports the integer at the given position or an error if the attribute is +// invalid, the position does not exist, or the value at the given position is +// not an integer. +func (a *Attr) Int(pos int) (int64, error) { + if err := a.hasPos(pos); err != nil { + return 0, err + } + // TODO: use CUE's literal parser once it exists, allowing any of CUE's + // number types. + return strconv.ParseInt(a.Fields[pos].Text(), 10, 64) +} + +// Flag reports whether an entry with the given name exists at position pos or +// onwards or an error if the attribute is invalid or if the first pos-1 entries +// are not defined. +func (a *Attr) Flag(pos int, key string) (bool, error) { + if err := a.hasPos(pos - 1); err != nil { + return false, err + } + for _, kv := range a.Fields[pos:] { + if kv.Text() == key { + return true, nil + } + } + return false, nil +} + +// Lookup searches for an entry of the form key=value from position pos onwards +// and reports the value if found. It reports an error if the attribute is +// invalid or if the first pos-1 entries are not defined. +func (a *Attr) Lookup(pos int, key string) (val string, found bool, err error) { + if err := a.hasPos(pos - 1); err != nil { + return "", false, err + } + for _, kv := range a.Fields[pos:] { + if kv.Key() == key { + return kv.Value(), true, nil + } + } + return "", false, nil +} + +func ParseAttrBody(pos token.Pos, s string) (a Attr) { + a.Body = s + i := 0 + for { + i += skipSpace(s[i:]) + // always scan at least one, possibly empty element. + n, err := scanAttributeElem(pos, s[i:], &a) + if err != nil { + return Attr{Err: err} + } + if i += n; i >= len(s) { + break + } + i += skipSpace(s[i:]) + if s[i] != ',' { + return Attr{Err: errors.Newf(pos, "invalid attribute: expected comma")} + } + i++ + } + return a +} + +func skipSpace(s string) int { + for n, r := range s { + if !unicode.IsSpace(r) { + return n + } + } + return 0 +} + +func scanAttributeElem(pos token.Pos, s string, a *Attr) (n int, err errors.Error) { + // try CUE string + kv := KeyValue{} + if n, kv.data, err = scanAttributeString(pos, s); n == 0 { + // try key-value pair + p := strings.IndexAny(s, ",=") // ) is assumed to be stripped. + switch { + case p < 0: + kv.data = strings.TrimSpace(s) + n = len(s) + + default: // ',' + n = p + kv.data = strings.TrimSpace(s[:n]) + + case s[p] == '=': + kv.equal = p + offset := p + 1 + offset += skipSpace(s[offset:]) + var str string + if p, str, err = scanAttributeString(pos, s[offset:]); p > 0 { + n = offset + p + kv.data = s[:offset] + str + } else { + n = len(s) + if p = strings.IndexByte(s[offset:], ','); p >= 0 { + n = offset + p + } + kv.data = strings.TrimSpace(s[:n]) + } + } + } + if a != nil { + a.Fields = append(a.Fields, kv) + } + return n, err +} + +func scanAttributeString(pos token.Pos, s string) (n int, str string, err errors.Error) { + if s == "" || (s[0] != '#' && s[0] != '"' && s[0] != '\'') { + return 0, "", nil + } + + nHash := 0 + for { + if nHash < len(s) { + if s[nHash] == '#' { + nHash++ + continue + } + if s[nHash] == '\'' || s[nHash] == '"' { + break + } + } + return nHash, s[:nHash], errors.Newf(pos, "invalid attribute string") + } + + // Determine closing quote. + nQuote := 1 + if c := s[nHash]; nHash+6 < len(s) && s[nHash+1] == c && s[nHash+2] == c { + nQuote = 3 + } + close := s[nHash:nHash+nQuote] + s[:nHash] + + // Search for closing quote. + index := strings.Index(s[len(close):], close) + if index == -1 { + return len(s), "", errors.Newf(pos, "attribute string not terminated") + } + + index += 2 * len(close) + s, err2 := literal.Unquote(s[:index]) + if err2 != nil { + return index, "", errors.Newf(pos, "invalid attribute string: %v", err2) + } + return index, s, nil +} diff --git a/vendor/cuelang.org/go/internal/cli/cli.go b/vendor/cuelang.org/go/internal/cli/cli.go new file mode 100644 index 0000000000..f6ffd251fe --- /dev/null +++ b/vendor/cuelang.org/go/internal/cli/cli.go @@ -0,0 +1,91 @@ +// Copyright 2020 CUE Authors +// +// 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 cli + +import ( + "strings" + + "cuelang.org/go/cue" + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/parser" + "cuelang.org/go/cue/token" +) + +func ParseValue(pos token.Pos, name, str string, k cue.Kind) (x ast.Expr, errs errors.Error) { + var expr ast.Expr + + if k&cue.NumberKind != 0 { + var err error + expr, err = parser.ParseExpr(name, str) + if err != nil { + errs = errors.Wrapf(err, pos, + "invalid number for environment variable %s", name) + } + } + + if k&cue.BoolKind != 0 { + str = strings.TrimSpace(str) + b, ok := boolValues[str] + if !ok { + errs = errors.Append(errs, errors.Newf(pos, + "invalid boolean value %q for environment variable %s", str, name)) + } else if expr != nil || k&cue.StringKind != 0 { + // Convert into an expression + bl := ast.NewBool(b) + if expr != nil { + expr = &ast.BinaryExpr{Op: token.OR, X: expr, Y: bl} + } else { + expr = bl + } + } else { + x = ast.NewBool(b) + } + } + + if k&cue.StringKind != 0 { + if expr != nil { + expr = &ast.BinaryExpr{Op: token.OR, X: expr, Y: ast.NewString(str)} + } else { + x = ast.NewString(str) + } + } + + switch { + case expr != nil: + return expr, nil + case x != nil: + return x, nil + case errs == nil: + return nil, errors.Newf(pos, + "invalid type for environment variable %s", name) + } + return nil, errs +} + +var boolValues = map[string]bool{ + "1": true, + "0": false, + "t": true, + "f": false, + "T": true, + "F": false, + "true": true, + "false": false, + "TRUE": true, + "FALSE": false, + "True": true, + "False": false, +} diff --git a/vendor/cuelang.org/go/internal/core/adt/adt.go b/vendor/cuelang.org/go/internal/core/adt/adt.go new file mode 100644 index 0000000000..1a286e7596 --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/adt.go @@ -0,0 +1,380 @@ +// Copyright 2020 CUE Authors +// +// 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 adt + +import ( + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/token" +) + +func Resolve(ctx *OpContext, c Conjunct) *Vertex { + env := c.Env + // TODO: also allow resolution in parent scopes. The following will set up + // the environments. But the compiler also needs to resolve accordingly. + // + // // Set up environments for parent scopes, if any. + // root := env + // for p := scope; p != nil; p = p.Parent { + // root.Up = &Environment{Vertex: p.Parent} + // root = root.Up + // } + + var v Value + + expr := c.Elem() + switch x := expr.(type) { + case Value: + v = x + + case Resolver: + r, err := ctx.Resolve(env, x) + if err != nil { + v = err + break + } + // r.Finalize(ctx) // TODO: Finalize here? + return r + + case Evaluator: + // TODO: have a way to evaluate, but not strip down to the value. + v, _ = ctx.Evaluate(env, expr.(Expr)) + + default: + // Unknown type. + v = ctx.NewErrf( + "could not evaluate expression %s of type %T", c.Elem(), c) + } + + return ToVertex(v) +} + +// A Node is any abstract data type representing an value or expression. +type Node interface { + Source() ast.Node + node() // enforce internal. +} + +// A Decl represents all valid StructLit elements. +type Decl interface { + Node + declNode() +} + +// An Elem represents all value ListLit elements. +// +// All Elem values can be used as a Decl. +type Elem interface { + Decl + elemNode() +} + +// An Expr corresponds to an ast.Expr. +// +// All Expr values can be used as an Elem or Decl. +type Expr interface { + Elem + expr() +} + +// A BaseValue is any Value or a *Marker. It indicates the type of a Vertex. +type BaseValue interface { + Kind() Kind +} + +// A Value represents a node in the evaluated data graph. +// +// All Values values can also be used as a Expr. +type Value interface { + Expr + Concreteness() Concreteness + Kind() Kind +} + +// An Evaluator provides a method to convert to a value. +type Evaluator interface { + Node + + // evaluate evaluates the underlying expression. If the expression + // is incomplete, it may record the error in ctx and return nil. + evaluate(ctx *OpContext) Value +} + +// A Resolver represents a reference somewhere else within a tree that resolves +// a value. +type Resolver interface { + Node + resolve(ctx *OpContext, state VertexStatus) *Vertex +} + +type YieldFunc func(env *Environment) + +// A Yielder represents 0 or more labeled values of structs or lists. +type Yielder interface { + Node + yield(ctx *OpContext, fn YieldFunc) +} + +// A Validator validates a Value. All Validators are Values. +type Validator interface { + Value + validate(c *OpContext, v Value) *Bottom +} + +// Pos returns the file position of n, or token.NoPos if it is unknown. +func Pos(n Node) token.Pos { + src := n.Source() + if src == nil { + return token.NoPos + } + return src.Pos() +} + +// Value + +func (x *Vertex) Concreteness() Concreteness { + // Depends on concreteness of value. + switch v := x.BaseValue.(type) { + case nil: + return Concrete // Should be indetermined. + + case Value: + return v.Concreteness() + + default: // *StructMarker, *ListMarker: + return Concrete + } +} + +func (x *NodeLink) Concreteness() Concreteness { return Concrete } + +func (*Conjunction) Concreteness() Concreteness { return Constraint } +func (*Disjunction) Concreteness() Concreteness { return Constraint } +func (*BoundValue) Concreteness() Concreteness { return Constraint } + +func (*Builtin) Concreteness() Concreteness { return Concrete } +func (*BuiltinValidator) Concreteness() Concreteness { return Constraint } + +// Value and Expr + +func (*Bottom) Concreteness() Concreteness { return BottomLevel } +func (*Null) Concreteness() Concreteness { return Concrete } +func (*Bool) Concreteness() Concreteness { return Concrete } +func (*Num) Concreteness() Concreteness { return Concrete } +func (*String) Concreteness() Concreteness { return Concrete } +func (*Bytes) Concreteness() Concreteness { return Concrete } +func (*Top) Concreteness() Concreteness { return Any } +func (*BasicType) Concreteness() Concreteness { return Type } + +// Expr + +func (*StructLit) expr() {} +func (*ListLit) expr() {} +func (*DisjunctionExpr) expr() {} + +// TODO: also allow? +// a: b: if cond {} +// +// It is unclear here, though, whether field `a` should be added +// unconditionally. +// func (*Comprehension) expr() {} + +// Expr and Value + +func (*Bottom) expr() {} +func (*Null) expr() {} +func (*Bool) expr() {} +func (*Num) expr() {} +func (*String) expr() {} +func (*Bytes) expr() {} +func (*Top) expr() {} +func (*BasicType) expr() {} +func (*Vertex) expr() {} +func (*ListMarker) expr() {} +func (*StructMarker) expr() {} +func (*Conjunction) expr() {} +func (*Disjunction) expr() {} +func (*BoundValue) expr() {} +func (*BuiltinValidator) expr() {} +func (*Builtin) expr() {} + +// Expr and Resolver + +func (*NodeLink) expr() {} +func (*FieldReference) expr() {} +func (*ValueReference) expr() {} +func (*LabelReference) expr() {} +func (*DynamicReference) expr() {} +func (*ImportReference) expr() {} +func (*LetReference) expr() {} + +// Expr and Evaluator + +func (*BoundExpr) expr() {} +func (*SelectorExpr) expr() {} +func (*IndexExpr) expr() {} +func (*SliceExpr) expr() {} +func (*Interpolation) expr() {} +func (*UnaryExpr) expr() {} +func (*BinaryExpr) expr() {} +func (*CallExpr) expr() {} + +// Decl and Expr (so allow attaching original source in Conjunct) + +func (*Field) declNode() {} +func (x *Field) expr() Expr { return x.Value } +func (*OptionalField) declNode() {} +func (x *OptionalField) expr() Expr { return x.Value } +func (*BulkOptionalField) declNode() {} +func (x *BulkOptionalField) expr() Expr { return x.Value } +func (*DynamicField) declNode() {} +func (x *DynamicField) expr() Expr { return x.Value } + +// Decl, Elem, and Expr (so allow attaching original source in Conjunct) + +func (*Ellipsis) elemNode() {} +func (*Ellipsis) declNode() {} +func (x *Ellipsis) expr() Expr { + if x.Value == nil { + return top + } + return x.Value +} + +var top = &Top{} + +// Decl and Yielder + +func (*LetClause) declNode() {} + +// Decl and Elem + +func (*StructLit) declNode() {} +func (*StructLit) elemNode() {} +func (*ListLit) declNode() {} +func (*ListLit) elemNode() {} +func (*Bottom) declNode() {} +func (*Bottom) elemNode() {} +func (*Null) declNode() {} +func (*Null) elemNode() {} +func (*Bool) declNode() {} +func (*Bool) elemNode() {} +func (*Num) declNode() {} +func (*Num) elemNode() {} +func (*String) declNode() {} +func (*String) elemNode() {} +func (*Bytes) declNode() {} +func (*Bytes) elemNode() {} +func (*Top) declNode() {} +func (*Top) elemNode() {} +func (*BasicType) declNode() {} +func (*BasicType) elemNode() {} +func (*BoundExpr) declNode() {} +func (*BoundExpr) elemNode() {} +func (*Vertex) declNode() {} +func (*Vertex) elemNode() {} +func (*ListMarker) declNode() {} +func (*ListMarker) elemNode() {} +func (*StructMarker) declNode() {} +func (*StructMarker) elemNode() {} +func (*Conjunction) declNode() {} +func (*Conjunction) elemNode() {} +func (*Disjunction) declNode() {} +func (*Disjunction) elemNode() {} +func (*BoundValue) declNode() {} +func (*BoundValue) elemNode() {} +func (*BuiltinValidator) declNode() {} +func (*BuiltinValidator) elemNode() {} +func (*NodeLink) declNode() {} +func (*NodeLink) elemNode() {} +func (*FieldReference) declNode() {} +func (*FieldReference) elemNode() {} +func (*ValueReference) declNode() {} +func (*ValueReference) elemNode() {} +func (*LabelReference) declNode() {} +func (*LabelReference) elemNode() {} +func (*DynamicReference) declNode() {} +func (*DynamicReference) elemNode() {} +func (*ImportReference) declNode() {} +func (*ImportReference) elemNode() {} +func (*LetReference) declNode() {} +func (*LetReference) elemNode() {} +func (*SelectorExpr) declNode() {} +func (*SelectorExpr) elemNode() {} +func (*IndexExpr) declNode() {} +func (*IndexExpr) elemNode() {} +func (*SliceExpr) declNode() {} +func (*SliceExpr) elemNode() {} +func (*Interpolation) declNode() {} +func (*Interpolation) elemNode() {} +func (*UnaryExpr) declNode() {} +func (*UnaryExpr) elemNode() {} +func (*BinaryExpr) declNode() {} +func (*BinaryExpr) elemNode() {} +func (*CallExpr) declNode() {} +func (*CallExpr) elemNode() {} +func (*Builtin) declNode() {} +func (*Builtin) elemNode() {} +func (*DisjunctionExpr) declNode() {} +func (*DisjunctionExpr) elemNode() {} + +// Decl, Elem, and Yielder + +func (*Comprehension) declNode() {} +func (*Comprehension) elemNode() {} + +// Node + +func (*Vertex) node() {} +func (*Conjunction) node() {} +func (*Disjunction) node() {} +func (*BoundValue) node() {} +func (*Builtin) node() {} +func (*BuiltinValidator) node() {} +func (*Bottom) node() {} +func (*Null) node() {} +func (*Bool) node() {} +func (*Num) node() {} +func (*String) node() {} +func (*Bytes) node() {} +func (*Top) node() {} +func (*BasicType) node() {} +func (*StructLit) node() {} +func (*ListLit) node() {} +func (*BoundExpr) node() {} +func (*NodeLink) node() {} +func (*FieldReference) node() {} +func (*ValueReference) node() {} +func (*LabelReference) node() {} +func (*DynamicReference) node() {} +func (*ImportReference) node() {} +func (*LetReference) node() {} +func (*SelectorExpr) node() {} +func (*IndexExpr) node() {} +func (*SliceExpr) node() {} +func (*Interpolation) node() {} +func (*UnaryExpr) node() {} +func (*BinaryExpr) node() {} +func (*CallExpr) node() {} +func (*DisjunctionExpr) node() {} +func (*Field) node() {} +func (*OptionalField) node() {} +func (*BulkOptionalField) node() {} +func (*DynamicField) node() {} +func (*Ellipsis) node() {} +func (*Comprehension) node() {} +func (*ForClause) node() {} +func (*IfClause) node() {} +func (*LetClause) node() {} +func (*ValueClause) node() {} diff --git a/vendor/cuelang.org/go/internal/core/adt/binop.go b/vendor/cuelang.org/go/internal/core/adt/binop.go new file mode 100644 index 0000000000..e2410a1e8f --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/binop.go @@ -0,0 +1,321 @@ +// Copyright 2020 CUE Authors +// +// 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 adt + +import ( + "bytes" + "strings" +) + +// BinOp handles all operations except AndOp and OrOp. This includes processing +// unary comparators such as '<4' and '=~"foo"'. +// +// BinOp returns nil if not both left and right are concrete. +func BinOp(c *OpContext, op Op, left, right Value) Value { + leftKind := left.Kind() + rightKind := right.Kind() + + const msg = "non-concrete value '%v' to operation '%s'" + if left.Concreteness() > Concrete { + return &Bottom{ + Code: IncompleteError, + Err: c.Newf(msg, left, op), + } + } + if right.Concreteness() > Concrete { + return &Bottom{ + Code: IncompleteError, + Err: c.Newf(msg, right, op), + } + } + + if err := CombineErrors(c.src, left, right); err != nil { + return err + } + + switch op { + case EqualOp: + switch { + case leftKind == NullKind && rightKind == NullKind: + return c.newBool(true) + + case leftKind == NullKind || rightKind == NullKind: + return c.newBool(false) + + case leftKind == BoolKind: + return c.newBool(c.BoolValue(left) == c.BoolValue(right)) + + case leftKind == StringKind: + // normalize? + return cmpTonode(c, op, strings.Compare(c.StringValue(left), c.StringValue(right))) + + case leftKind == BytesKind: + return cmpTonode(c, op, bytes.Compare(c.bytesValue(left, op), c.bytesValue(right, op))) + + case leftKind&NumKind != 0 && rightKind&NumKind != 0: + // n := c.newNum() + return cmpTonode(c, op, c.Num(left, op).X.Cmp(&c.Num(right, op).X)) + + case leftKind == ListKind && rightKind == ListKind: + x := c.Elems(left) + y := c.Elems(right) + if len(x) != len(y) { + return c.newBool(false) + } + for i, e := range x { + a, _ := c.Concrete(nil, e, op) + b, _ := c.Concrete(nil, y[i], op) + if !test(c, EqualOp, a, b) { + return c.newBool(false) + } + } + return c.newBool(true) + } + + case NotEqualOp: + switch { + case leftKind == NullKind && rightKind == NullKind: + return c.newBool(false) + + case leftKind == NullKind || rightKind == NullKind: + return c.newBool(true) + + case leftKind == BoolKind: + return c.newBool(c.boolValue(left, op) != c.boolValue(right, op)) + + case leftKind == StringKind: + // normalize? + return cmpTonode(c, op, strings.Compare(c.StringValue(left), c.StringValue(right))) + + case leftKind == BytesKind: + return cmpTonode(c, op, bytes.Compare(c.bytesValue(left, op), c.bytesValue(right, op))) + + case leftKind&NumKind != 0 && rightKind&NumKind != 0: + // n := c.newNum() + return cmpTonode(c, op, c.Num(left, op).X.Cmp(&c.Num(right, op).X)) + + case leftKind == ListKind && rightKind == ListKind: + x := c.Elems(left) + y := c.Elems(right) + if len(x) != len(y) { + return c.newBool(false) + } + for i, e := range x { + a, _ := c.Concrete(nil, e, op) + b, _ := c.Concrete(nil, y[i], op) + if !test(c, EqualOp, a, b) { + return c.newBool(true) + } + } + return c.newBool(false) + } + + case LessThanOp, LessEqualOp, GreaterEqualOp, GreaterThanOp: + switch { + case leftKind == StringKind && rightKind == StringKind: + // normalize? + return cmpTonode(c, op, strings.Compare(c.stringValue(left, op), c.stringValue(right, op))) + + case leftKind == BytesKind && rightKind == BytesKind: + return cmpTonode(c, op, bytes.Compare(c.bytesValue(left, op), c.bytesValue(right, op))) + + case leftKind&NumKind != 0 && rightKind&NumKind != 0: + // n := c.newNum(left, right) + return cmpTonode(c, op, c.Num(left, op).X.Cmp(&c.Num(right, op).X)) + } + + case BoolAndOp: + return c.newBool(c.boolValue(left, op) && c.boolValue(right, op)) + + case BoolOrOp: + return c.newBool(c.boolValue(left, op) || c.boolValue(right, op)) + + case MatchOp: + // if y.re == nil { + // // This really should not happen, but leave in for safety. + // b, err := Regexp.MatchString(str, x.str) + // if err != nil { + // return c.Errf(Src, "error parsing Regexp: %v", err) + // } + // return boolTonode(Src, b) + // } + return c.newBool(c.regexp(right).MatchString(c.stringValue(left, op))) + + case NotMatchOp: + return c.newBool(!c.regexp(right).MatchString(c.stringValue(left, op))) + + case AddOp: + switch { + case leftKind&NumKind != 0 && rightKind&NumKind != 0: + return c.Add(c.Num(left, op), c.Num(right, op)) + + case leftKind == StringKind && rightKind == StringKind: + return c.NewString(c.StringValue(left) + c.StringValue(right)) + + case leftKind == BytesKind && rightKind == BytesKind: + ba := c.bytesValue(left, op) + bb := c.bytesValue(right, op) + b := make([]byte, len(ba)+len(bb)) + copy(b, ba) + copy(b[len(ba):], bb) + return c.newBytes(b) + + case leftKind == ListKind && rightKind == ListKind: + // TODO: get rid of list addition. Semantically it is somewhat + // unclear and, as it turns out, it is also hard to get right. + // Simulate addition with comprehensions now. + if err := c.Err(); err != nil { + return err + } + + x := MakeIdentLabel(c, "x", "") + + forClause := func(src Expr) *Comprehension { + s := &StructLit{Decls: []Decl{ + &FieldReference{UpCount: 1, Label: x}, + }} + return &Comprehension{ + Clauses: &ForClause{ + Value: x, + Src: src, + Dst: &ValueClause{s}, + }, + Value: s, + } + } + + list := &ListLit{ + Elems: []Elem{ + forClause(left), + forClause(right), + }, + } + + n := &Vertex{} + n.AddConjunct(MakeRootConjunct(c.Env(0), list)) + n.Finalize(c) + + return n + } + + case SubtractOp: + return c.Sub(c.Num(left, op), c.Num(right, op)) + + case MultiplyOp: + switch { + // float + case leftKind&NumKind != 0 && rightKind&NumKind != 0: + return c.Mul(c.Num(left, op), c.Num(right, op)) + + case leftKind == StringKind && rightKind == IntKind: + const as = "string multiplication" + return c.NewString(strings.Repeat(c.stringValue(left, as), int(c.uint64(right, as)))) + + case leftKind == IntKind && rightKind == StringKind: + const as = "string multiplication" + return c.NewString(strings.Repeat(c.stringValue(right, as), int(c.uint64(left, as)))) + + case leftKind == BytesKind && rightKind == IntKind: + const as = "bytes multiplication" + return c.newBytes(bytes.Repeat(c.bytesValue(left, as), int(c.uint64(right, as)))) + + case leftKind == IntKind && rightKind == BytesKind: + const as = "bytes multiplication" + return c.newBytes(bytes.Repeat(c.bytesValue(right, as), int(c.uint64(left, as)))) + + case leftKind == ListKind && rightKind == IntKind: + left, right = right, left + fallthrough + + case leftKind == IntKind && rightKind == ListKind: + // TODO: get rid of list multiplication. + + list := &ListLit{} + x := MakeIdentLabel(c, "x", "") + + for i := c.uint64(left, "list multiplier"); i > 0; i-- { + st := &StructLit{Decls: []Decl{ + &FieldReference{UpCount: 1, Label: x}, + }} + list.Elems = append(list.Elems, + &Comprehension{ + Clauses: &ForClause{ + Value: x, + Src: right, + Dst: &ValueClause{st}, + }, + Value: st, + }, + ) + } + if err := c.Err(); err != nil { + return err + } + + n := &Vertex{} + n.AddConjunct(MakeRootConjunct(c.Env(0), list)) + n.Finalize(c) + + return n + } + + case FloatQuotientOp: + if leftKind&NumKind != 0 && rightKind&NumKind != 0 { + return c.Quo(c.Num(left, op), c.Num(right, op)) + } + + case IntDivideOp: + if leftKind&IntKind != 0 && rightKind&IntKind != 0 { + return c.IntDiv(c.Num(left, op), c.Num(right, op)) + } + + case IntModuloOp: + if leftKind&IntKind != 0 && rightKind&IntKind != 0 { + return c.IntMod(c.Num(left, op), c.Num(right, op)) + } + + case IntQuotientOp: + if leftKind&IntKind != 0 && rightKind&IntKind != 0 { + return c.IntQuo(c.Num(left, op), c.Num(right, op)) + } + + case IntRemainderOp: + if leftKind&IntKind != 0 && rightKind&IntKind != 0 { + return c.IntRem(c.Num(left, op), c.Num(right, op)) + } + } + + return c.NewErrf("invalid operands %s and %s to '%s' (type %s and %s)", + left, right, op, left.Kind(), right.Kind()) +} + +func cmpTonode(c *OpContext, op Op, r int) Value { + result := false + switch op { + case LessThanOp: + result = r == -1 + case LessEqualOp: + result = r != 1 + case EqualOp, AndOp: + result = r == 0 + case NotEqualOp: + result = r != 0 + case GreaterEqualOp: + result = r != -1 + case GreaterThanOp: + result = r == 1 + } + return c.newBool(result) +} diff --git a/vendor/cuelang.org/go/internal/core/adt/closed.go b/vendor/cuelang.org/go/internal/core/adt/closed.go new file mode 100644 index 0000000000..34a3e45e39 --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/closed.go @@ -0,0 +1,518 @@ +// Copyright 2020 CUE Authors +// +// 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 adt + +// This file implements the closedness algorithm. + +// Outline of algorithm +// +// To compute closedness each Vertex is associated with a tree which has +// leaf nodes with sets of allowed labels, and interior nodes that describe +// how these sets may be combines: Or, for embedding, or And for definitions. +// +// Each conjunct of a Vertex is associated with such a leaf node. Each +// conjunct that evaluates to a struct is added to the list of Structs, which +// in the end forms this tree. If a conjunct is embedded, or references another +// struct or definition, it adds interior node to reflect this. +// +// To test whether a feature is allowed, it must satisfy the resulting +// expression tree. +// +// In order to avoid having to copy the tree for each node, the tree is linked +// from leaf node to root, rather than the other way around. This allows +// parent nodes to be shared as the tree grows and ensures that the growth +// of the tree is bounded by the number of conjuncts. As a consequence, this +// requires a two-pass algorithm: +// +// - walk up to mark which nodes are required and count the number of +// child nodes that need to be satisfied. +// - verify fields in leaf structs and mark parent leafs as satisfied +// when appropriate. +// +// A label is allowed if all required root nodes are marked as accepted after +// these two passes. +// + +// A note on embeddings: it is important to keep track which conjuncts originate +// from an embedding, as an embedded value may eventually turn into a closed +// struct. Consider +// +// a: { +// b +// d: e: int +// } +// b: d: { +// #A & #B +// } +// +// At the point of evaluating `a`, the struct is not yet closed. However, +// descending into `d` will trigger the inclusion of definitions which in turn +// causes the struct to be closed. At this point, it is important to know that +// `b` originated from an embedding, as otherwise `e` may not be allowed. + +// TODO(perf): +// - less nodes +// - disable StructInfo nodes that can no longer pass a feature +// - sort StructInfos active ones first. + +// TODO(errors): return a dedicated ConflictError that can track original +// positions on demand. + +func (v *Vertex) IsInOneOf(t SpanType) bool { + for _, s := range v.Structs { + if s.CloseInfo.IsInOneOf(t) { + return true + } + } + return false +} + +// IsRecursivelyClosed returns true if this value is either a definition or unified +// with a definition. +func (v *Vertex) IsRecursivelyClosed() bool { + return v.Closed || v.IsInOneOf(DefinitionSpan) +} + +type closeNodeType uint8 + +const ( + // a closeRef node is created when there is a non-definition reference. + // These nodes are not necessary for computing results, but may be + // relevant down the line to group closures through embedded values and + // to track position information for failures. + closeRef closeNodeType = iota + + // closeDef indicates this node was introduced as a result of referencing + // a definition. + closeDef + + // closeEmbed indicates this node was added as a result of an embedding. + closeEmbed + + _ = closeRef // silence the linter +) + +// TODO: merge with closeInfo: this is a leftover of the refactoring. +type CloseInfo struct { + *closeInfo + + IsClosed bool + FieldTypes OptionalType +} + +func (c CloseInfo) Location() Node { + if c.closeInfo == nil { + return nil + } + return c.closeInfo.location +} + +func (c CloseInfo) SpanMask() SpanType { + if c.closeInfo == nil { + return 0 + } + return c.span +} + +func (c CloseInfo) RootSpanType() SpanType { + if c.closeInfo == nil { + return 0 + } + return c.root +} + +func (c CloseInfo) IsInOneOf(t SpanType) bool { + if c.closeInfo == nil { + return false + } + return c.span&t != 0 +} + +// TODO(perf): remove: error positions should always be computed on demand +// in dedicated error types. +func (c *CloseInfo) AddPositions(ctx *OpContext) { + for s := c.closeInfo; s != nil; s = s.parent { + if loc := s.location; loc != nil { + ctx.AddPosition(loc) + } + } +} + +// TODO(perf): use on StructInfo. Then if parent and expression are the same +// it is possible to use cached value. +func (c CloseInfo) SpawnEmbed(x Expr) CloseInfo { + var span SpanType + if c.closeInfo != nil { + span = c.span + } + + c.closeInfo = &closeInfo{ + parent: c.closeInfo, + location: x, + mode: closeEmbed, + root: EmbeddingSpan, + span: span | EmbeddingSpan, + } + return c +} + +// SpawnGroup is used for structs that contain embeddings that may end up +// closing the struct. This is to force that `b` is not allowed in +// +// a: {#foo} & {b: int} +// +func (c CloseInfo) SpawnGroup(x Expr) CloseInfo { + var span SpanType + if c.closeInfo != nil { + span = c.span + } + c.closeInfo = &closeInfo{ + parent: c.closeInfo, + location: x, + span: span, + } + return c +} + +// SpawnSpan is used to track that a value is introduced by a comprehension +// or constraint. Definition and embedding spans are introduced with SpawnRef +// and SpawnEmbed, respectively. +func (c CloseInfo) SpawnSpan(x Node, t SpanType) CloseInfo { + var span SpanType + if c.closeInfo != nil { + span = c.span + } + c.closeInfo = &closeInfo{ + parent: c.closeInfo, + location: x, + root: t, + span: span | t, + } + return c +} + +func (c CloseInfo) SpawnRef(arc *Vertex, isDef bool, x Expr) CloseInfo { + var span SpanType + if c.closeInfo != nil { + span = c.span + } + c.closeInfo = &closeInfo{ + parent: c.closeInfo, + location: x, + span: span, + } + if isDef { + c.mode = closeDef + c.closeInfo.root = DefinitionSpan + c.closeInfo.span |= DefinitionSpan + } + return c +} + +// isDef reports whether an expressions is a reference that references a +// definition anywhere in its selection path. +// +// TODO(performance): this should be merged with resolve(). But for now keeping +// this code isolated makes it easier to see what it is for. +func IsDef(x Expr) bool { + switch r := x.(type) { + case *FieldReference: + return r.Label.IsDef() + + case *SelectorExpr: + if r.Sel.IsDef() { + return true + } + return IsDef(r.X) + + case *IndexExpr: + return IsDef(r.X) + } + return false +} + +// A SpanType is used to indicate whether a CUE value is within the scope of +// a certain CUE language construct, the span type. +type SpanType uint8 + +const ( + // EmbeddingSpan means that this value was embedded at some point and should + // not be included as a possible root node in the todo field of OpContext. + EmbeddingSpan SpanType = 1 << iota + ConstraintSpan + ComprehensionSpan + DefinitionSpan +) + +type closeInfo struct { + // location records the expression that led to this node's introduction. + location Node + + // The parent node in the tree. + parent *closeInfo + + // TODO(performance): if references are chained, we could have a separate + // parent pointer to skip the chain. + + // mode indicates whether this node was added as part of an embedding, + // definition or non-definition reference. + mode closeNodeType + + // noCheck means this struct is irrelevant for closedness checking. This can + // happen when: + // - it is a sibling of a new definition. + noCheck bool // don't process for inclusion info + + root SpanType + span SpanType +} + +// closeStats holds the administrative fields for a closeInfo value. Each +// closeInfo is associated with a single closeStats value per unification +// operator. This association is done through an OpContext. This allows the +// same value to be used in multiple concurrent unification operations. +// NOTE: there are other parts of the algorithm that are not thread-safe yet. +type closeStats struct { + // the other fields of this closeStats value are only valid if generation + // is equal to the generation in OpContext. This allows for lazy + // initialization of closeStats. + generation int + + // These counts keep track of how many required child nodes need to be + // completed before this node is accepted. + requiredCount int + acceptedCount int + + // accepted is set if this node is accepted. + accepted bool + + required bool + next *closeStats +} + +func (c *closeInfo) isClosed() bool { + return c.mode == closeDef +} + +func isClosed(v *Vertex) bool { + for _, s := range v.Structs { + if s.IsClosed { + return true + } + for c := s.closeInfo; c != nil; c = c.parent { + if c.isClosed() { + return true + } + } + } + return false +} + +// Accept determines whether f is allowed in n. It uses the OpContext for +// caching administrative fields. +func Accept(ctx *OpContext, n *Vertex, f Feature) (found, required bool) { + ctx.generation++ + ctx.todo = nil + + var optionalTypes OptionalType + + // TODO(perf): more aggressively determine whether a struct is open or + // closed: open structs do not have to be checked, yet they can particularly + // be the ones with performance isssues, for instanced as a result of + // embedded for comprehensions. + for _, s := range n.Structs { + if !s.useForAccept() { + continue + } + markCounts(ctx, s.CloseInfo) + optionalTypes |= s.types + } + + var str Value + if f.Index() == MaxIndex { + f &= fTypeMask + } else if optionalTypes&(HasComplexPattern|HasDynamic) != 0 && f.IsString() { + str = f.ToValue(ctx) + } + + for _, s := range n.Structs { + if !s.useForAccept() { + continue + } + if verifyArc(ctx, s, f, str) { + // Beware: don't add to below expression: this relies on the + // side effects of markUp. + ok := markUp(ctx, s.closeInfo, 0) + found = found || ok + } + } + + // Reject if any of the roots is not accepted. + for x := ctx.todo; x != nil; x = x.next { + if !x.accepted { + return false, true + } + } + + return found, ctx.todo != nil +} + +func markCounts(ctx *OpContext, info CloseInfo) { + if info.IsClosed { + markRequired(ctx, info.closeInfo) + return + } + for s := info.closeInfo; s != nil; s = s.parent { + if s.isClosed() { + markRequired(ctx, s) + return + } + } +} + +func markRequired(ctx *OpContext, info *closeInfo) { + count := 0 + for ; ; info = info.parent { + var s closeInfo + if info != nil { + s = *info + } + + x := getScratch(ctx, info) + + x.requiredCount += count + + if x.required { + return + } + + if s.span&EmbeddingSpan == 0 { + x.next = ctx.todo + ctx.todo = x + } + + x.required = true + + if info == nil { + return + } + + count = 0 + if s.mode != closeEmbed { + count = 1 + } + } +} + +func markUp(ctx *OpContext, info *closeInfo, count int) bool { + for ; ; info = info.parent { + var s closeInfo + if info != nil { + s = *info + } + + x := getScratch(ctx, info) + + x.acceptedCount += count + + if x.acceptedCount < x.requiredCount { + return false + } + + x.accepted = true + + if info == nil { + return true + } + + count = 0 + if x.required && s.mode != closeEmbed { + count = 1 + } + } +} + +// getScratch: explain generation. +func getScratch(ctx *OpContext, s *closeInfo) *closeStats { + m := ctx.closed + if m == nil { + m = map[*closeInfo]*closeStats{} + ctx.closed = m + } + + x := m[s] + if x == nil { + x = &closeStats{} + m[s] = x + } + + if x.generation != ctx.generation { + *x = closeStats{generation: ctx.generation} + } + + return x +} + +func verifyArc(ctx *OpContext, s *StructInfo, f Feature, label Value) bool { + isRegular := f.IsString() + + o := s.StructLit + env := s.Env + + if isRegular && (len(o.Additional) > 0 || o.IsOpen) { + return true + } + + for _, g := range o.Fields { + if f == g.Label { + return true + } + } + + if !isRegular { + return false + } + + // Do not record errors during this validation. + errs := ctx.errs + defer func() { ctx.errs = errs }() + + if len(o.Dynamic) > 0 && f.IsString() && label != nil { + for _, b := range o.Dynamic { + v := env.evalCached(ctx, b.Key) + s, ok := Unwrap(v).(*String) + if !ok { + continue + } + if label.(*String).Str == s.Str { + return true + } + } + } + + for _, b := range o.Bulk { + if matchBulk(ctx, env, b, f, label) { + return true + } + } + + // TODO(perf): delay adding this position: create a special error type that + // computes all necessary positions on demand. + if ctx != nil { + ctx.AddPosition(s.StructLit) + } + + return false +} diff --git a/vendor/cuelang.org/go/internal/core/adt/closed2.go b/vendor/cuelang.org/go/internal/core/adt/closed2.go new file mode 100644 index 0000000000..ada0342d2d --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/closed2.go @@ -0,0 +1,68 @@ +// Copyright 2020 CUE Authors +// +// 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 adt + +// CloseDef defines how individual fieldSets (corresponding to conjuncts) +// combine to determine whether a field is contained in a closed set. +// +// A CloseDef combines multiple conjuncts and embeddings. All CloseDefs are +// stored in slice. References to other CloseDefs are indices within this slice. +// Together they define the top of the tree of the expression tree of how +// conjuncts combine together (a canopy). + +// isComplexStruct reports whether the Closed information should be copied as a +// subtree into the parent node using InsertSubtree. If not, the conjuncts can +// just be inserted at the current ID. +func isComplexStruct(ctx *OpContext, v *Vertex) bool { + return v.IsClosedStruct() +} + +// TODO: cleanup code and error messages. Reduce duplication in some related +// code. +func verifyArc2(ctx *OpContext, f Feature, v *Vertex, isClosed bool) (found bool, err *Bottom) { + // Don't check computed, temporary vertices. + if v.Label == InvalidLabel { + return true, nil + } + + // TODO(perf): collect positions in error. + defer ctx.ReleasePositions(ctx.MarkPositions()) + + // Note: it is okay to use parent here as this only needs to be computed + // for the original location. + if ok, required := Accept(ctx, v.Parent, f); ok || (!required && !isClosed) { + return true, nil + } + + if !f.IsString() { + // if f.IsHidden() { Also change Accept in composite.go + return false, nil + } + + if v != nil { + for _, c := range v.Conjuncts { + if pos := c.Field(); pos != nil { + ctx.AddPosition(pos) + } + } + } + + for _, s := range v.Parent.Structs { + s.AddPositions(ctx) + } + + label := f.SelectorString(ctx) + return false, ctx.NewErrf("field not allowed: %s", label) +} diff --git a/vendor/cuelang.org/go/internal/core/adt/composite.go b/vendor/cuelang.org/go/internal/core/adt/composite.go new file mode 100644 index 0000000000..603abf2386 --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/composite.go @@ -0,0 +1,838 @@ +// Copyright 2020 CUE Authors +// +// 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 adt + +import ( + "fmt" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/token" +) + +// TODO: unanswered questions about structural cycles: +// +// 1. When detecting a structural cycle, should we consider this as: +// a) an unevaluated value, +// b) an incomplete error (which does not affect parent validity), or +// c) a special value. +// +// Making it an error is the simplest way to ensure reentrancy is disallowed: +// without an error it would require an additional mechanism to stop reentrancy +// from continuing to process. Even worse, in some cases it may only partially +// evaluate, resulting in unexpected results. For this reason, we are taking +// approach `b` for now. +// +// This has some consequences of how disjunctions are treated though. Consider +// +// list: { +// head: _ +// tail: list | null +// } +// +// When making it an error, evaluating the above will result in +// +// list: { +// head: _ +// tail: null +// } +// +// because list will result in a structural cycle, and thus an error, it will be +// stripped from the disjunction. This may or may not be a desirable property. A +// nice thing is that it is not required to write `list | *null`. A disadvantage +// is that this is perhaps somewhat inexplicit. +// +// When not making it an error (and simply cease evaluating child arcs upon +// cycle detection), the result would be: +// +// list: { +// head: _ +// tail: list | null +// } +// +// In other words, an evaluation would result in a cycle and thus an error. +// Implementations can recognize such cases by having unevaluated arcs. An +// explicit structure cycle marker would probably be less error prone. +// +// Note that in both cases, a reference to list will still use the original +// conjuncts, so the result will be the same for either method in this case. +// +// +// 2. Structural cycle allowance. +// +// Structural cycle detection disallows reentrancy as well. This means one +// cannot use structs for recursive computation. This will probably preclude +// evaluation of some configuration. Given that there is no real alternative +// yet, we could allow structural cycle detection to be optionally disabled. + +// An Environment links the parent scopes for identifier lookup to a composite +// node. Each conjunct that make up node in the tree can be associated with +// a different environment (although some conjuncts may share an Environment). +type Environment struct { + Up *Environment + Vertex *Vertex + + // DynamicLabel is only set when instantiating a field from a pattern + // constraint. It is used to resolve label references. + DynamicLabel Feature + + // TODO(perf): make the following public fields a shareable struct as it + // mostly is going to be the same for child nodes. + + // Cyclic indicates a structural cycle was detected for this conjunct or one + // of its ancestors. + Cyclic bool + + // Deref keeps track of nodes that should dereference to Vertex. It is used + // for detecting structural cycle. + // + // The detection algorithm is based on Tomabechi's quasi-destructive graph + // unification. This detection requires dependencies to be resolved into + // fully dereferenced vertices. This is not the case in our algorithm: + // the result of evaluating conjuncts is placed into dereferenced vertices + // _after_ they are evaluated, but the Environment still points to the + // non-dereferenced context. + // + // In order to be able to detect structural cycles, we need to ensure that + // at least one node that is part of a cycle in the context in which + // conjunctions are evaluated dereferences correctly. + // + // The only field necessary to detect a structural cycle, however, is + // the Status field of the Vertex. So rather than dereferencing a node + // proper, it is sufficient to copy the Status of the dereferenced nodes + // to these nodes (will always be EvaluatingArcs). + Deref []*Vertex + + // Cycles contains vertices for which cycles are detected. It is used + // for tracking self-references within structural cycles. + // + // Unlike Deref, Cycles is not incremented with child nodes. + // TODO: Cycles is always a tail end of Deref, so this can be optimized. + Cycles []*Vertex + + cache map[Expr]Value +} + +type ID int32 + +// evalCached is used to look up let expressions. Caching let expressions +// prevents a possible combinatorial explosion. +func (e *Environment) evalCached(c *OpContext, x Expr) Value { + if v, ok := x.(Value); ok { + return v + } + v, ok := e.cache[x] + if !ok { + if e.cache == nil { + e.cache = map[Expr]Value{} + } + env, src := c.e, c.src + c.e, c.src = e, x.Source() + v = c.evalState(x, Partial) // TODO: should this be Finalized? + c.e, c.src = env, src + if b, ok := v.(*Bottom); !ok || !b.IsIncomplete() { + e.cache[x] = v + } + } + return v +} + +// A Vertex is a node in the value tree. It may be a leaf or internal node. +// It may have arcs to represent elements of a fully evaluated struct or list. +// +// For structs, it only contains definitions and concrete fields. +// optional fields are dropped. +// +// It maintains source information such as a list of conjuncts that contributed +// to the value. +type Vertex struct { + // Parent links to a parent Vertex. This parent should only be used to + // access the parent's Label field to find the relative location within a + // tree. + Parent *Vertex + + // Label is the feature leading to this vertex. + Label Feature + + // State: + // eval: nil, BaseValue: nil -- unevaluated + // eval: *, BaseValue: nil -- evaluating + // eval: *, BaseValue: * -- finalized + // + state *nodeContext + // TODO: move the following status fields to nodeContext. + + // status indicates the evaluation progress of this vertex. + status VertexStatus + + // isData indicates that this Vertex is to be interepreted as data: pattern + // and additional constraints, as well as optional fields, should be + // ignored. + isData bool + Closed bool + nonMonotonicReject bool + nonMonotonicInsertGen int32 + nonMonotonicLookupGen int32 + + // EvalCount keeps track of temporary dereferencing during evaluation. + // If EvalCount > 0, status should be considered to be EvaluatingArcs. + EvalCount int32 + + // SelfCount is used for tracking self-references. + SelfCount int32 + + // BaseValue is the value associated with this vertex. For lists and structs + // this is a sentinel value indicating its kind. + BaseValue BaseValue + + // ChildErrors is the collection of all errors of children. + ChildErrors *Bottom + + // The parent of nodes can be followed to determine the path within the + // configuration of this node. + // Value Value + Arcs []*Vertex // arcs are sorted in display order. + + // Conjuncts lists the structs that ultimately formed this Composite value. + // This includes all selected disjuncts. + // + // This value may be nil, in which case the Arcs are considered to define + // the final value of this Vertex. + Conjuncts []Conjunct + + // Structs is a slice of struct literals that contributed to this value. + // This information is used to compute the topological sort of arcs. + Structs []*StructInfo +} + +func (v *Vertex) Clone() *Vertex { + c := *v + c.state = nil + return &c +} + +type StructInfo struct { + *StructLit + + Env *Environment + + CloseInfo + + // Embed indicates the struct in which this struct is embedded (originally), + // or nil if this is a root structure. + // Embed *StructInfo + // Context *RefInfo // the location from which this struct originates. + Disable bool + + Embedding bool +} + +// TODO(perf): this could be much more aggressive for eliminating structs that +// are immaterial for closing. +func (s *StructInfo) useForAccept() bool { + if c := s.closeInfo; c != nil { + return !c.noCheck + } + return true +} + +// VertexStatus indicates the evaluation progress of a Vertex. +type VertexStatus int8 + +const ( + // Unprocessed indicates a Vertex has not been processed before. + // Value must be nil. + Unprocessed VertexStatus = iota + + // Evaluating means that the current Vertex is being evaluated. If this is + // encountered it indicates a reference cycle. Value must be nil. + Evaluating + + // Partial indicates that the result was only partially evaluated. It will + // need to be fully evaluated to get a complete results. + // + // TODO: this currently requires a renewed computation. Cache the + // nodeContext to allow reusing the computations done so far. + Partial + + // AllArcs is request only. It must be past Partial, but + // before recursively resolving arcs. + AllArcs + + // EvaluatingArcs indicates that the arcs of the Vertex are currently being + // evaluated. If this is encountered it indicates a structural cycle. + // Value does not have to be nil + EvaluatingArcs + + // Finalized means that this node is fully evaluated and that the results + // are save to use without further consideration. + Finalized +) + +func (s VertexStatus) String() string { + switch s { + case Unprocessed: + return "unprocessed" + case Evaluating: + return "evaluating" + case Partial: + return "partial" + case AllArcs: + return "allarcs" + case EvaluatingArcs: + return "evaluatingArcs" + case Finalized: + return "finalized" + default: + return "unknown" + } +} + +func (v *Vertex) Status() VertexStatus { + if v.EvalCount > 0 { + return EvaluatingArcs + } + return v.status +} + +func (v *Vertex) UpdateStatus(s VertexStatus) { + Assertf(v.status <= s+1, "attempt to regress status from %d to %d", v.Status(), s) + + if s == Finalized && v.BaseValue == nil { + // panic("not finalized") + } + v.status = s +} + +// Value returns the Value of v without definitions if it is a scalar +// or itself otherwise. +func (v *Vertex) Value() Value { + switch x := v.BaseValue.(type) { + case nil: + return nil + case *StructMarker, *ListMarker: + return v + case Value: + // TODO: recursively descend into Vertex? + return x + default: + panic(fmt.Sprintf("unexpected type %T", v.BaseValue)) + } +} + +// isUndefined reports whether a vertex does not have a useable BaseValue yet. +func (v *Vertex) isUndefined() bool { + switch v.BaseValue { + case nil, cycle: + return true + } + return false +} + +func (x *Vertex) IsConcrete() bool { + return x.Concreteness() <= Concrete +} + +// IsData reports whether v should be interpreted in data mode. In other words, +// it tells whether optional field matching and non-regular fields, like +// definitions and hidden fields, should be ignored. +func (v *Vertex) IsData() bool { + return v.isData || len(v.Conjuncts) == 0 +} + +// ToDataSingle creates a new Vertex that represents just the regular fields +// of this vertex. Arcs are left untouched. +// It is used by cue.Eval to convert nodes to data on per-node basis. +func (v *Vertex) ToDataSingle() *Vertex { + w := *v + w.isData = true + w.state = nil + w.status = Finalized + return &w +} + +// ToDataAll returns a new v where v and all its descendents contain only +// the regular fields. +func (v *Vertex) ToDataAll() *Vertex { + arcs := make([]*Vertex, 0, len(v.Arcs)) + for _, a := range v.Arcs { + if a.Label.IsRegular() { + arcs = append(arcs, a.ToDataAll()) + } + } + w := *v + w.state = nil + w.status = Finalized + + w.BaseValue = toDataAll(w.BaseValue) + w.Arcs = arcs + w.isData = true + w.Conjuncts = make([]Conjunct, len(v.Conjuncts)) + // TODO(perf): this is not strictly necessary for evaluation, but it can + // hurt performance greatly. Drawback is that it may disable ordering. + for _, s := range w.Structs { + s.Disable = true + } + copy(w.Conjuncts, v.Conjuncts) + for i, c := range w.Conjuncts { + if v, _ := c.x.(Value); v != nil { + w.Conjuncts[i].x = toDataAll(v).(Value) + } + } + return &w +} + +func toDataAll(v BaseValue) BaseValue { + switch x := v.(type) { + default: + return x + + case *Vertex: + return x.ToDataAll() + + // The following cases are always erroneous, but we handle them anyway + // to avoid issues with the closedness algorithm down the line. + case *Disjunction: + d := *x + d.Values = make([]*Vertex, len(x.Values)) + for i, v := range x.Values { + d.Values[i] = v.ToDataAll() + } + return &d + + case *Conjunction: + c := *x + c.Values = make([]Value, len(x.Values)) + for i, v := range x.Values { + // This case is okay because the source is of type Value. + c.Values[i] = toDataAll(v).(Value) + } + return &c + } +} + +// func (v *Vertex) IsEvaluating() bool { +// return v.Value == cycle +// } + +func (v *Vertex) IsErr() bool { + // if v.Status() > Evaluating { + if _, ok := v.BaseValue.(*Bottom); ok { + return true + } + // } + return false +} + +func (v *Vertex) Err(c *OpContext, state VertexStatus) *Bottom { + c.Unify(v, state) + if b, ok := v.BaseValue.(*Bottom); ok { + return b + } + return nil +} + +// func (v *Vertex) Evaluate() + +func (v *Vertex) Finalize(c *OpContext) { + // Saving and restoring the error context prevents v from panicking in + // case the caller did not handle existing errors in the context. + err := c.errs + c.errs = nil + c.Unify(v, Finalized) + c.errs = err +} + +func (v *Vertex) AddErr(ctx *OpContext, b *Bottom) { + v.SetValue(ctx, Finalized, CombineErrors(nil, v.Value(), b)) +} + +func (v *Vertex) SetValue(ctx *OpContext, state VertexStatus, value BaseValue) *Bottom { + v.BaseValue = value + v.UpdateStatus(state) + return nil +} + +// ToVertex wraps v in a new Vertex, if necessary. +func ToVertex(v Value) *Vertex { + switch x := v.(type) { + case *Vertex: + return x + default: + n := &Vertex{ + status: Finalized, + BaseValue: x, + } + n.AddConjunct(MakeRootConjunct(nil, v)) + return n + } +} + +// Unwrap returns the possibly non-concrete scalar value of v or nil if v is +// a list, struct or of undefined type. +func Unwrap(v Value) Value { + x, ok := v.(*Vertex) + if !ok { + return v + } + x = x.Indirect() + if n := x.state; n != nil && isCyclePlaceholder(x.BaseValue) { + if n.errs != nil && !n.errs.IsIncomplete() { + return n.errs + } + if n.scalar != nil { + return n.scalar + } + } + return x.Value() +} + +// Indirect unrolls indirections of Vertex values. These may be introduced, +// for instance, by temporary bindings such as comprehension values. +// It returns v itself if v does not point to another Vertex. +func (v *Vertex) Indirect() *Vertex { + for { + arc, ok := v.BaseValue.(*Vertex) + if !ok { + return v + } + v = arc + } +} + +// OptionalType is a bit field of the type of optional constraints in use by an +// Acceptor. +type OptionalType int8 + +const ( + HasField OptionalType = 1 << iota // X: T + HasDynamic // (X): T or "\(X)": T + HasPattern // [X]: T + HasComplexPattern // anything but a basic type + HasAdditional // ...T + IsOpen // Defined for all fields +) + +func (v *Vertex) Kind() Kind { + // This is possible when evaluating comprehensions. It is potentially + // not known at this time what the type is. + switch { + case v.state != nil: + return v.state.kind + case v.BaseValue == nil: + return TopKind + default: + return v.BaseValue.Kind() + } +} + +func (v *Vertex) OptionalTypes() OptionalType { + var mask OptionalType + for _, s := range v.Structs { + mask |= s.OptionalTypes() + } + return mask +} + +// IsOptional reports whether a field is explicitly defined as optional, +// as opposed to whether it is allowed by a pattern constraint. +func (v *Vertex) IsOptional(label Feature) bool { + for _, s := range v.Structs { + if s.IsOptional(label) { + return true + } + } + return false +} + +func (v *Vertex) accepts(ok, required bool) bool { + return ok || (!required && !v.Closed) +} + +func (v *Vertex) IsClosedStruct() bool { + switch x := v.BaseValue.(type) { + default: + return false + + case *StructMarker: + if x.NeedClose { + return true + } + + case *Disjunction: + } + return v.Closed || isClosed(v) +} + +func (v *Vertex) IsClosedList() bool { + if x, ok := v.BaseValue.(*ListMarker); ok { + return !x.IsOpen + } + return false +} + +// TODO: return error instead of boolean? (or at least have version that does.) +func (v *Vertex) Accept(ctx *OpContext, f Feature) bool { + if x, ok := v.BaseValue.(*Disjunction); ok { + for _, v := range x.Values { + if v.Accept(ctx, f) { + return true + } + } + return false + } + + if f.IsInt() { + switch v.BaseValue.(type) { + case *ListMarker: + // TODO(perf): use precomputed length. + if f.Index() < len(v.Elems()) { + return true + } + return !v.IsClosedList() + + default: + return v.Kind()&ListKind != 0 + } + } + + if k := v.Kind(); k&StructKind == 0 && f.IsString() { + // If the value is bottom, we may not really know if this used to + // be a struct. + if k != BottomKind || len(v.Structs) == 0 { + return false + } + } + + if f.IsHidden() || !v.IsClosedStruct() || v.Lookup(f) != nil { + return true + } + + // TODO(perf): collect positions in error. + defer ctx.ReleasePositions(ctx.MarkPositions()) + + return v.accepts(Accept(ctx, v, f)) +} + +// MatchAndInsert finds the conjuncts for optional fields, pattern +// constraints, and additional constraints that match f and inserts them in +// arc. Use f is 0 to match all additional constraints only. +func (v *Vertex) MatchAndInsert(ctx *OpContext, arc *Vertex) { + if !v.Accept(ctx, arc.Label) { + return + } + + // Go backwards to simulate old implementation. + for i := len(v.Structs) - 1; i >= 0; i-- { + s := v.Structs[i] + if s.Disable { + continue + } + s.MatchAndInsert(ctx, arc) + } +} + +func (v *Vertex) IsList() bool { + _, ok := v.BaseValue.(*ListMarker) + return ok +} + +// Lookup returns the Arc with label f if it exists or nil otherwise. +func (v *Vertex) Lookup(f Feature) *Vertex { + for _, a := range v.Arcs { + if a.Label == f { + a = a.Indirect() + return a + } + } + return nil +} + +// Elems returns the regular elements of a list. +func (v *Vertex) Elems() []*Vertex { + // TODO: add bookkeeping for where list arcs start and end. + a := make([]*Vertex, 0, len(v.Arcs)) + for _, x := range v.Arcs { + if x.Label.IsInt() { + a = append(a, x) + } + } + return a +} + +// GetArc returns a Vertex for the outgoing arc with label f. It creates and +// ads one if it doesn't yet exist. +func (v *Vertex) GetArc(c *OpContext, f Feature) (arc *Vertex, isNew bool) { + arc = v.Lookup(f) + if arc == nil { + for _, a := range v.state.usedArcs { + if a.Label == f { + arc = a + v.Arcs = append(v.Arcs, arc) + isNew = true + if c.nonMonotonicInsertNest > 0 { + a.nonMonotonicInsertGen = c.nonMonotonicGeneration + } + break + } + } + } + if arc == nil { + arc = &Vertex{Parent: v, Label: f} + v.Arcs = append(v.Arcs, arc) + isNew = true + if c.nonMonotonicInsertNest > 0 { + arc.nonMonotonicInsertGen = c.nonMonotonicGeneration + } + } + if c.nonMonotonicInsertNest == 0 { + arc.nonMonotonicInsertGen = 0 + } + return arc, isNew +} + +func (v *Vertex) Source() ast.Node { + if v != nil { + if b, ok := v.BaseValue.(Value); ok { + return b.Source() + } + } + return nil +} + +// AddConjunct adds the given Conjuncts to v if it doesn't already exist. +func (v *Vertex) AddConjunct(c Conjunct) *Bottom { + if v.BaseValue != nil { + // TODO: investigate why this happens at all. Removing it seems to + // change the order of fields in some cases. + // + // This is likely a bug in the evaluator and should not happen. + return &Bottom{Err: errors.Newf(token.NoPos, "cannot add conjunct")} + } + v.addConjunct(c) + return nil +} + +func (v *Vertex) addConjunct(c Conjunct) { + for _, x := range v.Conjuncts { + if x == c { + return + } + } + v.Conjuncts = append(v.Conjuncts, c) +} + +func (v *Vertex) AddStruct(s *StructLit, env *Environment, ci CloseInfo) *StructInfo { + info := StructInfo{ + StructLit: s, + Env: env, + CloseInfo: ci, + } + for _, t := range v.Structs { + if *t == info { + return t + } + } + t := &info + v.Structs = append(v.Structs, t) + return t +} + +// Path computes the sequence of Features leading from the root to of the +// instance to this Vertex. +// +// NOTE: this is for debugging purposes only. +func (v *Vertex) Path() []Feature { + return appendPath(nil, v) +} + +func appendPath(a []Feature, v *Vertex) []Feature { + if v.Parent == nil { + return a + } + a = appendPath(a, v.Parent) + if v.Label != 0 { + // A Label may be 0 for programmatically inserted nodes. + a = append(a, v.Label) + } + return a +} + +// An Conjunct is an Environment-Expr pair. The Environment is the starting +// point for reference lookup for any reference contained in X. +type Conjunct struct { + Env *Environment + x Node + + // CloseInfo is a unique number that tracks a group of conjuncts that need + // belong to a single originating definition. + CloseInfo CloseInfo +} + +// TODO(perf): replace with composite literal if this helps performance. + +// MakeRootConjunct creates a conjunct from the given environment and node. +// It panics if x cannot be used as an expression. +func MakeRootConjunct(env *Environment, x Node) Conjunct { + return MakeConjunct(env, x, CloseInfo{}) +} + +func MakeConjunct(env *Environment, x Node, id CloseInfo) Conjunct { + if env == nil { + // TODO: better is to pass one. + env = &Environment{} + } + switch x.(type) { + case Elem, interface{ expr() Expr }: + default: + panic(fmt.Sprintf("invalid Node type %T", x)) + } + return Conjunct{env, x, id} +} + +func (c *Conjunct) Source() ast.Node { + return c.x.Source() +} + +func (c *Conjunct) Field() Node { + return c.x +} + +// Elem retrieves the Elem form of the contained conjunct. +// If it is a Field, it will return the field value. +func (c *Conjunct) Elem() Elem { + switch x := c.x.(type) { + case interface{ expr() Expr }: + return x.expr() + case Elem: + return x + default: + panic("unreachable") + } +} + +// Expr retrieves the expression form of the contained conjunct. +// If it is a field or comprehension, it will return its associated value. +func (c *Conjunct) Expr() Expr { + switch x := c.x.(type) { + case Expr: + return x + // TODO: comprehension. + case interface{ expr() Expr }: + return x.expr() + default: + panic("unreachable") + } +} diff --git a/vendor/cuelang.org/go/internal/core/adt/comprehension.go b/vendor/cuelang.org/go/internal/core/adt/comprehension.go new file mode 100644 index 0000000000..804dc39579 --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/comprehension.go @@ -0,0 +1,70 @@ +// Copyright 2021 CUE Authors +// +// 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 adt + +type envYield struct { + comp *Comprehension + env *Environment + id CloseInfo + err *Bottom +} + +func (n *nodeContext) insertComprehension(env *Environment, x *Comprehension, ci CloseInfo) { + n.comprehensions = append(n.comprehensions, envYield{x, env, ci, nil}) +} + +// injectComprehensions evaluates and inserts comprehensions. +func (n *nodeContext) injectComprehensions(all *[]envYield) (progress bool) { + ctx := n.ctx + + k := 0 + for i := 0; i < len(*all); i++ { + d := (*all)[i] + + sa := []*Environment{} + f := func(env *Environment) { + sa = append(sa, env) + } + + if err := ctx.Yield(d.env, d.comp, f); err != nil { + if err.IsIncomplete() { + d.err = err + (*all)[k] = d + k++ + } else { + // continue to collect other errors. + n.addBottom(err) + } + continue + } + + if len(sa) == 0 { + continue + } + id := d.id.SpawnSpan(d.comp.Clauses, ComprehensionSpan) + + n.ctx.nonMonotonicInsertNest++ + for _, env := range sa { + n.addExprConjunct(Conjunct{env, d.comp.Value, id}) + } + n.ctx.nonMonotonicInsertNest-- + } + + progress = k < len(*all) + + *all = (*all)[:k] + + return progress +} diff --git a/vendor/cuelang.org/go/internal/core/adt/context.go b/vendor/cuelang.org/go/internal/core/adt/context.go new file mode 100644 index 0000000000..e7a6412beb --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/context.go @@ -0,0 +1,1283 @@ +// Copyright 2020 CUE Authors +// +// 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 adt + +import ( + "fmt" + "log" + "os" + "reflect" + "regexp" + "sort" + "strings" + + "github.com/cockroachdb/apd/v2" + "golang.org/x/text/encoding/unicode" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/token" +) + +// Debug sets whether extra aggressive checking should be done. +// This should typically default to true for pre-releases and default to +// false otherwise. +var Debug bool = os.Getenv("CUE_DEBUG") != "0" + +// Verbosity sets the log level. There are currently only two levels: +// 0: no logging +// 1: logging +var Verbosity int + +// DebugSort specifies that arcs be sorted consistently between implementations. +// 0: default +// 1: sort by Feature: this should be consistent between implementations where +// there is no change in the compiler and indexing code. +// 2: alphabetical +var DebugSort int + +func DebugSortArcs(c *OpContext, n *Vertex) { + if n.IsList() { + return + } + switch a := n.Arcs; DebugSort { + case 1: + sort.SliceStable(a, func(i, j int) bool { + return a[i].Label < a[j].Label + }) + case 2: + sort.SliceStable(a, func(i, j int) bool { + return a[i].Label.SelectorString(c.Runtime) < + a[j].Label.SelectorString(c.Runtime) + }) + } +} + +func DebugSortFields(c *OpContext, a []Feature) { + switch DebugSort { + case 1: + sort.SliceStable(a, func(i, j int) bool { + return a[i] < a[j] + }) + case 2: + sort.SliceStable(a, func(i, j int) bool { + return a[i].SelectorString(c.Runtime) < + a[j].SelectorString(c.Runtime) + }) + } +} + +// Assert panics if the condition is false. Assert can be used to check for +// conditions that are considers to break an internal variant or unexpected +// condition, but that nonetheless probably will be handled correctly down the +// line. For instance, a faulty condition could lead to to error being caught +// down the road, but resulting in an inaccurate error message. In production +// code it is better to deal with the bad error message than to panic. +// +// It is advisable for each use of Assert to document how the error is expected +// to be handled down the line. +func Assertf(b bool, format string, args ...interface{}) { + if Debug && !b { + panic(fmt.Sprintf("assertion failed: "+format, args...)) + } +} + +// Assertf either panics or reports an error to c if the condition is not met. +func (c *OpContext) Assertf(pos token.Pos, b bool, format string, args ...interface{}) { + if !b { + if Debug { + panic(fmt.Sprintf("assertion failed: "+format, args...)) + } + c.addErrf(0, pos, format, args...) + } +} + +func init() { + log.SetFlags(log.Lshortfile) +} + +func Logf(format string, args ...interface{}) { + if Verbosity == 0 { + return + } + s := fmt.Sprintf(format, args...) + _ = log.Output(2, s) +} + +var pMap = map[*Vertex]int{} + +func (c *OpContext) Logf(v *Vertex, format string, args ...interface{}) { + if Verbosity == 0 { + return + } + if v == nil { + s := fmt.Sprintf(strings.Repeat("..", c.nest)+format, args...) + _ = log.Output(2, s) + return + } + p := pMap[v] + if p == 0 { + p = len(pMap) + 1 + pMap[v] = p + } + a := append([]interface{}{ + strings.Repeat("..", c.nest), + p, + v.Label.SelectorString(c), + v.Path(), + }, args...) + for i := 2; i < len(a); i++ { + switch x := a[i].(type) { + case Node: + a[i] = c.Str(x) + case Feature: + a[i] = x.SelectorString(c) + } + } + s := fmt.Sprintf("%s [%d] %s/%v"+format, a...) + _ = log.Output(2, s) +} + +// Runtime defines an interface for low-level representation conversion and +// lookup. +type Runtime interface { + // StringIndexer allows for converting string labels to and from a + // canonical numeric representation. + StringIndexer + + // LoadImport loads a unique Vertex associated with a given import path. It + // returns nil if no import for this package could be found. + LoadImport(importPath string) *Vertex + + // StoreType associates a CUE expression with a Go type. + StoreType(t reflect.Type, src ast.Expr, expr Expr) + + // LoadType retrieves a previously stored CUE expression for a given Go + // type if available. + LoadType(t reflect.Type) (src ast.Expr, expr Expr, ok bool) +} + +type Config struct { + Runtime + Format func(Node) string +} + +// New creates an operation context. +func New(v *Vertex, cfg *Config) *OpContext { + if cfg.Runtime == nil { + panic("nil Runtime") + } + ctx := &OpContext{ + Runtime: cfg.Runtime, + Format: cfg.Format, + vertex: v, + } + if v != nil { + ctx.e = &Environment{Up: nil, Vertex: v} + } + return ctx +} + +// An OpContext implements CUE's unification operation. It's operations only +// operation on values that are created with the Runtime with which an OpContext +// is associated. An OpContext is not goroutine save and only one goroutine may +// use an OpContext at a time. +// +type OpContext struct { + Runtime + Format func(Node) string + + nest int + + stats Stats + freeListNode *nodeContext + + e *Environment + src ast.Node + errs *Bottom + positions []Node // keep track of error positions + + // vertex is used to determine the path location in case of error. Turning + // this into a stack could also allow determining the cyclic path for + // structural cycle errors. + vertex *Vertex + + nonMonotonicLookupNest int32 + nonMonotonicRejectNest int32 + nonMonotonicInsertNest int32 + nonMonotonicGeneration int32 + + // These fields are used associate scratch fields for computing closedness + // of a Vertex. These fields could have been included in StructInfo (like + // Tomabechi's unification algorithm), but we opted for an indirection to + // allow concurrent unification. + // + // TODO(perf): have two generations: one for each pass of the closedness + // algorithm, so that the results of the first pass can be reused for all + // features of a node. + generation int + closed map[*closeInfo]*closeStats + todo *closeStats + + // inDisjunct indicates that non-monotonic checks should be skipped. + // This is used if we want to do some extra work to eliminate disjunctions + // early. The result of unificantion should be thrown away if this check is + // used. + // + // TODO: replace this with a mechanism to determine the correct set (per + // conjunct) of StructInfos to include in closedness checking. + inDisjunct int + + // inConstaint overrides inDisjunct as field matching should always be + // enabled. + inConstraint int +} + +func (n *nodeContext) skipNonMonotonicChecks() bool { + if n.ctx.inConstraint > 0 { + return false + } + return n.ctx.inDisjunct > 0 +} + +// Impl is for internal use only. This will go. +func (c *OpContext) Impl() Runtime { + return c.Runtime +} + +func (c *OpContext) Pos() token.Pos { + if c.src == nil { + return token.NoPos + } + return c.src.Pos() +} + +func (c *OpContext) Source() ast.Node { + return c.src +} + +// NewContext creates an operation context. +func NewContext(r Runtime, v *Vertex) *OpContext { + return New(v, &Config{Runtime: r}) +} + +func (c *OpContext) pos() token.Pos { + if c.src == nil { + return token.NoPos + } + return c.src.Pos() +} + +func (c *OpContext) spawn(node *Vertex) *Environment { + node.Parent = c.e.Vertex // TODO: Is this necessary? + return &Environment{ + Up: c.e, + Vertex: node, + + // Copy cycle data. + Cyclic: c.e.Cyclic, + Deref: c.e.Deref, + Cycles: c.e.Cycles, + } +} + +func (c *OpContext) Env(upCount int32) *Environment { + e := c.e + for ; upCount > 0; upCount-- { + e = e.Up + } + return e +} + +func (c *OpContext) relNode(upCount int32) *Vertex { + e := c.e + for ; upCount > 0; upCount-- { + e = e.Up + } + c.Unify(e.Vertex, Partial) + return e.Vertex +} + +func (c *OpContext) relLabel(upCount int32) Feature { + // locate current label. + e := c.e + for ; upCount > 0; upCount-- { + e = e.Up + } + return e.DynamicLabel +} + +func (c *OpContext) concreteIsPossible(op Op, x Expr) bool { + if !AssertConcreteIsPossible(op, x) { + // No need to take position of expression. + c.AddErr(c.NewPosf(token.NoPos, + "invalid operand %s ('%s' requires concrete value)", x, op)) + return false + } + return true +} + +// Assert that the given expression can evaluate to a concrete value. +func AssertConcreteIsPossible(op Op, x Expr) bool { + switch v := x.(type) { + case *Bottom: + case *BoundExpr: + return false + case Value: + return v.Concreteness() == Concrete + } + return true +} + +// HasErr reports whether any error was reported, including whether value +// was incomplete. +func (c *OpContext) HasErr() bool { + return c.errs != nil +} + +func (c *OpContext) Err() *Bottom { + b := c.errs + c.errs = nil + return b +} + +func (c *OpContext) addErrf(code ErrorCode, pos token.Pos, msg string, args ...interface{}) { + err := c.NewPosf(pos, msg, args...) + c.addErr(code, err) +} + +func (c *OpContext) addErr(code ErrorCode, err errors.Error) { + c.AddBottom(&Bottom{Code: code, Err: err}) +} + +// AddBottom records an error in OpContext. +func (c *OpContext) AddBottom(b *Bottom) { + c.errs = CombineErrors(c.src, c.errs, b) +} + +// AddErr records an error in OpContext. It returns errors collected so far. +func (c *OpContext) AddErr(err errors.Error) *Bottom { + if err != nil { + c.AddBottom(&Bottom{Err: err}) + } + return c.errs +} + +// NewErrf creates a *Bottom value and returns it. The returned uses the +// current source as the point of origin of the error. +func (c *OpContext) NewErrf(format string, args ...interface{}) *Bottom { + // TODO: consider renaming ot NewBottomf: this is now confusing as we also + // have Newf. + err := c.Newf(format, args...) + return &Bottom{Src: c.src, Err: err, Code: EvalError} +} + +// AddErrf records an error in OpContext. It returns errors collected so far. +func (c *OpContext) AddErrf(format string, args ...interface{}) *Bottom { + return c.AddErr(c.Newf(format, args...)) +} + +type frame struct { + env *Environment + err *Bottom + src ast.Node +} + +func (c *OpContext) PushState(env *Environment, src ast.Node) (saved frame) { + saved.env = c.e + saved.err = c.errs + saved.src = c.src + + c.errs = nil + if src != nil { + c.src = src + } + c.e = env + + return saved +} + +func (c *OpContext) PopState(s frame) *Bottom { + err := c.errs + c.e = s.env + c.errs = s.err + c.src = s.src + return err +} + +// PushArc signals c that arc v is currently being processed for the purpose +// of error reporting. PopArc should be called with the returned value once +// processing of v is completed. +func (c *OpContext) PushArc(v *Vertex) (saved *Vertex) { + c.vertex, saved = v, c.vertex + return saved +} + +// PopArc signals completion of processing the current arc. +func (c *OpContext) PopArc(saved *Vertex) { + c.vertex = saved +} + +// Resolve finds a node in the tree. +// +// Should only be used to insert Conjuncts. TODO: perhaps only return Conjuncts +// and error. +func (c *OpContext) Resolve(env *Environment, r Resolver) (*Vertex, *Bottom) { + s := c.PushState(env, r.Source()) + + arc := r.resolve(c, Partial) + + err := c.PopState(s) + if err != nil { + return nil, err + } + + if arc.ChildErrors != nil && arc.ChildErrors.Code == StructuralCycleError { + return nil, arc.ChildErrors + } + + arc = arc.Indirect() + + return arc, err +} + +// Validate calls validates value for the given validator. +// +// TODO(errors): return boolean instead: only the caller has enough information +// to generate a proper error message. +func (c *OpContext) Validate(check Validator, value Value) *Bottom { + // TODO: use a position stack to push both values. + saved := c.src + c.src = check.Source() + + err := check.validate(c, value) + + c.src = saved + + return err +} + +// Yield evaluates a Yielder and calls f for each result. +func (c *OpContext) Yield(env *Environment, comp *Comprehension, f YieldFunc) *Bottom { + y := comp.Clauses + + s := c.PushState(env, y.Source()) + + y.yield(c, f) + + return c.PopState(s) + +} + +// Concrete returns the concrete value of x after evaluating it. +// msg is used to mention the context in which an error occurred, if any. +func (c *OpContext) Concrete(env *Environment, x Expr, msg interface{}) (result Value, complete bool) { + + w, complete := c.Evaluate(env, x) + + w, ok := c.getDefault(w) + if !ok { + return w, false + } + v := Unwrap(w) + + if !IsConcrete(v) { + complete = false + b := c.NewErrf("non-concrete value %v in operand to %s", w, msg) + b.Code = IncompleteError + v = b + } + + if !complete { + return v, complete + } + + return v, true +} + +// getDefault resolves a disjunction to a single value. If there is no default +// value, or if there is more than one default value, it reports an "incomplete" +// error and return false. In all other cases it will return true, even if +// v is already an error. v may be nil, in which case it will also return nil. +func (c *OpContext) getDefault(v Value) (result Value, ok bool) { + var d *Disjunction + switch x := v.(type) { + default: + return v, true + + case *Vertex: + // TODO: return vertex if not disjunction. + switch t := x.BaseValue.(type) { + case *Disjunction: + d = t + + case *Vertex: + return c.getDefault(t) + + default: + return x, true + } + + case *Disjunction: + d = x + } + + if d.NumDefaults != 1 { + c.addErrf(IncompleteError, c.pos(), + "unresolved disjunction %s (type %s)", d, d.Kind()) + return nil, false + } + return c.getDefault(d.Values[0]) +} + +// Evaluate evaluates an expression within the given environment and indicates +// whether the result is complete. It will always return a non-nil result. +func (c *OpContext) Evaluate(env *Environment, x Expr) (result Value, complete bool) { + s := c.PushState(env, x.Source()) + + val := c.evalState(x, Partial) + + complete = true + + if err, _ := val.(*Bottom); err != nil && err.IsIncomplete() { + complete = false + } + if val == nil { + complete = false + // TODO ENSURE THIS DOESN"T HAPPEN> + val = &Bottom{ + Code: IncompleteError, + Err: c.Newf("UNANTICIPATED ERROR"), + } + + } + + _ = c.PopState(s) + + if !complete || val == nil { + return val, false + } + + return val, true +} + +func (c *OpContext) evaluateRec(env *Environment, x Expr, state VertexStatus) Value { + s := c.PushState(env, x.Source()) + + val := c.evalState(x, state) + if val == nil { + // Be defensive: this never happens, but just in case. + Assertf(false, "nil return value: unspecified error") + val = &Bottom{ + Code: IncompleteError, + Err: c.Newf("UNANTICIPATED ERROR"), + } + } + _ = c.PopState(s) + + return val +} + +// value evaluates expression v within the current environment. The result may +// be nil if the result is incomplete. value leaves errors untouched to that +// they can be collected by the caller. +func (c *OpContext) value(x Expr) (result Value) { + v := c.evalState(x, Partial) + + v, _ = c.getDefault(v) + v = Unwrap(v) + return v +} + +func (c *OpContext) evalState(v Expr, state VertexStatus) (result Value) { + savedSrc := c.src + c.src = v.Source() + err := c.errs + c.errs = nil + + defer func() { + c.errs = CombineErrors(c.src, c.errs, err) + + if v, ok := result.(*Vertex); ok { + if b, _ := v.BaseValue.(*Bottom); b != nil { + switch b.Code { + case IncompleteError: + case CycleError: + if state == Partial { + break + } + fallthrough + default: + result = b + } + } + } + + // TODO: remove this when we handle errors more principally. + if b, ok := result.(*Bottom); ok { + if c.src != nil && + b.Code == CycleError && + len(errors.Positions(b.Err)) == 0 { + bb := *b + bb.Err = errors.Wrapf(b.Err, c.src.Pos(), "") + result = &bb + } + if c.errs != result { + c.errs = CombineErrors(c.src, c.errs, result) + } + } + if c.errs != nil { + result = c.errs + } + c.src = savedSrc + }() + + switch x := v.(type) { + case Value: + return x + + case Evaluator: + v := x.evaluate(c) + return v + + case Resolver: + arc := x.resolve(c, state) + if c.HasErr() { + return nil + } + if arc == nil { + return nil + } + + v := c.evaluate(arc, state) + return v + + default: + // This can only happen, really, if v == nil, which is not allowed. + panic(fmt.Sprintf("unexpected Expr type %T", v)) + } +} + +// unifyNode returns a possibly partially evaluated node value. +// +// TODO: maybe return *Vertex, *Bottom +// +func (c *OpContext) unifyNode(v Expr, state VertexStatus) (result Value) { + savedSrc := c.src + c.src = v.Source() + err := c.errs + c.errs = nil + + defer func() { + c.errs = CombineErrors(c.src, c.errs, err) + + if v, ok := result.(*Vertex); ok { + if b, _ := v.BaseValue.(*Bottom); b != nil { + switch b.Code { + case IncompleteError: + case CycleError: + if state == Partial { + break + } + fallthrough + default: + result = b + } + } + } + + // TODO: remove this when we handle errors more principally. + if b, ok := result.(*Bottom); ok { + if c.src != nil && + b.Code == CycleError && + b.Err.Position() == token.NoPos && + len(b.Err.InputPositions()) == 0 { + bb := *b + bb.Err = errors.Wrapf(b.Err, c.src.Pos(), "") + result = &bb + } + c.errs = CombineErrors(c.src, c.errs, result) + } + if c.errs != nil { + result = c.errs + } + c.src = savedSrc + }() + + switch x := v.(type) { + case Value: + return x + + case Evaluator: + v := x.evaluate(c) + return v + + case Resolver: + v := x.resolve(c, state) + if c.HasErr() { + return nil + } + if v == nil { + return nil + } + + if v.isUndefined() || state > v.status { + // Keep a minimum state of AllArcs. + // TODO: AllArcs may still not be achieved if a node is currently + // evaluating. + state := state + if state < AllArcs { + state = AllArcs + } + // Use node itself to allow for cycle detection. + c.Unify(v, state) + } + + return v + + default: + // This can only happen, really, if v == nil, which is not allowed. + panic(fmt.Sprintf("unexpected Expr type %T", v)) + } +} + +func (c *OpContext) lookup(x *Vertex, pos token.Pos, l Feature, state VertexStatus) *Vertex { + if l == InvalidLabel || x == nil { + // TODO: is it possible to have an invalid label here? Maybe through the + // API? + return &Vertex{} + } + + // var kind Kind + // if x.BaseValue != nil { + // kind = x.BaseValue.Kind() + // } + + switch x.BaseValue.(type) { + case *StructMarker: + if l.Typ() == IntLabel { + c.addErrf(0, pos, "invalid struct selector %s (type int)", l) + return nil + } + + case *ListMarker: + switch { + case l.Typ() == IntLabel: + switch { + case l.Index() < 0: + c.addErrf(0, pos, "invalid list index %s (index must be non-negative)", l) + return nil + case l.Index() > len(x.Arcs): + c.addErrf(0, pos, "invalid list index %s (out of bounds)", l) + return nil + } + + case l.IsDef(), l.IsHidden(): + + default: + c.addErrf(0, pos, "invalid list index %s (type string)", l) + return nil + } + + case nil: + // c.addErrf(IncompleteError, pos, "incomplete value %s", x) + // return nil + + case *Bottom: + + default: + kind := x.BaseValue.Kind() + if kind&(ListKind|StructKind) != 0 { + // c.addErrf(IncompleteError, pos, + // "cannot look up %s in incomplete type %s (type %s)", + // l, x.Source(), kind) + // return nil + } else if !l.IsDef() && !l.IsHidden() { + c.addErrf(0, pos, + "invalid selector %s for value of type %s", l, kind) + return nil + } + } + + a := x.Lookup(l) + if a != nil { + a = a.Indirect() + } + + var hasCycle bool +outer: + switch { + case c.nonMonotonicLookupNest == 0 && c.nonMonotonicRejectNest == 0: + case a != nil: + if state == Partial { + a.nonMonotonicLookupGen = c.nonMonotonicGeneration + } + + case x.state != nil && state == Partial: + for _, e := range x.state.exprs { + if isCyclePlaceholder(e.err) { + hasCycle = true + } + } + for _, a := range x.state.usedArcs { + if a.Label == l { + a.nonMonotonicLookupGen = c.nonMonotonicGeneration + if c.nonMonotonicRejectNest > 0 { + a.nonMonotonicReject = true + } + break outer + } + } + a := &Vertex{Label: l, nonMonotonicLookupGen: c.nonMonotonicGeneration} + if c.nonMonotonicRejectNest > 0 { + a.nonMonotonicReject = true + } + x.state.usedArcs = append(x.state.usedArcs, a) + } + + if a != nil && state > a.status { + c.Unify(a, state) + } + + if a == nil { + if x.state != nil { + for _, e := range x.state.exprs { + if isCyclePlaceholder(e.err) { + hasCycle = true + } + } + } + code := IncompleteError + if !x.Accept(c, l) { + code = 0 + } else if hasCycle { + code = CycleError + } + // TODO: if the struct was a literal struct, we can also treat it as + // closed and make this a permanent error. + label := l.SelectorString(c.Runtime) + + // TODO(errors): add path reference and make message + // "undefined field %s in %s" + if l.IsInt() { + c.addErrf(code, pos, "index out of range [%d] with length %d", + l.Index(), len(x.Elems())) + } else { + if code != 0 && x.IsOptional(l) { + c.addErrf(code, pos, + "cannot reference optional field: %s", label) + } else { + c.addErrf(code, pos, "undefined field: %s", label) + } + } + } + return a +} + +func (c *OpContext) Label(src Expr, x Value) Feature { + return labelFromValue(c, src, x) +} + +func (c *OpContext) typeError(v Value, k Kind) { + if isError(v) { + return + } + if !IsConcrete(v) && v.Kind()&k != 0 { + c.addErrf(IncompleteError, pos(v), "incomplete %s: %s", k, v) + } else { + c.AddErrf("cannot use %s (type %s) as type %s", v, v.Kind(), k) + } +} + +func (c *OpContext) typeErrorAs(v Value, k Kind, as interface{}) { + if as == nil { + c.typeError(v, k) + return + } + if isError(v) { + return + } + if !IsConcrete(v) && v.Kind()&k != 0 { + c.addErrf(IncompleteError, pos(v), + "incomplete %s in %v: %s", k, as, v) + } else { + c.AddErrf("cannot use %s (type %s) as type %s in %v", v, v.Kind(), k, as) + } +} + +var emptyNode = &Vertex{} + +func pos(x Node) token.Pos { + if x.Source() == nil { + return token.NoPos + } + return x.Source().Pos() +} + +func (c *OpContext) node(orig Node, x Expr, scalar bool, state VertexStatus) *Vertex { + // TODO: always get the vertex. This allows a whole bunch of trickery + // down the line. + v := c.unifyNode(x, state) + + v, ok := c.getDefault(v) + if !ok { + // Error already generated by getDefault. + return emptyNode + } + + // The two if blocks below are rather subtle. If we have an error of + // the sentinel value cycle, we have earlier determined that the cycle is + // allowed and that it can be ignored here. Any other CycleError is an + // annotated cycle error that could be taken as is. + // TODO: do something simpler. + if scalar { + if w := Unwrap(v); !isCyclePlaceholder(w) { + v = w + } + } + + node, ok := v.(*Vertex) + if ok && !isCyclePlaceholder(node.BaseValue) { + v = node.Value() + } + + switch nv := v.(type) { + case nil: + switch orig.(type) { + case *ForClause: + c.addErrf(IncompleteError, pos(x), + "cannot range over %s (incomplete)", x) + default: + c.addErrf(IncompleteError, pos(x), + "%s undefined (%s is incomplete)", orig, x) + } + return emptyNode + + case *Bottom: + // TODO: this is a bit messy. In some cases errors are already added + // and in some cases not. Not a huge deal, as errors will be uniqued + // down the line, but could be better. + c.AddBottom(nv) + return emptyNode + + case *Vertex: + if node == nil { + panic("unexpected markers with nil node") + } + + default: + if kind := v.Kind(); kind&StructKind != 0 { + switch orig.(type) { + case *ForClause: + c.addErrf(IncompleteError, pos(x), + "cannot range over %s (incomplete type %s)", x, kind) + default: + c.addErrf(IncompleteError, pos(x), + "%s undefined as %s is incomplete (type %s)", orig, x, kind) + } + return emptyNode + + } else if !ok { + c.addErrf(0, pos(x), // TODO(error): better message. + "invalid operand %s (found %s, want list or struct)", + x.Source(), v.Kind()) + return emptyNode + } + } + + return node +} + +// Elems returns the elements of a list. +func (c *OpContext) Elems(v Value) []*Vertex { + list := c.list(v) + return list.Elems() +} + +func (c *OpContext) list(v Value) *Vertex { + x, ok := v.(*Vertex) + if !ok || !x.IsList() { + c.typeError(v, ListKind) + return emptyNode + } + return x +} + +func (c *OpContext) scalar(v Value) Value { + v = Unwrap(v) + switch v.(type) { + case *Null, *Bool, *Num, *String, *Bytes: + default: + c.typeError(v, ScalarKinds) + } + return v +} + +var zero = &Num{K: NumKind} + +func (c *OpContext) Num(v Value, as interface{}) *Num { + v = Unwrap(v) + if isError(v) { + return zero + } + x, ok := v.(*Num) + if !ok { + c.typeErrorAs(v, NumKind, as) + return zero + } + return x +} + +func (c *OpContext) Int64(v Value) int64 { + v = Unwrap(v) + if isError(v) { + return 0 + } + x, ok := v.(*Num) + if !ok { + c.typeError(v, IntKind) + return 0 + } + i, err := x.X.Int64() + if err != nil { + c.AddErrf("number is not an int64: %v", err) + return 0 + } + return i +} + +func (c *OpContext) uint64(v Value, as string) uint64 { + v = Unwrap(v) + if isError(v) { + return 0 + } + x, ok := v.(*Num) + if !ok { + c.typeErrorAs(v, IntKind, as) + return 0 + } + if x.X.Negative { + // TODO: improve message + c.AddErrf("cannot convert negative number to uint64") + return 0 + } + if !x.X.Coeff.IsUint64() { + // TODO: improve message + c.AddErrf("cannot convert number %s to uint64", x.X) + return 0 + } + return x.X.Coeff.Uint64() +} + +func (c *OpContext) BoolValue(v Value) bool { + return c.boolValue(v, nil) +} + +func (c *OpContext) boolValue(v Value, as interface{}) bool { + v = Unwrap(v) + if isError(v) { + return false + } + x, ok := v.(*Bool) + if !ok { + c.typeErrorAs(v, BoolKind, as) + return false + } + return x.B +} + +func (c *OpContext) StringValue(v Value) string { + return c.stringValue(v, nil) +} + +// ToBytes returns the bytes value of a scalar value. +func (c *OpContext) ToBytes(v Value) []byte { + if x, ok := v.(*Bytes); ok { + return x.B + } + return []byte(c.ToString(v)) +} + +// ToString returns the string value of a scalar value. +func (c *OpContext) ToString(v Value) string { + return c.toStringValue(v, StringKind|NumKind|BytesKind|BoolKind, nil) + +} + +func (c *OpContext) stringValue(v Value, as interface{}) string { + return c.toStringValue(v, StringKind, as) +} + +func (c *OpContext) toStringValue(v Value, k Kind, as interface{}) string { + v = Unwrap(v) + if isError(v) { + return "" + } + if v.Kind()&k == 0 { + if as == nil { + c.typeError(v, k) + } else { + c.typeErrorAs(v, k, as) + } + return "" + } + switch x := v.(type) { + case *String: + return x.Str + + case *Bytes: + return bytesToString(x.B) + + case *Num: + return x.X.String() + + case *Bool: + if x.B { + return "true" + } + return "false" + + default: + c.addErrf(IncompleteError, c.pos(), + "non-concrete value %s (type %s)", v, v.Kind()) + } + return "" +} + +func bytesToString(b []byte) string { + b, _ = unicode.UTF8.NewDecoder().Bytes(b) + return string(b) +} + +func (c *OpContext) bytesValue(v Value, as interface{}) []byte { + v = Unwrap(v) + if isError(v) { + return nil + } + x, ok := v.(*Bytes) + if !ok { + c.typeErrorAs(v, BytesKind, as) + return nil + } + return x.B +} + +var matchNone = regexp.MustCompile("^$") + +func (c *OpContext) regexp(v Value) *regexp.Regexp { + v = Unwrap(v) + if isError(v) { + return matchNone + } + switch x := v.(type) { + case *String: + if x.RE != nil { + return x.RE + } + // TODO: synchronization + p, err := regexp.Compile(x.Str) + if err != nil { + // FatalError? How to cache error + c.AddErrf("invalid regexp: %s", err) + x.RE = matchNone + } else { + x.RE = p + } + return x.RE + + case *Bytes: + if x.RE != nil { + return x.RE + } + // TODO: synchronization + p, err := regexp.Compile(string(x.B)) + if err != nil { + c.AddErrf("invalid regexp: %s", err) + x.RE = matchNone + } else { + x.RE = p + } + return x.RE + + default: + c.typeError(v, StringKind|BytesKind) + return matchNone + } +} + +// newNum creates a new number of the given kind. It reports an error value +// instead if any error occurred. +func (c *OpContext) newNum(d *apd.Decimal, k Kind, sources ...Node) Value { + if c.HasErr() { + return c.Err() + } + return &Num{Src: c.src, X: *d, K: k} +} + +func (c *OpContext) NewInt64(n int64, sources ...Node) Value { + if c.HasErr() { + return c.Err() + } + d := apd.New(n, 0) + return &Num{Src: c.src, X: *d, K: IntKind} +} + +func (c *OpContext) NewString(s string) Value { + if c.HasErr() { + return c.Err() + } + return &String{Src: c.src, Str: s} +} + +func (c *OpContext) newBytes(b []byte) Value { + if c.HasErr() { + return c.Err() + } + return &Bytes{Src: c.src, B: b} +} + +func (c *OpContext) newBool(b bool) Value { + if c.HasErr() { + return c.Err() + } + return &Bool{Src: c.src, B: b} +} + +func (c *OpContext) newList(src ast.Node, parent *Vertex) *Vertex { + return &Vertex{Parent: parent, BaseValue: &ListMarker{}} +} + +// Str reports a debug string of x. +func (c *OpContext) Str(x Node) string { + if c.Format == nil { + return fmt.Sprintf("%T", x) + } + return c.Format(x) +} + +// NewList returns a new list for the given values. +func (c *OpContext) NewList(values ...Value) *Vertex { + // TODO: consider making this a literal list instead. + list := &ListLit{} + v := &Vertex{ + Conjuncts: []Conjunct{{Env: nil, x: list}}, + } + + for _, x := range values { + list.Elems = append(list.Elems, x) + } + c.Unify(v, Finalized) + return v +} diff --git a/vendor/cuelang.org/go/internal/core/adt/decimal.go b/vendor/cuelang.org/go/internal/core/adt/decimal.go new file mode 100644 index 0000000000..e7eba38566 --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/decimal.go @@ -0,0 +1,131 @@ +// Copyright 2020 CUE Authors +// +// 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 adt + +import ( + "math/big" + + "github.com/cockroachdb/apd/v2" +) + +var apdCtx apd.Context + +func init() { + apdCtx = apd.BaseContext + apdCtx.Precision = 24 +} + +func (n *Num) Impl() *apd.Decimal { + return &n.X +} + +func (n *Num) Negative() bool { + return n.X.Negative +} + +func (a *Num) Cmp(b *Num) int { + return a.X.Cmp(&b.X) +} + +func (c *OpContext) Add(a, b *Num) Value { + return numOp(c, apdCtx.Add, a, b) +} + +func (c *OpContext) Sub(a, b *Num) Value { + return numOp(c, apdCtx.Sub, a, b) +} + +func (c *OpContext) Mul(a, b *Num) Value { + return numOp(c, apdCtx.Mul, a, b) +} + +func (c *OpContext) Quo(a, b *Num) Value { + v := numOp(c, apdCtx.Quo, a, b) + if n, ok := v.(*Num); ok { + n.K = FloatKind + } + return v +} + +func (c *OpContext) Pow(a, b *Num) Value { + return numOp(c, apdCtx.Pow, a, b) +} + +type numFunc func(z, x, y *apd.Decimal) (apd.Condition, error) + +func numOp(c *OpContext, fn numFunc, x, y *Num) Value { + var d apd.Decimal + + cond, err := fn(&d, &x.X, &y.X) + + if err != nil { + return c.NewErrf("failed arithmetic: %v", err) + } + + if cond.DivisionByZero() { + return c.NewErrf("division by zero") + } + + k := x.Kind() & y.Kind() + if k == 0 { + k = FloatKind + } + return c.newNum(&d, k) +} + +func (c *OpContext) IntDiv(a, b *Num) Value { + return intDivOp(c, (*big.Int).Div, a, b) +} + +func (c *OpContext) IntMod(a, b *Num) Value { + return intDivOp(c, (*big.Int).Mod, a, b) +} + +func (c *OpContext) IntQuo(a, b *Num) Value { + return intDivOp(c, (*big.Int).Quo, a, b) +} + +func (c *OpContext) IntRem(a, b *Num) Value { + return intDivOp(c, (*big.Int).Rem, a, b) +} + +type intFunc func(z, x, y *big.Int) *big.Int + +func intDivOp(c *OpContext, fn intFunc, a, b *Num) Value { + if b.X.IsZero() { + return c.NewErrf("division by zero") + } + + var x, y apd.Decimal + _, _ = apdCtx.RoundToIntegralValue(&x, &a.X) + if x.Negative { + x.Coeff.Neg(&x.Coeff) + } + _, _ = apdCtx.RoundToIntegralValue(&y, &b.X) + if y.Negative { + y.Coeff.Neg(&y.Coeff) + } + + var d apd.Decimal + + fn(&d.Coeff, &x.Coeff, &y.Coeff) + + if d.Coeff.Sign() < 0 { + d.Coeff.Neg(&d.Coeff) + d.Negative = true + } + + return c.newNum(&d, IntKind) +} diff --git a/vendor/cuelang.org/go/internal/core/adt/default.go b/vendor/cuelang.org/go/internal/core/adt/default.go new file mode 100644 index 0000000000..6e6f1b19f4 --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/default.go @@ -0,0 +1,132 @@ +// Copyright 2020 CUE Authors +// +// 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 adt + +// Default returns the default value or itself if there is no default. +func Default(v Value) Value { + switch x := v.(type) { + case *Vertex: + return x.Default() + case *Disjunction: + return x.Default() + default: + return v + } +} + +func (d *Disjunction) Default() Value { + switch d.NumDefaults { + case 0: + return d + case 1: + return d.Values[0] + default: + return &Disjunction{ + Src: d.Src, + Values: d.Values[:d.NumDefaults], + NumDefaults: 0, + } + } +} + +// Default returns the default value or itself if there is no default. +// +// It also closes a list, representing its default value. +func (v *Vertex) Default() *Vertex { + switch d := v.BaseValue.(type) { + default: + return v + + case *Disjunction: + var w *Vertex + + switch d.NumDefaults { + case 0: + return v + case 1: + w = d.Values[0].Default() + default: + x := *v + x.state = nil + x.BaseValue = &Disjunction{ + Src: d.Src, + Values: d.Values[:d.NumDefaults], + NumDefaults: 0, + } + w = &x + w.Conjuncts = nil + } + + if w.Conjuncts == nil { + for _, c := range v.Conjuncts { + // TODO: preserve field information. + expr, _ := stripNonDefaults(c.Elem()) + w.Conjuncts = append(w.Conjuncts, MakeRootConjunct(c.Env, expr)) + } + } + return w + + case *ListMarker: + m := *d + m.IsOpen = false + + w := *v + w.BaseValue = &m + w.state = nil + return &w + } +} + +// TODO: this should go: record preexpanded disjunctions in Vertex. +func stripNonDefaults(elem Elem) (r Elem, stripped bool) { + expr, ok := elem.(Expr) + if !ok { + return elem, false + } + switch x := expr.(type) { + case *DisjunctionExpr: + if !x.HasDefaults { + return x, false + } + d := *x + d.Values = []Disjunct{} + for _, v := range x.Values { + if v.Default { + d.Values = append(d.Values, v) + } + } + if len(d.Values) == 1 { + return d.Values[0].Val, true + } + return &d, true + + case *BinaryExpr: + if x.Op != AndOp { + return x, false + } + a, sa := stripNonDefaults(x.X) + b, sb := stripNonDefaults(x.Y) + if sa || sb { + bin := *x + bin.X = a.(Expr) + bin.Y = b.(Expr) + return &bin, true + } + return x, false + + default: + return x, false + } +} diff --git a/vendor/cuelang.org/go/internal/core/adt/disjunct.go b/vendor/cuelang.org/go/internal/core/adt/disjunct.go new file mode 100644 index 0000000000..8f2074a40a --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/disjunct.go @@ -0,0 +1,588 @@ +// Copyright 2020 CUE Authors +// +// 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 adt + +import ( + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/token" +) + +// Nodes man not reenter a disjunction. +// +// Copy one layer deep; throw away items on failure. + +// DISJUNCTION ALGORITHM +// +// The basic concept of the algorithm is to use backtracking to find valid +// disjunctions. The algorithm can stop if two matching disjuncts are found +// where one does not subsume the other. +// +// At a later point, we can introduce a filter step to filter out possible +// disjuncts based on, say, discriminator fields or field exclusivity (oneOf +// fields in Protobuf). +// +// To understand the details of the algorithm, it is important to understand +// some properties of disjunction. +// +// +// EVALUATION OF A DISJUNCTION IS SELF CONTAINED +// +// In other words, fields outside of a disjunction cannot bind to values within +// a disjunction whilst evaluating that disjunction. This allows the computation +// of disjunctions to be isolated from side effects. +// +// The intuition behind this is as follows: as a disjunction is not a concrete +// value, it is not possible to lookup a field within a disjunction if it has +// not yet been evaluated. So if a reference within a disjunction that is needed +// to disambiguate that disjunction refers to a field outside the scope of the +// disjunction which, in turn, refers to a field within the disjunction, this +// results in a cycle error. We achieve this by not removing the cycle marker of +// the Vertex of the disjunction until the disjunction is resolved. +// +// Note that the following disjunct is still allowed: +// +// a: 1 +// b: a +// +// Even though `a` refers to the root of the disjunction, it does not _select +// into_ the disjunction. Implementation-wise, it also doesn't have to, as the +// respective vertex is available within the Environment. Referencing a node +// outside the disjunction that in turn selects the disjunction root, however, +// will result in a detected cycle. +// +// As usual, cycle detection should be interpreted marked as incomplete, so that +// the referring node will not be fixed to an error prematurely. +// +// +// SUBSUMPTION OF AMBIGUOUS DISJUNCTS +// +// A disjunction can be evaluated to a concrete value if only one disjunct +// remains. Aside from disambiguating through unification failure, disjuncts +// may also be disambiguated by taking the least specific of two disjuncts. +// For instance, if a subsumes b, then the result of disjunction may be a. +// +// NEW ALGORITHM NO LONGER VERIFIES SUBSUMPTION. SUBSUMPTION IS INHERENTLY +// IMPRECISE (DUE TO BULK OPTIONAL FIELDS). OTHER THAN THAT, FOR SCALAR VALUES +// IT JUST MEANS THERE IS AMBIGUITY, AND FOR STRUCTS IT CAN LEAD TO STRANGE +// CONSEQUENCES. +// +// USE EQUALITY INSTEAD: +// - Undefined == error for optional fields. +// - So only need to check exact labels for vertices. + +type envDisjunct struct { + env *Environment + cloneID CloseInfo + expr *DisjunctionExpr + value *Disjunction + hasDefaults bool + + // These are used for book keeping, tracking whether any of the + // disjuncts marked with a default marker remains after unification. + // If no default is used, all other elements are treated as "maybeDefault". + // Otherwise, elements are treated as is. + parentDefaultUsed bool + childDefaultUsed bool +} + +func (n *nodeContext) addDisjunction(env *Environment, x *DisjunctionExpr, cloneID CloseInfo) { + + // TODO: precompute + numDefaults := 0 + for _, v := range x.Values { + isDef := v.Default // || n.hasDefaults(env, v.Val) + if isDef { + numDefaults++ + } + } + + n.disjunctions = append(n.disjunctions, + envDisjunct{env, cloneID, x, nil, numDefaults > 0, false, false}) +} + +func (n *nodeContext) addDisjunctionValue(env *Environment, x *Disjunction, cloneID CloseInfo) { + n.disjunctions = append(n.disjunctions, + envDisjunct{env, cloneID, nil, x, x.HasDefaults, false, false}) + +} + +func (n *nodeContext) expandDisjuncts( + state VertexStatus, + parent *nodeContext, + parentMode defaultMode, // default mode of this disjunct + recursive, last bool) { + + n.ctx.stats.DisjunctCount++ + + node := n.node + defer func() { + n.node = node + }() + + for n.expandOne() { + } + + // save node to snapShot in nodeContex + // save nodeContext. + + if recursive || len(n.disjunctions) > 0 { + n.snapshot = clone(*n.node) + } else { + n.snapshot = *n.node + } + + defaultOffset := len(n.usedDefault) + + switch { + default: // len(n.disjunctions) == 0 + m := *n + n.postDisjunct(state) + + switch { + case n.hasErr(): + // TODO: consider finalizing the node thusly: + // if recursive { + // n.node.Finalize(n.ctx) + // } + x := n.node + err, ok := x.BaseValue.(*Bottom) + if !ok { + err = n.getErr() + } + if err == nil { + // TODO(disjuncts): Is this always correct? Especially for partial + // evaluation it is okay for child errors to have incomplete errors. + // Perhaps introduce an Err() method. + err = x.ChildErrors + } + if err.IsIncomplete() { + break + } + if err != nil { + parent.disjunctErrs = append(parent.disjunctErrs, err) + } + if recursive { + n.free() + } + return + } + + if recursive { + *n = m + n.result = *n.node // XXX: n.result = snapshotVertex(n.node)? + n.node = &n.result + n.disjuncts = append(n.disjuncts, n) + } + if n.node.BaseValue == nil { + n.node.BaseValue = n.getValidators() + } + + n.usedDefault = append(n.usedDefault, defaultInfo{ + parentMode: parentMode, + nestedMode: parentMode, + origMode: parentMode, + }) + + case len(n.disjunctions) > 0: + // Process full disjuncts to ensure that erroneous disjuncts are + // eliminated as early as possible. + state = Finalized + + n.disjuncts = append(n.disjuncts, n) + + n.refCount++ + defer n.free() + + for i, d := range n.disjunctions { + a := n.disjuncts + n.disjuncts = n.buffer[:0] + n.buffer = a[:0] + + last := i+1 == len(n.disjunctions) + skipNonMonotonicChecks := i+1 < len(n.disjunctions) + if skipNonMonotonicChecks { + n.ctx.inDisjunct++ + } + + for _, dn := range a { + switch { + case d.expr != nil: + for _, v := range d.expr.Values { + cn := dn.clone() + *cn.node = clone(dn.snapshot) + cn.node.state = cn + + c := MakeConjunct(d.env, v.Val, d.cloneID) + cn.addExprConjunct(c) + + newMode := mode(d.hasDefaults, v.Default) + + cn.expandDisjuncts(state, n, newMode, true, last) + } + + case d.value != nil: + for i, v := range d.value.Values { + cn := dn.clone() + *cn.node = clone(dn.snapshot) + cn.node.state = cn + + cn.addValueConjunct(d.env, v, d.cloneID) + + newMode := mode(d.hasDefaults, i < d.value.NumDefaults) + + cn.expandDisjuncts(state, n, newMode, true, last) + } + } + } + + if skipNonMonotonicChecks { + n.ctx.inDisjunct-- + } + + if len(n.disjuncts) == 0 { + n.makeError() + } + + if recursive || i > 0 { + for _, x := range a { + x.free() + } + } + + if len(n.disjuncts) == 0 { + break + } + } + + // Annotate disjunctions with whether any of the default disjunctions + // was used. + for _, d := range n.disjuncts { + for i, info := range d.usedDefault[defaultOffset:] { + if info.parentMode == isDefault { + n.disjunctions[i].parentDefaultUsed = true + } + if info.origMode == isDefault { + n.disjunctions[i].childDefaultUsed = true + } + } + } + + // Combine parent and child default markers, considering that a parent + // "notDefault" is treated as "maybeDefault" if none of the disjuncts + // marked as default remain. + // + // NOTE for a parent marked as "notDefault", a child is *never* + // considered as default. It may either be "not" or "maybe" default. + // + // The result for each disjunction is conjoined into a single value. + for _, d := range n.disjuncts { + m := maybeDefault + orig := maybeDefault + for i, info := range d.usedDefault[defaultOffset:] { + parent := info.parentMode + + used := n.disjunctions[i].parentDefaultUsed + childUsed := n.disjunctions[i].childDefaultUsed + hasDefaults := n.disjunctions[i].hasDefaults + + orig = combineDefault(orig, info.parentMode) + orig = combineDefault(orig, info.nestedMode) + + switch { + case childUsed: + // One of the children used a default. This is "normal" + // mode. This may also happen when we are in + // hasDefaults/notUsed mode. Consider + // + // ("a" | "b") & (*(*"a" | string) | string) + // + // Here the doubly nested default is called twice, once + // for "a" and then for "b", where the second resolves to + // not using a default. The first does, however, and on that + // basis the "ot default marker cannot be overridden. + m = combineDefault(m, info.parentMode) + m = combineDefault(m, info.origMode) + + case !hasDefaults, used: + m = combineDefault(m, info.parentMode) + m = combineDefault(m, info.nestedMode) + + case hasDefaults && !used: + Assertf(parent == notDefault, "unexpected default mode") + } + } + d.defaultMode = m + + d.usedDefault = d.usedDefault[:defaultOffset] + d.usedDefault = append(d.usedDefault, defaultInfo{ + parentMode: parentMode, + nestedMode: m, + origMode: orig, + }) + + } + + // TODO: this is an old trick that seems no longer necessary for the new + // implementation. Keep around until we finalize the semantics for + // defaults, though. The recursion of nested defaults is not entirely + // proper yet. + // + // A better approach, that avoids the need for recursion (semantically), + // would be to only consider default usage for one level, but then to + // also allow a default to be passed if only one value is remaining. + // This means that a nested subsumption would first have to be evaluated + // in isolation, however, to determine that it is not previous + // disjunctions that cause the disambiguation. + // + // HACK alert: this replaces the hack of the previous algorithm with a + // slightly less worse hack: instead of dropping the default info when + // the value was scalar before, we drop this information when there is + // only one disjunct, while not discarding hard defaults. TODO: a more + // principled approach would be to recognize that there is only one + // default at a point where this does not break commutativity. if + // if len(n.disjuncts) == 1 && n.disjuncts[0].defaultMode != isDefault { + // n.disjuncts[0].defaultMode = maybeDefault + // } + } + + // Compare to root, but add to this one. + switch p := parent; { + case p != n: + p.disjunctErrs = append(p.disjunctErrs, n.disjunctErrs...) + n.disjunctErrs = n.disjunctErrs[:0] + + outer: + for _, d := range n.disjuncts { + for k, v := range p.disjuncts { + if !d.done() || !v.done() { + break + } + flags := CheckStructural + if last { + flags |= IgnoreOptional + } + if Equal(n.ctx, &v.result, &d.result, flags) { + m := maybeDefault + for _, u := range d.usedDefault { + m = combineDefault(m, u.nestedMode) + } + if m == isDefault { + p.disjuncts[k] = d + v.free() + } else { + d.free() + } + continue outer + } + } + + p.disjuncts = append(p.disjuncts, d) + } + + n.disjuncts = n.disjuncts[:0] + } +} + +func (n *nodeContext) makeError() { + code := IncompleteError + + if len(n.disjunctErrs) > 0 { + code = EvalError + for _, c := range n.disjunctErrs { + if c.Code > code { + code = c.Code + } + } + } + + b := &Bottom{ + Code: code, + Err: n.disjunctError(), + } + n.node.SetValue(n.ctx, Finalized, b) +} + +func mode(hasDefault, marked bool) defaultMode { + var mode defaultMode + switch { + case !hasDefault: + mode = maybeDefault + case marked: + mode = isDefault + default: + mode = notDefault + } + return mode +} + +// clone makes a shallow copy of a Vertex. The purpose is to create different +// disjuncts from the same Vertex under computation. This allows the conjuncts +// of an arc to be reset to a previous position and the reuse of earlier +// computations. +// +// Notes: only Arcs need to be copied recursively. Either the arc is finalized +// and can be used as is, or Structs is assumed to not yet be computed at the +// time that a clone is needed and must be nil. Conjuncts no longer needed and +// can become nil. All other fields can be copied shallowly. +func clone(v Vertex) Vertex { + v.state = nil + if a := v.Arcs; len(a) > 0 { + v.Arcs = make([]*Vertex, len(a)) + for i, arc := range a { + switch arc.status { + case Finalized: + v.Arcs[i] = arc + + case 0: + a := *arc + v.Arcs[i] = &a + + a.Conjuncts = make([]Conjunct, len(arc.Conjuncts)) + copy(a.Conjuncts, arc.Conjuncts) + + default: + a := *arc + a.state = arc.state.clone() + a.state.node = &a + a.state.snapshot = clone(a) + v.Arcs[i] = &a + } + } + } + + if a := v.Structs; len(a) > 0 { + v.Structs = make([]*StructInfo, len(a)) + copy(v.Structs, a) + } + + return v +} + +// Default rules from spec: +// +// U1: (v1, d1) & v2 => (v1&v2, d1&v2) +// U2: (v1, d1) & (v2, d2) => (v1&v2, d1&d2) +// +// D1: (v1, d1) | v2 => (v1|v2, d1) +// D2: (v1, d1) | (v2, d2) => (v1|v2, d1|d2) +// +// M1: *v => (v, v) +// M2: *(v1, d1) => (v1, d1) +// +// NOTE: M2 cannot be *(v1, d1) => (v1, v1), as this has the weird property +// of making a value less specific. This causes issues, for instance, when +// trimming. +// +// The old implementation does something similar though. It will discard +// default information after first determining if more than one conjunct +// has survived. +// +// def + maybe -> def +// not + maybe -> def +// not + def -> def + +type defaultMode int + +const ( + maybeDefault defaultMode = iota + isDefault + notDefault +) + +// combineDefaults combines default modes for unifying conjuncts. +// +// Default rules from spec: +// +// U1: (v1, d1) & v2 => (v1&v2, d1&v2) +// U2: (v1, d1) & (v2, d2) => (v1&v2, d1&d2) +func combineDefault(a, b defaultMode) defaultMode { + if a > b { + return a + } + return b +} + +// disjunctError returns a compound error for a failed disjunction. +// +// TODO(perf): the set of errors is now computed during evaluation. Eventually, +// this could be done lazily. +func (n *nodeContext) disjunctError() (errs errors.Error) { + ctx := n.ctx + + disjuncts := selectErrors(n.disjunctErrs) + + if disjuncts == nil { + errs = ctx.Newf("empty disjunction") // XXX: add space to sort first + } else { + disjuncts = errors.Sanitize(disjuncts) + k := len(errors.Errors(disjuncts)) + // prefix '-' to sort to top + errs = ctx.Newf("%d errors in empty disjunction:", k) + } + + errs = errors.Append(errs, disjuncts) + + return errs +} + +func selectErrors(a []*Bottom) (errs errors.Error) { + // return all errors if less than a certain number. + if len(a) <= 2 { + for _, b := range a { + errs = errors.Append(errs, b.Err) + + } + return errs + } + + // First select only relevant errors. + isIncomplete := false + k := 0 + for _, b := range a { + if !isIncomplete && b.Code >= IncompleteError { + k = 0 + isIncomplete = true + } + a[k] = b + k++ + } + a = a[:k] + + // filter errors + positions := map[token.Pos]bool{} + + add := func(b *Bottom, p token.Pos) bool { + if positions[p] { + return false + } + positions[p] = true + errs = errors.Append(errs, b.Err) + return true + } + + for _, b := range a { + // TODO: Should we also distinguish by message type? + if add(b, b.Err.Position()) { + continue + } + for _, p := range b.Err.InputPositions() { + if add(b, p) { + break + } + } + } + + return errs +} diff --git a/vendor/cuelang.org/go/internal/core/adt/doc.go b/vendor/cuelang.org/go/internal/core/adt/doc.go new file mode 100644 index 0000000000..26c978e2f3 --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/doc.go @@ -0,0 +1,78 @@ +// Copyright 2020 CUE Authors +// +// 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 adt represents partially and fully evaluated CUE types. +// +// This package introduces several categories of types that indicate some set of +// values that may be used in a certain situation. Concrete types may belong to +// multiple categories. +// +// +// Abstract Types +// +// The following types describe the a place where a value may be used: +// +// Decl a value than can be used as a StructLit element. +// Elem a value than can be used as a ListLit element. +// Expr represents an Expr in the CUE grammar. +// Value a fully evaluated value that has no references (except for +// children in composite values). +// Node any of the above values. +// +// The following types categorize nodes by function: +// +// Resolver a reference to position in the result tree. +// Evaluator evaluates to 1 value. +// Yielder evaluates to 0 or more values. +// Validator validates another value. +// +// +// Reference resolution algorithm +// +// A Resolver is resolved within the context of an Environment. In CUE, a +// reference is evaluated by substituting it with a copy of the value to which +// it refers. If the copied value itself contains references we can distinguish +// two different cases. References that refer to values within the copied +// reference (not regarding selectors) will henceforth point to the copied node. +// References that point to outside the referened value will keep referring to +// their original value. +// +// a: b: { +// c: int +// d: c +// e: f +// } +// f: 4 +// g: a.b { // d.c points to inside the referred value, e.f, not. +// c: 3 +// } +// +// The implementation doesn't actually copy referred values, but rather resolves +// references with the aid of an Environment. During compile time, each +// references is associated with the label and a number indicating in which +// parent scope (offset from the current) this label needs to be looked up. An +// Environment keeps track of the point at which a value was referenced, +// providing enough information to look up the labeled value. This Environment +// is the identical for all references within a fields conjunct. Often, an +// Environment can even be shared among conjuncts. +// +// +// Values +// +// Values are fully evaluated expressions. As this means that all references +// will have been eliminated, Values are fully defined without the need for an +// Environment. Additionally, Values represent a fully evaluated form, stripped +// of any comprehensions, optional fields or embeddings. +// +package adt diff --git a/vendor/cuelang.org/go/internal/core/adt/equality.go b/vendor/cuelang.org/go/internal/core/adt/equality.go new file mode 100644 index 0000000000..cb1d338137 --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/equality.go @@ -0,0 +1,192 @@ +// Copyright 2020 CUE Authors +// +// 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 adt + +type Flag uint16 + +const ( + // IgnoreOptional allows optional information to be ignored. This only + // applies when CheckStructural is given. + IgnoreOptional Flag = 1 << iota + + // CheckStructural indicates that closedness information should be + // considered for equality. Equal may return false even when values are + // equal. + CheckStructural Flag = 1 << iota +) + +func Equal(ctx *OpContext, v, w Value, flags Flag) bool { + if x, ok := v.(*Vertex); ok { + return equalVertex(ctx, x, w, flags) + } + if y, ok := w.(*Vertex); ok { + return equalVertex(ctx, y, v, flags) + } + return equalTerminal(ctx, v, w, flags) +} + +func equalVertex(ctx *OpContext, x *Vertex, v Value, flags Flag) bool { + y, ok := v.(*Vertex) + if !ok { + return false + } + if x == y { + return true + } + xk := x.Kind() + yk := y.Kind() + + if xk != yk { + return false + } + + if len(x.Arcs) != len(y.Arcs) { + return false + } + + // TODO: this really should be subsumption. + if flags != 0 { + if x.IsClosedStruct() != y.IsClosedStruct() { + return false + } + if !equalClosed(ctx, x, y, flags) { + return false + } + } + +loop1: + for _, a := range x.Arcs { + for _, b := range y.Arcs { + if a.Label == b.Label { + if !Equal(ctx, a, b, flags) { + return false + } + continue loop1 + } + } + return false + } + + // We do not need to do the following check, because of the pigeon-hole principle. + // loop2: + // for _, b := range y.Arcs { + // for _, a := range x.Arcs { + // if a.Label == b.Label { + // continue loop2 + // } + // } + // return false + // } + + v, ok1 := x.BaseValue.(Value) + w, ok2 := y.BaseValue.(Value) + if !ok1 && !ok2 { + return true // both are struct or list. + } + + return equalTerminal(ctx, v, w, flags) +} + +// equalClosed tests if x and y have the same set of close information. +// TODO: the following refinements are possible: +// - unify optional fields and equate the optional fields +// - do the same for pattern constraints, where the pattern constraints +// are collated by pattern equality. +// - a further refinement would collate patterns by ranges. +// +// For all these refinements it would be necessary to have well-working +// structure sharing so as to not repeatedly recompute optional arcs. +func equalClosed(ctx *OpContext, x, y *Vertex, flags Flag) bool { + return verifyStructs(x, y, flags) && verifyStructs(y, x, flags) +} + +func verifyStructs(x, y *Vertex, flags Flag) bool { +outer: + for _, s := range x.Structs { + if (flags&IgnoreOptional != 0) && !s.StructLit.HasOptional() { + continue + } + if s.closeInfo == nil || s.closeInfo.span&DefinitionSpan == 0 { + if !s.StructLit.HasOptional() { + continue + } + } + for _, t := range y.Structs { + if s.StructLit == t.StructLit { + continue outer + } + } + return false + } + return true +} + +func equalTerminal(ctx *OpContext, v, w Value, flags Flag) bool { + if v == w { + return true + } + + switch x := v.(type) { + case *Num, *String, *Bool, *Bytes, *Null: + if b, ok := BinOp(ctx, EqualOp, v, w).(*Bool); ok { + return b.B + } + return false + + // TODO: for the remainder we are dealing with non-concrete values, so we + // could also just not bother. + + case *BoundValue: + if y, ok := w.(*BoundValue); ok { + return x.Op == y.Op && Equal(ctx, x.Value, y.Value, flags) + } + + case *BasicType: + if y, ok := w.(*BasicType); ok { + return x.K == y.K + } + + case *Conjunction: + y, ok := w.(*Conjunction) + if !ok || len(x.Values) != len(y.Values) { + return false + } + // always ordered the same + for i, xe := range x.Values { + if !Equal(ctx, xe, y.Values[i], flags) { + return false + } + } + return true + + case *Disjunction: + // The best way to compute this is with subsumption, but even that won't + // be too accurate. Assume structural equivalence for now. + y, ok := w.(*Disjunction) + if !ok || len(x.Values) != len(y.Values) { + return false + } + for i, xe := range x.Values { + if !Equal(ctx, xe, y.Values[i], flags) { + return false + } + } + return true + + case *BuiltinValidator: + } + + return false +} diff --git a/vendor/cuelang.org/go/internal/core/adt/errors.go b/vendor/cuelang.org/go/internal/core/adt/errors.go new file mode 100644 index 0000000000..d5f6cfc17a --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/errors.go @@ -0,0 +1,324 @@ +// Copyright 2020 CUE Authors +// +// 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 adt + +// This file contains error encodings. +// +// +// *Bottom: +// - an adt.Value +// - always belongs to a single vertex. +// - does NOT implement error +// - marks error code used for control flow +// +// errors.Error +// - CUE default error +// - implements error +// - tracks error locations +// - has error message details +// - supports multiple errors +// + +import ( + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/errors" + cueformat "cuelang.org/go/cue/format" + "cuelang.org/go/cue/token" +) + +// ErrorCode indicates the type of error. The type of error may influence +// control flow. No other aspects of an error may influence control flow. +type ErrorCode int + +const ( + // An EvalError is a fatal evaluation error. + EvalError ErrorCode = iota + + // A UserError is a fatal error originating from the user. + UserError + + // StructuralCycleError means a structural cycle was found. Structural + // cycles are permanent errors, but they are not passed up recursively, + // as a unification of a value with a structural cycle with one that + // doesn't may still give a useful result. + StructuralCycleError + + // IncompleteError means an evaluation could not complete because of + // insufficient information that may still be added later. + IncompleteError + + // A CycleError indicates a reference error. It is considered to be + // an incomplete error, as reference errors may be broken by providing + // a concrete value. + CycleError +) + +func (c ErrorCode) String() string { + switch c { + case EvalError: + return "eval" + case UserError: + return "user" + case StructuralCycleError: + return "structural cycle" + case IncompleteError: + return "incomplete" + case CycleError: + return "cycle" + } + return "unknown" +} + +// Bottom represents an error or bottom symbol. +// +// Although a Bottom node holds control data, it should not be created until the +// control information already resulted in an error. +type Bottom struct { + Src ast.Node + Err errors.Error + + Code ErrorCode + HasRecursive bool + ChildError bool // Err is the error of the child + NotExists bool // This error originated from a failed lookup. + // Value holds the computed value so far in case + Value Value +} + +func (x *Bottom) Source() ast.Node { return x.Src } +func (x *Bottom) Kind() Kind { return BottomKind } +func (x *Bottom) Specialize(k Kind) Value { return x } // XXX remove + +func (b *Bottom) IsIncomplete() bool { + if b == nil { + return false + } + return b.Code == IncompleteError || b.Code == CycleError +} + +// isLiteralBottom reports whether x is an error originating from a user. +func isLiteralBottom(x Expr) bool { + b, ok := x.(*Bottom) + return ok && b.Code == UserError +} + +// isError reports whether v is an error or nil. +func isError(v Value) bool { + if v == nil { + return true + } + _, ok := v.(*Bottom) + return ok +} + +// isIncomplete reports whether v is associated with an incomplete error. +func isIncomplete(v *Vertex) bool { + if v == nil { + return true + } + if b, ok := v.BaseValue.(*Bottom); ok { + return b.IsIncomplete() + } + return false +} + +// AddChildError updates x to record an error that occurred in one of +// its descendent arcs. The resulting error will record the worst error code of +// the current error or recursive error. +// +// If x is not already an error, the value is recorded in the error for +// reference. +// +func (v *Vertex) AddChildError(recursive *Bottom) { + v.ChildErrors = CombineErrors(nil, v.ChildErrors, recursive) + if recursive.IsIncomplete() { + return + } + x := v.BaseValue + err, _ := x.(*Bottom) + if err == nil { + v.BaseValue = &Bottom{ + Code: recursive.Code, + Value: v, + HasRecursive: true, + ChildError: true, + Err: recursive.Err, + } + return + } + + err.HasRecursive = true + if err.Code > recursive.Code { + err.Code = recursive.Code + } + + v.BaseValue = err +} + +// CombineErrors combines two errors that originate at the same Vertex. +func CombineErrors(src ast.Node, x, y Value) *Bottom { + a, _ := Unwrap(x).(*Bottom) + b, _ := Unwrap(y).(*Bottom) + + if a == b && isCyclePlaceholder(a) { + return a + } + switch { + case a != nil && b != nil: + case a != nil: + return a + case b != nil: + return b + default: + return nil + } + + if a.Code != b.Code { + if a.Code > b.Code { + a, b = b, a + } + + if b.Code >= IncompleteError { + return a + } + } + + return &Bottom{ + Src: src, + Err: errors.Append(a.Err, b.Err), + Code: a.Code, + } +} + +// A ValueError is returned as a result of evaluating a value. +type ValueError struct { + r Runtime + v *Vertex + pos token.Pos + auxpos []token.Pos + errors.Message +} + +func (v *ValueError) AddPosition(n Node) { + if n == nil { + return + } + if p := pos(n); p != token.NoPos { + for _, q := range v.auxpos { + if p == q { + return + } + } + v.auxpos = append(v.auxpos, p) + } +} + +func (v *ValueError) AddClosedPositions(c CloseInfo) { + for s := c.closeInfo; s != nil; s = s.parent { + if loc := s.location; loc != nil { + v.AddPosition(loc) + } + } +} + +func (c *OpContext) errNode() *Vertex { + return c.vertex +} + +// MarkPositions marks the current position stack. +func (c *OpContext) MarkPositions() int { + return len(c.positions) +} + +// ReleasePositions sets the position state to one from a call to MarkPositions. +func (c *OpContext) ReleasePositions(p int) { + c.positions = c.positions[:p] +} + +func (c *OpContext) AddPosition(n Node) { + if n != nil { + c.positions = append(c.positions, n) + } +} + +func (c *OpContext) Newf(format string, args ...interface{}) *ValueError { + return c.NewPosf(c.pos(), format, args...) +} + +func appendNodePositions(a []token.Pos, n Node) []token.Pos { + if p := pos(n); p != token.NoPos { + a = append(a, p) + } + if v, ok := n.(*Vertex); ok { + for _, c := range v.Conjuncts { + a = appendNodePositions(a, c.Elem()) + } + } + return a +} + +func (c *OpContext) NewPosf(p token.Pos, format string, args ...interface{}) *ValueError { + var a []token.Pos + if len(c.positions) > 0 { + a = make([]token.Pos, 0, len(c.positions)) + for _, n := range c.positions { + a = appendNodePositions(a, n) + } + } + for i, arg := range args { + switch x := arg.(type) { + case Node: + a = appendNodePositions(a, x) + args[i] = c.Str(x) + case ast.Node: + b, _ := cueformat.Node(x) + if p := x.Pos(); p != token.NoPos { + a = append(a, p) + } + args[i] = string(b) + case Feature: + args[i] = x.SelectorString(c.Runtime) + } + } + return &ValueError{ + r: c.Runtime, + v: c.errNode(), + pos: p, + auxpos: a, + Message: errors.NewMessage(format, args), + } +} + +func (e *ValueError) Error() string { + return errors.String(e) +} + +func (e *ValueError) Position() token.Pos { + return e.pos +} + +func (e *ValueError) InputPositions() (a []token.Pos) { + return e.auxpos +} + +func (e *ValueError) Path() (a []string) { + if e.v == nil { + return nil + } + for _, f := range appendPath(nil, e.v) { + a = append(a, f.SelectorString(e.r)) + } + return a +} diff --git a/vendor/cuelang.org/go/internal/core/adt/eval.go b/vendor/cuelang.org/go/internal/core/adt/eval.go new file mode 100644 index 0000000000..37e8cd9362 --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/eval.go @@ -0,0 +1,2173 @@ +// Copyright 2021 CUE Authors +// +// 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 eval contains the high level CUE evaluation strategy. +// +// CUE allows for a significant amount of freedom in order of evaluation due to +// the commutativity of the unification operation. This package implements one +// of the possible strategies. +package adt + +// TODO: +// - result should be nodeContext: this allows optionals info to be extracted +// and computed. +// + +import ( + "fmt" + "html/template" + "strings" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/token" +) + +// TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO TODO +// +// - Reuse work from previous cycles. For instance, if we can guarantee that a +// value is always correct for partial results, we can just process the arcs +// going from Partial to Finalized, without having to reevaluate the value. +// +// - Test closedness far more thoroughly. +// + +type Stats struct { + DisjunctCount int + UnifyCount int + + Freed int + Retained int + Reused int + Allocs int +} + +// Leaks reports the number of nodeContext structs leaked. These are typically +// benign, as they will just be garbage collected, as long as the pointer from +// the original nodes has been eliminated or the original nodes are also not +// referred to. But Leaks may have notable impact on performance, and thus +// should be avoided. +func (s *Stats) Leaks() int { + return s.Allocs + s.Reused - s.Freed +} + +var stats = template.Must(template.New("stats").Parse(`{{"" -}} + +Leaks: {{.Leaks}} +Freed: {{.Freed}} +Reused: {{.Reused}} +Allocs: {{.Allocs}} +Retain: {{.Retained}} + +Unifications: {{.UnifyCount}} +Disjuncts: {{.DisjunctCount}}`)) + +func (s *Stats) String() string { + buf := &strings.Builder{} + _ = stats.Execute(buf, s) + return buf.String() +} + +func (c *OpContext) Stats() *Stats { + return &c.stats +} + +// TODO: Note: NewContext takes essentially a cue.Value. By making this +// type more central, we can perhaps avoid context creation. + +// func NewContext(r Runtime, v *Vertex) *OpContext { +// e := NewUnifier(r) +// return e.NewContext(v) +// } + +var structSentinel = &StructMarker{} + +var incompleteSentinel = &Bottom{ + Code: IncompleteError, + Err: errors.Newf(token.NoPos, "incomplete"), +} + +// evaluate returns the evaluated value associated with v. It may return a +// partial result. That is, if v was not yet unified, it may return a +// concrete value that must be the result assuming the configuration has no +// errors. +// +// This semantics allows CUE to break reference cycles in a straightforward +// manner. +// +// Vertex v must still be evaluated at some point to catch the underlying +// error. +// +// TODO: return *Vertex +func (c *OpContext) evaluate(v *Vertex, state VertexStatus) Value { + if v.isUndefined() { + // Use node itself to allow for cycle detection. + c.Unify(v, state) + } + + if n := v.state; n != nil { + if n.errs != nil && !n.errs.IsIncomplete() { + return n.errs + } + if n.scalar != nil && isCyclePlaceholder(v.BaseValue) { + return n.scalar + } + } + + switch x := v.BaseValue.(type) { + case *Bottom: + if x.IsIncomplete() { + c.AddBottom(x) + return nil + } + return x + + case nil: + if v.state != nil { + switch x := v.state.getValidators().(type) { + case Value: + return x + default: + w := *v + w.BaseValue = x + return &w + } + } + Assertf(false, "no BaseValue: state: %v; requested: %v", v.status, state) + } + + if v.status < Finalized && v.state != nil { + // TODO: errors are slightly better if we always add addNotify, but + // in this case it is less likely to cause a performance penalty. + // See https://cuelang.org/issue/661. It may be possible to + // relax this again once we have proper tests to prevent regressions of + // that issue. + if !v.state.done() || v.state.errs != nil { + v.state.addNotify(c.vertex) + } + } + + return v +} + +// Unify fully unifies all values of a Vertex to completion and stores +// the result in the Vertex. If unify was called on v before it returns +// the cached results. +func (c *OpContext) Unify(v *Vertex, state VertexStatus) { + // defer c.PopVertex(c.PushVertex(v)) + if Debug { + c.nest++ + c.Logf(v, "Unify") + defer func() { + c.Logf(v, "END Unify") + c.nest-- + }() + } + + // Ensure a node will always have a nodeContext after calling Unify if it is + // not yet Finalized. + n := v.getNodeContext(c) + defer v.freeNode(n) + + if state <= v.Status() { + if v.Status() != Partial && state != Partial { + return + } + } + + switch v.Status() { + case Evaluating: + n.insertConjuncts() + return + + case EvaluatingArcs: + Assertf(v.status > 0, "unexpected status %d", v.status) + return + + case 0: + if v.Label.IsDef() { + v.Closed = true + } + + if v.Parent != nil { + if v.Parent.Closed { + v.Closed = true + } + } + + if p := v.Parent; p != nil && p.state != nil && v.Label.IsString() { + for _, s := range p.state.node.Structs { + if s.Disable { + continue + } + s.MatchAndInsert(n.ctx, v) + } + } + + if !n.checkClosed(state) { + return + } + + defer c.PopArc(c.PushArc(v)) + + c.stats.UnifyCount++ + + // Clear any remaining error. + if err := c.Err(); err != nil { + panic("uncaught error") + } + + // Set the cache to a cycle error to ensure a cyclic reference will result + // in an error if applicable. A cyclic error may be ignored for + // non-expression references. The cycle error may also be removed as soon + // as there is evidence what a correct value must be, but before all + // validation has taken place. + // + // TODO(cycle): having a more recursive algorithm would make this + // special cycle handling unnecessary. + v.BaseValue = cycle + + v.UpdateStatus(Evaluating) + + n.conjuncts = v.Conjuncts + n.insertConjuncts() + + fallthrough + + case Partial: + defer c.PopArc(c.PushArc(v)) + + v.status = Evaluating + + // Use maybeSetCache for cycle breaking + for n.maybeSetCache(); n.expandOne(); n.maybeSetCache() { + } + + n.doNotify() + + if !n.done() { + switch { + case len(n.disjunctions) > 0 && isCyclePlaceholder(v.BaseValue): + // We disallow entering computations of disjunctions with + // incomplete data. + if state == Finalized { + b := c.NewErrf("incomplete cause disjunction") + b.Code = IncompleteError + n.errs = CombineErrors(nil, n.errs, b) + v.SetValue(n.ctx, Finalized, b) + } else { + n.node.UpdateStatus(Partial) + } + return + + case state <= AllArcs: + n.node.UpdateStatus(Partial) + return + } + } + + if s := v.Status(); state <= s { + // We have found a partial result. There may still be errors + // down the line which may result from further evaluating this + // field, but that will be caught when evaluating this field + // for real. + + // This also covers the case where a recursive evaluation triggered + // this field to become finalized in the mean time. In that case + // we can avoid running another expandDisjuncts. + return + } + + // Disjunctions should always be finalized. If there are nested + // disjunctions the last one should be finalized. + disState := state + if len(n.disjunctions) > 0 && disState != Finalized { + disState = Finalized + } + n.expandDisjuncts(disState, n, maybeDefault, false, true) + + n.finalizeDisjuncts() + + switch len(n.disjuncts) { + case 0: + case 1: + x := n.disjuncts[0].result + x.state = nil + *v = x + + default: + d := n.createDisjunct() + v.BaseValue = d + // The conjuncts will have too much information. Better have no + // information than incorrect information. + for _, d := range d.Values { + // We clear the conjuncts for now. As these disjuncts are for API + // use only, we will fill them out when necessary (using Defaults). + d.Conjuncts = nil + + // TODO: use a more principled form of dereferencing. For instance, + // disjuncts could already be assumed to be the given Vertex, and + // the the main vertex could be dereferenced during evaluation. + for _, a := range d.Arcs { + for _, x := range a.Conjuncts { + // All the environments for embedded structs need to be + // dereferenced. + for env := x.Env; env != nil && env.Vertex == v; env = env.Up { + env.Vertex = d + } + } + } + } + v.Arcs = nil + // v.Structs = nil // TODO: should we keep or discard the Structs? + // TODO: how to represent closedness information? Do we need it? + } + + // If the state has changed, it is because a disjunct has been run, or + // because a single disjunct has replaced it. Restore the old state as + // to not confuse memory management. + v.state = n + + // We don't do this in postDisjuncts, as it should only be done after + // completing all disjunctions. + if !n.done() { + if err := n.incompleteErrors(); err != nil { + b, _ := n.node.BaseValue.(*Bottom) + if b != err { + err = CombineErrors(n.ctx.src, b, err) + } + n.node.BaseValue = err + } + } + + if state != Finalized { + return + } + + if v.BaseValue == nil { + v.BaseValue = n.getValidators() + } + + // Free memory here? + v.UpdateStatus(Finalized) + + case AllArcs: + if !n.checkClosed(state) { + break + } + + defer c.PopArc(c.PushArc(v)) + + n.completeArcs(state) + + case Finalized: + } +} + +// insertConjuncts inserts conjuncts previously uninserted. +func (n *nodeContext) insertConjuncts() { + for len(n.conjuncts) > 0 { + nInfos := len(n.node.Structs) + p := &n.conjuncts[0] + n.conjuncts = n.conjuncts[1:] + n.addExprConjunct(*p) + + // Record the OptionalTypes for all structs that were inferred by this + // Conjunct. This information can be used by algorithms such as trim. + for i := nInfos; i < len(n.node.Structs); i++ { + p.CloseInfo.FieldTypes |= n.node.Structs[i].types + } + } +} + +// finalizeDisjuncts: incomplete errors are kept around and not removed early. +// This call filters the incomplete errors and removes them +// +// This also collects all errors of empty disjunctions. These cannot be +// collected during the finalization state of individual disjuncts. Care should +// be taken to only call this after all disjuncts have been finalized. +func (n *nodeContext) finalizeDisjuncts() { + a := n.disjuncts + if len(a) == 0 { + return + } + k := 0 + for i, d := range a { + switch d.finalDone() { + case true: + a[k], a[i] = d, a[k] + k++ + default: + if err := d.incompleteErrors(); err != nil { + n.disjunctErrs = append(n.disjunctErrs, err) + } + } + d.free() + } + if k == 0 { + n.makeError() + } + n.disjuncts = a[:k] +} + +func (n *nodeContext) doNotify() { + if n.errs == nil || len(n.notify) == 0 { + return + } + for _, v := range n.notify { + if v.state == nil { + if b, ok := v.BaseValue.(*Bottom); ok { + v.BaseValue = CombineErrors(nil, b, n.errs) + } else { + v.BaseValue = n.errs + } + } else { + v.state.addBottom(n.errs) + } + } + n.notify = n.notify[:0] +} + +func (n *nodeContext) postDisjunct(state VertexStatus) { + ctx := n.ctx + + for { + // Use maybeSetCache for cycle breaking + for n.maybeSetCache(); n.expandOne(); n.maybeSetCache() { + } + + if aList, id := n.addLists(); aList != nil { + n.updateNodeType(ListKind, aList, id) + } else { + break + } + } + + if n.aStruct != nil { + n.updateNodeType(StructKind, n.aStruct, n.aStructID) + } + + switch err := n.getErr(); { + case err != nil: + n.node.BaseValue = err + n.errs = nil + + default: + if isCyclePlaceholder(n.node.BaseValue) { + if !n.done() { + n.node.BaseValue = n.incompleteErrors() + } else { + n.node.BaseValue = nil + } + } + // TODO: this ideally should be done here. However, doing so causes + // a somewhat more aggressive cutoff in disjunction cycles, which cause + // some incompatibilities. Fix in another CL. + // + // else if !n.done() { + // n.expandOne() + // if err := n.incompleteErrors(); err != nil { + // n.node.BaseValue = err + // } + // } + + // We are no longer evaluating. + // n.node.UpdateStatus(Partial) + n.node.UpdateStatus(Evaluating) + + // Either set to Conjunction or error. + // TODO: verify and simplify the below code to determine whether + // something is a struct. + markStruct := false + if n.aStruct != nil { + markStruct = true + } else if len(n.node.Structs) > 0 { + markStruct = n.kind&StructKind != 0 && !n.hasTop + } + v := n.node.Value() + if n.node.BaseValue == nil && markStruct { + n.node.BaseValue = &StructMarker{} + v = n.node + } + if v != nil && IsConcrete(v) { + // Also check when we already have errors as we may find more + // serious errors and would like to know about all errors anyway. + + if n.lowerBound != nil { + if b := ctx.Validate(n.lowerBound, v); b != nil { + // TODO(errors): make Validate return boolean and generate + // optimized conflict message. Also track and inject IDs + // to determine origin location.s + if e, _ := b.Err.(*ValueError); e != nil { + e.AddPosition(n.lowerBound) + e.AddPosition(v) + } + n.addBottom(b) + } + } + if n.upperBound != nil { + if b := ctx.Validate(n.upperBound, v); b != nil { + // TODO(errors): make Validate return boolean and generate + // optimized conflict message. Also track and inject IDs + // to determine origin location.s + if e, _ := b.Err.(*ValueError); e != nil { + e.AddPosition(n.upperBound) + e.AddPosition(v) + } + n.addBottom(b) + } + } + // MOVE BELOW + // TODO(perf): only delay processing of actual non-monotonic checks. + skip := n.skipNonMonotonicChecks() + if v := n.node.Value(); v != nil && IsConcrete(v) && !skip { + for _, v := range n.checks { + // TODO(errors): make Validate return bottom and generate + // optimized conflict message. Also track and inject IDs + // to determine origin location.s + if b := ctx.Validate(v, n.node); b != nil { + n.addBottom(b) + } + } + } + } else if state == Finalized { + n.node.BaseValue = n.getValidators() + } + + if v == nil { + break + } + + switch { + case v.Kind() == ListKind: + for _, a := range n.node.Arcs { + if a.Label.Typ() == StringLabel { + n.addErr(ctx.Newf("list may not have regular fields")) + // TODO(errors): add positions for list and arc definitions. + + } + } + + // case !isStruct(n.node) && v.Kind() != BottomKind: + // for _, a := range n.node.Arcs { + // if a.Label.IsRegular() { + // n.addErr(errors.Newf(token.NoPos, + // // TODO(errors): add positions of non-struct values and arcs. + // "cannot combine scalar values with arcs")) + // } + // } + } + } + + if err := n.getErr(); err != nil { + if b, _ := n.node.BaseValue.(*Bottom); b != nil { + err = CombineErrors(nil, b, err) + } + n.node.BaseValue = err + // TODO: add return: if evaluation of arcs is important it can be done + // later. Logically we're done. + } + + n.completeArcs(state) +} + +func (n *nodeContext) incompleteErrors() *Bottom { + // collect incomplete errors. + var err *Bottom // n.incomplete + for _, d := range n.dynamicFields { + err = CombineErrors(nil, err, d.err) + } + for _, c := range n.comprehensions { + err = CombineErrors(nil, err, c.err) + } + for _, x := range n.exprs { + err = CombineErrors(nil, err, x.err) + } + if err == nil { + // safeguard. + err = incompleteSentinel + } + return err +} + +// TODO(perf): ideally we should always perform a closedness check if +// state is Finalized. This is currently not possible when computing a +// partial disjunction as the closedness information is not yet +// complete, possibly leading to a disjunct to be rejected prematurely. +// It is probably possible to fix this if we could add StructInfo +// structures demarked per conjunct. +// +// In practice this should not be a problem: when disjuncts originate +// from the same disjunct, they will have the same StructInfos, and thus +// Equal is able to equate them even in the precense of optional field. +// In general, combining any limited set of disjuncts will soon reach +// a fixed point where duplicate elements can be eliminated this way. +// +// Note that not checking closedness is irrelevant for disjunctions of +// scalars. This means it also doesn't hurt performance where structs +// have a discriminator field (e.g. Kubernetes). We should take care, +// though, that any potential performance issues are eliminated for +// Protobuf-like oneOf fields. +func (n *nodeContext) checkClosed(state VertexStatus) bool { + ignore := state != Finalized || n.skipNonMonotonicChecks() + + v := n.node + if !v.Label.IsInt() && v.Parent != nil && !ignore { + ctx := n.ctx + // Visit arcs recursively to validate and compute error. + if _, err := verifyArc2(ctx, v.Label, v, v.Closed); err != nil { + // Record error in child node to allow recording multiple + // conflicts at the appropriate place, to allow valid fields to + // be represented normally and, most importantly, to avoid + // recursive processing of a disallowed field. + v.SetValue(ctx, Finalized, err) + return false + } + } + return true +} + +func (n *nodeContext) completeArcs(state VertexStatus) { + if DebugSort > 0 { + DebugSortArcs(n.ctx, n.node) + } + + if state <= AllArcs { + n.node.UpdateStatus(AllArcs) + return + } + + n.node.UpdateStatus(EvaluatingArcs) + + ctx := n.ctx + + if !assertStructuralCycle(n) { + // Visit arcs recursively to validate and compute error. + for _, a := range n.node.Arcs { + if a.nonMonotonicInsertGen >= a.nonMonotonicLookupGen && a.nonMonotonicLookupGen > 0 { + err := ctx.Newf( + "cycle: field inserted by if clause that was previously evaluated by another if clause: %s", a.Label) + err.AddPosition(n.node) + n.node.BaseValue = &Bottom{Err: err} + } else if a.nonMonotonicReject { + err := ctx.Newf( + "cycle: field was added after an if clause evaluated it: %s", + a.Label) + err.AddPosition(n.node) + n.node.BaseValue = &Bottom{Err: err} + } + + // Call UpdateStatus here to be absolutely sure the status is set + // correctly and that we are not regressing. + n.node.UpdateStatus(EvaluatingArcs) + ctx.Unify(a, state) + // Don't set the state to Finalized if the child arcs are not done. + if state == Finalized && a.status < Finalized { + state = AllArcs + } + if err, _ := a.BaseValue.(*Bottom); err != nil { + n.node.AddChildError(err) + } + } + } + + n.node.UpdateStatus(state) +} + +func assertStructuralCycle(n *nodeContext) bool { + if cyclic := n.hasCycle && !n.hasNonCycle; cyclic { + n.node.BaseValue = CombineErrors(nil, + n.node.Value(), + &Bottom{ + Code: StructuralCycleError, + Err: n.ctx.Newf("structural cycle"), + Value: n.node.Value(), + // TODO: probably, this should have the referenced arc. + }) + // Don't process Arcs. This is mostly to ensure that no Arcs with + // an Unprocessed status remain in the output. + n.node.Arcs = nil + return true + } + return false +} + +// TODO: this is now a sentinel. Use a user-facing error that traces where +// the cycle originates. +var cycle = &Bottom{ + Err: errors.Newf(token.NoPos, "cycle error"), + Code: CycleError, +} + +func isCyclePlaceholder(v BaseValue) bool { + return v == cycle +} + +func (n *nodeContext) createDisjunct() *Disjunction { + a := make([]*Vertex, len(n.disjuncts)) + p := 0 + hasDefaults := false + for i, x := range n.disjuncts { + v := new(Vertex) + *v = x.result + v.state = nil + switch x.defaultMode { + case isDefault: + a[i] = a[p] + a[p] = v + p++ + hasDefaults = true + + case notDefault: + hasDefaults = true + fallthrough + case maybeDefault: + a[i] = v + } + } + // TODO: disambiguate based on concrete values. + // TODO: consider not storing defaults. + // if p > 0 { + // a = a[:p] + // } + return &Disjunction{ + Values: a, + NumDefaults: p, + HasDefaults: hasDefaults, + } +} + +type arcKey struct { + arc *Vertex + id CloseInfo +} + +// A nodeContext is used to collate all conjuncts of a value to facilitate +// unification. Conceptually order of unification does not matter. However, +// order has relevance when performing checks of non-monotic properities. Such +// checks should only be performed once the full value is known. +type nodeContext struct { + nextFree *nodeContext + refCount int + + ctx *OpContext + node *Vertex + + // usedArcs is a list of arcs that were looked up during non-monotonic operations, but do not exist yet. + usedArcs []*Vertex + + // TODO: (this is CL is first step) + // filter *Vertex a subset of composite with concrete fields for + // bloom-like filtering of disjuncts. We should first verify, however, + // whether some breath-first search gives sufficient performance, as this + // should already ensure a quick-fail for struct disjunctions with + // discriminators. + + arcMap []arcKey + + // snapshot holds the last value of the vertex before calling postDisjunct. + snapshot Vertex + + // Result holds the last evaluated value of the vertex after calling + // postDisjunct. + result Vertex + + // Current value (may be under construction) + scalar Value // TODO: use Value in node. + scalarID CloseInfo + + // Concrete conjuncts + kind Kind + kindExpr Expr // expr that adjust last value (for error reporting) + kindID CloseInfo // for error tracing + lowerBound *BoundValue // > or >= + upperBound *BoundValue // < or <= + checks []Validator // BuiltinValidator, other bound values. + errs *Bottom + + // Conjuncts holds a reference to the Vertex Arcs that still need + // processing. It does NOT need to be copied. + conjuncts []Conjunct + + // notify is used to communicate errors in cyclic dependencies. + // TODO: also use this to communicate increasingly more concrete values. + notify []*Vertex + + // Struct information + dynamicFields []envDynamic + comprehensions []envYield + aStruct Expr + aStructID CloseInfo + + // Expression conjuncts + lists []envList + vLists []*Vertex + exprs []envExpr + + hasTop bool + hasCycle bool // has conjunct with structural cycle + hasNonCycle bool // has conjunct without structural cycle + + // Disjunction handling + disjunctions []envDisjunct + + // usedDefault indicates the for each of possibly multiple parent + // disjunctions whether it is unified with a default disjunct or not. + // This is then later used to determine whether a disjunction should + // be treated as a marked disjunction. + usedDefault []defaultInfo + + defaultMode defaultMode + disjuncts []*nodeContext + buffer []*nodeContext + disjunctErrs []*Bottom +} + +type defaultInfo struct { + // parentMode indicates whether this values was used as a default value, + // based on the parent mode. + parentMode defaultMode + + // The result of default evaluation for a nested disjunction. + nestedMode defaultMode + + origMode defaultMode +} + +func (n *nodeContext) addNotify(v *Vertex) { + if v != nil { + n.notify = append(n.notify, v) + } +} + +func (n *nodeContext) clone() *nodeContext { + d := n.ctx.newNodeContext(n.node) + + d.refCount++ + + d.ctx = n.ctx + d.node = n.node + + d.scalar = n.scalar + d.scalarID = n.scalarID + d.kind = n.kind + d.kindExpr = n.kindExpr + d.kindID = n.kindID + d.aStruct = n.aStruct + d.aStructID = n.aStructID + d.hasTop = n.hasTop + + d.lowerBound = n.lowerBound + d.upperBound = n.upperBound + d.errs = n.errs + d.hasTop = n.hasTop + d.hasCycle = n.hasCycle + d.hasNonCycle = n.hasNonCycle + + // d.arcMap = append(d.arcMap, n.arcMap...) // XXX add? + // d.usedArcs = append(d.usedArcs, n.usedArcs...) // XXX: add? + d.notify = append(d.notify, n.notify...) + d.checks = append(d.checks, n.checks...) + d.dynamicFields = append(d.dynamicFields, n.dynamicFields...) + d.comprehensions = append(d.comprehensions, n.comprehensions...) + d.lists = append(d.lists, n.lists...) + d.vLists = append(d.vLists, n.vLists...) + d.exprs = append(d.exprs, n.exprs...) + d.usedDefault = append(d.usedDefault, n.usedDefault...) + + // No need to clone d.disjunctions + + return d +} + +func (c *OpContext) newNodeContext(node *Vertex) *nodeContext { + if n := c.freeListNode; n != nil { + c.stats.Reused++ + c.freeListNode = n.nextFree + + *n = nodeContext{ + ctx: c, + node: node, + kind: TopKind, + usedArcs: n.usedArcs[:0], + arcMap: n.arcMap[:0], + notify: n.notify[:0], + checks: n.checks[:0], + dynamicFields: n.dynamicFields[:0], + comprehensions: n.comprehensions[:0], + lists: n.lists[:0], + vLists: n.vLists[:0], + exprs: n.exprs[:0], + disjunctions: n.disjunctions[:0], + usedDefault: n.usedDefault[:0], + disjunctErrs: n.disjunctErrs[:0], + disjuncts: n.disjuncts[:0], + buffer: n.buffer[:0], + } + + return n + } + c.stats.Allocs++ + + return &nodeContext{ + ctx: c, + node: node, + kind: TopKind, + } +} + +func (v *Vertex) getNodeContext(c *OpContext) *nodeContext { + if v.state == nil { + if v.status == Finalized { + return nil + } + v.state = c.newNodeContext(v) + } else if v.state.node != v { + panic("getNodeContext: nodeContext out of sync") + } + v.state.refCount++ + return v.state +} + +func (v *Vertex) freeNode(n *nodeContext) { + if n == nil { + return + } + if n.node != v { + panic("freeNode: unpaired free") + } + if v.state != nil && v.state != n { + panic("freeNode: nodeContext out of sync") + } + if n.refCount--; n.refCount == 0 { + if v.status == Finalized { + v.freeNodeState() + } else { + n.ctx.stats.Retained++ + } + } +} + +func (v *Vertex) freeNodeState() { + if v.state == nil { + return + } + state := v.state + v.state = nil + + state.ctx.freeNodeContext(state) +} + +func (n *nodeContext) free() { + if n.refCount--; n.refCount == 0 { + n.ctx.freeNodeContext(n) + } +} + +func (c *OpContext) freeNodeContext(n *nodeContext) { + c.stats.Freed++ + n.nextFree = c.freeListNode + c.freeListNode = n + n.node = nil + n.refCount = 0 +} + +// TODO(perf): return a dedicated ConflictError that can track original +// positions on demand. +func (n *nodeContext) reportConflict( + v1, v2 Node, + k1, k2 Kind, + ids ...CloseInfo) { + + ctx := n.ctx + + var err *ValueError + if k1 == k2 { + err = ctx.NewPosf(token.NoPos, "conflicting values %s and %s", v1, v2) + } else { + err = ctx.NewPosf(token.NoPos, + "conflicting values %s and %s (mismatched types %s and %s)", + v1, v2, k1, k2) + } + + err.AddPosition(v1) + err.AddPosition(v2) + for _, id := range ids { + err.AddClosedPositions(id) + } + + n.addErr(err) +} + +// reportFieldMismatch reports the mixture of regular fields with non-struct +// values. Either s or f needs to be given. +func (n *nodeContext) reportFieldMismatch( + p token.Pos, + s *StructLit, + f Feature, + scalar Expr, + id ...CloseInfo) { + + ctx := n.ctx + + if f == InvalidLabel { + for _, a := range s.Decls { + if x, ok := a.(*Field); ok && x.Label.IsRegular() { + f = x.Label + p = pos(x) + break + } + } + if f == InvalidLabel { + n.reportConflict(scalar, s, n.kind, StructKind, id...) + return + } + } + + err := ctx.NewPosf(p, "cannot combine regular field %q with %v", f, scalar) + + if s != nil { + err.AddPosition(s) + } + + for _, ci := range id { + err.AddClosedPositions(ci) + } + + n.addErr(err) +} + +func (n *nodeContext) updateNodeType(k Kind, v Expr, id CloseInfo) bool { + ctx := n.ctx + kind := n.kind & k + + switch { + case n.kind == BottomKind, + k == BottomKind: + return false + + case kind != BottomKind: + + // TODO: we could consider changing the reporting for structs, but this + // makes only sense in case they are for embeddings. Otherwise the type + // of a struct is more relevant for the failure. + // case k == StructKind: + // s, _ := v.(*StructLit) + // n.reportFieldMismatch(token.NoPos, s, 0, n.kindExpr, id, n.kindID) + + case n.kindExpr != nil: + n.reportConflict(n.kindExpr, v, n.kind, k, n.kindID, id) + + default: + n.addErr(ctx.Newf( + "conflicting value %s (mismatched types %s and %s)", + v, n.kind, k)) + } + + if n.kind != kind || n.kindExpr == nil { + n.kindExpr = v + } + n.kind = kind + return kind != BottomKind +} + +func (n *nodeContext) done() bool { + return len(n.dynamicFields) == 0 && + len(n.comprehensions) == 0 && + len(n.exprs) == 0 +} + +// finalDone is like done, but allows for cycle errors, which can be ignored +// as they essentially indicate a = a & _. +func (n *nodeContext) finalDone() bool { + for _, x := range n.exprs { + if x.err.Code != CycleError { + return false + } + } + return len(n.dynamicFields) == 0 && len(n.comprehensions) == 0 +} + +// hasErr is used to determine if an evaluation path, for instance a single +// path after expanding all disjunctions, has an error. +func (n *nodeContext) hasErr() bool { + if n.node.ChildErrors != nil { + return true + } + if n.node.Status() > Evaluating && n.node.IsErr() { + return true + } + return n.ctx.HasErr() || n.errs != nil +} + +func (n *nodeContext) getErr() *Bottom { + n.errs = CombineErrors(nil, n.errs, n.ctx.Err()) + return n.errs +} + +// getValidators sets the vertex' Value in case there was no concrete value. +func (n *nodeContext) getValidators() BaseValue { + ctx := n.ctx + + a := []Value{} + // if n.node.Value != nil { + // a = append(a, n.node.Value) + // } + kind := TopKind + if n.lowerBound != nil { + a = append(a, n.lowerBound) + kind &= n.lowerBound.Kind() + } + if n.upperBound != nil { + a = append(a, n.upperBound) + kind &= n.upperBound.Kind() + } + for _, c := range n.checks { + // Drop !=x if x is out of bounds with another bound. + if b, _ := c.(*BoundValue); b != nil && b.Op == NotEqualOp { + if n.upperBound != nil && + SimplifyBounds(ctx, n.kind, n.upperBound, b) != nil { + continue + } + if n.lowerBound != nil && + SimplifyBounds(ctx, n.kind, n.lowerBound, b) != nil { + continue + } + } + a = append(a, c) + kind &= c.Kind() + } + + if kind&^n.kind != 0 { + a = append(a, &BasicType{ + Src: n.kindExpr.Source(), // TODO:Is this always a BasicType? + K: n.kind, + }) + } + + var v BaseValue + switch len(a) { + case 0: + // Src is the combined input. + v = &BasicType{K: n.kind} + + case 1: + v = a[0].(Value) // remove cast + + default: + v = &Conjunction{Values: a} + } + + return v +} + +// TODO: this function can probably go as this is now handled in the nodeContext. +func (n *nodeContext) maybeSetCache() { + if n.node.Status() > Partial { // n.node.BaseValue != nil + return + } + if n.scalar != nil { + n.node.BaseValue = n.scalar + } + // NOTE: this is now handled by associating the nodeContext + // if n.errs != nil { + // n.node.SetValue(n.ctx, Partial, n.errs) + // } +} + +type envExpr struct { + c Conjunct + err *Bottom +} + +type envDynamic struct { + env *Environment + field *DynamicField + id CloseInfo + err *Bottom +} + +type envList struct { + env *Environment + list *ListLit + n int64 // recorded length after evaluator + elipsis *Ellipsis + id CloseInfo +} + +func (n *nodeContext) addBottom(b *Bottom) { + n.errs = CombineErrors(nil, n.errs, b) + // TODO(errors): consider doing this + // n.kindExpr = n.errs + // n.kind = 0 +} + +func (n *nodeContext) addErr(err errors.Error) { + if err != nil { + n.addBottom(&Bottom{Err: err}) + } +} + +// addExprConjuncts will attempt to evaluate an Expr and insert the value +// into the nodeContext if successful or queue it for later evaluation if it is +// incomplete or is not value. +func (n *nodeContext) addExprConjunct(v Conjunct) { + env := v.Env + id := v.CloseInfo + + switch x := v.Elem().(type) { + case *Vertex: + if x.IsData() { + n.addValueConjunct(env, x, id) + } else { + n.addVertexConjuncts(v, x, true) + } + + case Value: + n.addValueConjunct(env, x, id) + + case *BinaryExpr: + if x.Op == AndOp { + n.addExprConjunct(MakeConjunct(env, x.X, id)) + n.addExprConjunct(MakeConjunct(env, x.Y, id)) + } else { + n.evalExpr(v) + } + + case *StructLit: + n.addStruct(env, x, id) + + case *ListLit: + childEnv := &Environment{ + Up: env, + Vertex: n.node, + } + if env != nil { + childEnv.Cyclic = env.Cyclic + childEnv.Deref = env.Deref + } + n.lists = append(n.lists, envList{env: childEnv, list: x, id: id}) + + case *DisjunctionExpr: + n.addDisjunction(env, x, id) + + default: + // Must be Resolver or Evaluator. + n.evalExpr(v) + } +} + +// evalExpr is only called by addExprConjunct. If an error occurs, it records +// the error in n and returns nil. +func (n *nodeContext) evalExpr(v Conjunct) { + // Require an Environment. + ctx := n.ctx + + closeID := v.CloseInfo + + // TODO: see if we can do without these counters. + for _, d := range v.Env.Deref { + d.EvalCount++ + } + for _, d := range v.Env.Cycles { + d.SelfCount++ + } + defer func() { + for _, d := range v.Env.Deref { + d.EvalCount-- + } + for _, d := range v.Env.Cycles { + d.SelfCount++ + } + }() + + switch x := v.Expr().(type) { + case Resolver: + arc, err := ctx.Resolve(v.Env, x) + if err != nil && !err.IsIncomplete() { + n.addBottom(err) + break + } + if arc == nil { + n.exprs = append(n.exprs, envExpr{v, err}) + break + } + + n.addVertexConjuncts(v, arc, false) + + case Evaluator: + // Interpolation, UnaryExpr, BinaryExpr, CallExpr + // Could be unify? + val := ctx.evaluateRec(v.Env, v.Expr(), Partial) + if b, ok := val.(*Bottom); ok && b.IsIncomplete() { + n.exprs = append(n.exprs, envExpr{v, b}) + break + } + + if v, ok := val.(*Vertex); ok { + // Handle generated disjunctions (as in the 'or' builtin). + // These come as a Vertex, but should not be added as a value. + b, ok := v.BaseValue.(*Bottom) + if ok && b.IsIncomplete() && len(v.Conjuncts) > 0 { + for _, c := range v.Conjuncts { + c.CloseInfo = closeID + n.addExprConjunct(c) + } + break + } + } + + // TODO: also to through normal Vertex handling here. At the moment + // addValueConjunct handles StructMarker.NeedsClose, as this is always + // only needed when evaluation an Evaluator, and not a Resolver. + // The two code paths should ideally be merged once this separate + // mechanism is eliminated. + // + // if arc, ok := val.(*Vertex); ok && !arc.IsData() { + // n.addVertexConjuncts(v.Env, closeID, v.Expr(), arc) + // break + // } + + // TODO: insert in vertex as well + n.addValueConjunct(v.Env, val, closeID) + + default: + panic(fmt.Sprintf("unknown expression of type %T", x)) + } +} + +func (n *nodeContext) addVertexConjuncts(c Conjunct, arc *Vertex, inline bool) { + closeInfo := c.CloseInfo + + // We need to ensure that each arc is only unified once (or at least) a + // bounded time, witch each conjunct. Comprehensions, for instance, may + // distribute a value across many values that get unified back into the + // same value. If such a value is a disjunction, than a disjunction of N + // disjuncts will result in a factor N more unifications for each + // occurrence of such value, resulting in exponential running time. This + // is especially common values that are used as a type. + // + // However, unification is idempotent, so each such conjunct only needs + // to be unified once. This cache checks for this and prevents an + // exponential blowup in such case. + // + // TODO(perf): this cache ensures the conjuncts of an arc at most once + // per ID. However, we really need to add the conjuncts of an arc only + // once total, and then add the close information once per close ID + // (pointer can probably be shared). Aside from being more performant, + // this is probably the best way to guarantee that conjunctions are + // linear in this case. + key := arcKey{arc, closeInfo} + for _, k := range n.arcMap { + if key == k { + return + } + } + n.arcMap = append(n.arcMap, key) + + env := c.Env + // Pass detection of structural cycles from parent to children. + cyclic := false + if env != nil { + // If a reference is in a tainted set, so is the value it refers to. + cyclic = env.Cyclic + } + + status := arc.Status() + + switch status { + case Evaluating: + // Reference cycle detected. We have reached a fixed point and + // adding conjuncts at this point will not change the value. Also, + // continuing to pursue this value will result in an infinite loop. + + // TODO: add a mechanism so that the computation will only have to + // be done once? + + if arc == n.node { + // TODO: we could use node sharing here. This may avoid an + // exponential blowup during evaluation, like is possible with + // YAML. + return + } + + case EvaluatingArcs: + // Structural cycle detected. Continue evaluation as usual, but + // keep track of whether any other conjuncts without structural + // cycles are added. If not, evaluation of child arcs will end + // with this node. + + // For the purpose of determining whether at least one non-cyclic + // conjuncts exists, we consider all conjuncts of a cyclic conjuncts + // also cyclic. + + cyclic = true + n.hasCycle = true + + // As the EvaluatingArcs mechanism bypasses the self-reference + // mechanism, we need to separately keep track of it here. + // If this (originally) is a self-reference node, adding them + // will result in recursively adding the same reference. For this + // we also mark the node as evaluating. + if arc.SelfCount > 0 { + return + } + + // This count is added for values that are directly added below. + // The count is handled separately for delayed values. + arc.SelfCount++ + defer func() { arc.SelfCount-- }() + } + + // Performance: the following if check filters cases that are not strictly + // necessary for correct functioning. Not updating the closeInfo may cause + // some position information to be lost for top-level positions of merges + // resulting form APIs. These tend to be fairly uninteresting. + // At the same time, this optimization may prevent considerable slowdown + // in case an API does many calls to Unify. + x := c.Expr() + if !inline || arc.IsClosedStruct() || arc.IsClosedList() { + closeInfo = closeInfo.SpawnRef(arc, IsDef(x), x) + } + + if arc.status == 0 && !inline { + // This is a rare condition, but can happen in certain + // evaluation orders. Unfortunately, adding this breaks + // resolution of cyclic mutually referring disjunctions. But it + // is necessary to prevent lookups in unevaluated structs. + // TODO(cycles): this can probably most easily be fixed with a + // having a more recursive implementation. + n.ctx.Unify(arc, Partial) + } + + for _, c := range arc.Conjuncts { + var a []*Vertex + if env != nil { + a = env.Deref + } + if inline { + c = updateCyclic(c, cyclic, nil, nil) + } else { + c = updateCyclic(c, cyclic, arc, a) + } + + // Note that we are resetting the tree here. We hereby assume that + // closedness conflicts resulting from unifying the referenced arc were + // already caught there and that we can ignore further errors here. + c.CloseInfo = closeInfo + n.addExprConjunct(c) + } +} + +// isDef reports whether an expressions is a reference that references a +// definition anywhere in its selection path. +// +// TODO(performance): this should be merged with resolve(). But for now keeping +// this code isolated makes it easier to see what it is for. +func isDef(x Expr) bool { + switch r := x.(type) { + case *FieldReference: + return r.Label.IsDef() + + case *SelectorExpr: + if r.Sel.IsDef() { + return true + } + return isDef(r.X) + + case *IndexExpr: + return isDef(r.X) + } + return false +} + +// updateCyclicStatus looks for proof of non-cyclic conjuncts to override +// a structural cycle. +func (n *nodeContext) updateCyclicStatus(env *Environment) { + if env == nil || !env.Cyclic { + n.hasNonCycle = true + } +} + +func updateCyclic(c Conjunct, cyclic bool, deref *Vertex, a []*Vertex) Conjunct { + env := c.Env + switch { + case env == nil: + if !cyclic && deref == nil { + return c + } + env = &Environment{Cyclic: cyclic} + case deref == nil && env.Cyclic == cyclic && len(a) == 0: + return c + default: + // The conjunct may still be in use in other fields, so we should + // make a new copy to mark Cyclic only for this case. + e := *env + e.Cyclic = e.Cyclic || cyclic + env = &e + } + if deref != nil || len(a) > 0 { + cp := make([]*Vertex, 0, len(a)+1) + cp = append(cp, a...) + if deref != nil { + cp = append(cp, deref) + } + env.Deref = cp + } + if deref != nil { + env.Cycles = append(env.Cycles, deref) + } + return MakeConjunct(env, c.Elem(), c.CloseInfo) +} + +func (n *nodeContext) addValueConjunct(env *Environment, v Value, id CloseInfo) { + n.updateCyclicStatus(env) + + ctx := n.ctx + + if x, ok := v.(*Vertex); ok { + if m, ok := x.BaseValue.(*StructMarker); ok { + n.aStruct = x + n.aStructID = id + if m.NeedClose { + id = id.SpawnRef(x, IsDef(x), x) + id.IsClosed = true + } + } + + cyclic := env != nil && env.Cyclic + + if !x.IsData() { + // TODO: this really shouldn't happen anymore. + if isComplexStruct(ctx, x) { + // This really shouldn't happen, but just in case. + n.addVertexConjuncts(MakeConjunct(env, x, id), x, true) + return + } + + for _, c := range x.Conjuncts { + c = updateCyclic(c, cyclic, nil, nil) + c.CloseInfo = id + n.addExprConjunct(c) // TODO: Pass from eval + } + return + } + + // TODO: evaluate value? + switch v := x.BaseValue.(type) { + default: + panic(fmt.Sprintf("invalid type %T", x.BaseValue)) + + case *ListMarker: + n.vLists = append(n.vLists, x) + return + + case *StructMarker: + + case Value: + n.addValueConjunct(env, v, id) + } + + if len(x.Arcs) == 0 { + return + } + + s := &StructLit{} + + // Keep ordering of Go struct for topological sort. + n.node.AddStruct(s, env, id) + n.node.Structs = append(n.node.Structs, x.Structs...) + + for _, a := range x.Arcs { + // TODO(errors): report error when this is a regular field. + c := MakeConjunct(nil, a, id) + c = updateCyclic(c, cyclic, nil, nil) + n.insertField(a.Label, c) + s.MarkField(a.Label) + } + return + } + + switch b := v.(type) { + case *Bottom: + n.addBottom(b) + return + case *Builtin: + if v := b.BareValidator(); v != nil { + n.addValueConjunct(env, v, id) + return + } + } + + if !n.updateNodeType(v.Kind(), v, id) { + return + } + + switch x := v.(type) { + case *Disjunction: + n.addDisjunctionValue(env, x, id) + + case *Conjunction: + for _, x := range x.Values { + n.addValueConjunct(env, x, id) + } + + case *Top: + n.hasTop = true + + case *BasicType: + // handled above + + case *BoundValue: + switch x.Op { + case LessThanOp, LessEqualOp: + if y := n.upperBound; y != nil { + n.upperBound = nil + v := SimplifyBounds(ctx, n.kind, x, y) + if err := valueError(v); err != nil { + err.AddPosition(v) + err.AddPosition(n.upperBound) + err.AddClosedPositions(id) + } + n.addValueConjunct(env, v, id) + return + } + n.upperBound = x + + case GreaterThanOp, GreaterEqualOp: + if y := n.lowerBound; y != nil { + n.lowerBound = nil + v := SimplifyBounds(ctx, n.kind, x, y) + if err := valueError(v); err != nil { + err.AddPosition(v) + err.AddPosition(n.lowerBound) + err.AddClosedPositions(id) + } + n.addValueConjunct(env, v, id) + return + } + n.lowerBound = x + + case EqualOp, NotEqualOp, MatchOp, NotMatchOp: + // This check serves as simplifier, but also to remove duplicates. + k := 0 + match := false + for _, c := range n.checks { + if y, ok := c.(*BoundValue); ok { + switch z := SimplifyBounds(ctx, n.kind, x, y); { + case z == y: + match = true + case z == x: + continue + } + } + n.checks[k] = c + k++ + } + n.checks = n.checks[:k] + if !match { + n.checks = append(n.checks, x) + } + return + } + + case Validator: + // This check serves as simplifier, but also to remove duplicates. + for i, y := range n.checks { + if b := SimplifyValidator(ctx, x, y); b != nil { + n.checks[i] = b + return + } + } + n.updateNodeType(x.Kind(), x, id) + n.checks = append(n.checks, x) + + case *Vertex: + // handled above. + + case Value: // *NullLit, *BoolLit, *NumLit, *StringLit, *BytesLit, *Builtin + if y := n.scalar; y != nil { + if b, ok := BinOp(ctx, EqualOp, x, y).(*Bool); !ok || !b.B { + n.reportConflict(x, y, x.Kind(), y.Kind(), n.scalarID, id) + } + // TODO: do we need to explicitly add again? + // n.scalar = nil + // n.addValueConjunct(c, BinOp(c, EqualOp, x, y)) + break + } + n.scalar = x + n.scalarID = id + + default: + panic(fmt.Sprintf("unknown value type %T", x)) + } + + if n.lowerBound != nil && n.upperBound != nil { + if u := SimplifyBounds(ctx, n.kind, n.lowerBound, n.upperBound); u != nil { + if err := valueError(u); err != nil { + err.AddPosition(n.lowerBound) + err.AddPosition(n.upperBound) + err.AddClosedPositions(id) + } + n.lowerBound = nil + n.upperBound = nil + n.addValueConjunct(env, u, id) + } + } +} + +func valueError(v Value) *ValueError { + if v == nil { + return nil + } + b, _ := v.(*Bottom) + if b == nil { + return nil + } + err, _ := b.Err.(*ValueError) + if err == nil { + return nil + } + return err +} + +// addStruct collates the declarations of a struct. +// +// addStruct fulfills two additional pivotal functions: +// 1) Implement vertex unification (this happens through De Bruijn indices +// combined with proper set up of Environments). +// 2) Implied closedness for definitions. +// +func (n *nodeContext) addStruct( + env *Environment, + s *StructLit, + closeInfo CloseInfo) { + + n.updateCyclicStatus(env) // to handle empty structs. + + // NOTE: This is a crucial point in the code: + // Unification derferencing happens here. The child nodes are set to + // an Environment linked to the current node. Together with the De Bruijn + // indices, this determines to which Vertex a reference resolves. + + // TODO(perf): consider using environment cache: + // var childEnv *Environment + // for _, s := range n.nodeCache.sub { + // if s.Up == env { + // childEnv = s + // } + // } + childEnv := &Environment{ + Up: env, + Vertex: n.node, + } + if env != nil { + childEnv.Cyclic = env.Cyclic + childEnv.Deref = env.Deref + } + + s.Init() + + if s.HasEmbed && !s.IsFile() { + closeInfo = closeInfo.SpawnGroup(nil) + } + + parent := n.node.AddStruct(s, childEnv, closeInfo) + closeInfo.IsClosed = false + parent.Disable = true // disable until processing is done. + + for _, d := range s.Decls { + switch x := d.(type) { + case *Field: + // handle in next iteration. + + case *DynamicField: + n.aStruct = s + n.aStructID = closeInfo + n.dynamicFields = append(n.dynamicFields, envDynamic{childEnv, x, closeInfo, nil}) + + case *Comprehension: + n.insertComprehension(childEnv, x, closeInfo) + + case Expr: + // add embedding to optional + + // TODO(perf): only do this if addExprConjunct below will result in + // a fieldSet. Otherwise the entry will just be removed next. + id := closeInfo.SpawnEmbed(x) + + // push and opo embedding type. + n.addExprConjunct(MakeConjunct(childEnv, x, id)) + + case *OptionalField, *BulkOptionalField, *Ellipsis: + // Nothing to do here. Note that the precense of these fields do not + // excluded embedded scalars: only when they match actual fields + // does it exclude those. + + default: + panic("unreachable") + } + } + + if !s.HasEmbed { + n.aStruct = s + n.aStructID = closeInfo + } + + parent.Disable = false + + for _, d := range s.Decls { + switch x := d.(type) { + case *Field: + if x.Label.IsString() { + n.aStruct = s + n.aStructID = closeInfo + } + n.insertField(x.Label, MakeConjunct(childEnv, x, closeInfo)) + } + } +} + +// TODO(perf): if an arc is the only arc with that label added to a Vertex, and +// if there are no conjuncts of optional fields to be added, then the arc could +// be added as is until any of these conditions change. This would allow +// structure sharing in many cases. One should be careful, however, to +// recursively track arcs of previously unified evaluated vertices ot make this +// optimization meaningful. +// +// An alternative approach to avoid evaluating optional arcs (if we take that +// route) is to not recursively evaluate those arcs, even for Finalize. This is +// possible as it is not necessary to evaluate optional arcs to evaluate +// disjunctions. +func (n *nodeContext) insertField(f Feature, x Conjunct) *Vertex { + ctx := n.ctx + arc, _ := n.node.GetArc(ctx, f) + + arc.addConjunct(x) + + switch { + case arc.state != nil: + s := arc.state + switch { + case arc.Status() <= AllArcs: + // This may happen when a struct has multiple comprehensions, where + // the insertion of one of which depends on the outcome of another. + + // TODO: to something more principled by allowing values to + // monotonically increase. + arc.status = Partial + arc.BaseValue = nil + s.disjuncts = s.disjuncts[:0] + s.disjunctErrs = s.disjunctErrs[:0] + + fallthrough + + default: + arc.state.addExprConjunct(x) + } + + case arc.Status() == 0: + default: + n.addBottom(&Bottom{ + Code: IncompleteError, + Err: ctx.NewPosf(pos(x.Field()), + "cannot add field %s: was already used", + f.SelectorString(ctx)), + }) + } + return arc +} + +// expandOne adds dynamic fields to a node until a fixed point is reached. +// On each iteration, dynamic fields that cannot resolve due to incomplete +// values are skipped. They will be retried on the next iteration until no +// progress can be made. Note that a dynamic field may add more dynamic fields. +// +// forClauses are processed after all other clauses. A struct may be referenced +// before it is complete, meaning that fields added by other forms of injection +// may influence the result of a for clause _after_ it has already been +// processed. We could instead detect such insertion and feed it to the +// ForClause to generate another entry or have the for clause be recomputed. +// This seems to be too complicated and lead to iffy edge cases. +// TODO(errors): detect when a field is added to a struct that is already used +// in a for clause. +func (n *nodeContext) expandOne() (done bool) { + // Don't expand incomplete expressions if we detected a cycle. + if n.done() || (n.hasCycle && !n.hasNonCycle) { + return false + } + + var progress bool + + if progress = n.injectDynamic(); progress { + return true + } + + if progress = n.injectComprehensions(&(n.comprehensions)); progress { + return true + } + + // Do expressions after comprehensions, as comprehensions can never + // refer to embedded scalars, whereas expressions may refer to generated + // fields if we were to allow attributes to be defined alongside + // scalars. + exprs := n.exprs + n.exprs = n.exprs[:0] + for _, x := range exprs { + n.addExprConjunct(x.c) + + // collect and and or + } + if len(n.exprs) < len(exprs) { + return true + } + + // No progress, report error later if needed: unification with + // disjuncts may resolve this later later on. + return false +} + +// injectDynamic evaluates and inserts dynamic declarations. +func (n *nodeContext) injectDynamic() (progress bool) { + ctx := n.ctx + k := 0 + + a := n.dynamicFields + for _, d := range n.dynamicFields { + var f Feature + v, complete := ctx.Evaluate(d.env, d.field.Key) + if !complete { + d.err, _ = v.(*Bottom) + a[k] = d + k++ + continue + } + if b, _ := v.(*Bottom); b != nil { + n.addValueConjunct(nil, b, d.id) + continue + } + f = ctx.Label(d.field.Key, v) + if f.IsInt() { + n.addErr(ctx.NewPosf(pos(d.field.Key), "integer fields not supported")) + } + n.insertField(f, MakeConjunct(d.env, d.field, d.id)) + } + + progress = k < len(n.dynamicFields) + + n.dynamicFields = a[:k] + + return progress +} + +// addLists +// +// TODO: association arrays: +// If an association array marker was present in a struct, create a struct node +// instead of a list node. In either case, a node may only have list fields +// or struct fields and not both. +// +// addLists should be run after the fixpoint expansion: +// - it enforces that comprehensions may not refer to the list itself +// - there may be no other fields within the list. +// +// TODO(embeddedScalars): for embedded scalars, there should be another pass +// of evaluation expressions after expanding lists. +func (n *nodeContext) addLists() (oneOfTheLists Expr, anID CloseInfo) { + if len(n.lists) == 0 && len(n.vLists) == 0 { + return nil, CloseInfo{} + } + + isOpen := true + max := 0 + var maxNode Expr + + if m, ok := n.node.BaseValue.(*ListMarker); ok { + isOpen = m.IsOpen + max = len(n.node.Arcs) + } + + c := n.ctx + + for _, l := range n.vLists { + oneOfTheLists = l + + elems := l.Elems() + isClosed := l.IsClosedList() + + switch { + case len(elems) < max: + if isClosed { + n.invalidListLength(len(elems), max, l, maxNode) + continue + } + + case len(elems) > max: + if !isOpen { + n.invalidListLength(max, len(elems), maxNode, l) + continue + } + isOpen = !isClosed + max = len(elems) + maxNode = l + + case isClosed: + isOpen = false + maxNode = l + } + + for _, a := range elems { + if a.Conjuncts == nil { + x := a.BaseValue.(Value) + n.insertField(a.Label, MakeConjunct(nil, x, CloseInfo{})) + continue + } + for _, c := range a.Conjuncts { + n.insertField(a.Label, c) + } + } + } + +outer: + for i, l := range n.lists { + n.updateCyclicStatus(l.env.Up) + + index := int64(0) + hasComprehension := false + for j, elem := range l.list.Elems { + switch x := elem.(type) { + case *Comprehension: + err := c.Yield(l.env, x, func(e *Environment) { + label, err := MakeLabel(x.Source(), index, IntLabel) + n.addErr(err) + index++ + c := MakeConjunct(e, x.Value, l.id) + n.insertField(label, c) + }) + hasComprehension = true + if err != nil { + n.addBottom(err) + continue outer + } + + case *Ellipsis: + if j != len(l.list.Elems)-1 { + n.addErr(c.Newf("ellipsis must be last element in list")) + } + + n.lists[i].elipsis = x + + default: + label, err := MakeLabel(x.Source(), index, IntLabel) + n.addErr(err) + index++ // TODO: don't use insertField. + n.insertField(label, MakeConjunct(l.env, x, l.id)) + } + + // Terminate early in case of runaway comprehension. + if !isOpen && int(index) > max { + n.invalidListLength(max, len(l.list.Elems), maxNode, l.list) + continue outer + } + } + + oneOfTheLists = l.list + anID = l.id + + switch closed := n.lists[i].elipsis == nil; { + case int(index) < max: + if closed { + n.invalidListLength(int(index), max, l.list, maxNode) + continue + } + + case int(index) > max, + closed && isOpen, + (!closed == isOpen) && !hasComprehension: + max = int(index) + maxNode = l.list + isOpen = !closed + } + + n.lists[i].n = index + } + + // add additionalItem values to list and construct optionals. + elems := n.node.Elems() + for _, l := range n.vLists { + if !l.IsClosedList() { + continue + } + + newElems := l.Elems() + if len(newElems) >= len(elems) { + continue // error generated earlier, if applicable. + } + + for _, arc := range elems[len(newElems):] { + l.MatchAndInsert(c, arc) + } + } + + for _, l := range n.lists { + if l.elipsis == nil { + continue + } + + s := l.list.info + if s == nil { + s = &StructLit{Decls: []Decl{l.elipsis}} + s.Init() + l.list.info = s + } + info := n.node.AddStruct(s, l.env, l.id) + + for _, arc := range elems[l.n:] { + info.MatchAndInsert(c, arc) + } + } + + sources := []ast.Expr{} + // Add conjuncts for additional items. + for _, l := range n.lists { + if l.elipsis == nil { + continue + } + if src, _ := l.elipsis.Source().(ast.Expr); src != nil { + sources = append(sources, src) + } + } + + if m, ok := n.node.BaseValue.(*ListMarker); !ok { + n.node.SetValue(c, Partial, &ListMarker{ + Src: ast.NewBinExpr(token.AND, sources...), + IsOpen: isOpen, + }) + } else { + if expr, _ := m.Src.(ast.Expr); expr != nil { + sources = append(sources, expr) + } + m.Src = ast.NewBinExpr(token.AND, sources...) + m.IsOpen = m.IsOpen && isOpen + } + + n.lists = n.lists[:0] + n.vLists = n.vLists[:0] + + return oneOfTheLists, anID +} + +func (n *nodeContext) invalidListLength(na, nb int, a, b Expr) { + n.addErr(n.ctx.Newf("incompatible list lengths (%d and %d)", na, nb)) +} diff --git a/vendor/cuelang.org/go/internal/core/adt/expr.go b/vendor/cuelang.org/go/internal/core/adt/expr.go new file mode 100644 index 0000000000..31aeda234f --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/expr.go @@ -0,0 +1,1759 @@ +// Copyright 2020 CUE Authors +// +// 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 adt + +import ( + "bytes" + "fmt" + "io" + "regexp" + + "github.com/cockroachdb/apd/v2" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/token" +) + +// A StructLit represents an unevaluated struct literal or file body. +type StructLit struct { + Src ast.Node // ast.File or ast.StructLit + Decls []Decl + + // TODO: record the merge order somewhere. + + // The below fields are redundant to Decls and are computed with Init. + + // field marks the optional conjuncts of all explicit Fields. + // Required Fields are marked as empty + Fields []FieldInfo + + Dynamic []*DynamicField + + // excluded are all literal fields that already exist. + Bulk []*BulkOptionalField + + Additional []*Ellipsis + HasEmbed bool + IsOpen bool // has a ... + initialized bool + + types OptionalType + + // administrative fields like hasreferences. + // hasReferences bool +} + +func (o *StructLit) IsFile() bool { + _, ok := o.Src.(*ast.File) + return ok +} + +type FieldInfo struct { + Label Feature + Optional []Node +} + +func (x *StructLit) HasOptional() bool { + return x.types&(HasField|HasPattern|HasAdditional) != 0 +} + +func (x *StructLit) Source() ast.Node { return x.Src } + +func (x *StructLit) evaluate(c *OpContext) Value { + e := c.Env(0) + v := &Vertex{ + Parent: e.Vertex, + Conjuncts: []Conjunct{{e, x, CloseInfo{}}}, + } + // evaluate may not finalize a field, as the resulting value may be + // used in a context where more conjuncts are added. It may also lead + // to disjuncts being in a partially expanded state, leading to + // misaligned nodeContexts. + c.Unify(v, AllArcs) + return v +} + +// TODO: remove this method +func (o *StructLit) MarkField(f Feature) { + o.Fields = append(o.Fields, FieldInfo{Label: f}) +} + +func (o *StructLit) Init() { + if o.initialized { + return + } + o.initialized = true + for _, d := range o.Decls { + switch x := d.(type) { + case *Field: + if o.fieldIndex(x.Label) < 0 { + o.Fields = append(o.Fields, FieldInfo{Label: x.Label}) + } + + case *OptionalField: + p := o.fieldIndex(x.Label) + if p < 0 { + p = len(o.Fields) + o.Fields = append(o.Fields, FieldInfo{Label: x.Label}) + } + o.Fields[p].Optional = append(o.Fields[p].Optional, x) + o.types |= HasField + + case *DynamicField: + o.Dynamic = append(o.Dynamic, x) + o.types |= HasDynamic + + case Expr: + o.HasEmbed = true + + case *Comprehension: + o.HasEmbed = true + + case *LetClause: + o.HasEmbed = true + + case *BulkOptionalField: + o.Bulk = append(o.Bulk, x) + o.types |= HasPattern + switch x.Filter.(type) { + case *BasicType, *Top: + default: + o.types |= HasComplexPattern + } + + case *Ellipsis: + switch x.Value.(type) { + case nil, *Top: + o.IsOpen = true + o.types |= IsOpen + + default: + // TODO: consider only adding for non-top. + o.types |= HasAdditional + } + o.Additional = append(o.Additional, x) + + default: + panic("unreachable") + } + } +} + +func (o *StructLit) fieldIndex(f Feature) int { + for i := range o.Fields { + if o.Fields[i].Label == f { + return i + } + } + return -1 +} + +func (o *StructLit) OptionalTypes() OptionalType { + return o.types +} + +func (o *StructLit) IsOptional(label Feature) bool { + for _, f := range o.Fields { + if f.Label == label && len(f.Optional) > 0 { + return true + } + } + return false +} + +// FIELDS +// +// Fields can also be used as expressions whereby the value field is the +// expression this allows retaining more context. + +// Field represents a field with a fixed label. It can be a regular field, +// definition or hidden field. +// +// foo: bar +// #foo: bar +// _foo: bar +// +// Legacy: +// +// Foo :: bar +// +type Field struct { + Src *ast.Field + + Label Feature + Value Expr +} + +func (x *Field) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +// An OptionalField represents an optional regular field. +// +// foo?: expr +// +type OptionalField struct { + Src *ast.Field + Label Feature + Value Expr +} + +func (x *OptionalField) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +// A BulkOptionalField represents a set of optional field. +// +// [expr]: expr +// +type BulkOptionalField struct { + Src *ast.Field // Elipsis or Field + Filter Expr + Value Expr + Label Feature // for reference and formatting +} + +func (x *BulkOptionalField) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +// A Ellipsis represents a set of optional fields of a given type. +// +// ...T +// +type Ellipsis struct { + Src *ast.Ellipsis + Value Expr +} + +func (x *Ellipsis) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +// A DynamicField represents a regular field for which the key is computed. +// +// "\(expr)": expr +// (expr): expr +// +type DynamicField struct { + Src *ast.Field + Key Expr + Value Expr +} + +func (x *DynamicField) IsOptional() bool { + return x.Src.Optional != token.NoPos +} + +func (x *DynamicField) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +// A ListLit represents an unevaluated list literal. +// +// [a, for x in src { ... }, b, ...T] +// +type ListLit struct { + Src *ast.ListLit + + // scalars, comprehensions, ...T + Elems []Elem + + info *StructLit // Shared closedness info. +} + +func (x *ListLit) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *ListLit) evaluate(c *OpContext) Value { + e := c.Env(0) + v := &Vertex{ + Parent: e.Vertex, + Conjuncts: []Conjunct{{e, x, CloseInfo{}}}, + } + // TODO: should be AllArcs and then use Finalize for builtins? + c.Unify(v, Finalized) // TODO: also partial okay? + return v +} + +// Null represents null. It can be used as a Value and Expr. +type Null struct { + Src ast.Node +} + +func (x *Null) Source() ast.Node { return x.Src } +func (x *Null) Kind() Kind { return NullKind } + +// Bool is a boolean value. It can be used as a Value and Expr. +type Bool struct { + Src ast.Node + B bool +} + +func (x *Bool) Source() ast.Node { return x.Src } +func (x *Bool) Kind() Kind { return BoolKind } + +// Num is a numeric value. It can be used as a Value and Expr. +type Num struct { + Src ast.Node + K Kind // needed? + X apd.Decimal // Is integer if the apd.Decimal is an integer. +} + +// TODO: do we need this? +// func NewNumFromString(src ast.Node, s string) Value { +// n := &Num{Src: src, K: IntKind} +// if strings.ContainsAny(s, "eE.") { +// n.K = FloatKind +// } +// _, _, err := n.X.SetString(s) +// if err != nil { +// pos := token.NoPos +// if src != nil { +// pos = src.Pos() +// } +// return &Bottom{Err: errors.Newf(pos, "invalid number: %v", err)} +// } +// return n +// } + +func (x *Num) Source() ast.Node { return x.Src } +func (x *Num) Kind() Kind { return x.K } + +// TODO: do we still need this? +// func (x *Num) Specialize(k Kind) Value { +// k = k & x.K +// if k == x.K { +// return x +// } +// y := *x +// y.K = k +// return &y +// } + +// String is a string value. It can be used as a Value and Expr. +type String struct { + Src ast.Node + Str string + RE *regexp.Regexp // only set if needed +} + +func (x *String) Source() ast.Node { return x.Src } +func (x *String) Kind() Kind { return StringKind } + +// Bytes is a bytes value. It can be used as a Value and Expr. +type Bytes struct { + Src ast.Node + B []byte + RE *regexp.Regexp // only set if needed +} + +func (x *Bytes) Source() ast.Node { return x.Src } +func (x *Bytes) Kind() Kind { return BytesKind } + +// Composites: the evaluated fields of a composite are recorded in the arc +// vertices. + +type ListMarker struct { + Src ast.Node + IsOpen bool +} + +func (x *ListMarker) Source() ast.Node { return x.Src } +func (x *ListMarker) Kind() Kind { return ListKind } +func (x *ListMarker) node() {} + +type StructMarker struct { + // NeedClose is used to signal that the evaluator should close this struct. + // It is only set by the close builtin. + NeedClose bool +} + +func (x *StructMarker) Source() ast.Node { return nil } +func (x *StructMarker) Kind() Kind { return StructKind } +func (x *StructMarker) node() {} + +// Top represents all possible values. It can be used as a Value and Expr. +type Top struct{ Src *ast.Ident } + +func (x *Top) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} +func (x *Top) Kind() Kind { return TopKind } + +// BasicType represents all values of a certain Kind. It can be used as a Value +// and Expr. +// +// string +// int +// num +// bool +// +type BasicType struct { + Src ast.Node + K Kind +} + +func (x *BasicType) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} +func (x *BasicType) Kind() Kind { return x.K } + +// TODO: do we still need this? +// func (x *BasicType) Specialize(k Kind) Value { +// k = x.K & k +// if k == x.K { +// return x +// } +// y := *x +// y.K = k +// return &y +// } + +// TODO: should we use UnaryExpr for Bound now we have BoundValue? + +// BoundExpr represents an unresolved unary comparator. +// +// Concrete { + return ctx.NewErrf("bound has fixed non-concrete value") + } + return &BoundValue{x.Src, x.Op, v} + } + + // This simplifies boundary expressions. It is an alternative to an + // evaluation strategy that makes nodes increasingly more specific. + // + // For instance, a completely different implementation would be to allow + // the precense of a concrete value to ignore incomplete errors. + // + // TODO: consider an alternative approach. + switch y := v.(type) { + case *BoundValue: + switch { + case y.Op == NotEqualOp: + switch x.Op { + case LessEqualOp, LessThanOp, GreaterEqualOp, GreaterThanOp: + // <(!=3) => number + // Smaller than an arbitrarily large number is any number. + return &BasicType{K: y.Kind()} + case NotEqualOp: + // !=(!=3) ==> 3 + // Not a value that is anything but a given value is that + // given value. + return y.Value + } + + case x.Op == NotEqualOp: + // Invert if applicable. + switch y.Op { + case LessEqualOp: + return &BoundValue{x.Src, GreaterThanOp, y.Value} + case LessThanOp: + return &BoundValue{x.Src, GreaterEqualOp, y.Value} + case GreaterEqualOp: + return &BoundValue{x.Src, LessThanOp, y.Value} + case GreaterThanOp: + return &BoundValue{x.Src, LessEqualOp, y.Value} + } + + case (x.Op == LessThanOp || x.Op == LessEqualOp) && + (y.Op == GreaterThanOp || y.Op == GreaterEqualOp), + (x.Op == GreaterThanOp || x.Op == GreaterEqualOp) && + (y.Op == LessThanOp || y.Op == LessEqualOp): + // <(>=3) + // Something smaller than an arbitrarily large number is any number. + return &BasicType{K: y.Kind()} + + case x.Op == LessThanOp && + (y.Op == LessEqualOp || y.Op == LessThanOp), + x.Op == GreaterThanOp && + (y.Op == GreaterEqualOp || y.Op == GreaterThanOp): + // <(<=x) => <=x + // Less or equal than something that is less than x is less than x. + return y + } + + case *BasicType: + switch x.Op { + case LessEqualOp, LessThanOp, GreaterEqualOp, GreaterThanOp: + return y + } + } + if v.Concreteness() > Concrete { + // TODO(errors): analyze dependencies of x.Expr to get positions. + ctx.addErrf(IncompleteError, token.NoPos, // TODO(errors): use ctx.pos()? + "non-concrete value %s for bound %s", x.Expr, x.Op) + return nil + } + return &BoundValue{x.Src, x.Op, v} +} + +// A BoundValue is a fully evaluated unary comparator that can be used to +// validate other values. +// +// <5 +// =~"Name$" +// +type BoundValue struct { + Src ast.Expr + Op Op + Value Value +} + +func (x *BoundValue) Source() ast.Node { return x.Src } +func (x *BoundValue) Kind() Kind { + k := x.Value.Kind() + switch k { + case IntKind, FloatKind, NumKind: + return NumKind + + case NullKind: + if x.Op == NotEqualOp { + return TopKind &^ NullKind + } + } + return k +} + +func (x *BoundValue) validate(c *OpContext, y Value) *Bottom { + a := y // Can be list or struct. + b := c.scalar(x.Value) + if c.HasErr() { + return c.Err() + } + + switch v := BinOp(c, x.Op, a, b).(type) { + case *Bottom: + return v + + case *Bool: + if v.B { + return nil + } + // TODO(errors): use "invalid value %v (not an %s)" if x is a + // predeclared identifier such as `int`. + err := c.Newf("invalid value %v (out of bound %s)", y, x) + err.AddPosition(y) + return &Bottom{Src: c.src, Err: err, Code: EvalError} + + default: + panic(fmt.Sprintf("unsupported type %T", v)) + } +} + +func (x *BoundValue) validateStr(c *OpContext, a string) bool { + if str, ok := x.Value.(*String); ok { + b := str.Str + switch x.Op { + case LessEqualOp: + return a <= b + case LessThanOp: + return a < b + case GreaterEqualOp: + return a >= b + case GreaterThanOp: + return a > b + case EqualOp: + return a == b + case NotEqualOp: + return a != b + case MatchOp: + return c.regexp(x.Value).MatchString(a) + case NotMatchOp: + return !c.regexp(x.Value).MatchString(a) + } + } + return x.validate(c, &String{Str: a}) == nil +} + +func (x *BoundValue) validateInt(c *OpContext, a int64) bool { + switch n := x.Value.(type) { + case *Num: + b, err := n.X.Int64() + if err != nil { + break + } + switch x.Op { + case LessEqualOp: + return a <= b + case LessThanOp: + return a < b + case GreaterEqualOp: + return a >= b + case GreaterThanOp: + return a > b + case EqualOp: + return a == b + case NotEqualOp: + return a != b + } + } + return x.validate(c, c.NewInt64(a)) == nil +} + +// A NodeLink is used during computation to refer to an existing Vertex. +// It is used to signal a potential cycle or reference. +// Note that a NodeLink may be used as a value. This should be taken into +// account. +type NodeLink struct { + Node *Vertex +} + +func (x *NodeLink) Kind() Kind { + return x.Node.Kind() +} +func (x *NodeLink) Source() ast.Node { return x.Node.Source() } + +func (x *NodeLink) resolve(c *OpContext, state VertexStatus) *Vertex { + return x.Node +} + +// A FieldReference represents a lexical reference to a field. +// +// a +// +type FieldReference struct { + Src *ast.Ident + UpCount int32 + Label Feature +} + +func (x *FieldReference) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *FieldReference) resolve(c *OpContext, state VertexStatus) *Vertex { + n := c.relNode(x.UpCount) + pos := pos(x) + return c.lookup(n, pos, x.Label, state) +} + +// A ValueReference represents a lexical reference to a value. +// +// a: X=b +// +type ValueReference struct { + Src *ast.Ident + UpCount int32 + Label Feature // for informative purposes +} + +func (x *ValueReference) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *ValueReference) resolve(c *OpContext, state VertexStatus) *Vertex { + if x.UpCount == 0 { + return c.vertex + } + n := c.relNode(x.UpCount - 1) + return n +} + +// A LabelReference refers to the string or integer value of a label. +// +// [X=Pattern]: b: X +// +type LabelReference struct { + Src *ast.Ident + UpCount int32 +} + +// TODO: should this implement resolver at all? + +func (x *LabelReference) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *LabelReference) evaluate(ctx *OpContext) Value { + label := ctx.relLabel(x.UpCount) + if label == 0 { + // There is no label. This may happen if a LabelReference is evaluated + // outside of the context of a parent node, for instance if an + // "additional" items or properties is evaluated in isolation. + // + // TODO: this should return the pattern of the label. + return &BasicType{K: StringKind} + } + return label.ToValue(ctx) +} + +// A DynamicReference is like a LabelReference, but with a computed label. +// +// X=(x): X +// X="\(x)": X +// +type DynamicReference struct { + Src *ast.Ident + UpCount int32 + Label Expr + + // TODO: only use aliases and store the actual expression only in the scope. + // The feature is unique for every instance. This will also allow dynamic + // fields to be ordered among normal fields. + // + // This could also be used to assign labels to embedded values, if they + // don't match a label. + Alias Feature +} + +func (x *DynamicReference) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *DynamicReference) resolve(ctx *OpContext, state VertexStatus) *Vertex { + e := ctx.Env(x.UpCount) + frame := ctx.PushState(e, x.Src) + v := ctx.value(x.Label) + ctx.PopState(frame) + f := ctx.Label(x.Label, v) + return ctx.lookup(e.Vertex, pos(x), f, state) +} + +// An ImportReference refers to an imported package. +// +// import "strings" +// +// strings.ToLower("Upper") +// +type ImportReference struct { + Src *ast.Ident + ImportPath Feature + Label Feature // for informative purposes +} + +func (x *ImportReference) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *ImportReference) resolve(ctx *OpContext, state VertexStatus) *Vertex { + path := x.ImportPath.StringValue(ctx) + v := ctx.Runtime.LoadImport(path) + if v == nil { + ctx.addErrf(EvalError, x.Src.Pos(), "cannot find package %q", path) + } + return v +} + +// A LetReference evaluates a let expression in its original environment. +// +// let X = x +// +type LetReference struct { + Src *ast.Ident + UpCount int32 + Label Feature // for informative purposes + X Expr +} + +func (x *LetReference) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *LetReference) resolve(c *OpContext, state VertexStatus) *Vertex { + e := c.Env(x.UpCount) + label := e.Vertex.Label + if x.X == nil { + panic("nil expression") + } + // Anonymous arc. + return &Vertex{Parent: nil, Label: label, Conjuncts: []Conjunct{{e, x.X, CloseInfo{}}}} +} + +func (x *LetReference) evaluate(c *OpContext) Value { + e := c.Env(x.UpCount) + + // Not caching let expressions may lead to exponential behavior. + return e.evalCached(c, x.X) +} + +// A SelectorExpr looks up a fixed field in an expression. +// +// X.Sel +// +type SelectorExpr struct { + Src *ast.SelectorExpr + X Expr + Sel Feature +} + +func (x *SelectorExpr) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *SelectorExpr) resolve(c *OpContext, state VertexStatus) *Vertex { + // TODO: the node should really be evaluated as AllArcs, but the order + // of evaluation is slightly off, causing too much to be evaluated. + // This may especially result in incorrect results when using embedded + // scalars. + n := c.node(x, x.X, x.Sel.IsRegular(), Partial) + if n == emptyNode { + return n + } + if n.status == Partial { + if b := n.state.incompleteErrors(); b != nil && b.Code < CycleError { + n.BaseValue = b + return n + } + } + return c.lookup(n, x.Src.Sel.Pos(), x.Sel, state) +} + +// IndexExpr is like a selector, but selects an index. +// +// X[Index] +// +type IndexExpr struct { + Src *ast.IndexExpr + X Expr + Index Expr +} + +func (x *IndexExpr) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *IndexExpr) resolve(ctx *OpContext, state VertexStatus) *Vertex { + // TODO: support byte index. + // TODO: the node should really be evaluated as AllArcs, but the order + // of evaluation is slightly off, causing too much to be evaluated. + // This may especially result in incorrect results when using embedded + // scalars. + n := ctx.node(x, x.X, true, Partial) + i := ctx.value(x.Index) + if n == emptyNode { + return n + } + if n.status == Partial { + if b := n.state.incompleteErrors(); b != nil && b.Code < CycleError { + n.BaseValue = b + return n + } + } + f := ctx.Label(x.Index, i) + return ctx.lookup(n, x.Src.Index.Pos(), f, state) +} + +// A SliceExpr represents a slice operation. (Not currently in spec.) +// +// X[Lo:Hi:Stride] +// +type SliceExpr struct { + Src *ast.SliceExpr + X Expr + Lo Expr + Hi Expr + Stride Expr +} + +func (x *SliceExpr) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *SliceExpr) evaluate(c *OpContext) Value { + // TODO: strides + + v := c.value(x.X) + const as = "slice index" + + switch v := v.(type) { + case nil: + c.addErrf(IncompleteError, c.pos(), "non-concrete slice subject %s", x.X) + return nil + case *Vertex: + if !v.IsList() { + break + } + + var ( + lo = uint64(0) + hi = uint64(len(v.Arcs)) + ) + if x.Lo != nil { + lo = c.uint64(c.value(x.Lo), as) + } + if x.Hi != nil { + hi = c.uint64(c.value(x.Hi), as) + if hi > uint64(len(v.Arcs)) { + return c.NewErrf("index %d out of range", hi) + } + } + if lo > hi { + return c.NewErrf("invalid slice index: %d > %d", lo, hi) + } + + n := c.newList(c.src, v.Parent) + for i, a := range v.Arcs[lo:hi] { + label, err := MakeLabel(a.Source(), int64(i), IntLabel) + if err != nil { + c.AddBottom(&Bottom{Src: a.Source(), Err: err}) + return nil + } + arc := *a + arc.Parent = n + arc.Label = label + n.Arcs = append(n.Arcs, &arc) + } + n.status = Finalized + return n + + case *Bytes: + var ( + lo = uint64(0) + hi = uint64(len(v.B)) + ) + if x.Lo != nil { + lo = c.uint64(c.value(x.Lo), as) + } + if x.Hi != nil { + hi = c.uint64(c.value(x.Hi), as) + if hi > uint64(len(v.B)) { + return c.NewErrf("index %d out of range", hi) + } + } + if lo > hi { + return c.NewErrf("invalid slice index: %d > %d", lo, hi) + } + return c.newBytes(v.B[lo:hi]) + } + + if isError(v) { + return v + } + return c.NewErrf("cannot slice %v (type %s)", v, v.Kind()) +} + +// An Interpolation is a string interpolation. +// +// "a \(b) c" +// +type Interpolation struct { + Src *ast.Interpolation + K Kind // string or bytes + Parts []Expr // odd: strings, even sources +} + +func (x *Interpolation) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *Interpolation) evaluate(c *OpContext) Value { + buf := bytes.Buffer{} + for _, e := range x.Parts { + v := c.value(e) + if x.K == BytesKind { + buf.Write(c.ToBytes(v)) + } else { + buf.WriteString(c.ToString(v)) + } + } + if err := c.Err(); err != nil { + err = &Bottom{ + Code: err.Code, + Err: errors.Wrapf(err.Err, pos(x), "invalid interpolation"), + } + // c.AddBottom(err) + // return nil + return err + } + if x.K == BytesKind { + return &Bytes{x.Src, buf.Bytes(), nil} + } + return &String{x.Src, buf.String(), nil} +} + +// UnaryExpr is a unary expression. +// +// Op X +// -X !X +X +// +type UnaryExpr struct { + Src *ast.UnaryExpr + Op Op + X Expr +} + +func (x *UnaryExpr) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *UnaryExpr) evaluate(c *OpContext) Value { + if !c.concreteIsPossible(x.Op, x.X) { + return nil + } + v := c.value(x.X) + if isError(v) { + return v + } + + op := x.Op + k := kind(v) + expectedKind := k + switch op { + case SubtractOp: + if v, ok := v.(*Num); ok { + f := *v + f.X.Neg(&v.X) + f.Src = x.Src + return &f + } + expectedKind = NumKind + + case AddOp: + if v, ok := v.(*Num); ok { + // TODO: wrap in thunk to save position of '+'? + return v + } + expectedKind = NumKind + + case NotOp: + if v, ok := v.(*Bool); ok { + return &Bool{x.Src, !v.B} + } + expectedKind = BoolKind + } + if k&expectedKind != BottomKind { + c.addErrf(IncompleteError, pos(x.X), + "operand %s of '%s' not concrete (was %s)", x.X, op, k) + return nil + } + return c.NewErrf("invalid operation %s (%s %s)", x, op, k) +} + +// BinaryExpr is a binary expression. +// +// X + Y +// X & Y +// +type BinaryExpr struct { + Src *ast.BinaryExpr + Op Op + X Expr + Y Expr +} + +func (x *BinaryExpr) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *BinaryExpr) evaluate(c *OpContext) Value { + env := c.Env(0) + if x.Op == AndOp { + // Anonymous Arc + v := &Vertex{Conjuncts: []Conjunct{{env, x, CloseInfo{}}}} + c.Unify(v, Finalized) + return v + } + + if !c.concreteIsPossible(x.Op, x.X) || !c.concreteIsPossible(x.Op, x.Y) { + return nil + } + + // TODO: allow comparing to a literal Bottom only. Find something more + // principled perhaps. One should especially take care that two values + // evaluating to Bottom don't evaluate to true. For now we check for + // Bottom here and require that one of the values be a Bottom literal. + if x.Op == EqualOp || x.Op == NotEqualOp { + if isLiteralBottom(x.X) { + return c.validate(env, x.Src, x.Y, x.Op) + } + if isLiteralBottom(x.Y) { + return c.validate(env, x.Src, x.X, x.Op) + } + } + + left, _ := c.Concrete(env, x.X, x.Op) + right, _ := c.Concrete(env, x.Y, x.Op) + + if err := CombineErrors(x.Src, left, right); err != nil { + return err + } + + if err := c.Err(); err != nil { + return err + } + + return BinOp(c, x.Op, left, right) +} + +func (c *OpContext) validate(env *Environment, src ast.Node, x Expr, op Op) (r Value) { + s := c.PushState(env, src) + if c.nonMonotonicLookupNest == 0 { + c.nonMonotonicGeneration++ + } + + var match bool + // NOTE: using Unwrap is maybe note entirely accurate, as it may discard + // a future error. However, if it does so, the error will at least be + // reported elsewhere. + switch b := c.value(x).(type) { + case nil: + case *Bottom: + if b.Code == CycleError { + c.PopState(s) + c.AddBottom(b) + return nil + } + match = op == EqualOp + // We have a nonmonotonic use of a failure. Referenced fields should + // not be added anymore. + c.nonMonotonicRejectNest++ + c.evalState(x, Partial) + c.nonMonotonicRejectNest-- + + default: + // TODO(cycle): if EqualOp: + // - ensure to pass special status to if clause or keep a track of "hot" + // paths. + // - evaluate hypothetical struct + // - walk over all fields and verify that fields are not contradicting + // previously marked fields. + // + switch { + case b.Concreteness() > Concrete: + // TODO: mimic comparison to bottom semantics. If it is a valid + // value, check for concreteness that this level only. This + // should ultimately be replaced with an exists and valid + // builtin. + match = op == EqualOp + default: + match = op != EqualOp + } + c.nonMonotonicLookupNest++ + c.evalState(x, Partial) + c.nonMonotonicLookupNest-- + } + + c.PopState(s) + return &Bool{src, match} +} + +// A CallExpr represents a call to a builtin. +// +// len(x) +// strings.ToLower(x) +// +type CallExpr struct { + Src *ast.CallExpr + Fun Expr + Args []Expr +} + +func (x *CallExpr) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *CallExpr) evaluate(c *OpContext) Value { + fun := c.value(x.Fun) + var b *Builtin + switch f := fun.(type) { + case *Builtin: + b = f + + case *BuiltinValidator: + // We allow a validator that takes no arguments accept the validated + // value to be called with zero arguments. + switch { + case f.Src != nil: + c.AddErrf("cannot call previously called validator %s", x.Fun) + + case f.Builtin.IsValidator(len(x.Args)): + v := *f + v.Src = x + return &v + + default: + b = f.Builtin + } + + default: + c.AddErrf("cannot call non-function %s (type %s)", x.Fun, kind(fun)) + return nil + } + args := []Value{} + for i, a := range x.Args { + expr := c.value(a) + switch v := expr.(type) { + case nil: + // There SHOULD be an error in the context. If not, we generate + // one. + c.Assertf(pos(x.Fun), c.HasErr(), + "argument %d to function %s is incomplete", i, x.Fun) + + case *Bottom: + // TODO(errors): consider adding an argument index for this errors. + // On the other hand, this error is really not related to the + // argument itself, so maybe it is good as it is. + c.AddBottom(v) + + default: + args = append(args, expr) + } + } + if c.HasErr() { + return nil + } + if b.IsValidator(len(args)) { + return &BuiltinValidator{x, b, args} + } + result := b.call(c, pos(x), args) + if result == nil { + return nil + } + return c.evalState(result, Partial) +} + +// A Builtin is a value representing a native function call. +type Builtin struct { + // TODO: make these values for better type checking. + Params []Param + Result Kind + Func func(c *OpContext, args []Value) Expr + + Package Feature + Name string +} + +type Param struct { + Name Feature // name of the argument; mostly for documentation + Value Value // Could become Value later, using disjunctions for defaults. +} + +// Kind returns the kind mask of this parameter. +func (p Param) Kind() Kind { + return p.Value.Kind() +} + +// Default reports the default value for this Param or nil if there is none. +func (p Param) Default() Value { + d, ok := p.Value.(*Disjunction) + if !ok || d.NumDefaults != 1 { + return nil + } + return d.Values[0] +} + +func (x *Builtin) WriteName(w io.Writer, c *OpContext) { + _, _ = fmt.Fprintf(w, "%s.%s", x.Package.StringValue(c), x.Name) +} + +// Kind here represents the case where Builtin is used as a Validator. +func (x *Builtin) Kind() Kind { + return FuncKind +} + +func (x *Builtin) BareValidator() *BuiltinValidator { + if len(x.Params) != 1 || + (x.Result != BoolKind && x.Result != BottomKind) { + return nil + } + return &BuiltinValidator{Builtin: x} +} + +// IsValidator reports whether b should be interpreted as a Validator for the +// given number of arguments. +func (b *Builtin) IsValidator(numArgs int) bool { + return numArgs == len(b.Params)-1 && + b.Result&^BoolKind == 0 && + b.Params[numArgs].Default() == nil +} + +func bottom(v Value) *Bottom { + if x, ok := v.(*Vertex); ok { + v = x.Value() + } + b, _ := v.(*Bottom) + return b +} + +func (x *Builtin) call(c *OpContext, p token.Pos, args []Value) Expr { + fun := x // right now always x. + if len(args) > len(x.Params) { + c.addErrf(0, p, + "too many arguments in call to %s (have %d, want %d)", + fun, len(args), len(x.Params)) + return nil + } + for i := len(args); i < len(x.Params); i++ { + v := x.Params[i].Default() + if v == nil { + c.addErrf(0, p, + "not enough arguments in call to %s (have %d, want %d)", + fun, len(args), len(x.Params)) + return nil + } + args = append(args, v) + } + for i, a := range args { + if x.Params[i].Kind() == BottomKind { + continue + } + if b := bottom(a); b != nil { + return b + } + if k := kind(a); x.Params[i].Kind()&k == BottomKind { + code := EvalError + b, _ := args[i].(*Bottom) + if b != nil { + code = b.Code + } + c.addErrf(code, pos(a), + "cannot use %s (type %s) as %s in argument %d to %s", + a, k, x.Params[i].Kind(), i+1, fun) + return nil + } + v := x.Params[i].Value + if _, ok := v.(*BasicType); !ok { + env := c.Env(0) + x := &BinaryExpr{Op: AndOp, X: v, Y: a} + n := &Vertex{Conjuncts: []Conjunct{{env, x, CloseInfo{}}}} + c.Unify(n, Finalized) + if _, ok := n.BaseValue.(*Bottom); ok { + c.addErrf(0, pos(a), + "cannot use %s as %s in argument %d to %s", + a, v, i+1, fun) + return nil + } + args[i] = n + } + } + return x.Func(c, args) +} + +func (x *Builtin) Source() ast.Node { return nil } + +// A BuiltinValidator is a Value that results from evaluation a partial call +// to a builtin (using CallExpr). +// +// strings.MinRunes(4) +// +type BuiltinValidator struct { + Src *CallExpr + Builtin *Builtin + Args []Value // any but the first value +} + +func (x *BuiltinValidator) Source() ast.Node { + if x.Src == nil { + return x.Builtin.Source() + } + return x.Src.Source() +} + +func (x *BuiltinValidator) Pos() token.Pos { + if src := x.Source(); src != nil { + return src.Pos() + } + return token.NoPos +} + +func (x *BuiltinValidator) Kind() Kind { + return x.Builtin.Params[0].Kind() +} + +func (x *BuiltinValidator) validate(c *OpContext, v Value) *Bottom { + args := make([]Value, len(x.Args)+1) + args[0] = v + copy(args[1:], x.Args) + + return validateWithBuiltin(c, x.Pos(), x.Builtin, args) +} + +func validateWithBuiltin(c *OpContext, src token.Pos, b *Builtin, args []Value) *Bottom { + var severeness ErrorCode + var err errors.Error + + res := b.call(c, src, args) + switch v := res.(type) { + case nil: + return nil + + case *Bottom: + if v == nil { + return nil // caught elsewhere, but be defensive. + } + severeness = v.Code + err = v.Err + + case *Bool: + if v.B { + return nil + } + + default: + return c.NewErrf("invalid validator %s.%s", b.Package.StringValue(c), b.Name) + } + + // failed: + var buf bytes.Buffer + b.WriteName(&buf, c) + if len(args) > 1 { + buf.WriteString("(") + for i, a := range args[1:] { + if i > 0 { + _, _ = buf.WriteString(", ") + } + buf.WriteString(c.Str(a)) + } + buf.WriteString(")") + } + + vErr := c.NewPosf(src, "invalid value %s (does not satisfy %s)", args[0], buf.String()) + + for _, v := range args { + vErr.AddPosition(v) + } + + return &Bottom{Code: severeness, Err: errors.Wrap(vErr, err)} +} + +// A Disjunction represents a disjunction, where each disjunct may or may not +// be marked as a default. +type DisjunctionExpr struct { + Src *ast.BinaryExpr + Values []Disjunct + + HasDefaults bool +} + +// A Disjunct is used in Disjunction. +type Disjunct struct { + Val Expr + Default bool +} + +func (x *DisjunctionExpr) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *DisjunctionExpr) evaluate(c *OpContext) Value { + e := c.Env(0) + v := &Vertex{Conjuncts: []Conjunct{{e, x, CloseInfo{}}}} + c.Unify(v, Finalized) // TODO: also partial okay? + // TODO: if the disjunction result originated from a literal value, we may + // consider the result closed to create more permanent errors. + return v +} + +// A Conjunction is a conjunction of values that cannot be represented as a +// single value. It is the result of unification. +type Conjunction struct { + Src ast.Expr + Values []Value +} + +func (x *Conjunction) Source() ast.Node { return x.Src } +func (x *Conjunction) Kind() Kind { + k := TopKind + for _, v := range x.Values { + k &= v.Kind() + } + return k +} + +// A disjunction is a disjunction of values. It is the result of expanding +// a DisjunctionExpr if the expression cannot be represented as a single value. +type Disjunction struct { + Src ast.Expr + + // Values are the non-error disjuncts of this expression. The first + // NumDefault values are default values. + Values []*Vertex + + Errors *Bottom // []bottom + + // NumDefaults indicates the number of default values. + NumDefaults int + HasDefaults bool +} + +func (x *Disjunction) Source() ast.Node { return x.Src } +func (x *Disjunction) Kind() Kind { + k := BottomKind + for _, v := range x.Values { + k |= v.Kind() + } + return k +} + +type Comprehension struct { + Clauses Yielder + Value Expr +} + +func (x *Comprehension) Source() ast.Node { + if x.Clauses == nil { + return nil + } + return x.Clauses.Source() +} + +// A ForClause represents a for clause of a comprehension. It can be used +// as a struct or list element. +// +// for k, v in src {} +// +type ForClause struct { + Syntax *ast.ForClause + Key Feature + Value Feature + Src Expr + Dst Yielder +} + +func (x *ForClause) Source() ast.Node { + if x.Syntax == nil { + return nil + } + return x.Syntax +} + +func (x *ForClause) yield(c *OpContext, f YieldFunc) { + n := c.node(x, x.Src, true, Finalized) + for _, a := range n.Arcs { + if !a.Label.IsRegular() { + continue + } + + c.Unify(a, Partial) + + n := &Vertex{status: Finalized} + + if x.Value != InvalidLabel { + b := &Vertex{ + Label: x.Value, + BaseValue: a, + } + n.Arcs = append(n.Arcs, b) + } + + if x.Key != InvalidLabel { + v := &Vertex{Label: x.Key} + key := a.Label.ToValue(c) + v.AddConjunct(MakeRootConjunct(c.Env(0), key)) + v.SetValue(c, Finalized, key) + n.Arcs = append(n.Arcs, v) + } + + sub := c.spawn(n) + saved := c.PushState(sub, x.Dst.Source()) + x.Dst.yield(c, f) + if b := c.PopState(saved); b != nil { + c.AddBottom(b) + break + } + if c.HasErr() { + break + } + } +} + +// An IfClause represents an if clause of a comprehension. It can be used +// as a struct or list element. +// +// if cond {} +// +type IfClause struct { + Src *ast.IfClause + Condition Expr + Dst Yielder +} + +func (x *IfClause) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *IfClause) yield(ctx *OpContext, f YieldFunc) { + if ctx.BoolValue(ctx.value(x.Condition)) { + x.Dst.yield(ctx, f) + } +} + +// An LetClause represents a let clause in a comprehension. +// +// let x = y +// +type LetClause struct { + Src *ast.LetClause + Label Feature + Expr Expr + Dst Yielder +} + +func (x *LetClause) Source() ast.Node { + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *LetClause) yield(c *OpContext, f YieldFunc) { + n := &Vertex{Arcs: []*Vertex{ + {Label: x.Label, Conjuncts: []Conjunct{{c.Env(0), x.Expr, CloseInfo{}}}}, + }} + + sub := c.spawn(n) + saved := c.PushState(sub, x.Dst.Source()) + x.Dst.yield(c, f) + if b := c.PopState(saved); b != nil { + c.AddBottom(b) + } +} + +// A ValueClause represents the value part of a comprehension. +type ValueClause struct { + *StructLit +} + +func (x *ValueClause) Source() ast.Node { + if x.StructLit == nil { + return nil + } + if x.Src == nil { + return nil + } + return x.Src +} + +func (x *ValueClause) yield(op *OpContext, f YieldFunc) { + f(op.Env(0)) +} diff --git a/vendor/cuelang.org/go/internal/core/adt/feature.go b/vendor/cuelang.org/go/internal/core/adt/feature.go new file mode 100644 index 0000000000..26d6c9301f --- /dev/null +++ b/vendor/cuelang.org/go/internal/core/adt/feature.go @@ -0,0 +1,324 @@ +// Copyright 2020 CUE Authors +// +// 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 adt + +import ( + "fmt" + "strconv" + "strings" + + "cuelang.org/go/cue/ast" + "cuelang.org/go/cue/errors" + "cuelang.org/go/cue/literal" + "cuelang.org/go/cue/token" + "cuelang.org/go/internal" +) + +// A Feature is an encoded form of a label which comprises a compact +// representation of an integer or string label as well as a label type. +type Feature uint32 + +// TODO: create labels such that list are sorted first (or last with index.) + +// InvalidLabel is an encoding of an erroneous label. +const ( + InvalidLabel Feature = 0 + + // MaxIndex indicates the maximum number of unique strings that are used for + // labeles within this CUE implementation. + MaxIndex = 1<<(32-indexShift) - 1 +) + +// These labels can be used for wildcard queries. +var ( + AnyDefinition Feature = makeLabel(MaxIndex, DefinitionLabel) + AnyHidden Feature = makeLabel(MaxIndex, HiddenLabel) + AnyString Feature = makeLabel(MaxIndex, StringLabel) + AnyIndex Feature = makeLabel(MaxIndex, IntLabel) +) + +// A StringIndexer coverts strings to and from an index that is unique for a +// given string. +type StringIndexer interface { + // ToIndex returns a unique positive index for s (0 < index < 2^28-1). + // + // For each pair of strings s and t it must return the same index if and + // only if s == t. + StringToIndex(s string) (index int64) + + // ToString returns a string s for index such that ToIndex(s) == index. + IndexToString(index int64) string +} + +// SelectorString reports the shortest string representation of f when used as a +// selector. +func (f Feature) SelectorString(index StringIndexer) string { + x := f.safeIndex() + switch f.Typ() { + case IntLabel: + return strconv.Itoa(int(x)) + case StringLabel: + s := index.IndexToString(x) + if ast.IsValidIdent(s) && !internal.IsDefOrHidden(s) { + return s + } + return literal.String.Quote(s) + default: + return f.IdentString(index) + } +} + +// IdentString reports the identifier of f. The result is undefined if f +// is not an identifier label. +func (f Feature) IdentString(index StringIndexer) string { + s := index.IndexToString(f.safeIndex()) + if f.IsHidden() { + if p := strings.IndexByte(s, '\x00'); p >= 0 { + s = s[:p] + } + } + return s +} + +// PkgID returns the package identifier, composed of the module and package +// name, associated with this identifier. It will return "" if this is not +// a hidden label. +func (f Feature) PkgID(index StringIndexer) string { + if !f.IsHidden() { + return "" + } + s := index.IndexToString(f.safeIndex()) + if p := strings.IndexByte(s, '\x00'); p >= 0 { + s = s[p+1:] + } + return s +} + +// StringValue reports the string value of f, which must be a string label. +func (f Feature) StringValue(index StringIndexer) string { + if !f.IsString() { + panic("not a string label") + } + x := f.safeIndex() + return index.IndexToString(x) +} + +// ToValue converts a label to a value, which will be a Num for integer labels +// and a String for string labels. It panics when f is not a regular label. +func (f Feature) ToValue(ctx *OpContext) Value { + if !f.IsRegular() { + panic("not a regular label") + } + // TODO: Handle special regular values: invalid and AnyRegular. + if f.IsInt() { + return ctx.NewInt64(int64(f.Index())) + } + x := f.safeIndex() + str := ctx.IndexToString(x) + return ctx.NewString(str) +} + +// StringLabel converts s to a string label. +func (c *OpContext) StringLabel(s string) Feature { + return labelFromValue(c, nil, &String{Str: s}) +} + +// MakeStringLabel creates a label for the given string. +func MakeStringLabel(r StringIndexer, s string) Feature { + i := r.StringToIndex(s) + + // TODO: set position if it exists. + f, err := MakeLabel(nil, i, StringLabel) + if err != nil { + panic("out of free string slots") + } + return f +} + +// MakeIdentLabel creates a label for the given identifier. +func MakeIdentLabel(r StringIndexer, s, pkgpath string) Feature { + t := StringLabel + switch { + case strings.HasPrefix(s, "_#"): + t = HiddenDefinitionLabel + s = fmt.Sprintf("%s\x00%s", s, pkgpath) + case strings.HasPrefix(s, "#"): + t = DefinitionLabel + case strings.HasPrefix(s, "_"): + s = fmt.Sprintf("%s\x00%s", s, pkgpath) + t = HiddenLabel + } + i := r.StringToIndex(s) + f, err := MakeLabel(nil, i, t) + if err != nil { + panic("out of free string slots") + } + return f +} + +const msgGround = "invalid non-ground value %s (must be concrete %s)" + +func labelFromValue(c *OpContext, src Expr, v Value) Feature { + var i int64 + var t FeatureType + if isError(v) { + return InvalidLabel + } + switch v.Kind() { + case IntKind, NumKind: + x, _ := Unwrap(v).(*Num) + if x == nil { + c.addErrf(IncompleteError, pos(v), msgGround, v, "int") + return InvalidLabel + } + t = IntLabel + var err error + i, err = x.X.Int64() + if err != nil || x.K != IntKind { + if src == nil { + src = v + } + c.AddErrf("invalid index %v: %v", src, err) + return InvalidLabel + } + if i < 0 { + switch src.(type) { + case nil, *Num, *UnaryExpr: + // If the value is a constant, we know it is always an error. + // UnaryExpr is an approximation for a constant value here. + c.AddErrf("invalid index %s (index must be non-negative)", x) + default: + // Use a different message is it is the result of evaluation. + c.AddErrf("index %s out of range [%s]", src, x) + } + return InvalidLabel + } + + case StringKind: + x, _ := Unwrap(v).(*String) + if x == nil { + c.addErrf(IncompleteError, pos(v), msgGround, v, "string") + return InvalidLabel + } + t = StringLabel + i = c.StringToIndex(x.Str) + + default: + if src != nil { + c.AddErrf("invalid index %s (invalid type %v)", src, v.Kind()) + } else { + c.AddErrf("invalid index type %v", v.Kind()) + } + return InvalidLabel + } + + // TODO: set position if it exists. + f, err := MakeLabel(nil, i, t) + if err != nil { + c.AddErr(err) + } + return f +} + +// MakeLabel creates a label. It reports an error if the index is out of range. +func MakeLabel(src ast.Node, index int64, f FeatureType) (Feature, errors.Error) { + if 0 > index || index > MaxIndex-1 { + p := token.NoPos + if src != nil { + p = src.Pos() + } + return InvalidLabel, + errors.Newf(p, "int label out of range (%d not >=0 and <= %d)", + index, MaxIndex-1) + } + return Feature(index)<

^J3SC{O=CWxCY&tzNKiT7Ed?5&{U3B&KGl|Qi^kMOQv-cdv&|b# zHv+SZnT-wAe#7(YZP%L^B$3jDwEgJu(xPef1bPBj%~dC;>1=x8>E5aNpVdk9wEbN6 znfaFOK%PuQ9ON7bZ#)?~79(fcCXQqA`D`Z^Rgu8`diJp@{pdoRYN4v4B4!~qJ-xju zz9IuzeC7N8f2iUny2fVW&qlO$b@fXohTE2YkVtuxm^Lfs2*8}h`MmELTD7An)$top z>)iW4A+RHqf!yXsIQ;4yji&n6bje&nP9`W_hdwjbH)&I*Wh8ZLl=GX0)U9S4oXxg6 zZ{12VGBnnQ1(;YF+gRC~?6xwY(n4ZEb7U-Fc{#E{b-*pmQcv9y{)P@%LPCS`v-JaK zT8IV_uYiNZn#0rZdHL1O0GRqoE^pN`*{DwiyuB!#aE=KF62E}$cw>RQ+gAg zsYe&`UP`U3`0(qQqqLS-DIYLd2FV&Z7OZ9beu-$Fy5@4Pb z6%`PyADnHMZKoHEky+BJHLEtSH`ZHcVG(Ar7F!#4+W1&I9@$}i^N1`Z}+u zyi=Qw=EXF5SA_bhQsc@)(<>q}u&VxP-`GS?*T*03`fjmreyMNxr#i(*y+SY|FB7<- zD&PpDJk~K?2M(O7O=WZpM`W%ZI&sp{EfdLxXo|~@txkZj&oI8f*6T%cbPRVShlPZM z#D<5PS=s3u8DSG|fYF-ZZ2e%+oP!-UfH)X$UQIF%U!9HeWsmU-pG8@J7J`j}&tbIQ z+S<{5tvflT?#xdObSDT|o*GbB3%T4RuJ9Z)`NCCN zY)F{#>hap_GezrY3Wg~|+7OjT3*K0kle_;}|XMc1yy z$2TV>jf%nkGC}`HjgpA$0<@fqWrFW{_|MQg1>#9aGQhu16cF2;{t<%wz=60#_pdGA zQYR#Ex%{7)qSI_)Y)E7XEs7QyYn7N}a?r%~O%u#hSUOW(Tx@r5^^M)@>+4KfV_;-p zVn{O9vr4itNlJ3tZ*K0D7T_2{^9rMxxJSiC(=r>_v}kiWo1c=zEli*{@X2IqA-7<@ zh)L1fBhoDf*e-}C;vkz>3ah^5K?(!o;_$)KVhple11Wk?gIgQTKrF(Zh{Bw!Q8r!I#@`l`!c zi87)Hf^SQ-jfv!w_vWru=OAUhaDO0CSm46;%@k5IU0hBHAa`bPTpq*eA77VFTTbKCQR$>Gl|b{yVw~P=d z3=WBRgDu98<0@Q&37mDX67^AAcaqNd*F>^iooNO>OPEi{rzytxqraRR!ji z@2WTy5$7M1TD7Iz`+zDi=$U9%U8o5M@M-iZal% zBN^G5t}c6CZY*#!^&6N=h@@7dR~*C@GVH9bPHo@K{nFELN^ijCYQ;XLNq^q|ZAdG;UY> z7yj)T54L-~<*q85t>WG@_0-w!Jhz$v$g?NSA(AGJaSUK24kyaZS z6S~$92FY)>vopnp=HNBKo3o9wadS3{FW-IFWY1@M*ztZC8($6|w*Knyw!^q_A0}^K z!IJZ~BZSs>ypnPRAIOfU2cF#Hh|#6wKmeNXc@1bj)45FYd})7AS5Irj<+0)MEA7w9 z;{q!V>}vWvFx6ibxa-0DGgY52e!jR^{_xqK{ffq#$yyYxW&LtQHK|-9Rce$x@cTjM zVsxJwFf3HaI%mff*uFyUcxtuI#N~%=FvaJt-x9KELUuSilg6fj*J&1CW{2BnuUVa~ zA0BL%9gMpX8Ll=Ax4?^Au!Ef$QMo~EoNbc$Nl~_L25xBv_GzT`ULotq`@?tInERwf zoiN$oKqK$ZjHV}?E(|*%bajnAolvd5aPM9+n3u`K`BB*sZi$vHPg9I^zO3eV(s*6P z<+i>jqZzNp9O@`PkP+{HH1yM|R}Y{&^YZ&0!*?@g(2NA;Nu>f?BnFiT=PaItB|G;> z=ES5--_}esVNF_g15yalbVaU?7pNT%0zLHZS;BU$*E=+RI`!3C1&z7ahRpK z>^67a?SlKSP#s*HF&1pR*V64E>CHEd4hGng0vt#VHs(gbdaDuOOh^`MNzd=m!v+HE zD8L;$$e(PpUb_?ffUI4~m`-tb-)a3^iqFny*FrU2-4a9;t#C9k;pssL@;nVoIwGi% zl%lU(+t~fEGriI;9f>>E7xUsUD^%%M?jP^nG1C$8hyTo9fBntVmB%$*#^H@!>>f;H z12$xXjbIXJvXT&*vtSJZW&;HlM}#`=iGi$$h{MWFXAp=MA{BH%fgGiiL(Iz1C`GbE zR8Uu>r9t)Sdxr(_A z0$UfPC8dZcl(ZzN#zR9#%1#wA=?srh4F{cOwo4h4=Bf15d&YWG0|S{`x3a>Y$-p$H z8?=qwpyaoDb@T%dtae+y_h4!S*hBKvy(bTvOs2lsMYIgp4JZ;GI6d@13nO>8Ihnw( zet+?si)Wu)SGw-;xWjSUEtS>#FqvK15w)%B?&_#hKb82;|NZwLf4z06;@zoh7cU(u z1iob+KlIu0fm1$Rst>+3>tN^bI(ha%i^i8c-a}-fMQ_l@CS3MGm}FT zDxgbhRgF$nmkuAN^i~pCUW_u9hD{{YGkFvymndb|OOvE9c%U>C0voo@CbH`JYyqE7 z%S*2CEYRyKWO)@8%8G)#0=-IQsxhgJs9}m~dUI5UT_#zrsl2nc`@0bQVt8IBOba)c zwHV+~a<&1XMEP>;%lS3hn4{W`(k-Q>>(*@BxA}#2G0(>Pw?tJxaO$VvkN*7g?>|33 zG+_Va=g@QZm+}uBXc(M0^6J}fUmE&uMab~b(-&!1cwxpKmO9=0;@?UnC8JJmX1X`b%C`tvlhL}z%z@rEp7uuDZ7 zo<$$Gl;1khlF5Gfo?GK1HdUIjMwb_wuBu7T)bOZ~Tw`L;hv&=lkuZdzzQXkZ$$kOC z$n|O2%Od>He+ zohpx~R0@=t*jO32zFt~Z&u0-Un6P*$5f7P6p=*2yOmdP7kqd<;9*vs97ZN?`PQEOS z0NO0yRiEsu;4|cWb#%HxohH|zLm`Vc%A-{V6Hxle+s-{><48G?%;1a)tMU&70hT^} z43z$k2jSn}*#(yY^;73UVfY7*$tZ=!MTowV<%pH|F1s}$2=HwIR1x^e{OC0 z==YwU>9-rI4wb}6dk-~kZ7eEWud(0*sOyS8&; zc&>Ms5jMW7Hm9%#P*g$kGGWj%1|tX;-jz!ANJ3nPfAb)+rED@Y$q7btLenH^X(>V- zEmT0GS75%AEa3B4L{GN2CoO|U#ZW=`{o?SzFtIpHrVtzC^1KK|pFwX@mk(aXnP+7! z8oRT6vox9u^V{1bMypCAsl8zxw9* z$7fHUzH+7K`1Y^H9{#jzwEEgW|MluLNK{Q8PkB*QTBEsab^$1(E8@Ar7 zF7ND~xl@e5>WnXlzl~NL(oVkvRRz~ZbB}@73dU#flck&A*xUi>(3tHVTJ5%HgCE_p zCU?X3(x{_x4}NcSH*R!K8P!F3=#l2h#C*M{ zx4_$r=HM<%Wf?kF*Kfs@hPs9Xj83f#Uj=x8$lpTJ#r-uU-IhES#r%?&+mEGiN| zt>f3^g$h-n1)&8TPSG+lmm~r^)Pv#bL4iUxh0l~S$xNavmCW^^Q?sF=>cU~r1+FQc z$pWf`&vj)$Zr9h7%kbjyyr_JyVCyMF7E3_jQRyB8 zj#Nlbqthidz8Z-rNuuG1D3Jkv=)TmG>nRjAJBdiFFJqL&l9BV)ds0$(z-TEzZorgx z7evP@#6^4cM!8xXT`up_^_lAA>T&~6!2Y2d-|g7lT$nxS_JG^Ty$2t<*l=Rgqo+3H zLOc|rO3w!G>(Kfi-Wa@YyW_!9d=bQjhaD%6o~-`%D#l&gfW#eWKh)6NFol=@L@7@<{w?&jLA*2zBB*-$ey~||AJ@Q%<>a}Q@s8j`f z9XNn|0fEKl)t9lU0u~oyYAm8hJ(Ec!N{P7pJ`9dX6tFXtK$cK_m?SQbz~zH4D@mb+ z(geb?ydZairy$5PnZyesxeJ1}dMcFqt%|%%gDgxPW&rg-A(NS8261oi$c^K(0H*v# znwkzaVI1(Tu^wnQtSxyorg}@qzK(71aSKmY#xHE{S}18bdb1__e77nA1hADi`t7&u!?%Zj`)z6KO9|{!E|=v5EvO0AUu!;2abZ;J!%oR}qy-Fz*@Pb{W6cI&AVUi?h!Dy01 zDH`aA)9C3W&U(6VXAXTmQzFbGpwZ$*Lr2Q%{&4SSFbR(_st9-3y4p=1CYQ;>6nTIu z4Jz9=#|JL?9Y`Md;;Ge7J2T$Fm#b791N(tK;HhP91BF zIu_pAbk zS-S(1U)(zGyJgmX&TgtxtI-lx$z;Hv-Q9Ii5@oV@JcKS^Ave;6;RE;0b0zWp7#hEH zjt~*tg(&rK@%8g1Joz^3n4M9Yxc$keSe!`>p3!Pa!G>b%cH>%*z1Klykpcl7wEe`);MN3~k)xMMy( zc)oODzO*Z5Avf27F%E^};Dsq66dVdIW~+H;L%U^vW1@L~R^oe!AuC?lvGSKshgYCF zFK%3kt3F<3o|+wAdHc0R@csJS+}vybb~=ZLC&zmSdu^S%U9~!tl{$4@C?b#&Ghc#0 z&sdr_i-+9Yg9y41)rUl<`-;+bl6(S0bQcL-D9TyyD4&vr z18HC8cCGOr{p63cXECSTv1NXrzr!C9E!P3HfyYj@mUJmnqocY88qB*7Ou^dQ3lSX5 z2~#0p<~3XoNf<0nFyF8@6gHb18bcCS+SQkm{W{N#&)vK7<$LbAetUXwdUz#V-1U%g z`|qIqcXroxmm6yhIw?(H5HLGL2_)6*Vb5Nmm=IvvHZTh zvIp*49vybyeXHd!rrwo$R~X3Rtvv%6Xd9R~5_D|MT~TWHJVWZ?f+${KVeVR?mfl7 z-0piizZ~=@>l{q{-a9kXgPnVZ?u0l~8vB_cm1muL$X;%<88P>x(&_6|>FBla^}?JW zjy{0z?Lz|-6z9z#ijc=ZFx`bK(ulYaX(15n^VyhgBqed!n0;Y08H^n0!=q7^EQu5_ z2xU|VchTxuWs5P+J2o%Y9kC-EZ3%qEPIOqRTeL#av^ua!X=oAyyMZXj@hZu;S3cQv zSIdP*$4+gC(w1ob7fRwC{>Qc>Y0q6a)%EBCUe(Q~4t~*}xU;#c%C8;mR15m{K-aAA zCA`^aS&`Lvz4+c6{j0Ke?Hbc2 zd5&>-&X}SuLI$f=DBLqMV#B>-Gh&&sEEXY!$q|yXef@Sy0wmmJWQGQOp>!$R!wJxc z=yZG`0D;S)`vzpY?i7+Dd0bHtTObq&7+!2HE;|Dv2g%7n1VNb~7AZZ-S2(<|5t-HlSzI(7e0Zj5c*b;o$Y_mWDxVqO}v=Zv56rL1F*J)No^O?Ik0Y ze(0A~*2(gkBDL6PFdR<+tqZQs}x>hCBz5#V8BBqIu=AgDw{1J z2v})Mz9^K#$qrZ+8Q?34qz3u1T^NxJczcnb$d%3^Xeb^O3Q-^-5;+7egnCFkBC1va zgF$2D=yM8WLRyeOuY?;>gsJ6jXhALCyF4t_xd7Zm;N#xtgO4=zoE~W(Go?QA(Abx! z$DWFUf@pk8+@_lg59gLdJ#yjZrlx~y@4HK{?;0rF{dDvG#=`61Wi&VMPq2c3idWE> zXjy?9Uwr%Wg#F}QDRSE`paQtiioV&91f;A6gTZ$2xs!8tOLOD6EmIa~f>Odcl|C<1 zta(Ps$gHSvqn9aJK`8`2bhU&OK7~Z(feR~QQlxBbkEhZ2Nz-<6BeNs3G3Vy$=i=*u zP(X!NIFm>&i*@zlk6i_B}5 zZR&JE#YByX|9p=6t-B>8@SXF1-+OzW=l%GjZ_nKG^k2|+$3Tnji;p~X@k@L3;>FtP z?aCs$YYT7qR-a#f7e4K-xh|aY+*DT=>e;yQE*%fc`2JSKoTVw+fw3cr^jfAZCa^X6)+U@~PL)O)#Ma@_ zk-BMk#wIB@7&nPzav9!lP!c4N$Tum(0Rxg*x0UOz#uw6zVCQt=}b3M%P<#DO}=^wwQJyno{aG_O#npRTrR>&@&f{mYzm+QQUoCqb{!~0gC_;(m9y-x@ zGIj!GjuVlcW*yquNi=Ex;gtW~ptjZngsWi%$)zqL6%*92e@$1MtIBvKBE3Y}7+ zCirS2m?6;8KiP1<=>E3G@m7(8GE$-Vc;Yk$jo3gW>%@4ol@>5WAP5zW7CYKcf$jR< z`|n>?UHKmCHSVjQzSn*G@!O9)a(t@2_srzo4}?FYQq|1xam)5XR}N_pkn1CJBW!SX z$Jx2{vj7|eQZWVCec=mNd-J)np8?;hx)|;Fd~d5vQRQ}~W1iaHDOZ?gv(8@$``_O> z+M6~Hj`lmu;nOM2#2pE>O{(_DiMk@Xf=_1Lne}RlWv*C5R__yBoFl(Er)B; zb7iDNA{O(SR6=7=frD<8RuNSpOPt4%fF5O;4w1YtkEp3T-Ij3H&euS(7L6zf8iL(# z@AO0;=vcy;pLf~jPfhmT-G1uMjkmrRqpR}PYu~^2^N-&>c;>Hrx{n{ZxN>}E1yVoJ zUVAtyDpq!{?OxtL+}!y6@7vfqHXuWN=q(qLR~9l?rg96Ffhawi_GY7C8HPNQ2?lh& zbP1u<#`fl=3XLWxy?yCM_1<2^6LP@0)j1RmpmZk3MV3epGE?NKD71?S4#`((b*+fDY-!8hMZ_H9$>L@8byigVrD+5X!j{F_-7#D>IgePfb`w5sTcy0i;qQ zwtxrr#A$XaL@UI+TE}ZdI%S;)o{cGbI%aEGQdsR0v^71Mk!tV6Q1#~RNlL>SE?CkPMOhGRU+#i zf1)ma;=~ET6DRrnNN^|}% zzVo%_9w8BSG>juMktjF{u22BBu8OA$$^t=?P~-FYjP8DGM9kyFd_t*If+lmos_vKh zcy1F3B0pgjNM)ibC~K=ZgqSbm%k&n#$xBA+rS-7;L}NWVG7c!9u%gO#mI!9+)X`BL ztxI`yOgW^}v5=#$fQuONx!;(Ih{YDu>o2@H}ZlV-Ij@E;vLpK`idVg2^v{@m5g z%Kq8)&CM@DDF< zz7YUvOcFgup8*vH-XFIjuocFj%EaXw_;LfGSF4js(l8z&2sW7!iR#deX@-O{jd=s% z5XGy(ejT=U8&t%jo+xhkB31M->GbB=97sZi!qfs&w7q47ce%x`!c-=Au(zfRhs!RHISMnfN9|AvSh9QI zLgv9kqv*u;SC3WV8{1oz-QRv-KL7J@^S4_+EiNx_?e=*0;>}M8>c&ZZBx!ZKNrN!h zUlr6=Nn?DmSR*!wtsF(hs}>uR7>FPxs>mQuC2!)gLmdrLq0GW}TS%Y9q>fFitvqDA zb&wuB(a_WIgrm+F4iTY72jy^eOt#dr2H#G3pvxCFqjZ7d6?$>m&9fsJ@PRTu!|>G0 z5yR_OED&gcud96B-Tihi#@;=!vNQqN@kw(hV{U0~on^ju8*nWQxu*;Zxi=&W8*SlY zI28@iblhz2cbOF~nxb3`?SWt{)9xyJvfG=0bou>`neDAn@3hY`xVw3U zh$x;sp*kT|#mSzWAy6=glPW$J!<_^w+;MV~Po|N;)=2ak^!Y#Uo!dvFWbrwa9G{W~^2>PbSlv zFw_i6n;ENtE0kmQlTfLbgX_!H2o*+!+ejq&GB=QB5v8RLvsxS5+A!Fyrg6BgXFMFH zU1oD_2Oa_>rEN?qA5P^%-n@5g?B?phr9PGn$9AJY5EFSmy&iOE|&5hx!Mn#pR3Uv!a@LI&J zq%tWnka{am&*A6=$YGGjYr*d3Sw-X4NMtBtGVzjDiJAl2A4e#CMmP@VhMSHjs>7(a zfdOZ=4TBRCE(-4VD*z# zNh(HQII#jfxCV$lxmp3EqFpFWQeJ%0*)b-aH-jFBrw{!67eD=9C&%mW>RMmyLSDYx zGU~E7uF&UuYdh|S;_p39XKxz!cadt_e!P%;ys$X3Siq-{dv|Z`^R4UKlv5Y=z%1+@ zT=GtEO=+`E_iR4xW&D0Bn{tHE6v&R2E?+vlus*jxT%P;=8c3=`R_hG-OECfjW_3T= zPg;3$4PWj9S6>^G2@3&;uJJi?0}p3i9MniPY$iYC)9}bDkya|#i?t@ToG;`^)uxmI z_r0}0E>h|e=s%+8UN_JTpo+*G3h7{s9Xe-iEtO5{vi|YWHI_Q?EVjRYlif4BmPgLQ z>T!jYoavH1)lq^(R`gDUeRmf<6J}Q%sy+8#&5c}n90w1sFlQL~>ae)GKeyxYhIQVW zM5?;lHjhcXY#3p4MYAsa-w~oxgIO5BaN_eDxeR=1;b>>`X#JL;rw2bO&{FOs8Plo+ zQf{0b0zk%MrkFMoAZ0k}Ds99>YV=Jp#5QhU@|=Xv#ZCq6h2Y}~v{g#uI38C9Gd+1? zxC$ZScSMNwpty_b@C;hpXh@0M=J8`B9OfFjCdJSc8gY=zSpDkxRd9?B{(kH~FyAZa z!!CB+(RY0VCw3lF*H)a+s_dP(yBjiYQM>0QWGBDP}(GzkarYYh?rCjHA)TGl%*)e+wBj>RD%j*Ti5V^v7;VTf=%W*<20$3;%Gm3?J zlOzc}HNCV-5@Z{VVu{9@F&K@Sq!{pE=*Y_50dQfE$BVg|02I@OZaG4kq+6^}6Odaa z;N4*RBDFMvo&-k$qj$7n?r~y(mA!#SccmE@n(Z@r?@Sh0#npd5V}rQr{*_Z;0anYb zz`~^xqOu~w6uZvjY_q#uEr4TE@DPxe!51$Be#O$n3)lA2X5IF}@-CCWX`*d57l!%R z;Z1A22%siHc0@IfaJ7wULx_KQe-0;v-TgX#Eza%iPWOA+R(gyinvjheG#rglD}f(Z z3%R(^3`%2wi@24S(aVw?+yN%ORm_)T+8GQ&#w!ScAhd{^xTFlqd>kbqtJ4}S2Eu9) zHPqF&wY56f$(V^SokFQ1p{VxK9@-YxnE@;UGI@0sTW8mP9~wi;iw|FTcyS%OpWDha zB!GE}Lbj|Mt%P_5DQ1P#h&Nt)6 zYsY*Wlq$jrue!#I`b1^n@eAu%7ykc^KexUDqw85c*)LNf<(4b8e6%5CVw7xf)$xg> z*raWeD0qA$8NgeYsPr5XnuBhAl2m3C3Tu$i5M;Qi0Dw7Z4`kr zK!kKcI^5`V=&EaR--XjUGt{nXY&Is%i~`fK%C3X!7w)*w*N2}5O!7PSE8BU*qzLzm z9yTy#7d(}{$fQeYJThz@3r4@(_tSxYaOTE~*AMbuzc;R<<90e89S*r@q_1=~)la(+ zEhBjy1Z437yYMX*3+osDTd%;wtv-A1Szl&I4q(PF zEfa`Qs?cOepMfMn`inQ25X%Y`G9^c*!iZ|fOrsnrsy_+8CQ_?J^}@Qk`V&esWcS0T z?}tq7zBe1wRm3u|$%YjJCjVH|9;3N5W-KqF8E42=ZL`tE!E6Yj>*y#N ztOxrnIe#7d1ylY1H~-jeET0hs<)NYB3<->wMr?v`a!^22srWeQZiyRmb9_~VgtnxZ zBr{grX2{mH@*vO`$tGEHIO*o|2m&U-=gZ|nk@}=sWR#?o1kQS6Rr6_J>RN3;*PzMc zBv6-z;+amD_QO>FJ?>bWM}3RzT3*Lz%j-{%tx;YxlP(YX(_z*@+lpx_no6g!^|7(t zo9ve^!?7*w>ZZf~)w184&Fa9i)PaXVowqyB!=WO4s2U& z`}haeZNGrI%5t+oc4C7%nM}q<1xm<^LtwEd5X1$57p=~iK;qZCwI;ci-^7>mtuk&V z7AwRJG6fF0M#fVK|EZ!VJQA7~*Am03C)o*upc9*$){oeO`@BQBUy>GX__i|0_qxU@A z`VA0BaO}62r>6&Z{`>$Zf~e+$r#`s&q;ws83sR6>2q=JcnBErJd+5`V>8+qI`1Dl_ z*f{||eGb%Xgsqhn-L_CnHaWyFU0(N^YZFz~xnwL((xgBg6131ZdDYSl70^e|Z~^jp8?99- zf+o;bJW~dCD#F$h5hBYll9cI)w3yu^67@um1tC;_QQQT8bOYyu(^yQQB0NG5>GIQC zPle|QpnLVzPjSd)tqT9Q6S7TL@bj8eeFwdl;kI#8rmG>0H)Q1Re7XuZcm@DCo(4-) zj~klk^ma<#uG89G-MDeH1!KQC4FUD&;%Dp?JHEH)XYoB;e?Y|w1?$mx0Y#^vrX?fQ zqtl!*Xu9KTa-8C66UjQsg?C-g4=l?9&M7uW>frFAgi2F-(J;6HYLNs{iKeJYSgK9T zr8&iBscd$mg9nth#gMSt9-+@-G+Cmz;TXmYls`pZ%h~y@5ASUpD(BB{?BLwo)vkxQ z{~c{-YZvRC(#}XL4@2>2Yk4+Z{sKMp;mLPj;_rTIhz$nA<8XdJ8Bn^l9$qe|wKZ*M zr)Y?T(sp?YY4*jR&qA*K=dZv1_1Di2W9#AGANT_&9{xUB9FEa2D;Rn^D&PT(SI`_T zHwRsKZK@c>u2E#hT}PFfE5y=dJgz25lgiJefdM~=dr{z%JV;$?u5*CIL%bP=}=a;KtaNQrRra(og&9(q=AOpm(RTIf#V|n{_C_%XR z`Qbl*{R`#Sqn|GR{tGQ;5cB>T+WP@8eu3Yz{Y-O4xs;NQPnuA1Lh(UyLScZ?qQOwa z0OfT)Miyz3)77F%(O?+T_sbt};bLcGGDFtfT6E1_JCKFSmu+1pR;XDd5=H&d&L zcqs*s5a2dyVZHZYxI8*IJy?Eq=ZQC-1E+rZ%iS-ukIPsq*gLrU^_^YxnqS3XLR!)< zjR1|SRqICS?6Z$P`R0@BH~L$3q z7r*`S=bx`09o@e5+fP3}5N`eFyN@5e6>c8eKmBD|w2;NP$X{Zr8Rf50vTWwlF(xnB zU~CD#kkl#FQuRE*zI{lMvo@ut^-!PndX7}{r`J#6M}Toh_aw@% zzVPaE&mBGYI5a3vUHlztxc_+Y=--V$fsrJ4ep)WnisfZvYt#vXdL6<(I$bmisv-%D zO`uoOR%C@UY+)eKFGb^AnpTTNGuE`oLDW!r-t&??i;@h-`f`QGu5-`lG8y!gAF4DjR0kRMZr@qvaw;kP1C+&JGI({(3E~=Skg5 z+l(=;*n%2Mb_oflPMh5Ugn-#ZHkFOU3n9$0IjK`ACjmQXGaKY z?%etiQT62)UmxGRQG&TwtDS1Kj7Je+?8x+9Tn|rk2aOq>P6q)&38~61Dwp^k{;)O* zJ=(}&=JAcncCNjJ(q65f(`q%xA32bghorz0w{hKHeeRxVFYxE>7cMU^PoKb%W9!XO zzx>6szug{>Ay=llZ9bXL<5n}Vg22rXttxSvXdVs@JsIu-`&)a=O}WRIeOAR@%9G<+1wx4{g0&-FdHH#U3>@gCLH<8@TB09RkftxYpb7 zgIDWULwRX+jz;BNVN%KE_P6KPM-V9ew@y!C?>Of%_USGU4(@)t7#}T;76%6t*!x%C zo_~D6T#HeraN>K>sMl*-oJw9Jl>##`b(0Vj+6Kz2a*QWwb<7E~cH50c3rT{@>*z2{ z32KVryL8BNVwwp@Nlm_zVY8vZ1L{Yt?>iPhvCzC#^H$EvIreV`r@vof>p$LUVAe}( zRc^pi{mzbtG;F<&Q-1{M>mztD?S2ptRdBiZyc)p3N4K164UoBAV-P1rH}{BoW@BHh z?>!x^{mnW?=P8r9+^~Eg%OYF{;TkuWFQKb;arVbwf#tdjkW<{@?Ci&jPY)Kcq9CPa zi8c~5j`P4srf6N^lAK&Y=4Oz#>n16~hO(P#Mp>av%5BC-n+j!CKzD$++Cgh>D{SRyg&fsye_-o(ZbBW_DpxnJS7GpF$SF{| zz&pR#`Mrf_xe%OUVaRhCugtu>D?(az72qkNBO8GuRhQ;_Jm#T_Vou!KM1?a zH;}Z!WLJ~c)L#r2i_vl<24F1Ce|qEHJ70h}L_=G@-$DK{*N|?n=N{X{E8&lBJ-WO3 zc7N+JaZ7_veib;Hd!<&p;y7Zb-`^CsH|n_^dMTx2e32K}!R{H+()Oe}DPz-F6(zYjeEdl^$kpscN30$e0ZZPK^~6 z@a)21aOfL4MX8(_L);S?FwL1ODAyz!t>e1dmQB_~>PrhsC6$%3y`CZa_C!HYlj-O7 zYAlE_ZwklO3be)u*wn%}-%o%1;KOG>Z2-A%0LXTyqsAy0l}BQ~ysm9uspFZ7^7>Wa zeHf(y=5WzR>)Ya^b@3r>Tg-@&TneEb7&2$F?ztd$!MF?VcLq``uvZ}K%uAEWVm=8-l#|wg*Yin&Mq?daA$SEE=()TW4@=J343&{s#}A~& zy*URCu(wlNIhug%?Y9r#ci$gU9pz58+YW^{pz9 zZY7Gl;GH&iVC$Rv;W$jhii(&KuB2Fz&y3g&tlUOve}6yq{A99x#-A0erWN?hMH2=O zg_kWi7nUx&NYavwKpFn{`?E3K_GDfj$B9^)_GgwW@LW3S@j8*`p?5L~({!i&6CNl3^kx<8S0G8(+tSyD5tbJO3o%3)HK>lmIX^kWjQ-;rVwesJ@p$Sr{@hV z%UL!cL74`~C*M6EPMzbDgj5SI`8q~-Yfwf$(g(5i8s3lYzo*sj7eVH?MlH+Hq$^@) zd*oo-`?>u(n9pr7ThHw5Z{*P2WP%Epn7zzC5Z;-%!D0f7p9PDtbvTADbul*l1@8Dj zE)-0@?dyUfnZ7Rw7G&y#AMd$QQgta$p4f8CZO0-M4JEUU!c(!yH3x<+I|2h>i^i@+ zT+e_JA!ubN5*2xp(IpTWN=%_BHu1_N5*bj2HJ{AUNvCzfn5SV4{YFsr8h!9aD25!I zfB4~#A0Hq0!)~_Px`&X|Z(Q;EAl2AXsfM=t{^pKWeOj!C>WY@^^u6`|_KV`))4e(l zoXPPWB#C^*scndxn|pxwM7GNoC`rhyIlW%n_bssOiohEK|73h}B+H9yNnQ!8=FIYK zo}keY>bgwNx5m~$kldcsW?WTJx?IJkRLbNqx}i&OwhrqVOhDe|i*YVmk-PFtYQqtN zsRY(jN>>$BicC^0#8Ujk=sv>}1S`D~N#IXuUYX2&WNniMme+Dtojzn{%ex=k`gU=1 zQR7>UPNy^ywd*Sw{Q7IJq1_M*I#Iy;I$lq|TGcQKM%+U6w!B%@#Lj#)8cCyQB1ejQ z<0=pyA=MngBL?Tx_xBPKV@$?lO844|tEdJ#95GGokSom0@R^4q9CKkjwr$oX;+*Tc zV>Vjwe2Dv8zg|=2gE+Mq>V7e z9;mk4uf5ja-0EW(hSq3iOrGjA_@**rT$s~2i$z~T`8hdku`i&%`+tj|qYpaNs3l z(WE3PNLyzzqY|?w*-Yk(BnS+l;M+akgwiz&}U@7Q?QWT}=tit7$bRukmqULN90$RTVB`UY5qa*s9xR2McYi$hM&i~E4prOsJ0oRM5gWb! zQ1qOtr-hFfR2!YGRJDUlESQc&shUf?oQXV?%E61XsZ=(D>ZVuQ$Pl@DCYS3}x*&^y zJM3PD@dR`XFrEk5`Qga{R2*cIv7&83m>HB2c6}FJANu7&P#6pONbwbD9nxxEiI{Vl z7u+_vM)6UBJ0y}S?z#}|mG31xwKz`?j_4Pw@qY7=BM-ELyZUMi9&72RN?G;3QrPtGA&PU8d(y&|)MAk$G2 zF+6AH2b4AI>M=3~^(Xq~6nM;J3^NU4#U#yBf=#FbB(Efcep*U5Q{z;HsnF0&xILnB z)?9{Kai1NHY8`3R8_mzgH-jTopT219=YVIuvM81T@uNBb3_)2AacXTlA?|fHLt0Y| z|1&4To!7TSQ9~gohkvqr8{sUpST04Z3E?MSsjv)~;l%SE%AMB))~o3 z)-nhtN)A!?Ry~2|^dzmsd$qZg%T+p(S7n_lsLhc!!jPY^bej}wUO9s?{<#_gyfu@Ev4vb2#*4xizdX^%)ETV1Nvd5URB1~u=FVlvTqmOFeA;7=$78UE*t=saXJmvTiqJp-X$Z}_G!jXXl|a!J2(nN{ZxIp&$jvK3 z;@@(d1q$v<#(BRM?|Uh~`ugQ-WGQePH-yKC`)cBbLf^fISFq3S zKKb~=4-wF-xI`MU_3CgJsn2;9l{m9`KA?=uuAhGWvic(eA{ z4`~#gyc>2eEpbw8IVmg==ii33iFD+kj^Yg`d3-Q#vqmp}e0=(H_@SvDpK*!$c>nNz zh8t7-^2he~@1MVTzxd?-^ZK(-KF2L+K8nAEJ|jgTPi1$X!kb@bHU56T5I%#fe+YxN ze}fpf`?`4fVe`@)p0^vm(S?l*Nc1>rV;*pQAlqKjJ~}=cGdbp4pYt>NuH3f?lZb%J z3e^rg{5tCZRIa%~A{qg|47p`BCO^PkhIAV!b;IiESt99qq_zzp4`Fn9x+I zBp)J%|3%MQVoz1N9iH|?NGqt`pi0c2t2CyjE{`v@c}e;G;qcStx9#)OSMMG_e;41Y z_?!aJx8HvI?pG-IVfUZjEr6Gsqd(l;;u_Fv4Bvc%d&OsqmaXa)%H-@NTiLJc`h^yX z zdbo>>9#4yxG~&4x-VdcTG>^dWq?!z+~;V$UdQhi!-Wo9r-Q9N z|K=NP$SRHs1XK|(zomaMvVy;bXh;#`Js$4{{v)cqyEvoHw#p{)x^MRVunsPlEZ@E9 zFYA-s zxqI)E?-n7i@38^cgazBb&$zCSXoK*jpab>QT)(qU@V(=;y3OG+0&9J{2~IX|hm(b2=8MRE(@kPy}(F2o+qxmnupIO&6Evx6WT-~E0yI-hH7RWf#`y1iEx%+g9`5Vta1?`uUU<6zYuh;Qnw5~VD zto}61ZeB+&*%U>gNfbp$sFR6`JO#aXsdYq-Y3}n&yM7Z`+f`MUKW%@!ti^K@#UVJG zd$TJ@KTW}Cn>_EDB%=92g^=?#@x2(V?a{bJt(hvK8|l!YCqxG+o#*SOqq2n`8_C#^ z4;>_iYzXHdSUf-k8$u!~j`N(YNKKE$0v*5S<3qDRN2wL5&ft9CKeZ5|dgpws_GGhEoPujA;bY?P0 zZOf`I?(He@e!n3ifBW@f{vaML1N{f7;7 ziu|@ui+gm|85j+;48AnRtTg-zS3hK*!o#nYEite>Rtwt^)DZ}@i6V68*a|$x<0BDV zD99Y8)(Xb#X~LXVhQO?)v>;4*-(8}^o^>6rR$O+;d8kTBtvh(p(H(JvGlw~Q+*Kay zpAtnFE=CM*8YKNKKSM1g`nKiL#g(?2vVv4mCq_x7c0nPuP$rzfJkljq|3+{wMhA^0 zR+54ja3C)!jpGP@B~QasTGUH$-!1GOfnkM5gkiDct3lu5qBbToc(2G_zvfuP$7MHT zQDC6Q@vCKS!U)WAVxfGeDMElF6s5C>b!j347WJPp4L##x_sSWaw>=dHvAUeeFD*#TiIR&DsL3(3mJNkic0@xc9BCP=5XOSI@|Z z1-2^QC4PhylQ=sG`=)l0<~(4#4v;J3P}2B4BE;?U{%i)FwrpnE^-Z%oWV4$NIiZTU z&@wtp>ilk3@`85~6`Y0?Zo@sEqi*DS7+f@~s9 zSLGu2uvK=2-7Uk6C+y)qzQ5@}nSxFNpbL@RUBMO}ixH>Tg48uiC8|`jF%#p81veQ= zly8F*mhhd=&zr;g@K?8f6ts|?SNxE_iTB^x}tLrx2Nn-?w(nPdEFv24!tyhdyL9o1I!nP5lXY@qM1v-L~$JEeG z_gEYe#4cOvk*mm#6tEV-$5kf8Gr}8|&8DW=JexV2R|Vb!cDPn+3X3?BxQpllT}LDV z+xf^Wfy;6ygya(LzzK&mWm)UhroXh@SImMK3N5yWzKPQ`MGbS8&BTo6Rz~5lgYwP3 zP>uI|Pu>hxczy3zm2$9i6GdZV?d)bpgo`&X#p8bDD}0 zGTU)!Rx6#+Xk71_$RNwnhlSV=={@?IMdmQTOtGl-t#FA;TECjjU_ig5bOWOnLuO`C zj%@Ka>f1;(xnG*`nM#KjmTJ9pFG-Mur*HTBU@hl)*Qtn%p;f!C+%9rZU&pB36Qhl2 z0LQJX)=zBvsqfOOHWdCK0&~s`X4+a zNklAA1HZ9x1a~BoX4y*>(He=2KESRI_Bv zO}HKBfU|~1NdihUCL=0k#h8%77zwQrl12#Q{_^JW(F@;oETrH-dx|2%(abf%0mW$M zGF|6P(wX=rE%oc6iCWo`wr3Z;-66M`XrevpqH7eWmO5(k#L3x6m^)4qE*C@z)$WxF z%0pkfrh&q=*4oqy5W{FJ*Tii^Gl6glYr2S*)gb z^9Ehqju71?)@5)}Btw#%#!)6nZcY(!KRD?GZ)~^gd7CUxwP;W-tO|m(QahFo+olkj zGCI{=!nt%aBP6MsCK+r;c+dY7jhqT*g{sf9OXjP)LzZMNrU?AmOok{)4T)@`fHPF8 zYV+0-+aby<#Lh|0C>BfQ0=-t0E72ttv?2#Z$@KVo0|dptBKom z3v>mj3&VgIcXeKGY-ArdDSJIV?6g2^iZ%4%VmXac@YcUt}E&?3f9K0 z9+)o-D-v9cT(8O7OUS2Z&fvD?`w=rFIr0@!YQ~hj(km5AU#FD`-cHlR6pAJrN#1*} z+JZo77-Viz3k2%SVodA*pwF++VgEq~?8UHjvK%5n7q8GU0ev;L%(g%WLipA?Bw4Hw z!pm@GA_igJiefrmwn?8Scz<7YjdHFT1|^ZdRYzhwN$%s!nXaj>lhKTkP50uNKUz`_ z{!H?<8-jl>wpCP_2X@s7ul=1t+Qi0B*20g5GBHuRH11wN-58oBMIr))cUG#Uw0d2u z`zJ!pe1nb+_&;>0Hvlh~WdzNH0eT^D{vYW2)$6zE3=|&FC36;D4?#+8*sSR^P7~fI z_+~>o%D_4#@y?E_^IWw|AQ)}L3f4NP6D2L3qeA6L6wQ-zqvs;`)+V$kz6x8Nzljo= zEv2uGI;;Soslz8{ji84Uu~NA#lzD|%55#d5>;gTYRj>}wDOU84*TW3_sBf;>40#I~ zeT7~da9A(U$zqNWetQMS3!J~117wY-SdPGX#0VD#w?KEV(5ap*1y$hfA|6kHB|t8^ zG4Y)ejZa#pFmG#_pbj#j?K}x8xe!80F+=6mx!JS{8wgvIzf__p8koI;Ac8$$)sn5Q z8nhzwJn67xcq5pCi-oW~bd$9qEHyk7sC5pkkEH$=Ix_~CF$qSqKwr$*8pyF^0u!&$ zg?)uyup3^Oi(a8Kz1Yp`k#r2uCH}qtpo1J@C{ryF3?$__SN_~C#jYPJB?wb3!3>O9 s>SmKTFz#xX%2+j_#T4;&ea^-9Z+8#z7el$et^fc407*qoM6N<$f?|Tx;{X5v literal 0 HcmV?d00001 diff --git a/vendor/github.com/go-playground/locales/rules.go b/vendor/github.com/go-playground/locales/rules.go new file mode 100644 index 0000000000..9202900149 --- /dev/null +++ b/vendor/github.com/go-playground/locales/rules.go @@ -0,0 +1,293 @@ +package locales + +import ( + "strconv" + "time" + + "github.com/go-playground/locales/currency" +) + +// // ErrBadNumberValue is returned when the number passed for +// // plural rule determination cannot be parsed +// type ErrBadNumberValue struct { +// NumberValue string +// InnerError error +// } + +// // Error returns ErrBadNumberValue error string +// func (e *ErrBadNumberValue) Error() string { +// return fmt.Sprintf("Invalid Number Value '%s' %s", e.NumberValue, e.InnerError) +// } + +// var _ error = new(ErrBadNumberValue) + +// PluralRule denotes the type of plural rules +type PluralRule int + +// PluralRule's +const ( + PluralRuleUnknown PluralRule = iota + PluralRuleZero // zero + PluralRuleOne // one - singular + PluralRuleTwo // two - dual + PluralRuleFew // few - paucal + PluralRuleMany // many - also used for fractions if they have a separate class + PluralRuleOther // other - required—general plural form—also used if the language only has a single form +) + +const ( + pluralsString = "UnknownZeroOneTwoFewManyOther" +) + +// Translator encapsulates an instance of a locale +// NOTE: some values are returned as a []byte just in case the caller +// wishes to add more and can help avoid allocations; otherwise just cast as string +type Translator interface { + + // The following Functions are for overriding, debugging or developing + // with a Translator Locale + + // Locale returns the string value of the translator + Locale() string + + // returns an array of cardinal plural rules associated + // with this translator + PluralsCardinal() []PluralRule + + // returns an array of ordinal plural rules associated + // with this translator + PluralsOrdinal() []PluralRule + + // returns an array of range plural rules associated + // with this translator + PluralsRange() []PluralRule + + // returns the cardinal PluralRule given 'num' and digits/precision of 'v' for locale + CardinalPluralRule(num float64, v uint64) PluralRule + + // returns the ordinal PluralRule given 'num' and digits/precision of 'v' for locale + OrdinalPluralRule(num float64, v uint64) PluralRule + + // returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for locale + RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) PluralRule + + // returns the locales abbreviated month given the 'month' provided + MonthAbbreviated(month time.Month) string + + // returns the locales abbreviated months + MonthsAbbreviated() []string + + // returns the locales narrow month given the 'month' provided + MonthNarrow(month time.Month) string + + // returns the locales narrow months + MonthsNarrow() []string + + // returns the locales wide month given the 'month' provided + MonthWide(month time.Month) string + + // returns the locales wide months + MonthsWide() []string + + // returns the locales abbreviated weekday given the 'weekday' provided + WeekdayAbbreviated(weekday time.Weekday) string + + // returns the locales abbreviated weekdays + WeekdaysAbbreviated() []string + + // returns the locales narrow weekday given the 'weekday' provided + WeekdayNarrow(weekday time.Weekday) string + + // WeekdaysNarrowreturns the locales narrow weekdays + WeekdaysNarrow() []string + + // returns the locales short weekday given the 'weekday' provided + WeekdayShort(weekday time.Weekday) string + + // returns the locales short weekdays + WeekdaysShort() []string + + // returns the locales wide weekday given the 'weekday' provided + WeekdayWide(weekday time.Weekday) string + + // returns the locales wide weekdays + WeekdaysWide() []string + + // The following Functions are common Formatting functionsfor the Translator's Locale + + // returns 'num' with digits/precision of 'v' for locale and handles both Whole and Real numbers based on 'v' + FmtNumber(num float64, v uint64) string + + // returns 'num' with digits/precision of 'v' for locale and handles both Whole and Real numbers based on 'v' + // NOTE: 'num' passed into FmtPercent is assumed to be in percent already + FmtPercent(num float64, v uint64) string + + // returns the currency representation of 'num' with digits/precision of 'v' for locale + FmtCurrency(num float64, v uint64, currency currency.Type) string + + // returns the currency representation of 'num' with digits/precision of 'v' for locale + // in accounting notation. + FmtAccounting(num float64, v uint64, currency currency.Type) string + + // returns the short date representation of 't' for locale + FmtDateShort(t time.Time) string + + // returns the medium date representation of 't' for locale + FmtDateMedium(t time.Time) string + + // returns the long date representation of 't' for locale + FmtDateLong(t time.Time) string + + // returns the full date representation of 't' for locale + FmtDateFull(t time.Time) string + + // returns the short time representation of 't' for locale + FmtTimeShort(t time.Time) string + + // returns the medium time representation of 't' for locale + FmtTimeMedium(t time.Time) string + + // returns the long time representation of 't' for locale + FmtTimeLong(t time.Time) string + + // returns the full time representation of 't' for locale + FmtTimeFull(t time.Time) string +} + +// String returns the string value of PluralRule +func (p PluralRule) String() string { + + switch p { + case PluralRuleZero: + return pluralsString[7:11] + case PluralRuleOne: + return pluralsString[11:14] + case PluralRuleTwo: + return pluralsString[14:17] + case PluralRuleFew: + return pluralsString[17:20] + case PluralRuleMany: + return pluralsString[20:24] + case PluralRuleOther: + return pluralsString[24:] + default: + return pluralsString[:7] + } +} + +// +// Precision Notes: +// +// must specify a precision >= 0, and here is why https://play.golang.org/p/LyL90U0Vyh +// +// v := float64(3.141) +// i := float64(int64(v)) +// +// fmt.Println(v - i) +// +// or +// +// s := strconv.FormatFloat(v-i, 'f', -1, 64) +// fmt.Println(s) +// +// these will not print what you'd expect: 0.14100000000000001 +// and so this library requires a precision to be specified, or +// inaccurate plural rules could be applied. +// +// +// +// n - absolute value of the source number (integer and decimals). +// i - integer digits of n. +// v - number of visible fraction digits in n, with trailing zeros. +// w - number of visible fraction digits in n, without trailing zeros. +// f - visible fractional digits in n, with trailing zeros. +// t - visible fractional digits in n, without trailing zeros. +// +// +// Func(num float64, v uint64) // v = digits/precision and prevents -1 as a special case as this can lead to very unexpected behaviour, see precision note's above. +// +// n := math.Abs(num) +// i := int64(n) +// v := v +// +// +// w := strconv.FormatFloat(num-float64(i), 'f', int(v), 64) // then parse backwards on string until no more zero's.... +// f := strconv.FormatFloat(n, 'f', int(v), 64) // then turn everything after decimal into an int64 +// t := strconv.FormatFloat(n, 'f', int(v), 64) // then parse backwards on string until no more zero's.... +// +// +// +// General Inclusion Rules +// - v will always be available inherently +// - all require n +// - w requires i +// + +// W returns the number of visible fraction digits in N, without trailing zeros. +func W(n float64, v uint64) (w int64) { + + s := strconv.FormatFloat(n-float64(int64(n)), 'f', int(v), 64) + + // with either be '0' or '0.xxxx', so if 1 then w will be zero + // otherwise need to parse + if len(s) != 1 { + + s = s[2:] + end := len(s) + 1 + + for i := end; i >= 0; i-- { + if s[i] != '0' { + end = i + 1 + break + } + } + + w = int64(len(s[:end])) + } + + return +} + +// F returns the visible fractional digits in N, with trailing zeros. +func F(n float64, v uint64) (f int64) { + + s := strconv.FormatFloat(n-float64(int64(n)), 'f', int(v), 64) + + // with either be '0' or '0.xxxx', so if 1 then f will be zero + // otherwise need to parse + if len(s) != 1 { + + // ignoring error, because it can't fail as we generated + // the string internally from a real number + f, _ = strconv.ParseInt(s[2:], 10, 64) + } + + return +} + +// T returns the visible fractional digits in N, without trailing zeros. +func T(n float64, v uint64) (t int64) { + + s := strconv.FormatFloat(n-float64(int64(n)), 'f', int(v), 64) + + // with either be '0' or '0.xxxx', so if 1 then t will be zero + // otherwise need to parse + if len(s) != 1 { + + s = s[2:] + end := len(s) + 1 + + for i := end; i >= 0; i-- { + if s[i] != '0' { + end = i + 1 + break + } + } + + // ignoring error, because it can't fail as we generated + // the string internally from a real number + t, _ = strconv.ParseInt(s[:end], 10, 64) + } + + return +} diff --git a/vendor/github.com/go-playground/universal-translator/.gitignore b/vendor/github.com/go-playground/universal-translator/.gitignore new file mode 100644 index 0000000000..bc4e07f34e --- /dev/null +++ b/vendor/github.com/go-playground/universal-translator/.gitignore @@ -0,0 +1,25 @@ +# 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 +*.coverprofile \ No newline at end of file diff --git a/vendor/github.com/go-playground/universal-translator/.travis.yml b/vendor/github.com/go-playground/universal-translator/.travis.yml new file mode 100644 index 0000000000..39b8b923e4 --- /dev/null +++ b/vendor/github.com/go-playground/universal-translator/.travis.yml @@ -0,0 +1,27 @@ +language: go +go: + - 1.13.4 + - tip +matrix: + allow_failures: + - go: tip + +notifications: + email: + recipients: dean.karn@gmail.com + on_success: change + on_failure: always + +before_install: + - go install github.com/mattn/goveralls + +# Only clone the most recent commit. +git: + depth: 1 + +script: + - go test -v -race -covermode=atomic -coverprofile=coverage.coverprofile ./... + +after_success: | + [ $TRAVIS_GO_VERSION = 1.13.4 ] && + goveralls -coverprofile=coverage.coverprofile -service travis-ci -repotoken $COVERALLS_TOKEN \ No newline at end of file diff --git a/vendor/github.com/go-playground/universal-translator/LICENSE b/vendor/github.com/go-playground/universal-translator/LICENSE new file mode 100644 index 0000000000..8d8aba15ba --- /dev/null +++ b/vendor/github.com/go-playground/universal-translator/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Go Playground + +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-playground/universal-translator/Makefile b/vendor/github.com/go-playground/universal-translator/Makefile new file mode 100644 index 0000000000..ec3455bd59 --- /dev/null +++ b/vendor/github.com/go-playground/universal-translator/Makefile @@ -0,0 +1,18 @@ +GOCMD=GO111MODULE=on go + +linters-install: + @golangci-lint --version >/dev/null 2>&1 || { \ + echo "installing linting tools..."; \ + curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.41.1; \ + } + +lint: linters-install + golangci-lint run + +test: + $(GOCMD) test -cover -race ./... + +bench: + $(GOCMD) test -bench=. -benchmem ./... + +.PHONY: test lint linters-install \ No newline at end of file diff --git a/vendor/github.com/go-playground/universal-translator/README.md b/vendor/github.com/go-playground/universal-translator/README.md new file mode 100644 index 0000000000..46dec6d2b2 --- /dev/null +++ b/vendor/github.com/go-playground/universal-translator/README.md @@ -0,0 +1,89 @@ +## universal-translator +![Project status](https://img.shields.io/badge/version-0.18.0-green.svg) +[![Build Status](https://travis-ci.org/go-playground/universal-translator.svg?branch=master)](https://travis-ci.org/go-playground/universal-translator) +[![Coverage Status](https://coveralls.io/repos/github/go-playground/universal-translator/badge.svg)](https://coveralls.io/github/go-playground/universal-translator) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/universal-translator)](https://goreportcard.com/report/github.com/go-playground/universal-translator) +[![GoDoc](https://godoc.org/github.com/go-playground/universal-translator?status.svg)](https://godoc.org/github.com/go-playground/universal-translator) +![License](https://img.shields.io/dub/l/vibe-d.svg) +[![Gitter](https://badges.gitter.im/go-playground/universal-translator.svg)](https://gitter.im/go-playground/universal-translator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) + +Universal Translator is an i18n Translator for Go/Golang using CLDR data + pluralization rules + +Why another i18n library? +-------------------------- +Because none of the plural rules seem to be correct out there, including the previous implementation of this package, +so I took it upon myself to create [locales](https://github.com/go-playground/locales) for everyone to use; this package +is a thin wrapper around [locales](https://github.com/go-playground/locales) in order to store and translate text for +use in your applications. + +Features +-------- +- [x] Rules generated from the [CLDR](http://cldr.unicode.org/index/downloads) data, v36.0.1 +- [x] Contains Cardinal, Ordinal and Range Plural Rules +- [x] Contains Month, Weekday and Timezone translations built in +- [x] Contains Date & Time formatting functions +- [x] Contains Number, Currency, Accounting and Percent formatting functions +- [x] Supports the "Gregorian" calendar only ( my time isn't unlimited, had to draw the line somewhere ) +- [x] Support loading translations from files +- [x] Exporting translations to file(s), mainly for getting them professionally translated +- [ ] Code Generation for translation files -> Go code.. i.e. after it has been professionally translated +- [ ] Tests for all languages, I need help with this, please see [here](https://github.com/go-playground/locales/issues/1) + +Installation +----------- + +Use go get + +```shell +go get github.com/go-playground/universal-translator +``` + +Usage & Documentation +------- + +Please see https://godoc.org/github.com/go-playground/universal-translator for usage docs + +##### Examples: + +- [Basic](https://github.com/go-playground/universal-translator/tree/master/_examples/basic) +- [Full - no files](https://github.com/go-playground/universal-translator/tree/master/_examples/full-no-files) +- [Full - with files](https://github.com/go-playground/universal-translator/tree/master/_examples/full-with-files) + +File formatting +-------------- +All types, Plain substitution, Cardinal, Ordinal and Range translations can all be contained within the same file(s); +they are only separated for easy viewing. + +##### Examples: + +- [Formats](https://github.com/go-playground/universal-translator/tree/master/_examples/file-formats) + +##### Basic Makeup +NOTE: not all fields are needed for all translation types, see [examples](https://github.com/go-playground/universal-translator/tree/master/_examples/file-formats) +```json +{ + "locale": "en", + "key": "days-left", + "trans": "You have {0} day left.", + "type": "Cardinal", + "rule": "One", + "override": false +} +``` +|Field|Description| +|---|---| +|locale|The locale for which the translation is for.| +|key|The translation key that will be used to store and lookup each translation; normally it is a string or integer.| +|trans|The actual translation text.| +|type|The type of translation Cardinal, Ordinal, Range or "" for a plain substitution(not required to be defined if plain used)| +|rule|The plural rule for which the translation is for eg. One, Two, Few, Many or Other.(not required to be defined if plain used)| +|override|If you wish to override an existing translation that has already been registered, set this to 'true'. 99% of the time there is no need to define it.| + +Help With Tests +--------------- +To anyone interesting in helping or contributing, I sure could use some help creating tests for each language. +Please see issue [here](https://github.com/go-playground/locales/issues/1) for details. + +License +------ +Distributed under MIT License, please see license file in code for more details. diff --git a/vendor/github.com/go-playground/universal-translator/errors.go b/vendor/github.com/go-playground/universal-translator/errors.go new file mode 100644 index 0000000000..38b163b626 --- /dev/null +++ b/vendor/github.com/go-playground/universal-translator/errors.go @@ -0,0 +1,148 @@ +package ut + +import ( + "errors" + "fmt" + + "github.com/go-playground/locales" +) + +var ( + // ErrUnknowTranslation indicates the translation could not be found + ErrUnknowTranslation = errors.New("Unknown Translation") +) + +var _ error = new(ErrConflictingTranslation) +var _ error = new(ErrRangeTranslation) +var _ error = new(ErrOrdinalTranslation) +var _ error = new(ErrCardinalTranslation) +var _ error = new(ErrMissingPluralTranslation) +var _ error = new(ErrExistingTranslator) + +// ErrExistingTranslator is the error representing a conflicting translator +type ErrExistingTranslator struct { + locale string +} + +// Error returns ErrExistingTranslator's internal error text +func (e *ErrExistingTranslator) Error() string { + return fmt.Sprintf("error: conflicting translator for locale '%s'", e.locale) +} + +// ErrConflictingTranslation is the error representing a conflicting translation +type ErrConflictingTranslation struct { + locale string + key interface{} + rule locales.PluralRule + text string +} + +// Error returns ErrConflictingTranslation's internal error text +func (e *ErrConflictingTranslation) Error() string { + + if _, ok := e.key.(string); !ok { + return fmt.Sprintf("error: conflicting key '%#v' rule '%s' with text '%s' for locale '%s', value being ignored", e.key, e.rule, e.text, e.locale) + } + + return fmt.Sprintf("error: conflicting key '%s' rule '%s' with text '%s' for locale '%s', value being ignored", e.key, e.rule, e.text, e.locale) +} + +// ErrRangeTranslation is the error representing a range translation error +type ErrRangeTranslation struct { + text string +} + +// Error returns ErrRangeTranslation's internal error text +func (e *ErrRangeTranslation) Error() string { + return e.text +} + +// ErrOrdinalTranslation is the error representing an ordinal translation error +type ErrOrdinalTranslation struct { + text string +} + +// Error returns ErrOrdinalTranslation's internal error text +func (e *ErrOrdinalTranslation) Error() string { + return e.text +} + +// ErrCardinalTranslation is the error representing a cardinal translation error +type ErrCardinalTranslation struct { + text string +} + +// Error returns ErrCardinalTranslation's internal error text +func (e *ErrCardinalTranslation) Error() string { + return e.text +} + +// ErrMissingPluralTranslation is the error signifying a missing translation given +// the locales plural rules. +type ErrMissingPluralTranslation struct { + locale string + key interface{} + rule locales.PluralRule + translationType string +} + +// Error returns ErrMissingPluralTranslation's internal error text +func (e *ErrMissingPluralTranslation) Error() string { + + if _, ok := e.key.(string); !ok { + return fmt.Sprintf("error: missing '%s' plural rule '%s' for translation with key '%#v' and locale '%s'", e.translationType, e.rule, e.key, e.locale) + } + + return fmt.Sprintf("error: missing '%s' plural rule '%s' for translation with key '%s' and locale '%s'", e.translationType, e.rule, e.key, e.locale) +} + +// ErrMissingBracket is the error representing a missing bracket in a translation +// eg. This is a {0 <-- missing ending '}' +type ErrMissingBracket struct { + locale string + key interface{} + text string +} + +// Error returns ErrMissingBracket error message +func (e *ErrMissingBracket) Error() string { + return fmt.Sprintf("error: missing bracket '{}', in translation. locale: '%s' key: '%v' text: '%s'", e.locale, e.key, e.text) +} + +// ErrBadParamSyntax is the error representing a bad parameter definition in a translation +// eg. This is a {must-be-int} +type ErrBadParamSyntax struct { + locale string + param string + key interface{} + text string +} + +// Error returns ErrBadParamSyntax error message +func (e *ErrBadParamSyntax) Error() string { + return fmt.Sprintf("error: bad parameter syntax, missing parameter '%s' in translation. locale: '%s' key: '%v' text: '%s'", e.param, e.locale, e.key, e.text) +} + +// import/export errors + +// ErrMissingLocale is the error representing an expected locale that could +// not be found aka locale not registered with the UniversalTranslator Instance +type ErrMissingLocale struct { + locale string +} + +// Error returns ErrMissingLocale's internal error text +func (e *ErrMissingLocale) Error() string { + return fmt.Sprintf("error: locale '%s' not registered.", e.locale) +} + +// ErrBadPluralDefinition is the error representing an incorrect plural definition +// usually found within translations defined within files during the import process. +type ErrBadPluralDefinition struct { + tl translation +} + +// Error returns ErrBadPluralDefinition's internal error text +func (e *ErrBadPluralDefinition) Error() string { + return fmt.Sprintf("error: bad plural definition '%#v'", e.tl) +} diff --git a/vendor/github.com/go-playground/universal-translator/import_export.go b/vendor/github.com/go-playground/universal-translator/import_export.go new file mode 100644 index 0000000000..1216f19237 --- /dev/null +++ b/vendor/github.com/go-playground/universal-translator/import_export.go @@ -0,0 +1,276 @@ +package ut + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "os" + "path/filepath" + + "io" + + "github.com/go-playground/locales" +) + +type translation struct { + Locale string `json:"locale"` + Key interface{} `json:"key"` // either string or integer + Translation string `json:"trans"` + PluralType string `json:"type,omitempty"` + PluralRule string `json:"rule,omitempty"` + OverrideExisting bool `json:"override,omitempty"` +} + +const ( + cardinalType = "Cardinal" + ordinalType = "Ordinal" + rangeType = "Range" +) + +// ImportExportFormat is the format of the file import or export +type ImportExportFormat uint8 + +// supported Export Formats +const ( + FormatJSON ImportExportFormat = iota +) + +// Export writes the translations out to a file on disk. +// +// NOTE: this currently only works with string or int translations keys. +func (t *UniversalTranslator) Export(format ImportExportFormat, dirname string) error { + + _, err := os.Stat(dirname) + fmt.Println(dirname, err, os.IsNotExist(err)) + if err != nil { + + if !os.IsNotExist(err) { + return err + } + + if err = os.MkdirAll(dirname, 0744); err != nil { + return err + } + } + + // build up translations + var trans []translation + var b []byte + var ext string + + for _, locale := range t.translators { + + for k, v := range locale.(*translator).translations { + trans = append(trans, translation{ + Locale: locale.Locale(), + Key: k, + Translation: v.text, + }) + } + + for k, pluralTrans := range locale.(*translator).cardinalTanslations { + + for i, plural := range pluralTrans { + + // leave enough for all plural rules + // but not all are set for all languages. + if plural == nil { + continue + } + + trans = append(trans, translation{ + Locale: locale.Locale(), + Key: k.(string), + Translation: plural.text, + PluralType: cardinalType, + PluralRule: locales.PluralRule(i).String(), + }) + } + } + + for k, pluralTrans := range locale.(*translator).ordinalTanslations { + + for i, plural := range pluralTrans { + + // leave enough for all plural rules + // but not all are set for all languages. + if plural == nil { + continue + } + + trans = append(trans, translation{ + Locale: locale.Locale(), + Key: k.(string), + Translation: plural.text, + PluralType: ordinalType, + PluralRule: locales.PluralRule(i).String(), + }) + } + } + + for k, pluralTrans := range locale.(*translator).rangeTanslations { + + for i, plural := range pluralTrans { + + // leave enough for all plural rules + // but not all are set for all languages. + if plural == nil { + continue + } + + trans = append(trans, translation{ + Locale: locale.Locale(), + Key: k.(string), + Translation: plural.text, + PluralType: rangeType, + PluralRule: locales.PluralRule(i).String(), + }) + } + } + + switch format { + case FormatJSON: + b, err = json.MarshalIndent(trans, "", " ") + ext = ".json" + } + + if err != nil { + return err + } + + err = ioutil.WriteFile(filepath.Join(dirname, fmt.Sprintf("%s%s", locale.Locale(), ext)), b, 0644) + if err != nil { + return err + } + + trans = trans[0:0] + } + + return nil +} + +// Import reads the translations out of a file or directory on disk. +// +// NOTE: this currently only works with string or int translations keys. +func (t *UniversalTranslator) Import(format ImportExportFormat, dirnameOrFilename string) error { + + fi, err := os.Stat(dirnameOrFilename) + if err != nil { + return err + } + + processFn := func(filename string) error { + + f, err := os.Open(filename) + if err != nil { + return err + } + defer f.Close() + + return t.ImportByReader(format, f) + } + + if !fi.IsDir() { + return processFn(dirnameOrFilename) + } + + // recursively go through directory + walker := func(path string, info os.FileInfo, err error) error { + + if info.IsDir() { + return nil + } + + switch format { + case FormatJSON: + // skip non JSON files + if filepath.Ext(info.Name()) != ".json" { + return nil + } + } + + return processFn(path) + } + + return filepath.Walk(dirnameOrFilename, walker) +} + +// ImportByReader imports the the translations found within the contents read from the supplied reader. +// +// NOTE: generally used when assets have been embedded into the binary and are already in memory. +func (t *UniversalTranslator) ImportByReader(format ImportExportFormat, reader io.Reader) error { + + b, err := ioutil.ReadAll(reader) + if err != nil { + return err + } + + var trans []translation + + switch format { + case FormatJSON: + err = json.Unmarshal(b, &trans) + } + + if err != nil { + return err + } + + for _, tl := range trans { + + locale, found := t.FindTranslator(tl.Locale) + if !found { + return &ErrMissingLocale{locale: tl.Locale} + } + + pr := stringToPR(tl.PluralRule) + + if pr == locales.PluralRuleUnknown { + + err = locale.Add(tl.Key, tl.Translation, tl.OverrideExisting) + if err != nil { + return err + } + + continue + } + + switch tl.PluralType { + case cardinalType: + err = locale.AddCardinal(tl.Key, tl.Translation, pr, tl.OverrideExisting) + case ordinalType: + err = locale.AddOrdinal(tl.Key, tl.Translation, pr, tl.OverrideExisting) + case rangeType: + err = locale.AddRange(tl.Key, tl.Translation, pr, tl.OverrideExisting) + default: + return &ErrBadPluralDefinition{tl: tl} + } + + if err != nil { + return err + } + } + + return nil +} + +func stringToPR(s string) locales.PluralRule { + + switch s { + case "Zero": + return locales.PluralRuleZero + case "One": + return locales.PluralRuleOne + case "Two": + return locales.PluralRuleTwo + case "Few": + return locales.PluralRuleFew + case "Many": + return locales.PluralRuleMany + case "Other": + return locales.PluralRuleOther + default: + return locales.PluralRuleUnknown + } + +} diff --git a/vendor/github.com/go-playground/universal-translator/logo.png b/vendor/github.com/go-playground/universal-translator/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..a37aa8c0cd0f6e1b98e0be3eb2531ebc6ac6717b GIT binary patch literal 16598 zcmV(yK*U_<=i=1Q$^7;0v#+eDrK0%p z>%6(N%f`XBv#;pk-N3xJlaY`9`tZ@r#>d0H&B?^Dtf>F`_3`TEoSK)csHK;dl)1LD z{xUb9o}0zMyZALSjf{%1BqI0!{{5jc`1SO`zPq8KpwB5MBz`@`DJHxnB>jUjr=XpP zhJ*ceGX0V>qah&tt}xmxDK3XPA9F;SA|8N$duRs?{%JJ*T{HG>5AcL8I*&O1Ju^KN z1^!Yp@h&apFDzno38}29au*Y6VF#%(B=Pd^`t{{04g#CPRH8PEL>89OH1Y4=wM`?Y+cnsCD|dZGb#-yb zPbYsY6v#U#TTlf1)HKmxCR88|TWkfi;WgJmEa>U!iH1CPzc%zlFUrZIxOpL50SAW2 zHrkRe-Bv8!+}rP-U23*Bp`mB-jzz%dHuKoF($TRq)t%&MEAPFIet}u?$D-;-NTfd? zqGBFudL7@{$H>RCmXS~SDk-e2cr(q3b}2D4;I^fdk8wf@!NHcex`pmIGxX}ykX2Zk zP#l(MXu)GF(Pvk zb5n$3uu@QfLrR3XE#bH{zmF;My}ImfZ|eE@n0GU+i65iC#kVv_JUkHP6q^ z=b4$1KRnawHnN9;XOVD+dTcU@PWtQI+{V7)vVb@}2{~W|d768ob{*KawLyATCMyBY zhk?3y?SQh*YZ(!U#KDNg9qaM-(p?CZPE$X(8z(y`Rk002FaNkl8uC7fajE|-h>jHG2b9lbevz(KOfu`z+X2)PND2t1w1WGFmB z;BZ@Tf}w8eW!d6lVUNJlhe<3w@VLAr5!hqYo=(frj?qrXhNe@r$z?o#)_BC$c#6Tn zw%ibJSrePzu1EE-o7FRWE@Bmr=0#t-W8=a(6GTqoYvcqTWN@=@*0!nMye8HIu2(T+Ak@9J5Z~>D99iw*`m8V%yP8G^_lKA3_-39D4+I+C1zz z%PxAIjtxqC6rEeEoK;TYRK5moFT3e)S;c473ltAKvc{hCWlVc;gKFP7(_^pP+TQSQ zjTnnuLBc{Sdb7KSnYy{T8Mi%*-`7X=bnva_VNVf!d<1rL=-JH6uuGF1?^y5f9AB6q zotFt+&fvKN9wTt?2px9TxG)4b)AV}%MO>l#`PSCbhc8CH z(ahGS3jt5QrHGrvLqpybTd3aT!_Ma3C?0!8iS}-@N4$|3Vjk~Odfkur_B2j4Q=ai9 zwCdFE-MgodJ$v@--@hOJdcD5T)wQs^+~2>veB#83lSsEgpFKBQ8LAYfrz?!j@VGrK zfD?mhnuhu zc6A*>`uqE-yqo0c(WA$Y&khU>p!`akr_C16;qx9(K3}Q48GMs(2|#W(U+C>U+gs?p z^6}jBk0WP#6@}XUG1|MFxifa;Gu`Gf@{^8r3D0vJ&-0ExB2Qql!KaO@u%q%RuxCa- z=nDq{@3OWa?o`}pF?bNzz;Q^nz?4c2d1Yzhk<6eIWaeu#=B8Cm810v^Rke)+e)?h zH``r9!+0zn64TyHj(U9NCw8Ir?OU83bm-%VH;0Wb>dWQso<4o4T$akBA7WgT3iz&_ zN#||w+mrl%lwSPt^Vg61UR6`~YFWHi_l{!JcULueSU zuU#7-U!wAd^F!yiGqsgYce}fpeBa&ns10GwH=8Hj)>BVDk~}BH;~@vhCnx{=D_1_h z9(z4@+Q`0r`z}a*NhgoKotri}dCcg8TMu47d)M~vT^slBr56_$zkgrMPE@N|O(WZ! zsLQ%0YpP1+LKrd6^35*)GUSB5)MzwrJS8#U4D>#RSz-pt?c=lJXO zeSaQ*)aC{sacalkE(o<+>1c~WPfGnKtu-k`2YJOl(N%r)u4fVPB7smYkR!~c!2?5` z13>TVn~)3sx0VVE3qQ8?KZ&MxkE4I%0~`Az9FB(`>c8OVKkXPppkEAHPbYRdx2|$6 zf*j~H;Ex?orIrKyj}eYAQ%S`h#fdpw@Cz<58T?>}2zx?ZT|%y(T{~Xpi=gkZTF;#e z3F=$F{`}PNFa>wR$HyM5Ztd#os_vSakjh6}Iy<|C2zX8|>ielr&R9gEe{Fo0|8gK| zkY8VlfcpEtiRi!U(S93Z-L~--2kINT8Vb8(?fP;$%dGar++*t=TX-4CqacXL~rY1d|=Z=r( zT@Q{j(+PIADfOvY)=!t^b(wRg^=0R7n8aR zGu)okchJ@@r~V1+Ujz8JBY#ZBac;u{>vE*5fRzYXDa*3>N)mKP)O|L;_+)+@W$#W_ z1HCSw0BPQbdWUK^n3k3~2){GaaiQou{J~fvivE1qGekZm14C^s_>uYe_~`Zew$6dh z&dz2jY$hilM;G9l1sq4)7Rn-P`H|OEqLr&S14g)DnOR!8zA!U0bMNinM7RaVpGDl; zY-jGh@Wtt|F$}V_tG&EfzS=j}cU7%lLF4S~p35Z7OJBR(*!bOV-xB?PmY6P)N+eR& zm~-CP8no)@pwxKED3P8YEr^+%?8q=F+vn#4EnG5nUJd7iSCx$h8STYo>M5XqKb%>U znOOtZDR(?fN4Uox1Ub*XkD$wZHf)e>(EIqv@I>f+HsGnMd7^oAVqjvh1vQ|K6RZ%6 zS(agDR(SBQc^!rdmzN8vK88rJqp)LqgEnqF@z805HGQJ@1$%=?VI znx@@zXBFMuwRP&sqPpVZvLw6xjS9oC{Zv}oug2jiu%}ZIcF@Ph^RCBI+pC^=W&^+h zj2nbIz;VS1L`O&K^(`$vP;`|5u!wLu!{jbqrQrBbaLVo`2m4qAM6qoVHq>>S?SyR` z*c}LXS5Tn6g}o`iI4?0VQ5zK%Rio1xlm=zWuo0G1 z^py0Jec*;-d4*BepMTH?oH9ZSY$|#H{6GG`^dbW~(Tbd;`3i5jm;5kK&YSMhLvC&3 zHVlp9eiusn*^WX_1XErv-9)w42ysdA?Q+H zW2CX6=ZBNdm?l$Xli3vMR5s}}x+#0!T+v)!UV9=H(9Y8J_>rsU{BkbR#TC3Ak&M^yN+acyB-!s$e-Ut;vL8ySlm4a z;eC8dRw94`tf=X%Uv6%$8=aRI9J<1TIMbMW6^gFu(4jHQl%}SF=r%{bpn^hWvR;$u# z?d{>=gnV=2*2E~n{(eP81u1Vp-=CRI+4rUIi{BUTb=|}MLKVTK$?cJhCIQZa#yajY zS(}2N?bT>;%*x8uf2KJB_nPh{ry9GsF6g#rFPyoz{6b}Ux%JHA;^J%)xNpWt!c`tW z{u(CNPsL)vuD!{O6hY2%>I8qZSX5O>PtGWEy~`Lmb<%8B>Xe$#4z(JbN}bN!q|z#P z103ko^(ZQx!H{Jz7!K^;PuL-zok!n77@PpuN3`=QIJaXNJwN>xw8No`D|!K~UHql+Qv5HWo# zB}cT^)aaC12QmqJ`hK3=ZTlv`6W5{ViSOGfIrW*|Np9;)2Kq```l9tRy)3$O^iF?{ zPUxJ75m{!I-KK-QaAxVc*K(Nd4R;SXqMht4{NEVX+)5Xg*@A@Hq<~LB?(fg+E!|uH zU3PZ%u1f#x_XH9a#ZAHrAeO}~uDGbkZnqajX~LVrJ32BtOdr;k&6(!Li-vb=RcYZo z`qr(9iCZ7x(X%SDkm@`-$X^FI#FKA=?VA8jd`GrF3{<|9@ts|UOIx>`TRl)x)i(4! zVqK1178248PoY+zy&b-K_%Oy7g$1LI+PVzSss7D$wDbGdl?MTRO~_3yx};tzTQz$r zSe*>=WM;>E0%_2DZ|vGpUk`K^A_F2WgkGGN_tjVSqN1X_;l#xEe>Y_`nRX?JRuvab z&g~`&C+yn9tq{;bzH_ItrY6OpN)iIAqhPS4RrcG0}H-ItzJ63yu82&@oOwU+_mf1X}n+g2RO*VZncK44<-BB z+G+Yq=F+7-dwvP<@5T-$&i;rIO9hgIw?BI0!*bRmde8z!{OebMCn_45k1IEu%%;5w zZ2pLs8`5bugFNbyN1`6vx%0719fnqA*1>c_p8opl;C9=-g_85G(`0|)akx&hT0i8E z*A@6EL~^dPMBnD8U_geo*8BDX#{gcTd}-NoZ9(W=)2}TPcDLmocn>*d*J+ov2jn5X zXFPA=Qd371{#Zkjvdg7$5|ZN*kx0rQ<9P{LJPXA|<1mAld=H zeF6pxh+y>)4x?&9&JdUXE;854k?u3tb-luOx$vDg{YKA04)&K8U7-bQ)+Wt*$g!p+ zd>R)h=2(eXDrI1_slN=}1S%ohp zYxPt}n<|U+ZLLX3DU^`n%%gKDue)jSGZ|@jXG+Vz=eq5l&YUz)X3nM`O}_;8bW6G= z_o!T>E7p}a=o+%+4G~%088Lh6<#L=(cY(ZrFR_KH+jR%FgZ+7u*Ku0ym53ZDlD%;M zDK00U$79jCFr3=+e>+Zd8Kbx^y8rpdw;+ePi0(rEcF{vXXUH9M*J=IbOtmtzv9U2p zZ8n=LDb51T5%B!EI7_u9F0HyYe&&bWyDz1GlxsT+qsKmW{8-WTmSZB|aUiV( zp-$K&$n7N5VfYthn(2a0mpq8WDj|Q##oe9cXkS151>`UX`LAYm5)73sDbrS_7t)At z*5MiTSA0^HksSw%*X)LU1ay357LSh~J$h6Zm8R3Ap?k~D-LOHIy{AFm-Px^**;QYa zRWHuV0((CzdpO8}4s*y3Xwud&^^FK$SLZ;dLr&F+Ft25_rg2cGMHE*=P(hwTxPLCH!Q#wALd+)uu>YY1x z@80P^ABRO1AI(Ks%hl*K+3~t~e6n@AtgJn{^)dCj`q*8&RP*TJAcw=-+1WIg>Og-! zi0R>uof>t-y6A!jjiN=dZvEf4lN?@2@VXN~XWf0N=0ImPpPrm-n>8vX&)n@Ol2R#B znbf1LwNQFh?-AAi|L(|>>jb9nKL5a# z9Oin*V%Hps8x@|4J7>=Pz-uLu-d02$AM6y*6+OQCyoDT5;^I)icc$llc4<5}_oyZ} z9q6GAFnMu9vAj6DbA5(iJ=DU~vNpz>?Ab;zfJ01KKV`b&+4+RMK#-yA2MrCG_ zjasUD`OG&}adz8*Hiir*E=5IYiqq0M(?ZkbGuepsVqLeqJEOB(2kKohauw41-dFoo zTMPU9LH@!E;jl%)zA-iRc}Di9+Jk~xPK8|TB|^jN?%g<&O~C;*1>ZTr|1HqT^~&AZ zt2|$RWm0odWs$lF-$Id8uw<=`?m#1}vaQK}T3tBj~iK{rDR^4%a1L}Fip6pKf zo^E+P(CcIO@2Z!pRH`=%LEgUw>`rv2>e~rA)5v2sH_8=VnBt-*_gW4*wPuqbAjy{F zg8t9slNhyMMJprJo3Y9#Q_FY~k2ZAkutg4!9=0@%*iP77rNsdba<2F7igPm&jID>o z#Kgo_Rqc*a9xqlw4X(wq?9avVNq zlfWb>_yT3k)!mnn1Ko?Cg6jldkn@@v0Zpnql3mf#LUJI^Vez+xlB;b|b15a~Lmi@X zJWG2YK1tUT^v0&MU$F+&){6@@u6Tr zjdB19{%^XtMFoAbLxMTGeca3`Dl2Pk)9Z^WWs<-7woPeKX~Znm6;#ut=)i4DZGI`h zOUtV7N~y{@4xQgO_dr`{X@zvA z9J2{nIpTZ?Ix9NJfxgt`Nv!vrR&C#Sx@&moL?lHYuRFE;i^icGLGYMgK=2as!*F+y zzYB7^=2C^ii(DQ062r07cvB{%yjs=fMwz`zF6@(vkk(-#is~cOIV0CsxT=)reLM7O z{`m-UPzCo=aF7%BcH;2FTvT^-HCu;GT{Si0(*uFSLtPj@?fr^guIS!|F@Y(-mgIM0 zaW8WisqhzQofDQsa1z#?_ca*OC3#HY)*TC(}?XH@?&Z-WxtL~JYjrGCdlLMQysqz8SfFa-G>$_VQx`Nh36<)yN?DnC)#7fB z!>_%4IZIsJ+?=ICB0tL7{@(1QvYaHs45Uw{tXPiEHi zq;9v>)C6A~O&ks3E?4zOPYwjEGlgLhcHN7M-5uy4zvVcsRg7q(#oprRXf3(HQ)IUJ z(u5qhYprT2kK(wXIgT4Cestix!M$rbb2e+FyM>a9riL|Pi${b zWYL!fd*tdHml<@G>e3Yo=eHL4-U>46j7L+xp|&jsyRdcav_GR z?TLwOu)`KNH6uRBVLeKlQl-)kmWV=@sXCVuBE7nXm4b>5UH&(vkkqhs7x<)`RO!=hk@B#+>Rab5%2HV z@qUDT;C_V5J-1;)dF|B@?)S7eM0aW)%WxBPyXuLse{y(u{0LS@BmIVYYLo{hWD2@W zboZVy!GJQ!6dA~Det&WKgV$KiKP2R^X|e|>@v@5htOl`G9KBCW0iDKWi+vohILtX5 z^p*J^*^es_9A7ZZoR6G~M`F*2FVBc^fIH)yC5P$^JM5o4eyi0V`;&p#WgX~oN6;>J z0et0m>jc5dfw0Ihzd--h$)=yy!QEN%TWxJW>+df)pr5|OSDf3oFFG2ZXzc}>q&b_B zMpg&^BI6+advZH0JMHW&ICIl5U)0LyHUE0eet<6}U*hm=L-*YCgZ@xG46Ceyo+d7D zd3%z`xob`i3j~46u;DJPA=%%@|0kPmUi4qEJc4B@?^XHJXFAqO`V1r1zKLtsR*;NE zNzF#Pd#CU{q(+zR9chQO!m{&Hv4xPQX#j3VXTf1#kFu$KhQ1i<)SPUJuM zj6L-LfC+56y*~W^lm#th`;^yuyU3>Y=Bs#gX zxN*THx|cicONSWMm{YK(W-A(|v90N^r041!rU`A>rg4C?uVnZw%yymDml4p z^m^gTU=MovKC&c}*us#r9&ZPCq7Nqfe2aR-pda$Z&s?U*NA?7pOv(Y%6~k)7gUQK0 zPXzxS#^$&-EO5FRvD@!aGJV(U+5=erBbz^6`zYjanHk5nd2`k^-vU{R(Sp&GUG>oM zZ5lf{)4a0iGhRQkVSen#&u&g#tE(%ltE+q2en+0jqO)y0J_P+)(#k#;`K>=vJhLjj zDUys|mm@j;KfzeA0IK^LwAwBofAX$JdD#!-1bxj)vM1(_E%vq6zP{+w){!n8mrh3; zP?>3?t*o`RwXLm94=ZA`CPfMH&zg&g9c98Cs=H{;pvT01{ONu+!|ngfTKN5O>D1Ks z9zV8_B>{)%4%Nf)K|f~~9kP!c9En^VwmOiYuRDl&ySn`A%x**wgO0!UE)4c?Ms(|g2CMy12+&Pq_u%a! ziOWhQZw%-Gfyx`CR6=wgpC=AI^yt$zfZw|H0Q}u;1(u~|^$B3tVn=nvYQ4ed2zgxS zE>vK*U!tfik_qSiodN)Tp2_W+;!qadsW~ZX1U+VRZAlf|$MhE>%)cUcmcFa5x76XP zJduPuW)*eUUzl&>!y);g^^r$>h9i^xfsWT$ICA<@{~MmBOC;O{I_0brprKJlb|J+N zgZ&Vmu|4|e&9I`IX0;XsGxg9iuu zuqIF5#P}!U6;uFJ7mT4u{r~d{{YO5J)tr*#)Qq8zwfTvo#i?CPtTX5!huvS|)--)a zw#q}{A!(XCZ|$>Mts^5NR&tLlRg*lYuGAyZt6S$YJjeGH{cYSNYBb}WgdFH;5svdY zJ~6}?^eSp<6xf?_U?H9R$5?|PZITxa^q>|(e$2hsyTr=+`}M~s1`m^+} zk2rdWpck2C5|LhA$x9JQGc#F_$6+?9IdeQ+jvIysW^EuLAuqlmuUj6mzB@0AxVyL$ z4qu-aJCQT;`sS@0+g~r-xOdA*nUt*3k`V|&2YJh}RphC_r-R6Ig#F?g!ysM&;#ElG zL7#6|M+Tbw0&44d(q-Q%l06rGzZ+>}TLX6*pw|{x?0MNM(^eHS2w6q_?+H`NP_lgzP>mx6aB=_u_k3P+) z?qe7vNjYG^WP0@gS$Q~#=Lw3FI z^kQ#lUte#p+rA4F$6!E4qNPdBj>arwkE;qgrLh@`!#X>ea{d=7=N{8m702;%aa^D< zV6csc@^TEk>mZD>DT%9=&`nn;gh)mlB7!rdB9AJME`b_S!eiwj ztdeHfL{c_bjmTcch>`u}|Hkh*x3{+)Iw$_<;Qj;ar@!axl#^7s(}uH{Y;^fAa2w@GE+?S3Ep z{Oz~%^F4tvUh2BKPS&D;Oly$Rx%c=!JlS~bVug~%%PXR^tFgEVUFh02#JbG1Hj4fs zK|iWiefYX6=Vd3lDs^3Z}T+Ya;&Ni@f!YgQA1J`fWyK%5;X(4!FEX-yLqx}StO zvq`UuOHP2T0^S!C>=UXTiWi?HgPSd*;fB$KaJ9bkRLETcolYqut+(&mx3K>6{O>(6 z(xBB&wIz3z1iCvgYY78VLd(Bg2Z+2ir8OlLRQf6^D$l010h^$|1oUdv`+2I5dGy!v zw0Uo7b($(eu6+&YXc+P65lgLzaR@ILFc;IX>f_gL+Az^7-f8e=hu$F%q3A7}estPl zClWei9YrA0N6X`Y}!prk%Okx6*BdR;WvleVA97X%R&DC&^KGs4G%(E9BPQ3WVdbTMFDE;wHAn3hB92y`<(J4RpFY&niX{j{c{56Ajx2`3ml z3fQ;c>p4Jo)B2IDr>0~gI!SKW&s+)ExP68iybs8Cn>KJ{GmNBl7`%LMaDv`qk|)q8 zHxsyH^j%19*lhfyv{Tm^M^|oc=wK(aO{nJfg)QB^NrbM+Cg#s=d3U|a7w%$7!w0WjnU;tsxcgfeU z!?dyx7KV9G__}WK*;7dg`FeRQjqo#4cN+G;pa+uVW{6GJVKT>Y@9r}s&UvEy?;{8Q z&z$ienRm*$b0Z@-4u%F5>Am6&pQ(Y?1u=tp?;Tih9fz8ispN9RXD5#@M; zUofRC52d6oL`9K%EKJWmrz2O^$de5Sa+{ki%nln=5G-1gS{}57_x38x_&7y$jFZ## zx)WV0t*op2e!iCY`o#BDyx=f6mT!;;VjCm~uFlJ6-XzA55Fs*gIpRz!<4JhY;1C}BLr<47kbpwp6LEtidvj$ud5s%uc(|KfsBujHs zu&DiuCeolf92|`Gx_Pw4UJ1D9V@qY-!+W&I#AW{29FwE2=PFt>@h#h zt83>+6l!>Rt$O|(1e@nSZo3i;tX{b|f1ug3=c{HsbI`g!Gpgm$tGA*1!O`1o2iI&x ze~V5d{Gu)+_2JOdQD)kZ&6#$XrqM%POeS3#xfef}x)b&Uawo^A)iBnHv>qa$3)#(Y zR|nLNF`uH5`Pw=Zv9=FJftcKx8M3trvP+}!MTCi;sSA~5@A^0wGD`#u@a zPY`s4>LQPxrPgNUXj3-qyEOLw<+i9bTa1v~Ku*z7&4C=f5?|kSQ)=pZSd@+)E_k?i zT4z2LVvRNH_2KEyau{9QA$#!gq;zw5EY|%xY(Y?Tu#1U(cRSU3Gql}Tr)Y!D;p>R+ zw(%-nUWEudt==&Ci0tMwJzX_LXTGT6u(Dv*>;aNd?bVmxQmIcUh_B~$Q*>zk{BFCy z%pTQYi!|7RM07$f6{4IEt}wZ~n3}pV7`B(#d)`p&b9#qEXHK?S^3&g(9w0+5GT9D{ zo{2i14x5j6bdF8;-V3=)J5(Y%&2B&sX#e?~Q^vo)NsRsGcy@L+4^NhF5{B*of!({N zr1aDBlG4(W&u9R;Zx5Bg*H2tkDNxI_=3$*$U6)m$%_z_Y_}WHCZGMPxqc+5MF~Ead zK!>mIj*LSIZ(1DGV+O=DsDIvc4_o5X4y&biF6F@NB*$Env3I157c78za&+`6tm$S$ ze7FT2*N~7?+Y>w32|7|a0vn=R8TE4rzCm92=1_5cNsWYotuwTg^)7#}SqeWW=VL&W z&F(X5U%YriMdV_JR;AL`W#y~TvkAJeX|ru=?%Td#qwm~S^`r3rdWmkw(A_ZEroDXB-mrlx2GAF?s==(t${^?w zUiWO9p;$Nv7+M5$C|z)MitbC$BcpUVD^JsFOHju4S{?LWD!ggyMk3}wPEN{}u3wi8 zkUd1N|8nb6fB#&6Z@)!7hCdi0E?dJqLVU;gxrsU|WE*0l z%F)~gbllSvYF?;4p6^DdPo+Iefy}C|^Ia#!LicZx|=kx;>#>W*m5$35-OP}~2($)sWSM+5L zV}#I2OF4kVH+~tA(W`!DFJ@7pL)Lh~OgZ6=68MPisZB)3;w5VTVLA2y%=mIR^!oVN za9o=7%<|Go>#b`m-M`^#21YutbVv5&T}nwX)w)%$9r>>m^wyho>i54Tc5$@-0|-^qv5389|oe03Z9LVZLDo@$A6KChyh0HFb zH|ekA^*^-Xq<(=~-FL`Hb?zd+to(?BY9G`5mrZ$+6K9vnVpwKiz>6mbx@hn2sV$OM zx`58#I~W^2XUVr*-@~%AlU^LLIT;BlEKM=)I%iqUKdFR$1L*kb*CV^R%J|T279Vra znbN;OkGa_B0*5r+_(=H?N}9)@vyFLnOlern>=agSth1P*!@GE9=pzJ1!2Y8(j?VDtI3JWOqCdKV*>@q}he~y2-0s-K{cKKo9a*x=?b8&f7b>u^^`# z%sPvuKfgeogGi~_NSvZWKRhb=lQR0m(e&}y`hKv*ItTLp1ie~L)Q%>VE6@SmrS>9S zop8E9eaLtW=m4kEnA=l$nS}C3RVZb_Q zLr^-sTY=1-lhBT_YrJoOi%O^Huy^;Q?o>K=1xUtEJY7?Lw5zbeUY7t>e@cVp)&9rjhRZL@fiLU zrln!fK{?De4Re>ji@tQZr)STlo*U5|+k?w_7{SVxy8+FklYbz`r^BqH6dUm7(J8rS zCC8(KT(EbX@d`PmvtZT@qCVohi>Ld*B$kaXduBN)RY5fS4+&j-@}B`Z#sT6_jg1|5 zQ#-m;e1nd%<0_h=PNX#j&POZG76Kd8g+`pxtWE^ zON@Zd>}y5+D#o}g10)b5_$AIpgIp6BNR=*F+*~lm}B~8kn%Sz?&C8hFo&_{(Bb_!y|k|xpJD$#tM6v`FKZc zQ~INxPFy{1I_G(iQ*?DcnQ5hw1GXa-K4flvSxOT1azhW<|(3Ixh;XVH5*TL2eCp0E53{WhKEG`gQ5;{d6>n1~Y%ma5 ze%K}aNC~DK+Vp_bAjJX&l~pX!HM@JUkSiCE6(PF9szj`{VmUYnXKNuyYDA-?mnbI= zsh~ZyRfU{fDpf5|C4zE^Q2q(TcV>4o9$LVOR9;-yQ7`@Y`{vD?H?#AWj`#f-Tvb8Q zUxWKlaGD_9;s-W;cL!JpYxaX9{H|njNAxrP{08)3)lS)azB%(9Qkr}U?AFTRqbo-b zTZUFDhsq_bTvp4Lx;{EpLvo`M^rK}B=xpIG%i}ZL;Rk1KDR4;S-xqIb96ccCbGjfp zVqD)Z!Ce(JzK^vBkLS;AqgJx}6XJ(3+PUn0kpH{vllyxveEH@X`^Y5bH zJ^uSU3>{aL@axuK2%L&cu2tNv0bO7hWcOYE(F<#j|L_L}`pfU;&!0?zdu64RR?CK= zOP65uu<`3BHspiAXcZJDAca~fGrg@ zXaUNypPzhv!T|cGVXbP_jO{5Sw?W=(En_)N(2?B$eXCq1IZZ<^LUX_)o>TO(4;^ez zlZuqxP(hyLE{ivC?6?#-Q@L5-8-bNImmP%IEA*pTR~CjEX8 z>A)_?&e&qn8IoWk7-CsWpnHEm4E)p9JqzF|z|j9S{59x_T{BPGjLSp#~jHQiDq zsGg;YW;(C;L2N8*xG7Ur(2`b z8bu!(CFsatG1p-T$UZs|9U086-xhmRX~Aq@w%2m8^k#3-ZFF_ndLtHP`GtGq!0v zF(NuA?-t2{4)Wg*ku4V(*eCs~(j&iZ!r?(axGLfd-NZEC>G{!N$R4mC5ZNI+Vej5I zn}=C>ihe7XZ|1j>Eu(4}O4({!B`sA-!_$vinp{q`q;;za^stn1OfTsG&iSKXRNxrc%gd^^9xB5b@^qq~|8u$i?VRV;s)e zf3rCiOXGobOKn<)Va2d;l?Zwhi&p#<);vsZwwX=Nn-#}|`{(8h+MJ%4vvZD?gEOtE0_g@+bTz-JE3tKTXm%mBT z^LK7yBdUL~7w|#fgS3hXN=v3Unl-gnBF?@MADXTjHBuFI^^8Owlkn`cr-xk~GHVT6 z#mn>-^h(q-l*t_jANT-SAV8EK@>Q9n2(Ueq}&dkrOkQyCnK;ggPO| z!yt^^*Ig{wK!&^Lanorve**{f19reCeD?G>rPnliRX8yXIZHf5&~vKoNYWQ(*fz-* z;M!rwjoWTUpPSd?b=&sliR6qt&>W%*1D%m$NS>BNOZ>WuaL+ZDw=a%ugIoqxhoO$i zPT7Ip&JOh1>l3g~w^?jVcxVAZ8$PIk`gn^Ic*!H^URYH!r*tQ3yJ=+Z`dpMqp7Gq=oE`nlZHw)q z<}8`Pyv9Ty7BW^A+L-Fd;#SWMUWE3$YX$SzC9eC9%Tsndasz)S=<92=XoJ-|7oJLw z{ubjnFh|C`N(Vmp@h9Zzu?)~L%jvq8Fy|4~qlIEtuefH^p6h8iEpuL&)dX@RGsN9F z`N);~?C60q#6BxMSIPP{#5UbJp5PceOX}Lf{8tqHgB#sJ!AgJ^y4)AOy<2b!$cE8t%=oOIDMpsA~@74TSHqZwM`NJLD9VqXm`O76C)V;u~ zRZEY*_`}3`kgxeg8yII7;h9nLG|;s=vi7XrsO$6fLN-&V7xe|#?6KXt9?95quH7GD z)A{Y2ocy^Uxcj0H_yc`-JoMifd%DEn8K5(EA=JU=ucIf&ylJtPPZ13ae}EbQrV zV26r&v4U421KtMG8GFGj7VWNxQ_yGk`{d-P)Sm!n`72G`LEb*lp9=jK8G`zrYrqR+?Y^hyzW7cvbqA4f-Sr5ueUzLvaeN$c zN4~mq=gtS4q#5s%SFUt3c+fwz)XZ9+$XWABkh2YCQFBE14o3Rk8(kf|4|{N)uJ1bFF9hp%-l;Rvb+;eJ;5k1mnn*vn zRR5`tmENP7u0(G#8I97WR;;HNeh)bt=Pb5U&1rCd;(_ZHiyEwno#Y`YP z=)oSiJ!{S?@Z$sdh<6zNiBL0eLe3l2ve3@Qxsb|0^hxP~+r$6B&T?ARtbF0Q@`N77 z;R&Z;nSQP}xQPjUTE$82e&nx658Oi1fxoe{+C1BsAngAEz5qf00MAd3Cq<=4x Z{{;$xH 0 && tarr[rule] != nil && !override { + return &ErrConflictingTranslation{locale: t.Locale(), key: key, rule: rule, text: text} + } + + } else { + tarr = make([]*transText, 7) + t.cardinalTanslations[key] = tarr + } + + trans := &transText{ + text: text, + indexes: make([]int, 2), + } + + tarr[rule] = trans + + idx := strings.Index(text, paramZero) + if idx == -1 { + tarr[rule] = nil + return &ErrCardinalTranslation{text: fmt.Sprintf("error: parameter '%s' not found, may want to use 'Add' instead of 'AddCardinal'. locale: '%s' key: '%v' text: '%s'", paramZero, t.Locale(), key, text)} + } + + trans.indexes[0] = idx + trans.indexes[1] = idx + len(paramZero) + + return nil +} + +// AddOrdinal adds an ordinal plural translation for a particular language/locale +// {0} is the only replacement type accepted and only one variable is accepted as +// multiple cannot be used for a plural rule determination, unless it is a range; +// see AddRange below. +// eg. in locale 'en' one: '{0}st day of spring' other: '{0}nd day of spring' - 1st, 2nd, 3rd... +func (t *translator) AddOrdinal(key interface{}, text string, rule locales.PluralRule, override bool) error { + + var verified bool + + // verify plural rule exists for locale + for _, pr := range t.PluralsOrdinal() { + if pr == rule { + verified = true + break + } + } + + if !verified { + return &ErrOrdinalTranslation{text: fmt.Sprintf("error: ordinal plural rule '%s' does not exist for locale '%s' key: '%v' text: '%s'", rule, t.Locale(), key, text)} + } + + tarr, ok := t.ordinalTanslations[key] + if ok { + // verify not adding a conflicting record + if len(tarr) > 0 && tarr[rule] != nil && !override { + return &ErrConflictingTranslation{locale: t.Locale(), key: key, rule: rule, text: text} + } + + } else { + tarr = make([]*transText, 7) + t.ordinalTanslations[key] = tarr + } + + trans := &transText{ + text: text, + indexes: make([]int, 2), + } + + tarr[rule] = trans + + idx := strings.Index(text, paramZero) + if idx == -1 { + tarr[rule] = nil + return &ErrOrdinalTranslation{text: fmt.Sprintf("error: parameter '%s' not found, may want to use 'Add' instead of 'AddOrdinal'. locale: '%s' key: '%v' text: '%s'", paramZero, t.Locale(), key, text)} + } + + trans.indexes[0] = idx + trans.indexes[1] = idx + len(paramZero) + + return nil +} + +// AddRange adds a range plural translation for a particular language/locale +// {0} and {1} are the only replacement types accepted and only these are accepted. +// eg. in locale 'nl' one: '{0}-{1} day left' other: '{0}-{1} days left' +func (t *translator) AddRange(key interface{}, text string, rule locales.PluralRule, override bool) error { + + var verified bool + + // verify plural rule exists for locale + for _, pr := range t.PluralsRange() { + if pr == rule { + verified = true + break + } + } + + if !verified { + return &ErrRangeTranslation{text: fmt.Sprintf("error: range plural rule '%s' does not exist for locale '%s' key: '%v' text: '%s'", rule, t.Locale(), key, text)} + } + + tarr, ok := t.rangeTanslations[key] + if ok { + // verify not adding a conflicting record + if len(tarr) > 0 && tarr[rule] != nil && !override { + return &ErrConflictingTranslation{locale: t.Locale(), key: key, rule: rule, text: text} + } + + } else { + tarr = make([]*transText, 7) + t.rangeTanslations[key] = tarr + } + + trans := &transText{ + text: text, + indexes: make([]int, 4), + } + + tarr[rule] = trans + + idx := strings.Index(text, paramZero) + if idx == -1 { + tarr[rule] = nil + return &ErrRangeTranslation{text: fmt.Sprintf("error: parameter '%s' not found, are you sure you're adding a Range Translation? locale: '%s' key: '%v' text: '%s'", paramZero, t.Locale(), key, text)} + } + + trans.indexes[0] = idx + trans.indexes[1] = idx + len(paramZero) + + idx = strings.Index(text, paramOne) + if idx == -1 { + tarr[rule] = nil + return &ErrRangeTranslation{text: fmt.Sprintf("error: parameter '%s' not found, a Range Translation requires two parameters. locale: '%s' key: '%v' text: '%s'", paramOne, t.Locale(), key, text)} + } + + trans.indexes[2] = idx + trans.indexes[3] = idx + len(paramOne) + + return nil +} + +// T creates the translation for the locale given the 'key' and params passed in +func (t *translator) T(key interface{}, params ...string) (string, error) { + + trans, ok := t.translations[key] + if !ok { + return unknownTranslation, ErrUnknowTranslation + } + + b := make([]byte, 0, 64) + + var start, end, count int + + for i := 0; i < len(trans.indexes); i++ { + end = trans.indexes[i] + b = append(b, trans.text[start:end]...) + b = append(b, params[count]...) + i++ + start = trans.indexes[i] + count++ + } + + b = append(b, trans.text[start:]...) + + return string(b), nil +} + +// C creates the cardinal translation for the locale given the 'key', 'num' and 'digit' arguments and param passed in +func (t *translator) C(key interface{}, num float64, digits uint64, param string) (string, error) { + + tarr, ok := t.cardinalTanslations[key] + if !ok { + return unknownTranslation, ErrUnknowTranslation + } + + rule := t.CardinalPluralRule(num, digits) + + trans := tarr[rule] + + b := make([]byte, 0, 64) + b = append(b, trans.text[:trans.indexes[0]]...) + b = append(b, param...) + b = append(b, trans.text[trans.indexes[1]:]...) + + return string(b), nil +} + +// O creates the ordinal translation for the locale given the 'key', 'num' and 'digit' arguments and param passed in +func (t *translator) O(key interface{}, num float64, digits uint64, param string) (string, error) { + + tarr, ok := t.ordinalTanslations[key] + if !ok { + return unknownTranslation, ErrUnknowTranslation + } + + rule := t.OrdinalPluralRule(num, digits) + + trans := tarr[rule] + + b := make([]byte, 0, 64) + b = append(b, trans.text[:trans.indexes[0]]...) + b = append(b, param...) + b = append(b, trans.text[trans.indexes[1]:]...) + + return string(b), nil +} + +// R creates the range translation for the locale given the 'key', 'num1', 'digit1', 'num2' and 'digit2' arguments +// and 'param1' and 'param2' passed in +func (t *translator) R(key interface{}, num1 float64, digits1 uint64, num2 float64, digits2 uint64, param1, param2 string) (string, error) { + + tarr, ok := t.rangeTanslations[key] + if !ok { + return unknownTranslation, ErrUnknowTranslation + } + + rule := t.RangePluralRule(num1, digits1, num2, digits2) + + trans := tarr[rule] + + b := make([]byte, 0, 64) + b = append(b, trans.text[:trans.indexes[0]]...) + b = append(b, param1...) + b = append(b, trans.text[trans.indexes[1]:trans.indexes[2]]...) + b = append(b, param2...) + b = append(b, trans.text[trans.indexes[3]:]...) + + return string(b), nil +} + +// VerifyTranslations checks to ensures that no plural rules have been +// missed within the translations. +func (t *translator) VerifyTranslations() error { + + for k, v := range t.cardinalTanslations { + + for _, rule := range t.PluralsCardinal() { + + if v[rule] == nil { + return &ErrMissingPluralTranslation{locale: t.Locale(), translationType: "plural", rule: rule, key: k} + } + } + } + + for k, v := range t.ordinalTanslations { + + for _, rule := range t.PluralsOrdinal() { + + if v[rule] == nil { + return &ErrMissingPluralTranslation{locale: t.Locale(), translationType: "ordinal", rule: rule, key: k} + } + } + } + + for k, v := range t.rangeTanslations { + + for _, rule := range t.PluralsRange() { + + if v[rule] == nil { + return &ErrMissingPluralTranslation{locale: t.Locale(), translationType: "range", rule: rule, key: k} + } + } + } + + return nil +} diff --git a/vendor/github.com/go-playground/universal-translator/universal_translator.go b/vendor/github.com/go-playground/universal-translator/universal_translator.go new file mode 100644 index 0000000000..dbf707f5c7 --- /dev/null +++ b/vendor/github.com/go-playground/universal-translator/universal_translator.go @@ -0,0 +1,113 @@ +package ut + +import ( + "strings" + + "github.com/go-playground/locales" +) + +// UniversalTranslator holds all locale & translation data +type UniversalTranslator struct { + translators map[string]Translator + fallback Translator +} + +// New returns a new UniversalTranslator instance set with +// the fallback locale and locales it should support +func New(fallback locales.Translator, supportedLocales ...locales.Translator) *UniversalTranslator { + + t := &UniversalTranslator{ + translators: make(map[string]Translator), + } + + for _, v := range supportedLocales { + + trans := newTranslator(v) + t.translators[strings.ToLower(trans.Locale())] = trans + + if fallback.Locale() == v.Locale() { + t.fallback = trans + } + } + + if t.fallback == nil && fallback != nil { + t.fallback = newTranslator(fallback) + } + + return t +} + +// FindTranslator trys to find a Translator based on an array of locales +// and returns the first one it can find, otherwise returns the +// fallback translator. +func (t *UniversalTranslator) FindTranslator(locales ...string) (trans Translator, found bool) { + + for _, locale := range locales { + + if trans, found = t.translators[strings.ToLower(locale)]; found { + return + } + } + + return t.fallback, false +} + +// GetTranslator returns the specified translator for the given locale, +// or fallback if not found +func (t *UniversalTranslator) GetTranslator(locale string) (trans Translator, found bool) { + + if trans, found = t.translators[strings.ToLower(locale)]; found { + return + } + + return t.fallback, false +} + +// GetFallback returns the fallback locale +func (t *UniversalTranslator) GetFallback() Translator { + return t.fallback +} + +// AddTranslator adds the supplied translator, if it already exists the override param +// will be checked and if false an error will be returned, otherwise the translator will be +// overridden; if the fallback matches the supplied translator it will be overridden as well +// NOTE: this is normally only used when translator is embedded within a library +func (t *UniversalTranslator) AddTranslator(translator locales.Translator, override bool) error { + + lc := strings.ToLower(translator.Locale()) + _, ok := t.translators[lc] + if ok && !override { + return &ErrExistingTranslator{locale: translator.Locale()} + } + + trans := newTranslator(translator) + + if t.fallback.Locale() == translator.Locale() { + + // because it's optional to have a fallback, I don't impose that limitation + // don't know why you wouldn't but... + if !override { + return &ErrExistingTranslator{locale: translator.Locale()} + } + + t.fallback = trans + } + + t.translators[lc] = trans + + return nil +} + +// VerifyTranslations runs through all locales and identifies any issues +// eg. missing plural rules for a locale +func (t *UniversalTranslator) VerifyTranslations() (err error) { + + for _, trans := range t.translators { + err = trans.VerifyTranslations() + if err != nil { + return + } + } + + return +} diff --git a/vendor/github.com/go-playground/validator/v10/.gitignore b/vendor/github.com/go-playground/validator/v10/.gitignore new file mode 100644 index 0000000000..6e43fac0d5 --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/.gitignore @@ -0,0 +1,30 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test +bin + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof +*.test +*.out +*.txt +cover.html +README.html diff --git a/vendor/github.com/go-playground/validator/v10/LICENSE b/vendor/github.com/go-playground/validator/v10/LICENSE new file mode 100644 index 0000000000..6a2ae9aa4d --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Dean Karn + +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-playground/validator/v10/MAINTAINERS.md b/vendor/github.com/go-playground/validator/v10/MAINTAINERS.md new file mode 100644 index 0000000000..b809c4ce12 --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/MAINTAINERS.md @@ -0,0 +1,16 @@ +## Maintainers Guide + +### Semantic Versioning +Semantic versioning as defined [here](https://semver.org) must be strictly adhered to. + +### External Dependencies +Any new external dependencies MUST: +- Have a compatible LICENSE present. +- Be actively maintained. +- Be approved by @go-playground/admins + +### PR Merge Requirements +- Up-to-date branch. +- Passing tests and linting. +- CODEOWNERS approval. +- Tests that cover both the Happy and Unhappy paths. \ No newline at end of file diff --git a/vendor/github.com/go-playground/validator/v10/Makefile b/vendor/github.com/go-playground/validator/v10/Makefile new file mode 100644 index 0000000000..ec3455bd59 --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/Makefile @@ -0,0 +1,18 @@ +GOCMD=GO111MODULE=on go + +linters-install: + @golangci-lint --version >/dev/null 2>&1 || { \ + echo "installing linting tools..."; \ + curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.41.1; \ + } + +lint: linters-install + golangci-lint run + +test: + $(GOCMD) test -cover -race ./... + +bench: + $(GOCMD) test -bench=. -benchmem ./... + +.PHONY: test lint linters-install \ No newline at end of file diff --git a/vendor/github.com/go-playground/validator/v10/README.md b/vendor/github.com/go-playground/validator/v10/README.md new file mode 100644 index 0000000000..9d0a79e98c --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/README.md @@ -0,0 +1,338 @@ +Package validator +================= +[![Join the chat at https://gitter.im/go-playground/validator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +![Project status](https://img.shields.io/badge/version-10.11.1-green.svg) +[![Build Status](https://travis-ci.org/go-playground/validator.svg?branch=master)](https://travis-ci.org/go-playground/validator) +[![Coverage Status](https://coveralls.io/repos/go-playground/validator/badge.svg?branch=master&service=github)](https://coveralls.io/github/go-playground/validator?branch=master) +[![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/validator)](https://goreportcard.com/report/github.com/go-playground/validator) +[![GoDoc](https://godoc.org/github.com/go-playground/validator?status.svg)](https://pkg.go.dev/github.com/go-playground/validator/v10) +![License](https://img.shields.io/dub/l/vibe-d.svg) + +Package validator implements value validations for structs and individual fields based on tags. + +It has the following **unique** features: + +- Cross Field and Cross Struct validations by using validation tags or custom validators. +- Slice, Array and Map diving, which allows any or all levels of a multidimensional field to be validated. +- Ability to dive into both map keys and values for validation +- Handles type interface by determining it's underlying type prior to validation. +- Handles custom field types such as sql driver Valuer see [Valuer](https://golang.org/src/database/sql/driver/types.go?s=1210:1293#L29) +- Alias validation tags, which allows for mapping of several validations to a single tag for easier defining of validations on structs +- Extraction of custom defined Field Name e.g. can specify to extract the JSON name while validating and have it available in the resulting FieldError +- Customizable i18n aware error messages. +- Default validator for the [gin](https://github.com/gin-gonic/gin) web framework; upgrading from v8 to v9 in gin see [here](https://github.com/go-playground/validator/tree/master/_examples/gin-upgrading-overriding) + +Installation +------------ + +Use go get. + + go get github.com/go-playground/validator/v10 + +Then import the validator package into your own code. + + import "github.com/go-playground/validator/v10" + +Error Return Value +------- + +Validation functions return type error + +They return type error to avoid the issue discussed in the following, where err is always != nil: + +* http://stackoverflow.com/a/29138676/3158232 +* https://github.com/go-playground/validator/issues/134 + +Validator returns only InvalidValidationError for bad validation input, nil or ValidationErrors as type error; so, in your code all you need to do is check if the error returned is not nil, and if it's not check if error is InvalidValidationError ( if necessary, most of the time it isn't ) type cast it to type ValidationErrors like so: + +```go +err := validate.Struct(mystruct) +validationErrors := err.(validator.ValidationErrors) + ``` + +Usage and documentation +------ + +Please see https://pkg.go.dev/github.com/go-playground/validator/v10 for detailed usage docs. + +##### Examples: + +- [Simple](https://github.com/go-playground/validator/blob/master/_examples/simple/main.go) +- [Custom Field Types](https://github.com/go-playground/validator/blob/master/_examples/custom/main.go) +- [Struct Level](https://github.com/go-playground/validator/blob/master/_examples/struct-level/main.go) +- [Translations & Custom Errors](https://github.com/go-playground/validator/blob/master/_examples/translations/main.go) +- [Gin upgrade and/or override validator](https://github.com/go-playground/validator/tree/v9/_examples/gin-upgrading-overriding) +- [wash - an example application putting it all together](https://github.com/bluesuncorp/wash) + +Baked-in Validations +------ + +### Fields: + +| Tag | Description | +| - | - | +| eqcsfield | Field Equals Another Field (relative)| +| eqfield | Field Equals Another Field | +| fieldcontains | NOT DOCUMENTED IN doc.go | +| fieldexcludes | NOT DOCUMENTED IN doc.go | +| gtcsfield | Field Greater Than Another Relative Field | +| gtecsfield | Field Greater Than or Equal To Another Relative Field | +| gtefield | Field Greater Than or Equal To Another Field | +| gtfield | Field Greater Than Another Field | +| ltcsfield | Less Than Another Relative Field | +| ltecsfield | Less Than or Equal To Another Relative Field | +| ltefield | Less Than or Equal To Another Field | +| ltfield | Less Than Another Field | +| necsfield | Field Does Not Equal Another Field (relative) | +| nefield | Field Does Not Equal Another Field | + +### Network: + +| Tag | Description | +| - | - | +| cidr | Classless Inter-Domain Routing CIDR | +| cidrv4 | Classless Inter-Domain Routing CIDRv4 | +| cidrv6 | Classless Inter-Domain Routing CIDRv6 | +| datauri | Data URL | +| fqdn | Full Qualified Domain Name (FQDN) | +| hostname | Hostname RFC 952 | +| hostname_port | HostPort | +| hostname_rfc1123 | Hostname RFC 1123 | +| ip | Internet Protocol Address IP | +| ip4_addr | Internet Protocol Address IPv4 | +| ip6_addr | Internet Protocol Address IPv6 | +| ip_addr | Internet Protocol Address IP | +| ipv4 | Internet Protocol Address IPv4 | +| ipv6 | Internet Protocol Address IPv6 | +| mac | Media Access Control Address MAC | +| tcp4_addr | Transmission Control Protocol Address TCPv4 | +| tcp6_addr | Transmission Control Protocol Address TCPv6 | +| tcp_addr | Transmission Control Protocol Address TCP | +| udp4_addr | User Datagram Protocol Address UDPv4 | +| udp6_addr | User Datagram Protocol Address UDPv6 | +| udp_addr | User Datagram Protocol Address UDP | +| unix_addr | Unix domain socket end point Address | +| uri | URI String | +| url | URL String | +| url_encoded | URL Encoded | +| urn_rfc2141 | Urn RFC 2141 String | + +### Strings: + +| Tag | Description | +| - | - | +| alpha | Alpha Only | +| alphanum | Alphanumeric | +| alphanumunicode | Alphanumeric Unicode | +| alphaunicode | Alpha Unicode | +| ascii | ASCII | +| boolean | Boolean | +| contains | Contains | +| containsany | Contains Any | +| containsrune | Contains Rune | +| endsnotwith | Ends Not With | +| endswith | Ends With | +| excludes | Excludes | +| excludesall | Excludes All | +| excludesrune | Excludes Rune | +| lowercase | Lowercase | +| multibyte | Multi-Byte Characters | +| number | NOT DOCUMENTED IN doc.go | +| numeric | Numeric | +| printascii | Printable ASCII | +| startsnotwith | Starts Not With | +| startswith | Starts With | +| uppercase | Uppercase | + +### Format: +| Tag | Description | +| - | - | +| base64 | Base64 String | +| base64url | Base64URL String | +| bic | Business Identifier Code (ISO 9362) | +| bcp47_language_tag | Language tag (BCP 47) | +| btc_addr | Bitcoin Address | +| btc_addr_bech32 | Bitcoin Bech32 Address (segwit) | +| credit_card | Credit Card Number | +| datetime | Datetime | +| e164 | e164 formatted phone number | +| email | E-mail String +| eth_addr | Ethereum Address | +| hexadecimal | Hexadecimal String | +| hexcolor | Hexcolor String | +| hsl | HSL String | +| hsla | HSLA String | +| html | HTML Tags | +| html_encoded | HTML Encoded | +| isbn | International Standard Book Number | +| isbn10 | International Standard Book Number 10 | +| isbn13 | International Standard Book Number 13 | +| iso3166_1_alpha2 | Two-letter country code (ISO 3166-1 alpha-2) | +| iso3166_1_alpha3 | Three-letter country code (ISO 3166-1 alpha-3) | +| iso3166_1_alpha_numeric | Numeric country code (ISO 3166-1 numeric) | +| iso3166_2 | Country subdivision code (ISO 3166-2) | +| iso4217 | Currency code (ISO 4217) | +| json | JSON | +| jwt | JSON Web Token (JWT) | +| latitude | Latitude | +| longitude | Longitude | +| postcode_iso3166_alpha2 | Postcode | +| postcode_iso3166_alpha2_field | Postcode | +| rgb | RGB String | +| rgba | RGBA String | +| ssn | Social Security Number SSN | +| timezone | Timezone | +| uuid | Universally Unique Identifier UUID | +| uuid3 | Universally Unique Identifier UUID v3 | +| uuid3_rfc4122 | Universally Unique Identifier UUID v3 RFC4122 | +| uuid4 | Universally Unique Identifier UUID v4 | +| uuid4_rfc4122 | Universally Unique Identifier UUID v4 RFC4122 | +| uuid5 | Universally Unique Identifier UUID v5 | +| uuid5_rfc4122 | Universally Unique Identifier UUID v5 RFC4122 | +| uuid_rfc4122 | Universally Unique Identifier UUID RFC4122 | +| md4 | MD4 hash | +| md5 | MD5 hash | +| sha256 | SHA256 hash | +| sha384 | SHA384 hash | +| sha512 | SHA512 hash | +| ripemd128 | RIPEMD-128 hash | +| ripemd128 | RIPEMD-160 hash | +| tiger128 | TIGER128 hash | +| tiger160 | TIGER160 hash | +| tiger192 | TIGER192 hash | +| semver | Semantic Versioning 2.0.0 | +| ulid | Universally Unique Lexicographically Sortable Identifier ULID | + +### Comparisons: +| Tag | Description | +| - | - | +| eq | Equals | +| gt | Greater than| +| gte | Greater than or equal | +| lt | Less Than | +| lte | Less Than or Equal | +| ne | Not Equal | + +### Other: +| Tag | Description | +| - | - | +| dir | Directory | +| file | File path | +| isdefault | Is Default | +| len | Length | +| max | Maximum | +| min | Minimum | +| oneof | One Of | +| required | Required | +| required_if | Required If | +| required_unless | Required Unless | +| required_with | Required With | +| required_with_all | Required With All | +| required_without | Required Without | +| required_without_all | Required Without All | +| excluded_if | Excluded If | +| excluded_unless | Excluded Unless | +| excluded_with | Excluded With | +| excluded_with_all | Excluded With All | +| excluded_without | Excluded Without | +| excluded_without_all | Excluded Without All | +| unique | Unique | + +#### Aliases: +| Tag | Description | +| - | - | +| iscolor | hexcolor\|rgb\|rgba\|hsl\|hsla | +| country_code | iso3166_1_alpha2\|iso3166_1_alpha3\|iso3166_1_alpha_numeric | + +Benchmarks +------ +###### Run on MacBook Pro (15-inch, 2017) go version go1.10.2 darwin/amd64 +```go +goos: darwin +goarch: amd64 +pkg: github.com/go-playground/validator +BenchmarkFieldSuccess-8 20000000 83.6 ns/op 0 B/op 0 allocs/op +BenchmarkFieldSuccessParallel-8 50000000 26.8 ns/op 0 B/op 0 allocs/op +BenchmarkFieldFailure-8 5000000 291 ns/op 208 B/op 4 allocs/op +BenchmarkFieldFailureParallel-8 20000000 107 ns/op 208 B/op 4 allocs/op +BenchmarkFieldArrayDiveSuccess-8 2000000 623 ns/op 201 B/op 11 allocs/op +BenchmarkFieldArrayDiveSuccessParallel-8 10000000 237 ns/op 201 B/op 11 allocs/op +BenchmarkFieldArrayDiveFailure-8 2000000 859 ns/op 412 B/op 16 allocs/op +BenchmarkFieldArrayDiveFailureParallel-8 5000000 335 ns/op 413 B/op 16 allocs/op +BenchmarkFieldMapDiveSuccess-8 1000000 1292 ns/op 432 B/op 18 allocs/op +BenchmarkFieldMapDiveSuccessParallel-8 3000000 467 ns/op 432 B/op 18 allocs/op +BenchmarkFieldMapDiveFailure-8 1000000 1082 ns/op 512 B/op 16 allocs/op +BenchmarkFieldMapDiveFailureParallel-8 5000000 425 ns/op 512 B/op 16 allocs/op +BenchmarkFieldMapDiveWithKeysSuccess-8 1000000 1539 ns/op 480 B/op 21 allocs/op +BenchmarkFieldMapDiveWithKeysSuccessParallel-8 3000000 613 ns/op 480 B/op 21 allocs/op +BenchmarkFieldMapDiveWithKeysFailure-8 1000000 1413 ns/op 721 B/op 21 allocs/op +BenchmarkFieldMapDiveWithKeysFailureParallel-8 3000000 575 ns/op 721 B/op 21 allocs/op +BenchmarkFieldCustomTypeSuccess-8 10000000 216 ns/op 32 B/op 2 allocs/op +BenchmarkFieldCustomTypeSuccessParallel-8 20000000 82.2 ns/op 32 B/op 2 allocs/op +BenchmarkFieldCustomTypeFailure-8 5000000 274 ns/op 208 B/op 4 allocs/op +BenchmarkFieldCustomTypeFailureParallel-8 20000000 116 ns/op 208 B/op 4 allocs/op +BenchmarkFieldOrTagSuccess-8 2000000 740 ns/op 16 B/op 1 allocs/op +BenchmarkFieldOrTagSuccessParallel-8 3000000 474 ns/op 16 B/op 1 allocs/op +BenchmarkFieldOrTagFailure-8 3000000 471 ns/op 224 B/op 5 allocs/op +BenchmarkFieldOrTagFailureParallel-8 3000000 414 ns/op 224 B/op 5 allocs/op +BenchmarkStructLevelValidationSuccess-8 10000000 213 ns/op 32 B/op 2 allocs/op +BenchmarkStructLevelValidationSuccessParallel-8 20000000 91.8 ns/op 32 B/op 2 allocs/op +BenchmarkStructLevelValidationFailure-8 3000000 473 ns/op 304 B/op 8 allocs/op +BenchmarkStructLevelValidationFailureParallel-8 10000000 234 ns/op 304 B/op 8 allocs/op +BenchmarkStructSimpleCustomTypeSuccess-8 5000000 385 ns/op 32 B/op 2 allocs/op +BenchmarkStructSimpleCustomTypeSuccessParallel-8 10000000 161 ns/op 32 B/op 2 allocs/op +BenchmarkStructSimpleCustomTypeFailure-8 2000000 640 ns/op 424 B/op 9 allocs/op +BenchmarkStructSimpleCustomTypeFailureParallel-8 5000000 318 ns/op 440 B/op 10 allocs/op +BenchmarkStructFilteredSuccess-8 2000000 597 ns/op 288 B/op 9 allocs/op +BenchmarkStructFilteredSuccessParallel-8 10000000 266 ns/op 288 B/op 9 allocs/op +BenchmarkStructFilteredFailure-8 3000000 454 ns/op 256 B/op 7 allocs/op +BenchmarkStructFilteredFailureParallel-8 10000000 214 ns/op 256 B/op 7 allocs/op +BenchmarkStructPartialSuccess-8 3000000 502 ns/op 256 B/op 6 allocs/op +BenchmarkStructPartialSuccessParallel-8 10000000 225 ns/op 256 B/op 6 allocs/op +BenchmarkStructPartialFailure-8 2000000 702 ns/op 480 B/op 11 allocs/op +BenchmarkStructPartialFailureParallel-8 5000000 329 ns/op 480 B/op 11 allocs/op +BenchmarkStructExceptSuccess-8 2000000 793 ns/op 496 B/op 12 allocs/op +BenchmarkStructExceptSuccessParallel-8 10000000 193 ns/op 240 B/op 5 allocs/op +BenchmarkStructExceptFailure-8 2000000 639 ns/op 464 B/op 10 allocs/op +BenchmarkStructExceptFailureParallel-8 5000000 300 ns/op 464 B/op 10 allocs/op +BenchmarkStructSimpleCrossFieldSuccess-8 3000000 417 ns/op 72 B/op 3 allocs/op +BenchmarkStructSimpleCrossFieldSuccessParallel-8 10000000 163 ns/op 72 B/op 3 allocs/op +BenchmarkStructSimpleCrossFieldFailure-8 2000000 645 ns/op 304 B/op 8 allocs/op +BenchmarkStructSimpleCrossFieldFailureParallel-8 5000000 285 ns/op 304 B/op 8 allocs/op +BenchmarkStructSimpleCrossStructCrossFieldSuccess-8 3000000 588 ns/op 80 B/op 4 allocs/op +BenchmarkStructSimpleCrossStructCrossFieldSuccessParallel-8 10000000 221 ns/op 80 B/op 4 allocs/op +BenchmarkStructSimpleCrossStructCrossFieldFailure-8 2000000 868 ns/op 320 B/op 9 allocs/op +BenchmarkStructSimpleCrossStructCrossFieldFailureParallel-8 5000000 337 ns/op 320 B/op 9 allocs/op +BenchmarkStructSimpleSuccess-8 5000000 260 ns/op 0 B/op 0 allocs/op +BenchmarkStructSimpleSuccessParallel-8 20000000 90.6 ns/op 0 B/op 0 allocs/op +BenchmarkStructSimpleFailure-8 2000000 619 ns/op 424 B/op 9 allocs/op +BenchmarkStructSimpleFailureParallel-8 5000000 296 ns/op 424 B/op 9 allocs/op +BenchmarkStructComplexSuccess-8 1000000 1454 ns/op 128 B/op 8 allocs/op +BenchmarkStructComplexSuccessParallel-8 3000000 579 ns/op 128 B/op 8 allocs/op +BenchmarkStructComplexFailure-8 300000 4140 ns/op 3041 B/op 53 allocs/op +BenchmarkStructComplexFailureParallel-8 1000000 2127 ns/op 3041 B/op 53 allocs/op +BenchmarkOneof-8 10000000 140 ns/op 0 B/op 0 allocs/op +BenchmarkOneofParallel-8 20000000 70.1 ns/op 0 B/op 0 allocs/op +``` + +Complementary Software +---------------------- + +Here is a list of software that complements using this library either pre or post validation. + +* [form](https://github.com/go-playground/form) - Decodes url.Values into Go value(s) and Encodes Go value(s) into url.Values. Dual Array and Full map support. +* [mold](https://github.com/go-playground/mold) - A general library to help modify or set data within data structures and other objects + +How to Contribute +------ + +Make a pull request... + +License +------- +Distributed under MIT License, please see license file within the code for more details. + +Maintainers +----------- +This project has grown large enough that more than one person is required to properly support the community. +If you are interested in becoming a maintainer please reach out to me https://github.com/deankarn diff --git a/vendor/github.com/go-playground/validator/v10/baked_in.go b/vendor/github.com/go-playground/validator/v10/baked_in.go new file mode 100644 index 0000000000..c9b1db402e --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/baked_in.go @@ -0,0 +1,2526 @@ +package validator + +import ( + "bytes" + "context" + "crypto/sha256" + "encoding/hex" + "encoding/json" + "fmt" + "net" + "net/url" + "os" + "reflect" + "strconv" + "strings" + "sync" + "time" + "unicode/utf8" + + "golang.org/x/crypto/sha3" + "golang.org/x/text/language" + + urn "github.com/leodido/go-urn" +) + +// Func accepts a FieldLevel interface for all validation needs. The return +// value should be true when validation succeeds. +type Func func(fl FieldLevel) bool + +// FuncCtx accepts a context.Context and FieldLevel interface for all +// validation needs. The return value should be true when validation succeeds. +type FuncCtx func(ctx context.Context, fl FieldLevel) bool + +// wrapFunc wraps noramal Func makes it compatible with FuncCtx +func wrapFunc(fn Func) FuncCtx { + if fn == nil { + return nil // be sure not to wrap a bad function. + } + return func(ctx context.Context, fl FieldLevel) bool { + return fn(fl) + } +} + +var ( + restrictedTags = map[string]struct{}{ + diveTag: {}, + keysTag: {}, + endKeysTag: {}, + structOnlyTag: {}, + omitempty: {}, + skipValidationTag: {}, + utf8HexComma: {}, + utf8Pipe: {}, + noStructLevelTag: {}, + requiredTag: {}, + isdefault: {}, + } + + // bakedInAliases is a default mapping of a single validation tag that + // defines a common or complex set of validation(s) to simplify + // adding validation to structs. + bakedInAliases = map[string]string{ + "iscolor": "hexcolor|rgb|rgba|hsl|hsla", + "country_code": "iso3166_1_alpha2|iso3166_1_alpha3|iso3166_1_alpha_numeric", + } + + // bakedInValidators is the default map of ValidationFunc + // you can add, remove or even replace items to suite your needs, + // or even disregard and use your own map if so desired. + bakedInValidators = map[string]Func{ + "required": hasValue, + "required_if": requiredIf, + "required_unless": requiredUnless, + "required_with": requiredWith, + "required_with_all": requiredWithAll, + "required_without": requiredWithout, + "required_without_all": requiredWithoutAll, + "excluded_if": excludedIf, + "excluded_unless": excludedUnless, + "excluded_with": excludedWith, + "excluded_with_all": excludedWithAll, + "excluded_without": excludedWithout, + "excluded_without_all": excludedWithoutAll, + "isdefault": isDefault, + "len": hasLengthOf, + "min": hasMinOf, + "max": hasMaxOf, + "eq": isEq, + "ne": isNe, + "lt": isLt, + "lte": isLte, + "gt": isGt, + "gte": isGte, + "eqfield": isEqField, + "eqcsfield": isEqCrossStructField, + "necsfield": isNeCrossStructField, + "gtcsfield": isGtCrossStructField, + "gtecsfield": isGteCrossStructField, + "ltcsfield": isLtCrossStructField, + "ltecsfield": isLteCrossStructField, + "nefield": isNeField, + "gtefield": isGteField, + "gtfield": isGtField, + "ltefield": isLteField, + "ltfield": isLtField, + "fieldcontains": fieldContains, + "fieldexcludes": fieldExcludes, + "alpha": isAlpha, + "alphanum": isAlphanum, + "alphaunicode": isAlphaUnicode, + "alphanumunicode": isAlphanumUnicode, + "boolean": isBoolean, + "numeric": isNumeric, + "number": isNumber, + "hexadecimal": isHexadecimal, + "hexcolor": isHEXColor, + "rgb": isRGB, + "rgba": isRGBA, + "hsl": isHSL, + "hsla": isHSLA, + "e164": isE164, + "email": isEmail, + "url": isURL, + "uri": isURI, + "urn_rfc2141": isUrnRFC2141, // RFC 2141 + "file": isFile, + "base64": isBase64, + "base64url": isBase64URL, + "contains": contains, + "containsany": containsAny, + "containsrune": containsRune, + "excludes": excludes, + "excludesall": excludesAll, + "excludesrune": excludesRune, + "startswith": startsWith, + "endswith": endsWith, + "startsnotwith": startsNotWith, + "endsnotwith": endsNotWith, + "isbn": isISBN, + "isbn10": isISBN10, + "isbn13": isISBN13, + "eth_addr": isEthereumAddress, + "btc_addr": isBitcoinAddress, + "btc_addr_bech32": isBitcoinBech32Address, + "uuid": isUUID, + "uuid3": isUUID3, + "uuid4": isUUID4, + "uuid5": isUUID5, + "uuid_rfc4122": isUUIDRFC4122, + "uuid3_rfc4122": isUUID3RFC4122, + "uuid4_rfc4122": isUUID4RFC4122, + "uuid5_rfc4122": isUUID5RFC4122, + "ulid": isULID, + "md4": isMD4, + "md5": isMD5, + "sha256": isSHA256, + "sha384": isSHA384, + "sha512": isSHA512, + "ripemd128": isRIPEMD128, + "ripemd160": isRIPEMD160, + "tiger128": isTIGER128, + "tiger160": isTIGER160, + "tiger192": isTIGER192, + "ascii": isASCII, + "printascii": isPrintableASCII, + "multibyte": hasMultiByteCharacter, + "datauri": isDataURI, + "latitude": isLatitude, + "longitude": isLongitude, + "ssn": isSSN, + "ipv4": isIPv4, + "ipv6": isIPv6, + "ip": isIP, + "cidrv4": isCIDRv4, + "cidrv6": isCIDRv6, + "cidr": isCIDR, + "tcp4_addr": isTCP4AddrResolvable, + "tcp6_addr": isTCP6AddrResolvable, + "tcp_addr": isTCPAddrResolvable, + "udp4_addr": isUDP4AddrResolvable, + "udp6_addr": isUDP6AddrResolvable, + "udp_addr": isUDPAddrResolvable, + "ip4_addr": isIP4AddrResolvable, + "ip6_addr": isIP6AddrResolvable, + "ip_addr": isIPAddrResolvable, + "unix_addr": isUnixAddrResolvable, + "mac": isMAC, + "hostname": isHostnameRFC952, // RFC 952 + "hostname_rfc1123": isHostnameRFC1123, // RFC 1123 + "fqdn": isFQDN, + "unique": isUnique, + "oneof": isOneOf, + "html": isHTML, + "html_encoded": isHTMLEncoded, + "url_encoded": isURLEncoded, + "dir": isDir, + "json": isJSON, + "jwt": isJWT, + "hostname_port": isHostnamePort, + "lowercase": isLowercase, + "uppercase": isUppercase, + "datetime": isDatetime, + "timezone": isTimeZone, + "iso3166_1_alpha2": isIso3166Alpha2, + "iso3166_1_alpha3": isIso3166Alpha3, + "iso3166_1_alpha_numeric": isIso3166AlphaNumeric, + "iso3166_2": isIso31662, + "iso4217": isIso4217, + "iso4217_numeric": isIso4217Numeric, + "bcp47_language_tag": isBCP47LanguageTag, + "postcode_iso3166_alpha2": isPostcodeByIso3166Alpha2, + "postcode_iso3166_alpha2_field": isPostcodeByIso3166Alpha2Field, + "bic": isIsoBicFormat, + "semver": isSemverFormat, + "dns_rfc1035_label": isDnsRFC1035LabelFormat, + "credit_card": isCreditCard, + } +) + +var ( + oneofValsCache = map[string][]string{} + oneofValsCacheRWLock = sync.RWMutex{} +) + +func parseOneOfParam2(s string) []string { + oneofValsCacheRWLock.RLock() + vals, ok := oneofValsCache[s] + oneofValsCacheRWLock.RUnlock() + if !ok { + oneofValsCacheRWLock.Lock() + vals = splitParamsRegex.FindAllString(s, -1) + for i := 0; i < len(vals); i++ { + vals[i] = strings.Replace(vals[i], "'", "", -1) + } + oneofValsCache[s] = vals + oneofValsCacheRWLock.Unlock() + } + return vals +} + +func isURLEncoded(fl FieldLevel) bool { + return uRLEncodedRegex.MatchString(fl.Field().String()) +} + +func isHTMLEncoded(fl FieldLevel) bool { + return hTMLEncodedRegex.MatchString(fl.Field().String()) +} + +func isHTML(fl FieldLevel) bool { + return hTMLRegex.MatchString(fl.Field().String()) +} + +func isOneOf(fl FieldLevel) bool { + vals := parseOneOfParam2(fl.Param()) + + field := fl.Field() + + var v string + switch field.Kind() { + case reflect.String: + v = field.String() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + v = strconv.FormatInt(field.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + v = strconv.FormatUint(field.Uint(), 10) + default: + panic(fmt.Sprintf("Bad field type %T", field.Interface())) + } + for i := 0; i < len(vals); i++ { + if vals[i] == v { + return true + } + } + return false +} + +// isUnique is the validation function for validating if each array|slice|map value is unique +func isUnique(fl FieldLevel) bool { + field := fl.Field() + param := fl.Param() + v := reflect.ValueOf(struct{}{}) + + switch field.Kind() { + case reflect.Slice, reflect.Array: + elem := field.Type().Elem() + if elem.Kind() == reflect.Ptr { + elem = elem.Elem() + } + + if param == "" { + m := reflect.MakeMap(reflect.MapOf(elem, v.Type())) + + for i := 0; i < field.Len(); i++ { + m.SetMapIndex(reflect.Indirect(field.Index(i)), v) + } + return field.Len() == m.Len() + } + + sf, ok := elem.FieldByName(param) + if !ok { + panic(fmt.Sprintf("Bad field name %s", param)) + } + + sfTyp := sf.Type + if sfTyp.Kind() == reflect.Ptr { + sfTyp = sfTyp.Elem() + } + + m := reflect.MakeMap(reflect.MapOf(sfTyp, v.Type())) + for i := 0; i < field.Len(); i++ { + m.SetMapIndex(reflect.Indirect(reflect.Indirect(field.Index(i)).FieldByName(param)), v) + } + return field.Len() == m.Len() + case reflect.Map: + m := reflect.MakeMap(reflect.MapOf(field.Type().Elem(), v.Type())) + + for _, k := range field.MapKeys() { + m.SetMapIndex(field.MapIndex(k), v) + } + return field.Len() == m.Len() + default: + panic(fmt.Sprintf("Bad field type %T", field.Interface())) + } +} + +// isMAC is the validation function for validating if the field's value is a valid MAC address. +func isMAC(fl FieldLevel) bool { + _, err := net.ParseMAC(fl.Field().String()) + + return err == nil +} + +// isCIDRv4 is the validation function for validating if the field's value is a valid v4 CIDR address. +func isCIDRv4(fl FieldLevel) bool { + ip, _, err := net.ParseCIDR(fl.Field().String()) + + return err == nil && ip.To4() != nil +} + +// isCIDRv6 is the validation function for validating if the field's value is a valid v6 CIDR address. +func isCIDRv6(fl FieldLevel) bool { + ip, _, err := net.ParseCIDR(fl.Field().String()) + + return err == nil && ip.To4() == nil +} + +// isCIDR is the validation function for validating if the field's value is a valid v4 or v6 CIDR address. +func isCIDR(fl FieldLevel) bool { + _, _, err := net.ParseCIDR(fl.Field().String()) + + return err == nil +} + +// isIPv4 is the validation function for validating if a value is a valid v4 IP address. +func isIPv4(fl FieldLevel) bool { + ip := net.ParseIP(fl.Field().String()) + + return ip != nil && ip.To4() != nil +} + +// isIPv6 is the validation function for validating if the field's value is a valid v6 IP address. +func isIPv6(fl FieldLevel) bool { + ip := net.ParseIP(fl.Field().String()) + + return ip != nil && ip.To4() == nil +} + +// isIP is the validation function for validating if the field's value is a valid v4 or v6 IP address. +func isIP(fl FieldLevel) bool { + ip := net.ParseIP(fl.Field().String()) + + return ip != nil +} + +// isSSN is the validation function for validating if the field's value is a valid SSN. +func isSSN(fl FieldLevel) bool { + field := fl.Field() + + if field.Len() != 11 { + return false + } + + return sSNRegex.MatchString(field.String()) +} + +// isLongitude is the validation function for validating if the field's value is a valid longitude coordinate. +func isLongitude(fl FieldLevel) bool { + field := fl.Field() + + var v string + switch field.Kind() { + case reflect.String: + v = field.String() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + v = strconv.FormatInt(field.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + v = strconv.FormatUint(field.Uint(), 10) + case reflect.Float32: + v = strconv.FormatFloat(field.Float(), 'f', -1, 32) + case reflect.Float64: + v = strconv.FormatFloat(field.Float(), 'f', -1, 64) + default: + panic(fmt.Sprintf("Bad field type %T", field.Interface())) + } + + return longitudeRegex.MatchString(v) +} + +// isLatitude is the validation function for validating if the field's value is a valid latitude coordinate. +func isLatitude(fl FieldLevel) bool { + field := fl.Field() + + var v string + switch field.Kind() { + case reflect.String: + v = field.String() + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + v = strconv.FormatInt(field.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + v = strconv.FormatUint(field.Uint(), 10) + case reflect.Float32: + v = strconv.FormatFloat(field.Float(), 'f', -1, 32) + case reflect.Float64: + v = strconv.FormatFloat(field.Float(), 'f', -1, 64) + default: + panic(fmt.Sprintf("Bad field type %T", field.Interface())) + } + + return latitudeRegex.MatchString(v) +} + +// isDataURI is the validation function for validating if the field's value is a valid data URI. +func isDataURI(fl FieldLevel) bool { + uri := strings.SplitN(fl.Field().String(), ",", 2) + + if len(uri) != 2 { + return false + } + + if !dataURIRegex.MatchString(uri[0]) { + return false + } + + return base64Regex.MatchString(uri[1]) +} + +// hasMultiByteCharacter is the validation function for validating if the field's value has a multi byte character. +func hasMultiByteCharacter(fl FieldLevel) bool { + field := fl.Field() + + if field.Len() == 0 { + return true + } + + return multibyteRegex.MatchString(field.String()) +} + +// isPrintableASCII is the validation function for validating if the field's value is a valid printable ASCII character. +func isPrintableASCII(fl FieldLevel) bool { + return printableASCIIRegex.MatchString(fl.Field().String()) +} + +// isASCII is the validation function for validating if the field's value is a valid ASCII character. +func isASCII(fl FieldLevel) bool { + return aSCIIRegex.MatchString(fl.Field().String()) +} + +// isUUID5 is the validation function for validating if the field's value is a valid v5 UUID. +func isUUID5(fl FieldLevel) bool { + return uUID5Regex.MatchString(fl.Field().String()) +} + +// isUUID4 is the validation function for validating if the field's value is a valid v4 UUID. +func isUUID4(fl FieldLevel) bool { + return uUID4Regex.MatchString(fl.Field().String()) +} + +// isUUID3 is the validation function for validating if the field's value is a valid v3 UUID. +func isUUID3(fl FieldLevel) bool { + return uUID3Regex.MatchString(fl.Field().String()) +} + +// isUUID is the validation function for validating if the field's value is a valid UUID of any version. +func isUUID(fl FieldLevel) bool { + return uUIDRegex.MatchString(fl.Field().String()) +} + +// isUUID5RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v5 UUID. +func isUUID5RFC4122(fl FieldLevel) bool { + return uUID5RFC4122Regex.MatchString(fl.Field().String()) +} + +// isUUID4RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v4 UUID. +func isUUID4RFC4122(fl FieldLevel) bool { + return uUID4RFC4122Regex.MatchString(fl.Field().String()) +} + +// isUUID3RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v3 UUID. +func isUUID3RFC4122(fl FieldLevel) bool { + return uUID3RFC4122Regex.MatchString(fl.Field().String()) +} + +// isUUIDRFC4122 is the validation function for validating if the field's value is a valid RFC4122 UUID of any version. +func isUUIDRFC4122(fl FieldLevel) bool { + return uUIDRFC4122Regex.MatchString(fl.Field().String()) +} + +// isULID is the validation function for validating if the field's value is a valid ULID. +func isULID(fl FieldLevel) bool { + return uLIDRegex.MatchString(fl.Field().String()) +} + +// isMD4 is the validation function for validating if the field's value is a valid MD4. +func isMD4(fl FieldLevel) bool { + return md4Regex.MatchString(fl.Field().String()) +} + +// isMD5 is the validation function for validating if the field's value is a valid MD5. +func isMD5(fl FieldLevel) bool { + return md5Regex.MatchString(fl.Field().String()) +} + +// isSHA256 is the validation function for validating if the field's value is a valid SHA256. +func isSHA256(fl FieldLevel) bool { + return sha256Regex.MatchString(fl.Field().String()) +} + +// isSHA384 is the validation function for validating if the field's value is a valid SHA384. +func isSHA384(fl FieldLevel) bool { + return sha384Regex.MatchString(fl.Field().String()) +} + +// isSHA512 is the validation function for validating if the field's value is a valid SHA512. +func isSHA512(fl FieldLevel) bool { + return sha512Regex.MatchString(fl.Field().String()) +} + +// isRIPEMD128 is the validation function for validating if the field's value is a valid PIPEMD128. +func isRIPEMD128(fl FieldLevel) bool { + return ripemd128Regex.MatchString(fl.Field().String()) +} + +// isRIPEMD160 is the validation function for validating if the field's value is a valid PIPEMD160. +func isRIPEMD160(fl FieldLevel) bool { + return ripemd160Regex.MatchString(fl.Field().String()) +} + +// isTIGER128 is the validation function for validating if the field's value is a valid TIGER128. +func isTIGER128(fl FieldLevel) bool { + return tiger128Regex.MatchString(fl.Field().String()) +} + +// isTIGER160 is the validation function for validating if the field's value is a valid TIGER160. +func isTIGER160(fl FieldLevel) bool { + return tiger160Regex.MatchString(fl.Field().String()) +} + +// isTIGER192 is the validation function for validating if the field's value is a valid isTIGER192. +func isTIGER192(fl FieldLevel) bool { + return tiger192Regex.MatchString(fl.Field().String()) +} + +// isISBN is the validation function for validating if the field's value is a valid v10 or v13 ISBN. +func isISBN(fl FieldLevel) bool { + return isISBN10(fl) || isISBN13(fl) +} + +// isISBN13 is the validation function for validating if the field's value is a valid v13 ISBN. +func isISBN13(fl FieldLevel) bool { + s := strings.Replace(strings.Replace(fl.Field().String(), "-", "", 4), " ", "", 4) + + if !iSBN13Regex.MatchString(s) { + return false + } + + var checksum int32 + var i int32 + + factor := []int32{1, 3} + + for i = 0; i < 12; i++ { + checksum += factor[i%2] * int32(s[i]-'0') + } + + return (int32(s[12]-'0'))-((10-(checksum%10))%10) == 0 +} + +// isISBN10 is the validation function for validating if the field's value is a valid v10 ISBN. +func isISBN10(fl FieldLevel) bool { + s := strings.Replace(strings.Replace(fl.Field().String(), "-", "", 3), " ", "", 3) + + if !iSBN10Regex.MatchString(s) { + return false + } + + var checksum int32 + var i int32 + + for i = 0; i < 9; i++ { + checksum += (i + 1) * int32(s[i]-'0') + } + + if s[9] == 'X' { + checksum += 10 * 10 + } else { + checksum += 10 * int32(s[9]-'0') + } + + return checksum%11 == 0 +} + +// isEthereumAddress is the validation function for validating if the field's value is a valid Ethereum address. +func isEthereumAddress(fl FieldLevel) bool { + address := fl.Field().String() + + if !ethAddressRegex.MatchString(address) { + return false + } + + if ethAddressRegexUpper.MatchString(address) || ethAddressRegexLower.MatchString(address) { + return true + } + + // Checksum validation. Reference: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-55.md + address = address[2:] // Skip "0x" prefix. + h := sha3.NewLegacyKeccak256() + // hash.Hash's io.Writer implementation says it never returns an error. https://golang.org/pkg/hash/#Hash + _, _ = h.Write([]byte(strings.ToLower(address))) + hash := hex.EncodeToString(h.Sum(nil)) + + for i := 0; i < len(address); i++ { + if address[i] <= '9' { // Skip 0-9 digits: they don't have upper/lower-case. + continue + } + if hash[i] > '7' && address[i] >= 'a' || hash[i] <= '7' && address[i] <= 'F' { + return false + } + } + + return true +} + +// isBitcoinAddress is the validation function for validating if the field's value is a valid btc address +func isBitcoinAddress(fl FieldLevel) bool { + address := fl.Field().String() + + if !btcAddressRegex.MatchString(address) { + return false + } + + alphabet := []byte("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz") + + decode := [25]byte{} + + for _, n := range []byte(address) { + d := bytes.IndexByte(alphabet, n) + + for i := 24; i >= 0; i-- { + d += 58 * int(decode[i]) + decode[i] = byte(d % 256) + d /= 256 + } + } + + h := sha256.New() + _, _ = h.Write(decode[:21]) + d := h.Sum([]byte{}) + h = sha256.New() + _, _ = h.Write(d) + + validchecksum := [4]byte{} + computedchecksum := [4]byte{} + + copy(computedchecksum[:], h.Sum(d[:0])) + copy(validchecksum[:], decode[21:]) + + return validchecksum == computedchecksum +} + +// isBitcoinBech32Address is the validation function for validating if the field's value is a valid bech32 btc address +func isBitcoinBech32Address(fl FieldLevel) bool { + address := fl.Field().String() + + if !btcLowerAddressRegexBech32.MatchString(address) && !btcUpperAddressRegexBech32.MatchString(address) { + return false + } + + am := len(address) % 8 + + if am == 0 || am == 3 || am == 5 { + return false + } + + address = strings.ToLower(address) + + alphabet := "qpzry9x8gf2tvdw0s3jn54khce6mua7l" + + hr := []int{3, 3, 0, 2, 3} // the human readable part will always be bc + addr := address[3:] + dp := make([]int, 0, len(addr)) + + for _, c := range addr { + dp = append(dp, strings.IndexRune(alphabet, c)) + } + + ver := dp[0] + + if ver < 0 || ver > 16 { + return false + } + + if ver == 0 { + if len(address) != 42 && len(address) != 62 { + return false + } + } + + values := append(hr, dp...) + + GEN := []int{0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3} + + p := 1 + + for _, v := range values { + b := p >> 25 + p = (p&0x1ffffff)<<5 ^ v + + for i := 0; i < 5; i++ { + if (b>>uint(i))&1 == 1 { + p ^= GEN[i] + } + } + } + + if p != 1 { + return false + } + + b := uint(0) + acc := 0 + mv := (1 << 5) - 1 + var sw []int + + for _, v := range dp[1 : len(dp)-6] { + acc = (acc << 5) | v + b += 5 + for b >= 8 { + b -= 8 + sw = append(sw, (acc>>b)&mv) + } + } + + if len(sw) < 2 || len(sw) > 40 { + return false + } + + return true +} + +// excludesRune is the validation function for validating that the field's value does not contain the rune specified within the param. +func excludesRune(fl FieldLevel) bool { + return !containsRune(fl) +} + +// excludesAll is the validation function for validating that the field's value does not contain any of the characters specified within the param. +func excludesAll(fl FieldLevel) bool { + return !containsAny(fl) +} + +// excludes is the validation function for validating that the field's value does not contain the text specified within the param. +func excludes(fl FieldLevel) bool { + return !contains(fl) +} + +// containsRune is the validation function for validating that the field's value contains the rune specified within the param. +func containsRune(fl FieldLevel) bool { + r, _ := utf8.DecodeRuneInString(fl.Param()) + + return strings.ContainsRune(fl.Field().String(), r) +} + +// containsAny is the validation function for validating that the field's value contains any of the characters specified within the param. +func containsAny(fl FieldLevel) bool { + return strings.ContainsAny(fl.Field().String(), fl.Param()) +} + +// contains is the validation function for validating that the field's value contains the text specified within the param. +func contains(fl FieldLevel) bool { + return strings.Contains(fl.Field().String(), fl.Param()) +} + +// startsWith is the validation function for validating that the field's value starts with the text specified within the param. +func startsWith(fl FieldLevel) bool { + return strings.HasPrefix(fl.Field().String(), fl.Param()) +} + +// endsWith is the validation function for validating that the field's value ends with the text specified within the param. +func endsWith(fl FieldLevel) bool { + return strings.HasSuffix(fl.Field().String(), fl.Param()) +} + +// startsNotWith is the validation function for validating that the field's value does not start with the text specified within the param. +func startsNotWith(fl FieldLevel) bool { + return !startsWith(fl) +} + +// endsNotWith is the validation function for validating that the field's value does not end with the text specified within the param. +func endsNotWith(fl FieldLevel) bool { + return !endsWith(fl) +} + +// fieldContains is the validation function for validating if the current field's value contains the field specified by the param's value. +func fieldContains(fl FieldLevel) bool { + field := fl.Field() + + currentField, _, ok := fl.GetStructFieldOK() + + if !ok { + return false + } + + return strings.Contains(field.String(), currentField.String()) +} + +// fieldExcludes is the validation function for validating if the current field's value excludes the field specified by the param's value. +func fieldExcludes(fl FieldLevel) bool { + field := fl.Field() + + currentField, _, ok := fl.GetStructFieldOK() + if !ok { + return true + } + + return !strings.Contains(field.String(), currentField.String()) +} + +// isNeField is the validation function for validating if the current field's value is not equal to the field specified by the param's value. +func isNeField(fl FieldLevel) bool { + field := fl.Field() + kind := field.Kind() + + currentField, currentKind, ok := fl.GetStructFieldOK() + + if !ok || currentKind != kind { + return true + } + + switch kind { + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return field.Int() != currentField.Int() + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return field.Uint() != currentField.Uint() + + case reflect.Float32, reflect.Float64: + return field.Float() != currentField.Float() + + case reflect.Slice, reflect.Map, reflect.Array: + return int64(field.Len()) != int64(currentField.Len()) + + case reflect.Bool: + return field.Bool() != currentField.Bool() + + case reflect.Struct: + + fieldType := field.Type() + + if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) { + + t := currentField.Interface().(time.Time) + fieldTime := field.Interface().(time.Time) + + return !fieldTime.Equal(t) + } + + // Not Same underlying type i.e. struct and time + if fieldType != currentField.Type() { + return true + } + } + + // default reflect.String: + return field.String() != currentField.String() +} + +// isNe is the validation function for validating that the field's value does not equal the provided param value. +func isNe(fl FieldLevel) bool { + return !isEq(fl) +} + +// isLteCrossStructField is the validation function for validating if the current field's value is less than or equal to the field, within a separate struct, specified by the param's value. +func isLteCrossStructField(fl FieldLevel) bool { + field := fl.Field() + kind := field.Kind() + + topField, topKind, ok := fl.GetStructFieldOK() + if !ok || topKind != kind { + return false + } + + switch kind { + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return field.Int() <= topField.Int() + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return field.Uint() <= topField.Uint() + + case reflect.Float32, reflect.Float64: + return field.Float() <= topField.Float() + + case reflect.Slice, reflect.Map, reflect.Array: + return int64(field.Len()) <= int64(topField.Len()) + + case reflect.Struct: + + fieldType := field.Type() + + if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) { + + fieldTime := field.Convert(timeType).Interface().(time.Time) + topTime := topField.Convert(timeType).Interface().(time.Time) + + return fieldTime.Before(topTime) || fieldTime.Equal(topTime) + } + + // Not Same underlying type i.e. struct and time + if fieldType != topField.Type() { + return false + } + } + + // default reflect.String: + return field.String() <= topField.String() +} + +// isLtCrossStructField is the validation function for validating if the current field's value is less than the field, within a separate struct, specified by the param's value. +// NOTE: This is exposed for use within your own custom functions and not intended to be called directly. +func isLtCrossStructField(fl FieldLevel) bool { + field := fl.Field() + kind := field.Kind() + + topField, topKind, ok := fl.GetStructFieldOK() + if !ok || topKind != kind { + return false + } + + switch kind { + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return field.Int() < topField.Int() + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return field.Uint() < topField.Uint() + + case reflect.Float32, reflect.Float64: + return field.Float() < topField.Float() + + case reflect.Slice, reflect.Map, reflect.Array: + return int64(field.Len()) < int64(topField.Len()) + + case reflect.Struct: + + fieldType := field.Type() + + if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) { + + fieldTime := field.Convert(timeType).Interface().(time.Time) + topTime := topField.Convert(timeType).Interface().(time.Time) + + return fieldTime.Before(topTime) + } + + // Not Same underlying type i.e. struct and time + if fieldType != topField.Type() { + return false + } + } + + // default reflect.String: + return field.String() < topField.String() +} + +// isGteCrossStructField is the validation function for validating if the current field's value is greater than or equal to the field, within a separate struct, specified by the param's value. +func isGteCrossStructField(fl FieldLevel) bool { + field := fl.Field() + kind := field.Kind() + + topField, topKind, ok := fl.GetStructFieldOK() + if !ok || topKind != kind { + return false + } + + switch kind { + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return field.Int() >= topField.Int() + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return field.Uint() >= topField.Uint() + + case reflect.Float32, reflect.Float64: + return field.Float() >= topField.Float() + + case reflect.Slice, reflect.Map, reflect.Array: + return int64(field.Len()) >= int64(topField.Len()) + + case reflect.Struct: + + fieldType := field.Type() + + if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) { + + fieldTime := field.Convert(timeType).Interface().(time.Time) + topTime := topField.Convert(timeType).Interface().(time.Time) + + return fieldTime.After(topTime) || fieldTime.Equal(topTime) + } + + // Not Same underlying type i.e. struct and time + if fieldType != topField.Type() { + return false + } + } + + // default reflect.String: + return field.String() >= topField.String() +} + +// isGtCrossStructField is the validation function for validating if the current field's value is greater than the field, within a separate struct, specified by the param's value. +func isGtCrossStructField(fl FieldLevel) bool { + field := fl.Field() + kind := field.Kind() + + topField, topKind, ok := fl.GetStructFieldOK() + if !ok || topKind != kind { + return false + } + + switch kind { + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return field.Int() > topField.Int() + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return field.Uint() > topField.Uint() + + case reflect.Float32, reflect.Float64: + return field.Float() > topField.Float() + + case reflect.Slice, reflect.Map, reflect.Array: + return int64(field.Len()) > int64(topField.Len()) + + case reflect.Struct: + + fieldType := field.Type() + + if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) { + + fieldTime := field.Convert(timeType).Interface().(time.Time) + topTime := topField.Convert(timeType).Interface().(time.Time) + + return fieldTime.After(topTime) + } + + // Not Same underlying type i.e. struct and time + if fieldType != topField.Type() { + return false + } + } + + // default reflect.String: + return field.String() > topField.String() +} + +// isNeCrossStructField is the validation function for validating that the current field's value is not equal to the field, within a separate struct, specified by the param's value. +func isNeCrossStructField(fl FieldLevel) bool { + field := fl.Field() + kind := field.Kind() + + topField, currentKind, ok := fl.GetStructFieldOK() + if !ok || currentKind != kind { + return true + } + + switch kind { + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return topField.Int() != field.Int() + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return topField.Uint() != field.Uint() + + case reflect.Float32, reflect.Float64: + return topField.Float() != field.Float() + + case reflect.Slice, reflect.Map, reflect.Array: + return int64(topField.Len()) != int64(field.Len()) + + case reflect.Bool: + return topField.Bool() != field.Bool() + + case reflect.Struct: + + fieldType := field.Type() + + if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) { + + t := field.Convert(timeType).Interface().(time.Time) + fieldTime := topField.Convert(timeType).Interface().(time.Time) + + return !fieldTime.Equal(t) + } + + // Not Same underlying type i.e. struct and time + if fieldType != topField.Type() { + return true + } + } + + // default reflect.String: + return topField.String() != field.String() +} + +// isEqCrossStructField is the validation function for validating that the current field's value is equal to the field, within a separate struct, specified by the param's value. +func isEqCrossStructField(fl FieldLevel) bool { + field := fl.Field() + kind := field.Kind() + + topField, topKind, ok := fl.GetStructFieldOK() + if !ok || topKind != kind { + return false + } + + switch kind { + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return topField.Int() == field.Int() + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return topField.Uint() == field.Uint() + + case reflect.Float32, reflect.Float64: + return topField.Float() == field.Float() + + case reflect.Slice, reflect.Map, reflect.Array: + return int64(topField.Len()) == int64(field.Len()) + + case reflect.Bool: + return topField.Bool() == field.Bool() + + case reflect.Struct: + + fieldType := field.Type() + + if fieldType.ConvertibleTo(timeType) && topField.Type().ConvertibleTo(timeType) { + + t := field.Convert(timeType).Interface().(time.Time) + fieldTime := topField.Convert(timeType).Interface().(time.Time) + + return fieldTime.Equal(t) + } + + // Not Same underlying type i.e. struct and time + if fieldType != topField.Type() { + return false + } + } + + // default reflect.String: + return topField.String() == field.String() +} + +// isEqField is the validation function for validating if the current field's value is equal to the field specified by the param's value. +func isEqField(fl FieldLevel) bool { + field := fl.Field() + kind := field.Kind() + + currentField, currentKind, ok := fl.GetStructFieldOK() + if !ok || currentKind != kind { + return false + } + + switch kind { + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return field.Int() == currentField.Int() + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return field.Uint() == currentField.Uint() + + case reflect.Float32, reflect.Float64: + return field.Float() == currentField.Float() + + case reflect.Slice, reflect.Map, reflect.Array: + return int64(field.Len()) == int64(currentField.Len()) + + case reflect.Bool: + return field.Bool() == currentField.Bool() + + case reflect.Struct: + + fieldType := field.Type() + + if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) { + + t := currentField.Convert(timeType).Interface().(time.Time) + fieldTime := field.Convert(timeType).Interface().(time.Time) + + return fieldTime.Equal(t) + } + + // Not Same underlying type i.e. struct and time + if fieldType != currentField.Type() { + return false + } + } + + // default reflect.String: + return field.String() == currentField.String() +} + +// isEq is the validation function for validating if the current field's value is equal to the param's value. +func isEq(fl FieldLevel) bool { + field := fl.Field() + param := fl.Param() + + switch field.Kind() { + + case reflect.String: + return field.String() == param + + case reflect.Slice, reflect.Map, reflect.Array: + p := asInt(param) + + return int64(field.Len()) == p + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + p := asIntFromType(field.Type(), param) + + return field.Int() == p + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + p := asUint(param) + + return field.Uint() == p + + case reflect.Float32, reflect.Float64: + p := asFloat(param) + + return field.Float() == p + + case reflect.Bool: + p := asBool(param) + + return field.Bool() == p + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isPostcodeByIso3166Alpha2 validates by value which is country code in iso 3166 alpha 2 +// example: `postcode_iso3166_alpha2=US` +func isPostcodeByIso3166Alpha2(fl FieldLevel) bool { + field := fl.Field() + param := fl.Param() + + reg, found := postCodeRegexDict[param] + if !found { + return false + } + + return reg.MatchString(field.String()) +} + +// isPostcodeByIso3166Alpha2Field validates by field which represents for a value of country code in iso 3166 alpha 2 +// example: `postcode_iso3166_alpha2_field=CountryCode` +func isPostcodeByIso3166Alpha2Field(fl FieldLevel) bool { + field := fl.Field() + params := parseOneOfParam2(fl.Param()) + + if len(params) != 1 { + return false + } + + currentField, kind, _, found := fl.GetStructFieldOKAdvanced2(fl.Parent(), params[0]) + if !found { + return false + } + + if kind != reflect.String { + panic(fmt.Sprintf("Bad field type %T", currentField.Interface())) + } + + reg, found := postCodeRegexDict[currentField.String()] + if !found { + return false + } + + return reg.MatchString(field.String()) +} + +// isBase64 is the validation function for validating if the current field's value is a valid base 64. +func isBase64(fl FieldLevel) bool { + return base64Regex.MatchString(fl.Field().String()) +} + +// isBase64URL is the validation function for validating if the current field's value is a valid base64 URL safe string. +func isBase64URL(fl FieldLevel) bool { + return base64URLRegex.MatchString(fl.Field().String()) +} + +// isURI is the validation function for validating if the current field's value is a valid URI. +func isURI(fl FieldLevel) bool { + field := fl.Field() + + switch field.Kind() { + case reflect.String: + + s := field.String() + + // checks needed as of Go 1.6 because of change https://github.com/golang/go/commit/617c93ce740c3c3cc28cdd1a0d712be183d0b328#diff-6c2d018290e298803c0c9419d8739885L195 + // emulate browser and strip the '#' suffix prior to validation. see issue-#237 + if i := strings.Index(s, "#"); i > -1 { + s = s[:i] + } + + if len(s) == 0 { + return false + } + + _, err := url.ParseRequestURI(s) + + return err == nil + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isURL is the validation function for validating if the current field's value is a valid URL. +func isURL(fl FieldLevel) bool { + field := fl.Field() + + switch field.Kind() { + case reflect.String: + + var i int + s := field.String() + + // checks needed as of Go 1.6 because of change https://github.com/golang/go/commit/617c93ce740c3c3cc28cdd1a0d712be183d0b328#diff-6c2d018290e298803c0c9419d8739885L195 + // emulate browser and strip the '#' suffix prior to validation. see issue-#237 + if i = strings.Index(s, "#"); i > -1 { + s = s[:i] + } + + if len(s) == 0 { + return false + } + + url, err := url.ParseRequestURI(s) + + if err != nil || url.Scheme == "" { + return false + } + + return true + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isUrnRFC2141 is the validation function for validating if the current field's value is a valid URN as per RFC 2141. +func isUrnRFC2141(fl FieldLevel) bool { + field := fl.Field() + + switch field.Kind() { + case reflect.String: + + str := field.String() + + _, match := urn.Parse([]byte(str)) + + return match + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isFile is the validation function for validating if the current field's value is a valid file path. +func isFile(fl FieldLevel) bool { + field := fl.Field() + + switch field.Kind() { + case reflect.String: + fileInfo, err := os.Stat(field.String()) + if err != nil { + return false + } + + return !fileInfo.IsDir() + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isE164 is the validation function for validating if the current field's value is a valid e.164 formatted phone number. +func isE164(fl FieldLevel) bool { + return e164Regex.MatchString(fl.Field().String()) +} + +// isEmail is the validation function for validating if the current field's value is a valid email address. +func isEmail(fl FieldLevel) bool { + return emailRegex.MatchString(fl.Field().String()) +} + +// isHSLA is the validation function for validating if the current field's value is a valid HSLA color. +func isHSLA(fl FieldLevel) bool { + return hslaRegex.MatchString(fl.Field().String()) +} + +// isHSL is the validation function for validating if the current field's value is a valid HSL color. +func isHSL(fl FieldLevel) bool { + return hslRegex.MatchString(fl.Field().String()) +} + +// isRGBA is the validation function for validating if the current field's value is a valid RGBA color. +func isRGBA(fl FieldLevel) bool { + return rgbaRegex.MatchString(fl.Field().String()) +} + +// isRGB is the validation function for validating if the current field's value is a valid RGB color. +func isRGB(fl FieldLevel) bool { + return rgbRegex.MatchString(fl.Field().String()) +} + +// isHEXColor is the validation function for validating if the current field's value is a valid HEX color. +func isHEXColor(fl FieldLevel) bool { + return hexColorRegex.MatchString(fl.Field().String()) +} + +// isHexadecimal is the validation function for validating if the current field's value is a valid hexadecimal. +func isHexadecimal(fl FieldLevel) bool { + return hexadecimalRegex.MatchString(fl.Field().String()) +} + +// isNumber is the validation function for validating if the current field's value is a valid number. +func isNumber(fl FieldLevel) bool { + switch fl.Field().Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64: + return true + default: + return numberRegex.MatchString(fl.Field().String()) + } +} + +// isNumeric is the validation function for validating if the current field's value is a valid numeric value. +func isNumeric(fl FieldLevel) bool { + switch fl.Field().Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64: + return true + default: + return numericRegex.MatchString(fl.Field().String()) + } +} + +// isAlphanum is the validation function for validating if the current field's value is a valid alphanumeric value. +func isAlphanum(fl FieldLevel) bool { + return alphaNumericRegex.MatchString(fl.Field().String()) +} + +// isAlpha is the validation function for validating if the current field's value is a valid alpha value. +func isAlpha(fl FieldLevel) bool { + return alphaRegex.MatchString(fl.Field().String()) +} + +// isAlphanumUnicode is the validation function for validating if the current field's value is a valid alphanumeric unicode value. +func isAlphanumUnicode(fl FieldLevel) bool { + return alphaUnicodeNumericRegex.MatchString(fl.Field().String()) +} + +// isAlphaUnicode is the validation function for validating if the current field's value is a valid alpha unicode value. +func isAlphaUnicode(fl FieldLevel) bool { + return alphaUnicodeRegex.MatchString(fl.Field().String()) +} + +// isBoolean is the validation function for validating if the current field's value is a valid boolean value or can be safely converted to a boolean value. +func isBoolean(fl FieldLevel) bool { + switch fl.Field().Kind() { + case reflect.Bool: + return true + default: + _, err := strconv.ParseBool(fl.Field().String()) + return err == nil + } +} + +// isDefault is the opposite of required aka hasValue +func isDefault(fl FieldLevel) bool { + return !hasValue(fl) +} + +// hasValue is the validation function for validating if the current field's value is not the default static value. +func hasValue(fl FieldLevel) bool { + field := fl.Field() + switch field.Kind() { + case reflect.Slice, reflect.Map, reflect.Ptr, reflect.Interface, reflect.Chan, reflect.Func: + return !field.IsNil() + default: + if fl.(*validate).fldIsPointer && field.Interface() != nil { + return true + } + return field.IsValid() && field.Interface() != reflect.Zero(field.Type()).Interface() + } +} + +// requireCheckField is a func for check field kind +func requireCheckFieldKind(fl FieldLevel, param string, defaultNotFoundValue bool) bool { + field := fl.Field() + kind := field.Kind() + var nullable, found bool + if len(param) > 0 { + field, kind, nullable, found = fl.GetStructFieldOKAdvanced2(fl.Parent(), param) + if !found { + return defaultNotFoundValue + } + } + switch kind { + case reflect.Invalid: + return defaultNotFoundValue + case reflect.Slice, reflect.Map, reflect.Ptr, reflect.Interface, reflect.Chan, reflect.Func: + return field.IsNil() + default: + if nullable && field.Interface() != nil { + return false + } + return field.IsValid() && field.Interface() == reflect.Zero(field.Type()).Interface() + } +} + +// requireCheckFieldValue is a func for check field value +func requireCheckFieldValue(fl FieldLevel, param string, value string, defaultNotFoundValue bool) bool { + field, kind, _, found := fl.GetStructFieldOKAdvanced2(fl.Parent(), param) + if !found { + return defaultNotFoundValue + } + + switch kind { + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return field.Int() == asInt(value) + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + return field.Uint() == asUint(value) + + case reflect.Float32, reflect.Float64: + return field.Float() == asFloat(value) + + case reflect.Slice, reflect.Map, reflect.Array: + return int64(field.Len()) == asInt(value) + + case reflect.Bool: + return field.Bool() == asBool(value) + } + + // default reflect.String: + return field.String() == value +} + +// requiredIf is the validation function +// The field under validation must be present and not empty only if all the other specified fields are equal to the value following with the specified field. +func requiredIf(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + if len(params)%2 != 0 { + panic(fmt.Sprintf("Bad param number for required_if %s", fl.FieldName())) + } + for i := 0; i < len(params); i += 2 { + if !requireCheckFieldValue(fl, params[i], params[i+1], false) { + return true + } + } + return hasValue(fl) +} + +// excludedIf is the validation function +// The field under validation must not be present or is empty only if all the other specified fields are equal to the value following with the specified field. +func excludedIf(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + if len(params)%2 != 0 { + panic(fmt.Sprintf("Bad param number for excluded_if %s", fl.FieldName())) + } + + for i := 0; i < len(params); i += 2 { + if !requireCheckFieldValue(fl, params[i], params[i+1], false) { + return false + } + } + return true +} + +// requiredUnless is the validation function +// The field under validation must be present and not empty only unless all the other specified fields are equal to the value following with the specified field. +func requiredUnless(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + if len(params)%2 != 0 { + panic(fmt.Sprintf("Bad param number for required_unless %s", fl.FieldName())) + } + + for i := 0; i < len(params); i += 2 { + if requireCheckFieldValue(fl, params[i], params[i+1], false) { + return true + } + } + return hasValue(fl) +} + +// excludedUnless is the validation function +// The field under validation must not be present or is empty unless all the other specified fields are equal to the value following with the specified field. +func excludedUnless(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + if len(params)%2 != 0 { + panic(fmt.Sprintf("Bad param number for excluded_unless %s", fl.FieldName())) + } + for i := 0; i < len(params); i += 2 { + if !requireCheckFieldValue(fl, params[i], params[i+1], false) { + return true + } + } + return !hasValue(fl) +} + +// excludedWith is the validation function +// The field under validation must not be present or is empty if any of the other specified fields are present. +func excludedWith(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + for _, param := range params { + if !requireCheckFieldKind(fl, param, true) { + return !hasValue(fl) + } + } + return true +} + +// requiredWith is the validation function +// The field under validation must be present and not empty only if any of the other specified fields are present. +func requiredWith(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + for _, param := range params { + if !requireCheckFieldKind(fl, param, true) { + return hasValue(fl) + } + } + return true +} + +// excludedWithAll is the validation function +// The field under validation must not be present or is empty if all of the other specified fields are present. +func excludedWithAll(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + for _, param := range params { + if requireCheckFieldKind(fl, param, true) { + return true + } + } + return !hasValue(fl) +} + +// requiredWithAll is the validation function +// The field under validation must be present and not empty only if all of the other specified fields are present. +func requiredWithAll(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + for _, param := range params { + if requireCheckFieldKind(fl, param, true) { + return true + } + } + return hasValue(fl) +} + +// excludedWithout is the validation function +// The field under validation must not be present or is empty when any of the other specified fields are not present. +func excludedWithout(fl FieldLevel) bool { + if requireCheckFieldKind(fl, strings.TrimSpace(fl.Param()), true) { + return !hasValue(fl) + } + return true +} + +// requiredWithout is the validation function +// The field under validation must be present and not empty only when any of the other specified fields are not present. +func requiredWithout(fl FieldLevel) bool { + if requireCheckFieldKind(fl, strings.TrimSpace(fl.Param()), true) { + return hasValue(fl) + } + return true +} + +// excludedWithoutAll is the validation function +// The field under validation must not be present or is empty when all of the other specified fields are not present. +func excludedWithoutAll(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + for _, param := range params { + if !requireCheckFieldKind(fl, param, true) { + return true + } + } + return !hasValue(fl) +} + +// requiredWithoutAll is the validation function +// The field under validation must be present and not empty only when all of the other specified fields are not present. +func requiredWithoutAll(fl FieldLevel) bool { + params := parseOneOfParam2(fl.Param()) + for _, param := range params { + if !requireCheckFieldKind(fl, param, true) { + return true + } + } + return hasValue(fl) +} + +// isGteField is the validation function for validating if the current field's value is greater than or equal to the field specified by the param's value. +func isGteField(fl FieldLevel) bool { + field := fl.Field() + kind := field.Kind() + + currentField, currentKind, ok := fl.GetStructFieldOK() + if !ok || currentKind != kind { + return false + } + + switch kind { + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + + return field.Int() >= currentField.Int() + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + + return field.Uint() >= currentField.Uint() + + case reflect.Float32, reflect.Float64: + + return field.Float() >= currentField.Float() + + case reflect.Struct: + + fieldType := field.Type() + + if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) { + + t := currentField.Convert(timeType).Interface().(time.Time) + fieldTime := field.Convert(timeType).Interface().(time.Time) + + return fieldTime.After(t) || fieldTime.Equal(t) + } + + // Not Same underlying type i.e. struct and time + if fieldType != currentField.Type() { + return false + } + } + + // default reflect.String + return len(field.String()) >= len(currentField.String()) +} + +// isGtField is the validation function for validating if the current field's value is greater than the field specified by the param's value. +func isGtField(fl FieldLevel) bool { + field := fl.Field() + kind := field.Kind() + + currentField, currentKind, ok := fl.GetStructFieldOK() + if !ok || currentKind != kind { + return false + } + + switch kind { + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + + return field.Int() > currentField.Int() + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + + return field.Uint() > currentField.Uint() + + case reflect.Float32, reflect.Float64: + + return field.Float() > currentField.Float() + + case reflect.Struct: + + fieldType := field.Type() + + if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) { + + t := currentField.Convert(timeType).Interface().(time.Time) + fieldTime := field.Convert(timeType).Interface().(time.Time) + + return fieldTime.After(t) + } + + // Not Same underlying type i.e. struct and time + if fieldType != currentField.Type() { + return false + } + } + + // default reflect.String + return len(field.String()) > len(currentField.String()) +} + +// isGte is the validation function for validating if the current field's value is greater than or equal to the param's value. +func isGte(fl FieldLevel) bool { + field := fl.Field() + param := fl.Param() + + switch field.Kind() { + + case reflect.String: + p := asInt(param) + + return int64(utf8.RuneCountInString(field.String())) >= p + + case reflect.Slice, reflect.Map, reflect.Array: + p := asInt(param) + + return int64(field.Len()) >= p + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + p := asIntFromType(field.Type(), param) + + return field.Int() >= p + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + p := asUint(param) + + return field.Uint() >= p + + case reflect.Float32, reflect.Float64: + p := asFloat(param) + + return field.Float() >= p + + case reflect.Struct: + + if field.Type().ConvertibleTo(timeType) { + + now := time.Now().UTC() + t := field.Convert(timeType).Interface().(time.Time) + + return t.After(now) || t.Equal(now) + } + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isGt is the validation function for validating if the current field's value is greater than the param's value. +func isGt(fl FieldLevel) bool { + field := fl.Field() + param := fl.Param() + + switch field.Kind() { + + case reflect.String: + p := asInt(param) + + return int64(utf8.RuneCountInString(field.String())) > p + + case reflect.Slice, reflect.Map, reflect.Array: + p := asInt(param) + + return int64(field.Len()) > p + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + p := asIntFromType(field.Type(), param) + + return field.Int() > p + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + p := asUint(param) + + return field.Uint() > p + + case reflect.Float32, reflect.Float64: + p := asFloat(param) + + return field.Float() > p + case reflect.Struct: + + if field.Type().ConvertibleTo(timeType) { + + return field.Convert(timeType).Interface().(time.Time).After(time.Now().UTC()) + } + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// hasLengthOf is the validation function for validating if the current field's value is equal to the param's value. +func hasLengthOf(fl FieldLevel) bool { + field := fl.Field() + param := fl.Param() + + switch field.Kind() { + + case reflect.String: + p := asInt(param) + + return int64(utf8.RuneCountInString(field.String())) == p + + case reflect.Slice, reflect.Map, reflect.Array: + p := asInt(param) + + return int64(field.Len()) == p + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + p := asIntFromType(field.Type(), param) + + return field.Int() == p + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + p := asUint(param) + + return field.Uint() == p + + case reflect.Float32, reflect.Float64: + p := asFloat(param) + + return field.Float() == p + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// hasMinOf is the validation function for validating if the current field's value is greater than or equal to the param's value. +func hasMinOf(fl FieldLevel) bool { + return isGte(fl) +} + +// isLteField is the validation function for validating if the current field's value is less than or equal to the field specified by the param's value. +func isLteField(fl FieldLevel) bool { + field := fl.Field() + kind := field.Kind() + + currentField, currentKind, ok := fl.GetStructFieldOK() + if !ok || currentKind != kind { + return false + } + + switch kind { + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + + return field.Int() <= currentField.Int() + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + + return field.Uint() <= currentField.Uint() + + case reflect.Float32, reflect.Float64: + + return field.Float() <= currentField.Float() + + case reflect.Struct: + + fieldType := field.Type() + + if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) { + + t := currentField.Convert(timeType).Interface().(time.Time) + fieldTime := field.Convert(timeType).Interface().(time.Time) + + return fieldTime.Before(t) || fieldTime.Equal(t) + } + + // Not Same underlying type i.e. struct and time + if fieldType != currentField.Type() { + return false + } + } + + // default reflect.String + return len(field.String()) <= len(currentField.String()) +} + +// isLtField is the validation function for validating if the current field's value is less than the field specified by the param's value. +func isLtField(fl FieldLevel) bool { + field := fl.Field() + kind := field.Kind() + + currentField, currentKind, ok := fl.GetStructFieldOK() + if !ok || currentKind != kind { + return false + } + + switch kind { + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + + return field.Int() < currentField.Int() + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + + return field.Uint() < currentField.Uint() + + case reflect.Float32, reflect.Float64: + + return field.Float() < currentField.Float() + + case reflect.Struct: + + fieldType := field.Type() + + if fieldType.ConvertibleTo(timeType) && currentField.Type().ConvertibleTo(timeType) { + + t := currentField.Convert(timeType).Interface().(time.Time) + fieldTime := field.Convert(timeType).Interface().(time.Time) + + return fieldTime.Before(t) + } + + // Not Same underlying type i.e. struct and time + if fieldType != currentField.Type() { + return false + } + } + + // default reflect.String + return len(field.String()) < len(currentField.String()) +} + +// isLte is the validation function for validating if the current field's value is less than or equal to the param's value. +func isLte(fl FieldLevel) bool { + field := fl.Field() + param := fl.Param() + + switch field.Kind() { + + case reflect.String: + p := asInt(param) + + return int64(utf8.RuneCountInString(field.String())) <= p + + case reflect.Slice, reflect.Map, reflect.Array: + p := asInt(param) + + return int64(field.Len()) <= p + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + p := asIntFromType(field.Type(), param) + + return field.Int() <= p + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + p := asUint(param) + + return field.Uint() <= p + + case reflect.Float32, reflect.Float64: + p := asFloat(param) + + return field.Float() <= p + + case reflect.Struct: + + if field.Type().ConvertibleTo(timeType) { + + now := time.Now().UTC() + t := field.Convert(timeType).Interface().(time.Time) + + return t.Before(now) || t.Equal(now) + } + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isLt is the validation function for validating if the current field's value is less than the param's value. +func isLt(fl FieldLevel) bool { + field := fl.Field() + param := fl.Param() + + switch field.Kind() { + + case reflect.String: + p := asInt(param) + + return int64(utf8.RuneCountInString(field.String())) < p + + case reflect.Slice, reflect.Map, reflect.Array: + p := asInt(param) + + return int64(field.Len()) < p + + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + p := asIntFromType(field.Type(), param) + + return field.Int() < p + + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: + p := asUint(param) + + return field.Uint() < p + + case reflect.Float32, reflect.Float64: + p := asFloat(param) + + return field.Float() < p + + case reflect.Struct: + + if field.Type().ConvertibleTo(timeType) { + + return field.Convert(timeType).Interface().(time.Time).Before(time.Now().UTC()) + } + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// hasMaxOf is the validation function for validating if the current field's value is less than or equal to the param's value. +func hasMaxOf(fl FieldLevel) bool { + return isLte(fl) +} + +// isTCP4AddrResolvable is the validation function for validating if the field's value is a resolvable tcp4 address. +func isTCP4AddrResolvable(fl FieldLevel) bool { + if !isIP4Addr(fl) { + return false + } + + _, err := net.ResolveTCPAddr("tcp4", fl.Field().String()) + return err == nil +} + +// isTCP6AddrResolvable is the validation function for validating if the field's value is a resolvable tcp6 address. +func isTCP6AddrResolvable(fl FieldLevel) bool { + if !isIP6Addr(fl) { + return false + } + + _, err := net.ResolveTCPAddr("tcp6", fl.Field().String()) + + return err == nil +} + +// isTCPAddrResolvable is the validation function for validating if the field's value is a resolvable tcp address. +func isTCPAddrResolvable(fl FieldLevel) bool { + if !isIP4Addr(fl) && !isIP6Addr(fl) { + return false + } + + _, err := net.ResolveTCPAddr("tcp", fl.Field().String()) + + return err == nil +} + +// isUDP4AddrResolvable is the validation function for validating if the field's value is a resolvable udp4 address. +func isUDP4AddrResolvable(fl FieldLevel) bool { + if !isIP4Addr(fl) { + return false + } + + _, err := net.ResolveUDPAddr("udp4", fl.Field().String()) + + return err == nil +} + +// isUDP6AddrResolvable is the validation function for validating if the field's value is a resolvable udp6 address. +func isUDP6AddrResolvable(fl FieldLevel) bool { + if !isIP6Addr(fl) { + return false + } + + _, err := net.ResolveUDPAddr("udp6", fl.Field().String()) + + return err == nil +} + +// isUDPAddrResolvable is the validation function for validating if the field's value is a resolvable udp address. +func isUDPAddrResolvable(fl FieldLevel) bool { + if !isIP4Addr(fl) && !isIP6Addr(fl) { + return false + } + + _, err := net.ResolveUDPAddr("udp", fl.Field().String()) + + return err == nil +} + +// isIP4AddrResolvable is the validation function for validating if the field's value is a resolvable ip4 address. +func isIP4AddrResolvable(fl FieldLevel) bool { + if !isIPv4(fl) { + return false + } + + _, err := net.ResolveIPAddr("ip4", fl.Field().String()) + + return err == nil +} + +// isIP6AddrResolvable is the validation function for validating if the field's value is a resolvable ip6 address. +func isIP6AddrResolvable(fl FieldLevel) bool { + if !isIPv6(fl) { + return false + } + + _, err := net.ResolveIPAddr("ip6", fl.Field().String()) + + return err == nil +} + +// isIPAddrResolvable is the validation function for validating if the field's value is a resolvable ip address. +func isIPAddrResolvable(fl FieldLevel) bool { + if !isIP(fl) { + return false + } + + _, err := net.ResolveIPAddr("ip", fl.Field().String()) + + return err == nil +} + +// isUnixAddrResolvable is the validation function for validating if the field's value is a resolvable unix address. +func isUnixAddrResolvable(fl FieldLevel) bool { + _, err := net.ResolveUnixAddr("unix", fl.Field().String()) + + return err == nil +} + +func isIP4Addr(fl FieldLevel) bool { + val := fl.Field().String() + + if idx := strings.LastIndex(val, ":"); idx != -1 { + val = val[0:idx] + } + + ip := net.ParseIP(val) + + return ip != nil && ip.To4() != nil +} + +func isIP6Addr(fl FieldLevel) bool { + val := fl.Field().String() + + if idx := strings.LastIndex(val, ":"); idx != -1 { + if idx != 0 && val[idx-1:idx] == "]" { + val = val[1 : idx-1] + } + } + + ip := net.ParseIP(val) + + return ip != nil && ip.To4() == nil +} + +func isHostnameRFC952(fl FieldLevel) bool { + return hostnameRegexRFC952.MatchString(fl.Field().String()) +} + +func isHostnameRFC1123(fl FieldLevel) bool { + return hostnameRegexRFC1123.MatchString(fl.Field().String()) +} + +func isFQDN(fl FieldLevel) bool { + val := fl.Field().String() + + if val == "" { + return false + } + + return fqdnRegexRFC1123.MatchString(val) +} + +// isDir is the validation function for validating if the current field's value is a valid directory. +func isDir(fl FieldLevel) bool { + field := fl.Field() + + if field.Kind() == reflect.String { + fileInfo, err := os.Stat(field.String()) + if err != nil { + return false + } + + return fileInfo.IsDir() + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isJSON is the validation function for validating if the current field's value is a valid json string. +func isJSON(fl FieldLevel) bool { + field := fl.Field() + + if field.Kind() == reflect.String { + val := field.String() + return json.Valid([]byte(val)) + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isJWT is the validation function for validating if the current field's value is a valid JWT string. +func isJWT(fl FieldLevel) bool { + return jWTRegex.MatchString(fl.Field().String()) +} + +// isHostnamePort validates a : combination for fields typically used for socket address. +func isHostnamePort(fl FieldLevel) bool { + val := fl.Field().String() + host, port, err := net.SplitHostPort(val) + if err != nil { + return false + } + // Port must be a iny <= 65535. + if portNum, err := strconv.ParseInt(port, 10, 32); err != nil || portNum > 65535 || portNum < 1 { + return false + } + + // If host is specified, it should match a DNS name + if host != "" { + return hostnameRegexRFC1123.MatchString(host) + } + return true +} + +// isLowercase is the validation function for validating if the current field's value is a lowercase string. +func isLowercase(fl FieldLevel) bool { + field := fl.Field() + + if field.Kind() == reflect.String { + if field.String() == "" { + return false + } + return field.String() == strings.ToLower(field.String()) + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isUppercase is the validation function for validating if the current field's value is an uppercase string. +func isUppercase(fl FieldLevel) bool { + field := fl.Field() + + if field.Kind() == reflect.String { + if field.String() == "" { + return false + } + return field.String() == strings.ToUpper(field.String()) + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isDatetime is the validation function for validating if the current field's value is a valid datetime string. +func isDatetime(fl FieldLevel) bool { + field := fl.Field() + param := fl.Param() + + if field.Kind() == reflect.String { + _, err := time.Parse(param, field.String()) + + return err == nil + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isTimeZone is the validation function for validating if the current field's value is a valid time zone string. +func isTimeZone(fl FieldLevel) bool { + field := fl.Field() + + if field.Kind() == reflect.String { + // empty value is converted to UTC by time.LoadLocation but disallow it as it is not a valid time zone name + if field.String() == "" { + return false + } + + // Local value is converted to the current system time zone by time.LoadLocation but disallow it as it is not a valid time zone name + if strings.ToLower(field.String()) == "local" { + return false + } + + _, err := time.LoadLocation(field.String()) + return err == nil + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isIso3166Alpha2 is the validation function for validating if the current field's value is a valid iso3166-1 alpha-2 country code. +func isIso3166Alpha2(fl FieldLevel) bool { + val := fl.Field().String() + return iso3166_1_alpha2[val] +} + +// isIso3166Alpha2 is the validation function for validating if the current field's value is a valid iso3166-1 alpha-3 country code. +func isIso3166Alpha3(fl FieldLevel) bool { + val := fl.Field().String() + return iso3166_1_alpha3[val] +} + +// isIso3166Alpha2 is the validation function for validating if the current field's value is a valid iso3166-1 alpha-numeric country code. +func isIso3166AlphaNumeric(fl FieldLevel) bool { + field := fl.Field() + + var code int + switch field.Kind() { + case reflect.String: + i, err := strconv.Atoi(field.String()) + if err != nil { + return false + } + code = i % 1000 + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + code = int(field.Int() % 1000) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + code = int(field.Uint() % 1000) + default: + panic(fmt.Sprintf("Bad field type %T", field.Interface())) + } + return iso3166_1_alpha_numeric[code] +} + +// isIso31662 is the validation function for validating if the current field's value is a valid iso3166-2 code. +func isIso31662(fl FieldLevel) bool { + val := fl.Field().String() + return iso3166_2[val] +} + +// isIso4217 is the validation function for validating if the current field's value is a valid iso4217 currency code. +func isIso4217(fl FieldLevel) bool { + val := fl.Field().String() + return iso4217[val] +} + +// isIso4217Numeric is the validation function for validating if the current field's value is a valid iso4217 numeric currency code. +func isIso4217Numeric(fl FieldLevel) bool { + field := fl.Field() + + var code int + switch field.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + code = int(field.Int()) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + code = int(field.Uint()) + default: + panic(fmt.Sprintf("Bad field type %T", field.Interface())) + } + return iso4217_numeric[code] +} + +// isBCP47LanguageTag is the validation function for validating if the current field's value is a valid BCP 47 language tag, as parsed by language.Parse +func isBCP47LanguageTag(fl FieldLevel) bool { + field := fl.Field() + + if field.Kind() == reflect.String { + _, err := language.Parse(field.String()) + return err == nil + } + + panic(fmt.Sprintf("Bad field type %T", field.Interface())) +} + +// isIsoBicFormat is the validation function for validating if the current field's value is a valid Business Identifier Code (SWIFT code), defined in ISO 9362 +func isIsoBicFormat(fl FieldLevel) bool { + bicString := fl.Field().String() + + return bicRegex.MatchString(bicString) +} + +// isSemverFormat is the validation function for validating if the current field's value is a valid semver version, defined in Semantic Versioning 2.0.0 +func isSemverFormat(fl FieldLevel) bool { + semverString := fl.Field().String() + + return semverRegex.MatchString(semverString) +} + +// isDnsRFC1035LabelFormat is the validation function +// for validating if the current field's value is +// a valid dns RFC 1035 label, defined in RFC 1035. +func isDnsRFC1035LabelFormat(fl FieldLevel) bool { + val := fl.Field().String() + return dnsRegexRFC1035Label.MatchString(val) +} + +// isCreditCard is the validation function for validating if the current field's value is a valid credit card number +func isCreditCard(fl FieldLevel) bool { + val := fl.Field().String() + var creditCard bytes.Buffer + segments := strings.Split(val, " ") + for _, segment := range segments { + if len(segment) < 3 { + return false + } + creditCard.WriteString(segment) + } + + ccDigits := strings.Split(creditCard.String(), "") + size := len(ccDigits) + if size < 12 || size > 19 { + return false + } + + sum := 0 + for i, digit := range ccDigits { + value, err := strconv.Atoi(digit) + if err != nil { + return false + } + if size%2 == 0 && i%2 == 0 || size%2 == 1 && i%2 == 1 { + v := value * 2 + if v >= 10 { + sum += 1 + (v % 10) + } else { + sum += v + } + } else { + sum += value + } + } + return (sum % 10) == 0 +} diff --git a/vendor/github.com/go-playground/validator/v10/cache.go b/vendor/github.com/go-playground/validator/v10/cache.go new file mode 100644 index 0000000000..7b84c91fe5 --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/cache.go @@ -0,0 +1,327 @@ +package validator + +import ( + "fmt" + "reflect" + "strings" + "sync" + "sync/atomic" +) + +type tagType uint8 + +const ( + typeDefault tagType = iota + typeOmitEmpty + typeIsDefault + typeNoStructLevel + typeStructOnly + typeDive + typeOr + typeKeys + typeEndKeys +) + +const ( + invalidValidation = "Invalid validation tag on field '%s'" + undefinedValidation = "Undefined validation function '%s' on field '%s'" + keysTagNotDefined = "'" + endKeysTag + "' tag encountered without a corresponding '" + keysTag + "' tag" +) + +type structCache struct { + lock sync.Mutex + m atomic.Value // map[reflect.Type]*cStruct +} + +func (sc *structCache) Get(key reflect.Type) (c *cStruct, found bool) { + c, found = sc.m.Load().(map[reflect.Type]*cStruct)[key] + return +} + +func (sc *structCache) Set(key reflect.Type, value *cStruct) { + m := sc.m.Load().(map[reflect.Type]*cStruct) + nm := make(map[reflect.Type]*cStruct, len(m)+1) + for k, v := range m { + nm[k] = v + } + nm[key] = value + sc.m.Store(nm) +} + +type tagCache struct { + lock sync.Mutex + m atomic.Value // map[string]*cTag +} + +func (tc *tagCache) Get(key string) (c *cTag, found bool) { + c, found = tc.m.Load().(map[string]*cTag)[key] + return +} + +func (tc *tagCache) Set(key string, value *cTag) { + m := tc.m.Load().(map[string]*cTag) + nm := make(map[string]*cTag, len(m)+1) + for k, v := range m { + nm[k] = v + } + nm[key] = value + tc.m.Store(nm) +} + +type cStruct struct { + name string + fields []*cField + fn StructLevelFuncCtx +} + +type cField struct { + idx int + name string + altName string + namesEqual bool + cTags *cTag +} + +type cTag struct { + tag string + aliasTag string + actualAliasTag string + param string + keys *cTag // only populated when using tag's 'keys' and 'endkeys' for map key validation + next *cTag + fn FuncCtx + typeof tagType + hasTag bool + hasAlias bool + hasParam bool // true if parameter used eg. eq= where the equal sign has been set + isBlockEnd bool // indicates the current tag represents the last validation in the block + runValidationWhenNil bool +} + +func (v *Validate) extractStructCache(current reflect.Value, sName string) *cStruct { + v.structCache.lock.Lock() + defer v.structCache.lock.Unlock() // leave as defer! because if inner panics, it will never get unlocked otherwise! + + typ := current.Type() + + // could have been multiple trying to access, but once first is done this ensures struct + // isn't parsed again. + cs, ok := v.structCache.Get(typ) + if ok { + return cs + } + + cs = &cStruct{name: sName, fields: make([]*cField, 0), fn: v.structLevelFuncs[typ]} + + numFields := current.NumField() + rules := v.rules[typ] + + var ctag *cTag + var fld reflect.StructField + var tag string + var customName string + + for i := 0; i < numFields; i++ { + + fld = typ.Field(i) + + if !fld.Anonymous && len(fld.PkgPath) > 0 { + continue + } + + if rtag, ok := rules[fld.Name]; ok { + tag = rtag + } else { + tag = fld.Tag.Get(v.tagName) + } + + if tag == skipValidationTag { + continue + } + + customName = fld.Name + + if v.hasTagNameFunc { + name := v.tagNameFunc(fld) + if len(name) > 0 { + customName = name + } + } + + // NOTE: cannot use shared tag cache, because tags may be equal, but things like alias may be different + // and so only struct level caching can be used instead of combined with Field tag caching + + if len(tag) > 0 { + ctag, _ = v.parseFieldTagsRecursive(tag, fld.Name, "", false) + } else { + // even if field doesn't have validations need cTag for traversing to potential inner/nested + // elements of the field. + ctag = new(cTag) + } + + cs.fields = append(cs.fields, &cField{ + idx: i, + name: fld.Name, + altName: customName, + cTags: ctag, + namesEqual: fld.Name == customName, + }) + } + v.structCache.Set(typ, cs) + return cs +} + +func (v *Validate) parseFieldTagsRecursive(tag string, fieldName string, alias string, hasAlias bool) (firstCtag *cTag, current *cTag) { + var t string + noAlias := len(alias) == 0 + tags := strings.Split(tag, tagSeparator) + + for i := 0; i < len(tags); i++ { + t = tags[i] + if noAlias { + alias = t + } + + // check map for alias and process new tags, otherwise process as usual + if tagsVal, found := v.aliases[t]; found { + if i == 0 { + firstCtag, current = v.parseFieldTagsRecursive(tagsVal, fieldName, t, true) + } else { + next, curr := v.parseFieldTagsRecursive(tagsVal, fieldName, t, true) + current.next, current = next, curr + + } + continue + } + + var prevTag tagType + + if i == 0 { + current = &cTag{aliasTag: alias, hasAlias: hasAlias, hasTag: true, typeof: typeDefault} + firstCtag = current + } else { + prevTag = current.typeof + current.next = &cTag{aliasTag: alias, hasAlias: hasAlias, hasTag: true} + current = current.next + } + + switch t { + case diveTag: + current.typeof = typeDive + continue + + case keysTag: + current.typeof = typeKeys + + if i == 0 || prevTag != typeDive { + panic(fmt.Sprintf("'%s' tag must be immediately preceded by the '%s' tag", keysTag, diveTag)) + } + + current.typeof = typeKeys + + // need to pass along only keys tag + // need to increment i to skip over the keys tags + b := make([]byte, 0, 64) + + i++ + + for ; i < len(tags); i++ { + + b = append(b, tags[i]...) + b = append(b, ',') + + if tags[i] == endKeysTag { + break + } + } + + current.keys, _ = v.parseFieldTagsRecursive(string(b[:len(b)-1]), fieldName, "", false) + continue + + case endKeysTag: + current.typeof = typeEndKeys + + // if there are more in tags then there was no keysTag defined + // and an error should be thrown + if i != len(tags)-1 { + panic(keysTagNotDefined) + } + return + + case omitempty: + current.typeof = typeOmitEmpty + continue + + case structOnlyTag: + current.typeof = typeStructOnly + continue + + case noStructLevelTag: + current.typeof = typeNoStructLevel + continue + + default: + if t == isdefault { + current.typeof = typeIsDefault + } + // if a pipe character is needed within the param you must use the utf8Pipe representation "0x7C" + orVals := strings.Split(t, orSeparator) + + for j := 0; j < len(orVals); j++ { + vals := strings.SplitN(orVals[j], tagKeySeparator, 2) + if noAlias { + alias = vals[0] + current.aliasTag = alias + } else { + current.actualAliasTag = t + } + + if j > 0 { + current.next = &cTag{aliasTag: alias, actualAliasTag: current.actualAliasTag, hasAlias: hasAlias, hasTag: true} + current = current.next + } + current.hasParam = len(vals) > 1 + + current.tag = vals[0] + if len(current.tag) == 0 { + panic(strings.TrimSpace(fmt.Sprintf(invalidValidation, fieldName))) + } + + if wrapper, ok := v.validations[current.tag]; ok { + current.fn = wrapper.fn + current.runValidationWhenNil = wrapper.runValidatinOnNil + } else { + panic(strings.TrimSpace(fmt.Sprintf(undefinedValidation, current.tag, fieldName))) + } + + if len(orVals) > 1 { + current.typeof = typeOr + } + + if len(vals) > 1 { + current.param = strings.Replace(strings.Replace(vals[1], utf8HexComma, ",", -1), utf8Pipe, "|", -1) + } + } + current.isBlockEnd = true + } + } + return +} + +func (v *Validate) fetchCacheTag(tag string) *cTag { + // find cached tag + ctag, found := v.tagCache.Get(tag) + if !found { + v.tagCache.lock.Lock() + defer v.tagCache.lock.Unlock() + + // could have been multiple trying to access, but once first is done this ensures tag + // isn't parsed again. + ctag, found = v.tagCache.Get(tag) + if !found { + ctag, _ = v.parseFieldTagsRecursive(tag, "", "", false) + v.tagCache.Set(tag, ctag) + } + } + return ctag +} diff --git a/vendor/github.com/go-playground/validator/v10/country_codes.go b/vendor/github.com/go-playground/validator/v10/country_codes.go new file mode 100644 index 0000000000..0d9eda0338 --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/country_codes.go @@ -0,0 +1,1132 @@ +package validator + +var iso3166_1_alpha2 = map[string]bool{ + // see: https://www.iso.org/iso-3166-country-codes.html + "AF": true, "AX": true, "AL": true, "DZ": true, "AS": true, + "AD": true, "AO": true, "AI": true, "AQ": true, "AG": true, + "AR": true, "AM": true, "AW": true, "AU": true, "AT": true, + "AZ": true, "BS": true, "BH": true, "BD": true, "BB": true, + "BY": true, "BE": true, "BZ": true, "BJ": true, "BM": true, + "BT": true, "BO": true, "BQ": true, "BA": true, "BW": true, + "BV": true, "BR": true, "IO": true, "BN": true, "BG": true, + "BF": true, "BI": true, "KH": true, "CM": true, "CA": true, + "CV": true, "KY": true, "CF": true, "TD": true, "CL": true, + "CN": true, "CX": true, "CC": true, "CO": true, "KM": true, + "CG": true, "CD": true, "CK": true, "CR": true, "CI": true, + "HR": true, "CU": true, "CW": true, "CY": true, "CZ": true, + "DK": true, "DJ": true, "DM": true, "DO": true, "EC": true, + "EG": true, "SV": true, "GQ": true, "ER": true, "EE": true, + "ET": true, "FK": true, "FO": true, "FJ": true, "FI": true, + "FR": true, "GF": true, "PF": true, "TF": true, "GA": true, + "GM": true, "GE": true, "DE": true, "GH": true, "GI": true, + "GR": true, "GL": true, "GD": true, "GP": true, "GU": true, + "GT": true, "GG": true, "GN": true, "GW": true, "GY": true, + "HT": true, "HM": true, "VA": true, "HN": true, "HK": true, + "HU": true, "IS": true, "IN": true, "ID": true, "IR": true, + "IQ": true, "IE": true, "IM": true, "IL": true, "IT": true, + "JM": true, "JP": true, "JE": true, "JO": true, "KZ": true, + "KE": true, "KI": true, "KP": true, "KR": true, "KW": true, + "KG": true, "LA": true, "LV": true, "LB": true, "LS": true, + "LR": true, "LY": true, "LI": true, "LT": true, "LU": true, + "MO": true, "MK": true, "MG": true, "MW": true, "MY": true, + "MV": true, "ML": true, "MT": true, "MH": true, "MQ": true, + "MR": true, "MU": true, "YT": true, "MX": true, "FM": true, + "MD": true, "MC": true, "MN": true, "ME": true, "MS": true, + "MA": true, "MZ": true, "MM": true, "NA": true, "NR": true, + "NP": true, "NL": true, "NC": true, "NZ": true, "NI": true, + "NE": true, "NG": true, "NU": true, "NF": true, "MP": true, + "NO": true, "OM": true, "PK": true, "PW": true, "PS": true, + "PA": true, "PG": true, "PY": true, "PE": true, "PH": true, + "PN": true, "PL": true, "PT": true, "PR": true, "QA": true, + "RE": true, "RO": true, "RU": true, "RW": true, "BL": true, + "SH": true, "KN": true, "LC": true, "MF": true, "PM": true, + "VC": true, "WS": true, "SM": true, "ST": true, "SA": true, + "SN": true, "RS": true, "SC": true, "SL": true, "SG": true, + "SX": true, "SK": true, "SI": true, "SB": true, "SO": true, + "ZA": true, "GS": true, "SS": true, "ES": true, "LK": true, + "SD": true, "SR": true, "SJ": true, "SZ": true, "SE": true, + "CH": true, "SY": true, "TW": true, "TJ": true, "TZ": true, + "TH": true, "TL": true, "TG": true, "TK": true, "TO": true, + "TT": true, "TN": true, "TR": true, "TM": true, "TC": true, + "TV": true, "UG": true, "UA": true, "AE": true, "GB": true, + "US": true, "UM": true, "UY": true, "UZ": true, "VU": true, + "VE": true, "VN": true, "VG": true, "VI": true, "WF": true, + "EH": true, "YE": true, "ZM": true, "ZW": true, +} + +var iso3166_1_alpha3 = map[string]bool{ + // see: https://www.iso.org/iso-3166-country-codes.html + "AFG": true, "ALB": true, "DZA": true, "ASM": true, "AND": true, + "AGO": true, "AIA": true, "ATA": true, "ATG": true, "ARG": true, + "ARM": true, "ABW": true, "AUS": true, "AUT": true, "AZE": true, + "BHS": true, "BHR": true, "BGD": true, "BRB": true, "BLR": true, + "BEL": true, "BLZ": true, "BEN": true, "BMU": true, "BTN": true, + "BOL": true, "BES": true, "BIH": true, "BWA": true, "BVT": true, + "BRA": true, "IOT": true, "BRN": true, "BGR": true, "BFA": true, + "BDI": true, "CPV": true, "KHM": true, "CMR": true, "CAN": true, + "CYM": true, "CAF": true, "TCD": true, "CHL": true, "CHN": true, + "CXR": true, "CCK": true, "COL": true, "COM": true, "COD": true, + "COG": true, "COK": true, "CRI": true, "HRV": true, "CUB": true, + "CUW": true, "CYP": true, "CZE": true, "CIV": true, "DNK": true, + "DJI": true, "DMA": true, "DOM": true, "ECU": true, "EGY": true, + "SLV": true, "GNQ": true, "ERI": true, "EST": true, "SWZ": true, + "ETH": true, "FLK": true, "FRO": true, "FJI": true, "FIN": true, + "FRA": true, "GUF": true, "PYF": true, "ATF": true, "GAB": true, + "GMB": true, "GEO": true, "DEU": true, "GHA": true, "GIB": true, + "GRC": true, "GRL": true, "GRD": true, "GLP": true, "GUM": true, + "GTM": true, "GGY": true, "GIN": true, "GNB": true, "GUY": true, + "HTI": true, "HMD": true, "VAT": true, "HND": true, "HKG": true, + "HUN": true, "ISL": true, "IND": true, "IDN": true, "IRN": true, + "IRQ": true, "IRL": true, "IMN": true, "ISR": true, "ITA": true, + "JAM": true, "JPN": true, "JEY": true, "JOR": true, "KAZ": true, + "KEN": true, "KIR": true, "PRK": true, "KOR": true, "KWT": true, + "KGZ": true, "LAO": true, "LVA": true, "LBN": true, "LSO": true, + "LBR": true, "LBY": true, "LIE": true, "LTU": true, "LUX": true, + "MAC": true, "MDG": true, "MWI": true, "MYS": true, "MDV": true, + "MLI": true, "MLT": true, "MHL": true, "MTQ": true, "MRT": true, + "MUS": true, "MYT": true, "MEX": true, "FSM": true, "MDA": true, + "MCO": true, "MNG": true, "MNE": true, "MSR": true, "MAR": true, + "MOZ": true, "MMR": true, "NAM": true, "NRU": true, "NPL": true, + "NLD": true, "NCL": true, "NZL": true, "NIC": true, "NER": true, + "NGA": true, "NIU": true, "NFK": true, "MKD": true, "MNP": true, + "NOR": true, "OMN": true, "PAK": true, "PLW": true, "PSE": true, + "PAN": true, "PNG": true, "PRY": true, "PER": true, "PHL": true, + "PCN": true, "POL": true, "PRT": true, "PRI": true, "QAT": true, + "ROU": true, "RUS": true, "RWA": true, "REU": true, "BLM": true, + "SHN": true, "KNA": true, "LCA": true, "MAF": true, "SPM": true, + "VCT": true, "WSM": true, "SMR": true, "STP": true, "SAU": true, + "SEN": true, "SRB": true, "SYC": true, "SLE": true, "SGP": true, + "SXM": true, "SVK": true, "SVN": true, "SLB": true, "SOM": true, + "ZAF": true, "SGS": true, "SSD": true, "ESP": true, "LKA": true, + "SDN": true, "SUR": true, "SJM": true, "SWE": true, "CHE": true, + "SYR": true, "TWN": true, "TJK": true, "TZA": true, "THA": true, + "TLS": true, "TGO": true, "TKL": true, "TON": true, "TTO": true, + "TUN": true, "TUR": true, "TKM": true, "TCA": true, "TUV": true, + "UGA": true, "UKR": true, "ARE": true, "GBR": true, "UMI": true, + "USA": true, "URY": true, "UZB": true, "VUT": true, "VEN": true, + "VNM": true, "VGB": true, "VIR": true, "WLF": true, "ESH": true, + "YEM": true, "ZMB": true, "ZWE": true, "ALA": true, +} +var iso3166_1_alpha_numeric = map[int]bool{ + // see: https://www.iso.org/iso-3166-country-codes.html + 4: true, 8: true, 12: true, 16: true, 20: true, + 24: true, 660: true, 10: true, 28: true, 32: true, + 51: true, 533: true, 36: true, 40: true, 31: true, + 44: true, 48: true, 50: true, 52: true, 112: true, + 56: true, 84: true, 204: true, 60: true, 64: true, + 68: true, 535: true, 70: true, 72: true, 74: true, + 76: true, 86: true, 96: true, 100: true, 854: true, + 108: true, 132: true, 116: true, 120: true, 124: true, + 136: true, 140: true, 148: true, 152: true, 156: true, + 162: true, 166: true, 170: true, 174: true, 180: true, + 178: true, 184: true, 188: true, 191: true, 192: true, + 531: true, 196: true, 203: true, 384: true, 208: true, + 262: true, 212: true, 214: true, 218: true, 818: true, + 222: true, 226: true, 232: true, 233: true, 748: true, + 231: true, 238: true, 234: true, 242: true, 246: true, + 250: true, 254: true, 258: true, 260: true, 266: true, + 270: true, 268: true, 276: true, 288: true, 292: true, + 300: true, 304: true, 308: true, 312: true, 316: true, + 320: true, 831: true, 324: true, 624: true, 328: true, + 332: true, 334: true, 336: true, 340: true, 344: true, + 348: true, 352: true, 356: true, 360: true, 364: true, + 368: true, 372: true, 833: true, 376: true, 380: true, + 388: true, 392: true, 832: true, 400: true, 398: true, + 404: true, 296: true, 408: true, 410: true, 414: true, + 417: true, 418: true, 428: true, 422: true, 426: true, + 430: true, 434: true, 438: true, 440: true, 442: true, + 446: true, 450: true, 454: true, 458: true, 462: true, + 466: true, 470: true, 584: true, 474: true, 478: true, + 480: true, 175: true, 484: true, 583: true, 498: true, + 492: true, 496: true, 499: true, 500: true, 504: true, + 508: true, 104: true, 516: true, 520: true, 524: true, + 528: true, 540: true, 554: true, 558: true, 562: true, + 566: true, 570: true, 574: true, 807: true, 580: true, + 578: true, 512: true, 586: true, 585: true, 275: true, + 591: true, 598: true, 600: true, 604: true, 608: true, + 612: true, 616: true, 620: true, 630: true, 634: true, + 642: true, 643: true, 646: true, 638: true, 652: true, + 654: true, 659: true, 662: true, 663: true, 666: true, + 670: true, 882: true, 674: true, 678: true, 682: true, + 686: true, 688: true, 690: true, 694: true, 702: true, + 534: true, 703: true, 705: true, 90: true, 706: true, + 710: true, 239: true, 728: true, 724: true, 144: true, + 729: true, 740: true, 744: true, 752: true, 756: true, + 760: true, 158: true, 762: true, 834: true, 764: true, + 626: true, 768: true, 772: true, 776: true, 780: true, + 788: true, 792: true, 795: true, 796: true, 798: true, + 800: true, 804: true, 784: true, 826: true, 581: true, + 840: true, 858: true, 860: true, 548: true, 862: true, + 704: true, 92: true, 850: true, 876: true, 732: true, + 887: true, 894: true, 716: true, 248: true, +} + +var iso3166_2 = map[string]bool{ + "AD-02" : true, "AD-03" : true, "AD-04" : true, "AD-05" : true, "AD-06" : true, + "AD-07" : true, "AD-08" : true, "AE-AJ" : true, "AE-AZ" : true, "AE-DU" : true, + "AE-FU" : true, "AE-RK" : true, "AE-SH" : true, "AE-UQ" : true, "AF-BAL" : true, + "AF-BAM" : true, "AF-BDG" : true, "AF-BDS" : true, "AF-BGL" : true, "AF-DAY" : true, + "AF-FRA" : true, "AF-FYB" : true, "AF-GHA" : true, "AF-GHO" : true, "AF-HEL" : true, + "AF-HER" : true, "AF-JOW" : true, "AF-KAB" : true, "AF-KAN" : true, "AF-KAP" : true, + "AF-KDZ" : true, "AF-KHO" : true, "AF-KNR" : true, "AF-LAG" : true, "AF-LOG" : true, + "AF-NAN" : true, "AF-NIM" : true, "AF-NUR" : true, "AF-PAN" : true, "AF-PAR" : true, + "AF-PIA" : true, "AF-PKA" : true, "AF-SAM" : true, "AF-SAR" : true, "AF-TAK" : true, + "AF-URU" : true, "AF-WAR" : true, "AF-ZAB" : true, "AG-03" : true, "AG-04" : true, + "AG-05" : true, "AG-06" : true, "AG-07" : true, "AG-08" : true, "AG-10" : true, + "AG-11" : true, "AL-01" : true, "AL-02" : true, "AL-03" : true, "AL-04" : true, + "AL-05" : true, "AL-06" : true, "AL-07" : true, "AL-08" : true, "AL-09" : true, + "AL-10" : true, "AL-11" : true, "AL-12" : true, "AL-BR" : true, "AL-BU" : true, + "AL-DI" : true, "AL-DL" : true, "AL-DR" : true, "AL-DV" : true, "AL-EL" : true, + "AL-ER" : true, "AL-FR" : true, "AL-GJ" : true, "AL-GR" : true, "AL-HA" : true, + "AL-KA" : true, "AL-KB" : true, "AL-KC" : true, "AL-KO" : true, "AL-KR" : true, + "AL-KU" : true, "AL-LB" : true, "AL-LE" : true, "AL-LU" : true, "AL-MK" : true, + "AL-MM" : true, "AL-MR" : true, "AL-MT" : true, "AL-PG" : true, "AL-PQ" : true, + "AL-PR" : true, "AL-PU" : true, "AL-SH" : true, "AL-SK" : true, "AL-SR" : true, + "AL-TE" : true, "AL-TP" : true, "AL-TR" : true, "AL-VL" : true, "AM-AG" : true, + "AM-AR" : true, "AM-AV" : true, "AM-ER" : true, "AM-GR" : true, "AM-KT" : true, + "AM-LO" : true, "AM-SH" : true, "AM-SU" : true, "AM-TV" : true, "AM-VD" : true, + "AO-BGO" : true, "AO-BGU" : true, "AO-BIE" : true, "AO-CAB" : true, "AO-CCU" : true, + "AO-CNN" : true, "AO-CNO" : true, "AO-CUS" : true, "AO-HUA" : true, "AO-HUI" : true, + "AO-LNO" : true, "AO-LSU" : true, "AO-LUA" : true, "AO-MAL" : true, "AO-MOX" : true, + "AO-NAM" : true, "AO-UIG" : true, "AO-ZAI" : true, "AR-A" : true, "AR-B" : true, + "AR-C" : true, "AR-D" : true, "AR-E" : true, "AR-G" : true, "AR-H" : true, + "AR-J" : true, "AR-K" : true, "AR-L" : true, "AR-M" : true, "AR-N" : true, + "AR-P" : true, "AR-Q" : true, "AR-R" : true, "AR-S" : true, "AR-T" : true, + "AR-U" : true, "AR-V" : true, "AR-W" : true, "AR-X" : true, "AR-Y" : true, + "AR-Z" : true, "AT-1" : true, "AT-2" : true, "AT-3" : true, "AT-4" : true, + "AT-5" : true, "AT-6" : true, "AT-7" : true, "AT-8" : true, "AT-9" : true, + "AU-ACT" : true, "AU-NSW" : true, "AU-NT" : true, "AU-QLD" : true, "AU-SA" : true, + "AU-TAS" : true, "AU-VIC" : true, "AU-WA" : true, "AZ-ABS" : true, "AZ-AGA" : true, + "AZ-AGC" : true, "AZ-AGM" : true, "AZ-AGS" : true, "AZ-AGU" : true, "AZ-AST" : true, + "AZ-BA" : true, "AZ-BAB" : true, "AZ-BAL" : true, "AZ-BAR" : true, "AZ-BEY" : true, + "AZ-BIL" : true, "AZ-CAB" : true, "AZ-CAL" : true, "AZ-CUL" : true, "AZ-DAS" : true, + "AZ-FUZ" : true, "AZ-GA" : true, "AZ-GAD" : true, "AZ-GOR" : true, "AZ-GOY" : true, + "AZ-GYG" : true, "AZ-HAC" : true, "AZ-IMI" : true, "AZ-ISM" : true, "AZ-KAL" : true, + "AZ-KAN" : true, "AZ-KUR" : true, "AZ-LA" : true, "AZ-LAC" : true, "AZ-LAN" : true, + "AZ-LER" : true, "AZ-MAS" : true, "AZ-MI" : true, "AZ-NA" : true, "AZ-NEF" : true, + "AZ-NV" : true, "AZ-NX" : true, "AZ-OGU" : true, "AZ-ORD" : true, "AZ-QAB" : true, + "AZ-QAX" : true, "AZ-QAZ" : true, "AZ-QBA" : true, "AZ-QBI" : true, "AZ-QOB" : true, + "AZ-QUS" : true, "AZ-SA" : true, "AZ-SAB" : true, "AZ-SAD" : true, "AZ-SAH" : true, + "AZ-SAK" : true, "AZ-SAL" : true, "AZ-SAR" : true, "AZ-SAT" : true, "AZ-SBN" : true, + "AZ-SIY" : true, "AZ-SKR" : true, "AZ-SM" : true, "AZ-SMI" : true, "AZ-SMX" : true, + "AZ-SR" : true, "AZ-SUS" : true, "AZ-TAR" : true, "AZ-TOV" : true, "AZ-UCA" : true, + "AZ-XA" : true, "AZ-XAC" : true, "AZ-XCI" : true, "AZ-XIZ" : true, "AZ-XVD" : true, + "AZ-YAR" : true, "AZ-YE" : true, "AZ-YEV" : true, "AZ-ZAN" : true, "AZ-ZAQ" : true, + "AZ-ZAR" : true, "BA-01" : true, "BA-02" : true, "BA-03" : true, "BA-04" : true, + "BA-05" : true, "BA-06" : true, "BA-07" : true, "BA-08" : true, "BA-09" : true, + "BA-10" : true, "BA-BIH" : true, "BA-BRC" : true, "BA-SRP" : true, "BB-01" : true, + "BB-02" : true, "BB-03" : true, "BB-04" : true, "BB-05" : true, "BB-06" : true, + "BB-07" : true, "BB-08" : true, "BB-09" : true, "BB-10" : true, "BB-11" : true, + "BD-01" : true, "BD-02" : true, "BD-03" : true, "BD-04" : true, "BD-05" : true, + "BD-06" : true, "BD-07" : true, "BD-08" : true, "BD-09" : true, "BD-10" : true, + "BD-11" : true, "BD-12" : true, "BD-13" : true, "BD-14" : true, "BD-15" : true, + "BD-16" : true, "BD-17" : true, "BD-18" : true, "BD-19" : true, "BD-20" : true, + "BD-21" : true, "BD-22" : true, "BD-23" : true, "BD-24" : true, "BD-25" : true, + "BD-26" : true, "BD-27" : true, "BD-28" : true, "BD-29" : true, "BD-30" : true, + "BD-31" : true, "BD-32" : true, "BD-33" : true, "BD-34" : true, "BD-35" : true, + "BD-36" : true, "BD-37" : true, "BD-38" : true, "BD-39" : true, "BD-40" : true, + "BD-41" : true, "BD-42" : true, "BD-43" : true, "BD-44" : true, "BD-45" : true, + "BD-46" : true, "BD-47" : true, "BD-48" : true, "BD-49" : true, "BD-50" : true, + "BD-51" : true, "BD-52" : true, "BD-53" : true, "BD-54" : true, "BD-55" : true, + "BD-56" : true, "BD-57" : true, "BD-58" : true, "BD-59" : true, "BD-60" : true, + "BD-61" : true, "BD-62" : true, "BD-63" : true, "BD-64" : true, "BD-A" : true, + "BD-B" : true, "BD-C" : true, "BD-D" : true, "BD-E" : true, "BD-F" : true, + "BD-G" : true, "BE-BRU" : true, "BE-VAN" : true, "BE-VBR" : true, "BE-VLG" : true, + "BE-VLI" : true, "BE-VOV" : true, "BE-VWV" : true, "BE-WAL" : true, "BE-WBR" : true, + "BE-WHT" : true, "BE-WLG" : true, "BE-WLX" : true, "BE-WNA" : true, "BF-01" : true, + "BF-02" : true, "BF-03" : true, "BF-04" : true, "BF-05" : true, "BF-06" : true, + "BF-07" : true, "BF-08" : true, "BF-09" : true, "BF-10" : true, "BF-11" : true, + "BF-12" : true, "BF-13" : true, "BF-BAL" : true, "BF-BAM" : true, "BF-BAN" : true, + "BF-BAZ" : true, "BF-BGR" : true, "BF-BLG" : true, "BF-BLK" : true, "BF-COM" : true, + "BF-GAN" : true, "BF-GNA" : true, "BF-GOU" : true, "BF-HOU" : true, "BF-IOB" : true, + "BF-KAD" : true, "BF-KEN" : true, "BF-KMD" : true, "BF-KMP" : true, "BF-KOP" : true, + "BF-KOS" : true, "BF-KOT" : true, "BF-KOW" : true, "BF-LER" : true, "BF-LOR" : true, + "BF-MOU" : true, "BF-NAM" : true, "BF-NAO" : true, "BF-NAY" : true, "BF-NOU" : true, + "BF-OUB" : true, "BF-OUD" : true, "BF-PAS" : true, "BF-PON" : true, "BF-SEN" : true, + "BF-SIS" : true, "BF-SMT" : true, "BF-SNG" : true, "BF-SOM" : true, "BF-SOR" : true, + "BF-TAP" : true, "BF-TUI" : true, "BF-YAG" : true, "BF-YAT" : true, "BF-ZIR" : true, + "BF-ZON" : true, "BF-ZOU" : true, "BG-01" : true, "BG-02" : true, "BG-03" : true, + "BG-04" : true, "BG-05" : true, "BG-06" : true, "BG-07" : true, "BG-08" : true, + "BG-09" : true, "BG-10" : true, "BG-11" : true, "BG-12" : true, "BG-13" : true, + "BG-14" : true, "BG-15" : true, "BG-16" : true, "BG-17" : true, "BG-18" : true, + "BG-19" : true, "BG-20" : true, "BG-21" : true, "BG-22" : true, "BG-23" : true, + "BG-24" : true, "BG-25" : true, "BG-26" : true, "BG-27" : true, "BG-28" : true, + "BH-13" : true, "BH-14" : true, "BH-15" : true, "BH-16" : true, "BH-17" : true, + "BI-BB" : true, "BI-BL" : true, "BI-BM" : true, "BI-BR" : true, "BI-CA" : true, + "BI-CI" : true, "BI-GI" : true, "BI-KI" : true, "BI-KR" : true, "BI-KY" : true, + "BI-MA" : true, "BI-MU" : true, "BI-MW" : true, "BI-NG" : true, "BI-RT" : true, + "BI-RY" : true, "BJ-AK" : true, "BJ-AL" : true, "BJ-AQ" : true, "BJ-BO" : true, + "BJ-CO" : true, "BJ-DO" : true, "BJ-KO" : true, "BJ-LI" : true, "BJ-MO" : true, + "BJ-OU" : true, "BJ-PL" : true, "BJ-ZO" : true, "BN-BE" : true, "BN-BM" : true, + "BN-TE" : true, "BN-TU" : true, "BO-B" : true, "BO-C" : true, "BO-H" : true, + "BO-L" : true, "BO-N" : true, "BO-O" : true, "BO-P" : true, "BO-S" : true, + "BO-T" : true, "BQ-BO" : true, "BQ-SA" : true, "BQ-SE" : true, "BR-AC" : true, + "BR-AL" : true, "BR-AM" : true, "BR-AP" : true, "BR-BA" : true, "BR-CE" : true, + "BR-DF" : true, "BR-ES" : true, "BR-FN" : true, "BR-GO" : true, "BR-MA" : true, + "BR-MG" : true, "BR-MS" : true, "BR-MT" : true, "BR-PA" : true, "BR-PB" : true, + "BR-PE" : true, "BR-PI" : true, "BR-PR" : true, "BR-RJ" : true, "BR-RN" : true, + "BR-RO" : true, "BR-RR" : true, "BR-RS" : true, "BR-SC" : true, "BR-SE" : true, + "BR-SP" : true, "BR-TO" : true, "BS-AK" : true, "BS-BI" : true, "BS-BP" : true, + "BS-BY" : true, "BS-CE" : true, "BS-CI" : true, "BS-CK" : true, "BS-CO" : true, + "BS-CS" : true, "BS-EG" : true, "BS-EX" : true, "BS-FP" : true, "BS-GC" : true, + "BS-HI" : true, "BS-HT" : true, "BS-IN" : true, "BS-LI" : true, "BS-MC" : true, + "BS-MG" : true, "BS-MI" : true, "BS-NE" : true, "BS-NO" : true, "BS-NS" : true, + "BS-RC" : true, "BS-RI" : true, "BS-SA" : true, "BS-SE" : true, "BS-SO" : true, + "BS-SS" : true, "BS-SW" : true, "BS-WG" : true, "BT-11" : true, "BT-12" : true, + "BT-13" : true, "BT-14" : true, "BT-15" : true, "BT-21" : true, "BT-22" : true, + "BT-23" : true, "BT-24" : true, "BT-31" : true, "BT-32" : true, "BT-33" : true, + "BT-34" : true, "BT-41" : true, "BT-42" : true, "BT-43" : true, "BT-44" : true, + "BT-45" : true, "BT-GA" : true, "BT-TY" : true, "BW-CE" : true, "BW-GH" : true, + "BW-KG" : true, "BW-KL" : true, "BW-KW" : true, "BW-NE" : true, "BW-NW" : true, + "BW-SE" : true, "BW-SO" : true, "BY-BR" : true, "BY-HM" : true, "BY-HO" : true, + "BY-HR" : true, "BY-MA" : true, "BY-MI" : true, "BY-VI" : true, "BZ-BZ" : true, + "BZ-CY" : true, "BZ-CZL" : true, "BZ-OW" : true, "BZ-SC" : true, "BZ-TOL" : true, + "CA-AB" : true, "CA-BC" : true, "CA-MB" : true, "CA-NB" : true, "CA-NL" : true, + "CA-NS" : true, "CA-NT" : true, "CA-NU" : true, "CA-ON" : true, "CA-PE" : true, + "CA-QC" : true, "CA-SK" : true, "CA-YT" : true, "CD-BC" : true, "CD-BN" : true, + "CD-EQ" : true, "CD-KA" : true, "CD-KE" : true, "CD-KN" : true, "CD-KW" : true, + "CD-MA" : true, "CD-NK" : true, "CD-OR" : true, "CD-SK" : true, "CF-AC" : true, + "CF-BB" : true, "CF-BGF" : true, "CF-BK" : true, "CF-HK" : true, "CF-HM" : true, + "CF-HS" : true, "CF-KB" : true, "CF-KG" : true, "CF-LB" : true, "CF-MB" : true, + "CF-MP" : true, "CF-NM" : true, "CF-OP" : true, "CF-SE" : true, "CF-UK" : true, + "CF-VK" : true, "CG-11" : true, "CG-12" : true, "CG-13" : true, "CG-14" : true, + "CG-15" : true, "CG-2" : true, "CG-5" : true, "CG-7" : true, "CG-8" : true, + "CG-9" : true, "CG-BZV" : true, "CH-AG" : true, "CH-AI" : true, "CH-AR" : true, + "CH-BE" : true, "CH-BL" : true, "CH-BS" : true, "CH-FR" : true, "CH-GE" : true, + "CH-GL" : true, "CH-GR" : true, "CH-JU" : true, "CH-LU" : true, "CH-NE" : true, + "CH-NW" : true, "CH-OW" : true, "CH-SG" : true, "CH-SH" : true, "CH-SO" : true, + "CH-SZ" : true, "CH-TG" : true, "CH-TI" : true, "CH-UR" : true, "CH-VD" : true, + "CH-VS" : true, "CH-ZG" : true, "CH-ZH" : true, "CI-01" : true, "CI-02" : true, + "CI-03" : true, "CI-04" : true, "CI-05" : true, "CI-06" : true, "CI-07" : true, + "CI-08" : true, "CI-09" : true, "CI-10" : true, "CI-11" : true, "CI-12" : true, + "CI-13" : true, "CI-14" : true, "CI-15" : true, "CI-16" : true, "CI-17" : true, + "CI-18" : true, "CI-19" : true, "CL-AI" : true, "CL-AN" : true, "CL-AP" : true, + "CL-AR" : true, "CL-AT" : true, "CL-BI" : true, "CL-CO" : true, "CL-LI" : true, + "CL-LL" : true, "CL-LR" : true, "CL-MA" : true, "CL-ML" : true, "CL-RM" : true, + "CL-TA" : true, "CL-VS" : true, "CM-AD" : true, "CM-CE" : true, "CM-EN" : true, + "CM-ES" : true, "CM-LT" : true, "CM-NO" : true, "CM-NW" : true, "CM-OU" : true, + "CM-SU" : true, "CM-SW" : true, "CN-11" : true, "CN-12" : true, "CN-13" : true, + "CN-14" : true, "CN-15" : true, "CN-21" : true, "CN-22" : true, "CN-23" : true, + "CN-31" : true, "CN-32" : true, "CN-33" : true, "CN-34" : true, "CN-35" : true, + "CN-36" : true, "CN-37" : true, "CN-41" : true, "CN-42" : true, "CN-43" : true, + "CN-44" : true, "CN-45" : true, "CN-46" : true, "CN-50" : true, "CN-51" : true, + "CN-52" : true, "CN-53" : true, "CN-54" : true, "CN-61" : true, "CN-62" : true, + "CN-63" : true, "CN-64" : true, "CN-65" : true, "CN-71" : true, "CN-91" : true, + "CN-92" : true, "CO-AMA" : true, "CO-ANT" : true, "CO-ARA" : true, "CO-ATL" : true, + "CO-BOL" : true, "CO-BOY" : true, "CO-CAL" : true, "CO-CAQ" : true, "CO-CAS" : true, + "CO-CAU" : true, "CO-CES" : true, "CO-CHO" : true, "CO-COR" : true, "CO-CUN" : true, + "CO-DC" : true, "CO-GUA" : true, "CO-GUV" : true, "CO-HUI" : true, "CO-LAG" : true, + "CO-MAG" : true, "CO-MET" : true, "CO-NAR" : true, "CO-NSA" : true, "CO-PUT" : true, + "CO-QUI" : true, "CO-RIS" : true, "CO-SAN" : true, "CO-SAP" : true, "CO-SUC" : true, + "CO-TOL" : true, "CO-VAC" : true, "CO-VAU" : true, "CO-VID" : true, "CR-A" : true, + "CR-C" : true, "CR-G" : true, "CR-H" : true, "CR-L" : true, "CR-P" : true, + "CR-SJ" : true, "CU-01" : true, "CU-02" : true, "CU-03" : true, "CU-04" : true, + "CU-05" : true, "CU-06" : true, "CU-07" : true, "CU-08" : true, "CU-09" : true, + "CU-10" : true, "CU-11" : true, "CU-12" : true, "CU-13" : true, "CU-14" : true, + "CU-99" : true, "CV-B" : true, "CV-BR" : true, "CV-BV" : true, "CV-CA" : true, + "CV-CF" : true, "CV-CR" : true, "CV-MA" : true, "CV-MO" : true, "CV-PA" : true, + "CV-PN" : true, "CV-PR" : true, "CV-RB" : true, "CV-RG" : true, "CV-RS" : true, + "CV-S" : true, "CV-SD" : true, "CV-SF" : true, "CV-SL" : true, "CV-SM" : true, + "CV-SO" : true, "CV-SS" : true, "CV-SV" : true, "CV-TA" : true, "CV-TS" : true, + "CY-01" : true, "CY-02" : true, "CY-03" : true, "CY-04" : true, "CY-05" : true, + "CY-06" : true, "CZ-10" : true, "CZ-101" : true, "CZ-102" : true, "CZ-103" : true, + "CZ-104" : true, "CZ-105" : true, "CZ-106" : true, "CZ-107" : true, "CZ-108" : true, + "CZ-109" : true, "CZ-110" : true, "CZ-111" : true, "CZ-112" : true, "CZ-113" : true, + "CZ-114" : true, "CZ-115" : true, "CZ-116" : true, "CZ-117" : true, "CZ-118" : true, + "CZ-119" : true, "CZ-120" : true, "CZ-121" : true, "CZ-122" : true, "CZ-20" : true, + "CZ-201" : true, "CZ-202" : true, "CZ-203" : true, "CZ-204" : true, "CZ-205" : true, + "CZ-206" : true, "CZ-207" : true, "CZ-208" : true, "CZ-209" : true, "CZ-20A" : true, + "CZ-20B" : true, "CZ-20C" : true, "CZ-31" : true, "CZ-311" : true, "CZ-312" : true, + "CZ-313" : true, "CZ-314" : true, "CZ-315" : true, "CZ-316" : true, "CZ-317" : true, + "CZ-32" : true, "CZ-321" : true, "CZ-322" : true, "CZ-323" : true, "CZ-324" : true, + "CZ-325" : true, "CZ-326" : true, "CZ-327" : true, "CZ-41" : true, "CZ-411" : true, + "CZ-412" : true, "CZ-413" : true, "CZ-42" : true, "CZ-421" : true, "CZ-422" : true, + "CZ-423" : true, "CZ-424" : true, "CZ-425" : true, "CZ-426" : true, "CZ-427" : true, + "CZ-51" : true, "CZ-511" : true, "CZ-512" : true, "CZ-513" : true, "CZ-514" : true, + "CZ-52" : true, "CZ-521" : true, "CZ-522" : true, "CZ-523" : true, "CZ-524" : true, + "CZ-525" : true, "CZ-53" : true, "CZ-531" : true, "CZ-532" : true, "CZ-533" : true, + "CZ-534" : true, "CZ-63" : true, "CZ-631" : true, "CZ-632" : true, "CZ-633" : true, + "CZ-634" : true, "CZ-635" : true, "CZ-64" : true, "CZ-641" : true, "CZ-642" : true, + "CZ-643" : true, "CZ-644" : true, "CZ-645" : true, "CZ-646" : true, "CZ-647" : true, + "CZ-71" : true, "CZ-711" : true, "CZ-712" : true, "CZ-713" : true, "CZ-714" : true, + "CZ-715" : true, "CZ-72" : true, "CZ-721" : true, "CZ-722" : true, "CZ-723" : true, + "CZ-724" : true, "CZ-80" : true, "CZ-801" : true, "CZ-802" : true, "CZ-803" : true, + "CZ-804" : true, "CZ-805" : true, "CZ-806" : true, "DE-BB" : true, "DE-BE" : true, + "DE-BW" : true, "DE-BY" : true, "DE-HB" : true, "DE-HE" : true, "DE-HH" : true, + "DE-MV" : true, "DE-NI" : true, "DE-NW" : true, "DE-RP" : true, "DE-SH" : true, + "DE-SL" : true, "DE-SN" : true, "DE-ST" : true, "DE-TH" : true, "DJ-AR" : true, + "DJ-AS" : true, "DJ-DI" : true, "DJ-DJ" : true, "DJ-OB" : true, "DJ-TA" : true, + "DK-81" : true, "DK-82" : true, "DK-83" : true, "DK-84" : true, "DK-85" : true, + "DM-01" : true, "DM-02" : true, "DM-03" : true, "DM-04" : true, "DM-05" : true, + "DM-06" : true, "DM-07" : true, "DM-08" : true, "DM-09" : true, "DM-10" : true, + "DO-01" : true, "DO-02" : true, "DO-03" : true, "DO-04" : true, "DO-05" : true, + "DO-06" : true, "DO-07" : true, "DO-08" : true, "DO-09" : true, "DO-10" : true, + "DO-11" : true, "DO-12" : true, "DO-13" : true, "DO-14" : true, "DO-15" : true, + "DO-16" : true, "DO-17" : true, "DO-18" : true, "DO-19" : true, "DO-20" : true, + "DO-21" : true, "DO-22" : true, "DO-23" : true, "DO-24" : true, "DO-25" : true, + "DO-26" : true, "DO-27" : true, "DO-28" : true, "DO-29" : true, "DO-30" : true, + "DZ-01" : true, "DZ-02" : true, "DZ-03" : true, "DZ-04" : true, "DZ-05" : true, + "DZ-06" : true, "DZ-07" : true, "DZ-08" : true, "DZ-09" : true, "DZ-10" : true, + "DZ-11" : true, "DZ-12" : true, "DZ-13" : true, "DZ-14" : true, "DZ-15" : true, + "DZ-16" : true, "DZ-17" : true, "DZ-18" : true, "DZ-19" : true, "DZ-20" : true, + "DZ-21" : true, "DZ-22" : true, "DZ-23" : true, "DZ-24" : true, "DZ-25" : true, + "DZ-26" : true, "DZ-27" : true, "DZ-28" : true, "DZ-29" : true, "DZ-30" : true, + "DZ-31" : true, "DZ-32" : true, "DZ-33" : true, "DZ-34" : true, "DZ-35" : true, + "DZ-36" : true, "DZ-37" : true, "DZ-38" : true, "DZ-39" : true, "DZ-40" : true, + "DZ-41" : true, "DZ-42" : true, "DZ-43" : true, "DZ-44" : true, "DZ-45" : true, + "DZ-46" : true, "DZ-47" : true, "DZ-48" : true, "EC-A" : true, "EC-B" : true, + "EC-C" : true, "EC-D" : true, "EC-E" : true, "EC-F" : true, "EC-G" : true, + "EC-H" : true, "EC-I" : true, "EC-L" : true, "EC-M" : true, "EC-N" : true, + "EC-O" : true, "EC-P" : true, "EC-R" : true, "EC-S" : true, "EC-SD" : true, + "EC-SE" : true, "EC-T" : true, "EC-U" : true, "EC-W" : true, "EC-X" : true, + "EC-Y" : true, "EC-Z" : true, "EE-37" : true, "EE-39" : true, "EE-44" : true, + "EE-49" : true, "EE-51" : true, "EE-57" : true, "EE-59" : true, "EE-65" : true, + "EE-67" : true, "EE-70" : true, "EE-74" : true, "EE-78" : true, "EE-82" : true, + "EE-84" : true, "EE-86" : true, "EG-ALX" : true, "EG-ASN" : true, "EG-AST" : true, + "EG-BA" : true, "EG-BH" : true, "EG-BNS" : true, "EG-C" : true, "EG-DK" : true, + "EG-DT" : true, "EG-FYM" : true, "EG-GH" : true, "EG-GZ" : true, "EG-HU" : true, + "EG-IS" : true, "EG-JS" : true, "EG-KB" : true, "EG-KFS" : true, "EG-KN" : true, + "EG-MN" : true, "EG-MNF" : true, "EG-MT" : true, "EG-PTS" : true, "EG-SHG" : true, + "EG-SHR" : true, "EG-SIN" : true, "EG-SU" : true, "EG-SUZ" : true, "EG-WAD" : true, + "ER-AN" : true, "ER-DK" : true, "ER-DU" : true, "ER-GB" : true, "ER-MA" : true, + "ER-SK" : true, "ES-A" : true, "ES-AB" : true, "ES-AL" : true, "ES-AN" : true, + "ES-AR" : true, "ES-AS" : true, "ES-AV" : true, "ES-B" : true, "ES-BA" : true, + "ES-BI" : true, "ES-BU" : true, "ES-C" : true, "ES-CA" : true, "ES-CB" : true, + "ES-CC" : true, "ES-CE" : true, "ES-CL" : true, "ES-CM" : true, "ES-CN" : true, + "ES-CO" : true, "ES-CR" : true, "ES-CS" : true, "ES-CT" : true, "ES-CU" : true, + "ES-EX" : true, "ES-GA" : true, "ES-GC" : true, "ES-GI" : true, "ES-GR" : true, + "ES-GU" : true, "ES-H" : true, "ES-HU" : true, "ES-IB" : true, "ES-J" : true, + "ES-L" : true, "ES-LE" : true, "ES-LO" : true, "ES-LU" : true, "ES-M" : true, + "ES-MA" : true, "ES-MC" : true, "ES-MD" : true, "ES-ML" : true, "ES-MU" : true, + "ES-NA" : true, "ES-NC" : true, "ES-O" : true, "ES-OR" : true, "ES-P" : true, + "ES-PM" : true, "ES-PO" : true, "ES-PV" : true, "ES-RI" : true, "ES-S" : true, + "ES-SA" : true, "ES-SE" : true, "ES-SG" : true, "ES-SO" : true, "ES-SS" : true, + "ES-T" : true, "ES-TE" : true, "ES-TF" : true, "ES-TO" : true, "ES-V" : true, + "ES-VA" : true, "ES-VC" : true, "ES-VI" : true, "ES-Z" : true, "ES-ZA" : true, + "ET-AA" : true, "ET-AF" : true, "ET-AM" : true, "ET-BE" : true, "ET-DD" : true, + "ET-GA" : true, "ET-HA" : true, "ET-OR" : true, "ET-SN" : true, "ET-SO" : true, + "ET-TI" : true, "FI-01" : true, "FI-02" : true, "FI-03" : true, "FI-04" : true, + "FI-05" : true, "FI-06" : true, "FI-07" : true, "FI-08" : true, "FI-09" : true, + "FI-10" : true, "FI-11" : true, "FI-12" : true, "FI-13" : true, "FI-14" : true, + "FI-15" : true, "FI-16" : true, "FI-17" : true, "FI-18" : true, "FI-19" : true, + "FJ-C" : true, "FJ-E" : true, "FJ-N" : true, "FJ-R" : true, "FJ-W" : true, + "FM-KSA" : true, "FM-PNI" : true, "FM-TRK" : true, "FM-YAP" : true, "FR-01" : true, + "FR-02" : true, "FR-03" : true, "FR-04" : true, "FR-05" : true, "FR-06" : true, + "FR-07" : true, "FR-08" : true, "FR-09" : true, "FR-10" : true, "FR-11" : true, + "FR-12" : true, "FR-13" : true, "FR-14" : true, "FR-15" : true, "FR-16" : true, + "FR-17" : true, "FR-18" : true, "FR-19" : true, "FR-21" : true, "FR-22" : true, + "FR-23" : true, "FR-24" : true, "FR-25" : true, "FR-26" : true, "FR-27" : true, + "FR-28" : true, "FR-29" : true, "FR-2A" : true, "FR-2B" : true, "FR-30" : true, + "FR-31" : true, "FR-32" : true, "FR-33" : true, "FR-34" : true, "FR-35" : true, + "FR-36" : true, "FR-37" : true, "FR-38" : true, "FR-39" : true, "FR-40" : true, + "FR-41" : true, "FR-42" : true, "FR-43" : true, "FR-44" : true, "FR-45" : true, + "FR-46" : true, "FR-47" : true, "FR-48" : true, "FR-49" : true, "FR-50" : true, + "FR-51" : true, "FR-52" : true, "FR-53" : true, "FR-54" : true, "FR-55" : true, + "FR-56" : true, "FR-57" : true, "FR-58" : true, "FR-59" : true, "FR-60" : true, + "FR-61" : true, "FR-62" : true, "FR-63" : true, "FR-64" : true, "FR-65" : true, + "FR-66" : true, "FR-67" : true, "FR-68" : true, "FR-69" : true, "FR-70" : true, + "FR-71" : true, "FR-72" : true, "FR-73" : true, "FR-74" : true, "FR-75" : true, + "FR-76" : true, "FR-77" : true, "FR-78" : true, "FR-79" : true, "FR-80" : true, + "FR-81" : true, "FR-82" : true, "FR-83" : true, "FR-84" : true, "FR-85" : true, + "FR-86" : true, "FR-87" : true, "FR-88" : true, "FR-89" : true, "FR-90" : true, + "FR-91" : true, "FR-92" : true, "FR-93" : true, "FR-94" : true, "FR-95" : true, + "FR-ARA" : true, "FR-BFC" : true, "FR-BL" : true, "FR-BRE" : true, "FR-COR" : true, + "FR-CP" : true, "FR-CVL" : true, "FR-GES" : true, "FR-GF" : true, "FR-GP" : true, + "FR-GUA" : true, "FR-HDF" : true, "FR-IDF" : true, "FR-LRE" : true, "FR-MAY" : true, + "FR-MF" : true, "FR-MQ" : true, "FR-NAQ" : true, "FR-NC" : true, "FR-NOR" : true, + "FR-OCC" : true, "FR-PAC" : true, "FR-PDL" : true, "FR-PF" : true, "FR-PM" : true, + "FR-RE" : true, "FR-TF" : true, "FR-WF" : true, "FR-YT" : true, "GA-1" : true, + "GA-2" : true, "GA-3" : true, "GA-4" : true, "GA-5" : true, "GA-6" : true, + "GA-7" : true, "GA-8" : true, "GA-9" : true, "GB-ABC" : true, "GB-ABD" : true, + "GB-ABE" : true, "GB-AGB" : true, "GB-AGY" : true, "GB-AND" : true, "GB-ANN" : true, + "GB-ANS" : true, "GB-BAS" : true, "GB-BBD" : true, "GB-BDF" : true, "GB-BDG" : true, + "GB-BEN" : true, "GB-BEX" : true, "GB-BFS" : true, "GB-BGE" : true, "GB-BGW" : true, + "GB-BIR" : true, "GB-BKM" : true, "GB-BMH" : true, "GB-BNE" : true, "GB-BNH" : true, + "GB-BNS" : true, "GB-BOL" : true, "GB-BPL" : true, "GB-BRC" : true, "GB-BRD" : true, + "GB-BRY" : true, "GB-BST" : true, "GB-BUR" : true, "GB-CAM" : true, "GB-CAY" : true, + "GB-CBF" : true, "GB-CCG" : true, "GB-CGN" : true, "GB-CHE" : true, "GB-CHW" : true, + "GB-CLD" : true, "GB-CLK" : true, "GB-CMA" : true, "GB-CMD" : true, "GB-CMN" : true, + "GB-CON" : true, "GB-COV" : true, "GB-CRF" : true, "GB-CRY" : true, "GB-CWY" : true, + "GB-DAL" : true, "GB-DBY" : true, "GB-DEN" : true, "GB-DER" : true, "GB-DEV" : true, + "GB-DGY" : true, "GB-DNC" : true, "GB-DND" : true, "GB-DOR" : true, "GB-DRS" : true, + "GB-DUD" : true, "GB-DUR" : true, "GB-EAL" : true, "GB-EAW" : true, "GB-EAY" : true, + "GB-EDH" : true, "GB-EDU" : true, "GB-ELN" : true, "GB-ELS" : true, "GB-ENF" : true, + "GB-ENG" : true, "GB-ERW" : true, "GB-ERY" : true, "GB-ESS" : true, "GB-ESX" : true, + "GB-FAL" : true, "GB-FIF" : true, "GB-FLN" : true, "GB-FMO" : true, "GB-GAT" : true, + "GB-GBN" : true, "GB-GLG" : true, "GB-GLS" : true, "GB-GRE" : true, "GB-GWN" : true, + "GB-HAL" : true, "GB-HAM" : true, "GB-HAV" : true, "GB-HCK" : true, "GB-HEF" : true, + "GB-HIL" : true, "GB-HLD" : true, "GB-HMF" : true, "GB-HNS" : true, "GB-HPL" : true, + "GB-HRT" : true, "GB-HRW" : true, "GB-HRY" : true, "GB-IOS" : true, "GB-IOW" : true, + "GB-ISL" : true, "GB-IVC" : true, "GB-KEC" : true, "GB-KEN" : true, "GB-KHL" : true, + "GB-KIR" : true, "GB-KTT" : true, "GB-KWL" : true, "GB-LAN" : true, "GB-LBC" : true, + "GB-LBH" : true, "GB-LCE" : true, "GB-LDS" : true, "GB-LEC" : true, "GB-LEW" : true, + "GB-LIN" : true, "GB-LIV" : true, "GB-LND" : true, "GB-LUT" : true, "GB-MAN" : true, + "GB-MDB" : true, "GB-MDW" : true, "GB-MEA" : true, "GB-MIK" : true, "GD-01" : true, + "GB-MLN" : true, "GB-MON" : true, "GB-MRT" : true, "GB-MRY" : true, "GB-MTY" : true, + "GB-MUL" : true, "GB-NAY" : true, "GB-NBL" : true, "GB-NEL" : true, "GB-NET" : true, + "GB-NFK" : true, "GB-NGM" : true, "GB-NIR" : true, "GB-NLK" : true, "GB-NLN" : true, + "GB-NMD" : true, "GB-NSM" : true, "GB-NTH" : true, "GB-NTL" : true, "GB-NTT" : true, + "GB-NTY" : true, "GB-NWM" : true, "GB-NWP" : true, "GB-NYK" : true, "GB-OLD" : true, + "GB-ORK" : true, "GB-OXF" : true, "GB-PEM" : true, "GB-PKN" : true, "GB-PLY" : true, + "GB-POL" : true, "GB-POR" : true, "GB-POW" : true, "GB-PTE" : true, "GB-RCC" : true, + "GB-RCH" : true, "GB-RCT" : true, "GB-RDB" : true, "GB-RDG" : true, "GB-RFW" : true, + "GB-RIC" : true, "GB-ROT" : true, "GB-RUT" : true, "GB-SAW" : true, "GB-SAY" : true, + "GB-SCB" : true, "GB-SCT" : true, "GB-SFK" : true, "GB-SFT" : true, "GB-SGC" : true, + "GB-SHF" : true, "GB-SHN" : true, "GB-SHR" : true, "GB-SKP" : true, "GB-SLF" : true, + "GB-SLG" : true, "GB-SLK" : true, "GB-SND" : true, "GB-SOL" : true, "GB-SOM" : true, + "GB-SOS" : true, "GB-SRY" : true, "GB-STE" : true, "GB-STG" : true, "GB-STH" : true, + "GB-STN" : true, "GB-STS" : true, "GB-STT" : true, "GB-STY" : true, "GB-SWA" : true, + "GB-SWD" : true, "GB-SWK" : true, "GB-TAM" : true, "GB-TFW" : true, "GB-THR" : true, + "GB-TOB" : true, "GB-TOF" : true, "GB-TRF" : true, "GB-TWH" : true, "GB-UKM" : true, + "GB-VGL" : true, "GB-WAR" : true, "GB-WBK" : true, "GB-WDU" : true, "GB-WFT" : true, + "GB-WGN" : true, "GB-WIL" : true, "GB-WKF" : true, "GB-WLL" : true, "GB-WLN" : true, + "GB-WLS" : true, "GB-WLV" : true, "GB-WND" : true, "GB-WNM" : true, "GB-WOK" : true, + "GB-WOR" : true, "GB-WRL" : true, "GB-WRT" : true, "GB-WRX" : true, "GB-WSM" : true, + "GB-WSX" : true, "GB-YOR" : true, "GB-ZET" : true, "GD-02" : true, "GD-03" : true, + "GD-04" : true, "GD-05" : true, "GD-06" : true, "GD-10" : true, "GE-AB" : true, + "GE-AJ" : true, "GE-GU" : true, "GE-IM" : true, "GE-KA" : true, "GE-KK" : true, + "GE-MM" : true, "GE-RL" : true, "GE-SJ" : true, "GE-SK" : true, "GE-SZ" : true, + "GE-TB" : true, "GH-AA" : true, "GH-AH" : true, "GH-BA" : true, "GH-CP" : true, + "GH-EP" : true, "GH-NP" : true, "GH-TV" : true, "GH-UE" : true, "GH-UW" : true, + "GH-WP" : true, "GL-KU" : true, "GL-QA" : true, "GL-QE" : true, "GL-SM" : true, + "GM-B" : true, "GM-L" : true, "GM-M" : true, "GM-N" : true, "GM-U" : true, + "GM-W" : true, "GN-B" : true, "GN-BE" : true, "GN-BF" : true, "GN-BK" : true, + "GN-C" : true, "GN-CO" : true, "GN-D" : true, "GN-DB" : true, "GN-DI" : true, + "GN-DL" : true, "GN-DU" : true, "GN-F" : true, "GN-FA" : true, "GN-FO" : true, + "GN-FR" : true, "GN-GA" : true, "GN-GU" : true, "GN-K" : true, "GN-KA" : true, + "GN-KB" : true, "GN-KD" : true, "GN-KE" : true, "GN-KN" : true, "GN-KO" : true, + "GN-KS" : true, "GN-L" : true, "GN-LA" : true, "GN-LE" : true, "GN-LO" : true, + "GN-M" : true, "GN-MC" : true, "GN-MD" : true, "GN-ML" : true, "GN-MM" : true, + "GN-N" : true, "GN-NZ" : true, "GN-PI" : true, "GN-SI" : true, "GN-TE" : true, + "GN-TO" : true, "GN-YO" : true, "GQ-AN" : true, "GQ-BN" : true, "GQ-BS" : true, + "GQ-C" : true, "GQ-CS" : true, "GQ-I" : true, "GQ-KN" : true, "GQ-LI" : true, + "GQ-WN" : true, "GR-01" : true, "GR-03" : true, "GR-04" : true, "GR-05" : true, + "GR-06" : true, "GR-07" : true, "GR-11" : true, "GR-12" : true, "GR-13" : true, + "GR-14" : true, "GR-15" : true, "GR-16" : true, "GR-17" : true, "GR-21" : true, + "GR-22" : true, "GR-23" : true, "GR-24" : true, "GR-31" : true, "GR-32" : true, + "GR-33" : true, "GR-34" : true, "GR-41" : true, "GR-42" : true, "GR-43" : true, + "GR-44" : true, "GR-51" : true, "GR-52" : true, "GR-53" : true, "GR-54" : true, + "GR-55" : true, "GR-56" : true, "GR-57" : true, "GR-58" : true, "GR-59" : true, + "GR-61" : true, "GR-62" : true, "GR-63" : true, "GR-64" : true, "GR-69" : true, + "GR-71" : true, "GR-72" : true, "GR-73" : true, "GR-81" : true, "GR-82" : true, + "GR-83" : true, "GR-84" : true, "GR-85" : true, "GR-91" : true, "GR-92" : true, + "GR-93" : true, "GR-94" : true, "GR-A" : true, "GR-A1" : true, "GR-B" : true, + "GR-C" : true, "GR-D" : true, "GR-E" : true, "GR-F" : true, "GR-G" : true, + "GR-H" : true, "GR-I" : true, "GR-J" : true, "GR-K" : true, "GR-L" : true, + "GR-M" : true, "GT-AV" : true, "GT-BV" : true, "GT-CM" : true, "GT-CQ" : true, + "GT-ES" : true, "GT-GU" : true, "GT-HU" : true, "GT-IZ" : true, "GT-JA" : true, + "GT-JU" : true, "GT-PE" : true, "GT-PR" : true, "GT-QC" : true, "GT-QZ" : true, + "GT-RE" : true, "GT-SA" : true, "GT-SM" : true, "GT-SO" : true, "GT-SR" : true, + "GT-SU" : true, "GT-TO" : true, "GT-ZA" : true, "GW-BA" : true, "GW-BL" : true, + "GW-BM" : true, "GW-BS" : true, "GW-CA" : true, "GW-GA" : true, "GW-L" : true, + "GW-N" : true, "GW-OI" : true, "GW-QU" : true, "GW-S" : true, "GW-TO" : true, + "GY-BA" : true, "GY-CU" : true, "GY-DE" : true, "GY-EB" : true, "GY-ES" : true, + "GY-MA" : true, "GY-PM" : true, "GY-PT" : true, "GY-UD" : true, "GY-UT" : true, + "HN-AT" : true, "HN-CH" : true, "HN-CL" : true, "HN-CM" : true, "HN-CP" : true, + "HN-CR" : true, "HN-EP" : true, "HN-FM" : true, "HN-GD" : true, "HN-IB" : true, + "HN-IN" : true, "HN-LE" : true, "HN-LP" : true, "HN-OC" : true, "HN-OL" : true, + "HN-SB" : true, "HN-VA" : true, "HN-YO" : true, "HR-01" : true, "HR-02" : true, + "HR-03" : true, "HR-04" : true, "HR-05" : true, "HR-06" : true, "HR-07" : true, + "HR-08" : true, "HR-09" : true, "HR-10" : true, "HR-11" : true, "HR-12" : true, + "HR-13" : true, "HR-14" : true, "HR-15" : true, "HR-16" : true, "HR-17" : true, + "HR-18" : true, "HR-19" : true, "HR-20" : true, "HR-21" : true, "HT-AR" : true, + "HT-CE" : true, "HT-GA" : true, "HT-ND" : true, "HT-NE" : true, "HT-NO" : true, + "HT-OU" : true, "HT-SD" : true, "HT-SE" : true, "HU-BA" : true, "HU-BC" : true, + "HU-BE" : true, "HU-BK" : true, "HU-BU" : true, "HU-BZ" : true, "HU-CS" : true, + "HU-DE" : true, "HU-DU" : true, "HU-EG" : true, "HU-ER" : true, "HU-FE" : true, + "HU-GS" : true, "HU-GY" : true, "HU-HB" : true, "HU-HE" : true, "HU-HV" : true, + "HU-JN" : true, "HU-KE" : true, "HU-KM" : true, "HU-KV" : true, "HU-MI" : true, + "HU-NK" : true, "HU-NO" : true, "HU-NY" : true, "HU-PE" : true, "HU-PS" : true, + "HU-SD" : true, "HU-SF" : true, "HU-SH" : true, "HU-SK" : true, "HU-SN" : true, + "HU-SO" : true, "HU-SS" : true, "HU-ST" : true, "HU-SZ" : true, "HU-TB" : true, + "HU-TO" : true, "HU-VA" : true, "HU-VE" : true, "HU-VM" : true, "HU-ZA" : true, + "HU-ZE" : true, "ID-AC" : true, "ID-BA" : true, "ID-BB" : true, "ID-BE" : true, + "ID-BT" : true, "ID-GO" : true, "ID-IJ" : true, "ID-JA" : true, "ID-JB" : true, + "ID-JI" : true, "ID-JK" : true, "ID-JT" : true, "ID-JW" : true, "ID-KA" : true, + "ID-KB" : true, "ID-KI" : true, "ID-KR" : true, "ID-KS" : true, "ID-KT" : true, + "ID-LA" : true, "ID-MA" : true, "ID-ML" : true, "ID-MU" : true, "ID-NB" : true, + "ID-NT" : true, "ID-NU" : true, "ID-PA" : true, "ID-PB" : true, "ID-RI" : true, + "ID-SA" : true, "ID-SB" : true, "ID-SG" : true, "ID-SL" : true, "ID-SM" : true, + "ID-SN" : true, "ID-SR" : true, "ID-SS" : true, "ID-ST" : true, "ID-SU" : true, + "ID-YO" : true, "IE-C" : true, "IE-CE" : true, "IE-CN" : true, "IE-CO" : true, + "IE-CW" : true, "IE-D" : true, "IE-DL" : true, "IE-G" : true, "IE-KE" : true, + "IE-KK" : true, "IE-KY" : true, "IE-L" : true, "IE-LD" : true, "IE-LH" : true, + "IE-LK" : true, "IE-LM" : true, "IE-LS" : true, "IE-M" : true, "IE-MH" : true, + "IE-MN" : true, "IE-MO" : true, "IE-OY" : true, "IE-RN" : true, "IE-SO" : true, + "IE-TA" : true, "IE-U" : true, "IE-WD" : true, "IE-WH" : true, "IE-WW" : true, + "IE-WX" : true, "IL-D" : true, "IL-HA" : true, "IL-JM" : true, "IL-M" : true, + "IL-TA" : true, "IL-Z" : true, "IN-AN" : true, "IN-AP" : true, "IN-AR" : true, + "IN-AS" : true, "IN-BR" : true, "IN-CH" : true, "IN-CT" : true, "IN-DD" : true, + "IN-DL" : true, "IN-DN" : true, "IN-GA" : true, "IN-GJ" : true, "IN-HP" : true, + "IN-HR" : true, "IN-JH" : true, "IN-JK" : true, "IN-KA" : true, "IN-KL" : true, + "IN-LD" : true, "IN-MH" : true, "IN-ML" : true, "IN-MN" : true, "IN-MP" : true, + "IN-MZ" : true, "IN-NL" : true, "IN-OR" : true, "IN-PB" : true, "IN-PY" : true, + "IN-RJ" : true, "IN-SK" : true, "IN-TN" : true, "IN-TR" : true, "IN-UP" : true, + "IN-UT" : true, "IN-WB" : true, "IQ-AN" : true, "IQ-AR" : true, "IQ-BA" : true, + "IQ-BB" : true, "IQ-BG" : true, "IQ-DA" : true, "IQ-DI" : true, "IQ-DQ" : true, + "IQ-KA" : true, "IQ-MA" : true, "IQ-MU" : true, "IQ-NA" : true, "IQ-NI" : true, + "IQ-QA" : true, "IQ-SD" : true, "IQ-SW" : true, "IQ-TS" : true, "IQ-WA" : true, + "IR-01" : true, "IR-02" : true, "IR-03" : true, "IR-04" : true, "IR-05" : true, + "IR-06" : true, "IR-07" : true, "IR-08" : true, "IR-10" : true, "IR-11" : true, + "IR-12" : true, "IR-13" : true, "IR-14" : true, "IR-15" : true, "IR-16" : true, + "IR-17" : true, "IR-18" : true, "IR-19" : true, "IR-20" : true, "IR-21" : true, + "IR-22" : true, "IR-23" : true, "IR-24" : true, "IR-25" : true, "IR-26" : true, + "IR-27" : true, "IR-28" : true, "IR-29" : true, "IR-30" : true, "IR-31" : true, + "IS-0" : true, "IS-1" : true, "IS-2" : true, "IS-3" : true, "IS-4" : true, + "IS-5" : true, "IS-6" : true, "IS-7" : true, "IS-8" : true, "IT-21" : true, + "IT-23" : true, "IT-25" : true, "IT-32" : true, "IT-34" : true, "IT-36" : true, + "IT-42" : true, "IT-45" : true, "IT-52" : true, "IT-55" : true, "IT-57" : true, + "IT-62" : true, "IT-65" : true, "IT-67" : true, "IT-72" : true, "IT-75" : true, + "IT-77" : true, "IT-78" : true, "IT-82" : true, "IT-88" : true, "IT-AG" : true, + "IT-AL" : true, "IT-AN" : true, "IT-AO" : true, "IT-AP" : true, "IT-AQ" : true, + "IT-AR" : true, "IT-AT" : true, "IT-AV" : true, "IT-BA" : true, "IT-BG" : true, + "IT-BI" : true, "IT-BL" : true, "IT-BN" : true, "IT-BO" : true, "IT-BR" : true, + "IT-BS" : true, "IT-BT" : true, "IT-BZ" : true, "IT-CA" : true, "IT-CB" : true, + "IT-CE" : true, "IT-CH" : true, "IT-CI" : true, "IT-CL" : true, "IT-CN" : true, + "IT-CO" : true, "IT-CR" : true, "IT-CS" : true, "IT-CT" : true, "IT-CZ" : true, + "IT-EN" : true, "IT-FC" : true, "IT-FE" : true, "IT-FG" : true, "IT-FI" : true, + "IT-FM" : true, "IT-FR" : true, "IT-GE" : true, "IT-GO" : true, "IT-GR" : true, + "IT-IM" : true, "IT-IS" : true, "IT-KR" : true, "IT-LC" : true, "IT-LE" : true, + "IT-LI" : true, "IT-LO" : true, "IT-LT" : true, "IT-LU" : true, "IT-MB" : true, + "IT-MC" : true, "IT-ME" : true, "IT-MI" : true, "IT-MN" : true, "IT-MO" : true, + "IT-MS" : true, "IT-MT" : true, "IT-NA" : true, "IT-NO" : true, "IT-NU" : true, + "IT-OG" : true, "IT-OR" : true, "IT-OT" : true, "IT-PA" : true, "IT-PC" : true, + "IT-PD" : true, "IT-PE" : true, "IT-PG" : true, "IT-PI" : true, "IT-PN" : true, + "IT-PO" : true, "IT-PR" : true, "IT-PT" : true, "IT-PU" : true, "IT-PV" : true, + "IT-PZ" : true, "IT-RA" : true, "IT-RC" : true, "IT-RE" : true, "IT-RG" : true, + "IT-RI" : true, "IT-RM" : true, "IT-RN" : true, "IT-RO" : true, "IT-SA" : true, + "IT-SI" : true, "IT-SO" : true, "IT-SP" : true, "IT-SR" : true, "IT-SS" : true, + "IT-SV" : true, "IT-TA" : true, "IT-TE" : true, "IT-TN" : true, "IT-TO" : true, + "IT-TP" : true, "IT-TR" : true, "IT-TS" : true, "IT-TV" : true, "IT-UD" : true, + "IT-VA" : true, "IT-VB" : true, "IT-VC" : true, "IT-VE" : true, "IT-VI" : true, + "IT-VR" : true, "IT-VS" : true, "IT-VT" : true, "IT-VV" : true, "JM-01" : true, + "JM-02" : true, "JM-03" : true, "JM-04" : true, "JM-05" : true, "JM-06" : true, + "JM-07" : true, "JM-08" : true, "JM-09" : true, "JM-10" : true, "JM-11" : true, + "JM-12" : true, "JM-13" : true, "JM-14" : true, "JO-AJ" : true, "JO-AM" : true, + "JO-AQ" : true, "JO-AT" : true, "JO-AZ" : true, "JO-BA" : true, "JO-IR" : true, + "JO-JA" : true, "JO-KA" : true, "JO-MA" : true, "JO-MD" : true, "JO-MN" : true, + "JP-01" : true, "JP-02" : true, "JP-03" : true, "JP-04" : true, "JP-05" : true, + "JP-06" : true, "JP-07" : true, "JP-08" : true, "JP-09" : true, "JP-10" : true, + "JP-11" : true, "JP-12" : true, "JP-13" : true, "JP-14" : true, "JP-15" : true, + "JP-16" : true, "JP-17" : true, "JP-18" : true, "JP-19" : true, "JP-20" : true, + "JP-21" : true, "JP-22" : true, "JP-23" : true, "JP-24" : true, "JP-25" : true, + "JP-26" : true, "JP-27" : true, "JP-28" : true, "JP-29" : true, "JP-30" : true, + "JP-31" : true, "JP-32" : true, "JP-33" : true, "JP-34" : true, "JP-35" : true, + "JP-36" : true, "JP-37" : true, "JP-38" : true, "JP-39" : true, "JP-40" : true, + "JP-41" : true, "JP-42" : true, "JP-43" : true, "JP-44" : true, "JP-45" : true, + "JP-46" : true, "JP-47" : true, "KE-110" : true, "KE-200" : true, "KE-300" : true, + "KE-400" : true, "KE-500" : true, "KE-700" : true, "KE-800" : true, "KG-B" : true, + "KG-C" : true, "KG-GB" : true, "KG-J" : true, "KG-N" : true, "KG-O" : true, + "KG-T" : true, "KG-Y" : true, "KH-1" : true, "KH-10" : true, "KH-11" : true, + "KH-12" : true, "KH-13" : true, "KH-14" : true, "KH-15" : true, "KH-16" : true, + "KH-17" : true, "KH-18" : true, "KH-19" : true, "KH-2" : true, "KH-20" : true, + "KH-21" : true, "KH-22" : true, "KH-23" : true, "KH-24" : true, "KH-3" : true, + "KH-4" : true, "KH-5" : true, "KH-6" : true, "KH-7" : true, "KH-8" : true, + "KH-9" : true, "KI-G" : true, "KI-L" : true, "KI-P" : true, "KM-A" : true, + "KM-G" : true, "KM-M" : true, "KN-01" : true, "KN-02" : true, "KN-03" : true, + "KN-04" : true, "KN-05" : true, "KN-06" : true, "KN-07" : true, "KN-08" : true, + "KN-09" : true, "KN-10" : true, "KN-11" : true, "KN-12" : true, "KN-13" : true, + "KN-15" : true, "KN-K" : true, "KN-N" : true, "KP-01" : true, "KP-02" : true, + "KP-03" : true, "KP-04" : true, "KP-05" : true, "KP-06" : true, "KP-07" : true, + "KP-08" : true, "KP-09" : true, "KP-10" : true, "KP-13" : true, "KR-11" : true, + "KR-26" : true, "KR-27" : true, "KR-28" : true, "KR-29" : true, "KR-30" : true, + "KR-31" : true, "KR-41" : true, "KR-42" : true, "KR-43" : true, "KR-44" : true, + "KR-45" : true, "KR-46" : true, "KR-47" : true, "KR-48" : true, "KR-49" : true, + "KW-AH" : true, "KW-FA" : true, "KW-HA" : true, "KW-JA" : true, "KW-KU" : true, + "KW-MU" : true, "KZ-AKM" : true, "KZ-AKT" : true, "KZ-ALA" : true, "KZ-ALM" : true, + "KZ-AST" : true, "KZ-ATY" : true, "KZ-KAR" : true, "KZ-KUS" : true, "KZ-KZY" : true, + "KZ-MAN" : true, "KZ-PAV" : true, "KZ-SEV" : true, "KZ-VOS" : true, "KZ-YUZ" : true, + "KZ-ZAP" : true, "KZ-ZHA" : true, "LA-AT" : true, "LA-BK" : true, "LA-BL" : true, + "LA-CH" : true, "LA-HO" : true, "LA-KH" : true, "LA-LM" : true, "LA-LP" : true, + "LA-OU" : true, "LA-PH" : true, "LA-SL" : true, "LA-SV" : true, "LA-VI" : true, + "LA-VT" : true, "LA-XA" : true, "LA-XE" : true, "LA-XI" : true, "LA-XS" : true, + "LB-AK" : true, "LB-AS" : true, "LB-BA" : true, "LB-BH" : true, "LB-BI" : true, + "LB-JA" : true, "LB-JL" : true, "LB-NA" : true, "LI-01" : true, "LI-02" : true, + "LI-03" : true, "LI-04" : true, "LI-05" : true, "LI-06" : true, "LI-07" : true, + "LI-08" : true, "LI-09" : true, "LI-10" : true, "LI-11" : true, "LK-1" : true, + "LK-11" : true, "LK-12" : true, "LK-13" : true, "LK-2" : true, "LK-21" : true, + "LK-22" : true, "LK-23" : true, "LK-3" : true, "LK-31" : true, "LK-32" : true, + "LK-33" : true, "LK-4" : true, "LK-41" : true, "LK-42" : true, "LK-43" : true, + "LK-44" : true, "LK-45" : true, "LK-5" : true, "LK-51" : true, "LK-52" : true, + "LK-53" : true, "LK-6" : true, "LK-61" : true, "LK-62" : true, "LK-7" : true, + "LK-71" : true, "LK-72" : true, "LK-8" : true, "LK-81" : true, "LK-82" : true, + "LK-9" : true, "LK-91" : true, "LK-92" : true, "LR-BG" : true, "LR-BM" : true, + "LR-CM" : true, "LR-GB" : true, "LR-GG" : true, "LR-GK" : true, "LR-LO" : true, + "LR-MG" : true, "LR-MO" : true, "LR-MY" : true, "LR-NI" : true, "LR-RI" : true, + "LR-SI" : true, "LS-A" : true, "LS-B" : true, "LS-C" : true, "LS-D" : true, + "LS-E" : true, "LS-F" : true, "LS-G" : true, "LS-H" : true, "LS-J" : true, + "LS-K" : true, "LT-AL" : true, "LT-KL" : true, "LT-KU" : true, "LT-MR" : true, + "LT-PN" : true, "LT-SA" : true, "LT-TA" : true, "LT-TE" : true, "LT-UT" : true, + "LT-VL" : true, "LU-D" : true, "LU-G" : true, "LU-L" : true, "LV-001" : true, + "LV-002" : true, "LV-003" : true, "LV-004" : true, "LV-005" : true, "LV-006" : true, + "LV-007" : true, "LV-008" : true, "LV-009" : true, "LV-010" : true, "LV-011" : true, + "LV-012" : true, "LV-013" : true, "LV-014" : true, "LV-015" : true, "LV-016" : true, + "LV-017" : true, "LV-018" : true, "LV-019" : true, "LV-020" : true, "LV-021" : true, + "LV-022" : true, "LV-023" : true, "LV-024" : true, "LV-025" : true, "LV-026" : true, + "LV-027" : true, "LV-028" : true, "LV-029" : true, "LV-030" : true, "LV-031" : true, + "LV-032" : true, "LV-033" : true, "LV-034" : true, "LV-035" : true, "LV-036" : true, + "LV-037" : true, "LV-038" : true, "LV-039" : true, "LV-040" : true, "LV-041" : true, + "LV-042" : true, "LV-043" : true, "LV-044" : true, "LV-045" : true, "LV-046" : true, + "LV-047" : true, "LV-048" : true, "LV-049" : true, "LV-050" : true, "LV-051" : true, + "LV-052" : true, "LV-053" : true, "LV-054" : true, "LV-055" : true, "LV-056" : true, + "LV-057" : true, "LV-058" : true, "LV-059" : true, "LV-060" : true, "LV-061" : true, + "LV-062" : true, "LV-063" : true, "LV-064" : true, "LV-065" : true, "LV-066" : true, + "LV-067" : true, "LV-068" : true, "LV-069" : true, "LV-070" : true, "LV-071" : true, + "LV-072" : true, "LV-073" : true, "LV-074" : true, "LV-075" : true, "LV-076" : true, + "LV-077" : true, "LV-078" : true, "LV-079" : true, "LV-080" : true, "LV-081" : true, + "LV-082" : true, "LV-083" : true, "LV-084" : true, "LV-085" : true, "LV-086" : true, + "LV-087" : true, "LV-088" : true, "LV-089" : true, "LV-090" : true, "LV-091" : true, + "LV-092" : true, "LV-093" : true, "LV-094" : true, "LV-095" : true, "LV-096" : true, + "LV-097" : true, "LV-098" : true, "LV-099" : true, "LV-100" : true, "LV-101" : true, + "LV-102" : true, "LV-103" : true, "LV-104" : true, "LV-105" : true, "LV-106" : true, + "LV-107" : true, "LV-108" : true, "LV-109" : true, "LV-110" : true, "LV-DGV" : true, + "LV-JEL" : true, "LV-JKB" : true, "LV-JUR" : true, "LV-LPX" : true, "LV-REZ" : true, + "LV-RIX" : true, "LV-VEN" : true, "LV-VMR" : true, "LY-BA" : true, "LY-BU" : true, + "LY-DR" : true, "LY-GT" : true, "LY-JA" : true, "LY-JB" : true, "LY-JG" : true, + "LY-JI" : true, "LY-JU" : true, "LY-KF" : true, "LY-MB" : true, "LY-MI" : true, + "LY-MJ" : true, "LY-MQ" : true, "LY-NL" : true, "LY-NQ" : true, "LY-SB" : true, + "LY-SR" : true, "LY-TB" : true, "LY-WA" : true, "LY-WD" : true, "LY-WS" : true, + "LY-ZA" : true, "MA-01" : true, "MA-02" : true, "MA-03" : true, "MA-04" : true, + "MA-05" : true, "MA-06" : true, "MA-07" : true, "MA-08" : true, "MA-09" : true, + "MA-10" : true, "MA-11" : true, "MA-12" : true, "MA-13" : true, "MA-14" : true, + "MA-15" : true, "MA-16" : true, "MA-AGD" : true, "MA-AOU" : true, "MA-ASZ" : true, + "MA-AZI" : true, "MA-BEM" : true, "MA-BER" : true, "MA-BES" : true, "MA-BOD" : true, + "MA-BOM" : true, "MA-CAS" : true, "MA-CHE" : true, "MA-CHI" : true, "MA-CHT" : true, + "MA-ERR" : true, "MA-ESI" : true, "MA-ESM" : true, "MA-FAH" : true, "MA-FES" : true, + "MA-FIG" : true, "MA-GUE" : true, "MA-HAJ" : true, "MA-HAO" : true, "MA-HOC" : true, + "MA-IFR" : true, "MA-INE" : true, "MA-JDI" : true, "MA-JRA" : true, "MA-KEN" : true, + "MA-KES" : true, "MA-KHE" : true, "MA-KHN" : true, "MA-KHO" : true, "MA-LAA" : true, + "MA-LAR" : true, "MA-MED" : true, "MA-MEK" : true, "MA-MMD" : true, "MA-MMN" : true, + "MA-MOH" : true, "MA-MOU" : true, "MA-NAD" : true, "MA-NOU" : true, "MA-OUA" : true, + "MA-OUD" : true, "MA-OUJ" : true, "MA-RAB" : true, "MA-SAF" : true, "MA-SAL" : true, + "MA-SEF" : true, "MA-SET" : true, "MA-SIK" : true, "MA-SKH" : true, "MA-SYB" : true, + "MA-TAI" : true, "MA-TAO" : true, "MA-TAR" : true, "MA-TAT" : true, "MA-TAZ" : true, + "MA-TET" : true, "MA-TIZ" : true, "MA-TNG" : true, "MA-TNT" : true, "MA-ZAG" : true, + "MC-CL" : true, "MC-CO" : true, "MC-FO" : true, "MC-GA" : true, "MC-JE" : true, + "MC-LA" : true, "MC-MA" : true, "MC-MC" : true, "MC-MG" : true, "MC-MO" : true, + "MC-MU" : true, "MC-PH" : true, "MC-SD" : true, "MC-SO" : true, "MC-SP" : true, + "MC-SR" : true, "MC-VR" : true, "MD-AN" : true, "MD-BA" : true, "MD-BD" : true, + "MD-BR" : true, "MD-BS" : true, "MD-CA" : true, "MD-CL" : true, "MD-CM" : true, + "MD-CR" : true, "MD-CS" : true, "MD-CT" : true, "MD-CU" : true, "MD-DO" : true, + "MD-DR" : true, "MD-DU" : true, "MD-ED" : true, "MD-FA" : true, "MD-FL" : true, + "MD-GA" : true, "MD-GL" : true, "MD-HI" : true, "MD-IA" : true, "MD-LE" : true, + "MD-NI" : true, "MD-OC" : true, "MD-OR" : true, "MD-RE" : true, "MD-RI" : true, + "MD-SD" : true, "MD-SI" : true, "MD-SN" : true, "MD-SO" : true, "MD-ST" : true, + "MD-SV" : true, "MD-TA" : true, "MD-TE" : true, "MD-UN" : true, "ME-01" : true, + "ME-02" : true, "ME-03" : true, "ME-04" : true, "ME-05" : true, "ME-06" : true, + "ME-07" : true, "ME-08" : true, "ME-09" : true, "ME-10" : true, "ME-11" : true, + "ME-12" : true, "ME-13" : true, "ME-14" : true, "ME-15" : true, "ME-16" : true, + "ME-17" : true, "ME-18" : true, "ME-19" : true, "ME-20" : true, "ME-21" : true, + "MG-A" : true, "MG-D" : true, "MG-F" : true, "MG-M" : true, "MG-T" : true, + "MG-U" : true, "MH-ALK" : true, "MH-ALL" : true, "MH-ARN" : true, "MH-AUR" : true, + "MH-EBO" : true, "MH-ENI" : true, "MH-JAB" : true, "MH-JAL" : true, "MH-KIL" : true, + "MH-KWA" : true, "MH-L" : true, "MH-LAE" : true, "MH-LIB" : true, "MH-LIK" : true, + "MH-MAJ" : true, "MH-MAL" : true, "MH-MEJ" : true, "MH-MIL" : true, "MH-NMK" : true, + "MH-NMU" : true, "MH-RON" : true, "MH-T" : true, "MH-UJA" : true, "MH-UTI" : true, + "MH-WTJ" : true, "MH-WTN" : true, "MK-01" : true, "MK-02" : true, "MK-03" : true, + "MK-04" : true, "MK-05" : true, "MK-06" : true, "MK-07" : true, "MK-08" : true, + "MK-09" : true, "MK-10" : true, "MK-11" : true, "MK-12" : true, "MK-13" : true, + "MK-14" : true, "MK-15" : true, "MK-16" : true, "MK-17" : true, "MK-18" : true, + "MK-19" : true, "MK-20" : true, "MK-21" : true, "MK-22" : true, "MK-23" : true, + "MK-24" : true, "MK-25" : true, "MK-26" : true, "MK-27" : true, "MK-28" : true, + "MK-29" : true, "MK-30" : true, "MK-31" : true, "MK-32" : true, "MK-33" : true, + "MK-34" : true, "MK-35" : true, "MK-36" : true, "MK-37" : true, "MK-38" : true, + "MK-39" : true, "MK-40" : true, "MK-41" : true, "MK-42" : true, "MK-43" : true, + "MK-44" : true, "MK-45" : true, "MK-46" : true, "MK-47" : true, "MK-48" : true, + "MK-49" : true, "MK-50" : true, "MK-51" : true, "MK-52" : true, "MK-53" : true, + "MK-54" : true, "MK-55" : true, "MK-56" : true, "MK-57" : true, "MK-58" : true, + "MK-59" : true, "MK-60" : true, "MK-61" : true, "MK-62" : true, "MK-63" : true, + "MK-64" : true, "MK-65" : true, "MK-66" : true, "MK-67" : true, "MK-68" : true, + "MK-69" : true, "MK-70" : true, "MK-71" : true, "MK-72" : true, "MK-73" : true, + "MK-74" : true, "MK-75" : true, "MK-76" : true, "MK-77" : true, "MK-78" : true, + "MK-79" : true, "MK-80" : true, "MK-81" : true, "MK-82" : true, "MK-83" : true, + "MK-84" : true, "ML-1" : true, "ML-2" : true, "ML-3" : true, "ML-4" : true, + "ML-5" : true, "ML-6" : true, "ML-7" : true, "ML-8" : true, "ML-BK0" : true, + "MM-01" : true, "MM-02" : true, "MM-03" : true, "MM-04" : true, "MM-05" : true, + "MM-06" : true, "MM-07" : true, "MM-11" : true, "MM-12" : true, "MM-13" : true, + "MM-14" : true, "MM-15" : true, "MM-16" : true, "MM-17" : true, "MN-035" : true, + "MN-037" : true, "MN-039" : true, "MN-041" : true, "MN-043" : true, "MN-046" : true, + "MN-047" : true, "MN-049" : true, "MN-051" : true, "MN-053" : true, "MN-055" : true, + "MN-057" : true, "MN-059" : true, "MN-061" : true, "MN-063" : true, "MN-064" : true, + "MN-065" : true, "MN-067" : true, "MN-069" : true, "MN-071" : true, "MN-073" : true, + "MN-1" : true, "MR-01" : true, "MR-02" : true, "MR-03" : true, "MR-04" : true, + "MR-05" : true, "MR-06" : true, "MR-07" : true, "MR-08" : true, "MR-09" : true, + "MR-10" : true, "MR-11" : true, "MR-12" : true, "MR-NKC" : true, "MT-01" : true, + "MT-02" : true, "MT-03" : true, "MT-04" : true, "MT-05" : true, "MT-06" : true, + "MT-07" : true, "MT-08" : true, "MT-09" : true, "MT-10" : true, "MT-11" : true, + "MT-12" : true, "MT-13" : true, "MT-14" : true, "MT-15" : true, "MT-16" : true, + "MT-17" : true, "MT-18" : true, "MT-19" : true, "MT-20" : true, "MT-21" : true, + "MT-22" : true, "MT-23" : true, "MT-24" : true, "MT-25" : true, "MT-26" : true, + "MT-27" : true, "MT-28" : true, "MT-29" : true, "MT-30" : true, "MT-31" : true, + "MT-32" : true, "MT-33" : true, "MT-34" : true, "MT-35" : true, "MT-36" : true, + "MT-37" : true, "MT-38" : true, "MT-39" : true, "MT-40" : true, "MT-41" : true, + "MT-42" : true, "MT-43" : true, "MT-44" : true, "MT-45" : true, "MT-46" : true, + "MT-47" : true, "MT-48" : true, "MT-49" : true, "MT-50" : true, "MT-51" : true, + "MT-52" : true, "MT-53" : true, "MT-54" : true, "MT-55" : true, "MT-56" : true, + "MT-57" : true, "MT-58" : true, "MT-59" : true, "MT-60" : true, "MT-61" : true, + "MT-62" : true, "MT-63" : true, "MT-64" : true, "MT-65" : true, "MT-66" : true, + "MT-67" : true, "MT-68" : true, "MU-AG" : true, "MU-BL" : true, "MU-BR" : true, + "MU-CC" : true, "MU-CU" : true, "MU-FL" : true, "MU-GP" : true, "MU-MO" : true, + "MU-PA" : true, "MU-PL" : true, "MU-PU" : true, "MU-PW" : true, "MU-QB" : true, + "MU-RO" : true, "MU-RP" : true, "MU-SA" : true, "MU-VP" : true, "MV-00" : true, + "MV-01" : true, "MV-02" : true, "MV-03" : true, "MV-04" : true, "MV-05" : true, + "MV-07" : true, "MV-08" : true, "MV-12" : true, "MV-13" : true, "MV-14" : true, + "MV-17" : true, "MV-20" : true, "MV-23" : true, "MV-24" : true, "MV-25" : true, + "MV-26" : true, "MV-27" : true, "MV-28" : true, "MV-29" : true, "MV-CE" : true, + "MV-MLE" : true, "MV-NC" : true, "MV-NO" : true, "MV-SC" : true, "MV-SU" : true, + "MV-UN" : true, "MV-US" : true, "MW-BA" : true, "MW-BL" : true, "MW-C" : true, + "MW-CK" : true, "MW-CR" : true, "MW-CT" : true, "MW-DE" : true, "MW-DO" : true, + "MW-KR" : true, "MW-KS" : true, "MW-LI" : true, "MW-LK" : true, "MW-MC" : true, + "MW-MG" : true, "MW-MH" : true, "MW-MU" : true, "MW-MW" : true, "MW-MZ" : true, + "MW-N" : true, "MW-NB" : true, "MW-NE" : true, "MW-NI" : true, "MW-NK" : true, + "MW-NS" : true, "MW-NU" : true, "MW-PH" : true, "MW-RU" : true, "MW-S" : true, + "MW-SA" : true, "MW-TH" : true, "MW-ZO" : true, "MX-AGU" : true, "MX-BCN" : true, + "MX-BCS" : true, "MX-CAM" : true, "MX-CHH" : true, "MX-CHP" : true, "MX-COA" : true, + "MX-COL" : true, "MX-DIF" : true, "MX-DUR" : true, "MX-GRO" : true, "MX-GUA" : true, + "MX-HID" : true, "MX-JAL" : true, "MX-MEX" : true, "MX-MIC" : true, "MX-MOR" : true, + "MX-NAY" : true, "MX-NLE" : true, "MX-OAX" : true, "MX-PUE" : true, "MX-QUE" : true, + "MX-ROO" : true, "MX-SIN" : true, "MX-SLP" : true, "MX-SON" : true, "MX-TAB" : true, + "MX-TAM" : true, "MX-TLA" : true, "MX-VER" : true, "MX-YUC" : true, "MX-ZAC" : true, + "MY-01" : true, "MY-02" : true, "MY-03" : true, "MY-04" : true, "MY-05" : true, + "MY-06" : true, "MY-07" : true, "MY-08" : true, "MY-09" : true, "MY-10" : true, + "MY-11" : true, "MY-12" : true, "MY-13" : true, "MY-14" : true, "MY-15" : true, + "MY-16" : true, "MZ-A" : true, "MZ-B" : true, "MZ-G" : true, "MZ-I" : true, + "MZ-L" : true, "MZ-MPM" : true, "MZ-N" : true, "MZ-P" : true, "MZ-Q" : true, + "MZ-S" : true, "MZ-T" : true, "NA-CA" : true, "NA-ER" : true, "NA-HA" : true, + "NA-KA" : true, "NA-KH" : true, "NA-KU" : true, "NA-OD" : true, "NA-OH" : true, + "NA-OK" : true, "NA-ON" : true, "NA-OS" : true, "NA-OT" : true, "NA-OW" : true, + "NE-1" : true, "NE-2" : true, "NE-3" : true, "NE-4" : true, "NE-5" : true, + "NE-6" : true, "NE-7" : true, "NE-8" : true, "NG-AB" : true, "NG-AD" : true, + "NG-AK" : true, "NG-AN" : true, "NG-BA" : true, "NG-BE" : true, "NG-BO" : true, + "NG-BY" : true, "NG-CR" : true, "NG-DE" : true, "NG-EB" : true, "NG-ED" : true, + "NG-EK" : true, "NG-EN" : true, "NG-FC" : true, "NG-GO" : true, "NG-IM" : true, + "NG-JI" : true, "NG-KD" : true, "NG-KE" : true, "NG-KN" : true, "NG-KO" : true, + "NG-KT" : true, "NG-KW" : true, "NG-LA" : true, "NG-NA" : true, "NG-NI" : true, + "NG-OG" : true, "NG-ON" : true, "NG-OS" : true, "NG-OY" : true, "NG-PL" : true, + "NG-RI" : true, "NG-SO" : true, "NG-TA" : true, "NG-YO" : true, "NG-ZA" : true, + "NI-AN" : true, "NI-AS" : true, "NI-BO" : true, "NI-CA" : true, "NI-CI" : true, + "NI-CO" : true, "NI-ES" : true, "NI-GR" : true, "NI-JI" : true, "NI-LE" : true, + "NI-MD" : true, "NI-MN" : true, "NI-MS" : true, "NI-MT" : true, "NI-NS" : true, + "NI-RI" : true, "NI-SJ" : true, "NL-AW" : true, "NL-BQ1" : true, "NL-BQ2" : true, + "NL-BQ3" : true, "NL-CW" : true, "NL-DR" : true, "NL-FL" : true, "NL-FR" : true, + "NL-GE" : true, "NL-GR" : true, "NL-LI" : true, "NL-NB" : true, "NL-NH" : true, + "NL-OV" : true, "NL-SX" : true, "NL-UT" : true, "NL-ZE" : true, "NL-ZH" : true, + "NO-01" : true, "NO-02" : true, "NO-03" : true, "NO-04" : true, "NO-05" : true, + "NO-06" : true, "NO-07" : true, "NO-08" : true, "NO-09" : true, "NO-10" : true, + "NO-11" : true, "NO-12" : true, "NO-14" : true, "NO-15" : true, "NO-16" : true, + "NO-17" : true, "NO-18" : true, "NO-19" : true, "NO-20" : true, "NO-21" : true, + "NO-22" : true, "NP-1" : true, "NP-2" : true, "NP-3" : true, "NP-4" : true, + "NP-5" : true, "NP-BA" : true, "NP-BH" : true, "NP-DH" : true, "NP-GA" : true, + "NP-JA" : true, "NP-KA" : true, "NP-KO" : true, "NP-LU" : true, "NP-MA" : true, + "NP-ME" : true, "NP-NA" : true, "NP-RA" : true, "NP-SA" : true, "NP-SE" : true, + "NR-01" : true, "NR-02" : true, "NR-03" : true, "NR-04" : true, "NR-05" : true, + "NR-06" : true, "NR-07" : true, "NR-08" : true, "NR-09" : true, "NR-10" : true, + "NR-11" : true, "NR-12" : true, "NR-13" : true, "NR-14" : true, "NZ-AUK" : true, + "NZ-BOP" : true, "NZ-CAN" : true, "NZ-CIT" : true, "NZ-GIS" : true, "NZ-HKB" : true, + "NZ-MBH" : true, "NZ-MWT" : true, "NZ-N" : true, "NZ-NSN" : true, "NZ-NTL" : true, + "NZ-OTA" : true, "NZ-S" : true, "NZ-STL" : true, "NZ-TAS" : true, "NZ-TKI" : true, + "NZ-WGN" : true, "NZ-WKO" : true, "NZ-WTC" : true, "OM-BA" : true, "OM-BU" : true, + "OM-DA" : true, "OM-MA" : true, "OM-MU" : true, "OM-SH" : true, "OM-WU" : true, + "OM-ZA" : true, "OM-ZU" : true, "PA-1" : true, "PA-2" : true, "PA-3" : true, + "PA-4" : true, "PA-5" : true, "PA-6" : true, "PA-7" : true, "PA-8" : true, + "PA-9" : true, "PA-EM" : true, "PA-KY" : true, "PA-NB" : true, "PE-AMA" : true, + "PE-ANC" : true, "PE-APU" : true, "PE-ARE" : true, "PE-AYA" : true, "PE-CAJ" : true, + "PE-CAL" : true, "PE-CUS" : true, "PE-HUC" : true, "PE-HUV" : true, "PE-ICA" : true, + "PE-JUN" : true, "PE-LAL" : true, "PE-LAM" : true, "PE-LIM" : true, "PE-LMA" : true, + "PE-LOR" : true, "PE-MDD" : true, "PE-MOQ" : true, "PE-PAS" : true, "PE-PIU" : true, + "PE-PUN" : true, "PE-SAM" : true, "PE-TAC" : true, "PE-TUM" : true, "PE-UCA" : true, + "PG-CPK" : true, "PG-CPM" : true, "PG-EBR" : true, "PG-EHG" : true, "PG-EPW" : true, + "PG-ESW" : true, "PG-GPK" : true, "PG-MBA" : true, "PG-MPL" : true, "PG-MPM" : true, + "PG-MRL" : true, "PG-NCD" : true, "PG-NIK" : true, "PG-NPP" : true, "PG-NSB" : true, + "PG-SAN" : true, "PG-SHM" : true, "PG-WBK" : true, "PG-WHM" : true, "PG-WPD" : true, + "PH-00" : true, "PH-01" : true, "PH-02" : true, "PH-03" : true, "PH-05" : true, + "PH-06" : true, "PH-07" : true, "PH-08" : true, "PH-09" : true, "PH-10" : true, + "PH-11" : true, "PH-12" : true, "PH-13" : true, "PH-14" : true, "PH-15" : true, + "PH-40" : true, "PH-41" : true, "PH-ABR" : true, "PH-AGN" : true, "PH-AGS" : true, + "PH-AKL" : true, "PH-ALB" : true, "PH-ANT" : true, "PH-APA" : true, "PH-AUR" : true, + "PH-BAN" : true, "PH-BAS" : true, "PH-BEN" : true, "PH-BIL" : true, "PH-BOH" : true, + "PH-BTG" : true, "PH-BTN" : true, "PH-BUK" : true, "PH-BUL" : true, "PH-CAG" : true, + "PH-CAM" : true, "PH-CAN" : true, "PH-CAP" : true, "PH-CAS" : true, "PH-CAT" : true, + "PH-CAV" : true, "PH-CEB" : true, "PH-COM" : true, "PH-DAO" : true, "PH-DAS" : true, + "PH-DAV" : true, "PH-DIN" : true, "PH-EAS" : true, "PH-GUI" : true, "PH-IFU" : true, + "PH-ILI" : true, "PH-ILN" : true, "PH-ILS" : true, "PH-ISA" : true, "PH-KAL" : true, + "PH-LAG" : true, "PH-LAN" : true, "PH-LAS" : true, "PH-LEY" : true, "PH-LUN" : true, + "PH-MAD" : true, "PH-MAG" : true, "PH-MAS" : true, "PH-MDC" : true, "PH-MDR" : true, + "PH-MOU" : true, "PH-MSC" : true, "PH-MSR" : true, "PH-NCO" : true, "PH-NEC" : true, + "PH-NER" : true, "PH-NSA" : true, "PH-NUE" : true, "PH-NUV" : true, "PH-PAM" : true, + "PH-PAN" : true, "PH-PLW" : true, "PH-QUE" : true, "PH-QUI" : true, "PH-RIZ" : true, + "PH-ROM" : true, "PH-SAR" : true, "PH-SCO" : true, "PH-SIG" : true, "PH-SLE" : true, + "PH-SLU" : true, "PH-SOR" : true, "PH-SUK" : true, "PH-SUN" : true, "PH-SUR" : true, + "PH-TAR" : true, "PH-TAW" : true, "PH-WSA" : true, "PH-ZAN" : true, "PH-ZAS" : true, + "PH-ZMB" : true, "PH-ZSI" : true, "PK-BA" : true, "PK-GB" : true, "PK-IS" : true, + "PK-JK" : true, "PK-KP" : true, "PK-PB" : true, "PK-SD" : true, "PK-TA" : true, + "PL-DS" : true, "PL-KP" : true, "PL-LB" : true, "PL-LD" : true, "PL-LU" : true, + "PL-MA" : true, "PL-MZ" : true, "PL-OP" : true, "PL-PD" : true, "PL-PK" : true, + "PL-PM" : true, "PL-SK" : true, "PL-SL" : true, "PL-WN" : true, "PL-WP" : true, + "PL-ZP" : true, "PS-BTH" : true, "PS-DEB" : true, "PS-GZA" : true, "PS-HBN" : true, + "PS-JEM" : true, "PS-JEN" : true, "PS-JRH" : true, "PS-KYS" : true, "PS-NBS" : true, + "PS-NGZ" : true, "PS-QQA" : true, "PS-RBH" : true, "PS-RFH" : true, "PS-SLT" : true, + "PS-TBS" : true, "PS-TKM" : true, "PT-01" : true, "PT-02" : true, "PT-03" : true, + "PT-04" : true, "PT-05" : true, "PT-06" : true, "PT-07" : true, "PT-08" : true, + "PT-09" : true, "PT-10" : true, "PT-11" : true, "PT-12" : true, "PT-13" : true, + "PT-14" : true, "PT-15" : true, "PT-16" : true, "PT-17" : true, "PT-18" : true, + "PT-20" : true, "PT-30" : true, "PW-002" : true, "PW-004" : true, "PW-010" : true, + "PW-050" : true, "PW-100" : true, "PW-150" : true, "PW-212" : true, "PW-214" : true, + "PW-218" : true, "PW-222" : true, "PW-224" : true, "PW-226" : true, "PW-227" : true, + "PW-228" : true, "PW-350" : true, "PW-370" : true, "PY-1" : true, "PY-10" : true, + "PY-11" : true, "PY-12" : true, "PY-13" : true, "PY-14" : true, "PY-15" : true, + "PY-16" : true, "PY-19" : true, "PY-2" : true, "PY-3" : true, "PY-4" : true, + "PY-5" : true, "PY-6" : true, "PY-7" : true, "PY-8" : true, "PY-9" : true, + "PY-ASU" : true, "QA-DA" : true, "QA-KH" : true, "QA-MS" : true, "QA-RA" : true, + "QA-US" : true, "QA-WA" : true, "QA-ZA" : true, "RO-AB" : true, "RO-AG" : true, + "RO-AR" : true, "RO-B" : true, "RO-BC" : true, "RO-BH" : true, "RO-BN" : true, + "RO-BR" : true, "RO-BT" : true, "RO-BV" : true, "RO-BZ" : true, "RO-CJ" : true, + "RO-CL" : true, "RO-CS" : true, "RO-CT" : true, "RO-CV" : true, "RO-DB" : true, + "RO-DJ" : true, "RO-GJ" : true, "RO-GL" : true, "RO-GR" : true, "RO-HD" : true, + "RO-HR" : true, "RO-IF" : true, "RO-IL" : true, "RO-IS" : true, "RO-MH" : true, + "RO-MM" : true, "RO-MS" : true, "RO-NT" : true, "RO-OT" : true, "RO-PH" : true, + "RO-SB" : true, "RO-SJ" : true, "RO-SM" : true, "RO-SV" : true, "RO-TL" : true, + "RO-TM" : true, "RO-TR" : true, "RO-VL" : true, "RO-VN" : true, "RO-VS" : true, + "RS-00" : true, "RS-01" : true, "RS-02" : true, "RS-03" : true, "RS-04" : true, + "RS-05" : true, "RS-06" : true, "RS-07" : true, "RS-08" : true, "RS-09" : true, + "RS-10" : true, "RS-11" : true, "RS-12" : true, "RS-13" : true, "RS-14" : true, + "RS-15" : true, "RS-16" : true, "RS-17" : true, "RS-18" : true, "RS-19" : true, + "RS-20" : true, "RS-21" : true, "RS-22" : true, "RS-23" : true, "RS-24" : true, + "RS-25" : true, "RS-26" : true, "RS-27" : true, "RS-28" : true, "RS-29" : true, + "RS-KM" : true, "RS-VO" : true, "RU-AD" : true, "RU-AL" : true, "RU-ALT" : true, + "RU-AMU" : true, "RU-ARK" : true, "RU-AST" : true, "RU-BA" : true, "RU-BEL" : true, + "RU-BRY" : true, "RU-BU" : true, "RU-CE" : true, "RU-CHE" : true, "RU-CHU" : true, + "RU-CU" : true, "RU-DA" : true, "RU-IN" : true, "RU-IRK" : true, "RU-IVA" : true, + "RU-KAM" : true, "RU-KB" : true, "RU-KC" : true, "RU-KDA" : true, "RU-KEM" : true, + "RU-KGD" : true, "RU-KGN" : true, "RU-KHA" : true, "RU-KHM" : true, "RU-KIR" : true, + "RU-KK" : true, "RU-KL" : true, "RU-KLU" : true, "RU-KO" : true, "RU-KOS" : true, + "RU-KR" : true, "RU-KRS" : true, "RU-KYA" : true, "RU-LEN" : true, "RU-LIP" : true, + "RU-MAG" : true, "RU-ME" : true, "RU-MO" : true, "RU-MOS" : true, "RU-MOW" : true, + "RU-MUR" : true, "RU-NEN" : true, "RU-NGR" : true, "RU-NIZ" : true, "RU-NVS" : true, + "RU-OMS" : true, "RU-ORE" : true, "RU-ORL" : true, "RU-PER" : true, "RU-PNZ" : true, + "RU-PRI" : true, "RU-PSK" : true, "RU-ROS" : true, "RU-RYA" : true, "RU-SA" : true, + "RU-SAK" : true, "RU-SAM" : true, "RU-SAR" : true, "RU-SE" : true, "RU-SMO" : true, + "RU-SPE" : true, "RU-STA" : true, "RU-SVE" : true, "RU-TA" : true, "RU-TAM" : true, + "RU-TOM" : true, "RU-TUL" : true, "RU-TVE" : true, "RU-TY" : true, "RU-TYU" : true, + "RU-UD" : true, "RU-ULY" : true, "RU-VGG" : true, "RU-VLA" : true, "RU-VLG" : true, + "RU-VOR" : true, "RU-YAN" : true, "RU-YAR" : true, "RU-YEV" : true, "RU-ZAB" : true, + "RW-01" : true, "RW-02" : true, "RW-03" : true, "RW-04" : true, "RW-05" : true, + "SA-01" : true, "SA-02" : true, "SA-03" : true, "SA-04" : true, "SA-05" : true, + "SA-06" : true, "SA-07" : true, "SA-08" : true, "SA-09" : true, "SA-10" : true, + "SA-11" : true, "SA-12" : true, "SA-14" : true, "SB-CE" : true, "SB-CH" : true, + "SB-CT" : true, "SB-GU" : true, "SB-IS" : true, "SB-MK" : true, "SB-ML" : true, + "SB-RB" : true, "SB-TE" : true, "SB-WE" : true, "SC-01" : true, "SC-02" : true, + "SC-03" : true, "SC-04" : true, "SC-05" : true, "SC-06" : true, "SC-07" : true, + "SC-08" : true, "SC-09" : true, "SC-10" : true, "SC-11" : true, "SC-12" : true, + "SC-13" : true, "SC-14" : true, "SC-15" : true, "SC-16" : true, "SC-17" : true, + "SC-18" : true, "SC-19" : true, "SC-20" : true, "SC-21" : true, "SC-22" : true, + "SC-23" : true, "SC-24" : true, "SC-25" : true, "SD-DC" : true, "SD-DE" : true, + "SD-DN" : true, "SD-DS" : true, "SD-DW" : true, "SD-GD" : true, "SD-GZ" : true, + "SD-KA" : true, "SD-KH" : true, "SD-KN" : true, "SD-KS" : true, "SD-NB" : true, + "SD-NO" : true, "SD-NR" : true, "SD-NW" : true, "SD-RS" : true, "SD-SI" : true, + "SE-AB" : true, "SE-AC" : true, "SE-BD" : true, "SE-C" : true, "SE-D" : true, + "SE-E" : true, "SE-F" : true, "SE-G" : true, "SE-H" : true, "SE-I" : true, + "SE-K" : true, "SE-M" : true, "SE-N" : true, "SE-O" : true, "SE-S" : true, + "SE-T" : true, "SE-U" : true, "SE-W" : true, "SE-X" : true, "SE-Y" : true, + "SE-Z" : true, "SG-01" : true, "SG-02" : true, "SG-03" : true, "SG-04" : true, + "SG-05" : true, "SH-AC" : true, "SH-HL" : true, "SH-TA" : true, "SI-001" : true, + "SI-002" : true, "SI-003" : true, "SI-004" : true, "SI-005" : true, "SI-006" : true, + "SI-007" : true, "SI-008" : true, "SI-009" : true, "SI-010" : true, "SI-011" : true, + "SI-012" : true, "SI-013" : true, "SI-014" : true, "SI-015" : true, "SI-016" : true, + "SI-017" : true, "SI-018" : true, "SI-019" : true, "SI-020" : true, "SI-021" : true, + "SI-022" : true, "SI-023" : true, "SI-024" : true, "SI-025" : true, "SI-026" : true, + "SI-027" : true, "SI-028" : true, "SI-029" : true, "SI-030" : true, "SI-031" : true, + "SI-032" : true, "SI-033" : true, "SI-034" : true, "SI-035" : true, "SI-036" : true, + "SI-037" : true, "SI-038" : true, "SI-039" : true, "SI-040" : true, "SI-041" : true, + "SI-042" : true, "SI-043" : true, "SI-044" : true, "SI-045" : true, "SI-046" : true, + "SI-047" : true, "SI-048" : true, "SI-049" : true, "SI-050" : true, "SI-051" : true, + "SI-052" : true, "SI-053" : true, "SI-054" : true, "SI-055" : true, "SI-056" : true, + "SI-057" : true, "SI-058" : true, "SI-059" : true, "SI-060" : true, "SI-061" : true, + "SI-062" : true, "SI-063" : true, "SI-064" : true, "SI-065" : true, "SI-066" : true, + "SI-067" : true, "SI-068" : true, "SI-069" : true, "SI-070" : true, "SI-071" : true, + "SI-072" : true, "SI-073" : true, "SI-074" : true, "SI-075" : true, "SI-076" : true, + "SI-077" : true, "SI-078" : true, "SI-079" : true, "SI-080" : true, "SI-081" : true, + "SI-082" : true, "SI-083" : true, "SI-084" : true, "SI-085" : true, "SI-086" : true, + "SI-087" : true, "SI-088" : true, "SI-089" : true, "SI-090" : true, "SI-091" : true, + "SI-092" : true, "SI-093" : true, "SI-094" : true, "SI-095" : true, "SI-096" : true, + "SI-097" : true, "SI-098" : true, "SI-099" : true, "SI-100" : true, "SI-101" : true, + "SI-102" : true, "SI-103" : true, "SI-104" : true, "SI-105" : true, "SI-106" : true, + "SI-107" : true, "SI-108" : true, "SI-109" : true, "SI-110" : true, "SI-111" : true, + "SI-112" : true, "SI-113" : true, "SI-114" : true, "SI-115" : true, "SI-116" : true, + "SI-117" : true, "SI-118" : true, "SI-119" : true, "SI-120" : true, "SI-121" : true, + "SI-122" : true, "SI-123" : true, "SI-124" : true, "SI-125" : true, "SI-126" : true, + "SI-127" : true, "SI-128" : true, "SI-129" : true, "SI-130" : true, "SI-131" : true, + "SI-132" : true, "SI-133" : true, "SI-134" : true, "SI-135" : true, "SI-136" : true, + "SI-137" : true, "SI-138" : true, "SI-139" : true, "SI-140" : true, "SI-141" : true, + "SI-142" : true, "SI-143" : true, "SI-144" : true, "SI-146" : true, "SI-147" : true, + "SI-148" : true, "SI-149" : true, "SI-150" : true, "SI-151" : true, "SI-152" : true, + "SI-153" : true, "SI-154" : true, "SI-155" : true, "SI-156" : true, "SI-157" : true, + "SI-158" : true, "SI-159" : true, "SI-160" : true, "SI-161" : true, "SI-162" : true, + "SI-163" : true, "SI-164" : true, "SI-165" : true, "SI-166" : true, "SI-167" : true, + "SI-168" : true, "SI-169" : true, "SI-170" : true, "SI-171" : true, "SI-172" : true, + "SI-173" : true, "SI-174" : true, "SI-175" : true, "SI-176" : true, "SI-177" : true, + "SI-178" : true, "SI-179" : true, "SI-180" : true, "SI-181" : true, "SI-182" : true, + "SI-183" : true, "SI-184" : true, "SI-185" : true, "SI-186" : true, "SI-187" : true, + "SI-188" : true, "SI-189" : true, "SI-190" : true, "SI-191" : true, "SI-192" : true, + "SI-193" : true, "SI-194" : true, "SI-195" : true, "SI-196" : true, "SI-197" : true, + "SI-198" : true, "SI-199" : true, "SI-200" : true, "SI-201" : true, "SI-202" : true, + "SI-203" : true, "SI-204" : true, "SI-205" : true, "SI-206" : true, "SI-207" : true, + "SI-208" : true, "SI-209" : true, "SI-210" : true, "SI-211" : true, "SK-BC" : true, + "SK-BL" : true, "SK-KI" : true, "SK-NI" : true, "SK-PV" : true, "SK-TA" : true, + "SK-TC" : true, "SK-ZI" : true, "SL-E" : true, "SL-N" : true, "SL-S" : true, + "SL-W" : true, "SM-01" : true, "SM-02" : true, "SM-03" : true, "SM-04" : true, + "SM-05" : true, "SM-06" : true, "SM-07" : true, "SM-08" : true, "SM-09" : true, + "SN-DB" : true, "SN-DK" : true, "SN-FK" : true, "SN-KA" : true, "SN-KD" : true, + "SN-KE" : true, "SN-KL" : true, "SN-LG" : true, "SN-MT" : true, "SN-SE" : true, + "SN-SL" : true, "SN-TC" : true, "SN-TH" : true, "SN-ZG" : true, "SO-AW" : true, + "SO-BK" : true, "SO-BN" : true, "SO-BR" : true, "SO-BY" : true, "SO-GA" : true, + "SO-GE" : true, "SO-HI" : true, "SO-JD" : true, "SO-JH" : true, "SO-MU" : true, + "SO-NU" : true, "SO-SA" : true, "SO-SD" : true, "SO-SH" : true, "SO-SO" : true, + "SO-TO" : true, "SO-WO" : true, "SR-BR" : true, "SR-CM" : true, "SR-CR" : true, + "SR-MA" : true, "SR-NI" : true, "SR-PM" : true, "SR-PR" : true, "SR-SA" : true, + "SR-SI" : true, "SR-WA" : true, "SS-BN" : true, "SS-BW" : true, "SS-EC" : true, + "SS-EE8" : true, "SS-EW" : true, "SS-JG" : true, "SS-LK" : true, "SS-NU" : true, + "SS-UY" : true, "SS-WR" : true, "ST-P" : true, "ST-S" : true, "SV-AH" : true, + "SV-CA" : true, "SV-CH" : true, "SV-CU" : true, "SV-LI" : true, "SV-MO" : true, + "SV-PA" : true, "SV-SA" : true, "SV-SM" : true, "SV-SO" : true, "SV-SS" : true, + "SV-SV" : true, "SV-UN" : true, "SV-US" : true, "SY-DI" : true, "SY-DR" : true, + "SY-DY" : true, "SY-HA" : true, "SY-HI" : true, "SY-HL" : true, "SY-HM" : true, + "SY-ID" : true, "SY-LA" : true, "SY-QU" : true, "SY-RA" : true, "SY-RD" : true, + "SY-SU" : true, "SY-TA" : true, "SZ-HH" : true, "SZ-LU" : true, "SZ-MA" : true, + "SZ-SH" : true, "TD-BA" : true, "TD-BG" : true, "TD-BO" : true, "TD-CB" : true, + "TD-EN" : true, "TD-GR" : true, "TD-HL" : true, "TD-KA" : true, "TD-LC" : true, + "TD-LO" : true, "TD-LR" : true, "TD-MA" : true, "TD-MC" : true, "TD-ME" : true, + "TD-MO" : true, "TD-ND" : true, "TD-OD" : true, "TD-SA" : true, "TD-SI" : true, + "TD-TA" : true, "TD-TI" : true, "TD-WF" : true, "TG-C" : true, "TG-K" : true, + "TG-M" : true, "TG-P" : true, "TG-S" : true, "TH-10" : true, "TH-11" : true, + "TH-12" : true, "TH-13" : true, "TH-14" : true, "TH-15" : true, "TH-16" : true, + "TH-17" : true, "TH-18" : true, "TH-19" : true, "TH-20" : true, "TH-21" : true, + "TH-22" : true, "TH-23" : true, "TH-24" : true, "TH-25" : true, "TH-26" : true, + "TH-27" : true, "TH-30" : true, "TH-31" : true, "TH-32" : true, "TH-33" : true, + "TH-34" : true, "TH-35" : true, "TH-36" : true, "TH-37" : true, "TH-39" : true, + "TH-40" : true, "TH-41" : true, "TH-42" : true, "TH-43" : true, "TH-44" : true, + "TH-45" : true, "TH-46" : true, "TH-47" : true, "TH-48" : true, "TH-49" : true, + "TH-50" : true, "TH-51" : true, "TH-52" : true, "TH-53" : true, "TH-54" : true, + "TH-55" : true, "TH-56" : true, "TH-57" : true, "TH-58" : true, "TH-60" : true, + "TH-61" : true, "TH-62" : true, "TH-63" : true, "TH-64" : true, "TH-65" : true, + "TH-66" : true, "TH-67" : true, "TH-70" : true, "TH-71" : true, "TH-72" : true, + "TH-73" : true, "TH-74" : true, "TH-75" : true, "TH-76" : true, "TH-77" : true, + "TH-80" : true, "TH-81" : true, "TH-82" : true, "TH-83" : true, "TH-84" : true, + "TH-85" : true, "TH-86" : true, "TH-90" : true, "TH-91" : true, "TH-92" : true, + "TH-93" : true, "TH-94" : true, "TH-95" : true, "TH-96" : true, "TH-S" : true, + "TJ-GB" : true, "TJ-KT" : true, "TJ-SU" : true, "TL-AL" : true, "TL-AN" : true, + "TL-BA" : true, "TL-BO" : true, "TL-CO" : true, "TL-DI" : true, "TL-ER" : true, + "TL-LA" : true, "TL-LI" : true, "TL-MF" : true, "TL-MT" : true, "TL-OE" : true, + "TL-VI" : true, "TM-A" : true, "TM-B" : true, "TM-D" : true, "TM-L" : true, + "TM-M" : true, "TM-S" : true, "TN-11" : true, "TN-12" : true, "TN-13" : true, + "TN-14" : true, "TN-21" : true, "TN-22" : true, "TN-23" : true, "TN-31" : true, + "TN-32" : true, "TN-33" : true, "TN-34" : true, "TN-41" : true, "TN-42" : true, + "TN-43" : true, "TN-51" : true, "TN-52" : true, "TN-53" : true, "TN-61" : true, + "TN-71" : true, "TN-72" : true, "TN-73" : true, "TN-81" : true, "TN-82" : true, + "TN-83" : true, "TO-01" : true, "TO-02" : true, "TO-03" : true, "TO-04" : true, + "TO-05" : true, "TR-01" : true, "TR-02" : true, "TR-03" : true, "TR-04" : true, + "TR-05" : true, "TR-06" : true, "TR-07" : true, "TR-08" : true, "TR-09" : true, + "TR-10" : true, "TR-11" : true, "TR-12" : true, "TR-13" : true, "TR-14" : true, + "TR-15" : true, "TR-16" : true, "TR-17" : true, "TR-18" : true, "TR-19" : true, + "TR-20" : true, "TR-21" : true, "TR-22" : true, "TR-23" : true, "TR-24" : true, + "TR-25" : true, "TR-26" : true, "TR-27" : true, "TR-28" : true, "TR-29" : true, + "TR-30" : true, "TR-31" : true, "TR-32" : true, "TR-33" : true, "TR-34" : true, + "TR-35" : true, "TR-36" : true, "TR-37" : true, "TR-38" : true, "TR-39" : true, + "TR-40" : true, "TR-41" : true, "TR-42" : true, "TR-43" : true, "TR-44" : true, + "TR-45" : true, "TR-46" : true, "TR-47" : true, "TR-48" : true, "TR-49" : true, + "TR-50" : true, "TR-51" : true, "TR-52" : true, "TR-53" : true, "TR-54" : true, + "TR-55" : true, "TR-56" : true, "TR-57" : true, "TR-58" : true, "TR-59" : true, + "TR-60" : true, "TR-61" : true, "TR-62" : true, "TR-63" : true, "TR-64" : true, + "TR-65" : true, "TR-66" : true, "TR-67" : true, "TR-68" : true, "TR-69" : true, + "TR-70" : true, "TR-71" : true, "TR-72" : true, "TR-73" : true, "TR-74" : true, + "TR-75" : true, "TR-76" : true, "TR-77" : true, "TR-78" : true, "TR-79" : true, + "TR-80" : true, "TR-81" : true, "TT-ARI" : true, "TT-CHA" : true, "TT-CTT" : true, + "TT-DMN" : true, "TT-ETO" : true, "TT-PED" : true, "TT-POS" : true, "TT-PRT" : true, + "TT-PTF" : true, "TT-RCM" : true, "TT-SFO" : true, "TT-SGE" : true, "TT-SIP" : true, + "TT-SJL" : true, "TT-TUP" : true, "TT-WTO" : true, "TV-FUN" : true, "TV-NIT" : true, + "TV-NKF" : true, "TV-NKL" : true, "TV-NMA" : true, "TV-NMG" : true, "TV-NUI" : true, + "TV-VAI" : true, "TW-CHA" : true, "TW-CYI" : true, "TW-CYQ" : true, "TW-HSQ" : true, + "TW-HSZ" : true, "TW-HUA" : true, "TW-ILA" : true, "TW-KEE" : true, "TW-KHH" : true, + "TW-KHQ" : true, "TW-MIA" : true, "TW-NAN" : true, "TW-PEN" : true, "TW-PIF" : true, + "TW-TAO" : true, "TW-TNN" : true, "TW-TNQ" : true, "TW-TPE" : true, "TW-TPQ" : true, + "TW-TTT" : true, "TW-TXG" : true, "TW-TXQ" : true, "TW-YUN" : true, "TZ-01" : true, + "TZ-02" : true, "TZ-03" : true, "TZ-04" : true, "TZ-05" : true, "TZ-06" : true, + "TZ-07" : true, "TZ-08" : true, "TZ-09" : true, "TZ-10" : true, "TZ-11" : true, + "TZ-12" : true, "TZ-13" : true, "TZ-14" : true, "TZ-15" : true, "TZ-16" : true, + "TZ-17" : true, "TZ-18" : true, "TZ-19" : true, "TZ-20" : true, "TZ-21" : true, + "TZ-22" : true, "TZ-23" : true, "TZ-24" : true, "TZ-25" : true, "TZ-26" : true, + "UA-05" : true, "UA-07" : true, "UA-09" : true, "UA-12" : true, "UA-14" : true, + "UA-18" : true, "UA-21" : true, "UA-23" : true, "UA-26" : true, "UA-30" : true, + "UA-32" : true, "UA-35" : true, "UA-40" : true, "UA-43" : true, "UA-46" : true, + "UA-48" : true, "UA-51" : true, "UA-53" : true, "UA-56" : true, "UA-59" : true, + "UA-61" : true, "UA-63" : true, "UA-65" : true, "UA-68" : true, "UA-71" : true, + "UA-74" : true, "UA-77" : true, "UG-101" : true, "UG-102" : true, "UG-103" : true, + "UG-104" : true, "UG-105" : true, "UG-106" : true, "UG-107" : true, "UG-108" : true, + "UG-109" : true, "UG-110" : true, "UG-111" : true, "UG-112" : true, "UG-113" : true, + "UG-114" : true, "UG-115" : true, "UG-116" : true, "UG-201" : true, "UG-202" : true, + "UG-203" : true, "UG-204" : true, "UG-205" : true, "UG-206" : true, "UG-207" : true, + "UG-208" : true, "UG-209" : true, "UG-210" : true, "UG-211" : true, "UG-212" : true, + "UG-213" : true, "UG-214" : true, "UG-215" : true, "UG-216" : true, "UG-217" : true, + "UG-218" : true, "UG-219" : true, "UG-220" : true, "UG-221" : true, "UG-222" : true, + "UG-223" : true, "UG-224" : true, "UG-301" : true, "UG-302" : true, "UG-303" : true, + "UG-304" : true, "UG-305" : true, "UG-306" : true, "UG-307" : true, "UG-308" : true, + "UG-309" : true, "UG-310" : true, "UG-311" : true, "UG-312" : true, "UG-313" : true, + "UG-314" : true, "UG-315" : true, "UG-316" : true, "UG-317" : true, "UG-318" : true, + "UG-319" : true, "UG-320" : true, "UG-321" : true, "UG-401" : true, "UG-402" : true, + "UG-403" : true, "UG-404" : true, "UG-405" : true, "UG-406" : true, "UG-407" : true, + "UG-408" : true, "UG-409" : true, "UG-410" : true, "UG-411" : true, "UG-412" : true, + "UG-413" : true, "UG-414" : true, "UG-415" : true, "UG-416" : true, "UG-417" : true, + "UG-418" : true, "UG-419" : true, "UG-C" : true, "UG-E" : true, "UG-N" : true, + "UG-W" : true, "UM-67" : true, "UM-71" : true, "UM-76" : true, "UM-79" : true, + "UM-81" : true, "UM-84" : true, "UM-86" : true, "UM-89" : true, "UM-95" : true, + "US-AK" : true, "US-AL" : true, "US-AR" : true, "US-AS" : true, "US-AZ" : true, + "US-CA" : true, "US-CO" : true, "US-CT" : true, "US-DC" : true, "US-DE" : true, + "US-FL" : true, "US-GA" : true, "US-GU" : true, "US-HI" : true, "US-IA" : true, + "US-ID" : true, "US-IL" : true, "US-IN" : true, "US-KS" : true, "US-KY" : true, + "US-LA" : true, "US-MA" : true, "US-MD" : true, "US-ME" : true, "US-MI" : true, + "US-MN" : true, "US-MO" : true, "US-MP" : true, "US-MS" : true, "US-MT" : true, + "US-NC" : true, "US-ND" : true, "US-NE" : true, "US-NH" : true, "US-NJ" : true, + "US-NM" : true, "US-NV" : true, "US-NY" : true, "US-OH" : true, "US-OK" : true, + "US-OR" : true, "US-PA" : true, "US-PR" : true, "US-RI" : true, "US-SC" : true, + "US-SD" : true, "US-TN" : true, "US-TX" : true, "US-UM" : true, "US-UT" : true, + "US-VA" : true, "US-VI" : true, "US-VT" : true, "US-WA" : true, "US-WI" : true, + "US-WV" : true, "US-WY" : true, "UY-AR" : true, "UY-CA" : true, "UY-CL" : true, + "UY-CO" : true, "UY-DU" : true, "UY-FD" : true, "UY-FS" : true, "UY-LA" : true, + "UY-MA" : true, "UY-MO" : true, "UY-PA" : true, "UY-RN" : true, "UY-RO" : true, + "UY-RV" : true, "UY-SA" : true, "UY-SJ" : true, "UY-SO" : true, "UY-TA" : true, + "UY-TT" : true, "UZ-AN" : true, "UZ-BU" : true, "UZ-FA" : true, "UZ-JI" : true, + "UZ-NG" : true, "UZ-NW" : true, "UZ-QA" : true, "UZ-QR" : true, "UZ-SA" : true, + "UZ-SI" : true, "UZ-SU" : true, "UZ-TK" : true, "UZ-TO" : true, "UZ-XO" : true, + "VC-01" : true, "VC-02" : true, "VC-03" : true, "VC-04" : true, "VC-05" : true, + "VC-06" : true, "VE-A" : true, "VE-B" : true, "VE-C" : true, "VE-D" : true, + "VE-E" : true, "VE-F" : true, "VE-G" : true, "VE-H" : true, "VE-I" : true, + "VE-J" : true, "VE-K" : true, "VE-L" : true, "VE-M" : true, "VE-N" : true, + "VE-O" : true, "VE-P" : true, "VE-R" : true, "VE-S" : true, "VE-T" : true, + "VE-U" : true, "VE-V" : true, "VE-W" : true, "VE-X" : true, "VE-Y" : true, + "VE-Z" : true, "VN-01" : true, "VN-02" : true, "VN-03" : true, "VN-04" : true, + "VN-05" : true, "VN-06" : true, "VN-07" : true, "VN-09" : true, "VN-13" : true, + "VN-14" : true, "VN-15" : true, "VN-18" : true, "VN-20" : true, "VN-21" : true, + "VN-22" : true, "VN-23" : true, "VN-24" : true, "VN-25" : true, "VN-26" : true, + "VN-27" : true, "VN-28" : true, "VN-29" : true, "VN-30" : true, "VN-31" : true, + "VN-32" : true, "VN-33" : true, "VN-34" : true, "VN-35" : true, "VN-36" : true, + "VN-37" : true, "VN-39" : true, "VN-40" : true, "VN-41" : true, "VN-43" : true, + "VN-44" : true, "VN-45" : true, "VN-46" : true, "VN-47" : true, "VN-49" : true, + "VN-50" : true, "VN-51" : true, "VN-52" : true, "VN-53" : true, "VN-54" : true, + "VN-55" : true, "VN-56" : true, "VN-57" : true, "VN-58" : true, "VN-59" : true, + "VN-61" : true, "VN-63" : true, "VN-66" : true, "VN-67" : true, "VN-68" : true, + "VN-69" : true, "VN-70" : true, "VN-71" : true, "VN-72" : true, "VN-73" : true, + "VN-CT" : true, "VN-DN" : true, "VN-HN" : true, "VN-HP" : true, "VN-SG" : true, + "VU-MAP" : true, "VU-PAM" : true, "VU-SAM" : true, "VU-SEE" : true, "VU-TAE" : true, + "VU-TOB" : true, "WS-AA" : true, "WS-AL" : true, "WS-AT" : true, "WS-FA" : true, + "WS-GE" : true, "WS-GI" : true, "WS-PA" : true, "WS-SA" : true, "WS-TU" : true, + "WS-VF" : true, "WS-VS" : true, "YE-AB" : true, "YE-AD" : true, "YE-AM" : true, + "YE-BA" : true, "YE-DA" : true, "YE-DH" : true, "YE-HD" : true, "YE-HJ" : true, + "YE-IB" : true, "YE-JA" : true, "YE-LA" : true, "YE-MA" : true, "YE-MR" : true, + "YE-MU" : true, "YE-MW" : true, "YE-RA" : true, "YE-SD" : true, "YE-SH" : true, + "YE-SN" : true, "YE-TA" : true, "ZA-EC" : true, "ZA-FS" : true, "ZA-GP" : true, + "ZA-LP" : true, "ZA-MP" : true, "ZA-NC" : true, "ZA-NW" : true, "ZA-WC" : true, + "ZA-ZN" : true, "ZM-01" : true, "ZM-02" : true, "ZM-03" : true, "ZM-04" : true, + "ZM-05" : true, "ZM-06" : true, "ZM-07" : true, "ZM-08" : true, "ZM-09" : true, + "ZW-BU" : true, "ZW-HA" : true, "ZW-MA" : true, "ZW-MC" : true, "ZW-ME" : true, + "ZW-MI" : true, "ZW-MN" : true, "ZW-MS" : true, "ZW-MV" : true, "ZW-MW" : true, +} diff --git a/vendor/github.com/go-playground/validator/v10/currency_codes.go b/vendor/github.com/go-playground/validator/v10/currency_codes.go new file mode 100644 index 0000000000..a5cd9b18a0 --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/currency_codes.go @@ -0,0 +1,79 @@ +package validator + +var iso4217 = map[string]bool{ + "AFN": true, "EUR": true, "ALL": true, "DZD": true, "USD": true, + "AOA": true, "XCD": true, "ARS": true, "AMD": true, "AWG": true, + "AUD": true, "AZN": true, "BSD": true, "BHD": true, "BDT": true, + "BBD": true, "BYN": true, "BZD": true, "XOF": true, "BMD": true, + "INR": true, "BTN": true, "BOB": true, "BOV": true, "BAM": true, + "BWP": true, "NOK": true, "BRL": true, "BND": true, "BGN": true, + "BIF": true, "CVE": true, "KHR": true, "XAF": true, "CAD": true, + "KYD": true, "CLP": true, "CLF": true, "CNY": true, "COP": true, + "COU": true, "KMF": true, "CDF": true, "NZD": true, "CRC": true, + "HRK": true, "CUP": true, "CUC": true, "ANG": true, "CZK": true, + "DKK": true, "DJF": true, "DOP": true, "EGP": true, "SVC": true, + "ERN": true, "SZL": true, "ETB": true, "FKP": true, "FJD": true, + "XPF": true, "GMD": true, "GEL": true, "GHS": true, "GIP": true, + "GTQ": true, "GBP": true, "GNF": true, "GYD": true, "HTG": true, + "HNL": true, "HKD": true, "HUF": true, "ISK": true, "IDR": true, + "XDR": true, "IRR": true, "IQD": true, "ILS": true, "JMD": true, + "JPY": true, "JOD": true, "KZT": true, "KES": true, "KPW": true, + "KRW": true, "KWD": true, "KGS": true, "LAK": true, "LBP": true, + "LSL": true, "ZAR": true, "LRD": true, "LYD": true, "CHF": true, + "MOP": true, "MKD": true, "MGA": true, "MWK": true, "MYR": true, + "MVR": true, "MRU": true, "MUR": true, "XUA": true, "MXN": true, + "MXV": true, "MDL": true, "MNT": true, "MAD": true, "MZN": true, + "MMK": true, "NAD": true, "NPR": true, "NIO": true, "NGN": true, + "OMR": true, "PKR": true, "PAB": true, "PGK": true, "PYG": true, + "PEN": true, "PHP": true, "PLN": true, "QAR": true, "RON": true, + "RUB": true, "RWF": true, "SHP": true, "WST": true, "STN": true, + "SAR": true, "RSD": true, "SCR": true, "SLL": true, "SGD": true, + "XSU": true, "SBD": true, "SOS": true, "SSP": true, "LKR": true, + "SDG": true, "SRD": true, "SEK": true, "CHE": true, "CHW": true, + "SYP": true, "TWD": true, "TJS": true, "TZS": true, "THB": true, + "TOP": true, "TTD": true, "TND": true, "TRY": true, "TMT": true, + "UGX": true, "UAH": true, "AED": true, "USN": true, "UYU": true, + "UYI": true, "UYW": true, "UZS": true, "VUV": true, "VES": true, + "VND": true, "YER": true, "ZMW": true, "ZWL": true, "XBA": true, + "XBB": true, "XBC": true, "XBD": true, "XTS": true, "XXX": true, + "XAU": true, "XPD": true, "XPT": true, "XAG": true, +} + +var iso4217_numeric = map[int]bool{ + 8: true, 12: true, 32: true, 36: true, 44: true, + 48: true, 50: true, 51: true, 52: true, 60: true, + 64: true, 68: true, 72: true, 84: true, 90: true, + 96: true, 104: true, 108: true, 116: true, 124: true, + 132: true, 136: true, 144: true, 152: true, 156: true, + 170: true, 174: true, 188: true, 191: true, 192: true, + 203: true, 208: true, 214: true, 222: true, 230: true, + 232: true, 238: true, 242: true, 262: true, 270: true, + 292: true, 320: true, 324: true, 328: true, 332: true, + 340: true, 344: true, 348: true, 352: true, 356: true, + 360: true, 364: true, 368: true, 376: true, 388: true, + 392: true, 398: true, 400: true, 404: true, 408: true, + 410: true, 414: true, 417: true, 418: true, 422: true, + 426: true, 430: true, 434: true, 446: true, 454: true, + 458: true, 462: true, 480: true, 484: true, 496: true, + 498: true, 504: true, 512: true, 516: true, 524: true, + 532: true, 533: true, 548: true, 554: true, 558: true, + 566: true, 578: true, 586: true, 590: true, 598: true, + 600: true, 604: true, 608: true, 634: true, 643: true, + 646: true, 654: true, 682: true, 690: true, 694: true, + 702: true, 704: true, 706: true, 710: true, 728: true, + 748: true, 752: true, 756: true, 760: true, 764: true, + 776: true, 780: true, 784: true, 788: true, 800: true, + 807: true, 818: true, 826: true, 834: true, 840: true, + 858: true, 860: true, 882: true, 886: true, 901: true, + 927: true, 928: true, 929: true, 930: true, 931: true, + 932: true, 933: true, 934: true, 936: true, 938: true, + 940: true, 941: true, 943: true, 944: true, 946: true, + 947: true, 948: true, 949: true, 950: true, 951: true, + 952: true, 953: true, 955: true, 956: true, 957: true, + 958: true, 959: true, 960: true, 961: true, 962: true, + 963: true, 964: true, 965: true, 967: true, 968: true, + 969: true, 970: true, 971: true, 972: true, 973: true, + 975: true, 976: true, 977: true, 978: true, 979: true, + 980: true, 981: true, 984: true, 985: true, 986: true, + 990: true, 994: true, 997: true, 999: true, +} diff --git a/vendor/github.com/go-playground/validator/v10/doc.go b/vendor/github.com/go-playground/validator/v10/doc.go new file mode 100644 index 0000000000..7341c67d74 --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/doc.go @@ -0,0 +1,1401 @@ +/* +Package validator implements value validations for structs and individual fields +based on tags. + +It can also handle Cross-Field and Cross-Struct validation for nested structs +and has the ability to dive into arrays and maps of any type. + +see more examples https://github.com/go-playground/validator/tree/master/_examples + +Singleton + +Validator is designed to be thread-safe and used as a singleton instance. +It caches information about your struct and validations, +in essence only parsing your validation tags once per struct type. +Using multiple instances neglects the benefit of caching. +The not thread-safe functions are explicitly marked as such in the documentation. + +Validation Functions Return Type error + +Doing things this way is actually the way the standard library does, see the +file.Open method here: + + https://golang.org/pkg/os/#Open. + +The authors return type "error" to avoid the issue discussed in the following, +where err is always != nil: + + http://stackoverflow.com/a/29138676/3158232 + https://github.com/go-playground/validator/issues/134 + +Validator only InvalidValidationError for bad validation input, nil or +ValidationErrors as type error; so, in your code all you need to do is check +if the error returned is not nil, and if it's not check if error is +InvalidValidationError ( if necessary, most of the time it isn't ) type cast +it to type ValidationErrors like so err.(validator.ValidationErrors). + +Custom Validation Functions + +Custom Validation functions can be added. Example: + + // Structure + func customFunc(fl validator.FieldLevel) bool { + + if fl.Field().String() == "invalid" { + return false + } + + return true + } + + validate.RegisterValidation("custom tag name", customFunc) + // NOTES: using the same tag name as an existing function + // will overwrite the existing one + +Cross-Field Validation + +Cross-Field Validation can be done via the following tags: + - eqfield + - nefield + - gtfield + - gtefield + - ltfield + - ltefield + - eqcsfield + - necsfield + - gtcsfield + - gtecsfield + - ltcsfield + - ltecsfield + +If, however, some custom cross-field validation is required, it can be done +using a custom validation. + +Why not just have cross-fields validation tags (i.e. only eqcsfield and not +eqfield)? + +The reason is efficiency. If you want to check a field within the same struct +"eqfield" only has to find the field on the same struct (1 level). But, if we +used "eqcsfield" it could be multiple levels down. Example: + + type Inner struct { + StartDate time.Time + } + + type Outer struct { + InnerStructField *Inner + CreatedAt time.Time `validate:"ltecsfield=InnerStructField.StartDate"` + } + + now := time.Now() + + inner := &Inner{ + StartDate: now, + } + + outer := &Outer{ + InnerStructField: inner, + CreatedAt: now, + } + + errs := validate.Struct(outer) + + // NOTE: when calling validate.Struct(val) topStruct will be the top level struct passed + // into the function + // when calling validate.VarWithValue(val, field, tag) val will be + // whatever you pass, struct, field... + // when calling validate.Field(field, tag) val will be nil + +Multiple Validators + +Multiple validators on a field will process in the order defined. Example: + + type Test struct { + Field `validate:"max=10,min=1"` + } + + // max will be checked then min + +Bad Validator definitions are not handled by the library. Example: + + type Test struct { + Field `validate:"min=10,max=0"` + } + + // this definition of min max will never succeed + +Using Validator Tags + +Baked In Cross-Field validation only compares fields on the same struct. +If Cross-Field + Cross-Struct validation is needed you should implement your +own custom validator. + +Comma (",") is the default separator of validation tags. If you wish to +have a comma included within the parameter (i.e. excludesall=,) you will need to +use the UTF-8 hex representation 0x2C, which is replaced in the code as a comma, +so the above will become excludesall=0x2C. + + type Test struct { + Field `validate:"excludesall=,"` // BAD! Do not include a comma. + Field `validate:"excludesall=0x2C"` // GOOD! Use the UTF-8 hex representation. + } + +Pipe ("|") is the 'or' validation tags deparator. If you wish to +have a pipe included within the parameter i.e. excludesall=| you will need to +use the UTF-8 hex representation 0x7C, which is replaced in the code as a pipe, +so the above will become excludesall=0x7C + + type Test struct { + Field `validate:"excludesall=|"` // BAD! Do not include a a pipe! + Field `validate:"excludesall=0x7C"` // GOOD! Use the UTF-8 hex representation. + } + + +Baked In Validators and Tags + +Here is a list of the current built in validators: + + +Skip Field + +Tells the validation to skip this struct field; this is particularly +handy in ignoring embedded structs from being validated. (Usage: -) + Usage: - + + +Or Operator + +This is the 'or' operator allowing multiple validators to be used and +accepted. (Usage: rgb|rgba) <-- this would allow either rgb or rgba +colors to be accepted. This can also be combined with 'and' for example +( Usage: omitempty,rgb|rgba) + + Usage: | + +StructOnly + +When a field that is a nested struct is encountered, and contains this flag +any validation on the nested struct will be run, but none of the nested +struct fields will be validated. This is useful if inside of your program +you know the struct will be valid, but need to verify it has been assigned. +NOTE: only "required" and "omitempty" can be used on a struct itself. + + Usage: structonly + +NoStructLevel + +Same as structonly tag except that any struct level validations will not run. + + Usage: nostructlevel + +Omit Empty + +Allows conditional validation, for example if a field is not set with +a value (Determined by the "required" validator) then other validation +such as min or max won't run, but if a value is set validation will run. + + Usage: omitempty + +Dive + +This tells the validator to dive into a slice, array or map and validate that +level of the slice, array or map with the validation tags that follow. +Multidimensional nesting is also supported, each level you wish to dive will +require another dive tag. dive has some sub-tags, 'keys' & 'endkeys', please see +the Keys & EndKeys section just below. + + Usage: dive + +Example #1 + + [][]string with validation tag "gt=0,dive,len=1,dive,required" + // gt=0 will be applied to [] + // len=1 will be applied to []string + // required will be applied to string + +Example #2 + + [][]string with validation tag "gt=0,dive,dive,required" + // gt=0 will be applied to [] + // []string will be spared validation + // required will be applied to string + +Keys & EndKeys + +These are to be used together directly after the dive tag and tells the validator +that anything between 'keys' and 'endkeys' applies to the keys of a map and not the +values; think of it like the 'dive' tag, but for map keys instead of values. +Multidimensional nesting is also supported, each level you wish to validate will +require another 'keys' and 'endkeys' tag. These tags are only valid for maps. + + Usage: dive,keys,othertagvalidation(s),endkeys,valuevalidationtags + +Example #1 + + map[string]string with validation tag "gt=0,dive,keys,eg=1|eq=2,endkeys,required" + // gt=0 will be applied to the map itself + // eg=1|eq=2 will be applied to the map keys + // required will be applied to map values + +Example #2 + + map[[2]string]string with validation tag "gt=0,dive,keys,dive,eq=1|eq=2,endkeys,required" + // gt=0 will be applied to the map itself + // eg=1|eq=2 will be applied to each array element in the the map keys + // required will be applied to map values + +Required + +This validates that the value is not the data types default zero value. +For numbers ensures value is not zero. For strings ensures value is +not "". For slices, maps, pointers, interfaces, channels and functions +ensures the value is not nil. + + Usage: required + +Required If + +The field under validation must be present and not empty only if all +the other specified fields are equal to the value following the specified +field. For strings ensures value is not "". For slices, maps, pointers, +interfaces, channels and functions ensures the value is not nil. + + Usage: required_if + +Examples: + + // require the field if the Field1 is equal to the parameter given: + Usage: required_if=Field1 foobar + + // require the field if the Field1 and Field2 is equal to the value respectively: + Usage: required_if=Field1 foo Field2 bar + +Required Unless + +The field under validation must be present and not empty unless all +the other specified fields are equal to the value following the specified +field. For strings ensures value is not "". For slices, maps, pointers, +interfaces, channels and functions ensures the value is not nil. + + Usage: required_unless + +Examples: + + // require the field unless the Field1 is equal to the parameter given: + Usage: required_unless=Field1 foobar + + // require the field unless the Field1 and Field2 is equal to the value respectively: + Usage: required_unless=Field1 foo Field2 bar + +Required With + +The field under validation must be present and not empty only if any +of the other specified fields are present. For strings ensures value is +not "". For slices, maps, pointers, interfaces, channels and functions +ensures the value is not nil. + + Usage: required_with + +Examples: + + // require the field if the Field1 is present: + Usage: required_with=Field1 + + // require the field if the Field1 or Field2 is present: + Usage: required_with=Field1 Field2 + +Required With All + +The field under validation must be present and not empty only if all +of the other specified fields are present. For strings ensures value is +not "". For slices, maps, pointers, interfaces, channels and functions +ensures the value is not nil. + + Usage: required_with_all + +Example: + + // require the field if the Field1 and Field2 is present: + Usage: required_with_all=Field1 Field2 + +Required Without + +The field under validation must be present and not empty only when any +of the other specified fields are not present. For strings ensures value is +not "". For slices, maps, pointers, interfaces, channels and functions +ensures the value is not nil. + + Usage: required_without + +Examples: + + // require the field if the Field1 is not present: + Usage: required_without=Field1 + + // require the field if the Field1 or Field2 is not present: + Usage: required_without=Field1 Field2 + +Required Without All + +The field under validation must be present and not empty only when all +of the other specified fields are not present. For strings ensures value is +not "". For slices, maps, pointers, interfaces, channels and functions +ensures the value is not nil. + + Usage: required_without_all + +Example: + + // require the field if the Field1 and Field2 is not present: + Usage: required_without_all=Field1 Field2 + +Excluded If + +The field under validation must not be present or not empty only if all +the other specified fields are equal to the value following the specified +field. For strings ensures value is not "". For slices, maps, pointers, +interfaces, channels and functions ensures the value is not nil. + + Usage: excluded_if + +Examples: + + // exclude the field if the Field1 is equal to the parameter given: + Usage: excluded_if=Field1 foobar + + // exclude the field if the Field1 and Field2 is equal to the value respectively: + Usage: excluded_if=Field1 foo Field2 bar + +Excluded Unless + +The field under validation must not be present or empty unless all +the other specified fields are equal to the value following the specified +field. For strings ensures value is not "". For slices, maps, pointers, +interfaces, channels and functions ensures the value is not nil. + + Usage: excluded_unless + +Examples: + + // exclude the field unless the Field1 is equal to the parameter given: + Usage: excluded_unless=Field1 foobar + + // exclude the field unless the Field1 and Field2 is equal to the value respectively: + Usage: excluded_unless=Field1 foo Field2 bar + +Is Default + +This validates that the value is the default value and is almost the +opposite of required. + + Usage: isdefault + +Length + +For numbers, length will ensure that the value is +equal to the parameter given. For strings, it checks that +the string length is exactly that number of characters. For slices, +arrays, and maps, validates the number of items. + +Example #1 + + Usage: len=10 + +Example #2 (time.Duration) + +For time.Duration, len will ensure that the value is equal to the duration given +in the parameter. + + Usage: len=1h30m + +Maximum + +For numbers, max will ensure that the value is +less than or equal to the parameter given. For strings, it checks +that the string length is at most that number of characters. For +slices, arrays, and maps, validates the number of items. + +Example #1 + + Usage: max=10 + +Example #2 (time.Duration) + +For time.Duration, max will ensure that the value is less than or equal to the +duration given in the parameter. + + Usage: max=1h30m + +Minimum + +For numbers, min will ensure that the value is +greater or equal to the parameter given. For strings, it checks that +the string length is at least that number of characters. For slices, +arrays, and maps, validates the number of items. + +Example #1 + + Usage: min=10 + +Example #2 (time.Duration) + +For time.Duration, min will ensure that the value is greater than or equal to +the duration given in the parameter. + + Usage: min=1h30m + +Equals + +For strings & numbers, eq will ensure that the value is +equal to the parameter given. For slices, arrays, and maps, +validates the number of items. + +Example #1 + + Usage: eq=10 + +Example #2 (time.Duration) + +For time.Duration, eq will ensure that the value is equal to the duration given +in the parameter. + + Usage: eq=1h30m + +Not Equal + +For strings & numbers, ne will ensure that the value is not +equal to the parameter given. For slices, arrays, and maps, +validates the number of items. + +Example #1 + + Usage: ne=10 + +Example #2 (time.Duration) + +For time.Duration, ne will ensure that the value is not equal to the duration +given in the parameter. + + Usage: ne=1h30m + +One Of + +For strings, ints, and uints, oneof will ensure that the value +is one of the values in the parameter. The parameter should be +a list of values separated by whitespace. Values may be +strings or numbers. To match strings with spaces in them, include +the target string between single quotes. + + Usage: oneof=red green + oneof='red green' 'blue yellow' + oneof=5 7 9 + +Greater Than + +For numbers, this will ensure that the value is greater than the +parameter given. For strings, it checks that the string length +is greater than that number of characters. For slices, arrays +and maps it validates the number of items. + +Example #1 + + Usage: gt=10 + +Example #2 (time.Time) + +For time.Time ensures the time value is greater than time.Now.UTC(). + + Usage: gt + +Example #3 (time.Duration) + +For time.Duration, gt will ensure that the value is greater than the duration +given in the parameter. + + Usage: gt=1h30m + +Greater Than or Equal + +Same as 'min' above. Kept both to make terminology with 'len' easier. + +Example #1 + + Usage: gte=10 + +Example #2 (time.Time) + +For time.Time ensures the time value is greater than or equal to time.Now.UTC(). + + Usage: gte + +Example #3 (time.Duration) + +For time.Duration, gte will ensure that the value is greater than or equal to +the duration given in the parameter. + + Usage: gte=1h30m + +Less Than + +For numbers, this will ensure that the value is less than the parameter given. +For strings, it checks that the string length is less than that number of +characters. For slices, arrays, and maps it validates the number of items. + +Example #1 + + Usage: lt=10 + +Example #2 (time.Time) + +For time.Time ensures the time value is less than time.Now.UTC(). + + Usage: lt + +Example #3 (time.Duration) + +For time.Duration, lt will ensure that the value is less than the duration given +in the parameter. + + Usage: lt=1h30m + +Less Than or Equal + +Same as 'max' above. Kept both to make terminology with 'len' easier. + +Example #1 + + Usage: lte=10 + +Example #2 (time.Time) + +For time.Time ensures the time value is less than or equal to time.Now.UTC(). + + Usage: lte + +Example #3 (time.Duration) + +For time.Duration, lte will ensure that the value is less than or equal to the +duration given in the parameter. + + Usage: lte=1h30m + +Field Equals Another Field + +This will validate the field value against another fields value either within +a struct or passed in field. + +Example #1: + + // Validation on Password field using: + Usage: eqfield=ConfirmPassword + +Example #2: + + // Validating by field: + validate.VarWithValue(password, confirmpassword, "eqfield") + +Field Equals Another Field (relative) + +This does the same as eqfield except that it validates the field provided relative +to the top level struct. + + Usage: eqcsfield=InnerStructField.Field) + +Field Does Not Equal Another Field + +This will validate the field value against another fields value either within +a struct or passed in field. + +Examples: + + // Confirm two colors are not the same: + // + // Validation on Color field: + Usage: nefield=Color2 + + // Validating by field: + validate.VarWithValue(color1, color2, "nefield") + +Field Does Not Equal Another Field (relative) + +This does the same as nefield except that it validates the field provided +relative to the top level struct. + + Usage: necsfield=InnerStructField.Field + +Field Greater Than Another Field + +Only valid for Numbers, time.Duration and time.Time types, this will validate +the field value against another fields value either within a struct or passed in +field. usage examples are for validation of a Start and End date: + +Example #1: + + // Validation on End field using: + validate.Struct Usage(gtfield=Start) + +Example #2: + + // Validating by field: + validate.VarWithValue(start, end, "gtfield") + +Field Greater Than Another Relative Field + +This does the same as gtfield except that it validates the field provided +relative to the top level struct. + + Usage: gtcsfield=InnerStructField.Field + +Field Greater Than or Equal To Another Field + +Only valid for Numbers, time.Duration and time.Time types, this will validate +the field value against another fields value either within a struct or passed in +field. usage examples are for validation of a Start and End date: + +Example #1: + + // Validation on End field using: + validate.Struct Usage(gtefield=Start) + +Example #2: + + // Validating by field: + validate.VarWithValue(start, end, "gtefield") + +Field Greater Than or Equal To Another Relative Field + +This does the same as gtefield except that it validates the field provided relative +to the top level struct. + + Usage: gtecsfield=InnerStructField.Field + +Less Than Another Field + +Only valid for Numbers, time.Duration and time.Time types, this will validate +the field value against another fields value either within a struct or passed in +field. usage examples are for validation of a Start and End date: + +Example #1: + + // Validation on End field using: + validate.Struct Usage(ltfield=Start) + +Example #2: + + // Validating by field: + validate.VarWithValue(start, end, "ltfield") + +Less Than Another Relative Field + +This does the same as ltfield except that it validates the field provided relative +to the top level struct. + + Usage: ltcsfield=InnerStructField.Field + +Less Than or Equal To Another Field + +Only valid for Numbers, time.Duration and time.Time types, this will validate +the field value against another fields value either within a struct or passed in +field. usage examples are for validation of a Start and End date: + +Example #1: + + // Validation on End field using: + validate.Struct Usage(ltefield=Start) + +Example #2: + + // Validating by field: + validate.VarWithValue(start, end, "ltefield") + +Less Than or Equal To Another Relative Field + +This does the same as ltefield except that it validates the field provided relative +to the top level struct. + + Usage: ltecsfield=InnerStructField.Field + +Field Contains Another Field + +This does the same as contains except for struct fields. It should only be used +with string types. See the behavior of reflect.Value.String() for behavior on +other types. + + Usage: containsfield=InnerStructField.Field + +Field Excludes Another Field + +This does the same as excludes except for struct fields. It should only be used +with string types. See the behavior of reflect.Value.String() for behavior on +other types. + + Usage: excludesfield=InnerStructField.Field + +Unique + +For arrays & slices, unique will ensure that there are no duplicates. +For maps, unique will ensure that there are no duplicate values. +For slices of struct, unique will ensure that there are no duplicate values +in a field of the struct specified via a parameter. + + // For arrays, slices, and maps: + Usage: unique + + // For slices of struct: + Usage: unique=field + +Alpha Only + +This validates that a string value contains ASCII alpha characters only + + Usage: alpha + +Alphanumeric + +This validates that a string value contains ASCII alphanumeric characters only + + Usage: alphanum + +Alpha Unicode + +This validates that a string value contains unicode alpha characters only + + Usage: alphaunicode + +Alphanumeric Unicode + +This validates that a string value contains unicode alphanumeric characters only + + Usage: alphanumunicode + +Boolean + +This validates that a string value can successfully be parsed into a boolean with strconv.ParseBool + + Usage: boolean + +Number + +This validates that a string value contains number values only. +For integers or float it returns true. + + Usage: number + +Numeric + +This validates that a string value contains a basic numeric value. +basic excludes exponents etc... +for integers or float it returns true. + + Usage: numeric + +Hexadecimal String + +This validates that a string value contains a valid hexadecimal. + + Usage: hexadecimal + +Hexcolor String + +This validates that a string value contains a valid hex color including +hashtag (#) + + Usage: hexcolor + +Lowercase String + +This validates that a string value contains only lowercase characters. An empty string is not a valid lowercase string. + + Usage: lowercase + +Uppercase String + +This validates that a string value contains only uppercase characters. An empty string is not a valid uppercase string. + + Usage: uppercase + +RGB String + +This validates that a string value contains a valid rgb color + + Usage: rgb + +RGBA String + +This validates that a string value contains a valid rgba color + + Usage: rgba + +HSL String + +This validates that a string value contains a valid hsl color + + Usage: hsl + +HSLA String + +This validates that a string value contains a valid hsla color + + Usage: hsla + +E.164 Phone Number String + +This validates that a string value contains a valid E.164 Phone number +https://en.wikipedia.org/wiki/E.164 (ex. +1123456789) + + Usage: e164 + +E-mail String + +This validates that a string value contains a valid email +This may not conform to all possibilities of any rfc standard, but neither +does any email provider accept all possibilities. + + Usage: email + +JSON String + +This validates that a string value is valid JSON + + Usage: json + +JWT String + +This validates that a string value is a valid JWT + + Usage: jwt + +File path + +This validates that a string value contains a valid file path and that +the file exists on the machine. +This is done using os.Stat, which is a platform independent function. + + Usage: file + +URL String + +This validates that a string value contains a valid url +This will accept any url the golang request uri accepts but must contain +a schema for example http:// or rtmp:// + + Usage: url + +URI String + +This validates that a string value contains a valid uri +This will accept any uri the golang request uri accepts + + Usage: uri + +Urn RFC 2141 String + +This validataes that a string value contains a valid URN +according to the RFC 2141 spec. + + Usage: urn_rfc2141 + +Base64 String + +This validates that a string value contains a valid base64 value. +Although an empty string is valid base64 this will report an empty string +as an error, if you wish to accept an empty string as valid you can use +this with the omitempty tag. + + Usage: base64 + +Base64URL String + +This validates that a string value contains a valid base64 URL safe value +according the the RFC4648 spec. +Although an empty string is a valid base64 URL safe value, this will report +an empty string as an error, if you wish to accept an empty string as valid +you can use this with the omitempty tag. + + Usage: base64url + +Bitcoin Address + +This validates that a string value contains a valid bitcoin address. +The format of the string is checked to ensure it matches one of the three formats +P2PKH, P2SH and performs checksum validation. + + Usage: btc_addr + +Bitcoin Bech32 Address (segwit) + +This validates that a string value contains a valid bitcoin Bech32 address as defined +by bip-0173 (https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki) +Special thanks to Pieter Wuille for providng reference implementations. + + Usage: btc_addr_bech32 + +Ethereum Address + +This validates that a string value contains a valid ethereum address. +The format of the string is checked to ensure it matches the standard Ethereum address format. + + Usage: eth_addr + +Contains + +This validates that a string value contains the substring value. + + Usage: contains=@ + +Contains Any + +This validates that a string value contains any Unicode code points +in the substring value. + + Usage: containsany=!@#? + +Contains Rune + +This validates that a string value contains the supplied rune value. + + Usage: containsrune=@ + +Excludes + +This validates that a string value does not contain the substring value. + + Usage: excludes=@ + +Excludes All + +This validates that a string value does not contain any Unicode code +points in the substring value. + + Usage: excludesall=!@#? + +Excludes Rune + +This validates that a string value does not contain the supplied rune value. + + Usage: excludesrune=@ + +Starts With + +This validates that a string value starts with the supplied string value + + Usage: startswith=hello + +Ends With + +This validates that a string value ends with the supplied string value + + Usage: endswith=goodbye + +Does Not Start With + +This validates that a string value does not start with the supplied string value + + Usage: startsnotwith=hello + +Does Not End With + +This validates that a string value does not end with the supplied string value + + Usage: endsnotwith=goodbye + +International Standard Book Number + +This validates that a string value contains a valid isbn10 or isbn13 value. + + Usage: isbn + +International Standard Book Number 10 + +This validates that a string value contains a valid isbn10 value. + + Usage: isbn10 + +International Standard Book Number 13 + +This validates that a string value contains a valid isbn13 value. + + Usage: isbn13 + +Universally Unique Identifier UUID + +This validates that a string value contains a valid UUID. Uppercase UUID values will not pass - use `uuid_rfc4122` instead. + + Usage: uuid + +Universally Unique Identifier UUID v3 + +This validates that a string value contains a valid version 3 UUID. Uppercase UUID values will not pass - use `uuid3_rfc4122` instead. + + Usage: uuid3 + +Universally Unique Identifier UUID v4 + +This validates that a string value contains a valid version 4 UUID. Uppercase UUID values will not pass - use `uuid4_rfc4122` instead. + + Usage: uuid4 + +Universally Unique Identifier UUID v5 + +This validates that a string value contains a valid version 5 UUID. Uppercase UUID values will not pass - use `uuid5_rfc4122` instead. + + Usage: uuid5 + +Universally Unique Lexicographically Sortable Identifier ULID + +This validates that a string value contains a valid ULID value. + + Usage: ulid + +ASCII + +This validates that a string value contains only ASCII characters. +NOTE: if the string is blank, this validates as true. + + Usage: ascii + +Printable ASCII + +This validates that a string value contains only printable ASCII characters. +NOTE: if the string is blank, this validates as true. + + Usage: printascii + +Multi-Byte Characters + +This validates that a string value contains one or more multibyte characters. +NOTE: if the string is blank, this validates as true. + + Usage: multibyte + +Data URL + +This validates that a string value contains a valid DataURI. +NOTE: this will also validate that the data portion is valid base64 + + Usage: datauri + +Latitude + +This validates that a string value contains a valid latitude. + + Usage: latitude + +Longitude + +This validates that a string value contains a valid longitude. + + Usage: longitude + +Social Security Number SSN + +This validates that a string value contains a valid U.S. Social Security Number. + + Usage: ssn + +Internet Protocol Address IP + +This validates that a string value contains a valid IP Address. + + Usage: ip + +Internet Protocol Address IPv4 + +This validates that a string value contains a valid v4 IP Address. + + Usage: ipv4 + +Internet Protocol Address IPv6 + +This validates that a string value contains a valid v6 IP Address. + + Usage: ipv6 + +Classless Inter-Domain Routing CIDR + +This validates that a string value contains a valid CIDR Address. + + Usage: cidr + +Classless Inter-Domain Routing CIDRv4 + +This validates that a string value contains a valid v4 CIDR Address. + + Usage: cidrv4 + +Classless Inter-Domain Routing CIDRv6 + +This validates that a string value contains a valid v6 CIDR Address. + + Usage: cidrv6 + +Transmission Control Protocol Address TCP + +This validates that a string value contains a valid resolvable TCP Address. + + Usage: tcp_addr + +Transmission Control Protocol Address TCPv4 + +This validates that a string value contains a valid resolvable v4 TCP Address. + + Usage: tcp4_addr + +Transmission Control Protocol Address TCPv6 + +This validates that a string value contains a valid resolvable v6 TCP Address. + + Usage: tcp6_addr + +User Datagram Protocol Address UDP + +This validates that a string value contains a valid resolvable UDP Address. + + Usage: udp_addr + +User Datagram Protocol Address UDPv4 + +This validates that a string value contains a valid resolvable v4 UDP Address. + + Usage: udp4_addr + +User Datagram Protocol Address UDPv6 + +This validates that a string value contains a valid resolvable v6 UDP Address. + + Usage: udp6_addr + +Internet Protocol Address IP + +This validates that a string value contains a valid resolvable IP Address. + + Usage: ip_addr + +Internet Protocol Address IPv4 + +This validates that a string value contains a valid resolvable v4 IP Address. + + Usage: ip4_addr + +Internet Protocol Address IPv6 + +This validates that a string value contains a valid resolvable v6 IP Address. + + Usage: ip6_addr + +Unix domain socket end point Address + +This validates that a string value contains a valid Unix Address. + + Usage: unix_addr + +Media Access Control Address MAC + +This validates that a string value contains a valid MAC Address. + + Usage: mac + +Note: See Go's ParseMAC for accepted formats and types: + + http://golang.org/src/net/mac.go?s=866:918#L29 + +Hostname RFC 952 + +This validates that a string value is a valid Hostname according to RFC 952 https://tools.ietf.org/html/rfc952 + + Usage: hostname + +Hostname RFC 1123 + +This validates that a string value is a valid Hostname according to RFC 1123 https://tools.ietf.org/html/rfc1123 + + Usage: hostname_rfc1123 or if you want to continue to use 'hostname' in your tags, create an alias. + +Full Qualified Domain Name (FQDN) + +This validates that a string value contains a valid FQDN. + + Usage: fqdn + +HTML Tags + +This validates that a string value appears to be an HTML element tag +including those described at https://developer.mozilla.org/en-US/docs/Web/HTML/Element + + Usage: html + +HTML Encoded + +This validates that a string value is a proper character reference in decimal +or hexadecimal format + + Usage: html_encoded + +URL Encoded + +This validates that a string value is percent-encoded (URL encoded) according +to https://tools.ietf.org/html/rfc3986#section-2.1 + + Usage: url_encoded + +Directory + +This validates that a string value contains a valid directory and that +it exists on the machine. +This is done using os.Stat, which is a platform independent function. + + Usage: dir + +HostPort + +This validates that a string value contains a valid DNS hostname and port that +can be used to valiate fields typically passed to sockets and connections. + + Usage: hostname_port + +Datetime + +This validates that a string value is a valid datetime based on the supplied datetime format. +Supplied format must match the official Go time format layout as documented in https://golang.org/pkg/time/ + + Usage: datetime=2006-01-02 + +Iso3166-1 alpha-2 + +This validates that a string value is a valid country code based on iso3166-1 alpha-2 standard. +see: https://www.iso.org/iso-3166-country-codes.html + + Usage: iso3166_1_alpha2 + +Iso3166-1 alpha-3 + +This validates that a string value is a valid country code based on iso3166-1 alpha-3 standard. +see: https://www.iso.org/iso-3166-country-codes.html + + Usage: iso3166_1_alpha3 + +Iso3166-1 alpha-numeric + +This validates that a string value is a valid country code based on iso3166-1 alpha-numeric standard. +see: https://www.iso.org/iso-3166-country-codes.html + + Usage: iso3166_1_alpha3 + +BCP 47 Language Tag + +This validates that a string value is a valid BCP 47 language tag, as parsed by language.Parse. +More information on https://pkg.go.dev/golang.org/x/text/language + + Usage: bcp47_language_tag + +BIC (SWIFT code) + +This validates that a string value is a valid Business Identifier Code (SWIFT code), defined in ISO 9362. +More information on https://www.iso.org/standard/60390.html + + Usage: bic + +RFC 1035 label + +This validates that a string value is a valid dns RFC 1035 label, defined in RFC 1035. +More information on https://datatracker.ietf.org/doc/html/rfc1035 + + Usage: dns_rfc1035_label + +TimeZone + +This validates that a string value is a valid time zone based on the time zone database present on the system. +Although empty value and Local value are allowed by time.LoadLocation golang function, they are not allowed by this validator. +More information on https://golang.org/pkg/time/#LoadLocation + + Usage: timezone + +Semantic Version + +This validates that a string value is a valid semver version, defined in Semantic Versioning 2.0.0. +More information on https://semver.org/ + + Usage: semver + +Credit Card + +This validates that a string value contains a valid credit card number using Luhn algoritm. + + Usage: credit_card + +Alias Validators and Tags + +NOTE: When returning an error, the tag returned in "FieldError" will be +the alias tag unless the dive tag is part of the alias. Everything after the +dive tag is not reported as the alias tag. Also, the "ActualTag" in the before +case will be the actual tag within the alias that failed. + +Here is a list of the current built in alias tags: + + "iscolor" + alias is "hexcolor|rgb|rgba|hsl|hsla" (Usage: iscolor) + "country_code" + alias is "iso3166_1_alpha2|iso3166_1_alpha3|iso3166_1_alpha_numeric" (Usage: country_code) + +Validator notes: + + regex + a regex validator won't be added because commas and = signs can be part + of a regex which conflict with the validation definitions. Although + workarounds can be made, they take away from using pure regex's. + Furthermore it's quick and dirty but the regex's become harder to + maintain and are not reusable, so it's as much a programming philosophy + as anything. + + In place of this new validator functions should be created; a regex can + be used within the validator function and even be precompiled for better + efficiency within regexes.go. + + And the best reason, you can submit a pull request and we can keep on + adding to the validation library of this package! + +Non standard validators + +A collection of validation rules that are frequently needed but are more +complex than the ones found in the baked in validators. +A non standard validator must be registered manually like you would +with your own custom validation functions. + +Example of registration and use: + + type Test struct { + TestField string `validate:"yourtag"` + } + + t := &Test{ + TestField: "Test" + } + + validate := validator.New() + validate.RegisterValidation("yourtag", validators.NotBlank) + +Here is a list of the current non standard validators: + + NotBlank + This validates that the value is not blank or with length zero. + For strings ensures they do not contain only spaces. For channels, maps, slices and arrays + ensures they don't have zero length. For others, a non empty value is required. + + Usage: notblank + +Panics + +This package panics when bad input is provided, this is by design, bad code like +that should not make it to production. + + type Test struct { + TestField string `validate:"nonexistantfunction=1"` + } + + t := &Test{ + TestField: "Test" + } + + validate.Struct(t) // this will panic +*/ +package validator diff --git a/vendor/github.com/go-playground/validator/v10/errors.go b/vendor/github.com/go-playground/validator/v10/errors.go new file mode 100644 index 0000000000..9a1b1abe93 --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/errors.go @@ -0,0 +1,275 @@ +package validator + +import ( + "bytes" + "fmt" + "reflect" + "strings" + + ut "github.com/go-playground/universal-translator" +) + +const ( + fieldErrMsg = "Key: '%s' Error:Field validation for '%s' failed on the '%s' tag" +) + +// ValidationErrorsTranslations is the translation return type +type ValidationErrorsTranslations map[string]string + +// InvalidValidationError describes an invalid argument passed to +// `Struct`, `StructExcept`, StructPartial` or `Field` +type InvalidValidationError struct { + Type reflect.Type +} + +// Error returns InvalidValidationError message +func (e *InvalidValidationError) Error() string { + + if e.Type == nil { + return "validator: (nil)" + } + + return "validator: (nil " + e.Type.String() + ")" +} + +// ValidationErrors is an array of FieldError's +// for use in custom error messages post validation. +type ValidationErrors []FieldError + +// Error is intended for use in development + debugging and not intended to be a production error message. +// It allows ValidationErrors to subscribe to the Error interface. +// All information to create an error message specific to your application is contained within +// the FieldError found within the ValidationErrors array +func (ve ValidationErrors) Error() string { + + buff := bytes.NewBufferString("") + + var fe *fieldError + + for i := 0; i < len(ve); i++ { + + fe = ve[i].(*fieldError) + buff.WriteString(fe.Error()) + buff.WriteString("\n") + } + + return strings.TrimSpace(buff.String()) +} + +// Translate translates all of the ValidationErrors +func (ve ValidationErrors) Translate(ut ut.Translator) ValidationErrorsTranslations { + + trans := make(ValidationErrorsTranslations) + + var fe *fieldError + + for i := 0; i < len(ve); i++ { + fe = ve[i].(*fieldError) + + // // in case an Anonymous struct was used, ensure that the key + // // would be 'Username' instead of ".Username" + // if len(fe.ns) > 0 && fe.ns[:1] == "." { + // trans[fe.ns[1:]] = fe.Translate(ut) + // continue + // } + + trans[fe.ns] = fe.Translate(ut) + } + + return trans +} + +// FieldError contains all functions to get error details +type FieldError interface { + + // Tag returns the validation tag that failed. if the + // validation was an alias, this will return the + // alias name and not the underlying tag that failed. + // + // eg. alias "iscolor": "hexcolor|rgb|rgba|hsl|hsla" + // will return "iscolor" + Tag() string + + // ActualTag returns the validation tag that failed, even if an + // alias the actual tag within the alias will be returned. + // If an 'or' validation fails the entire or will be returned. + // + // eg. alias "iscolor": "hexcolor|rgb|rgba|hsl|hsla" + // will return "hexcolor|rgb|rgba|hsl|hsla" + ActualTag() string + + // Namespace returns the namespace for the field error, with the tag + // name taking precedence over the field's actual name. + // + // eg. JSON name "User.fname" + // + // See StructNamespace() for a version that returns actual names. + // + // NOTE: this field can be blank when validating a single primitive field + // using validate.Field(...) as there is no way to extract it's name + Namespace() string + + // StructNamespace returns the namespace for the field error, with the field's + // actual name. + // + // eq. "User.FirstName" see Namespace for comparison + // + // NOTE: this field can be blank when validating a single primitive field + // using validate.Field(...) as there is no way to extract its name + StructNamespace() string + + // Field returns the fields name with the tag name taking precedence over the + // field's actual name. + // + // eq. JSON name "fname" + // see StructField for comparison + Field() string + + // StructField returns the field's actual name from the struct, when able to determine. + // + // eq. "FirstName" + // see Field for comparison + StructField() string + + // Value returns the actual field's value in case needed for creating the error + // message + Value() interface{} + + // Param returns the param value, in string form for comparison; this will also + // help with generating an error message + Param() string + + // Kind returns the Field's reflect Kind + // + // eg. time.Time's kind is a struct + Kind() reflect.Kind + + // Type returns the Field's reflect Type + // + // eg. time.Time's type is time.Time + Type() reflect.Type + + // Translate returns the FieldError's translated error + // from the provided 'ut.Translator' and registered 'TranslationFunc' + // + // NOTE: if no registered translator can be found it returns the same as + // calling fe.Error() + Translate(ut ut.Translator) string + + // Error returns the FieldError's message + Error() string +} + +// compile time interface checks +var _ FieldError = new(fieldError) +var _ error = new(fieldError) + +// fieldError contains a single field's validation error along +// with other properties that may be needed for error message creation +// it complies with the FieldError interface +type fieldError struct { + v *Validate + tag string + actualTag string + ns string + structNs string + fieldLen uint8 + structfieldLen uint8 + value interface{} + param string + kind reflect.Kind + typ reflect.Type +} + +// Tag returns the validation tag that failed. +func (fe *fieldError) Tag() string { + return fe.tag +} + +// ActualTag returns the validation tag that failed, even if an +// alias the actual tag within the alias will be returned. +func (fe *fieldError) ActualTag() string { + return fe.actualTag +} + +// Namespace returns the namespace for the field error, with the tag +// name taking precedence over the field's actual name. +func (fe *fieldError) Namespace() string { + return fe.ns +} + +// StructNamespace returns the namespace for the field error, with the field's +// actual name. +func (fe *fieldError) StructNamespace() string { + return fe.structNs +} + +// Field returns the field's name with the tag name taking precedence over the +// field's actual name. +func (fe *fieldError) Field() string { + + return fe.ns[len(fe.ns)-int(fe.fieldLen):] + // // return fe.field + // fld := fe.ns[len(fe.ns)-int(fe.fieldLen):] + + // log.Println("FLD:", fld) + + // if len(fld) > 0 && fld[:1] == "." { + // return fld[1:] + // } + + // return fld +} + +// StructField returns the field's actual name from the struct, when able to determine. +func (fe *fieldError) StructField() string { + // return fe.structField + return fe.structNs[len(fe.structNs)-int(fe.structfieldLen):] +} + +// Value returns the actual field's value in case needed for creating the error +// message +func (fe *fieldError) Value() interface{} { + return fe.value +} + +// Param returns the param value, in string form for comparison; this will +// also help with generating an error message +func (fe *fieldError) Param() string { + return fe.param +} + +// Kind returns the Field's reflect Kind +func (fe *fieldError) Kind() reflect.Kind { + return fe.kind +} + +// Type returns the Field's reflect Type +func (fe *fieldError) Type() reflect.Type { + return fe.typ +} + +// Error returns the fieldError's error message +func (fe *fieldError) Error() string { + return fmt.Sprintf(fieldErrMsg, fe.ns, fe.Field(), fe.tag) +} + +// Translate returns the FieldError's translated error +// from the provided 'ut.Translator' and registered 'TranslationFunc' +// +// NOTE: if no registered translation can be found, it returns the original +// untranslated error message. +func (fe *fieldError) Translate(ut ut.Translator) string { + + m, ok := fe.v.transTagFunc[ut] + if !ok { + return fe.Error() + } + + fn, ok := m[fe.tag] + if !ok { + return fe.Error() + } + + return fn(ut, fe) +} diff --git a/vendor/github.com/go-playground/validator/v10/field_level.go b/vendor/github.com/go-playground/validator/v10/field_level.go new file mode 100644 index 0000000000..ef35826ee6 --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/field_level.go @@ -0,0 +1,120 @@ +package validator + +import "reflect" + +// FieldLevel contains all the information and helper functions +// to validate a field +type FieldLevel interface { + + // Top returns the top level struct, if any + Top() reflect.Value + + // Parent returns the current fields parent struct, if any or + // the comparison value if called 'VarWithValue' + Parent() reflect.Value + + // Field returns current field for validation + Field() reflect.Value + + // FieldName returns the field's name with the tag + // name taking precedence over the fields actual name. + FieldName() string + + // StructFieldName returns the struct field's name + StructFieldName() string + + // Param returns param for validation against current field + Param() string + + // GetTag returns the current validations tag name + GetTag() string + + // ExtractType gets the actual underlying type of field value. + // It will dive into pointers, customTypes and return you the + // underlying value and it's kind. + ExtractType(field reflect.Value) (value reflect.Value, kind reflect.Kind, nullable bool) + + // GetStructFieldOK traverses the parent struct to retrieve a specific field denoted by the provided namespace + // in the param and returns the field, field kind and whether is was successful in retrieving + // the field at all. + // + // NOTE: when not successful ok will be false, this can happen when a nested struct is nil and so the field + // could not be retrieved because it didn't exist. + // + // Deprecated: Use GetStructFieldOK2() instead which also return if the value is nullable. + GetStructFieldOK() (reflect.Value, reflect.Kind, bool) + + // GetStructFieldOKAdvanced is the same as GetStructFieldOK except that it accepts the parent struct to start looking for + // the field and namespace allowing more extensibility for validators. + // + // Deprecated: Use GetStructFieldOKAdvanced2() instead which also return if the value is nullable. + GetStructFieldOKAdvanced(val reflect.Value, namespace string) (reflect.Value, reflect.Kind, bool) + + // GetStructFieldOK2 traverses the parent struct to retrieve a specific field denoted by the provided namespace + // in the param and returns the field, field kind, if it's a nullable type and whether is was successful in retrieving + // the field at all. + // + // NOTE: when not successful ok will be false, this can happen when a nested struct is nil and so the field + // could not be retrieved because it didn't exist. + GetStructFieldOK2() (reflect.Value, reflect.Kind, bool, bool) + + // GetStructFieldOKAdvanced2 is the same as GetStructFieldOK except that it accepts the parent struct to start looking for + // the field and namespace allowing more extensibility for validators. + GetStructFieldOKAdvanced2(val reflect.Value, namespace string) (reflect.Value, reflect.Kind, bool, bool) +} + +var _ FieldLevel = new(validate) + +// Field returns current field for validation +func (v *validate) Field() reflect.Value { + return v.flField +} + +// FieldName returns the field's name with the tag +// name taking precedence over the fields actual name. +func (v *validate) FieldName() string { + return v.cf.altName +} + +// GetTag returns the current validations tag name +func (v *validate) GetTag() string { + return v.ct.tag +} + +// StructFieldName returns the struct field's name +func (v *validate) StructFieldName() string { + return v.cf.name +} + +// Param returns param for validation against current field +func (v *validate) Param() string { + return v.ct.param +} + +// GetStructFieldOK returns Param returns param for validation against current field +// +// Deprecated: Use GetStructFieldOK2() instead which also return if the value is nullable. +func (v *validate) GetStructFieldOK() (reflect.Value, reflect.Kind, bool) { + current, kind, _, found := v.getStructFieldOKInternal(v.slflParent, v.ct.param) + return current, kind, found +} + +// GetStructFieldOKAdvanced is the same as GetStructFieldOK except that it accepts the parent struct to start looking for +// the field and namespace allowing more extensibility for validators. +// +// Deprecated: Use GetStructFieldOKAdvanced2() instead which also return if the value is nullable. +func (v *validate) GetStructFieldOKAdvanced(val reflect.Value, namespace string) (reflect.Value, reflect.Kind, bool) { + current, kind, _, found := v.GetStructFieldOKAdvanced2(val, namespace) + return current, kind, found +} + +// GetStructFieldOK2 returns Param returns param for validation against current field +func (v *validate) GetStructFieldOK2() (reflect.Value, reflect.Kind, bool, bool) { + return v.getStructFieldOKInternal(v.slflParent, v.ct.param) +} + +// GetStructFieldOKAdvanced2 is the same as GetStructFieldOK except that it accepts the parent struct to start looking for +// the field and namespace allowing more extensibility for validators. +func (v *validate) GetStructFieldOKAdvanced2(val reflect.Value, namespace string) (reflect.Value, reflect.Kind, bool, bool) { + return v.getStructFieldOKInternal(val, namespace) +} diff --git a/vendor/github.com/go-playground/validator/v10/logo.png b/vendor/github.com/go-playground/validator/v10/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..355000f5247d50e979cf5db5de38188ef4649a34 GIT binary patch literal 13443 zcmbVz^LHiB^LK39wrv|5-`KWoTN~T9%?&s9Mte8f*xWeZ`~Lg^&kxU>)6-|>Om|IH zcUM=vsybFxSr!?A009gP3|U@IN*z>Z{#W2&KzAW<*L_e0I`lYd#@osT8GH952<>}$=#%H%txCM^!YLYIPG*~?*PoX}XfpXD#$r$vg% zUJ@M8Sa6}E0bs?J()q&Aj2!Xx^!*X7wf45!j09TZ!t8tmiZrhYa~rM!hkOgG3jNOL z$t%hsiEZp{`uZS=pUq3db%5@e>LpqUR%RzF4Fp&XYtszH3NMj(x&yBfN!B@dDe(i*$ zFaI9z`VK(*+SzZ3Km$V|gFS(NfPUS&ND}#zKM&MsZR;zy@SJwDwy5moK{eH84yz0`{Dhd+jynpps_Wzr*Rl)ctU%7jk!=>D(g}(sK zP}YV(B1|d_4NeR~4qlx?36qk5ng9u-wt+@fOTlvqhk>WQ%HxtjxBspSS(-6OpP;_x z73LX72W9oA=yUj&B*sjt0z}2U44ACNztdo!tbwR&pl8vCLjf!@HDwcP;p{h$JYsrk zE3Pp7L^A>!xwNPSX+2zrQgJ8|CCr11n`u|=C}{? zlHLN%{DxBD;+;&!6Se$BciUB@EQ~Y8_ZT-Q&4p}|A3l`R=AVR9Kt+V~a3a3V{l=)gHBK2op+X}BW7o(X1K2eRTZ^; ziO?#OmuWkXeCj2*{H(1C#qnQ>tz|Kq>*#cF7g)+?3G3(pVB@N37)9YHmYxa}CVb-% z@SHf5CnrEMiI6-&fkkOb9ema$%-Ld}qN54xNf|CDt?#e@Aec&IEcEEpu3Ak5Y z>0@s)b7yHEr~UCsek0JVuF%66MBgBxj-d!wQu4Evlx;p|pZG{&=4VV)*pIE{{f=SO z;V$)QC5ae=-6(Nc68{(S;2ymNVxIiwAs9}A@vA2?55kfV(qK>S6caF|bywd&p8ydL zB}xJ~6Di7u^Xl{s1E&b!{FXH0#>1$=MTNA7+vd;Pm*#B`iYRecX>5H7^iqDqQ{GQH zKNNh0?p}h?nEjh_Ft*^M`+(a;L*rKgPp=E!!}stvVxG|YKY=Yh25?+RloCoyT3T~2 zr1!?YL58}YTlyj1sTl_H(oBl48zJPwJFr9|r(>T7Npe$Hyl7Pm(dZ}|x;n!X(4wtZ zeNCCz4LTygy(gl;pV;dp+-Lpq=weiOW2Z_Lt@RNd_s43tZ>$@23^%6`T}rfexq!%# z)e|oR;kRY~2fW@V(in6QZzE*6TubN0<>|v2xiX)v6->d$no+&np8 z=DZPj>yPVL2Y2U^MJuW`R8R{2@Rg&}`S+$yEgsGihuW$3 z2y*A5Rm-TCh*xaY#R1q)HfzQS_%fPHCL7200}u=S#u`m zvW%z6F_UcmBq~g~s|d}v6$Q?noL`Z(X;@Q$i>kw^bF}I3A8QQyAE_nz-`H~a9o2}- ztPUs0q(DTZ^Yx3oA6C5I?{nHCX0qfW&C2r}h~~slhe!$_Hh1WB`w?_|D{JsF#zpgf z;F^yDTZs-$?`myzyDj@=x}@L4b~_KtUWzV+uiL${48Qh^ZdoywlRNR<*WLFY>v0fq zeWQS`g6{8q<#x){FrCbZlcTAh?+fw^gB-2LpRnlF^}`$D;(KxTOLn;dXs3Yl(uW$g6hyw3{wZdTVg|kdSet`n+SACG=!&%#r zl+Ha_MzD$G>iQb%tW~Uus7-zOMPI__Qo92dK3VKkGgR#;-!`uw++~l5J?MT+BUCv3 zcItfZO)uKXlipj1XD?F|>3frjQWA;$JV>TcHHrcrR=Ql;-B}Bb4;f|uVo(S7xL(QP zE%c8{bnchCJ%aG)3x8gx0`Hqq`eapfWqK`~Ec6Mea`v0{J?4~x(S2D#-7sMBR1X;{ zO-QlMUsyD!#jI^8v6y2J8TinHz_zsU@;3|?TfT0F2b2A7aX&aEQGc;IZ>UV*cToht z27rX9TA$h1ZMxk`KX|$6o$)=$PxIM3k^FhGmiJMaA3fBM6(M#efLJ9ucfbo2TkroP zxE4Dv?B_Nkef;0LYVj3nk|C9-MLv{y^-tY`SD(5phR2KMn}9@?I@SQ^#m* zu>9T8l>)311+yf)qc`Zp%3Cp9FS4PN18t5zZGy-!{f^5eJQA&Fb>Llf4kF^OZ}Tu z=jyadHyzlQLaf@_eAf{CFb}_v=Gj*BLc$VrMAe%hAL@6JaXkt^p&>`#SXjBAX!3#; zZ(sPdwtkoS08=HP@lruhHm*fIlu{y~LTu@+@;u*LBUU~nbQ7S{eH09xc5^_Xtu!q@ z6^P#P!A-(qwW30Th;TBWNp{b1+lP1D!2Y2In`HJ8=DTs8;1)Y~TE2Tco&agHaJGJRtE&{R2y^@Gnpny|$qxXc2=Ps$@$~9mxET{1Q$%i!i#frlzo0UOe_Y zMxNvLk98G99Jhl+-rMB_{OyQsE?70nTDUTZf%>P_;7WAz0a+FG*4EALUD*p3UWt_( z3yZrIM%L#2dleC=K}bD*)-@4195ctqtgM0iQACxJ?F&0O<{t?%^dK1pMJo*-dHj;E z%Vt=-^pa?Z(eb%_rx~$m@yuyvX^t!IvZZ&&LJtY`#;x+PXT-Gb~(3>gv;tf~4N37#aCX z-tW%A@AM^Cf&WBJl*|wp9s0RGq_rCL)=Klfe3e8BUY|7FGZM)#ZdT04zyZ#{*|<&8 z+dsxt9B+krqDfJbykPO==|6C|yAi)*jkV&C{Du7Y#drV0`{jGeFSFOANIz#B-ncz= zB?v}IR2j5eCJ`2>yNMN9<}h!(e$i><|KSPd(Ff^lC-7pg&G~QJ8T0JD-37gq1-K+V z;1?GW_CVrGX3V0m%yvW#+uGLl^01=9zyGrgZ5fJ6GeeULS25^4)YCL=-Z!w`r$tH= zj-ikdG|nI;y1wvvk2)h7^hL0Xvnxw)Y1u}&9Vv%k1};Z0IqW?AQ8)B@QOUa?ayt31 zX^`u?pa(0F6YpbrT;e2^auw#%0BX_ub?}_ieYF;4rGRd*1_vX-+Xv9I&yR@ zZF(3;`kXg0vHdTn$5Ie;gpS4@djPPJ60-Z_1?!DwQz9NO2jKDbkZ^oJbQVc?6v#&0 zAW|kWVx3>tw#eTFT> z$S^|&ZWo)7Lyes7r)@VL=2A|$JW1nr)ed9~F&(_uHC1f;YO_5oj&Afj!0(9M)7c*f z$rra8Ji?1Bc%e|v^CcS{(B7RRCc7Wrrs=I7)f#8IE{rDM)o~`?Y8!;pSaL!lLHCZ% z2RHV1+l?QSk}_AkH)`_s#(xKJ?jwKC`csy*aOGtV&`hmHIG<5hXtzm+=iQkb{pyZ< z%;RxAP~z<%lTo;vNWd4mn;*jW+1tVM*tJ0j)}5|LR4#M7r{PkXJaW;yHBr@9pIuiG z8V1M4Ci1&Z6T1I>(C@#6rJT=}4_MR%kp=0LFD)iInpDCFQ;rm ziA+yF-c%|NyQ8);!vM6)#xu8qylq9(nieBl!@e}S5}R@)8LEU)Q|o0z)Z3vP);l2n zvCG7gtlR2XtjF1}fhC?!r{BZ4#sNRJi-Kgt?Rd(rePR;wmE}rqM-z^#fA_=ptrRR~ zqS-A)prf=s19gdfPBn?#&j;!a+e1!wX7|RMt|@0KQ_^z7My)2imN}+? z&Ro$-#EC#FN(11}WJ|$X)eQ0hf7Xye3AhvowX$0|1+x+uY~g?ccTKswq+io;vFNd6 zr7#C9z4;>@b-tg$UzV@9U5hK{mDW{6%YjDa>FJu9Z8hZyN}pshPN=W>uI!^Q$kMqm z+}IiQA9sdYvoB1IiBfX#m0axM;6c8}N>K$tD8kW56>r1h5t8J!3X0YAj1|Aw&~l@A zxf2^V`F;A0W?i!7*yQ+#;?4!!1ZQrBEI$9+-N z6P_sTrV&}s7MX}77Nq}~KmQy&5T&0ZWX--y(<$MEOLGIm!7k)jQOWggN0!Rg^`Bj3z7;;PquhhFnoqJeAbUfHR~d2;C{_De_Ogp81i65*qU(X5fweyv+B#w>RW0 zm&_w7Zm z`YWfGxm^7MK^A>0nDITy;gz^Lzudv@BC>+^JOVExD%|?aa0W#9qe``&CHjF6vqV zB8&tSqdhz{r4(|w3!g-DZKg>^k=!a74kk`D{P(2>&R~8kXP)^Ns3jTlnM7|b=I@?W z*3YW^eW^H83@t)lUE4LAm#(ICbAZTgW?ohHU;Ok91QJvMGp6fHL|&TQb|ICaXi{OO zrD__`B5>e)a6orX^!P5CsJZqQhI9-E6v4*!cC1vUi2?G|44quG+rfLS+7ZX;meFoT zMa+fb0pH+x{|o<7L^;cM5J4}K*7m~l#N2_qa(YL%G9rt7(fo;z(CaJOODkCKPA9`Bop?dIYFl3wBU&l zdqN~tz4k#i1&+HT_N>0Qm%uxG;}xqfaciIXXK|67VNTu0yzMz6pt6)m~ z7y^EZ+(wMlK9yMiwkhp&>cmXQoRzGf`o{MmkrGaxJY*%s0Dza_WczOvC8IXtY4zGE zoAfaSy~MQoF^;l5RWb}DJq*S_&wp|_lkCAaR~iQkooeXo>yX+1hRw(?%#&k0 zm|IG1?>%mpBmLr(*DC>|Vr>bN;nKsdZLlS4*_h%G1n`;;6|sE0rg^T9KG)Swoz!z& zJra776~H1@daS@C;jzI*0~;x5(E1Fpo!nLAV=SmM;Q>*#bxdaC<;wO{!IV4ONwN}f z8NK=|T>UjQ5%%_C3KAVb1}wC~Feno-GH|l>&?HI*RX~t*0XtJ~S0R6Kst$kD*7mw& z{mR31-KopNO5bKJqku0*PjnBKFE_1y_|tmDtiN7SF!NZpwNb5#sV6w^bu9#1B5K7# z0N}))422cqc#^(uW?wJU*^KLe?VU&(*c6j;U6^LZcQoK4POU1{yKSH^?k2$VGLEWB zog!7!3_Kl%apr)=%d3Rpw_4BDLZf!1tIdN&D;Yg?X2&jp0vSBqbz)XX`Wu2%`IWJS1s3lhZ7H--?PJxQLg$XONw$8qE z@4G(S5}8yFwM`{Rdz9E__ZH{{Gusj%$t#w4+ac&G3wkM0n&qZPP}J9r*av-Zq- z%NdhH1sgs~Oq9{PLkkxDiK6MQo36OTZrr&F7k6+F*a}5hV<;1u+B`QQSF#ti5`pI3 z@gvRFovLjNAri8~54co-plD$yQSX*b95r9t@B%~eI2r9NqXw{mGRKtdG5*|wk~yO zW)?msL*Rlpy{X4OLKx;RTX5`t1RY4!(bJ`a7rJ?=xM7fwcCL;k7j%-*cj9NLfbojM= zsFk;>hWcz(m*MFBO66YXrs>D4!BqdqWy_oZ>c&}P@|L*1a zVk(-?<3wy?;t9XLM*dyTj^XbicaVIM%BJouomO8jaqzV51LbTf>Ywq=#cXFtO*-oC z$O(ezf}G*);p^d{5Cc9apUxWE7RHp-F$ne9h?~C!5ok6%glp3JFOLJd2A-Fm@I}Id-s z30mMGUBh}2LTd&+z4*b8fB8hNy+ke`kmJbFXYm9=Ud96znCvs;Xa*GB`{*jEPp($~+DX+RP*)$prD03Z~ zot>}r&YE}7>5Wkie5E(*NC^ihU`EdF6Ezw%Y_=C72{{2}2gipm z*Kp)Aa`c2J&xYYZ876z^z{Zt5pR2|?72(fT&g8MYt4OgJ8>+ZDr_oB=>9xhEw%27Y zdZWI$a9GrD@5Los+iFbyl507c-TMRH3x)MMT{uczOKy3!ra7;z>2})#CRqJW`Jr@s z)uA36KCgr8c)q);G>N2B3p4kyV4NWuoxzls;Xqq+eg~fI$A3otuea;KAQGd#L@`_H zA12vy0BVLhln8XMstlX5M43pjjcZzAO3GUc$zV-2^wq;7JE(EwPLoa!*2(XgxwSlx z2_J0xvN3`hnHWW^kuO7z`%AW8B~t4yhgSPHzS%y%$=}V7s+fZJ0#{k0^O+*L0|Zg4 zfX#xMrgl!s6Xo=iNk_&jq83fy!YAvDSuT8GO6%m58Pi*2YUR|;TQb;TdN=rqTpKIZ z-p&;$N{lIA6N##--%mV~CtEEa4=)@J`4YoT@$9}xH&qcX>lvW>wj*s%n1(JbS$r*d zK9ca~LMdTQ7v!Y34Q6Zh;50&tLX-E@$j3m@9%{iLEyrjeeM_lyMFuI6_pPMcUemdp z%6;iM!PP84B5GQ70B|+R^|BqipYC7_%BZRXP;eo#KZ6EBvBzlpn}@P3p}|8#I(4 zul0x<>TxI(s0g?8v|a89+n1)Jx##kH*g@FY*niUw?{Sqmm)Xi-;WBKlUieBT&& zR3bfdZ|yI{!e~+H2q@uF@=N3k*$H|RZpj@5hvmw~_Py+wV14-k8ynOVi-{@1gB;!g zop(C8F2W!)$gD|@VYtF3M2`gl44ny?45baF7yCBl4PB@{E_nNFz6{2b zr3nxXdd~S*FLLzzO#wytqw(3PI0_%D56fEkMQPca=JX$gqH9aJ{ZpKvk8&kz zVxpVpl56nj^P5R4Lm_KK_6WeFW0cD?IY zZu%H?$YfA5eBYF>2g^}+ig>LD^PgW_C#jRJ$|LNXlubK_b)pT9uqy)nlg?;4DG*(P@1w56aN4^TZM6bWUyCM1*1Czy}HIA#1w25=*y73 z^<0dmnQg(qFmL~t3lPYXx1H8~Zxg@d(x{4t40F=4{->PSRp{RzUszJHDlXejc7G)lY;8~fKsU-hk(590&9v& zFxr}ZKJqco?V2qb5bnkeLoQVbyu32=?$Kwh?;N0OiGN|7=6`RkdoJ(JT@djZ8dUCb za?z#~&v8Fm?V}L${Zr&aQ8JC0EF>X56u4pkjt-w^+1bG$r9f1OrJ$<6qE&iV7_}kN zQweT&?sbJOanV*#E0|bLjkCC(vOm|{V<5MsimhiSt-uxzjxz9SMUvMQK{`~RZ+v_m ztb%l8kCZHm@?oa?Mb$L;Bv2$(K*V=w5SD>$*ITQ!W*n%SOXJlQO>pLoRxLI#%aHpA zmYUE<8T)d$P6F=j$+`7W&dSV^FR;c5cvU=igm6$Q0Bz?EE|?msF@JEX89DoMOUuTr z`R{3)%|h-VtA7`wTgs8)s;PQ6$6IvQTsUzrO=Y6G!D)=Xx9w0$Gba6n1y?{dK@SoK ze54vzFH|9D2~QbpUTb_H)IYDfa|J}Lq9?%CFHbsIB8(vc1WUKbA`4uL=6b&iurle2 zi(4jg{2hA5K*7uKNnBA0KV4x*3NO0jb^QuEWV&39?%#Ve9aEQ)AWUUwycBSf_o%|` zTcm^fRU(B}U8I(N*#z&8fsGAkKpBAt5@UnRa>N{07@%qaw@bs$K2R5VP#c$2^Q%RQ zVuW0slT(*~U8kk?duR;_jOTpmwrrbx->n}JX^_|@zO|a)Ik@>X7HOQ(!z(#CF@`^7JGf2aEfn1S0v}oHKo%uVUMDjl3<>f#kD$hfw(^nW(aRB6AaG-TDAh%oHjEJ=J$;2s zNEtTUsuZa{ji(_8)1j8gUOb~B9fXBSc)M%Hfsu<`&aJGt{{#rePUQ zno1K;1#~H`?Rd#V$}MtvkS~UOgsP~@^u^u{ua{D3V=Fa{2IKwI7>|!cOUteP#X!Z_ z0=9Z(Y!#lhZpJ0TKxMl6%R?6~lt!EvNztb>dbADO5-ZkYS1f(TlqF6|c^Euh&Dojz z>7lTs0ClkTp5>|*~0 z_E{QdSna;}KOcu@*xbF3xyhffB&XIT`p{6hS*F))v#>=YEtJB9Cr*b2YtK$qd9@hS zP$+_%N43)URxgAF_fx!4#yRV$Y6W06mtQ<`6RwW>A*AaHVyEylR` z2)a@71;tKHeL9Ik*CB!~)Qw;=Fl6gGLG;?;LTeerep>@XsgVh4FN73z`?Z=yj9;v% zBxr{}l;h6)J_enD_Xs$w_!zAMpK(;B2{L7;9924=)DeQQG^=eR>S_sq&5Q6tF?!ZR z5Qknd!5HirCsnTIK}aSQLQ_)EQtb#JSG@QUVD}mpOr(idOXutsza|QP5K1WjdsWrs zkY855Sph`j8nzw^f)v# zwC?)Bwo9-}lWq~G9ow>)3->q?FnXQ<$)Y*Vq?hu8MmH8aL1yGrPXCBBQZxc2c}gM_ zazx&=nWtc(!DSU&y7M>VVWHK|f42Z4$ zgM>V`3TB$s+ZXAeFq65x>B{Mdc~^YySq_px;%mpmr2Huz$C}=8-KJN$50%RxgBJ`5 zP&~~O#I1B_1NXRe11=!ZG+8?m1fW)N1v3M~LuJCB_sLZ){E+CtNyJ{zEW!m2t6~4F z%H681*4phFkdH+Wb0LC&2rz`YF05QDpj#b^CS9c1iNN6yizQhsjIRb7ouDlN!>cKa zg7n0;K8z}XHxXi2Ecua32b&VylFo$*L~5$eud(~1>99o0y8R!-= zN_$<&9xytjEu>6segSMd2}6=@3VVB@GhvK>e5(3kr&=sV&}-F69b-m9?Ip^S&_1rK z)REQFT(LR2P6B9EqR$$Fjhw z@@PRbM9s{1I>jgtQ$A{Too_2xnL(GQD!IAjpSUUis4yB{sY$2}MT}d+!IfS_pu32*B z(%fM}`E)&K1vl5$L@*MaDwYf>96D4c;kb|PKTS;+YgrY9Ko@0Q)3$VlDZzF2D5qzp z3ooIC#iZNaZ8P4)aA|hlnC{a}TPrb~vTu2a+lFss)C;W1zZ926mndG{GXR|B)WfV} z(w*ugyn0Rs7_}^z1)X+M+)NXwrEUSMFwNFX_HD7RuV z!p-X54t?QhInx8)RxXg9Gk>_MaF-=XqAoa3dpy^>ZnMr+Cdt={MR4L zlI?2b=gsG3&Ijqpwy~pkv)Y=9n_|E|4ghMbhOV!U-CR;Kg+YdeFwVdfiyc*SZ33P= z$^Lo3LKgdGzEro#sbQm;1h}cbE=gD;VPV$RSAC(NX#P3$r*wNcQV1ac_8s?7<*v7Pd5{UE zcj<@b8s(}ugB+l6X(Y2RciZYZr@$lnh&EYVD&Q;@IV#m~)&N`>i%eC8QGg&uMXI=s zQLp~@6So9V;*{|ZngyWwRLWwzOCrXEh&`MazZ2wm)kNAKFDMMTX_jGA!oO_hJ-YRa z$^tLI^PHPVUu(o9eNPBKBkY8oY*JvIpawcN$Hq>rF`BD0kq%ngOwjI!^ei&^{U1>= z!^&Yoa|y-vSLjPKIP(7C?$zHcE6TomiB6zAM~x|S=v76w%>=hQ$rVordZSPGH_r!u za~NE4L)9W;Zi;ur8=N=;g2x`9ew-T?zd44CWDowkmcCKC2ZEkwyy{Cgf?DBwA)VTz zfJ;~J*q-_{>l2=#Z#w%BHa5yiZUb#89mRN|$!s*X41Sj}m@%Y%D8!j#oex}HpuLkT zi_70a875WHbj(&5q=Cb3*-Fn-b_=@DxVxh?M%~C#aO%I9A zfDhFlS)5h5m^sgc`qgo&LB;4CbJ+4Do$EQJL-i45cQ|%b4D${*iHS6$Z!lFja4{Z& zm_cQ;+$jmX_Ipjb?|qoQbz3TEQd@UgHO-t8i&2#uH*%Y+@t8HptKD;^>9mRb|w53r?9PIIfP$v|io_ z*cIdNpF96_?%r4O-CUdtgPsVgQ7~>`(Iv=~Vz&=N0I0@6UyQtkp156a;eRI#QPSg> zAcDjr+gD33>K!@@N;gSJr1%xowp?n{?=lK{fWo0V0xrMs(WD=)!hLrQ-FS z@!mYs_Wz~@&+paJijML41V^ce^;23KtbY_xNJKz@7&zTeFEoHm7;$(UI=YQFs#$@ptk!EQ42Y4FfxEf@TOsVt37 z}4AVbnC9Ri){mLjd@o@_vA;wzpV8G_ypN3Y=M08M6ZfM2Xtkpu^=A9}u!A?A z)0NYU%Y#TSSE#tnm?KTmo4 zd|UY(Tqjl;m?`7^R${$QG*ZIW=)p?(%lWYXyf8k9{rdP=)z$ty1cAPSJfgXTOPXN1 z^D-Pknjk$jWsP@0+o&sn#8=lA=)a-i-j|YE5DwZ9s#vk3w-c?}%C?C;Q@<(1;-i>L zl}SN#MAX*71GGR14&RiPaHe@3srrMMPYHjml+|aGSDU_fRi{h1_NlT;MHYR@D(IR3 zt6;N#m)Tdz?)V=$7s!&Z;ZdmJFd0m>InR~Umqz^)eM=coLx(q4tw%~Z0U73ho^=Mj zF)fREGIOlh6`*ARYk?K%ir!a_Yvw9snW){J#zyP<3!#qD8Q_2~d|so+(Xc54smil}_4kGqEK^l7mVKQmM+ zBR70H=a2QXGB!3jg`P(Kg~lE^KQr-y_EVJi%}cMMzb+f?)6-|yp{QzpZdk)-9EhXzQpEZ(ZuvkddnL`d4Y{JQ>J+Eg}}BSGkUqgbqYuem+;8++@MM(|;Eh?pTI_O&4Gy6PBOnIB)^cWfo! V^Rh-@K?jDw` + jWTRegexString = "^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$" + splitParamsRegexString = `'[^']*'|\S+` + bicRegexString = `^[A-Za-z]{6}[A-Za-z0-9]{2}([A-Za-z0-9]{3})?$` + semverRegexString = `^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$` // numbered capture groups https://semver.org/ + dnsRegexStringRFC1035Label = "^[a-z]([-a-z0-9]*[a-z0-9]){0,62}$" +) + +var ( + alphaRegex = regexp.MustCompile(alphaRegexString) + alphaNumericRegex = regexp.MustCompile(alphaNumericRegexString) + alphaUnicodeRegex = regexp.MustCompile(alphaUnicodeRegexString) + alphaUnicodeNumericRegex = regexp.MustCompile(alphaUnicodeNumericRegexString) + numericRegex = regexp.MustCompile(numericRegexString) + numberRegex = regexp.MustCompile(numberRegexString) + hexadecimalRegex = regexp.MustCompile(hexadecimalRegexString) + hexColorRegex = regexp.MustCompile(hexColorRegexString) + rgbRegex = regexp.MustCompile(rgbRegexString) + rgbaRegex = regexp.MustCompile(rgbaRegexString) + hslRegex = regexp.MustCompile(hslRegexString) + hslaRegex = regexp.MustCompile(hslaRegexString) + e164Regex = regexp.MustCompile(e164RegexString) + emailRegex = regexp.MustCompile(emailRegexString) + base64Regex = regexp.MustCompile(base64RegexString) + base64URLRegex = regexp.MustCompile(base64URLRegexString) + iSBN10Regex = regexp.MustCompile(iSBN10RegexString) + iSBN13Regex = regexp.MustCompile(iSBN13RegexString) + uUID3Regex = regexp.MustCompile(uUID3RegexString) + uUID4Regex = regexp.MustCompile(uUID4RegexString) + uUID5Regex = regexp.MustCompile(uUID5RegexString) + uUIDRegex = regexp.MustCompile(uUIDRegexString) + uUID3RFC4122Regex = regexp.MustCompile(uUID3RFC4122RegexString) + uUID4RFC4122Regex = regexp.MustCompile(uUID4RFC4122RegexString) + uUID5RFC4122Regex = regexp.MustCompile(uUID5RFC4122RegexString) + uUIDRFC4122Regex = regexp.MustCompile(uUIDRFC4122RegexString) + uLIDRegex = regexp.MustCompile(uLIDRegexString) + md4Regex = regexp.MustCompile(md4RegexString) + md5Regex = regexp.MustCompile(md5RegexString) + sha256Regex = regexp.MustCompile(sha256RegexString) + sha384Regex = regexp.MustCompile(sha384RegexString) + sha512Regex = regexp.MustCompile(sha512RegexString) + ripemd128Regex = regexp.MustCompile(ripemd128RegexString) + ripemd160Regex = regexp.MustCompile(ripemd160RegexString) + tiger128Regex = regexp.MustCompile(tiger128RegexString) + tiger160Regex = regexp.MustCompile(tiger160RegexString) + tiger192Regex = regexp.MustCompile(tiger192RegexString) + aSCIIRegex = regexp.MustCompile(aSCIIRegexString) + printableASCIIRegex = regexp.MustCompile(printableASCIIRegexString) + multibyteRegex = regexp.MustCompile(multibyteRegexString) + dataURIRegex = regexp.MustCompile(dataURIRegexString) + latitudeRegex = regexp.MustCompile(latitudeRegexString) + longitudeRegex = regexp.MustCompile(longitudeRegexString) + sSNRegex = regexp.MustCompile(sSNRegexString) + hostnameRegexRFC952 = regexp.MustCompile(hostnameRegexStringRFC952) + hostnameRegexRFC1123 = regexp.MustCompile(hostnameRegexStringRFC1123) + fqdnRegexRFC1123 = regexp.MustCompile(fqdnRegexStringRFC1123) + btcAddressRegex = regexp.MustCompile(btcAddressRegexString) + btcUpperAddressRegexBech32 = regexp.MustCompile(btcAddressUpperRegexStringBech32) + btcLowerAddressRegexBech32 = regexp.MustCompile(btcAddressLowerRegexStringBech32) + ethAddressRegex = regexp.MustCompile(ethAddressRegexString) + ethAddressRegexUpper = regexp.MustCompile(ethAddressUpperRegexString) + ethAddressRegexLower = regexp.MustCompile(ethAddressLowerRegexString) + uRLEncodedRegex = regexp.MustCompile(uRLEncodedRegexString) + hTMLEncodedRegex = regexp.MustCompile(hTMLEncodedRegexString) + hTMLRegex = regexp.MustCompile(hTMLRegexString) + jWTRegex = regexp.MustCompile(jWTRegexString) + splitParamsRegex = regexp.MustCompile(splitParamsRegexString) + bicRegex = regexp.MustCompile(bicRegexString) + semverRegex = regexp.MustCompile(semverRegexString) + dnsRegexRFC1035Label = regexp.MustCompile(dnsRegexStringRFC1035Label) +) diff --git a/vendor/github.com/go-playground/validator/v10/struct_level.go b/vendor/github.com/go-playground/validator/v10/struct_level.go new file mode 100644 index 0000000000..c0d89cfbed --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/struct_level.go @@ -0,0 +1,175 @@ +package validator + +import ( + "context" + "reflect" +) + +// StructLevelFunc accepts all values needed for struct level validation +type StructLevelFunc func(sl StructLevel) + +// StructLevelFuncCtx accepts all values needed for struct level validation +// but also allows passing of contextual validation information via context.Context. +type StructLevelFuncCtx func(ctx context.Context, sl StructLevel) + +// wrapStructLevelFunc wraps normal StructLevelFunc makes it compatible with StructLevelFuncCtx +func wrapStructLevelFunc(fn StructLevelFunc) StructLevelFuncCtx { + return func(ctx context.Context, sl StructLevel) { + fn(sl) + } +} + +// StructLevel contains all the information and helper functions +// to validate a struct +type StructLevel interface { + + // Validator returns the main validation object, in case one wants to call validations internally. + // this is so you don't have to use anonymous functions to get access to the validate + // instance. + Validator() *Validate + + // Top returns the top level struct, if any + Top() reflect.Value + + // Parent returns the current fields parent struct, if any + Parent() reflect.Value + + // Current returns the current struct. + Current() reflect.Value + + // ExtractType gets the actual underlying type of field value. + // It will dive into pointers, customTypes and return you the + // underlying value and its kind. + ExtractType(field reflect.Value) (value reflect.Value, kind reflect.Kind, nullable bool) + + // ReportError reports an error just by passing the field and tag information + // + // NOTES: + // + // fieldName and altName get appended to the existing namespace that + // validator is on. e.g. pass 'FirstName' or 'Names[0]' depending + // on the nesting + // + // tag can be an existing validation tag or just something you make up + // and process on the flip side it's up to you. + ReportError(field interface{}, fieldName, structFieldName string, tag, param string) + + // ReportValidationErrors reports an error just by passing ValidationErrors + // + // NOTES: + // + // relativeNamespace and relativeActualNamespace get appended to the + // existing namespace that validator is on. + // e.g. pass 'User.FirstName' or 'Users[0].FirstName' depending + // on the nesting. most of the time they will be blank, unless you validate + // at a level lower the the current field depth + ReportValidationErrors(relativeNamespace, relativeActualNamespace string, errs ValidationErrors) +} + +var _ StructLevel = new(validate) + +// Top returns the top level struct +// +// NOTE: this can be the same as the current struct being validated +// if not is a nested struct. +// +// this is only called when within Struct and Field Level validation and +// should not be relied upon for an acurate value otherwise. +func (v *validate) Top() reflect.Value { + return v.top +} + +// Parent returns the current structs parent +// +// NOTE: this can be the same as the current struct being validated +// if not is a nested struct. +// +// this is only called when within Struct and Field Level validation and +// should not be relied upon for an acurate value otherwise. +func (v *validate) Parent() reflect.Value { + return v.slflParent +} + +// Current returns the current struct. +func (v *validate) Current() reflect.Value { + return v.slCurrent +} + +// Validator returns the main validation object, in case one want to call validations internally. +func (v *validate) Validator() *Validate { + return v.v +} + +// ExtractType gets the actual underlying type of field value. +func (v *validate) ExtractType(field reflect.Value) (reflect.Value, reflect.Kind, bool) { + return v.extractTypeInternal(field, false) +} + +// ReportError reports an error just by passing the field and tag information +func (v *validate) ReportError(field interface{}, fieldName, structFieldName, tag, param string) { + + fv, kind, _ := v.extractTypeInternal(reflect.ValueOf(field), false) + + if len(structFieldName) == 0 { + structFieldName = fieldName + } + + v.str1 = string(append(v.ns, fieldName...)) + + if v.v.hasTagNameFunc || fieldName != structFieldName { + v.str2 = string(append(v.actualNs, structFieldName...)) + } else { + v.str2 = v.str1 + } + + if kind == reflect.Invalid { + + v.errs = append(v.errs, + &fieldError{ + v: v.v, + tag: tag, + actualTag: tag, + ns: v.str1, + structNs: v.str2, + fieldLen: uint8(len(fieldName)), + structfieldLen: uint8(len(structFieldName)), + param: param, + kind: kind, + }, + ) + return + } + + v.errs = append(v.errs, + &fieldError{ + v: v.v, + tag: tag, + actualTag: tag, + ns: v.str1, + structNs: v.str2, + fieldLen: uint8(len(fieldName)), + structfieldLen: uint8(len(structFieldName)), + value: fv.Interface(), + param: param, + kind: kind, + typ: fv.Type(), + }, + ) +} + +// ReportValidationErrors reports ValidationErrors obtained from running validations within the Struct Level validation. +// +// NOTE: this function prepends the current namespace to the relative ones. +func (v *validate) ReportValidationErrors(relativeNamespace, relativeStructNamespace string, errs ValidationErrors) { + + var err *fieldError + + for i := 0; i < len(errs); i++ { + + err = errs[i].(*fieldError) + err.ns = string(append(append(v.ns, relativeNamespace...), err.ns...)) + err.structNs = string(append(append(v.actualNs, relativeStructNamespace...), err.structNs...)) + + v.errs = append(v.errs, err) + } +} diff --git a/vendor/github.com/go-playground/validator/v10/translations.go b/vendor/github.com/go-playground/validator/v10/translations.go new file mode 100644 index 0000000000..4d9d75c13a --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/translations.go @@ -0,0 +1,11 @@ +package validator + +import ut "github.com/go-playground/universal-translator" + +// TranslationFunc is the function type used to register or override +// custom translations +type TranslationFunc func(ut ut.Translator, fe FieldError) string + +// RegisterTranslationsFunc allows for registering of translations +// for a 'ut.Translator' for use within the 'TranslationFunc' +type RegisterTranslationsFunc func(ut ut.Translator) error diff --git a/vendor/github.com/go-playground/validator/v10/util.go b/vendor/github.com/go-playground/validator/v10/util.go new file mode 100644 index 0000000000..36da85514e --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/util.go @@ -0,0 +1,288 @@ +package validator + +import ( + "reflect" + "strconv" + "strings" + "time" +) + +// extractTypeInternal gets the actual underlying type of field value. +// It will dive into pointers, customTypes and return you the +// underlying value and it's kind. +func (v *validate) extractTypeInternal(current reflect.Value, nullable bool) (reflect.Value, reflect.Kind, bool) { + +BEGIN: + switch current.Kind() { + case reflect.Ptr: + + nullable = true + + if current.IsNil() { + return current, reflect.Ptr, nullable + } + + current = current.Elem() + goto BEGIN + + case reflect.Interface: + + nullable = true + + if current.IsNil() { + return current, reflect.Interface, nullable + } + + current = current.Elem() + goto BEGIN + + case reflect.Invalid: + return current, reflect.Invalid, nullable + + default: + + if v.v.hasCustomFuncs { + + if fn, ok := v.v.customFuncs[current.Type()]; ok { + current = reflect.ValueOf(fn(current)) + goto BEGIN + } + } + + return current, current.Kind(), nullable + } +} + +// getStructFieldOKInternal traverses a struct to retrieve a specific field denoted by the provided namespace and +// returns the field, field kind and whether is was successful in retrieving the field at all. +// +// NOTE: when not successful ok will be false, this can happen when a nested struct is nil and so the field +// could not be retrieved because it didn't exist. +func (v *validate) getStructFieldOKInternal(val reflect.Value, namespace string) (current reflect.Value, kind reflect.Kind, nullable bool, found bool) { + +BEGIN: + current, kind, nullable = v.ExtractType(val) + if kind == reflect.Invalid { + return + } + + if namespace == "" { + found = true + return + } + + switch kind { + + case reflect.Ptr, reflect.Interface: + return + + case reflect.Struct: + + typ := current.Type() + fld := namespace + var ns string + + if !typ.ConvertibleTo(timeType) { + + idx := strings.Index(namespace, namespaceSeparator) + + if idx != -1 { + fld = namespace[:idx] + ns = namespace[idx+1:] + } else { + ns = "" + } + + bracketIdx := strings.Index(fld, leftBracket) + if bracketIdx != -1 { + fld = fld[:bracketIdx] + + ns = namespace[bracketIdx:] + } + + val = current.FieldByName(fld) + namespace = ns + goto BEGIN + } + + case reflect.Array, reflect.Slice: + idx := strings.Index(namespace, leftBracket) + idx2 := strings.Index(namespace, rightBracket) + + arrIdx, _ := strconv.Atoi(namespace[idx+1 : idx2]) + + if arrIdx >= current.Len() { + return + } + + startIdx := idx2 + 1 + + if startIdx < len(namespace) { + if namespace[startIdx:startIdx+1] == namespaceSeparator { + startIdx++ + } + } + + val = current.Index(arrIdx) + namespace = namespace[startIdx:] + goto BEGIN + + case reflect.Map: + idx := strings.Index(namespace, leftBracket) + 1 + idx2 := strings.Index(namespace, rightBracket) + + endIdx := idx2 + + if endIdx+1 < len(namespace) { + if namespace[endIdx+1:endIdx+2] == namespaceSeparator { + endIdx++ + } + } + + key := namespace[idx:idx2] + + switch current.Type().Key().Kind() { + case reflect.Int: + i, _ := strconv.Atoi(key) + val = current.MapIndex(reflect.ValueOf(i)) + namespace = namespace[endIdx+1:] + + case reflect.Int8: + i, _ := strconv.ParseInt(key, 10, 8) + val = current.MapIndex(reflect.ValueOf(int8(i))) + namespace = namespace[endIdx+1:] + + case reflect.Int16: + i, _ := strconv.ParseInt(key, 10, 16) + val = current.MapIndex(reflect.ValueOf(int16(i))) + namespace = namespace[endIdx+1:] + + case reflect.Int32: + i, _ := strconv.ParseInt(key, 10, 32) + val = current.MapIndex(reflect.ValueOf(int32(i))) + namespace = namespace[endIdx+1:] + + case reflect.Int64: + i, _ := strconv.ParseInt(key, 10, 64) + val = current.MapIndex(reflect.ValueOf(i)) + namespace = namespace[endIdx+1:] + + case reflect.Uint: + i, _ := strconv.ParseUint(key, 10, 0) + val = current.MapIndex(reflect.ValueOf(uint(i))) + namespace = namespace[endIdx+1:] + + case reflect.Uint8: + i, _ := strconv.ParseUint(key, 10, 8) + val = current.MapIndex(reflect.ValueOf(uint8(i))) + namespace = namespace[endIdx+1:] + + case reflect.Uint16: + i, _ := strconv.ParseUint(key, 10, 16) + val = current.MapIndex(reflect.ValueOf(uint16(i))) + namespace = namespace[endIdx+1:] + + case reflect.Uint32: + i, _ := strconv.ParseUint(key, 10, 32) + val = current.MapIndex(reflect.ValueOf(uint32(i))) + namespace = namespace[endIdx+1:] + + case reflect.Uint64: + i, _ := strconv.ParseUint(key, 10, 64) + val = current.MapIndex(reflect.ValueOf(i)) + namespace = namespace[endIdx+1:] + + case reflect.Float32: + f, _ := strconv.ParseFloat(key, 32) + val = current.MapIndex(reflect.ValueOf(float32(f))) + namespace = namespace[endIdx+1:] + + case reflect.Float64: + f, _ := strconv.ParseFloat(key, 64) + val = current.MapIndex(reflect.ValueOf(f)) + namespace = namespace[endIdx+1:] + + case reflect.Bool: + b, _ := strconv.ParseBool(key) + val = current.MapIndex(reflect.ValueOf(b)) + namespace = namespace[endIdx+1:] + + // reflect.Type = string + default: + val = current.MapIndex(reflect.ValueOf(key)) + namespace = namespace[endIdx+1:] + } + + goto BEGIN + } + + // if got here there was more namespace, cannot go any deeper + panic("Invalid field namespace") +} + +// asInt returns the parameter as a int64 +// or panics if it can't convert +func asInt(param string) int64 { + i, err := strconv.ParseInt(param, 0, 64) + panicIf(err) + + return i +} + +// asIntFromTimeDuration parses param as time.Duration and returns it as int64 +// or panics on error. +func asIntFromTimeDuration(param string) int64 { + d, err := time.ParseDuration(param) + if err != nil { + // attempt parsing as an an integer assuming nanosecond precision + return asInt(param) + } + return int64(d) +} + +// asIntFromType calls the proper function to parse param as int64, +// given a field's Type t. +func asIntFromType(t reflect.Type, param string) int64 { + switch t { + case timeDurationType: + return asIntFromTimeDuration(param) + default: + return asInt(param) + } +} + +// asUint returns the parameter as a uint64 +// or panics if it can't convert +func asUint(param string) uint64 { + + i, err := strconv.ParseUint(param, 0, 64) + panicIf(err) + + return i +} + +// asFloat returns the parameter as a float64 +// or panics if it can't convert +func asFloat(param string) float64 { + + i, err := strconv.ParseFloat(param, 64) + panicIf(err) + + return i +} + +// asBool returns the parameter as a bool +// or panics if it can't convert +func asBool(param string) bool { + + i, err := strconv.ParseBool(param) + panicIf(err) + + return i +} + +func panicIf(err error) { + if err != nil { + panic(err.Error()) + } +} diff --git a/vendor/github.com/go-playground/validator/v10/validator.go b/vendor/github.com/go-playground/validator/v10/validator.go new file mode 100644 index 0000000000..80da095a63 --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/validator.go @@ -0,0 +1,486 @@ +package validator + +import ( + "context" + "fmt" + "reflect" + "strconv" +) + +// per validate construct +type validate struct { + v *Validate + top reflect.Value + ns []byte + actualNs []byte + errs ValidationErrors + includeExclude map[string]struct{} // reset only if StructPartial or StructExcept are called, no need otherwise + ffn FilterFunc + slflParent reflect.Value // StructLevel & FieldLevel + slCurrent reflect.Value // StructLevel & FieldLevel + flField reflect.Value // StructLevel & FieldLevel + cf *cField // StructLevel & FieldLevel + ct *cTag // StructLevel & FieldLevel + misc []byte // misc reusable + str1 string // misc reusable + str2 string // misc reusable + fldIsPointer bool // StructLevel & FieldLevel + isPartial bool + hasExcludes bool +} + +// parent and current will be the same the first run of validateStruct +func (v *validate) validateStruct(ctx context.Context, parent reflect.Value, current reflect.Value, typ reflect.Type, ns []byte, structNs []byte, ct *cTag) { + + cs, ok := v.v.structCache.Get(typ) + if !ok { + cs = v.v.extractStructCache(current, typ.Name()) + } + + if len(ns) == 0 && len(cs.name) != 0 { + + ns = append(ns, cs.name...) + ns = append(ns, '.') + + structNs = append(structNs, cs.name...) + structNs = append(structNs, '.') + } + + // ct is nil on top level struct, and structs as fields that have no tag info + // so if nil or if not nil and the structonly tag isn't present + if ct == nil || ct.typeof != typeStructOnly { + + var f *cField + + for i := 0; i < len(cs.fields); i++ { + + f = cs.fields[i] + + if v.isPartial { + + if v.ffn != nil { + // used with StructFiltered + if v.ffn(append(structNs, f.name...)) { + continue + } + + } else { + // used with StructPartial & StructExcept + _, ok = v.includeExclude[string(append(structNs, f.name...))] + + if (ok && v.hasExcludes) || (!ok && !v.hasExcludes) { + continue + } + } + } + + v.traverseField(ctx, current, current.Field(f.idx), ns, structNs, f, f.cTags) + } + } + + // check if any struct level validations, after all field validations already checked. + // first iteration will have no info about nostructlevel tag, and is checked prior to + // calling the next iteration of validateStruct called from traverseField. + if cs.fn != nil { + + v.slflParent = parent + v.slCurrent = current + v.ns = ns + v.actualNs = structNs + + cs.fn(ctx, v) + } +} + +// traverseField validates any field, be it a struct or single field, ensures it's validity and passes it along to be validated via it's tag options +func (v *validate) traverseField(ctx context.Context, parent reflect.Value, current reflect.Value, ns []byte, structNs []byte, cf *cField, ct *cTag) { + var typ reflect.Type + var kind reflect.Kind + + current, kind, v.fldIsPointer = v.extractTypeInternal(current, false) + + switch kind { + case reflect.Ptr, reflect.Interface, reflect.Invalid: + + if ct == nil { + return + } + + if ct.typeof == typeOmitEmpty || ct.typeof == typeIsDefault { + return + } + + if ct.hasTag { + if kind == reflect.Invalid { + v.str1 = string(append(ns, cf.altName...)) + if v.v.hasTagNameFunc { + v.str2 = string(append(structNs, cf.name...)) + } else { + v.str2 = v.str1 + } + v.errs = append(v.errs, + &fieldError{ + v: v.v, + tag: ct.aliasTag, + actualTag: ct.tag, + ns: v.str1, + structNs: v.str2, + fieldLen: uint8(len(cf.altName)), + structfieldLen: uint8(len(cf.name)), + param: ct.param, + kind: kind, + }, + ) + return + } + + v.str1 = string(append(ns, cf.altName...)) + if v.v.hasTagNameFunc { + v.str2 = string(append(structNs, cf.name...)) + } else { + v.str2 = v.str1 + } + if !ct.runValidationWhenNil { + v.errs = append(v.errs, + &fieldError{ + v: v.v, + tag: ct.aliasTag, + actualTag: ct.tag, + ns: v.str1, + structNs: v.str2, + fieldLen: uint8(len(cf.altName)), + structfieldLen: uint8(len(cf.name)), + value: current.Interface(), + param: ct.param, + kind: kind, + typ: current.Type(), + }, + ) + return + } + } + + case reflect.Struct: + + typ = current.Type() + + if !typ.ConvertibleTo(timeType) { + + if ct != nil { + + if ct.typeof == typeStructOnly { + goto CONTINUE + } else if ct.typeof == typeIsDefault { + // set Field Level fields + v.slflParent = parent + v.flField = current + v.cf = cf + v.ct = ct + + if !ct.fn(ctx, v) { + v.str1 = string(append(ns, cf.altName...)) + + if v.v.hasTagNameFunc { + v.str2 = string(append(structNs, cf.name...)) + } else { + v.str2 = v.str1 + } + + v.errs = append(v.errs, + &fieldError{ + v: v.v, + tag: ct.aliasTag, + actualTag: ct.tag, + ns: v.str1, + structNs: v.str2, + fieldLen: uint8(len(cf.altName)), + structfieldLen: uint8(len(cf.name)), + value: current.Interface(), + param: ct.param, + kind: kind, + typ: typ, + }, + ) + return + } + } + + ct = ct.next + } + + if ct != nil && ct.typeof == typeNoStructLevel { + return + } + + CONTINUE: + // if len == 0 then validating using 'Var' or 'VarWithValue' + // Var - doesn't make much sense to do it that way, should call 'Struct', but no harm... + // VarWithField - this allows for validating against each field within the struct against a specific value + // pretty handy in certain situations + if len(cf.name) > 0 { + ns = append(append(ns, cf.altName...), '.') + structNs = append(append(structNs, cf.name...), '.') + } + + v.validateStruct(ctx, parent, current, typ, ns, structNs, ct) + return + } + } + + if ct == nil || !ct.hasTag { + return + } + + typ = current.Type() + +OUTER: + for { + if ct == nil { + return + } + + switch ct.typeof { + + case typeOmitEmpty: + + // set Field Level fields + v.slflParent = parent + v.flField = current + v.cf = cf + v.ct = ct + + if !hasValue(v) { + return + } + + ct = ct.next + continue + + case typeEndKeys: + return + + case typeDive: + + ct = ct.next + + // traverse slice or map here + // or panic ;) + switch kind { + case reflect.Slice, reflect.Array: + + var i64 int64 + reusableCF := &cField{} + + for i := 0; i < current.Len(); i++ { + + i64 = int64(i) + + v.misc = append(v.misc[0:0], cf.name...) + v.misc = append(v.misc, '[') + v.misc = strconv.AppendInt(v.misc, i64, 10) + v.misc = append(v.misc, ']') + + reusableCF.name = string(v.misc) + + if cf.namesEqual { + reusableCF.altName = reusableCF.name + } else { + + v.misc = append(v.misc[0:0], cf.altName...) + v.misc = append(v.misc, '[') + v.misc = strconv.AppendInt(v.misc, i64, 10) + v.misc = append(v.misc, ']') + + reusableCF.altName = string(v.misc) + } + v.traverseField(ctx, parent, current.Index(i), ns, structNs, reusableCF, ct) + } + + case reflect.Map: + + var pv string + reusableCF := &cField{} + + for _, key := range current.MapKeys() { + + pv = fmt.Sprintf("%v", key.Interface()) + + v.misc = append(v.misc[0:0], cf.name...) + v.misc = append(v.misc, '[') + v.misc = append(v.misc, pv...) + v.misc = append(v.misc, ']') + + reusableCF.name = string(v.misc) + + if cf.namesEqual { + reusableCF.altName = reusableCF.name + } else { + v.misc = append(v.misc[0:0], cf.altName...) + v.misc = append(v.misc, '[') + v.misc = append(v.misc, pv...) + v.misc = append(v.misc, ']') + + reusableCF.altName = string(v.misc) + } + + if ct != nil && ct.typeof == typeKeys && ct.keys != nil { + v.traverseField(ctx, parent, key, ns, structNs, reusableCF, ct.keys) + // can be nil when just keys being validated + if ct.next != nil { + v.traverseField(ctx, parent, current.MapIndex(key), ns, structNs, reusableCF, ct.next) + } + } else { + v.traverseField(ctx, parent, current.MapIndex(key), ns, structNs, reusableCF, ct) + } + } + + default: + // throw error, if not a slice or map then should not have gotten here + // bad dive tag + panic("dive error! can't dive on a non slice or map") + } + + return + + case typeOr: + + v.misc = v.misc[0:0] + + for { + + // set Field Level fields + v.slflParent = parent + v.flField = current + v.cf = cf + v.ct = ct + + if ct.fn(ctx, v) { + if ct.isBlockEnd { + ct = ct.next + continue OUTER + } + + // drain rest of the 'or' values, then continue or leave + for { + + ct = ct.next + + if ct == nil { + return + } + + if ct.typeof != typeOr { + continue OUTER + } + + if ct.isBlockEnd { + ct = ct.next + continue OUTER + } + } + } + + v.misc = append(v.misc, '|') + v.misc = append(v.misc, ct.tag...) + + if ct.hasParam { + v.misc = append(v.misc, '=') + v.misc = append(v.misc, ct.param...) + } + + if ct.isBlockEnd || ct.next == nil { + // if we get here, no valid 'or' value and no more tags + v.str1 = string(append(ns, cf.altName...)) + + if v.v.hasTagNameFunc { + v.str2 = string(append(structNs, cf.name...)) + } else { + v.str2 = v.str1 + } + + if ct.hasAlias { + + v.errs = append(v.errs, + &fieldError{ + v: v.v, + tag: ct.aliasTag, + actualTag: ct.actualAliasTag, + ns: v.str1, + structNs: v.str2, + fieldLen: uint8(len(cf.altName)), + structfieldLen: uint8(len(cf.name)), + value: current.Interface(), + param: ct.param, + kind: kind, + typ: typ, + }, + ) + + } else { + + tVal := string(v.misc)[1:] + + v.errs = append(v.errs, + &fieldError{ + v: v.v, + tag: tVal, + actualTag: tVal, + ns: v.str1, + structNs: v.str2, + fieldLen: uint8(len(cf.altName)), + structfieldLen: uint8(len(cf.name)), + value: current.Interface(), + param: ct.param, + kind: kind, + typ: typ, + }, + ) + } + + return + } + + ct = ct.next + } + + default: + + // set Field Level fields + v.slflParent = parent + v.flField = current + v.cf = cf + v.ct = ct + + if !ct.fn(ctx, v) { + + v.str1 = string(append(ns, cf.altName...)) + + if v.v.hasTagNameFunc { + v.str2 = string(append(structNs, cf.name...)) + } else { + v.str2 = v.str1 + } + + v.errs = append(v.errs, + &fieldError{ + v: v.v, + tag: ct.aliasTag, + actualTag: ct.tag, + ns: v.str1, + structNs: v.str2, + fieldLen: uint8(len(cf.altName)), + structfieldLen: uint8(len(cf.name)), + value: current.Interface(), + param: ct.param, + kind: kind, + typ: typ, + }, + ) + + return + } + ct = ct.next + } + } + +} diff --git a/vendor/github.com/go-playground/validator/v10/validator_instance.go b/vendor/github.com/go-playground/validator/v10/validator_instance.go new file mode 100644 index 0000000000..9493da491a --- /dev/null +++ b/vendor/github.com/go-playground/validator/v10/validator_instance.go @@ -0,0 +1,699 @@ +package validator + +import ( + "context" + "errors" + "fmt" + "reflect" + "strings" + "sync" + "time" + + ut "github.com/go-playground/universal-translator" +) + +const ( + defaultTagName = "validate" + utf8HexComma = "0x2C" + utf8Pipe = "0x7C" + tagSeparator = "," + orSeparator = "|" + tagKeySeparator = "=" + structOnlyTag = "structonly" + noStructLevelTag = "nostructlevel" + omitempty = "omitempty" + isdefault = "isdefault" + requiredWithoutAllTag = "required_without_all" + requiredWithoutTag = "required_without" + requiredWithTag = "required_with" + requiredWithAllTag = "required_with_all" + requiredIfTag = "required_if" + requiredUnlessTag = "required_unless" + excludedWithoutAllTag = "excluded_without_all" + excludedWithoutTag = "excluded_without" + excludedWithTag = "excluded_with" + excludedWithAllTag = "excluded_with_all" + excludedIfTag = "excluded_if" + excludedUnlessTag = "excluded_unless" + skipValidationTag = "-" + diveTag = "dive" + keysTag = "keys" + endKeysTag = "endkeys" + requiredTag = "required" + namespaceSeparator = "." + leftBracket = "[" + rightBracket = "]" + restrictedTagChars = ".[],|=+()`~!@#$%^&*\\\"/?<>{}" + restrictedAliasErr = "Alias '%s' either contains restricted characters or is the same as a restricted tag needed for normal operation" + restrictedTagErr = "Tag '%s' either contains restricted characters or is the same as a restricted tag needed for normal operation" +) + +var ( + timeDurationType = reflect.TypeOf(time.Duration(0)) + timeType = reflect.TypeOf(time.Time{}) + + defaultCField = &cField{namesEqual: true} +) + +// FilterFunc is the type used to filter fields using +// StructFiltered(...) function. +// returning true results in the field being filtered/skiped from +// validation +type FilterFunc func(ns []byte) bool + +// CustomTypeFunc allows for overriding or adding custom field type handler functions +// field = field value of the type to return a value to be validated +// example Valuer from sql drive see https://golang.org/src/database/sql/driver/types.go?s=1210:1293#L29 +type CustomTypeFunc func(field reflect.Value) interface{} + +// TagNameFunc allows for adding of a custom tag name parser +type TagNameFunc func(field reflect.StructField) string + +type internalValidationFuncWrapper struct { + fn FuncCtx + runValidatinOnNil bool +} + +// Validate contains the validator settings and cache +type Validate struct { + tagName string + pool *sync.Pool + hasCustomFuncs bool + hasTagNameFunc bool + tagNameFunc TagNameFunc + structLevelFuncs map[reflect.Type]StructLevelFuncCtx + customFuncs map[reflect.Type]CustomTypeFunc + aliases map[string]string + validations map[string]internalValidationFuncWrapper + transTagFunc map[ut.Translator]map[string]TranslationFunc // map[]map[]TranslationFunc + rules map[reflect.Type]map[string]string + tagCache *tagCache + structCache *structCache +} + +// New returns a new instance of 'validate' with sane defaults. +// Validate is designed to be thread-safe and used as a singleton instance. +// It caches information about your struct and validations, +// in essence only parsing your validation tags once per struct type. +// Using multiple instances neglects the benefit of caching. +func New() *Validate { + + tc := new(tagCache) + tc.m.Store(make(map[string]*cTag)) + + sc := new(structCache) + sc.m.Store(make(map[reflect.Type]*cStruct)) + + v := &Validate{ + tagName: defaultTagName, + aliases: make(map[string]string, len(bakedInAliases)), + validations: make(map[string]internalValidationFuncWrapper, len(bakedInValidators)), + tagCache: tc, + structCache: sc, + } + + // must copy alias validators for separate validations to be used in each validator instance + for k, val := range bakedInAliases { + v.RegisterAlias(k, val) + } + + // must copy validators for separate validations to be used in each instance + for k, val := range bakedInValidators { + + switch k { + // these require that even if the value is nil that the validation should run, omitempty still overrides this behaviour + case requiredIfTag, requiredUnlessTag, requiredWithTag, requiredWithAllTag, requiredWithoutTag, requiredWithoutAllTag, + excludedIfTag, excludedUnlessTag, excludedWithTag, excludedWithAllTag, excludedWithoutTag, excludedWithoutAllTag: + _ = v.registerValidation(k, wrapFunc(val), true, true) + default: + // no need to error check here, baked in will always be valid + _ = v.registerValidation(k, wrapFunc(val), true, false) + } + } + + v.pool = &sync.Pool{ + New: func() interface{} { + return &validate{ + v: v, + ns: make([]byte, 0, 64), + actualNs: make([]byte, 0, 64), + misc: make([]byte, 32), + } + }, + } + + return v +} + +// SetTagName allows for changing of the default tag name of 'validate' +func (v *Validate) SetTagName(name string) { + v.tagName = name +} + +// ValidateMapCtx validates a map using a map of validation rules and allows passing of contextual +// validation validation information via context.Context. +func (v Validate) ValidateMapCtx(ctx context.Context, data map[string]interface{}, rules map[string]interface{}) map[string]interface{} { + errs := make(map[string]interface{}) + for field, rule := range rules { + if ruleObj, ok := rule.(map[string]interface{}); ok { + if dataObj, ok := data[field].(map[string]interface{}); ok { + err := v.ValidateMapCtx(ctx, dataObj, ruleObj) + if len(err) > 0 { + errs[field] = err + } + } else if dataObjs, ok := data[field].([]map[string]interface{}); ok { + for _, obj := range dataObjs { + err := v.ValidateMapCtx(ctx, obj, ruleObj) + if len(err) > 0 { + errs[field] = err + } + } + } else { + errs[field] = errors.New("The field: '" + field + "' is not a map to dive") + } + } else if ruleStr, ok := rule.(string); ok { + err := v.VarCtx(ctx, data[field], ruleStr) + if err != nil { + errs[field] = err + } + } + } + return errs +} + +// ValidateMap validates map data from a map of tags +func (v *Validate) ValidateMap(data map[string]interface{}, rules map[string]interface{}) map[string]interface{} { + return v.ValidateMapCtx(context.Background(), data, rules) +} + +// RegisterTagNameFunc registers a function to get alternate names for StructFields. +// +// eg. to use the names which have been specified for JSON representations of structs, rather than normal Go field names: +// +// validate.RegisterTagNameFunc(func(fld reflect.StructField) string { +// name := strings.SplitN(fld.Tag.Get("json"), ",", 2)[0] +// // skip if tag key says it should be ignored +// if name == "-" { +// return "" +// } +// return name +// }) +func (v *Validate) RegisterTagNameFunc(fn TagNameFunc) { + v.tagNameFunc = fn + v.hasTagNameFunc = true +} + +// RegisterValidation adds a validation with the given tag +// +// NOTES: +// - if the key already exists, the previous validation function will be replaced. +// - this method is not thread-safe it is intended that these all be registered prior to any validation +func (v *Validate) RegisterValidation(tag string, fn Func, callValidationEvenIfNull ...bool) error { + return v.RegisterValidationCtx(tag, wrapFunc(fn), callValidationEvenIfNull...) +} + +// RegisterValidationCtx does the same as RegisterValidation on accepts a FuncCtx validation +// allowing context.Context validation support. +func (v *Validate) RegisterValidationCtx(tag string, fn FuncCtx, callValidationEvenIfNull ...bool) error { + var nilCheckable bool + if len(callValidationEvenIfNull) > 0 { + nilCheckable = callValidationEvenIfNull[0] + } + return v.registerValidation(tag, fn, false, nilCheckable) +} + +func (v *Validate) registerValidation(tag string, fn FuncCtx, bakedIn bool, nilCheckable bool) error { + if len(tag) == 0 { + return errors.New("function Key cannot be empty") + } + + if fn == nil { + return errors.New("function cannot be empty") + } + + _, ok := restrictedTags[tag] + if !bakedIn && (ok || strings.ContainsAny(tag, restrictedTagChars)) { + panic(fmt.Sprintf(restrictedTagErr, tag)) + } + v.validations[tag] = internalValidationFuncWrapper{fn: fn, runValidatinOnNil: nilCheckable} + return nil +} + +// RegisterAlias registers a mapping of a single validation tag that +// defines a common or complex set of validation(s) to simplify adding validation +// to structs. +// +// NOTE: this function is not thread-safe it is intended that these all be registered prior to any validation +func (v *Validate) RegisterAlias(alias, tags string) { + + _, ok := restrictedTags[alias] + + if ok || strings.ContainsAny(alias, restrictedTagChars) { + panic(fmt.Sprintf(restrictedAliasErr, alias)) + } + + v.aliases[alias] = tags +} + +// RegisterStructValidation registers a StructLevelFunc against a number of types. +// +// NOTE: +// - this method is not thread-safe it is intended that these all be registered prior to any validation +func (v *Validate) RegisterStructValidation(fn StructLevelFunc, types ...interface{}) { + v.RegisterStructValidationCtx(wrapStructLevelFunc(fn), types...) +} + +// RegisterStructValidationCtx registers a StructLevelFuncCtx against a number of types and allows passing +// of contextual validation information via context.Context. +// +// NOTE: +// - this method is not thread-safe it is intended that these all be registered prior to any validation +func (v *Validate) RegisterStructValidationCtx(fn StructLevelFuncCtx, types ...interface{}) { + + if v.structLevelFuncs == nil { + v.structLevelFuncs = make(map[reflect.Type]StructLevelFuncCtx) + } + + for _, t := range types { + tv := reflect.ValueOf(t) + if tv.Kind() == reflect.Ptr { + t = reflect.Indirect(tv).Interface() + } + + v.structLevelFuncs[reflect.TypeOf(t)] = fn + } +} + +// RegisterStructValidationMapRules registers validate map rules. +// Be aware that map validation rules supersede those defined on a/the struct if present. +// +// NOTE: this method is not thread-safe it is intended that these all be registered prior to any validation +func (v *Validate) RegisterStructValidationMapRules(rules map[string]string, types ...interface{}) { + if v.rules == nil { + v.rules = make(map[reflect.Type]map[string]string) + } + + deepCopyRules := make(map[string]string) + for i, rule := range rules { + deepCopyRules[i] = rule + } + + for _, t := range types { + typ := reflect.TypeOf(t) + + if typ.Kind() == reflect.Ptr { + typ = typ.Elem() + } + + if typ.Kind() != reflect.Struct { + continue + } + v.rules[typ] = deepCopyRules + } +} + +// RegisterCustomTypeFunc registers a CustomTypeFunc against a number of types +// +// NOTE: this method is not thread-safe it is intended that these all be registered prior to any validation +func (v *Validate) RegisterCustomTypeFunc(fn CustomTypeFunc, types ...interface{}) { + + if v.customFuncs == nil { + v.customFuncs = make(map[reflect.Type]CustomTypeFunc) + } + + for _, t := range types { + v.customFuncs[reflect.TypeOf(t)] = fn + } + + v.hasCustomFuncs = true +} + +// RegisterTranslation registers translations against the provided tag. +func (v *Validate) RegisterTranslation(tag string, trans ut.Translator, registerFn RegisterTranslationsFunc, translationFn TranslationFunc) (err error) { + + if v.transTagFunc == nil { + v.transTagFunc = make(map[ut.Translator]map[string]TranslationFunc) + } + + if err = registerFn(trans); err != nil { + return + } + + m, ok := v.transTagFunc[trans] + if !ok { + m = make(map[string]TranslationFunc) + v.transTagFunc[trans] = m + } + + m[tag] = translationFn + + return +} + +// Struct validates a structs exposed fields, and automatically validates nested structs, unless otherwise specified. +// +// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. +// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. +func (v *Validate) Struct(s interface{}) error { + return v.StructCtx(context.Background(), s) +} + +// StructCtx validates a structs exposed fields, and automatically validates nested structs, unless otherwise specified +// and also allows passing of context.Context for contextual validation information. +// +// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. +// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. +func (v *Validate) StructCtx(ctx context.Context, s interface{}) (err error) { + + val := reflect.ValueOf(s) + top := val + + if val.Kind() == reflect.Ptr && !val.IsNil() { + val = val.Elem() + } + + if val.Kind() != reflect.Struct || val.Type().ConvertibleTo(timeType) { + return &InvalidValidationError{Type: reflect.TypeOf(s)} + } + + // good to validate + vd := v.pool.Get().(*validate) + vd.top = top + vd.isPartial = false + // vd.hasExcludes = false // only need to reset in StructPartial and StructExcept + + vd.validateStruct(ctx, top, val, val.Type(), vd.ns[0:0], vd.actualNs[0:0], nil) + + if len(vd.errs) > 0 { + err = vd.errs + vd.errs = nil + } + + v.pool.Put(vd) + + return +} + +// StructFiltered validates a structs exposed fields, that pass the FilterFunc check and automatically validates +// nested structs, unless otherwise specified. +// +// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. +// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. +func (v *Validate) StructFiltered(s interface{}, fn FilterFunc) error { + return v.StructFilteredCtx(context.Background(), s, fn) +} + +// StructFilteredCtx validates a structs exposed fields, that pass the FilterFunc check and automatically validates +// nested structs, unless otherwise specified and also allows passing of contextual validation information via +// context.Context +// +// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. +// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. +func (v *Validate) StructFilteredCtx(ctx context.Context, s interface{}, fn FilterFunc) (err error) { + val := reflect.ValueOf(s) + top := val + + if val.Kind() == reflect.Ptr && !val.IsNil() { + val = val.Elem() + } + + if val.Kind() != reflect.Struct || val.Type().ConvertibleTo(timeType) { + return &InvalidValidationError{Type: reflect.TypeOf(s)} + } + + // good to validate + vd := v.pool.Get().(*validate) + vd.top = top + vd.isPartial = true + vd.ffn = fn + // vd.hasExcludes = false // only need to reset in StructPartial and StructExcept + + vd.validateStruct(ctx, top, val, val.Type(), vd.ns[0:0], vd.actualNs[0:0], nil) + + if len(vd.errs) > 0 { + err = vd.errs + vd.errs = nil + } + + v.pool.Put(vd) + + return +} + +// StructPartial validates the fields passed in only, ignoring all others. +// Fields may be provided in a namespaced fashion relative to the struct provided +// eg. NestedStruct.Field or NestedArrayField[0].Struct.Name +// +// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. +// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. +func (v *Validate) StructPartial(s interface{}, fields ...string) error { + return v.StructPartialCtx(context.Background(), s, fields...) +} + +// StructPartialCtx validates the fields passed in only, ignoring all others and allows passing of contextual +// validation validation information via context.Context +// Fields may be provided in a namespaced fashion relative to the struct provided +// eg. NestedStruct.Field or NestedArrayField[0].Struct.Name +// +// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. +// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. +func (v *Validate) StructPartialCtx(ctx context.Context, s interface{}, fields ...string) (err error) { + val := reflect.ValueOf(s) + top := val + + if val.Kind() == reflect.Ptr && !val.IsNil() { + val = val.Elem() + } + + if val.Kind() != reflect.Struct || val.Type().ConvertibleTo(timeType) { + return &InvalidValidationError{Type: reflect.TypeOf(s)} + } + + // good to validate + vd := v.pool.Get().(*validate) + vd.top = top + vd.isPartial = true + vd.ffn = nil + vd.hasExcludes = false + vd.includeExclude = make(map[string]struct{}) + + typ := val.Type() + name := typ.Name() + + for _, k := range fields { + + flds := strings.Split(k, namespaceSeparator) + if len(flds) > 0 { + + vd.misc = append(vd.misc[0:0], name...) + // Don't append empty name for unnamed structs + if len(vd.misc) != 0 { + vd.misc = append(vd.misc, '.') + } + + for _, s := range flds { + + idx := strings.Index(s, leftBracket) + + if idx != -1 { + for idx != -1 { + vd.misc = append(vd.misc, s[:idx]...) + vd.includeExclude[string(vd.misc)] = struct{}{} + + idx2 := strings.Index(s, rightBracket) + idx2++ + vd.misc = append(vd.misc, s[idx:idx2]...) + vd.includeExclude[string(vd.misc)] = struct{}{} + s = s[idx2:] + idx = strings.Index(s, leftBracket) + } + } else { + + vd.misc = append(vd.misc, s...) + vd.includeExclude[string(vd.misc)] = struct{}{} + } + + vd.misc = append(vd.misc, '.') + } + } + } + + vd.validateStruct(ctx, top, val, typ, vd.ns[0:0], vd.actualNs[0:0], nil) + + if len(vd.errs) > 0 { + err = vd.errs + vd.errs = nil + } + + v.pool.Put(vd) + + return +} + +// StructExcept validates all fields except the ones passed in. +// Fields may be provided in a namespaced fashion relative to the struct provided +// i.e. NestedStruct.Field or NestedArrayField[0].Struct.Name +// +// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. +// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. +func (v *Validate) StructExcept(s interface{}, fields ...string) error { + return v.StructExceptCtx(context.Background(), s, fields...) +} + +// StructExceptCtx validates all fields except the ones passed in and allows passing of contextual +// validation validation information via context.Context +// Fields may be provided in a namespaced fashion relative to the struct provided +// i.e. NestedStruct.Field or NestedArrayField[0].Struct.Name +// +// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. +// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. +func (v *Validate) StructExceptCtx(ctx context.Context, s interface{}, fields ...string) (err error) { + val := reflect.ValueOf(s) + top := val + + if val.Kind() == reflect.Ptr && !val.IsNil() { + val = val.Elem() + } + + if val.Kind() != reflect.Struct || val.Type().ConvertibleTo(timeType) { + return &InvalidValidationError{Type: reflect.TypeOf(s)} + } + + // good to validate + vd := v.pool.Get().(*validate) + vd.top = top + vd.isPartial = true + vd.ffn = nil + vd.hasExcludes = true + vd.includeExclude = make(map[string]struct{}) + + typ := val.Type() + name := typ.Name() + + for _, key := range fields { + + vd.misc = vd.misc[0:0] + + if len(name) > 0 { + vd.misc = append(vd.misc, name...) + vd.misc = append(vd.misc, '.') + } + + vd.misc = append(vd.misc, key...) + vd.includeExclude[string(vd.misc)] = struct{}{} + } + + vd.validateStruct(ctx, top, val, typ, vd.ns[0:0], vd.actualNs[0:0], nil) + + if len(vd.errs) > 0 { + err = vd.errs + vd.errs = nil + } + + v.pool.Put(vd) + + return +} + +// Var validates a single variable using tag style validation. +// eg. +// var i int +// validate.Var(i, "gt=1,lt=10") +// +// WARNING: a struct can be passed for validation eg. time.Time is a struct or +// if you have a custom type and have registered a custom type handler, so must +// allow it; however unforeseen validations will occur if trying to validate a +// struct that is meant to be passed to 'validate.Struct' +// +// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. +// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. +// validate Array, Slice and maps fields which may contain more than one error +func (v *Validate) Var(field interface{}, tag string) error { + return v.VarCtx(context.Background(), field, tag) +} + +// VarCtx validates a single variable using tag style validation and allows passing of contextual +// validation validation information via context.Context. +// eg. +// var i int +// validate.Var(i, "gt=1,lt=10") +// +// WARNING: a struct can be passed for validation eg. time.Time is a struct or +// if you have a custom type and have registered a custom type handler, so must +// allow it; however unforeseen validations will occur if trying to validate a +// struct that is meant to be passed to 'validate.Struct' +// +// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. +// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. +// validate Array, Slice and maps fields which may contain more than one error +func (v *Validate) VarCtx(ctx context.Context, field interface{}, tag string) (err error) { + if len(tag) == 0 || tag == skipValidationTag { + return nil + } + + ctag := v.fetchCacheTag(tag) + val := reflect.ValueOf(field) + vd := v.pool.Get().(*validate) + vd.top = val + vd.isPartial = false + vd.traverseField(ctx, val, val, vd.ns[0:0], vd.actualNs[0:0], defaultCField, ctag) + + if len(vd.errs) > 0 { + err = vd.errs + vd.errs = nil + } + v.pool.Put(vd) + return +} + +// VarWithValue validates a single variable, against another variable/field's value using tag style validation +// eg. +// s1 := "abcd" +// s2 := "abcd" +// validate.VarWithValue(s1, s2, "eqcsfield") // returns true +// +// WARNING: a struct can be passed for validation eg. time.Time is a struct or +// if you have a custom type and have registered a custom type handler, so must +// allow it; however unforeseen validations will occur if trying to validate a +// struct that is meant to be passed to 'validate.Struct' +// +// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. +// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. +// validate Array, Slice and maps fields which may contain more than one error +func (v *Validate) VarWithValue(field interface{}, other interface{}, tag string) error { + return v.VarWithValueCtx(context.Background(), field, other, tag) +} + +// VarWithValueCtx validates a single variable, against another variable/field's value using tag style validation and +// allows passing of contextual validation validation information via context.Context. +// eg. +// s1 := "abcd" +// s2 := "abcd" +// validate.VarWithValue(s1, s2, "eqcsfield") // returns true +// +// WARNING: a struct can be passed for validation eg. time.Time is a struct or +// if you have a custom type and have registered a custom type handler, so must +// allow it; however unforeseen validations will occur if trying to validate a +// struct that is meant to be passed to 'validate.Struct' +// +// It returns InvalidValidationError for bad values passed in and nil or ValidationErrors as error otherwise. +// You will need to assert the error if it's not nil eg. err.(validator.ValidationErrors) to access the array of errors. +// validate Array, Slice and maps fields which may contain more than one error +func (v *Validate) VarWithValueCtx(ctx context.Context, field interface{}, other interface{}, tag string) (err error) { + if len(tag) == 0 || tag == skipValidationTag { + return nil + } + ctag := v.fetchCacheTag(tag) + otherVal := reflect.ValueOf(other) + vd := v.pool.Get().(*validate) + vd.top = otherVal + vd.isPartial = false + vd.traverseField(ctx, otherVal, reflect.ValueOf(field), vd.ns[0:0], vd.actualNs[0:0], defaultCField, ctag) + + if len(vd.errs) > 0 { + err = vd.errs + vd.errs = nil + } + v.pool.Put(vd) + return +} diff --git a/vendor/github.com/gobwas/glob/.gitignore b/vendor/github.com/gobwas/glob/.gitignore new file mode 100644 index 0000000000..b4ae623be5 --- /dev/null +++ b/vendor/github.com/gobwas/glob/.gitignore @@ -0,0 +1,8 @@ +glob.iml +.idea +*.cpu +*.mem +*.test +*.dot +*.png +*.svg diff --git a/vendor/github.com/gobwas/glob/.travis.yml b/vendor/github.com/gobwas/glob/.travis.yml new file mode 100644 index 0000000000..e8a276826c --- /dev/null +++ b/vendor/github.com/gobwas/glob/.travis.yml @@ -0,0 +1,9 @@ +sudo: false + +language: go + +go: + - 1.5.3 + +script: + - go test -v ./... diff --git a/vendor/github.com/gobwas/glob/LICENSE b/vendor/github.com/gobwas/glob/LICENSE new file mode 100644 index 0000000000..9d4735cad9 --- /dev/null +++ b/vendor/github.com/gobwas/glob/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Sergey Kamardin + +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/gobwas/glob/bench.sh b/vendor/github.com/gobwas/glob/bench.sh new file mode 100644 index 0000000000..804cf22e64 --- /dev/null +++ b/vendor/github.com/gobwas/glob/bench.sh @@ -0,0 +1,26 @@ +#! /bin/bash + +bench() { + filename="/tmp/$1-$2.bench" + if test -e "${filename}"; + then + echo "Already exists ${filename}" + else + backup=`git rev-parse --abbrev-ref HEAD` + git checkout $1 + echo -n "Creating ${filename}... " + go test ./... -run=NONE -bench=$2 > "${filename}" -benchmem + echo "OK" + git checkout ${backup} + sleep 5 + fi +} + + +to=$1 +current=`git rev-parse --abbrev-ref HEAD` + +bench ${to} $2 +bench ${current} $2 + +benchcmp $3 "/tmp/${to}-$2.bench" "/tmp/${current}-$2.bench" diff --git a/vendor/github.com/gobwas/glob/compiler/compiler.go b/vendor/github.com/gobwas/glob/compiler/compiler.go new file mode 100644 index 0000000000..02e7de80a0 --- /dev/null +++ b/vendor/github.com/gobwas/glob/compiler/compiler.go @@ -0,0 +1,525 @@ +package compiler + +// TODO use constructor with all matchers, and to their structs private +// TODO glue multiple Text nodes (like after QuoteMeta) + +import ( + "fmt" + "reflect" + + "github.com/gobwas/glob/match" + "github.com/gobwas/glob/syntax/ast" + "github.com/gobwas/glob/util/runes" +) + +func optimizeMatcher(matcher match.Matcher) match.Matcher { + switch m := matcher.(type) { + + case match.Any: + if len(m.Separators) == 0 { + return match.NewSuper() + } + + case match.AnyOf: + if len(m.Matchers) == 1 { + return m.Matchers[0] + } + + return m + + case match.List: + if m.Not == false && len(m.List) == 1 { + return match.NewText(string(m.List)) + } + + return m + + case match.BTree: + m.Left = optimizeMatcher(m.Left) + m.Right = optimizeMatcher(m.Right) + + r, ok := m.Value.(match.Text) + if !ok { + return m + } + + var ( + leftNil = m.Left == nil + rightNil = m.Right == nil + ) + if leftNil && rightNil { + return match.NewText(r.Str) + } + + _, leftSuper := m.Left.(match.Super) + lp, leftPrefix := m.Left.(match.Prefix) + la, leftAny := m.Left.(match.Any) + + _, rightSuper := m.Right.(match.Super) + rs, rightSuffix := m.Right.(match.Suffix) + ra, rightAny := m.Right.(match.Any) + + switch { + case leftSuper && rightSuper: + return match.NewContains(r.Str, false) + + case leftSuper && rightNil: + return match.NewSuffix(r.Str) + + case rightSuper && leftNil: + return match.NewPrefix(r.Str) + + case leftNil && rightSuffix: + return match.NewPrefixSuffix(r.Str, rs.Suffix) + + case rightNil && leftPrefix: + return match.NewPrefixSuffix(lp.Prefix, r.Str) + + case rightNil && leftAny: + return match.NewSuffixAny(r.Str, la.Separators) + + case leftNil && rightAny: + return match.NewPrefixAny(r.Str, ra.Separators) + } + + return m + } + + return matcher +} + +func compileMatchers(matchers []match.Matcher) (match.Matcher, error) { + if len(matchers) == 0 { + return nil, fmt.Errorf("compile error: need at least one matcher") + } + if len(matchers) == 1 { + return matchers[0], nil + } + if m := glueMatchers(matchers); m != nil { + return m, nil + } + + idx := -1 + maxLen := -1 + var val match.Matcher + for i, matcher := range matchers { + if l := matcher.Len(); l != -1 && l >= maxLen { + maxLen = l + idx = i + val = matcher + } + } + + if val == nil { // not found matcher with static length + r, err := compileMatchers(matchers[1:]) + if err != nil { + return nil, err + } + return match.NewBTree(matchers[0], nil, r), nil + } + + left := matchers[:idx] + var right []match.Matcher + if len(matchers) > idx+1 { + right = matchers[idx+1:] + } + + var l, r match.Matcher + var err error + if len(left) > 0 { + l, err = compileMatchers(left) + if err != nil { + return nil, err + } + } + + if len(right) > 0 { + r, err = compileMatchers(right) + if err != nil { + return nil, err + } + } + + return match.NewBTree(val, l, r), nil +} + +func glueMatchers(matchers []match.Matcher) match.Matcher { + if m := glueMatchersAsEvery(matchers); m != nil { + return m + } + if m := glueMatchersAsRow(matchers); m != nil { + return m + } + return nil +} + +func glueMatchersAsRow(matchers []match.Matcher) match.Matcher { + if len(matchers) <= 1 { + return nil + } + + var ( + c []match.Matcher + l int + ) + for _, matcher := range matchers { + if ml := matcher.Len(); ml == -1 { + return nil + } else { + c = append(c, matcher) + l += ml + } + } + return match.NewRow(l, c...) +} + +func glueMatchersAsEvery(matchers []match.Matcher) match.Matcher { + if len(matchers) <= 1 { + return nil + } + + var ( + hasAny bool + hasSuper bool + hasSingle bool + min int + separator []rune + ) + + for i, matcher := range matchers { + var sep []rune + + switch m := matcher.(type) { + case match.Super: + sep = []rune{} + hasSuper = true + + case match.Any: + sep = m.Separators + hasAny = true + + case match.Single: + sep = m.Separators + hasSingle = true + min++ + + case match.List: + if !m.Not { + return nil + } + sep = m.List + hasSingle = true + min++ + + default: + return nil + } + + // initialize + if i == 0 { + separator = sep + } + + if runes.Equal(sep, separator) { + continue + } + + return nil + } + + if hasSuper && !hasAny && !hasSingle { + return match.NewSuper() + } + + if hasAny && !hasSuper && !hasSingle { + return match.NewAny(separator) + } + + if (hasAny || hasSuper) && min > 0 && len(separator) == 0 { + return match.NewMin(min) + } + + every := match.NewEveryOf() + + if min > 0 { + every.Add(match.NewMin(min)) + + if !hasAny && !hasSuper { + every.Add(match.NewMax(min)) + } + } + + if len(separator) > 0 { + every.Add(match.NewContains(string(separator), true)) + } + + return every +} + +func minimizeMatchers(matchers []match.Matcher) []match.Matcher { + var done match.Matcher + var left, right, count int + + for l := 0; l < len(matchers); l++ { + for r := len(matchers); r > l; r-- { + if glued := glueMatchers(matchers[l:r]); glued != nil { + var swap bool + + if done == nil { + swap = true + } else { + cl, gl := done.Len(), glued.Len() + swap = cl > -1 && gl > -1 && gl > cl + swap = swap || count < r-l + } + + if swap { + done = glued + left = l + right = r + count = r - l + } + } + } + } + + if done == nil { + return matchers + } + + next := append(append([]match.Matcher{}, matchers[:left]...), done) + if right < len(matchers) { + next = append(next, matchers[right:]...) + } + + if len(next) == len(matchers) { + return next + } + + return minimizeMatchers(next) +} + +// minimizeAnyOf tries to apply some heuristics to minimize number of nodes in given tree +func minimizeTree(tree *ast.Node) *ast.Node { + switch tree.Kind { + case ast.KindAnyOf: + return minimizeTreeAnyOf(tree) + default: + return nil + } +} + +// minimizeAnyOf tries to find common children of given node of AnyOf pattern +// it searches for common children from left and from right +// if any common children are found – then it returns new optimized ast tree +// else it returns nil +func minimizeTreeAnyOf(tree *ast.Node) *ast.Node { + if !areOfSameKind(tree.Children, ast.KindPattern) { + return nil + } + + commonLeft, commonRight := commonChildren(tree.Children) + commonLeftCount, commonRightCount := len(commonLeft), len(commonRight) + if commonLeftCount == 0 && commonRightCount == 0 { // there are no common parts + return nil + } + + var result []*ast.Node + if commonLeftCount > 0 { + result = append(result, ast.NewNode(ast.KindPattern, nil, commonLeft...)) + } + + var anyOf []*ast.Node + for _, child := range tree.Children { + reuse := child.Children[commonLeftCount : len(child.Children)-commonRightCount] + var node *ast.Node + if len(reuse) == 0 { + // this pattern is completely reduced by commonLeft and commonRight patterns + // so it become nothing + node = ast.NewNode(ast.KindNothing, nil) + } else { + node = ast.NewNode(ast.KindPattern, nil, reuse...) + } + anyOf = appendIfUnique(anyOf, node) + } + switch { + case len(anyOf) == 1 && anyOf[0].Kind != ast.KindNothing: + result = append(result, anyOf[0]) + case len(anyOf) > 1: + result = append(result, ast.NewNode(ast.KindAnyOf, nil, anyOf...)) + } + + if commonRightCount > 0 { + result = append(result, ast.NewNode(ast.KindPattern, nil, commonRight...)) + } + + return ast.NewNode(ast.KindPattern, nil, result...) +} + +func commonChildren(nodes []*ast.Node) (commonLeft, commonRight []*ast.Node) { + if len(nodes) <= 1 { + return + } + + // find node that has least number of children + idx := leastChildren(nodes) + if idx == -1 { + return + } + tree := nodes[idx] + treeLength := len(tree.Children) + + // allocate max able size for rightCommon slice + // to get ability insert elements in reverse order (from end to start) + // without sorting + commonRight = make([]*ast.Node, treeLength) + lastRight := treeLength // will use this to get results as commonRight[lastRight:] + + var ( + breakLeft bool + breakRight bool + commonTotal int + ) + for i, j := 0, treeLength-1; commonTotal < treeLength && j >= 0 && !(breakLeft && breakRight); i, j = i+1, j-1 { + treeLeft := tree.Children[i] + treeRight := tree.Children[j] + + for k := 0; k < len(nodes) && !(breakLeft && breakRight); k++ { + // skip least children node + if k == idx { + continue + } + + restLeft := nodes[k].Children[i] + restRight := nodes[k].Children[j+len(nodes[k].Children)-treeLength] + + breakLeft = breakLeft || !treeLeft.Equal(restLeft) + + // disable searching for right common parts, if left part is already overlapping + breakRight = breakRight || (!breakLeft && j <= i) + breakRight = breakRight || !treeRight.Equal(restRight) + } + + if !breakLeft { + commonTotal++ + commonLeft = append(commonLeft, treeLeft) + } + if !breakRight { + commonTotal++ + lastRight = j + commonRight[j] = treeRight + } + } + + commonRight = commonRight[lastRight:] + + return +} + +func appendIfUnique(target []*ast.Node, val *ast.Node) []*ast.Node { + for _, n := range target { + if reflect.DeepEqual(n, val) { + return target + } + } + return append(target, val) +} + +func areOfSameKind(nodes []*ast.Node, kind ast.Kind) bool { + for _, n := range nodes { + if n.Kind != kind { + return false + } + } + return true +} + +func leastChildren(nodes []*ast.Node) int { + min := -1 + idx := -1 + for i, n := range nodes { + if idx == -1 || (len(n.Children) < min) { + min = len(n.Children) + idx = i + } + } + return idx +} + +func compileTreeChildren(tree *ast.Node, sep []rune) ([]match.Matcher, error) { + var matchers []match.Matcher + for _, desc := range tree.Children { + m, err := compile(desc, sep) + if err != nil { + return nil, err + } + matchers = append(matchers, optimizeMatcher(m)) + } + return matchers, nil +} + +func compile(tree *ast.Node, sep []rune) (m match.Matcher, err error) { + switch tree.Kind { + case ast.KindAnyOf: + // todo this could be faster on pattern_alternatives_combine_lite (see glob_test.go) + if n := minimizeTree(tree); n != nil { + return compile(n, sep) + } + matchers, err := compileTreeChildren(tree, sep) + if err != nil { + return nil, err + } + return match.NewAnyOf(matchers...), nil + + case ast.KindPattern: + if len(tree.Children) == 0 { + return match.NewNothing(), nil + } + matchers, err := compileTreeChildren(tree, sep) + if err != nil { + return nil, err + } + m, err = compileMatchers(minimizeMatchers(matchers)) + if err != nil { + return nil, err + } + + case ast.KindAny: + m = match.NewAny(sep) + + case ast.KindSuper: + m = match.NewSuper() + + case ast.KindSingle: + m = match.NewSingle(sep) + + case ast.KindNothing: + m = match.NewNothing() + + case ast.KindList: + l := tree.Value.(ast.List) + m = match.NewList([]rune(l.Chars), l.Not) + + case ast.KindRange: + r := tree.Value.(ast.Range) + m = match.NewRange(r.Lo, r.Hi, r.Not) + + case ast.KindText: + t := tree.Value.(ast.Text) + m = match.NewText(t.Text) + + default: + return nil, fmt.Errorf("could not compile tree: unknown node type") + } + + return optimizeMatcher(m), nil +} + +func Compile(tree *ast.Node, sep []rune) (match.Matcher, error) { + m, err := compile(tree, sep) + if err != nil { + return nil, err + } + + return m, nil +} diff --git a/vendor/github.com/gobwas/glob/glob.go b/vendor/github.com/gobwas/glob/glob.go new file mode 100644 index 0000000000..2afde343af --- /dev/null +++ b/vendor/github.com/gobwas/glob/glob.go @@ -0,0 +1,80 @@ +package glob + +import ( + "github.com/gobwas/glob/compiler" + "github.com/gobwas/glob/syntax" +) + +// Glob represents compiled glob pattern. +type Glob interface { + Match(string) bool +} + +// Compile creates Glob for given pattern and strings (if any present after pattern) as separators. +// The pattern syntax is: +// +// pattern: +// { term } +// +// term: +// `*` matches any sequence of non-separator characters +// `**` matches any sequence of characters +// `?` matches any single non-separator character +// `[` [ `!` ] { character-range } `]` +// character class (must be non-empty) +// `{` pattern-list `}` +// pattern alternatives +// c matches character c (c != `*`, `**`, `?`, `\`, `[`, `{`, `}`) +// `\` c matches character c +// +// character-range: +// c matches character c (c != `\\`, `-`, `]`) +// `\` c matches character c +// lo `-` hi matches character c for lo <= c <= hi +// +// pattern-list: +// pattern { `,` pattern } +// comma-separated (without spaces) patterns +// +func Compile(pattern string, separators ...rune) (Glob, error) { + ast, err := syntax.Parse(pattern) + if err != nil { + return nil, err + } + + matcher, err := compiler.Compile(ast, separators) + if err != nil { + return nil, err + } + + return matcher, nil +} + +// MustCompile is the same as Compile, except that if Compile returns error, this will panic +func MustCompile(pattern string, separators ...rune) Glob { + g, err := Compile(pattern, separators...) + if err != nil { + panic(err) + } + + return g +} + +// QuoteMeta returns a string that quotes all glob pattern meta characters +// inside the argument text; For example, QuoteMeta(`{foo*}`) returns `\[foo\*\]`. +func QuoteMeta(s string) string { + b := make([]byte, 2*len(s)) + + // a byte loop is correct because all meta characters are ASCII + j := 0 + for i := 0; i < len(s); i++ { + if syntax.Special(s[i]) { + b[j] = '\\' + j++ + } + b[j] = s[i] + j++ + } + + return string(b[0:j]) +} diff --git a/vendor/github.com/gobwas/glob/match/any.go b/vendor/github.com/gobwas/glob/match/any.go new file mode 100644 index 0000000000..514a9a5c45 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/any.go @@ -0,0 +1,45 @@ +package match + +import ( + "fmt" + "github.com/gobwas/glob/util/strings" +) + +type Any struct { + Separators []rune +} + +func NewAny(s []rune) Any { + return Any{s} +} + +func (self Any) Match(s string) bool { + return strings.IndexAnyRunes(s, self.Separators) == -1 +} + +func (self Any) Index(s string) (int, []int) { + found := strings.IndexAnyRunes(s, self.Separators) + switch found { + case -1: + case 0: + return 0, segments0 + default: + s = s[:found] + } + + segments := acquireSegments(len(s)) + for i := range s { + segments = append(segments, i) + } + segments = append(segments, len(s)) + + return 0, segments +} + +func (self Any) Len() int { + return lenNo +} + +func (self Any) String() string { + return fmt.Sprintf("", string(self.Separators)) +} diff --git a/vendor/github.com/gobwas/glob/match/any_of.go b/vendor/github.com/gobwas/glob/match/any_of.go new file mode 100644 index 0000000000..8e65356cdc --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/any_of.go @@ -0,0 +1,82 @@ +package match + +import "fmt" + +type AnyOf struct { + Matchers Matchers +} + +func NewAnyOf(m ...Matcher) AnyOf { + return AnyOf{Matchers(m)} +} + +func (self *AnyOf) Add(m Matcher) error { + self.Matchers = append(self.Matchers, m) + return nil +} + +func (self AnyOf) Match(s string) bool { + for _, m := range self.Matchers { + if m.Match(s) { + return true + } + } + + return false +} + +func (self AnyOf) Index(s string) (int, []int) { + index := -1 + + segments := acquireSegments(len(s)) + for _, m := range self.Matchers { + idx, seg := m.Index(s) + if idx == -1 { + continue + } + + if index == -1 || idx < index { + index = idx + segments = append(segments[:0], seg...) + continue + } + + if idx > index { + continue + } + + // here idx == index + segments = appendMerge(segments, seg) + } + + if index == -1 { + releaseSegments(segments) + return -1, nil + } + + return index, segments +} + +func (self AnyOf) Len() (l int) { + l = -1 + for _, m := range self.Matchers { + ml := m.Len() + switch { + case l == -1: + l = ml + continue + + case ml == -1: + return -1 + + case l != ml: + return -1 + } + } + + return +} + +func (self AnyOf) String() string { + return fmt.Sprintf("", self.Matchers) +} diff --git a/vendor/github.com/gobwas/glob/match/btree.go b/vendor/github.com/gobwas/glob/match/btree.go new file mode 100644 index 0000000000..a8130e93ea --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/btree.go @@ -0,0 +1,146 @@ +package match + +import ( + "fmt" + "unicode/utf8" +) + +type BTree struct { + Value Matcher + Left Matcher + Right Matcher + ValueLengthRunes int + LeftLengthRunes int + RightLengthRunes int + LengthRunes int +} + +func NewBTree(Value, Left, Right Matcher) (tree BTree) { + tree.Value = Value + tree.Left = Left + tree.Right = Right + + lenOk := true + if tree.ValueLengthRunes = Value.Len(); tree.ValueLengthRunes == -1 { + lenOk = false + } + + if Left != nil { + if tree.LeftLengthRunes = Left.Len(); tree.LeftLengthRunes == -1 { + lenOk = false + } + } + + if Right != nil { + if tree.RightLengthRunes = Right.Len(); tree.RightLengthRunes == -1 { + lenOk = false + } + } + + if lenOk { + tree.LengthRunes = tree.LeftLengthRunes + tree.ValueLengthRunes + tree.RightLengthRunes + } else { + tree.LengthRunes = -1 + } + + return tree +} + +func (self BTree) Len() int { + return self.LengthRunes +} + +// todo? +func (self BTree) Index(s string) (int, []int) { + return -1, nil +} + +func (self BTree) Match(s string) bool { + inputLen := len(s) + + // self.Length, self.RLen and self.LLen are values meaning the length of runes for each part + // here we manipulating byte length for better optimizations + // but these checks still works, cause minLen of 1-rune string is 1 byte. + if self.LengthRunes != -1 && self.LengthRunes > inputLen { + return false + } + + // try to cut unnecessary parts + // by knowledge of length of right and left part + var offset, limit int + if self.LeftLengthRunes >= 0 { + offset = self.LeftLengthRunes + } + if self.RightLengthRunes >= 0 { + limit = inputLen - self.RightLengthRunes + } else { + limit = inputLen + } + + for offset < limit { + // search for matching part in substring + index, segments := self.Value.Index(s[offset:limit]) + if index == -1 { + releaseSegments(segments) + return false + } + + l := s[:offset+index] + var left bool + if self.Left != nil { + left = self.Left.Match(l) + } else { + left = l == "" + } + + if left { + for i := len(segments) - 1; i >= 0; i-- { + length := segments[i] + + var right bool + var r string + // if there is no string for the right branch + if inputLen <= offset+index+length { + r = "" + } else { + r = s[offset+index+length:] + } + + if self.Right != nil { + right = self.Right.Match(r) + } else { + right = r == "" + } + + if right { + releaseSegments(segments) + return true + } + } + } + + _, step := utf8.DecodeRuneInString(s[offset+index:]) + offset += index + step + + releaseSegments(segments) + } + + return false +} + +func (self BTree) String() string { + const n string = "" + var l, r string + if self.Left == nil { + l = n + } else { + l = self.Left.String() + } + if self.Right == nil { + r = n + } else { + r = self.Right.String() + } + + return fmt.Sprintf("%s]>", l, self.Value, r) +} diff --git a/vendor/github.com/gobwas/glob/match/contains.go b/vendor/github.com/gobwas/glob/match/contains.go new file mode 100644 index 0000000000..0998e95b0e --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/contains.go @@ -0,0 +1,58 @@ +package match + +import ( + "fmt" + "strings" +) + +type Contains struct { + Needle string + Not bool +} + +func NewContains(needle string, not bool) Contains { + return Contains{needle, not} +} + +func (self Contains) Match(s string) bool { + return strings.Contains(s, self.Needle) != self.Not +} + +func (self Contains) Index(s string) (int, []int) { + var offset int + + idx := strings.Index(s, self.Needle) + + if !self.Not { + if idx == -1 { + return -1, nil + } + + offset = idx + len(self.Needle) + if len(s) <= offset { + return 0, []int{offset} + } + s = s[offset:] + } else if idx != -1 { + s = s[:idx] + } + + segments := acquireSegments(len(s) + 1) + for i := range s { + segments = append(segments, offset+i) + } + + return 0, append(segments, offset+len(s)) +} + +func (self Contains) Len() int { + return lenNo +} + +func (self Contains) String() string { + var not string + if self.Not { + not = "!" + } + return fmt.Sprintf("", not, self.Needle) +} diff --git a/vendor/github.com/gobwas/glob/match/every_of.go b/vendor/github.com/gobwas/glob/match/every_of.go new file mode 100644 index 0000000000..7c968ee368 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/every_of.go @@ -0,0 +1,99 @@ +package match + +import ( + "fmt" +) + +type EveryOf struct { + Matchers Matchers +} + +func NewEveryOf(m ...Matcher) EveryOf { + return EveryOf{Matchers(m)} +} + +func (self *EveryOf) Add(m Matcher) error { + self.Matchers = append(self.Matchers, m) + return nil +} + +func (self EveryOf) Len() (l int) { + for _, m := range self.Matchers { + if ml := m.Len(); l > 0 { + l += ml + } else { + return -1 + } + } + + return +} + +func (self EveryOf) Index(s string) (int, []int) { + var index int + var offset int + + // make `in` with cap as len(s), + // cause it is the maximum size of output segments values + next := acquireSegments(len(s)) + current := acquireSegments(len(s)) + + sub := s + for i, m := range self.Matchers { + idx, seg := m.Index(sub) + if idx == -1 { + releaseSegments(next) + releaseSegments(current) + return -1, nil + } + + if i == 0 { + // we use copy here instead of `current = seg` + // cause seg is a slice from reusable buffer `in` + // and it could be overwritten in next iteration + current = append(current, seg...) + } else { + // clear the next + next = next[:0] + + delta := index - (idx + offset) + for _, ex := range current { + for _, n := range seg { + if ex+delta == n { + next = append(next, n) + } + } + } + + if len(next) == 0 { + releaseSegments(next) + releaseSegments(current) + return -1, nil + } + + current = append(current[:0], next...) + } + + index = idx + offset + sub = s[index:] + offset += idx + } + + releaseSegments(next) + + return index, current +} + +func (self EveryOf) Match(s string) bool { + for _, m := range self.Matchers { + if !m.Match(s) { + return false + } + } + + return true +} + +func (self EveryOf) String() string { + return fmt.Sprintf("", self.Matchers) +} diff --git a/vendor/github.com/gobwas/glob/match/list.go b/vendor/github.com/gobwas/glob/match/list.go new file mode 100644 index 0000000000..7fd763ecd8 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/list.go @@ -0,0 +1,49 @@ +package match + +import ( + "fmt" + "github.com/gobwas/glob/util/runes" + "unicode/utf8" +) + +type List struct { + List []rune + Not bool +} + +func NewList(list []rune, not bool) List { + return List{list, not} +} + +func (self List) Match(s string) bool { + r, w := utf8.DecodeRuneInString(s) + if len(s) > w { + return false + } + + inList := runes.IndexRune(self.List, r) != -1 + return inList == !self.Not +} + +func (self List) Len() int { + return lenOne +} + +func (self List) Index(s string) (int, []int) { + for i, r := range s { + if self.Not == (runes.IndexRune(self.List, r) == -1) { + return i, segmentsByRuneLength[utf8.RuneLen(r)] + } + } + + return -1, nil +} + +func (self List) String() string { + var not string + if self.Not { + not = "!" + } + + return fmt.Sprintf("", not, string(self.List)) +} diff --git a/vendor/github.com/gobwas/glob/match/match.go b/vendor/github.com/gobwas/glob/match/match.go new file mode 100644 index 0000000000..f80e007fb8 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/match.go @@ -0,0 +1,81 @@ +package match + +// todo common table of rune's length + +import ( + "fmt" + "strings" +) + +const lenOne = 1 +const lenZero = 0 +const lenNo = -1 + +type Matcher interface { + Match(string) bool + Index(string) (int, []int) + Len() int + String() string +} + +type Matchers []Matcher + +func (m Matchers) String() string { + var s []string + for _, matcher := range m { + s = append(s, fmt.Sprint(matcher)) + } + + return fmt.Sprintf("%s", strings.Join(s, ",")) +} + +// appendMerge merges and sorts given already SORTED and UNIQUE segments. +func appendMerge(target, sub []int) []int { + lt, ls := len(target), len(sub) + out := make([]int, 0, lt+ls) + + for x, y := 0, 0; x < lt || y < ls; { + if x >= lt { + out = append(out, sub[y:]...) + break + } + + if y >= ls { + out = append(out, target[x:]...) + break + } + + xValue := target[x] + yValue := sub[y] + + switch { + + case xValue == yValue: + out = append(out, xValue) + x++ + y++ + + case xValue < yValue: + out = append(out, xValue) + x++ + + case yValue < xValue: + out = append(out, yValue) + y++ + + } + } + + target = append(target[:0], out...) + + return target +} + +func reverseSegments(input []int) { + l := len(input) + m := l / 2 + + for i := 0; i < m; i++ { + input[i], input[l-i-1] = input[l-i-1], input[i] + } +} diff --git a/vendor/github.com/gobwas/glob/match/max.go b/vendor/github.com/gobwas/glob/match/max.go new file mode 100644 index 0000000000..d72f69efff --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/max.go @@ -0,0 +1,49 @@ +package match + +import ( + "fmt" + "unicode/utf8" +) + +type Max struct { + Limit int +} + +func NewMax(l int) Max { + return Max{l} +} + +func (self Max) Match(s string) bool { + var l int + for range s { + l += 1 + if l > self.Limit { + return false + } + } + + return true +} + +func (self Max) Index(s string) (int, []int) { + segments := acquireSegments(self.Limit + 1) + segments = append(segments, 0) + var count int + for i, r := range s { + count++ + if count > self.Limit { + break + } + segments = append(segments, i+utf8.RuneLen(r)) + } + + return 0, segments +} + +func (self Max) Len() int { + return lenNo +} + +func (self Max) String() string { + return fmt.Sprintf("", self.Limit) +} diff --git a/vendor/github.com/gobwas/glob/match/min.go b/vendor/github.com/gobwas/glob/match/min.go new file mode 100644 index 0000000000..db57ac8eb4 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/min.go @@ -0,0 +1,57 @@ +package match + +import ( + "fmt" + "unicode/utf8" +) + +type Min struct { + Limit int +} + +func NewMin(l int) Min { + return Min{l} +} + +func (self Min) Match(s string) bool { + var l int + for range s { + l += 1 + if l >= self.Limit { + return true + } + } + + return false +} + +func (self Min) Index(s string) (int, []int) { + var count int + + c := len(s) - self.Limit + 1 + if c <= 0 { + return -1, nil + } + + segments := acquireSegments(c) + for i, r := range s { + count++ + if count >= self.Limit { + segments = append(segments, i+utf8.RuneLen(r)) + } + } + + if len(segments) == 0 { + return -1, nil + } + + return 0, segments +} + +func (self Min) Len() int { + return lenNo +} + +func (self Min) String() string { + return fmt.Sprintf("", self.Limit) +} diff --git a/vendor/github.com/gobwas/glob/match/nothing.go b/vendor/github.com/gobwas/glob/match/nothing.go new file mode 100644 index 0000000000..0d4ecd36b8 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/nothing.go @@ -0,0 +1,27 @@ +package match + +import ( + "fmt" +) + +type Nothing struct{} + +func NewNothing() Nothing { + return Nothing{} +} + +func (self Nothing) Match(s string) bool { + return len(s) == 0 +} + +func (self Nothing) Index(s string) (int, []int) { + return 0, segments0 +} + +func (self Nothing) Len() int { + return lenZero +} + +func (self Nothing) String() string { + return fmt.Sprintf("") +} diff --git a/vendor/github.com/gobwas/glob/match/prefix.go b/vendor/github.com/gobwas/glob/match/prefix.go new file mode 100644 index 0000000000..a7347250e8 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/prefix.go @@ -0,0 +1,50 @@ +package match + +import ( + "fmt" + "strings" + "unicode/utf8" +) + +type Prefix struct { + Prefix string +} + +func NewPrefix(p string) Prefix { + return Prefix{p} +} + +func (self Prefix) Index(s string) (int, []int) { + idx := strings.Index(s, self.Prefix) + if idx == -1 { + return -1, nil + } + + length := len(self.Prefix) + var sub string + if len(s) > idx+length { + sub = s[idx+length:] + } else { + sub = "" + } + + segments := acquireSegments(len(sub) + 1) + segments = append(segments, length) + for i, r := range sub { + segments = append(segments, length+i+utf8.RuneLen(r)) + } + + return idx, segments +} + +func (self Prefix) Len() int { + return lenNo +} + +func (self Prefix) Match(s string) bool { + return strings.HasPrefix(s, self.Prefix) +} + +func (self Prefix) String() string { + return fmt.Sprintf("", self.Prefix) +} diff --git a/vendor/github.com/gobwas/glob/match/prefix_any.go b/vendor/github.com/gobwas/glob/match/prefix_any.go new file mode 100644 index 0000000000..8ee58fe1b3 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/prefix_any.go @@ -0,0 +1,55 @@ +package match + +import ( + "fmt" + "strings" + "unicode/utf8" + + sutil "github.com/gobwas/glob/util/strings" +) + +type PrefixAny struct { + Prefix string + Separators []rune +} + +func NewPrefixAny(s string, sep []rune) PrefixAny { + return PrefixAny{s, sep} +} + +func (self PrefixAny) Index(s string) (int, []int) { + idx := strings.Index(s, self.Prefix) + if idx == -1 { + return -1, nil + } + + n := len(self.Prefix) + sub := s[idx+n:] + i := sutil.IndexAnyRunes(sub, self.Separators) + if i > -1 { + sub = sub[:i] + } + + seg := acquireSegments(len(sub) + 1) + seg = append(seg, n) + for i, r := range sub { + seg = append(seg, n+i+utf8.RuneLen(r)) + } + + return idx, seg +} + +func (self PrefixAny) Len() int { + return lenNo +} + +func (self PrefixAny) Match(s string) bool { + if !strings.HasPrefix(s, self.Prefix) { + return false + } + return sutil.IndexAnyRunes(s[len(self.Prefix):], self.Separators) == -1 +} + +func (self PrefixAny) String() string { + return fmt.Sprintf("", self.Prefix, string(self.Separators)) +} diff --git a/vendor/github.com/gobwas/glob/match/prefix_suffix.go b/vendor/github.com/gobwas/glob/match/prefix_suffix.go new file mode 100644 index 0000000000..8208085a19 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/prefix_suffix.go @@ -0,0 +1,62 @@ +package match + +import ( + "fmt" + "strings" +) + +type PrefixSuffix struct { + Prefix, Suffix string +} + +func NewPrefixSuffix(p, s string) PrefixSuffix { + return PrefixSuffix{p, s} +} + +func (self PrefixSuffix) Index(s string) (int, []int) { + prefixIdx := strings.Index(s, self.Prefix) + if prefixIdx == -1 { + return -1, nil + } + + suffixLen := len(self.Suffix) + if suffixLen <= 0 { + return prefixIdx, []int{len(s) - prefixIdx} + } + + if (len(s) - prefixIdx) <= 0 { + return -1, nil + } + + segments := acquireSegments(len(s) - prefixIdx) + for sub := s[prefixIdx:]; ; { + suffixIdx := strings.LastIndex(sub, self.Suffix) + if suffixIdx == -1 { + break + } + + segments = append(segments, suffixIdx+suffixLen) + sub = sub[:suffixIdx] + } + + if len(segments) == 0 { + releaseSegments(segments) + return -1, nil + } + + reverseSegments(segments) + + return prefixIdx, segments +} + +func (self PrefixSuffix) Len() int { + return lenNo +} + +func (self PrefixSuffix) Match(s string) bool { + return strings.HasPrefix(s, self.Prefix) && strings.HasSuffix(s, self.Suffix) +} + +func (self PrefixSuffix) String() string { + return fmt.Sprintf("", self.Prefix, self.Suffix) +} diff --git a/vendor/github.com/gobwas/glob/match/range.go b/vendor/github.com/gobwas/glob/match/range.go new file mode 100644 index 0000000000..ce30245a40 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/range.go @@ -0,0 +1,48 @@ +package match + +import ( + "fmt" + "unicode/utf8" +) + +type Range struct { + Lo, Hi rune + Not bool +} + +func NewRange(lo, hi rune, not bool) Range { + return Range{lo, hi, not} +} + +func (self Range) Len() int { + return lenOne +} + +func (self Range) Match(s string) bool { + r, w := utf8.DecodeRuneInString(s) + if len(s) > w { + return false + } + + inRange := r >= self.Lo && r <= self.Hi + + return inRange == !self.Not +} + +func (self Range) Index(s string) (int, []int) { + for i, r := range s { + if self.Not != (r >= self.Lo && r <= self.Hi) { + return i, segmentsByRuneLength[utf8.RuneLen(r)] + } + } + + return -1, nil +} + +func (self Range) String() string { + var not string + if self.Not { + not = "!" + } + return fmt.Sprintf("", not, string(self.Lo), string(self.Hi)) +} diff --git a/vendor/github.com/gobwas/glob/match/row.go b/vendor/github.com/gobwas/glob/match/row.go new file mode 100644 index 0000000000..4379042e42 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/row.go @@ -0,0 +1,77 @@ +package match + +import ( + "fmt" +) + +type Row struct { + Matchers Matchers + RunesLength int + Segments []int +} + +func NewRow(len int, m ...Matcher) Row { + return Row{ + Matchers: Matchers(m), + RunesLength: len, + Segments: []int{len}, + } +} + +func (self Row) matchAll(s string) bool { + var idx int + for _, m := range self.Matchers { + length := m.Len() + + var next, i int + for next = range s[idx:] { + i++ + if i == length { + break + } + } + + if i < length || !m.Match(s[idx:idx+next+1]) { + return false + } + + idx += next + 1 + } + + return true +} + +func (self Row) lenOk(s string) bool { + var i int + for range s { + i++ + if i > self.RunesLength { + return false + } + } + return self.RunesLength == i +} + +func (self Row) Match(s string) bool { + return self.lenOk(s) && self.matchAll(s) +} + +func (self Row) Len() (l int) { + return self.RunesLength +} + +func (self Row) Index(s string) (int, []int) { + for i := range s { + if len(s[i:]) < self.RunesLength { + break + } + if self.matchAll(s[i:]) { + return i, self.Segments + } + } + return -1, nil +} + +func (self Row) String() string { + return fmt.Sprintf("", self.RunesLength, self.Matchers) +} diff --git a/vendor/github.com/gobwas/glob/match/segments.go b/vendor/github.com/gobwas/glob/match/segments.go new file mode 100644 index 0000000000..9ea6f30943 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/segments.go @@ -0,0 +1,91 @@ +package match + +import ( + "sync" +) + +type SomePool interface { + Get() []int + Put([]int) +} + +var segmentsPools [1024]sync.Pool + +func toPowerOfTwo(v int) int { + v-- + v |= v >> 1 + v |= v >> 2 + v |= v >> 4 + v |= v >> 8 + v |= v >> 16 + v++ + + return v +} + +const ( + cacheFrom = 16 + cacheToAndHigher = 1024 + cacheFromIndex = 15 + cacheToAndHigherIndex = 1023 +) + +var ( + segments0 = []int{0} + segments1 = []int{1} + segments2 = []int{2} + segments3 = []int{3} + segments4 = []int{4} +) + +var segmentsByRuneLength [5][]int = [5][]int{ + 0: segments0, + 1: segments1, + 2: segments2, + 3: segments3, + 4: segments4, +} + +func init() { + for i := cacheToAndHigher; i >= cacheFrom; i >>= 1 { + func(i int) { + segmentsPools[i-1] = sync.Pool{New: func() interface{} { + return make([]int, 0, i) + }} + }(i) + } +} + +func getTableIndex(c int) int { + p := toPowerOfTwo(c) + switch { + case p >= cacheToAndHigher: + return cacheToAndHigherIndex + case p <= cacheFrom: + return cacheFromIndex + default: + return p - 1 + } +} + +func acquireSegments(c int) []int { + // make []int with less capacity than cacheFrom + // is faster than acquiring it from pool + if c < cacheFrom { + return make([]int, 0, c) + } + + return segmentsPools[getTableIndex(c)].Get().([]int)[:0] +} + +func releaseSegments(s []int) { + c := cap(s) + + // make []int with less capacity than cacheFrom + // is faster than acquiring it from pool + if c < cacheFrom { + return + } + + segmentsPools[getTableIndex(c)].Put(s) +} diff --git a/vendor/github.com/gobwas/glob/match/single.go b/vendor/github.com/gobwas/glob/match/single.go new file mode 100644 index 0000000000..ee6e3954c1 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/single.go @@ -0,0 +1,43 @@ +package match + +import ( + "fmt" + "github.com/gobwas/glob/util/runes" + "unicode/utf8" +) + +// single represents ? +type Single struct { + Separators []rune +} + +func NewSingle(s []rune) Single { + return Single{s} +} + +func (self Single) Match(s string) bool { + r, w := utf8.DecodeRuneInString(s) + if len(s) > w { + return false + } + + return runes.IndexRune(self.Separators, r) == -1 +} + +func (self Single) Len() int { + return lenOne +} + +func (self Single) Index(s string) (int, []int) { + for i, r := range s { + if runes.IndexRune(self.Separators, r) == -1 { + return i, segmentsByRuneLength[utf8.RuneLen(r)] + } + } + + return -1, nil +} + +func (self Single) String() string { + return fmt.Sprintf("", string(self.Separators)) +} diff --git a/vendor/github.com/gobwas/glob/match/suffix.go b/vendor/github.com/gobwas/glob/match/suffix.go new file mode 100644 index 0000000000..85bea8c68e --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/suffix.go @@ -0,0 +1,35 @@ +package match + +import ( + "fmt" + "strings" +) + +type Suffix struct { + Suffix string +} + +func NewSuffix(s string) Suffix { + return Suffix{s} +} + +func (self Suffix) Len() int { + return lenNo +} + +func (self Suffix) Match(s string) bool { + return strings.HasSuffix(s, self.Suffix) +} + +func (self Suffix) Index(s string) (int, []int) { + idx := strings.Index(s, self.Suffix) + if idx == -1 { + return -1, nil + } + + return 0, []int{idx + len(self.Suffix)} +} + +func (self Suffix) String() string { + return fmt.Sprintf("", self.Suffix) +} diff --git a/vendor/github.com/gobwas/glob/match/suffix_any.go b/vendor/github.com/gobwas/glob/match/suffix_any.go new file mode 100644 index 0000000000..c5106f8196 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/suffix_any.go @@ -0,0 +1,43 @@ +package match + +import ( + "fmt" + "strings" + + sutil "github.com/gobwas/glob/util/strings" +) + +type SuffixAny struct { + Suffix string + Separators []rune +} + +func NewSuffixAny(s string, sep []rune) SuffixAny { + return SuffixAny{s, sep} +} + +func (self SuffixAny) Index(s string) (int, []int) { + idx := strings.Index(s, self.Suffix) + if idx == -1 { + return -1, nil + } + + i := sutil.LastIndexAnyRunes(s[:idx], self.Separators) + 1 + + return i, []int{idx + len(self.Suffix) - i} +} + +func (self SuffixAny) Len() int { + return lenNo +} + +func (self SuffixAny) Match(s string) bool { + if !strings.HasSuffix(s, self.Suffix) { + return false + } + return sutil.IndexAnyRunes(s[:len(s)-len(self.Suffix)], self.Separators) == -1 +} + +func (self SuffixAny) String() string { + return fmt.Sprintf("", string(self.Separators), self.Suffix) +} diff --git a/vendor/github.com/gobwas/glob/match/super.go b/vendor/github.com/gobwas/glob/match/super.go new file mode 100644 index 0000000000..3875950bb8 --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/super.go @@ -0,0 +1,33 @@ +package match + +import ( + "fmt" +) + +type Super struct{} + +func NewSuper() Super { + return Super{} +} + +func (self Super) Match(s string) bool { + return true +} + +func (self Super) Len() int { + return lenNo +} + +func (self Super) Index(s string) (int, []int) { + segments := acquireSegments(len(s) + 1) + for i := range s { + segments = append(segments, i) + } + segments = append(segments, len(s)) + + return 0, segments +} + +func (self Super) String() string { + return fmt.Sprintf("") +} diff --git a/vendor/github.com/gobwas/glob/match/text.go b/vendor/github.com/gobwas/glob/match/text.go new file mode 100644 index 0000000000..0a17616d3c --- /dev/null +++ b/vendor/github.com/gobwas/glob/match/text.go @@ -0,0 +1,45 @@ +package match + +import ( + "fmt" + "strings" + "unicode/utf8" +) + +// raw represents raw string to match +type Text struct { + Str string + RunesLength int + BytesLength int + Segments []int +} + +func NewText(s string) Text { + return Text{ + Str: s, + RunesLength: utf8.RuneCountInString(s), + BytesLength: len(s), + Segments: []int{len(s)}, + } +} + +func (self Text) Match(s string) bool { + return self.Str == s +} + +func (self Text) Len() int { + return self.RunesLength +} + +func (self Text) Index(s string) (int, []int) { + index := strings.Index(s, self.Str) + if index == -1 { + return -1, nil + } + + return index, self.Segments +} + +func (self Text) String() string { + return fmt.Sprintf("", self.Str) +} diff --git a/vendor/github.com/gobwas/glob/readme.md b/vendor/github.com/gobwas/glob/readme.md new file mode 100644 index 0000000000..f58144e733 --- /dev/null +++ b/vendor/github.com/gobwas/glob/readme.md @@ -0,0 +1,148 @@ +# glob.[go](https://golang.org) + +[![GoDoc][godoc-image]][godoc-url] [![Build Status][travis-image]][travis-url] + +> Go Globbing Library. + +## Install + +```shell + go get github.com/gobwas/glob +``` + +## Example + +```go + +package main + +import "github.com/gobwas/glob" + +func main() { + var g glob.Glob + + // create simple glob + g = glob.MustCompile("*.github.com") + g.Match("api.github.com") // true + + // quote meta characters and then create simple glob + g = glob.MustCompile(glob.QuoteMeta("*.github.com")) + g.Match("*.github.com") // true + + // create new glob with set of delimiters as ["."] + g = glob.MustCompile("api.*.com", '.') + g.Match("api.github.com") // true + g.Match("api.gi.hub.com") // false + + // create new glob with set of delimiters as ["."] + // but now with super wildcard + g = glob.MustCompile("api.**.com", '.') + g.Match("api.github.com") // true + g.Match("api.gi.hub.com") // true + + // create glob with single symbol wildcard + g = glob.MustCompile("?at") + g.Match("cat") // true + g.Match("fat") // true + g.Match("at") // false + + // create glob with single symbol wildcard and delimiters ['f'] + g = glob.MustCompile("?at", 'f') + g.Match("cat") // true + g.Match("fat") // false + g.Match("at") // false + + // create glob with character-list matchers + g = glob.MustCompile("[abc]at") + g.Match("cat") // true + g.Match("bat") // true + g.Match("fat") // false + g.Match("at") // false + + // create glob with character-list matchers + g = glob.MustCompile("[!abc]at") + g.Match("cat") // false + g.Match("bat") // false + g.Match("fat") // true + g.Match("at") // false + + // create glob with character-range matchers + g = glob.MustCompile("[a-c]at") + g.Match("cat") // true + g.Match("bat") // true + g.Match("fat") // false + g.Match("at") // false + + // create glob with character-range matchers + g = glob.MustCompile("[!a-c]at") + g.Match("cat") // false + g.Match("bat") // false + g.Match("fat") // true + g.Match("at") // false + + // create glob with pattern-alternatives list + g = glob.MustCompile("{cat,bat,[fr]at}") + g.Match("cat") // true + g.Match("bat") // true + g.Match("fat") // true + g.Match("rat") // true + g.Match("at") // false + g.Match("zat") // false +} + +``` + +## Performance + +This library is created for compile-once patterns. This means, that compilation could take time, but +strings matching is done faster, than in case when always parsing template. + +If you will not use compiled `glob.Glob` object, and do `g := glob.MustCompile(pattern); g.Match(...)` every time, then your code will be much more slower. + +Run `go test -bench=.` from source root to see the benchmarks: + +Pattern | Fixture | Match | Speed (ns/op) +--------|---------|-------|-------------- +`[a-z][!a-x]*cat*[h][!b]*eyes*` | `my cat has very bright eyes` | `true` | 432 +`[a-z][!a-x]*cat*[h][!b]*eyes*` | `my dog has very bright eyes` | `false` | 199 +`https://*.google.*` | `https://account.google.com` | `true` | 96 +`https://*.google.*` | `https://google.com` | `false` | 66 +`{https://*.google.*,*yandex.*,*yahoo.*,*mail.ru}` | `http://yahoo.com` | `true` | 163 +`{https://*.google.*,*yandex.*,*yahoo.*,*mail.ru}` | `http://google.com` | `false` | 197 +`{https://*gobwas.com,http://exclude.gobwas.com}` | `https://safe.gobwas.com` | `true` | 22 +`{https://*gobwas.com,http://exclude.gobwas.com}` | `http://safe.gobwas.com` | `false` | 24 +`abc*` | `abcdef` | `true` | 8.15 +`abc*` | `af` | `false` | 5.68 +`*def` | `abcdef` | `true` | 8.84 +`*def` | `af` | `false` | 5.74 +`ab*ef` | `abcdef` | `true` | 15.2 +`ab*ef` | `af` | `false` | 10.4 + +The same things with `regexp` package: + +Pattern | Fixture | Match | Speed (ns/op) +--------|---------|-------|-------------- +`^[a-z][^a-x].*cat.*[h][^b].*eyes.*$` | `my cat has very bright eyes` | `true` | 2553 +`^[a-z][^a-x].*cat.*[h][^b].*eyes.*$` | `my dog has very bright eyes` | `false` | 1383 +`^https:\/\/.*\.google\..*$` | `https://account.google.com` | `true` | 1205 +`^https:\/\/.*\.google\..*$` | `https://google.com` | `false` | 767 +`^(https:\/\/.*\.google\..*|.*yandex\..*|.*yahoo\..*|.*mail\.ru)$` | `http://yahoo.com` | `true` | 1435 +`^(https:\/\/.*\.google\..*|.*yandex\..*|.*yahoo\..*|.*mail\.ru)$` | `http://google.com` | `false` | 1674 +`^(https:\/\/.*gobwas\.com|http://exclude.gobwas.com)$` | `https://safe.gobwas.com` | `true` | 1039 +`^(https:\/\/.*gobwas\.com|http://exclude.gobwas.com)$` | `http://safe.gobwas.com` | `false` | 272 +`^abc.*$` | `abcdef` | `true` | 237 +`^abc.*$` | `af` | `false` | 100 +`^.*def$` | `abcdef` | `true` | 464 +`^.*def$` | `af` | `false` | 265 +`^ab.*ef$` | `abcdef` | `true` | 375 +`^ab.*ef$` | `af` | `false` | 145 + +[godoc-image]: https://godoc.org/github.com/gobwas/glob?status.svg +[godoc-url]: https://godoc.org/github.com/gobwas/glob +[travis-image]: https://travis-ci.org/gobwas/glob.svg?branch=master +[travis-url]: https://travis-ci.org/gobwas/glob + +## Syntax + +Syntax is inspired by [standard wildcards](http://tldp.org/LDP/GNU-Linux-Tools-Summary/html/x11655.htm), +except that `**` is aka super-asterisk, that do not sensitive for separators. \ No newline at end of file diff --git a/vendor/github.com/gobwas/glob/syntax/ast/ast.go b/vendor/github.com/gobwas/glob/syntax/ast/ast.go new file mode 100644 index 0000000000..3220a694a9 --- /dev/null +++ b/vendor/github.com/gobwas/glob/syntax/ast/ast.go @@ -0,0 +1,122 @@ +package ast + +import ( + "bytes" + "fmt" +) + +type Node struct { + Parent *Node + Children []*Node + Value interface{} + Kind Kind +} + +func NewNode(k Kind, v interface{}, ch ...*Node) *Node { + n := &Node{ + Kind: k, + Value: v, + } + for _, c := range ch { + Insert(n, c) + } + return n +} + +func (a *Node) Equal(b *Node) bool { + if a.Kind != b.Kind { + return false + } + if a.Value != b.Value { + return false + } + if len(a.Children) != len(b.Children) { + return false + } + for i, c := range a.Children { + if !c.Equal(b.Children[i]) { + return false + } + } + return true +} + +func (a *Node) String() string { + var buf bytes.Buffer + buf.WriteString(a.Kind.String()) + if a.Value != nil { + buf.WriteString(" =") + buf.WriteString(fmt.Sprintf("%v", a.Value)) + } + if len(a.Children) > 0 { + buf.WriteString(" [") + for i, c := range a.Children { + if i > 0 { + buf.WriteString(", ") + } + buf.WriteString(c.String()) + } + buf.WriteString("]") + } + return buf.String() +} + +func Insert(parent *Node, children ...*Node) { + parent.Children = append(parent.Children, children...) + for _, ch := range children { + ch.Parent = parent + } +} + +type List struct { + Not bool + Chars string +} + +type Range struct { + Not bool + Lo, Hi rune +} + +type Text struct { + Text string +} + +type Kind int + +const ( + KindNothing Kind = iota + KindPattern + KindList + KindRange + KindText + KindAny + KindSuper + KindSingle + KindAnyOf +) + +func (k Kind) String() string { + switch k { + case KindNothing: + return "Nothing" + case KindPattern: + return "Pattern" + case KindList: + return "List" + case KindRange: + return "Range" + case KindText: + return "Text" + case KindAny: + return "Any" + case KindSuper: + return "Super" + case KindSingle: + return "Single" + case KindAnyOf: + return "AnyOf" + default: + return "" + } +} diff --git a/vendor/github.com/gobwas/glob/syntax/ast/parser.go b/vendor/github.com/gobwas/glob/syntax/ast/parser.go new file mode 100644 index 0000000000..429b409430 --- /dev/null +++ b/vendor/github.com/gobwas/glob/syntax/ast/parser.go @@ -0,0 +1,157 @@ +package ast + +import ( + "errors" + "fmt" + "github.com/gobwas/glob/syntax/lexer" + "unicode/utf8" +) + +type Lexer interface { + Next() lexer.Token +} + +type parseFn func(*Node, Lexer) (parseFn, *Node, error) + +func Parse(lexer Lexer) (*Node, error) { + var parser parseFn + + root := NewNode(KindPattern, nil) + + var ( + tree *Node + err error + ) + for parser, tree = parserMain, root; parser != nil; { + parser, tree, err = parser(tree, lexer) + if err != nil { + return nil, err + } + } + + return root, nil +} + +func parserMain(tree *Node, lex Lexer) (parseFn, *Node, error) { + for { + token := lex.Next() + switch token.Type { + case lexer.EOF: + return nil, tree, nil + + case lexer.Error: + return nil, tree, errors.New(token.Raw) + + case lexer.Text: + Insert(tree, NewNode(KindText, Text{token.Raw})) + return parserMain, tree, nil + + case lexer.Any: + Insert(tree, NewNode(KindAny, nil)) + return parserMain, tree, nil + + case lexer.Super: + Insert(tree, NewNode(KindSuper, nil)) + return parserMain, tree, nil + + case lexer.Single: + Insert(tree, NewNode(KindSingle, nil)) + return parserMain, tree, nil + + case lexer.RangeOpen: + return parserRange, tree, nil + + case lexer.TermsOpen: + a := NewNode(KindAnyOf, nil) + Insert(tree, a) + + p := NewNode(KindPattern, nil) + Insert(a, p) + + return parserMain, p, nil + + case lexer.Separator: + p := NewNode(KindPattern, nil) + Insert(tree.Parent, p) + + return parserMain, p, nil + + case lexer.TermsClose: + return parserMain, tree.Parent.Parent, nil + + default: + return nil, tree, fmt.Errorf("unexpected token: %s", token) + } + } + return nil, tree, fmt.Errorf("unknown error") +} + +func parserRange(tree *Node, lex Lexer) (parseFn, *Node, error) { + var ( + not bool + lo rune + hi rune + chars string + ) + for { + token := lex.Next() + switch token.Type { + case lexer.EOF: + return nil, tree, errors.New("unexpected end") + + case lexer.Error: + return nil, tree, errors.New(token.Raw) + + case lexer.Not: + not = true + + case lexer.RangeLo: + r, w := utf8.DecodeRuneInString(token.Raw) + if len(token.Raw) > w { + return nil, tree, fmt.Errorf("unexpected length of lo character") + } + lo = r + + case lexer.RangeBetween: + // + + case lexer.RangeHi: + r, w := utf8.DecodeRuneInString(token.Raw) + if len(token.Raw) > w { + return nil, tree, fmt.Errorf("unexpected length of lo character") + } + + hi = r + + if hi < lo { + return nil, tree, fmt.Errorf("hi character '%s' should be greater than lo '%s'", string(hi), string(lo)) + } + + case lexer.Text: + chars = token.Raw + + case lexer.RangeClose: + isRange := lo != 0 && hi != 0 + isChars := chars != "" + + if isChars == isRange { + return nil, tree, fmt.Errorf("could not parse range") + } + + if isRange { + Insert(tree, NewNode(KindRange, Range{ + Lo: lo, + Hi: hi, + Not: not, + })) + } else { + Insert(tree, NewNode(KindList, List{ + Chars: chars, + Not: not, + })) + } + + return parserMain, tree, nil + } + } +} diff --git a/vendor/github.com/gobwas/glob/syntax/lexer/lexer.go b/vendor/github.com/gobwas/glob/syntax/lexer/lexer.go new file mode 100644 index 0000000000..a1c8d1962a --- /dev/null +++ b/vendor/github.com/gobwas/glob/syntax/lexer/lexer.go @@ -0,0 +1,273 @@ +package lexer + +import ( + "bytes" + "fmt" + "github.com/gobwas/glob/util/runes" + "unicode/utf8" +) + +const ( + char_any = '*' + char_comma = ',' + char_single = '?' + char_escape = '\\' + char_range_open = '[' + char_range_close = ']' + char_terms_open = '{' + char_terms_close = '}' + char_range_not = '!' + char_range_between = '-' +) + +var specials = []byte{ + char_any, + char_single, + char_escape, + char_range_open, + char_range_close, + char_terms_open, + char_terms_close, +} + +func Special(c byte) bool { + return bytes.IndexByte(specials, c) != -1 +} + +type tokens []Token + +func (i *tokens) shift() (ret Token) { + ret = (*i)[0] + copy(*i, (*i)[1:]) + *i = (*i)[:len(*i)-1] + return +} + +func (i *tokens) push(v Token) { + *i = append(*i, v) +} + +func (i *tokens) empty() bool { + return len(*i) == 0 +} + +var eof rune = 0 + +type lexer struct { + data string + pos int + err error + + tokens tokens + termsLevel int + + lastRune rune + lastRuneSize int + hasRune bool +} + +func NewLexer(source string) *lexer { + l := &lexer{ + data: source, + tokens: tokens(make([]Token, 0, 4)), + } + return l +} + +func (l *lexer) Next() Token { + if l.err != nil { + return Token{Error, l.err.Error()} + } + if !l.tokens.empty() { + return l.tokens.shift() + } + + l.fetchItem() + return l.Next() +} + +func (l *lexer) peek() (r rune, w int) { + if l.pos == len(l.data) { + return eof, 0 + } + + r, w = utf8.DecodeRuneInString(l.data[l.pos:]) + if r == utf8.RuneError { + l.errorf("could not read rune") + r = eof + w = 0 + } + + return +} + +func (l *lexer) read() rune { + if l.hasRune { + l.hasRune = false + l.seek(l.lastRuneSize) + return l.lastRune + } + + r, s := l.peek() + l.seek(s) + + l.lastRune = r + l.lastRuneSize = s + + return r +} + +func (l *lexer) seek(w int) { + l.pos += w +} + +func (l *lexer) unread() { + if l.hasRune { + l.errorf("could not unread rune") + return + } + l.seek(-l.lastRuneSize) + l.hasRune = true +} + +func (l *lexer) errorf(f string, v ...interface{}) { + l.err = fmt.Errorf(f, v...) +} + +func (l *lexer) inTerms() bool { + return l.termsLevel > 0 +} + +func (l *lexer) termsEnter() { + l.termsLevel++ +} + +func (l *lexer) termsLeave() { + l.termsLevel-- +} + +var inTextBreakers = []rune{char_single, char_any, char_range_open, char_terms_open} +var inTermsBreakers = append(inTextBreakers, char_terms_close, char_comma) + +func (l *lexer) fetchItem() { + r := l.read() + switch { + case r == eof: + l.tokens.push(Token{EOF, ""}) + + case r == char_terms_open: + l.termsEnter() + l.tokens.push(Token{TermsOpen, string(r)}) + + case r == char_comma && l.inTerms(): + l.tokens.push(Token{Separator, string(r)}) + + case r == char_terms_close && l.inTerms(): + l.tokens.push(Token{TermsClose, string(r)}) + l.termsLeave() + + case r == char_range_open: + l.tokens.push(Token{RangeOpen, string(r)}) + l.fetchRange() + + case r == char_single: + l.tokens.push(Token{Single, string(r)}) + + case r == char_any: + if l.read() == char_any { + l.tokens.push(Token{Super, string(r) + string(r)}) + } else { + l.unread() + l.tokens.push(Token{Any, string(r)}) + } + + default: + l.unread() + + var breakers []rune + if l.inTerms() { + breakers = inTermsBreakers + } else { + breakers = inTextBreakers + } + l.fetchText(breakers) + } +} + +func (l *lexer) fetchRange() { + var wantHi bool + var wantClose bool + var seenNot bool + for { + r := l.read() + if r == eof { + l.errorf("unexpected end of input") + return + } + + if wantClose { + if r != char_range_close { + l.errorf("expected close range character") + } else { + l.tokens.push(Token{RangeClose, string(r)}) + } + return + } + + if wantHi { + l.tokens.push(Token{RangeHi, string(r)}) + wantClose = true + continue + } + + if !seenNot && r == char_range_not { + l.tokens.push(Token{Not, string(r)}) + seenNot = true + continue + } + + if n, w := l.peek(); n == char_range_between { + l.seek(w) + l.tokens.push(Token{RangeLo, string(r)}) + l.tokens.push(Token{RangeBetween, string(n)}) + wantHi = true + continue + } + + l.unread() // unread first peek and fetch as text + l.fetchText([]rune{char_range_close}) + wantClose = true + } +} + +func (l *lexer) fetchText(breakers []rune) { + var data []rune + var escaped bool + +reading: + for { + r := l.read() + if r == eof { + break + } + + if !escaped { + if r == char_escape { + escaped = true + continue + } + + if runes.IndexRune(breakers, r) != -1 { + l.unread() + break reading + } + } + + escaped = false + data = append(data, r) + } + + if len(data) > 0 { + l.tokens.push(Token{Text, string(data)}) + } +} diff --git a/vendor/github.com/gobwas/glob/syntax/lexer/token.go b/vendor/github.com/gobwas/glob/syntax/lexer/token.go new file mode 100644 index 0000000000..2797c4e83a --- /dev/null +++ b/vendor/github.com/gobwas/glob/syntax/lexer/token.go @@ -0,0 +1,88 @@ +package lexer + +import "fmt" + +type TokenType int + +const ( + EOF TokenType = iota + Error + Text + Char + Any + Super + Single + Not + Separator + RangeOpen + RangeClose + RangeLo + RangeHi + RangeBetween + TermsOpen + TermsClose +) + +func (tt TokenType) String() string { + switch tt { + case EOF: + return "eof" + + case Error: + return "error" + + case Text: + return "text" + + case Char: + return "char" + + case Any: + return "any" + + case Super: + return "super" + + case Single: + return "single" + + case Not: + return "not" + + case Separator: + return "separator" + + case RangeOpen: + return "range_open" + + case RangeClose: + return "range_close" + + case RangeLo: + return "range_lo" + + case RangeHi: + return "range_hi" + + case RangeBetween: + return "range_between" + + case TermsOpen: + return "terms_open" + + case TermsClose: + return "terms_close" + + default: + return "undef" + } +} + +type Token struct { + Type TokenType + Raw string +} + +func (t Token) String() string { + return fmt.Sprintf("%v<%q>", t.Type, t.Raw) +} diff --git a/vendor/github.com/gobwas/glob/syntax/syntax.go b/vendor/github.com/gobwas/glob/syntax/syntax.go new file mode 100644 index 0000000000..1d168b1482 --- /dev/null +++ b/vendor/github.com/gobwas/glob/syntax/syntax.go @@ -0,0 +1,14 @@ +package syntax + +import ( + "github.com/gobwas/glob/syntax/ast" + "github.com/gobwas/glob/syntax/lexer" +) + +func Parse(s string) (*ast.Node, error) { + return ast.Parse(lexer.NewLexer(s)) +} + +func Special(b byte) bool { + return lexer.Special(b) +} diff --git a/vendor/github.com/gobwas/glob/util/runes/runes.go b/vendor/github.com/gobwas/glob/util/runes/runes.go new file mode 100644 index 0000000000..a723556410 --- /dev/null +++ b/vendor/github.com/gobwas/glob/util/runes/runes.go @@ -0,0 +1,154 @@ +package runes + +func Index(s, needle []rune) int { + ls, ln := len(s), len(needle) + + switch { + case ln == 0: + return 0 + case ln == 1: + return IndexRune(s, needle[0]) + case ln == ls: + if Equal(s, needle) { + return 0 + } + return -1 + case ln > ls: + return -1 + } + +head: + for i := 0; i < ls && ls-i >= ln; i++ { + for y := 0; y < ln; y++ { + if s[i+y] != needle[y] { + continue head + } + } + + return i + } + + return -1 +} + +func LastIndex(s, needle []rune) int { + ls, ln := len(s), len(needle) + + switch { + case ln == 0: + if ls == 0 { + return 0 + } + return ls + case ln == 1: + return IndexLastRune(s, needle[0]) + case ln == ls: + if Equal(s, needle) { + return 0 + } + return -1 + case ln > ls: + return -1 + } + +head: + for i := ls - 1; i >= 0 && i >= ln; i-- { + for y := ln - 1; y >= 0; y-- { + if s[i-(ln-y-1)] != needle[y] { + continue head + } + } + + return i - ln + 1 + } + + return -1 +} + +// IndexAny returns the index of the first instance of any Unicode code point +// from chars in s, or -1 if no Unicode code point from chars is present in s. +func IndexAny(s, chars []rune) int { + if len(chars) > 0 { + for i, c := range s { + for _, m := range chars { + if c == m { + return i + } + } + } + } + return -1 +} + +func Contains(s, needle []rune) bool { + return Index(s, needle) >= 0 +} + +func Max(s []rune) (max rune) { + for _, r := range s { + if r > max { + max = r + } + } + + return +} + +func Min(s []rune) rune { + min := rune(-1) + for _, r := range s { + if min == -1 { + min = r + continue + } + + if r < min { + min = r + } + } + + return min +} + +func IndexRune(s []rune, r rune) int { + for i, c := range s { + if c == r { + return i + } + } + return -1 +} + +func IndexLastRune(s []rune, r rune) int { + for i := len(s) - 1; i >= 0; i-- { + if s[i] == r { + return i + } + } + + return -1 +} + +func Equal(a, b []rune) bool { + if len(a) == len(b) { + for i := 0; i < len(a); i++ { + if a[i] != b[i] { + return false + } + } + + return true + } + + return false +} + +// HasPrefix tests whether the string s begins with prefix. +func HasPrefix(s, prefix []rune) bool { + return len(s) >= len(prefix) && Equal(s[0:len(prefix)], prefix) +} + +// HasSuffix tests whether the string s ends with suffix. +func HasSuffix(s, suffix []rune) bool { + return len(s) >= len(suffix) && Equal(s[len(s)-len(suffix):], suffix) +} diff --git a/vendor/github.com/gobwas/glob/util/strings/strings.go b/vendor/github.com/gobwas/glob/util/strings/strings.go new file mode 100644 index 0000000000..e8ee1920b1 --- /dev/null +++ b/vendor/github.com/gobwas/glob/util/strings/strings.go @@ -0,0 +1,39 @@ +package strings + +import ( + "strings" + "unicode/utf8" +) + +func IndexAnyRunes(s string, rs []rune) int { + for _, r := range rs { + if i := strings.IndexRune(s, r); i != -1 { + return i + } + } + + return -1 +} + +func LastIndexAnyRunes(s string, rs []rune) int { + for _, r := range rs { + i := -1 + if 0 <= r && r < utf8.RuneSelf { + i = strings.LastIndexByte(s, byte(r)) + } else { + sub := s + for len(sub) > 0 { + j := strings.IndexRune(s, r) + if j == -1 { + break + } + i = j + sub = sub[i+1:] + } + } + if i != -1 { + return i + } + } + return -1 +} diff --git a/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go b/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go new file mode 100644 index 0000000000..ceadde6a5e --- /dev/null +++ b/vendor/github.com/gogo/protobuf/sortkeys/sortkeys.go @@ -0,0 +1,101 @@ +// Protocol Buffers for Go with Gadgets +// +// Copyright (c) 2013, The GoGo Authors. All rights reserved. +// http://github.com/gogo/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. +// +// 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 sortkeys + +import ( + "sort" +) + +func Strings(l []string) { + sort.Strings(l) +} + +func Float64s(l []float64) { + sort.Float64s(l) +} + +func Float32s(l []float32) { + sort.Sort(Float32Slice(l)) +} + +func Int64s(l []int64) { + sort.Sort(Int64Slice(l)) +} + +func Int32s(l []int32) { + sort.Sort(Int32Slice(l)) +} + +func Uint64s(l []uint64) { + sort.Sort(Uint64Slice(l)) +} + +func Uint32s(l []uint32) { + sort.Sort(Uint32Slice(l)) +} + +func Bools(l []bool) { + sort.Sort(BoolSlice(l)) +} + +type BoolSlice []bool + +func (p BoolSlice) Len() int { return len(p) } +func (p BoolSlice) Less(i, j int) bool { return p[j] } +func (p BoolSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Int64Slice []int64 + +func (p Int64Slice) Len() int { return len(p) } +func (p Int64Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Int64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Int32Slice []int32 + +func (p Int32Slice) Len() int { return len(p) } +func (p Int32Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Int32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Uint64Slice []uint64 + +func (p Uint64Slice) Len() int { return len(p) } +func (p Uint64Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Uint64Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Uint32Slice []uint32 + +func (p Uint32Slice) Len() int { return len(p) } +func (p Uint32Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Uint32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } + +type Float32Slice []float32 + +func (p Float32Slice) Len() int { return len(p) } +func (p Float32Slice) Less(i, j int) bool { return p[i] < p[j] } +func (p Float32Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } diff --git a/vendor/github.com/golang/groupcache/LICENSE b/vendor/github.com/golang/groupcache/LICENSE new file mode 100644 index 0000000000..37ec93a14f --- /dev/null +++ b/vendor/github.com/golang/groupcache/LICENSE @@ -0,0 +1,191 @@ +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: + +You must give any other recipients of the Work or Derivative Works a copy of +this License; and +You must cause any modified files to carry prominent notices stating that You +changed the files; and +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 +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/golang/groupcache/lru/lru.go b/vendor/github.com/golang/groupcache/lru/lru.go new file mode 100644 index 0000000000..eac1c7664f --- /dev/null +++ b/vendor/github.com/golang/groupcache/lru/lru.go @@ -0,0 +1,133 @@ +/* +Copyright 2013 Google Inc. + +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 lru implements an LRU cache. +package lru + +import "container/list" + +// Cache is an LRU cache. It is not safe for concurrent access. +type Cache struct { + // MaxEntries is the maximum number of cache entries before + // an item is evicted. Zero means no limit. + MaxEntries int + + // OnEvicted optionally specifies a callback function to be + // executed when an entry is purged from the cache. + OnEvicted func(key Key, value interface{}) + + ll *list.List + cache map[interface{}]*list.Element +} + +// A Key may be any value that is comparable. See http://golang.org/ref/spec#Comparison_operators +type Key interface{} + +type entry struct { + key Key + value interface{} +} + +// New creates a new Cache. +// If maxEntries is zero, the cache has no limit and it's assumed +// that eviction is done by the caller. +func New(maxEntries int) *Cache { + return &Cache{ + MaxEntries: maxEntries, + ll: list.New(), + cache: make(map[interface{}]*list.Element), + } +} + +// Add adds a value to the cache. +func (c *Cache) Add(key Key, value interface{}) { + if c.cache == nil { + c.cache = make(map[interface{}]*list.Element) + c.ll = list.New() + } + if ee, ok := c.cache[key]; ok { + c.ll.MoveToFront(ee) + ee.Value.(*entry).value = value + return + } + ele := c.ll.PushFront(&entry{key, value}) + c.cache[key] = ele + if c.MaxEntries != 0 && c.ll.Len() > c.MaxEntries { + c.RemoveOldest() + } +} + +// Get looks up a key's value from the cache. +func (c *Cache) Get(key Key) (value interface{}, ok bool) { + if c.cache == nil { + return + } + if ele, hit := c.cache[key]; hit { + c.ll.MoveToFront(ele) + return ele.Value.(*entry).value, true + } + return +} + +// Remove removes the provided key from the cache. +func (c *Cache) Remove(key Key) { + if c.cache == nil { + return + } + if ele, hit := c.cache[key]; hit { + c.removeElement(ele) + } +} + +// RemoveOldest removes the oldest item from the cache. +func (c *Cache) RemoveOldest() { + if c.cache == nil { + return + } + ele := c.ll.Back() + if ele != nil { + c.removeElement(ele) + } +} + +func (c *Cache) removeElement(e *list.Element) { + c.ll.Remove(e) + kv := e.Value.(*entry) + delete(c.cache, kv.key) + if c.OnEvicted != nil { + c.OnEvicted(kv.key, kv.value) + } +} + +// Len returns the number of items in the cache. +func (c *Cache) Len() int { + if c.cache == nil { + return 0 + } + return c.ll.Len() +} + +// Clear purges all stored items from the cache. +func (c *Cache) Clear() { + if c.OnEvicted != nil { + for _, e := range c.cache { + kv := e.Value.(*entry) + c.OnEvicted(kv.key, kv.value) + } + } + c.ll = nil + c.cache = nil +} diff --git a/vendor/github.com/golang/snappy/.gitignore b/vendor/github.com/golang/snappy/.gitignore new file mode 100644 index 0000000000..042091d9b3 --- /dev/null +++ b/vendor/github.com/golang/snappy/.gitignore @@ -0,0 +1,16 @@ +cmd/snappytool/snappytool +testdata/bench + +# These explicitly listed benchmark data files are for an obsolete version of +# snappy_test.go. +testdata/alice29.txt +testdata/asyoulik.txt +testdata/fireworks.jpeg +testdata/geo.protodata +testdata/html +testdata/html_x_4 +testdata/kppkn.gtb +testdata/lcet10.txt +testdata/paper-100k.pdf +testdata/plrabn12.txt +testdata/urls.10K diff --git a/vendor/github.com/golang/snappy/AUTHORS b/vendor/github.com/golang/snappy/AUTHORS new file mode 100644 index 0000000000..52ccb5a934 --- /dev/null +++ b/vendor/github.com/golang/snappy/AUTHORS @@ -0,0 +1,18 @@ +# This is the official list of Snappy-Go authors for copyright purposes. +# This file is distinct from the CONTRIBUTORS files. +# See the latter for an explanation. + +# Names should be added to this file as +# Name or Organization +# The email address is not required for organizations. + +# Please keep the list sorted. + +Amazon.com, Inc +Damian Gryski +Eric Buth +Google Inc. +Jan Mercl <0xjnml@gmail.com> +Klaus Post +Rodolfo Carvalho +Sebastien Binet diff --git a/vendor/github.com/golang/snappy/CONTRIBUTORS b/vendor/github.com/golang/snappy/CONTRIBUTORS new file mode 100644 index 0000000000..ea6524ddd0 --- /dev/null +++ b/vendor/github.com/golang/snappy/CONTRIBUTORS @@ -0,0 +1,41 @@ +# This is the official list of people who can contribute +# (and typically have contributed) code to the Snappy-Go repository. +# The AUTHORS file lists the copyright holders; this file +# lists people. For example, Google employees are listed here +# but not in AUTHORS, because Google holds the copyright. +# +# The submission process automatically checks to make sure +# that people submitting code are listed in this file (by email address). +# +# Names should be added to this file only after verifying that +# the individual or the individual's organization has agreed to +# the appropriate Contributor License Agreement, found here: +# +# http://code.google.com/legal/individual-cla-v1.0.html +# http://code.google.com/legal/corporate-cla-v1.0.html +# +# The agreement for individuals can be filled out on the web. +# +# When adding J Random Contributor's name to this file, +# either J's name or J's organization's name should be +# added to the AUTHORS file, depending on whether the +# individual or corporate CLA was used. + +# Names should be added to this file like so: +# Name + +# Please keep the list sorted. + +Alex Legg +Damian Gryski +Eric Buth +Jan Mercl <0xjnml@gmail.com> +Jonathan Swinney +Kai Backman +Klaus Post +Marc-Antoine Ruel +Nigel Tao +Rob Pike +Rodolfo Carvalho +Russ Cox +Sebastien Binet diff --git a/vendor/github.com/golang/snappy/LICENSE b/vendor/github.com/golang/snappy/LICENSE new file mode 100644 index 0000000000..6050c10f4c --- /dev/null +++ b/vendor/github.com/golang/snappy/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2011 The Snappy-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/snappy/README b/vendor/github.com/golang/snappy/README new file mode 100644 index 0000000000..cea12879a0 --- /dev/null +++ b/vendor/github.com/golang/snappy/README @@ -0,0 +1,107 @@ +The Snappy compression format in the Go programming language. + +To download and install from source: +$ go get github.com/golang/snappy + +Unless otherwise noted, the Snappy-Go source files are distributed +under the BSD-style license found in the LICENSE file. + + + +Benchmarks. + +The golang/snappy benchmarks include compressing (Z) and decompressing (U) ten +or so files, the same set used by the C++ Snappy code (github.com/google/snappy +and note the "google", not "golang"). On an "Intel(R) Core(TM) i7-3770 CPU @ +3.40GHz", Go's GOARCH=amd64 numbers as of 2016-05-29: + +"go test -test.bench=." + +_UFlat0-8 2.19GB/s ± 0% html +_UFlat1-8 1.41GB/s ± 0% urls +_UFlat2-8 23.5GB/s ± 2% jpg +_UFlat3-8 1.91GB/s ± 0% jpg_200 +_UFlat4-8 14.0GB/s ± 1% pdf +_UFlat5-8 1.97GB/s ± 0% html4 +_UFlat6-8 814MB/s ± 0% txt1 +_UFlat7-8 785MB/s ± 0% txt2 +_UFlat8-8 857MB/s ± 0% txt3 +_UFlat9-8 719MB/s ± 1% txt4 +_UFlat10-8 2.84GB/s ± 0% pb +_UFlat11-8 1.05GB/s ± 0% gaviota + +_ZFlat0-8 1.04GB/s ± 0% html +_ZFlat1-8 534MB/s ± 0% urls +_ZFlat2-8 15.7GB/s ± 1% jpg +_ZFlat3-8 740MB/s ± 3% jpg_200 +_ZFlat4-8 9.20GB/s ± 1% pdf +_ZFlat5-8 991MB/s ± 0% html4 +_ZFlat6-8 379MB/s ± 0% txt1 +_ZFlat7-8 352MB/s ± 0% txt2 +_ZFlat8-8 396MB/s ± 1% txt3 +_ZFlat9-8 327MB/s ± 1% txt4 +_ZFlat10-8 1.33GB/s ± 1% pb +_ZFlat11-8 605MB/s ± 1% gaviota + + + +"go test -test.bench=. -tags=noasm" + +_UFlat0-8 621MB/s ± 2% html +_UFlat1-8 494MB/s ± 1% urls +_UFlat2-8 23.2GB/s ± 1% jpg +_UFlat3-8 1.12GB/s ± 1% jpg_200 +_UFlat4-8 4.35GB/s ± 1% pdf +_UFlat5-8 609MB/s ± 0% html4 +_UFlat6-8 296MB/s ± 0% txt1 +_UFlat7-8 288MB/s ± 0% txt2 +_UFlat8-8 309MB/s ± 1% txt3 +_UFlat9-8 280MB/s ± 1% txt4 +_UFlat10-8 753MB/s ± 0% pb +_UFlat11-8 400MB/s ± 0% gaviota + +_ZFlat0-8 409MB/s ± 1% html +_ZFlat1-8 250MB/s ± 1% urls +_ZFlat2-8 12.3GB/s ± 1% jpg +_ZFlat3-8 132MB/s ± 0% jpg_200 +_ZFlat4-8 2.92GB/s ± 0% pdf +_ZFlat5-8 405MB/s ± 1% html4 +_ZFlat6-8 179MB/s ± 1% txt1 +_ZFlat7-8 170MB/s ± 1% txt2 +_ZFlat8-8 189MB/s ± 1% txt3 +_ZFlat9-8 164MB/s ± 1% txt4 +_ZFlat10-8 479MB/s ± 1% pb +_ZFlat11-8 270MB/s ± 1% gaviota + + + +For comparison (Go's encoded output is byte-for-byte identical to C++'s), here +are the numbers from C++ Snappy's + +make CXXFLAGS="-O2 -DNDEBUG -g" clean snappy_unittest.log && cat snappy_unittest.log + +BM_UFlat/0 2.4GB/s html +BM_UFlat/1 1.4GB/s urls +BM_UFlat/2 21.8GB/s jpg +BM_UFlat/3 1.5GB/s jpg_200 +BM_UFlat/4 13.3GB/s pdf +BM_UFlat/5 2.1GB/s html4 +BM_UFlat/6 1.0GB/s txt1 +BM_UFlat/7 959.4MB/s txt2 +BM_UFlat/8 1.0GB/s txt3 +BM_UFlat/9 864.5MB/s txt4 +BM_UFlat/10 2.9GB/s pb +BM_UFlat/11 1.2GB/s gaviota + +BM_ZFlat/0 944.3MB/s html (22.31 %) +BM_ZFlat/1 501.6MB/s urls (47.78 %) +BM_ZFlat/2 14.3GB/s jpg (99.95 %) +BM_ZFlat/3 538.3MB/s jpg_200 (73.00 %) +BM_ZFlat/4 8.3GB/s pdf (83.30 %) +BM_ZFlat/5 903.5MB/s html4 (22.52 %) +BM_ZFlat/6 336.0MB/s txt1 (57.88 %) +BM_ZFlat/7 312.3MB/s txt2 (61.91 %) +BM_ZFlat/8 353.1MB/s txt3 (54.99 %) +BM_ZFlat/9 289.9MB/s txt4 (66.26 %) +BM_ZFlat/10 1.2GB/s pb (19.68 %) +BM_ZFlat/11 527.4MB/s gaviota (37.72 %) diff --git a/vendor/github.com/golang/snappy/decode.go b/vendor/github.com/golang/snappy/decode.go new file mode 100644 index 0000000000..23c6e26c6b --- /dev/null +++ b/vendor/github.com/golang/snappy/decode.go @@ -0,0 +1,264 @@ +// Copyright 2011 The Snappy-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 snappy + +import ( + "encoding/binary" + "errors" + "io" +) + +var ( + // ErrCorrupt reports that the input is invalid. + ErrCorrupt = errors.New("snappy: corrupt input") + // ErrTooLarge reports that the uncompressed length is too large. + ErrTooLarge = errors.New("snappy: decoded block is too large") + // ErrUnsupported reports that the input isn't supported. + ErrUnsupported = errors.New("snappy: unsupported input") + + errUnsupportedLiteralLength = errors.New("snappy: unsupported literal length") +) + +// DecodedLen returns the length of the decoded block. +func DecodedLen(src []byte) (int, error) { + v, _, err := decodedLen(src) + return v, err +} + +// decodedLen returns the length of the decoded block and the number of bytes +// that the length header occupied. +func decodedLen(src []byte) (blockLen, headerLen int, err error) { + v, n := binary.Uvarint(src) + if n <= 0 || v > 0xffffffff { + return 0, 0, ErrCorrupt + } + + const wordSize = 32 << (^uint(0) >> 32 & 1) + if wordSize == 32 && v > 0x7fffffff { + return 0, 0, ErrTooLarge + } + return int(v), n, nil +} + +const ( + decodeErrCodeCorrupt = 1 + decodeErrCodeUnsupportedLiteralLength = 2 +) + +// Decode returns the decoded form of src. The returned slice may be a sub- +// slice of dst if dst was large enough to hold the entire decoded block. +// Otherwise, a newly allocated slice will be returned. +// +// The dst and src must not overlap. It is valid to pass a nil dst. +// +// Decode handles the Snappy block format, not the Snappy stream format. +func Decode(dst, src []byte) ([]byte, error) { + dLen, s, err := decodedLen(src) + if err != nil { + return nil, err + } + if dLen <= len(dst) { + dst = dst[:dLen] + } else { + dst = make([]byte, dLen) + } + switch decode(dst, src[s:]) { + case 0: + return dst, nil + case decodeErrCodeUnsupportedLiteralLength: + return nil, errUnsupportedLiteralLength + } + return nil, ErrCorrupt +} + +// NewReader returns a new Reader that decompresses from r, using the framing +// format described at +// https://github.com/google/snappy/blob/master/framing_format.txt +func NewReader(r io.Reader) *Reader { + return &Reader{ + r: r, + decoded: make([]byte, maxBlockSize), + buf: make([]byte, maxEncodedLenOfMaxBlockSize+checksumSize), + } +} + +// Reader is an io.Reader that can read Snappy-compressed bytes. +// +// Reader handles the Snappy stream format, not the Snappy block format. +type Reader struct { + r io.Reader + err error + decoded []byte + buf []byte + // decoded[i:j] contains decoded bytes that have not yet been passed on. + i, j int + readHeader bool +} + +// Reset discards any buffered data, resets all state, and switches the Snappy +// reader to read from r. This permits reusing a Reader rather than allocating +// a new one. +func (r *Reader) Reset(reader io.Reader) { + r.r = reader + r.err = nil + r.i = 0 + r.j = 0 + r.readHeader = false +} + +func (r *Reader) readFull(p []byte, allowEOF bool) (ok bool) { + if _, r.err = io.ReadFull(r.r, p); r.err != nil { + if r.err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) { + r.err = ErrCorrupt + } + return false + } + return true +} + +func (r *Reader) fill() error { + for r.i >= r.j { + if !r.readFull(r.buf[:4], true) { + return r.err + } + chunkType := r.buf[0] + if !r.readHeader { + if chunkType != chunkTypeStreamIdentifier { + r.err = ErrCorrupt + return r.err + } + r.readHeader = true + } + chunkLen := int(r.buf[1]) | int(r.buf[2])<<8 | int(r.buf[3])<<16 + if chunkLen > len(r.buf) { + r.err = ErrUnsupported + return r.err + } + + // The chunk types are specified at + // https://github.com/google/snappy/blob/master/framing_format.txt + switch chunkType { + case chunkTypeCompressedData: + // Section 4.2. Compressed data (chunk type 0x00). + if chunkLen < checksumSize { + r.err = ErrCorrupt + return r.err + } + buf := r.buf[:chunkLen] + if !r.readFull(buf, false) { + return r.err + } + checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 + buf = buf[checksumSize:] + + n, err := DecodedLen(buf) + if err != nil { + r.err = err + return r.err + } + if n > len(r.decoded) { + r.err = ErrCorrupt + return r.err + } + if _, err := Decode(r.decoded, buf); err != nil { + r.err = err + return r.err + } + if crc(r.decoded[:n]) != checksum { + r.err = ErrCorrupt + return r.err + } + r.i, r.j = 0, n + continue + + case chunkTypeUncompressedData: + // Section 4.3. Uncompressed data (chunk type 0x01). + if chunkLen < checksumSize { + r.err = ErrCorrupt + return r.err + } + buf := r.buf[:checksumSize] + if !r.readFull(buf, false) { + return r.err + } + checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 + // Read directly into r.decoded instead of via r.buf. + n := chunkLen - checksumSize + if n > len(r.decoded) { + r.err = ErrCorrupt + return r.err + } + if !r.readFull(r.decoded[:n], false) { + return r.err + } + if crc(r.decoded[:n]) != checksum { + r.err = ErrCorrupt + return r.err + } + r.i, r.j = 0, n + continue + + case chunkTypeStreamIdentifier: + // Section 4.1. Stream identifier (chunk type 0xff). + if chunkLen != len(magicBody) { + r.err = ErrCorrupt + return r.err + } + if !r.readFull(r.buf[:len(magicBody)], false) { + return r.err + } + for i := 0; i < len(magicBody); i++ { + if r.buf[i] != magicBody[i] { + r.err = ErrCorrupt + return r.err + } + } + continue + } + + if chunkType <= 0x7f { + // Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f). + r.err = ErrUnsupported + return r.err + } + // Section 4.4 Padding (chunk type 0xfe). + // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd). + if !r.readFull(r.buf[:chunkLen], false) { + return r.err + } + } + + return nil +} + +// Read satisfies the io.Reader interface. +func (r *Reader) Read(p []byte) (int, error) { + if r.err != nil { + return 0, r.err + } + + if err := r.fill(); err != nil { + return 0, err + } + + n := copy(p, r.decoded[r.i:r.j]) + r.i += n + return n, nil +} + +// ReadByte satisfies the io.ByteReader interface. +func (r *Reader) ReadByte() (byte, error) { + if r.err != nil { + return 0, r.err + } + + if err := r.fill(); err != nil { + return 0, err + } + + c := r.decoded[r.i] + r.i++ + return c, nil +} diff --git a/vendor/github.com/golang/snappy/decode_amd64.s b/vendor/github.com/golang/snappy/decode_amd64.s new file mode 100644 index 0000000000..e6179f65e3 --- /dev/null +++ b/vendor/github.com/golang/snappy/decode_amd64.s @@ -0,0 +1,490 @@ +// 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 !appengine +// +build gc +// +build !noasm + +#include "textflag.h" + +// The asm code generally follows the pure Go code in decode_other.go, except +// where marked with a "!!!". + +// func decode(dst, src []byte) int +// +// All local variables fit into registers. The non-zero stack size is only to +// spill registers and push args when issuing a CALL. The register allocation: +// - AX scratch +// - BX scratch +// - CX length or x +// - DX offset +// - SI &src[s] +// - DI &dst[d] +// + R8 dst_base +// + R9 dst_len +// + R10 dst_base + dst_len +// + R11 src_base +// + R12 src_len +// + R13 src_base + src_len +// - R14 used by doCopy +// - R15 used by doCopy +// +// The registers R8-R13 (marked with a "+") are set at the start of the +// function, and after a CALL returns, and are not otherwise modified. +// +// The d variable is implicitly DI - R8, and len(dst)-d is R10 - DI. +// The s variable is implicitly SI - R11, and len(src)-s is R13 - SI. +TEXT ·decode(SB), NOSPLIT, $48-56 + // Initialize SI, DI and R8-R13. + MOVQ dst_base+0(FP), R8 + MOVQ dst_len+8(FP), R9 + MOVQ R8, DI + MOVQ R8, R10 + ADDQ R9, R10 + MOVQ src_base+24(FP), R11 + MOVQ src_len+32(FP), R12 + MOVQ R11, SI + MOVQ R11, R13 + ADDQ R12, R13 + +loop: + // for s < len(src) + CMPQ SI, R13 + JEQ end + + // CX = uint32(src[s]) + // + // switch src[s] & 0x03 + MOVBLZX (SI), CX + MOVL CX, BX + ANDL $3, BX + CMPL BX, $1 + JAE tagCopy + + // ---------------------------------------- + // The code below handles literal tags. + + // case tagLiteral: + // x := uint32(src[s] >> 2) + // switch + SHRL $2, CX + CMPL CX, $60 + JAE tagLit60Plus + + // case x < 60: + // s++ + INCQ SI + +doLit: + // This is the end of the inner "switch", when we have a literal tag. + // + // We assume that CX == x and x fits in a uint32, where x is the variable + // used in the pure Go decode_other.go code. + + // length = int(x) + 1 + // + // Unlike the pure Go code, we don't need to check if length <= 0 because + // CX can hold 64 bits, so the increment cannot overflow. + INCQ CX + + // Prepare to check if copying length bytes will run past the end of dst or + // src. + // + // AX = len(dst) - d + // BX = len(src) - s + MOVQ R10, AX + SUBQ DI, AX + MOVQ R13, BX + SUBQ SI, BX + + // !!! Try a faster technique for short (16 or fewer bytes) copies. + // + // if length > 16 || len(dst)-d < 16 || len(src)-s < 16 { + // goto callMemmove // Fall back on calling runtime·memmove. + // } + // + // The C++ snappy code calls this TryFastAppend. It also checks len(src)-s + // against 21 instead of 16, because it cannot assume that all of its input + // is contiguous in memory and so it needs to leave enough source bytes to + // read the next tag without refilling buffers, but Go's Decode assumes + // contiguousness (the src argument is a []byte). + CMPQ CX, $16 + JGT callMemmove + CMPQ AX, $16 + JLT callMemmove + CMPQ BX, $16 + JLT callMemmove + + // !!! Implement the copy from src to dst as a 16-byte load and store. + // (Decode's documentation says that dst and src must not overlap.) + // + // This always copies 16 bytes, instead of only length bytes, but that's + // OK. If the input is a valid Snappy encoding then subsequent iterations + // will fix up the overrun. Otherwise, Decode returns a nil []byte (and a + // non-nil error), so the overrun will be ignored. + // + // Note that on amd64, it is legal and cheap to issue unaligned 8-byte or + // 16-byte loads and stores. This technique probably wouldn't be as + // effective on architectures that are fussier about alignment. + MOVOU 0(SI), X0 + MOVOU X0, 0(DI) + + // d += length + // s += length + ADDQ CX, DI + ADDQ CX, SI + JMP loop + +callMemmove: + // if length > len(dst)-d || length > len(src)-s { etc } + CMPQ CX, AX + JGT errCorrupt + CMPQ CX, BX + JGT errCorrupt + + // copy(dst[d:], src[s:s+length]) + // + // This means calling runtime·memmove(&dst[d], &src[s], length), so we push + // DI, SI and CX as arguments. Coincidentally, we also need to spill those + // three registers to the stack, to save local variables across the CALL. + MOVQ DI, 0(SP) + MOVQ SI, 8(SP) + MOVQ CX, 16(SP) + MOVQ DI, 24(SP) + MOVQ SI, 32(SP) + MOVQ CX, 40(SP) + CALL runtime·memmove(SB) + + // Restore local variables: unspill registers from the stack and + // re-calculate R8-R13. + MOVQ 24(SP), DI + MOVQ 32(SP), SI + MOVQ 40(SP), CX + MOVQ dst_base+0(FP), R8 + MOVQ dst_len+8(FP), R9 + MOVQ R8, R10 + ADDQ R9, R10 + MOVQ src_base+24(FP), R11 + MOVQ src_len+32(FP), R12 + MOVQ R11, R13 + ADDQ R12, R13 + + // d += length + // s += length + ADDQ CX, DI + ADDQ CX, SI + JMP loop + +tagLit60Plus: + // !!! This fragment does the + // + // s += x - 58; if uint(s) > uint(len(src)) { etc } + // + // checks. In the asm version, we code it once instead of once per switch case. + ADDQ CX, SI + SUBQ $58, SI + MOVQ SI, BX + SUBQ R11, BX + CMPQ BX, R12 + JA errCorrupt + + // case x == 60: + CMPL CX, $61 + JEQ tagLit61 + JA tagLit62Plus + + // x = uint32(src[s-1]) + MOVBLZX -1(SI), CX + JMP doLit + +tagLit61: + // case x == 61: + // x = uint32(src[s-2]) | uint32(src[s-1])<<8 + MOVWLZX -2(SI), CX + JMP doLit + +tagLit62Plus: + CMPL CX, $62 + JA tagLit63 + + // case x == 62: + // x = uint32(src[s-3]) | uint32(src[s-2])<<8 | uint32(src[s-1])<<16 + MOVWLZX -3(SI), CX + MOVBLZX -1(SI), BX + SHLL $16, BX + ORL BX, CX + JMP doLit + +tagLit63: + // case x == 63: + // x = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24 + MOVL -4(SI), CX + JMP doLit + +// The code above handles literal tags. +// ---------------------------------------- +// The code below handles copy tags. + +tagCopy4: + // case tagCopy4: + // s += 5 + ADDQ $5, SI + + // if uint(s) > uint(len(src)) { etc } + MOVQ SI, BX + SUBQ R11, BX + CMPQ BX, R12 + JA errCorrupt + + // length = 1 + int(src[s-5])>>2 + SHRQ $2, CX + INCQ CX + + // offset = int(uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24) + MOVLQZX -4(SI), DX + JMP doCopy + +tagCopy2: + // case tagCopy2: + // s += 3 + ADDQ $3, SI + + // if uint(s) > uint(len(src)) { etc } + MOVQ SI, BX + SUBQ R11, BX + CMPQ BX, R12 + JA errCorrupt + + // length = 1 + int(src[s-3])>>2 + SHRQ $2, CX + INCQ CX + + // offset = int(uint32(src[s-2]) | uint32(src[s-1])<<8) + MOVWQZX -2(SI), DX + JMP doCopy + +tagCopy: + // We have a copy tag. We assume that: + // - BX == src[s] & 0x03 + // - CX == src[s] + CMPQ BX, $2 + JEQ tagCopy2 + JA tagCopy4 + + // case tagCopy1: + // s += 2 + ADDQ $2, SI + + // if uint(s) > uint(len(src)) { etc } + MOVQ SI, BX + SUBQ R11, BX + CMPQ BX, R12 + JA errCorrupt + + // offset = int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1])) + MOVQ CX, DX + ANDQ $0xe0, DX + SHLQ $3, DX + MOVBQZX -1(SI), BX + ORQ BX, DX + + // length = 4 + int(src[s-2])>>2&0x7 + SHRQ $2, CX + ANDQ $7, CX + ADDQ $4, CX + +doCopy: + // This is the end of the outer "switch", when we have a copy tag. + // + // We assume that: + // - CX == length && CX > 0 + // - DX == offset + + // if offset <= 0 { etc } + CMPQ DX, $0 + JLE errCorrupt + + // if d < offset { etc } + MOVQ DI, BX + SUBQ R8, BX + CMPQ BX, DX + JLT errCorrupt + + // if length > len(dst)-d { etc } + MOVQ R10, BX + SUBQ DI, BX + CMPQ CX, BX + JGT errCorrupt + + // forwardCopy(dst[d:d+length], dst[d-offset:]); d += length + // + // Set: + // - R14 = len(dst)-d + // - R15 = &dst[d-offset] + MOVQ R10, R14 + SUBQ DI, R14 + MOVQ DI, R15 + SUBQ DX, R15 + + // !!! Try a faster technique for short (16 or fewer bytes) forward copies. + // + // First, try using two 8-byte load/stores, similar to the doLit technique + // above. Even if dst[d:d+length] and dst[d-offset:] can overlap, this is + // still OK if offset >= 8. Note that this has to be two 8-byte load/stores + // and not one 16-byte load/store, and the first store has to be before the + // second load, due to the overlap if offset is in the range [8, 16). + // + // if length > 16 || offset < 8 || len(dst)-d < 16 { + // goto slowForwardCopy + // } + // copy 16 bytes + // d += length + CMPQ CX, $16 + JGT slowForwardCopy + CMPQ DX, $8 + JLT slowForwardCopy + CMPQ R14, $16 + JLT slowForwardCopy + MOVQ 0(R15), AX + MOVQ AX, 0(DI) + MOVQ 8(R15), BX + MOVQ BX, 8(DI) + ADDQ CX, DI + JMP loop + +slowForwardCopy: + // !!! If the forward copy is longer than 16 bytes, or if offset < 8, we + // can still try 8-byte load stores, provided we can overrun up to 10 extra + // bytes. As above, the overrun will be fixed up by subsequent iterations + // of the outermost loop. + // + // The C++ snappy code calls this technique IncrementalCopyFastPath. Its + // commentary says: + // + // ---- + // + // The main part of this loop is a simple copy of eight bytes at a time + // until we've copied (at least) the requested amount of bytes. However, + // if d and d-offset are less than eight bytes apart (indicating a + // repeating pattern of length < 8), we first need to expand the pattern in + // order to get the correct results. For instance, if the buffer looks like + // this, with the eight-byte and patterns marked as + // intervals: + // + // abxxxxxxxxxxxx + // [------] d-offset + // [------] d + // + // a single eight-byte copy from to will repeat the pattern + // once, after which we can move two bytes without moving : + // + // ababxxxxxxxxxx + // [------] d-offset + // [------] d + // + // and repeat the exercise until the two no longer overlap. + // + // This allows us to do very well in the special case of one single byte + // repeated many times, without taking a big hit for more general cases. + // + // The worst case of extra writing past the end of the match occurs when + // offset == 1 and length == 1; the last copy will read from byte positions + // [0..7] and write to [4..11], whereas it was only supposed to write to + // position 1. Thus, ten excess bytes. + // + // ---- + // + // That "10 byte overrun" worst case is confirmed by Go's + // TestSlowForwardCopyOverrun, which also tests the fixUpSlowForwardCopy + // and finishSlowForwardCopy algorithm. + // + // if length > len(dst)-d-10 { + // goto verySlowForwardCopy + // } + SUBQ $10, R14 + CMPQ CX, R14 + JGT verySlowForwardCopy + +makeOffsetAtLeast8: + // !!! As above, expand the pattern so that offset >= 8 and we can use + // 8-byte load/stores. + // + // for offset < 8 { + // copy 8 bytes from dst[d-offset:] to dst[d:] + // length -= offset + // d += offset + // offset += offset + // // The two previous lines together means that d-offset, and therefore + // // R15, is unchanged. + // } + CMPQ DX, $8 + JGE fixUpSlowForwardCopy + MOVQ (R15), BX + MOVQ BX, (DI) + SUBQ DX, CX + ADDQ DX, DI + ADDQ DX, DX + JMP makeOffsetAtLeast8 + +fixUpSlowForwardCopy: + // !!! Add length (which might be negative now) to d (implied by DI being + // &dst[d]) so that d ends up at the right place when we jump back to the + // top of the loop. Before we do that, though, we save DI to AX so that, if + // length is positive, copying the remaining length bytes will write to the + // right place. + MOVQ DI, AX + ADDQ CX, DI + +finishSlowForwardCopy: + // !!! Repeat 8-byte load/stores until length <= 0. Ending with a negative + // length means that we overrun, but as above, that will be fixed up by + // subsequent iterations of the outermost loop. + CMPQ CX, $0 + JLE loop + MOVQ (R15), BX + MOVQ BX, (AX) + ADDQ $8, R15 + ADDQ $8, AX + SUBQ $8, CX + JMP finishSlowForwardCopy + +verySlowForwardCopy: + // verySlowForwardCopy is a simple implementation of forward copy. In C + // parlance, this is a do/while loop instead of a while loop, since we know + // that length > 0. In Go syntax: + // + // for { + // dst[d] = dst[d - offset] + // d++ + // length-- + // if length == 0 { + // break + // } + // } + MOVB (R15), BX + MOVB BX, (DI) + INCQ R15 + INCQ DI + DECQ CX + JNZ verySlowForwardCopy + JMP loop + +// The code above handles copy tags. +// ---------------------------------------- + +end: + // This is the end of the "for s < len(src)". + // + // if d != len(dst) { etc } + CMPQ DI, R10 + JNE errCorrupt + + // return 0 + MOVQ $0, ret+48(FP) + RET + +errCorrupt: + // return decodeErrCodeCorrupt + MOVQ $1, ret+48(FP) + RET diff --git a/vendor/github.com/golang/snappy/decode_arm64.s b/vendor/github.com/golang/snappy/decode_arm64.s new file mode 100644 index 0000000000..7a3ead17ea --- /dev/null +++ b/vendor/github.com/golang/snappy/decode_arm64.s @@ -0,0 +1,494 @@ +// Copyright 2020 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 !appengine +// +build gc +// +build !noasm + +#include "textflag.h" + +// The asm code generally follows the pure Go code in decode_other.go, except +// where marked with a "!!!". + +// func decode(dst, src []byte) int +// +// All local variables fit into registers. The non-zero stack size is only to +// spill registers and push args when issuing a CALL. The register allocation: +// - R2 scratch +// - R3 scratch +// - R4 length or x +// - R5 offset +// - R6 &src[s] +// - R7 &dst[d] +// + R8 dst_base +// + R9 dst_len +// + R10 dst_base + dst_len +// + R11 src_base +// + R12 src_len +// + R13 src_base + src_len +// - R14 used by doCopy +// - R15 used by doCopy +// +// The registers R8-R13 (marked with a "+") are set at the start of the +// function, and after a CALL returns, and are not otherwise modified. +// +// The d variable is implicitly R7 - R8, and len(dst)-d is R10 - R7. +// The s variable is implicitly R6 - R11, and len(src)-s is R13 - R6. +TEXT ·decode(SB), NOSPLIT, $56-56 + // Initialize R6, R7 and R8-R13. + MOVD dst_base+0(FP), R8 + MOVD dst_len+8(FP), R9 + MOVD R8, R7 + MOVD R8, R10 + ADD R9, R10, R10 + MOVD src_base+24(FP), R11 + MOVD src_len+32(FP), R12 + MOVD R11, R6 + MOVD R11, R13 + ADD R12, R13, R13 + +loop: + // for s < len(src) + CMP R13, R6 + BEQ end + + // R4 = uint32(src[s]) + // + // switch src[s] & 0x03 + MOVBU (R6), R4 + MOVW R4, R3 + ANDW $3, R3 + MOVW $1, R1 + CMPW R1, R3 + BGE tagCopy + + // ---------------------------------------- + // The code below handles literal tags. + + // case tagLiteral: + // x := uint32(src[s] >> 2) + // switch + MOVW $60, R1 + LSRW $2, R4, R4 + CMPW R4, R1 + BLS tagLit60Plus + + // case x < 60: + // s++ + ADD $1, R6, R6 + +doLit: + // This is the end of the inner "switch", when we have a literal tag. + // + // We assume that R4 == x and x fits in a uint32, where x is the variable + // used in the pure Go decode_other.go code. + + // length = int(x) + 1 + // + // Unlike the pure Go code, we don't need to check if length <= 0 because + // R4 can hold 64 bits, so the increment cannot overflow. + ADD $1, R4, R4 + + // Prepare to check if copying length bytes will run past the end of dst or + // src. + // + // R2 = len(dst) - d + // R3 = len(src) - s + MOVD R10, R2 + SUB R7, R2, R2 + MOVD R13, R3 + SUB R6, R3, R3 + + // !!! Try a faster technique for short (16 or fewer bytes) copies. + // + // if length > 16 || len(dst)-d < 16 || len(src)-s < 16 { + // goto callMemmove // Fall back on calling runtime·memmove. + // } + // + // The C++ snappy code calls this TryFastAppend. It also checks len(src)-s + // against 21 instead of 16, because it cannot assume that all of its input + // is contiguous in memory and so it needs to leave enough source bytes to + // read the next tag without refilling buffers, but Go's Decode assumes + // contiguousness (the src argument is a []byte). + CMP $16, R4 + BGT callMemmove + CMP $16, R2 + BLT callMemmove + CMP $16, R3 + BLT callMemmove + + // !!! Implement the copy from src to dst as a 16-byte load and store. + // (Decode's documentation says that dst and src must not overlap.) + // + // This always copies 16 bytes, instead of only length bytes, but that's + // OK. If the input is a valid Snappy encoding then subsequent iterations + // will fix up the overrun. Otherwise, Decode returns a nil []byte (and a + // non-nil error), so the overrun will be ignored. + // + // Note that on arm64, it is legal and cheap to issue unaligned 8-byte or + // 16-byte loads and stores. This technique probably wouldn't be as + // effective on architectures that are fussier about alignment. + LDP 0(R6), (R14, R15) + STP (R14, R15), 0(R7) + + // d += length + // s += length + ADD R4, R7, R7 + ADD R4, R6, R6 + B loop + +callMemmove: + // if length > len(dst)-d || length > len(src)-s { etc } + CMP R2, R4 + BGT errCorrupt + CMP R3, R4 + BGT errCorrupt + + // copy(dst[d:], src[s:s+length]) + // + // This means calling runtime·memmove(&dst[d], &src[s], length), so we push + // R7, R6 and R4 as arguments. Coincidentally, we also need to spill those + // three registers to the stack, to save local variables across the CALL. + MOVD R7, 8(RSP) + MOVD R6, 16(RSP) + MOVD R4, 24(RSP) + MOVD R7, 32(RSP) + MOVD R6, 40(RSP) + MOVD R4, 48(RSP) + CALL runtime·memmove(SB) + + // Restore local variables: unspill registers from the stack and + // re-calculate R8-R13. + MOVD 32(RSP), R7 + MOVD 40(RSP), R6 + MOVD 48(RSP), R4 + MOVD dst_base+0(FP), R8 + MOVD dst_len+8(FP), R9 + MOVD R8, R10 + ADD R9, R10, R10 + MOVD src_base+24(FP), R11 + MOVD src_len+32(FP), R12 + MOVD R11, R13 + ADD R12, R13, R13 + + // d += length + // s += length + ADD R4, R7, R7 + ADD R4, R6, R6 + B loop + +tagLit60Plus: + // !!! This fragment does the + // + // s += x - 58; if uint(s) > uint(len(src)) { etc } + // + // checks. In the asm version, we code it once instead of once per switch case. + ADD R4, R6, R6 + SUB $58, R6, R6 + MOVD R6, R3 + SUB R11, R3, R3 + CMP R12, R3 + BGT errCorrupt + + // case x == 60: + MOVW $61, R1 + CMPW R1, R4 + BEQ tagLit61 + BGT tagLit62Plus + + // x = uint32(src[s-1]) + MOVBU -1(R6), R4 + B doLit + +tagLit61: + // case x == 61: + // x = uint32(src[s-2]) | uint32(src[s-1])<<8 + MOVHU -2(R6), R4 + B doLit + +tagLit62Plus: + CMPW $62, R4 + BHI tagLit63 + + // case x == 62: + // x = uint32(src[s-3]) | uint32(src[s-2])<<8 | uint32(src[s-1])<<16 + MOVHU -3(R6), R4 + MOVBU -1(R6), R3 + ORR R3<<16, R4 + B doLit + +tagLit63: + // case x == 63: + // x = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24 + MOVWU -4(R6), R4 + B doLit + + // The code above handles literal tags. + // ---------------------------------------- + // The code below handles copy tags. + +tagCopy4: + // case tagCopy4: + // s += 5 + ADD $5, R6, R6 + + // if uint(s) > uint(len(src)) { etc } + MOVD R6, R3 + SUB R11, R3, R3 + CMP R12, R3 + BGT errCorrupt + + // length = 1 + int(src[s-5])>>2 + MOVD $1, R1 + ADD R4>>2, R1, R4 + + // offset = int(uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24) + MOVWU -4(R6), R5 + B doCopy + +tagCopy2: + // case tagCopy2: + // s += 3 + ADD $3, R6, R6 + + // if uint(s) > uint(len(src)) { etc } + MOVD R6, R3 + SUB R11, R3, R3 + CMP R12, R3 + BGT errCorrupt + + // length = 1 + int(src[s-3])>>2 + MOVD $1, R1 + ADD R4>>2, R1, R4 + + // offset = int(uint32(src[s-2]) | uint32(src[s-1])<<8) + MOVHU -2(R6), R5 + B doCopy + +tagCopy: + // We have a copy tag. We assume that: + // - R3 == src[s] & 0x03 + // - R4 == src[s] + CMP $2, R3 + BEQ tagCopy2 + BGT tagCopy4 + + // case tagCopy1: + // s += 2 + ADD $2, R6, R6 + + // if uint(s) > uint(len(src)) { etc } + MOVD R6, R3 + SUB R11, R3, R3 + CMP R12, R3 + BGT errCorrupt + + // offset = int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1])) + MOVD R4, R5 + AND $0xe0, R5 + MOVBU -1(R6), R3 + ORR R5<<3, R3, R5 + + // length = 4 + int(src[s-2])>>2&0x7 + MOVD $7, R1 + AND R4>>2, R1, R4 + ADD $4, R4, R4 + +doCopy: + // This is the end of the outer "switch", when we have a copy tag. + // + // We assume that: + // - R4 == length && R4 > 0 + // - R5 == offset + + // if offset <= 0 { etc } + MOVD $0, R1 + CMP R1, R5 + BLE errCorrupt + + // if d < offset { etc } + MOVD R7, R3 + SUB R8, R3, R3 + CMP R5, R3 + BLT errCorrupt + + // if length > len(dst)-d { etc } + MOVD R10, R3 + SUB R7, R3, R3 + CMP R3, R4 + BGT errCorrupt + + // forwardCopy(dst[d:d+length], dst[d-offset:]); d += length + // + // Set: + // - R14 = len(dst)-d + // - R15 = &dst[d-offset] + MOVD R10, R14 + SUB R7, R14, R14 + MOVD R7, R15 + SUB R5, R15, R15 + + // !!! Try a faster technique for short (16 or fewer bytes) forward copies. + // + // First, try using two 8-byte load/stores, similar to the doLit technique + // above. Even if dst[d:d+length] and dst[d-offset:] can overlap, this is + // still OK if offset >= 8. Note that this has to be two 8-byte load/stores + // and not one 16-byte load/store, and the first store has to be before the + // second load, due to the overlap if offset is in the range [8, 16). + // + // if length > 16 || offset < 8 || len(dst)-d < 16 { + // goto slowForwardCopy + // } + // copy 16 bytes + // d += length + CMP $16, R4 + BGT slowForwardCopy + CMP $8, R5 + BLT slowForwardCopy + CMP $16, R14 + BLT slowForwardCopy + MOVD 0(R15), R2 + MOVD R2, 0(R7) + MOVD 8(R15), R3 + MOVD R3, 8(R7) + ADD R4, R7, R7 + B loop + +slowForwardCopy: + // !!! If the forward copy is longer than 16 bytes, or if offset < 8, we + // can still try 8-byte load stores, provided we can overrun up to 10 extra + // bytes. As above, the overrun will be fixed up by subsequent iterations + // of the outermost loop. + // + // The C++ snappy code calls this technique IncrementalCopyFastPath. Its + // commentary says: + // + // ---- + // + // The main part of this loop is a simple copy of eight bytes at a time + // until we've copied (at least) the requested amount of bytes. However, + // if d and d-offset are less than eight bytes apart (indicating a + // repeating pattern of length < 8), we first need to expand the pattern in + // order to get the correct results. For instance, if the buffer looks like + // this, with the eight-byte and patterns marked as + // intervals: + // + // abxxxxxxxxxxxx + // [------] d-offset + // [------] d + // + // a single eight-byte copy from to will repeat the pattern + // once, after which we can move two bytes without moving : + // + // ababxxxxxxxxxx + // [------] d-offset + // [------] d + // + // and repeat the exercise until the two no longer overlap. + // + // This allows us to do very well in the special case of one single byte + // repeated many times, without taking a big hit for more general cases. + // + // The worst case of extra writing past the end of the match occurs when + // offset == 1 and length == 1; the last copy will read from byte positions + // [0..7] and write to [4..11], whereas it was only supposed to write to + // position 1. Thus, ten excess bytes. + // + // ---- + // + // That "10 byte overrun" worst case is confirmed by Go's + // TestSlowForwardCopyOverrun, which also tests the fixUpSlowForwardCopy + // and finishSlowForwardCopy algorithm. + // + // if length > len(dst)-d-10 { + // goto verySlowForwardCopy + // } + SUB $10, R14, R14 + CMP R14, R4 + BGT verySlowForwardCopy + +makeOffsetAtLeast8: + // !!! As above, expand the pattern so that offset >= 8 and we can use + // 8-byte load/stores. + // + // for offset < 8 { + // copy 8 bytes from dst[d-offset:] to dst[d:] + // length -= offset + // d += offset + // offset += offset + // // The two previous lines together means that d-offset, and therefore + // // R15, is unchanged. + // } + CMP $8, R5 + BGE fixUpSlowForwardCopy + MOVD (R15), R3 + MOVD R3, (R7) + SUB R5, R4, R4 + ADD R5, R7, R7 + ADD R5, R5, R5 + B makeOffsetAtLeast8 + +fixUpSlowForwardCopy: + // !!! Add length (which might be negative now) to d (implied by R7 being + // &dst[d]) so that d ends up at the right place when we jump back to the + // top of the loop. Before we do that, though, we save R7 to R2 so that, if + // length is positive, copying the remaining length bytes will write to the + // right place. + MOVD R7, R2 + ADD R4, R7, R7 + +finishSlowForwardCopy: + // !!! Repeat 8-byte load/stores until length <= 0. Ending with a negative + // length means that we overrun, but as above, that will be fixed up by + // subsequent iterations of the outermost loop. + MOVD $0, R1 + CMP R1, R4 + BLE loop + MOVD (R15), R3 + MOVD R3, (R2) + ADD $8, R15, R15 + ADD $8, R2, R2 + SUB $8, R4, R4 + B finishSlowForwardCopy + +verySlowForwardCopy: + // verySlowForwardCopy is a simple implementation of forward copy. In C + // parlance, this is a do/while loop instead of a while loop, since we know + // that length > 0. In Go syntax: + // + // for { + // dst[d] = dst[d - offset] + // d++ + // length-- + // if length == 0 { + // break + // } + // } + MOVB (R15), R3 + MOVB R3, (R7) + ADD $1, R15, R15 + ADD $1, R7, R7 + SUB $1, R4, R4 + CBNZ R4, verySlowForwardCopy + B loop + + // The code above handles copy tags. + // ---------------------------------------- + +end: + // This is the end of the "for s < len(src)". + // + // if d != len(dst) { etc } + CMP R10, R7 + BNE errCorrupt + + // return 0 + MOVD $0, ret+48(FP) + RET + +errCorrupt: + // return decodeErrCodeCorrupt + MOVD $1, R2 + MOVD R2, ret+48(FP) + RET diff --git a/vendor/github.com/golang/snappy/decode_asm.go b/vendor/github.com/golang/snappy/decode_asm.go new file mode 100644 index 0000000000..7082b34919 --- /dev/null +++ b/vendor/github.com/golang/snappy/decode_asm.go @@ -0,0 +1,15 @@ +// Copyright 2016 The Snappy-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 !appengine +// +build gc +// +build !noasm +// +build amd64 arm64 + +package snappy + +// decode has the same semantics as in decode_other.go. +// +//go:noescape +func decode(dst, src []byte) int diff --git a/vendor/github.com/golang/snappy/decode_other.go b/vendor/github.com/golang/snappy/decode_other.go new file mode 100644 index 0000000000..2f672be557 --- /dev/null +++ b/vendor/github.com/golang/snappy/decode_other.go @@ -0,0 +1,115 @@ +// Copyright 2016 The Snappy-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 !amd64,!arm64 appengine !gc noasm + +package snappy + +// decode writes the decoding of src to dst. It assumes that the varint-encoded +// length of the decompressed bytes has already been read, and that len(dst) +// equals that length. +// +// It returns 0 on success or a decodeErrCodeXxx error code on failure. +func decode(dst, src []byte) int { + var d, s, offset, length int + for s < len(src) { + switch src[s] & 0x03 { + case tagLiteral: + x := uint32(src[s] >> 2) + switch { + case x < 60: + s++ + case x == 60: + s += 2 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + x = uint32(src[s-1]) + case x == 61: + s += 3 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + x = uint32(src[s-2]) | uint32(src[s-1])<<8 + case x == 62: + s += 4 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + x = uint32(src[s-3]) | uint32(src[s-2])<<8 | uint32(src[s-1])<<16 + case x == 63: + s += 5 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + x = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24 + } + length = int(x) + 1 + if length <= 0 { + return decodeErrCodeUnsupportedLiteralLength + } + if length > len(dst)-d || length > len(src)-s { + return decodeErrCodeCorrupt + } + copy(dst[d:], src[s:s+length]) + d += length + s += length + continue + + case tagCopy1: + s += 2 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + length = 4 + int(src[s-2])>>2&0x7 + offset = int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1])) + + case tagCopy2: + s += 3 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + length = 1 + int(src[s-3])>>2 + offset = int(uint32(src[s-2]) | uint32(src[s-1])<<8) + + case tagCopy4: + s += 5 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + length = 1 + int(src[s-5])>>2 + offset = int(uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24) + } + + if offset <= 0 || d < offset || length > len(dst)-d { + return decodeErrCodeCorrupt + } + // Copy from an earlier sub-slice of dst to a later sub-slice. + // If no overlap, use the built-in copy: + if offset >= length { + copy(dst[d:d+length], dst[d-offset:]) + d += length + continue + } + + // Unlike the built-in copy function, this byte-by-byte copy always runs + // forwards, even if the slices overlap. Conceptually, this is: + // + // d += forwardCopy(dst[d:d+length], dst[d-offset:]) + // + // We align the slices into a and b and show the compiler they are the same size. + // This allows the loop to run without bounds checks. + a := dst[d : d+length] + b := dst[d-offset:] + b = b[:len(a)] + for i := range a { + a[i] = b[i] + } + d += length + } + if d != len(dst) { + return decodeErrCodeCorrupt + } + return 0 +} diff --git a/vendor/github.com/golang/snappy/encode.go b/vendor/github.com/golang/snappy/encode.go new file mode 100644 index 0000000000..7f23657076 --- /dev/null +++ b/vendor/github.com/golang/snappy/encode.go @@ -0,0 +1,289 @@ +// Copyright 2011 The Snappy-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 snappy + +import ( + "encoding/binary" + "errors" + "io" +) + +// Encode returns the encoded form of src. The returned slice may be a sub- +// slice of dst if dst was large enough to hold the entire encoded block. +// Otherwise, a newly allocated slice will be returned. +// +// The dst and src must not overlap. It is valid to pass a nil dst. +// +// Encode handles the Snappy block format, not the Snappy stream format. +func Encode(dst, src []byte) []byte { + if n := MaxEncodedLen(len(src)); n < 0 { + panic(ErrTooLarge) + } else if len(dst) < n { + dst = make([]byte, n) + } + + // The block starts with the varint-encoded length of the decompressed bytes. + d := binary.PutUvarint(dst, uint64(len(src))) + + for len(src) > 0 { + p := src + src = nil + if len(p) > maxBlockSize { + p, src = p[:maxBlockSize], p[maxBlockSize:] + } + if len(p) < minNonLiteralBlockSize { + d += emitLiteral(dst[d:], p) + } else { + d += encodeBlock(dst[d:], p) + } + } + return dst[:d] +} + +// inputMargin is the minimum number of extra input bytes to keep, inside +// encodeBlock's inner loop. On some architectures, this margin lets us +// implement a fast path for emitLiteral, where the copy of short (<= 16 byte) +// literals can be implemented as a single load to and store from a 16-byte +// register. That literal's actual length can be as short as 1 byte, so this +// can copy up to 15 bytes too much, but that's OK as subsequent iterations of +// the encoding loop will fix up the copy overrun, and this inputMargin ensures +// that we don't overrun the dst and src buffers. +const inputMargin = 16 - 1 + +// minNonLiteralBlockSize is the minimum size of the input to encodeBlock that +// could be encoded with a copy tag. This is the minimum with respect to the +// algorithm used by encodeBlock, not a minimum enforced by the file format. +// +// The encoded output must start with at least a 1 byte literal, as there are +// no previous bytes to copy. A minimal (1 byte) copy after that, generated +// from an emitCopy call in encodeBlock's main loop, would require at least +// another inputMargin bytes, for the reason above: we want any emitLiteral +// calls inside encodeBlock's main loop to use the fast path if possible, which +// requires being able to overrun by inputMargin bytes. Thus, +// minNonLiteralBlockSize equals 1 + 1 + inputMargin. +// +// The C++ code doesn't use this exact threshold, but it could, as discussed at +// https://groups.google.com/d/topic/snappy-compression/oGbhsdIJSJ8/discussion +// The difference between Go (2+inputMargin) and C++ (inputMargin) is purely an +// optimization. It should not affect the encoded form. This is tested by +// TestSameEncodingAsCppShortCopies. +const minNonLiteralBlockSize = 1 + 1 + inputMargin + +// MaxEncodedLen returns the maximum length of a snappy block, given its +// uncompressed length. +// +// It will return a negative value if srcLen is too large to encode. +func MaxEncodedLen(srcLen int) int { + n := uint64(srcLen) + if n > 0xffffffff { + return -1 + } + // Compressed data can be defined as: + // compressed := item* literal* + // item := literal* copy + // + // The trailing literal sequence has a space blowup of at most 62/60 + // since a literal of length 60 needs one tag byte + one extra byte + // for length information. + // + // Item blowup is trickier to measure. Suppose the "copy" op copies + // 4 bytes of data. Because of a special check in the encoding code, + // we produce a 4-byte copy only if the offset is < 65536. Therefore + // the copy op takes 3 bytes to encode, and this type of item leads + // to at most the 62/60 blowup for representing literals. + // + // Suppose the "copy" op copies 5 bytes of data. If the offset is big + // enough, it will take 5 bytes to encode the copy op. Therefore the + // worst case here is a one-byte literal followed by a five-byte copy. + // That is, 6 bytes of input turn into 7 bytes of "compressed" data. + // + // This last factor dominates the blowup, so the final estimate is: + n = 32 + n + n/6 + if n > 0xffffffff { + return -1 + } + return int(n) +} + +var errClosed = errors.New("snappy: Writer is closed") + +// NewWriter returns a new Writer that compresses to w. +// +// The Writer returned does not buffer writes. There is no need to Flush or +// Close such a Writer. +// +// Deprecated: the Writer returned is not suitable for many small writes, only +// for few large writes. Use NewBufferedWriter instead, which is efficient +// regardless of the frequency and shape of the writes, and remember to Close +// that Writer when done. +func NewWriter(w io.Writer) *Writer { + return &Writer{ + w: w, + obuf: make([]byte, obufLen), + } +} + +// NewBufferedWriter returns a new Writer that compresses to w, using the +// framing format described at +// https://github.com/google/snappy/blob/master/framing_format.txt +// +// The Writer returned buffers writes. Users must call Close to guarantee all +// data has been forwarded to the underlying io.Writer. They may also call +// Flush zero or more times before calling Close. +func NewBufferedWriter(w io.Writer) *Writer { + return &Writer{ + w: w, + ibuf: make([]byte, 0, maxBlockSize), + obuf: make([]byte, obufLen), + } +} + +// Writer is an io.Writer that can write Snappy-compressed bytes. +// +// Writer handles the Snappy stream format, not the Snappy block format. +type Writer struct { + w io.Writer + err error + + // ibuf is a buffer for the incoming (uncompressed) bytes. + // + // Its use is optional. For backwards compatibility, Writers created by the + // NewWriter function have ibuf == nil, do not buffer incoming bytes, and + // therefore do not need to be Flush'ed or Close'd. + ibuf []byte + + // obuf is a buffer for the outgoing (compressed) bytes. + obuf []byte + + // wroteStreamHeader is whether we have written the stream header. + wroteStreamHeader bool +} + +// Reset discards the writer's state and switches the Snappy writer to write to +// w. This permits reusing a Writer rather than allocating a new one. +func (w *Writer) Reset(writer io.Writer) { + w.w = writer + w.err = nil + if w.ibuf != nil { + w.ibuf = w.ibuf[:0] + } + w.wroteStreamHeader = false +} + +// Write satisfies the io.Writer interface. +func (w *Writer) Write(p []byte) (nRet int, errRet error) { + if w.ibuf == nil { + // Do not buffer incoming bytes. This does not perform or compress well + // if the caller of Writer.Write writes many small slices. This + // behavior is therefore deprecated, but still supported for backwards + // compatibility with code that doesn't explicitly Flush or Close. + return w.write(p) + } + + // The remainder of this method is based on bufio.Writer.Write from the + // standard library. + + for len(p) > (cap(w.ibuf)-len(w.ibuf)) && w.err == nil { + var n int + if len(w.ibuf) == 0 { + // Large write, empty buffer. + // Write directly from p to avoid copy. + n, _ = w.write(p) + } else { + n = copy(w.ibuf[len(w.ibuf):cap(w.ibuf)], p) + w.ibuf = w.ibuf[:len(w.ibuf)+n] + w.Flush() + } + nRet += n + p = p[n:] + } + if w.err != nil { + return nRet, w.err + } + n := copy(w.ibuf[len(w.ibuf):cap(w.ibuf)], p) + w.ibuf = w.ibuf[:len(w.ibuf)+n] + nRet += n + return nRet, nil +} + +func (w *Writer) write(p []byte) (nRet int, errRet error) { + if w.err != nil { + return 0, w.err + } + for len(p) > 0 { + obufStart := len(magicChunk) + if !w.wroteStreamHeader { + w.wroteStreamHeader = true + copy(w.obuf, magicChunk) + obufStart = 0 + } + + var uncompressed []byte + if len(p) > maxBlockSize { + uncompressed, p = p[:maxBlockSize], p[maxBlockSize:] + } else { + uncompressed, p = p, nil + } + checksum := crc(uncompressed) + + // Compress the buffer, discarding the result if the improvement + // isn't at least 12.5%. + compressed := Encode(w.obuf[obufHeaderLen:], uncompressed) + chunkType := uint8(chunkTypeCompressedData) + chunkLen := 4 + len(compressed) + obufEnd := obufHeaderLen + len(compressed) + if len(compressed) >= len(uncompressed)-len(uncompressed)/8 { + chunkType = chunkTypeUncompressedData + chunkLen = 4 + len(uncompressed) + obufEnd = obufHeaderLen + } + + // Fill in the per-chunk header that comes before the body. + w.obuf[len(magicChunk)+0] = chunkType + w.obuf[len(magicChunk)+1] = uint8(chunkLen >> 0) + w.obuf[len(magicChunk)+2] = uint8(chunkLen >> 8) + w.obuf[len(magicChunk)+3] = uint8(chunkLen >> 16) + w.obuf[len(magicChunk)+4] = uint8(checksum >> 0) + w.obuf[len(magicChunk)+5] = uint8(checksum >> 8) + w.obuf[len(magicChunk)+6] = uint8(checksum >> 16) + w.obuf[len(magicChunk)+7] = uint8(checksum >> 24) + + if _, err := w.w.Write(w.obuf[obufStart:obufEnd]); err != nil { + w.err = err + return nRet, err + } + if chunkType == chunkTypeUncompressedData { + if _, err := w.w.Write(uncompressed); err != nil { + w.err = err + return nRet, err + } + } + nRet += len(uncompressed) + } + return nRet, nil +} + +// Flush flushes the Writer to its underlying io.Writer. +func (w *Writer) Flush() error { + if w.err != nil { + return w.err + } + if len(w.ibuf) == 0 { + return nil + } + w.write(w.ibuf) + w.ibuf = w.ibuf[:0] + return w.err +} + +// Close calls Flush and then closes the Writer. +func (w *Writer) Close() error { + w.Flush() + ret := w.err + if w.err == nil { + w.err = errClosed + } + return ret +} diff --git a/vendor/github.com/golang/snappy/encode_amd64.s b/vendor/github.com/golang/snappy/encode_amd64.s new file mode 100644 index 0000000000..adfd979fe2 --- /dev/null +++ b/vendor/github.com/golang/snappy/encode_amd64.s @@ -0,0 +1,730 @@ +// 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 !appengine +// +build gc +// +build !noasm + +#include "textflag.h" + +// The XXX lines assemble on Go 1.4, 1.5 and 1.7, but not 1.6, due to a +// Go toolchain regression. See https://github.com/golang/go/issues/15426 and +// https://github.com/golang/snappy/issues/29 +// +// As a workaround, the package was built with a known good assembler, and +// those instructions were disassembled by "objdump -d" to yield the +// 4e 0f b7 7c 5c 78 movzwq 0x78(%rsp,%r11,2),%r15 +// style comments, in AT&T asm syntax. Note that rsp here is a physical +// register, not Go/asm's SP pseudo-register (see https://golang.org/doc/asm). +// The instructions were then encoded as "BYTE $0x.." sequences, which assemble +// fine on Go 1.6. + +// The asm code generally follows the pure Go code in encode_other.go, except +// where marked with a "!!!". + +// ---------------------------------------------------------------------------- + +// func emitLiteral(dst, lit []byte) int +// +// All local variables fit into registers. The register allocation: +// - AX len(lit) +// - BX n +// - DX return value +// - DI &dst[i] +// - R10 &lit[0] +// +// The 24 bytes of stack space is to call runtime·memmove. +// +// The unusual register allocation of local variables, such as R10 for the +// source pointer, matches the allocation used at the call site in encodeBlock, +// which makes it easier to manually inline this function. +TEXT ·emitLiteral(SB), NOSPLIT, $24-56 + MOVQ dst_base+0(FP), DI + MOVQ lit_base+24(FP), R10 + MOVQ lit_len+32(FP), AX + MOVQ AX, DX + MOVL AX, BX + SUBL $1, BX + + CMPL BX, $60 + JLT oneByte + CMPL BX, $256 + JLT twoBytes + +threeBytes: + MOVB $0xf4, 0(DI) + MOVW BX, 1(DI) + ADDQ $3, DI + ADDQ $3, DX + JMP memmove + +twoBytes: + MOVB $0xf0, 0(DI) + MOVB BX, 1(DI) + ADDQ $2, DI + ADDQ $2, DX + JMP memmove + +oneByte: + SHLB $2, BX + MOVB BX, 0(DI) + ADDQ $1, DI + ADDQ $1, DX + +memmove: + MOVQ DX, ret+48(FP) + + // copy(dst[i:], lit) + // + // This means calling runtime·memmove(&dst[i], &lit[0], len(lit)), so we push + // DI, R10 and AX as arguments. + MOVQ DI, 0(SP) + MOVQ R10, 8(SP) + MOVQ AX, 16(SP) + CALL runtime·memmove(SB) + RET + +// ---------------------------------------------------------------------------- + +// func emitCopy(dst []byte, offset, length int) int +// +// All local variables fit into registers. The register allocation: +// - AX length +// - SI &dst[0] +// - DI &dst[i] +// - R11 offset +// +// The unusual register allocation of local variables, such as R11 for the +// offset, matches the allocation used at the call site in encodeBlock, which +// makes it easier to manually inline this function. +TEXT ·emitCopy(SB), NOSPLIT, $0-48 + MOVQ dst_base+0(FP), DI + MOVQ DI, SI + MOVQ offset+24(FP), R11 + MOVQ length+32(FP), AX + +loop0: + // for length >= 68 { etc } + CMPL AX, $68 + JLT step1 + + // Emit a length 64 copy, encoded as 3 bytes. + MOVB $0xfe, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + SUBL $64, AX + JMP loop0 + +step1: + // if length > 64 { etc } + CMPL AX, $64 + JLE step2 + + // Emit a length 60 copy, encoded as 3 bytes. + MOVB $0xee, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + SUBL $60, AX + +step2: + // if length >= 12 || offset >= 2048 { goto step3 } + CMPL AX, $12 + JGE step3 + CMPL R11, $2048 + JGE step3 + + // Emit the remaining copy, encoded as 2 bytes. + MOVB R11, 1(DI) + SHRL $8, R11 + SHLB $5, R11 + SUBB $4, AX + SHLB $2, AX + ORB AX, R11 + ORB $1, R11 + MOVB R11, 0(DI) + ADDQ $2, DI + + // Return the number of bytes written. + SUBQ SI, DI + MOVQ DI, ret+40(FP) + RET + +step3: + // Emit the remaining copy, encoded as 3 bytes. + SUBL $1, AX + SHLB $2, AX + ORB $2, AX + MOVB AX, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + + // Return the number of bytes written. + SUBQ SI, DI + MOVQ DI, ret+40(FP) + RET + +// ---------------------------------------------------------------------------- + +// func extendMatch(src []byte, i, j int) int +// +// All local variables fit into registers. The register allocation: +// - DX &src[0] +// - SI &src[j] +// - R13 &src[len(src) - 8] +// - R14 &src[len(src)] +// - R15 &src[i] +// +// The unusual register allocation of local variables, such as R15 for a source +// pointer, matches the allocation used at the call site in encodeBlock, which +// makes it easier to manually inline this function. +TEXT ·extendMatch(SB), NOSPLIT, $0-48 + MOVQ src_base+0(FP), DX + MOVQ src_len+8(FP), R14 + MOVQ i+24(FP), R15 + MOVQ j+32(FP), SI + ADDQ DX, R14 + ADDQ DX, R15 + ADDQ DX, SI + MOVQ R14, R13 + SUBQ $8, R13 + +cmp8: + // As long as we are 8 or more bytes before the end of src, we can load and + // compare 8 bytes at a time. If those 8 bytes are equal, repeat. + CMPQ SI, R13 + JA cmp1 + MOVQ (R15), AX + MOVQ (SI), BX + CMPQ AX, BX + JNE bsf + ADDQ $8, R15 + ADDQ $8, SI + JMP cmp8 + +bsf: + // If those 8 bytes were not equal, XOR the two 8 byte values, and return + // the index of the first byte that differs. The BSF instruction finds the + // least significant 1 bit, the amd64 architecture is little-endian, and + // the shift by 3 converts a bit index to a byte index. + XORQ AX, BX + BSFQ BX, BX + SHRQ $3, BX + ADDQ BX, SI + + // Convert from &src[ret] to ret. + SUBQ DX, SI + MOVQ SI, ret+40(FP) + RET + +cmp1: + // In src's tail, compare 1 byte at a time. + CMPQ SI, R14 + JAE extendMatchEnd + MOVB (R15), AX + MOVB (SI), BX + CMPB AX, BX + JNE extendMatchEnd + ADDQ $1, R15 + ADDQ $1, SI + JMP cmp1 + +extendMatchEnd: + // Convert from &src[ret] to ret. + SUBQ DX, SI + MOVQ SI, ret+40(FP) + RET + +// ---------------------------------------------------------------------------- + +// func encodeBlock(dst, src []byte) (d int) +// +// All local variables fit into registers, other than "var table". The register +// allocation: +// - AX . . +// - BX . . +// - CX 56 shift (note that amd64 shifts by non-immediates must use CX). +// - DX 64 &src[0], tableSize +// - SI 72 &src[s] +// - DI 80 &dst[d] +// - R9 88 sLimit +// - R10 . &src[nextEmit] +// - R11 96 prevHash, currHash, nextHash, offset +// - R12 104 &src[base], skip +// - R13 . &src[nextS], &src[len(src) - 8] +// - R14 . len(src), bytesBetweenHashLookups, &src[len(src)], x +// - R15 112 candidate +// +// The second column (56, 64, etc) is the stack offset to spill the registers +// when calling other functions. We could pack this slightly tighter, but it's +// simpler to have a dedicated spill map independent of the function called. +// +// "var table [maxTableSize]uint16" takes up 32768 bytes of stack space. An +// extra 56 bytes, to call other functions, and an extra 64 bytes, to spill +// local variables (registers) during calls gives 32768 + 56 + 64 = 32888. +TEXT ·encodeBlock(SB), 0, $32888-56 + MOVQ dst_base+0(FP), DI + MOVQ src_base+24(FP), SI + MOVQ src_len+32(FP), R14 + + // shift, tableSize := uint32(32-8), 1<<8 + MOVQ $24, CX + MOVQ $256, DX + +calcShift: + // for ; tableSize < maxTableSize && tableSize < len(src); tableSize *= 2 { + // shift-- + // } + CMPQ DX, $16384 + JGE varTable + CMPQ DX, R14 + JGE varTable + SUBQ $1, CX + SHLQ $1, DX + JMP calcShift + +varTable: + // var table [maxTableSize]uint16 + // + // In the asm code, unlike the Go code, we can zero-initialize only the + // first tableSize elements. Each uint16 element is 2 bytes and each MOVOU + // writes 16 bytes, so we can do only tableSize/8 writes instead of the + // 2048 writes that would zero-initialize all of table's 32768 bytes. + SHRQ $3, DX + LEAQ table-32768(SP), BX + PXOR X0, X0 + +memclr: + MOVOU X0, 0(BX) + ADDQ $16, BX + SUBQ $1, DX + JNZ memclr + + // !!! DX = &src[0] + MOVQ SI, DX + + // sLimit := len(src) - inputMargin + MOVQ R14, R9 + SUBQ $15, R9 + + // !!! Pre-emptively spill CX, DX and R9 to the stack. Their values don't + // change for the rest of the function. + MOVQ CX, 56(SP) + MOVQ DX, 64(SP) + MOVQ R9, 88(SP) + + // nextEmit := 0 + MOVQ DX, R10 + + // s := 1 + ADDQ $1, SI + + // nextHash := hash(load32(src, s), shift) + MOVL 0(SI), R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + +outer: + // for { etc } + + // skip := 32 + MOVQ $32, R12 + + // nextS := s + MOVQ SI, R13 + + // candidate := 0 + MOVQ $0, R15 + +inner0: + // for { etc } + + // s := nextS + MOVQ R13, SI + + // bytesBetweenHashLookups := skip >> 5 + MOVQ R12, R14 + SHRQ $5, R14 + + // nextS = s + bytesBetweenHashLookups + ADDQ R14, R13 + + // skip += bytesBetweenHashLookups + ADDQ R14, R12 + + // if nextS > sLimit { goto emitRemainder } + MOVQ R13, AX + SUBQ DX, AX + CMPQ AX, R9 + JA emitRemainder + + // candidate = int(table[nextHash]) + // XXX: MOVWQZX table-32768(SP)(R11*2), R15 + // XXX: 4e 0f b7 7c 5c 78 movzwq 0x78(%rsp,%r11,2),%r15 + BYTE $0x4e + BYTE $0x0f + BYTE $0xb7 + BYTE $0x7c + BYTE $0x5c + BYTE $0x78 + + // table[nextHash] = uint16(s) + MOVQ SI, AX + SUBQ DX, AX + + // XXX: MOVW AX, table-32768(SP)(R11*2) + // XXX: 66 42 89 44 5c 78 mov %ax,0x78(%rsp,%r11,2) + BYTE $0x66 + BYTE $0x42 + BYTE $0x89 + BYTE $0x44 + BYTE $0x5c + BYTE $0x78 + + // nextHash = hash(load32(src, nextS), shift) + MOVL 0(R13), R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + + // if load32(src, s) != load32(src, candidate) { continue } break + MOVL 0(SI), AX + MOVL (DX)(R15*1), BX + CMPL AX, BX + JNE inner0 + +fourByteMatch: + // As per the encode_other.go code: + // + // A 4-byte match has been found. We'll later see etc. + + // !!! Jump to a fast path for short (<= 16 byte) literals. See the comment + // on inputMargin in encode.go. + MOVQ SI, AX + SUBQ R10, AX + CMPQ AX, $16 + JLE emitLiteralFastPath + + // ---------------------------------------- + // Begin inline of the emitLiteral call. + // + // d += emitLiteral(dst[d:], src[nextEmit:s]) + + MOVL AX, BX + SUBL $1, BX + + CMPL BX, $60 + JLT inlineEmitLiteralOneByte + CMPL BX, $256 + JLT inlineEmitLiteralTwoBytes + +inlineEmitLiteralThreeBytes: + MOVB $0xf4, 0(DI) + MOVW BX, 1(DI) + ADDQ $3, DI + JMP inlineEmitLiteralMemmove + +inlineEmitLiteralTwoBytes: + MOVB $0xf0, 0(DI) + MOVB BX, 1(DI) + ADDQ $2, DI + JMP inlineEmitLiteralMemmove + +inlineEmitLiteralOneByte: + SHLB $2, BX + MOVB BX, 0(DI) + ADDQ $1, DI + +inlineEmitLiteralMemmove: + // Spill local variables (registers) onto the stack; call; unspill. + // + // copy(dst[i:], lit) + // + // This means calling runtime·memmove(&dst[i], &lit[0], len(lit)), so we push + // DI, R10 and AX as arguments. + MOVQ DI, 0(SP) + MOVQ R10, 8(SP) + MOVQ AX, 16(SP) + ADDQ AX, DI // Finish the "d +=" part of "d += emitLiteral(etc)". + MOVQ SI, 72(SP) + MOVQ DI, 80(SP) + MOVQ R15, 112(SP) + CALL runtime·memmove(SB) + MOVQ 56(SP), CX + MOVQ 64(SP), DX + MOVQ 72(SP), SI + MOVQ 80(SP), DI + MOVQ 88(SP), R9 + MOVQ 112(SP), R15 + JMP inner1 + +inlineEmitLiteralEnd: + // End inline of the emitLiteral call. + // ---------------------------------------- + +emitLiteralFastPath: + // !!! Emit the 1-byte encoding "uint8(len(lit)-1)<<2". + MOVB AX, BX + SUBB $1, BX + SHLB $2, BX + MOVB BX, (DI) + ADDQ $1, DI + + // !!! Implement the copy from lit to dst as a 16-byte load and store. + // (Encode's documentation says that dst and src must not overlap.) + // + // This always copies 16 bytes, instead of only len(lit) bytes, but that's + // OK. Subsequent iterations will fix up the overrun. + // + // Note that on amd64, it is legal and cheap to issue unaligned 8-byte or + // 16-byte loads and stores. This technique probably wouldn't be as + // effective on architectures that are fussier about alignment. + MOVOU 0(R10), X0 + MOVOU X0, 0(DI) + ADDQ AX, DI + +inner1: + // for { etc } + + // base := s + MOVQ SI, R12 + + // !!! offset := base - candidate + MOVQ R12, R11 + SUBQ R15, R11 + SUBQ DX, R11 + + // ---------------------------------------- + // Begin inline of the extendMatch call. + // + // s = extendMatch(src, candidate+4, s+4) + + // !!! R14 = &src[len(src)] + MOVQ src_len+32(FP), R14 + ADDQ DX, R14 + + // !!! R13 = &src[len(src) - 8] + MOVQ R14, R13 + SUBQ $8, R13 + + // !!! R15 = &src[candidate + 4] + ADDQ $4, R15 + ADDQ DX, R15 + + // !!! s += 4 + ADDQ $4, SI + +inlineExtendMatchCmp8: + // As long as we are 8 or more bytes before the end of src, we can load and + // compare 8 bytes at a time. If those 8 bytes are equal, repeat. + CMPQ SI, R13 + JA inlineExtendMatchCmp1 + MOVQ (R15), AX + MOVQ (SI), BX + CMPQ AX, BX + JNE inlineExtendMatchBSF + ADDQ $8, R15 + ADDQ $8, SI + JMP inlineExtendMatchCmp8 + +inlineExtendMatchBSF: + // If those 8 bytes were not equal, XOR the two 8 byte values, and return + // the index of the first byte that differs. The BSF instruction finds the + // least significant 1 bit, the amd64 architecture is little-endian, and + // the shift by 3 converts a bit index to a byte index. + XORQ AX, BX + BSFQ BX, BX + SHRQ $3, BX + ADDQ BX, SI + JMP inlineExtendMatchEnd + +inlineExtendMatchCmp1: + // In src's tail, compare 1 byte at a time. + CMPQ SI, R14 + JAE inlineExtendMatchEnd + MOVB (R15), AX + MOVB (SI), BX + CMPB AX, BX + JNE inlineExtendMatchEnd + ADDQ $1, R15 + ADDQ $1, SI + JMP inlineExtendMatchCmp1 + +inlineExtendMatchEnd: + // End inline of the extendMatch call. + // ---------------------------------------- + + // ---------------------------------------- + // Begin inline of the emitCopy call. + // + // d += emitCopy(dst[d:], base-candidate, s-base) + + // !!! length := s - base + MOVQ SI, AX + SUBQ R12, AX + +inlineEmitCopyLoop0: + // for length >= 68 { etc } + CMPL AX, $68 + JLT inlineEmitCopyStep1 + + // Emit a length 64 copy, encoded as 3 bytes. + MOVB $0xfe, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + SUBL $64, AX + JMP inlineEmitCopyLoop0 + +inlineEmitCopyStep1: + // if length > 64 { etc } + CMPL AX, $64 + JLE inlineEmitCopyStep2 + + // Emit a length 60 copy, encoded as 3 bytes. + MOVB $0xee, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + SUBL $60, AX + +inlineEmitCopyStep2: + // if length >= 12 || offset >= 2048 { goto inlineEmitCopyStep3 } + CMPL AX, $12 + JGE inlineEmitCopyStep3 + CMPL R11, $2048 + JGE inlineEmitCopyStep3 + + // Emit the remaining copy, encoded as 2 bytes. + MOVB R11, 1(DI) + SHRL $8, R11 + SHLB $5, R11 + SUBB $4, AX + SHLB $2, AX + ORB AX, R11 + ORB $1, R11 + MOVB R11, 0(DI) + ADDQ $2, DI + JMP inlineEmitCopyEnd + +inlineEmitCopyStep3: + // Emit the remaining copy, encoded as 3 bytes. + SUBL $1, AX + SHLB $2, AX + ORB $2, AX + MOVB AX, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + +inlineEmitCopyEnd: + // End inline of the emitCopy call. + // ---------------------------------------- + + // nextEmit = s + MOVQ SI, R10 + + // if s >= sLimit { goto emitRemainder } + MOVQ SI, AX + SUBQ DX, AX + CMPQ AX, R9 + JAE emitRemainder + + // As per the encode_other.go code: + // + // We could immediately etc. + + // x := load64(src, s-1) + MOVQ -1(SI), R14 + + // prevHash := hash(uint32(x>>0), shift) + MOVL R14, R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + + // table[prevHash] = uint16(s-1) + MOVQ SI, AX + SUBQ DX, AX + SUBQ $1, AX + + // XXX: MOVW AX, table-32768(SP)(R11*2) + // XXX: 66 42 89 44 5c 78 mov %ax,0x78(%rsp,%r11,2) + BYTE $0x66 + BYTE $0x42 + BYTE $0x89 + BYTE $0x44 + BYTE $0x5c + BYTE $0x78 + + // currHash := hash(uint32(x>>8), shift) + SHRQ $8, R14 + MOVL R14, R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + + // candidate = int(table[currHash]) + // XXX: MOVWQZX table-32768(SP)(R11*2), R15 + // XXX: 4e 0f b7 7c 5c 78 movzwq 0x78(%rsp,%r11,2),%r15 + BYTE $0x4e + BYTE $0x0f + BYTE $0xb7 + BYTE $0x7c + BYTE $0x5c + BYTE $0x78 + + // table[currHash] = uint16(s) + ADDQ $1, AX + + // XXX: MOVW AX, table-32768(SP)(R11*2) + // XXX: 66 42 89 44 5c 78 mov %ax,0x78(%rsp,%r11,2) + BYTE $0x66 + BYTE $0x42 + BYTE $0x89 + BYTE $0x44 + BYTE $0x5c + BYTE $0x78 + + // if uint32(x>>8) == load32(src, candidate) { continue } + MOVL (DX)(R15*1), BX + CMPL R14, BX + JEQ inner1 + + // nextHash = hash(uint32(x>>16), shift) + SHRQ $8, R14 + MOVL R14, R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + + // s++ + ADDQ $1, SI + + // break out of the inner1 for loop, i.e. continue the outer loop. + JMP outer + +emitRemainder: + // if nextEmit < len(src) { etc } + MOVQ src_len+32(FP), AX + ADDQ DX, AX + CMPQ R10, AX + JEQ encodeBlockEnd + + // d += emitLiteral(dst[d:], src[nextEmit:]) + // + // Push args. + MOVQ DI, 0(SP) + MOVQ $0, 8(SP) // Unnecessary, as the callee ignores it, but conservative. + MOVQ $0, 16(SP) // Unnecessary, as the callee ignores it, but conservative. + MOVQ R10, 24(SP) + SUBQ R10, AX + MOVQ AX, 32(SP) + MOVQ AX, 40(SP) // Unnecessary, as the callee ignores it, but conservative. + + // Spill local variables (registers) onto the stack; call; unspill. + MOVQ DI, 80(SP) + CALL ·emitLiteral(SB) + MOVQ 80(SP), DI + + // Finish the "d +=" part of "d += emitLiteral(etc)". + ADDQ 48(SP), DI + +encodeBlockEnd: + MOVQ dst_base+0(FP), AX + SUBQ AX, DI + MOVQ DI, d+48(FP) + RET diff --git a/vendor/github.com/golang/snappy/encode_arm64.s b/vendor/github.com/golang/snappy/encode_arm64.s new file mode 100644 index 0000000000..f8d54adfc5 --- /dev/null +++ b/vendor/github.com/golang/snappy/encode_arm64.s @@ -0,0 +1,722 @@ +// Copyright 2020 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 !appengine +// +build gc +// +build !noasm + +#include "textflag.h" + +// The asm code generally follows the pure Go code in encode_other.go, except +// where marked with a "!!!". + +// ---------------------------------------------------------------------------- + +// func emitLiteral(dst, lit []byte) int +// +// All local variables fit into registers. The register allocation: +// - R3 len(lit) +// - R4 n +// - R6 return value +// - R8 &dst[i] +// - R10 &lit[0] +// +// The 32 bytes of stack space is to call runtime·memmove. +// +// The unusual register allocation of local variables, such as R10 for the +// source pointer, matches the allocation used at the call site in encodeBlock, +// which makes it easier to manually inline this function. +TEXT ·emitLiteral(SB), NOSPLIT, $32-56 + MOVD dst_base+0(FP), R8 + MOVD lit_base+24(FP), R10 + MOVD lit_len+32(FP), R3 + MOVD R3, R6 + MOVW R3, R4 + SUBW $1, R4, R4 + + CMPW $60, R4 + BLT oneByte + CMPW $256, R4 + BLT twoBytes + +threeBytes: + MOVD $0xf4, R2 + MOVB R2, 0(R8) + MOVW R4, 1(R8) + ADD $3, R8, R8 + ADD $3, R6, R6 + B memmove + +twoBytes: + MOVD $0xf0, R2 + MOVB R2, 0(R8) + MOVB R4, 1(R8) + ADD $2, R8, R8 + ADD $2, R6, R6 + B memmove + +oneByte: + LSLW $2, R4, R4 + MOVB R4, 0(R8) + ADD $1, R8, R8 + ADD $1, R6, R6 + +memmove: + MOVD R6, ret+48(FP) + + // copy(dst[i:], lit) + // + // This means calling runtime·memmove(&dst[i], &lit[0], len(lit)), so we push + // R8, R10 and R3 as arguments. + MOVD R8, 8(RSP) + MOVD R10, 16(RSP) + MOVD R3, 24(RSP) + CALL runtime·memmove(SB) + RET + +// ---------------------------------------------------------------------------- + +// func emitCopy(dst []byte, offset, length int) int +// +// All local variables fit into registers. The register allocation: +// - R3 length +// - R7 &dst[0] +// - R8 &dst[i] +// - R11 offset +// +// The unusual register allocation of local variables, such as R11 for the +// offset, matches the allocation used at the call site in encodeBlock, which +// makes it easier to manually inline this function. +TEXT ·emitCopy(SB), NOSPLIT, $0-48 + MOVD dst_base+0(FP), R8 + MOVD R8, R7 + MOVD offset+24(FP), R11 + MOVD length+32(FP), R3 + +loop0: + // for length >= 68 { etc } + CMPW $68, R3 + BLT step1 + + // Emit a length 64 copy, encoded as 3 bytes. + MOVD $0xfe, R2 + MOVB R2, 0(R8) + MOVW R11, 1(R8) + ADD $3, R8, R8 + SUB $64, R3, R3 + B loop0 + +step1: + // if length > 64 { etc } + CMP $64, R3 + BLE step2 + + // Emit a length 60 copy, encoded as 3 bytes. + MOVD $0xee, R2 + MOVB R2, 0(R8) + MOVW R11, 1(R8) + ADD $3, R8, R8 + SUB $60, R3, R3 + +step2: + // if length >= 12 || offset >= 2048 { goto step3 } + CMP $12, R3 + BGE step3 + CMPW $2048, R11 + BGE step3 + + // Emit the remaining copy, encoded as 2 bytes. + MOVB R11, 1(R8) + LSRW $3, R11, R11 + AND $0xe0, R11, R11 + SUB $4, R3, R3 + LSLW $2, R3 + AND $0xff, R3, R3 + ORRW R3, R11, R11 + ORRW $1, R11, R11 + MOVB R11, 0(R8) + ADD $2, R8, R8 + + // Return the number of bytes written. + SUB R7, R8, R8 + MOVD R8, ret+40(FP) + RET + +step3: + // Emit the remaining copy, encoded as 3 bytes. + SUB $1, R3, R3 + AND $0xff, R3, R3 + LSLW $2, R3, R3 + ORRW $2, R3, R3 + MOVB R3, 0(R8) + MOVW R11, 1(R8) + ADD $3, R8, R8 + + // Return the number of bytes written. + SUB R7, R8, R8 + MOVD R8, ret+40(FP) + RET + +// ---------------------------------------------------------------------------- + +// func extendMatch(src []byte, i, j int) int +// +// All local variables fit into registers. The register allocation: +// - R6 &src[0] +// - R7 &src[j] +// - R13 &src[len(src) - 8] +// - R14 &src[len(src)] +// - R15 &src[i] +// +// The unusual register allocation of local variables, such as R15 for a source +// pointer, matches the allocation used at the call site in encodeBlock, which +// makes it easier to manually inline this function. +TEXT ·extendMatch(SB), NOSPLIT, $0-48 + MOVD src_base+0(FP), R6 + MOVD src_len+8(FP), R14 + MOVD i+24(FP), R15 + MOVD j+32(FP), R7 + ADD R6, R14, R14 + ADD R6, R15, R15 + ADD R6, R7, R7 + MOVD R14, R13 + SUB $8, R13, R13 + +cmp8: + // As long as we are 8 or more bytes before the end of src, we can load and + // compare 8 bytes at a time. If those 8 bytes are equal, repeat. + CMP R13, R7 + BHI cmp1 + MOVD (R15), R3 + MOVD (R7), R4 + CMP R4, R3 + BNE bsf + ADD $8, R15, R15 + ADD $8, R7, R7 + B cmp8 + +bsf: + // If those 8 bytes were not equal, XOR the two 8 byte values, and return + // the index of the first byte that differs. + // RBIT reverses the bit order, then CLZ counts the leading zeros, the + // combination of which finds the least significant bit which is set. + // The arm64 architecture is little-endian, and the shift by 3 converts + // a bit index to a byte index. + EOR R3, R4, R4 + RBIT R4, R4 + CLZ R4, R4 + ADD R4>>3, R7, R7 + + // Convert from &src[ret] to ret. + SUB R6, R7, R7 + MOVD R7, ret+40(FP) + RET + +cmp1: + // In src's tail, compare 1 byte at a time. + CMP R7, R14 + BLS extendMatchEnd + MOVB (R15), R3 + MOVB (R7), R4 + CMP R4, R3 + BNE extendMatchEnd + ADD $1, R15, R15 + ADD $1, R7, R7 + B cmp1 + +extendMatchEnd: + // Convert from &src[ret] to ret. + SUB R6, R7, R7 + MOVD R7, ret+40(FP) + RET + +// ---------------------------------------------------------------------------- + +// func encodeBlock(dst, src []byte) (d int) +// +// All local variables fit into registers, other than "var table". The register +// allocation: +// - R3 . . +// - R4 . . +// - R5 64 shift +// - R6 72 &src[0], tableSize +// - R7 80 &src[s] +// - R8 88 &dst[d] +// - R9 96 sLimit +// - R10 . &src[nextEmit] +// - R11 104 prevHash, currHash, nextHash, offset +// - R12 112 &src[base], skip +// - R13 . &src[nextS], &src[len(src) - 8] +// - R14 . len(src), bytesBetweenHashLookups, &src[len(src)], x +// - R15 120 candidate +// - R16 . hash constant, 0x1e35a7bd +// - R17 . &table +// - . 128 table +// +// The second column (64, 72, etc) is the stack offset to spill the registers +// when calling other functions. We could pack this slightly tighter, but it's +// simpler to have a dedicated spill map independent of the function called. +// +// "var table [maxTableSize]uint16" takes up 32768 bytes of stack space. An +// extra 64 bytes, to call other functions, and an extra 64 bytes, to spill +// local variables (registers) during calls gives 32768 + 64 + 64 = 32896. +TEXT ·encodeBlock(SB), 0, $32896-56 + MOVD dst_base+0(FP), R8 + MOVD src_base+24(FP), R7 + MOVD src_len+32(FP), R14 + + // shift, tableSize := uint32(32-8), 1<<8 + MOVD $24, R5 + MOVD $256, R6 + MOVW $0xa7bd, R16 + MOVKW $(0x1e35<<16), R16 + +calcShift: + // for ; tableSize < maxTableSize && tableSize < len(src); tableSize *= 2 { + // shift-- + // } + MOVD $16384, R2 + CMP R2, R6 + BGE varTable + CMP R14, R6 + BGE varTable + SUB $1, R5, R5 + LSL $1, R6, R6 + B calcShift + +varTable: + // var table [maxTableSize]uint16 + // + // In the asm code, unlike the Go code, we can zero-initialize only the + // first tableSize elements. Each uint16 element is 2 bytes and each + // iterations writes 64 bytes, so we can do only tableSize/32 writes + // instead of the 2048 writes that would zero-initialize all of table's + // 32768 bytes. This clear could overrun the first tableSize elements, but + // it won't overrun the allocated stack size. + ADD $128, RSP, R17 + MOVD R17, R4 + + // !!! R6 = &src[tableSize] + ADD R6<<1, R17, R6 + +memclr: + STP.P (ZR, ZR), 64(R4) + STP (ZR, ZR), -48(R4) + STP (ZR, ZR), -32(R4) + STP (ZR, ZR), -16(R4) + CMP R4, R6 + BHI memclr + + // !!! R6 = &src[0] + MOVD R7, R6 + + // sLimit := len(src) - inputMargin + MOVD R14, R9 + SUB $15, R9, R9 + + // !!! Pre-emptively spill R5, R6 and R9 to the stack. Their values don't + // change for the rest of the function. + MOVD R5, 64(RSP) + MOVD R6, 72(RSP) + MOVD R9, 96(RSP) + + // nextEmit := 0 + MOVD R6, R10 + + // s := 1 + ADD $1, R7, R7 + + // nextHash := hash(load32(src, s), shift) + MOVW 0(R7), R11 + MULW R16, R11, R11 + LSRW R5, R11, R11 + +outer: + // for { etc } + + // skip := 32 + MOVD $32, R12 + + // nextS := s + MOVD R7, R13 + + // candidate := 0 + MOVD $0, R15 + +inner0: + // for { etc } + + // s := nextS + MOVD R13, R7 + + // bytesBetweenHashLookups := skip >> 5 + MOVD R12, R14 + LSR $5, R14, R14 + + // nextS = s + bytesBetweenHashLookups + ADD R14, R13, R13 + + // skip += bytesBetweenHashLookups + ADD R14, R12, R12 + + // if nextS > sLimit { goto emitRemainder } + MOVD R13, R3 + SUB R6, R3, R3 + CMP R9, R3 + BHI emitRemainder + + // candidate = int(table[nextHash]) + MOVHU 0(R17)(R11<<1), R15 + + // table[nextHash] = uint16(s) + MOVD R7, R3 + SUB R6, R3, R3 + + MOVH R3, 0(R17)(R11<<1) + + // nextHash = hash(load32(src, nextS), shift) + MOVW 0(R13), R11 + MULW R16, R11 + LSRW R5, R11, R11 + + // if load32(src, s) != load32(src, candidate) { continue } break + MOVW 0(R7), R3 + MOVW (R6)(R15), R4 + CMPW R4, R3 + BNE inner0 + +fourByteMatch: + // As per the encode_other.go code: + // + // A 4-byte match has been found. We'll later see etc. + + // !!! Jump to a fast path for short (<= 16 byte) literals. See the comment + // on inputMargin in encode.go. + MOVD R7, R3 + SUB R10, R3, R3 + CMP $16, R3 + BLE emitLiteralFastPath + + // ---------------------------------------- + // Begin inline of the emitLiteral call. + // + // d += emitLiteral(dst[d:], src[nextEmit:s]) + + MOVW R3, R4 + SUBW $1, R4, R4 + + MOVW $60, R2 + CMPW R2, R4 + BLT inlineEmitLiteralOneByte + MOVW $256, R2 + CMPW R2, R4 + BLT inlineEmitLiteralTwoBytes + +inlineEmitLiteralThreeBytes: + MOVD $0xf4, R1 + MOVB R1, 0(R8) + MOVW R4, 1(R8) + ADD $3, R8, R8 + B inlineEmitLiteralMemmove + +inlineEmitLiteralTwoBytes: + MOVD $0xf0, R1 + MOVB R1, 0(R8) + MOVB R4, 1(R8) + ADD $2, R8, R8 + B inlineEmitLiteralMemmove + +inlineEmitLiteralOneByte: + LSLW $2, R4, R4 + MOVB R4, 0(R8) + ADD $1, R8, R8 + +inlineEmitLiteralMemmove: + // Spill local variables (registers) onto the stack; call; unspill. + // + // copy(dst[i:], lit) + // + // This means calling runtime·memmove(&dst[i], &lit[0], len(lit)), so we push + // R8, R10 and R3 as arguments. + MOVD R8, 8(RSP) + MOVD R10, 16(RSP) + MOVD R3, 24(RSP) + + // Finish the "d +=" part of "d += emitLiteral(etc)". + ADD R3, R8, R8 + MOVD R7, 80(RSP) + MOVD R8, 88(RSP) + MOVD R15, 120(RSP) + CALL runtime·memmove(SB) + MOVD 64(RSP), R5 + MOVD 72(RSP), R6 + MOVD 80(RSP), R7 + MOVD 88(RSP), R8 + MOVD 96(RSP), R9 + MOVD 120(RSP), R15 + ADD $128, RSP, R17 + MOVW $0xa7bd, R16 + MOVKW $(0x1e35<<16), R16 + B inner1 + +inlineEmitLiteralEnd: + // End inline of the emitLiteral call. + // ---------------------------------------- + +emitLiteralFastPath: + // !!! Emit the 1-byte encoding "uint8(len(lit)-1)<<2". + MOVB R3, R4 + SUBW $1, R4, R4 + AND $0xff, R4, R4 + LSLW $2, R4, R4 + MOVB R4, (R8) + ADD $1, R8, R8 + + // !!! Implement the copy from lit to dst as a 16-byte load and store. + // (Encode's documentation says that dst and src must not overlap.) + // + // This always copies 16 bytes, instead of only len(lit) bytes, but that's + // OK. Subsequent iterations will fix up the overrun. + // + // Note that on arm64, it is legal and cheap to issue unaligned 8-byte or + // 16-byte loads and stores. This technique probably wouldn't be as + // effective on architectures that are fussier about alignment. + LDP 0(R10), (R0, R1) + STP (R0, R1), 0(R8) + ADD R3, R8, R8 + +inner1: + // for { etc } + + // base := s + MOVD R7, R12 + + // !!! offset := base - candidate + MOVD R12, R11 + SUB R15, R11, R11 + SUB R6, R11, R11 + + // ---------------------------------------- + // Begin inline of the extendMatch call. + // + // s = extendMatch(src, candidate+4, s+4) + + // !!! R14 = &src[len(src)] + MOVD src_len+32(FP), R14 + ADD R6, R14, R14 + + // !!! R13 = &src[len(src) - 8] + MOVD R14, R13 + SUB $8, R13, R13 + + // !!! R15 = &src[candidate + 4] + ADD $4, R15, R15 + ADD R6, R15, R15 + + // !!! s += 4 + ADD $4, R7, R7 + +inlineExtendMatchCmp8: + // As long as we are 8 or more bytes before the end of src, we can load and + // compare 8 bytes at a time. If those 8 bytes are equal, repeat. + CMP R13, R7 + BHI inlineExtendMatchCmp1 + MOVD (R15), R3 + MOVD (R7), R4 + CMP R4, R3 + BNE inlineExtendMatchBSF + ADD $8, R15, R15 + ADD $8, R7, R7 + B inlineExtendMatchCmp8 + +inlineExtendMatchBSF: + // If those 8 bytes were not equal, XOR the two 8 byte values, and return + // the index of the first byte that differs. + // RBIT reverses the bit order, then CLZ counts the leading zeros, the + // combination of which finds the least significant bit which is set. + // The arm64 architecture is little-endian, and the shift by 3 converts + // a bit index to a byte index. + EOR R3, R4, R4 + RBIT R4, R4 + CLZ R4, R4 + ADD R4>>3, R7, R7 + B inlineExtendMatchEnd + +inlineExtendMatchCmp1: + // In src's tail, compare 1 byte at a time. + CMP R7, R14 + BLS inlineExtendMatchEnd + MOVB (R15), R3 + MOVB (R7), R4 + CMP R4, R3 + BNE inlineExtendMatchEnd + ADD $1, R15, R15 + ADD $1, R7, R7 + B inlineExtendMatchCmp1 + +inlineExtendMatchEnd: + // End inline of the extendMatch call. + // ---------------------------------------- + + // ---------------------------------------- + // Begin inline of the emitCopy call. + // + // d += emitCopy(dst[d:], base-candidate, s-base) + + // !!! length := s - base + MOVD R7, R3 + SUB R12, R3, R3 + +inlineEmitCopyLoop0: + // for length >= 68 { etc } + MOVW $68, R2 + CMPW R2, R3 + BLT inlineEmitCopyStep1 + + // Emit a length 64 copy, encoded as 3 bytes. + MOVD $0xfe, R1 + MOVB R1, 0(R8) + MOVW R11, 1(R8) + ADD $3, R8, R8 + SUBW $64, R3, R3 + B inlineEmitCopyLoop0 + +inlineEmitCopyStep1: + // if length > 64 { etc } + MOVW $64, R2 + CMPW R2, R3 + BLE inlineEmitCopyStep2 + + // Emit a length 60 copy, encoded as 3 bytes. + MOVD $0xee, R1 + MOVB R1, 0(R8) + MOVW R11, 1(R8) + ADD $3, R8, R8 + SUBW $60, R3, R3 + +inlineEmitCopyStep2: + // if length >= 12 || offset >= 2048 { goto inlineEmitCopyStep3 } + MOVW $12, R2 + CMPW R2, R3 + BGE inlineEmitCopyStep3 + MOVW $2048, R2 + CMPW R2, R11 + BGE inlineEmitCopyStep3 + + // Emit the remaining copy, encoded as 2 bytes. + MOVB R11, 1(R8) + LSRW $8, R11, R11 + LSLW $5, R11, R11 + SUBW $4, R3, R3 + AND $0xff, R3, R3 + LSLW $2, R3, R3 + ORRW R3, R11, R11 + ORRW $1, R11, R11 + MOVB R11, 0(R8) + ADD $2, R8, R8 + B inlineEmitCopyEnd + +inlineEmitCopyStep3: + // Emit the remaining copy, encoded as 3 bytes. + SUBW $1, R3, R3 + LSLW $2, R3, R3 + ORRW $2, R3, R3 + MOVB R3, 0(R8) + MOVW R11, 1(R8) + ADD $3, R8, R8 + +inlineEmitCopyEnd: + // End inline of the emitCopy call. + // ---------------------------------------- + + // nextEmit = s + MOVD R7, R10 + + // if s >= sLimit { goto emitRemainder } + MOVD R7, R3 + SUB R6, R3, R3 + CMP R3, R9 + BLS emitRemainder + + // As per the encode_other.go code: + // + // We could immediately etc. + + // x := load64(src, s-1) + MOVD -1(R7), R14 + + // prevHash := hash(uint32(x>>0), shift) + MOVW R14, R11 + MULW R16, R11, R11 + LSRW R5, R11, R11 + + // table[prevHash] = uint16(s-1) + MOVD R7, R3 + SUB R6, R3, R3 + SUB $1, R3, R3 + + MOVHU R3, 0(R17)(R11<<1) + + // currHash := hash(uint32(x>>8), shift) + LSR $8, R14, R14 + MOVW R14, R11 + MULW R16, R11, R11 + LSRW R5, R11, R11 + + // candidate = int(table[currHash]) + MOVHU 0(R17)(R11<<1), R15 + + // table[currHash] = uint16(s) + ADD $1, R3, R3 + MOVHU R3, 0(R17)(R11<<1) + + // if uint32(x>>8) == load32(src, candidate) { continue } + MOVW (R6)(R15), R4 + CMPW R4, R14 + BEQ inner1 + + // nextHash = hash(uint32(x>>16), shift) + LSR $8, R14, R14 + MOVW R14, R11 + MULW R16, R11, R11 + LSRW R5, R11, R11 + + // s++ + ADD $1, R7, R7 + + // break out of the inner1 for loop, i.e. continue the outer loop. + B outer + +emitRemainder: + // if nextEmit < len(src) { etc } + MOVD src_len+32(FP), R3 + ADD R6, R3, R3 + CMP R3, R10 + BEQ encodeBlockEnd + + // d += emitLiteral(dst[d:], src[nextEmit:]) + // + // Push args. + MOVD R8, 8(RSP) + MOVD $0, 16(RSP) // Unnecessary, as the callee ignores it, but conservative. + MOVD $0, 24(RSP) // Unnecessary, as the callee ignores it, but conservative. + MOVD R10, 32(RSP) + SUB R10, R3, R3 + MOVD R3, 40(RSP) + MOVD R3, 48(RSP) // Unnecessary, as the callee ignores it, but conservative. + + // Spill local variables (registers) onto the stack; call; unspill. + MOVD R8, 88(RSP) + CALL ·emitLiteral(SB) + MOVD 88(RSP), R8 + + // Finish the "d +=" part of "d += emitLiteral(etc)". + MOVD 56(RSP), R1 + ADD R1, R8, R8 + +encodeBlockEnd: + MOVD dst_base+0(FP), R3 + SUB R3, R8, R8 + MOVD R8, d+48(FP) + RET diff --git a/vendor/github.com/golang/snappy/encode_asm.go b/vendor/github.com/golang/snappy/encode_asm.go new file mode 100644 index 0000000000..107c1e7141 --- /dev/null +++ b/vendor/github.com/golang/snappy/encode_asm.go @@ -0,0 +1,30 @@ +// Copyright 2016 The Snappy-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 !appengine +// +build gc +// +build !noasm +// +build amd64 arm64 + +package snappy + +// emitLiteral has the same semantics as in encode_other.go. +// +//go:noescape +func emitLiteral(dst, lit []byte) int + +// emitCopy has the same semantics as in encode_other.go. +// +//go:noescape +func emitCopy(dst []byte, offset, length int) int + +// extendMatch has the same semantics as in encode_other.go. +// +//go:noescape +func extendMatch(src []byte, i, j int) int + +// encodeBlock has the same semantics as in encode_other.go. +// +//go:noescape +func encodeBlock(dst, src []byte) (d int) diff --git a/vendor/github.com/golang/snappy/encode_other.go b/vendor/github.com/golang/snappy/encode_other.go new file mode 100644 index 0000000000..296d7f0beb --- /dev/null +++ b/vendor/github.com/golang/snappy/encode_other.go @@ -0,0 +1,238 @@ +// Copyright 2016 The Snappy-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 !amd64,!arm64 appengine !gc noasm + +package snappy + +func load32(b []byte, i int) uint32 { + b = b[i : i+4 : len(b)] // Help the compiler eliminate bounds checks on the next line. + return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 +} + +func load64(b []byte, i int) uint64 { + b = b[i : i+8 : len(b)] // Help the compiler eliminate bounds checks on the next line. + return 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 +} + +// emitLiteral writes a literal chunk and returns the number of bytes written. +// +// It assumes that: +// dst is long enough to hold the encoded bytes +// 1 <= len(lit) && len(lit) <= 65536 +func emitLiteral(dst, lit []byte) int { + i, n := 0, uint(len(lit)-1) + switch { + case n < 60: + dst[0] = uint8(n)<<2 | tagLiteral + i = 1 + case n < 1<<8: + dst[0] = 60<<2 | tagLiteral + dst[1] = uint8(n) + i = 2 + default: + dst[0] = 61<<2 | tagLiteral + dst[1] = uint8(n) + dst[2] = uint8(n >> 8) + i = 3 + } + return i + copy(dst[i:], lit) +} + +// emitCopy writes a copy chunk and returns the number of bytes written. +// +// It assumes that: +// dst is long enough to hold the encoded bytes +// 1 <= offset && offset <= 65535 +// 4 <= length && length <= 65535 +func emitCopy(dst []byte, offset, length int) int { + i := 0 + // The maximum length for a single tagCopy1 or tagCopy2 op is 64 bytes. The + // threshold for this loop is a little higher (at 68 = 64 + 4), and the + // length emitted down below is is a little lower (at 60 = 64 - 4), because + // it's shorter to encode a length 67 copy as a length 60 tagCopy2 followed + // by a length 7 tagCopy1 (which encodes as 3+2 bytes) than to encode it as + // a length 64 tagCopy2 followed by a length 3 tagCopy2 (which encodes as + // 3+3 bytes). The magic 4 in the 64±4 is because the minimum length for a + // tagCopy1 op is 4 bytes, which is why a length 3 copy has to be an + // encodes-as-3-bytes tagCopy2 instead of an encodes-as-2-bytes tagCopy1. + for length >= 68 { + // Emit a length 64 copy, encoded as 3 bytes. + dst[i+0] = 63<<2 | tagCopy2 + dst[i+1] = uint8(offset) + dst[i+2] = uint8(offset >> 8) + i += 3 + length -= 64 + } + if length > 64 { + // Emit a length 60 copy, encoded as 3 bytes. + dst[i+0] = 59<<2 | tagCopy2 + dst[i+1] = uint8(offset) + dst[i+2] = uint8(offset >> 8) + i += 3 + length -= 60 + } + if length >= 12 || offset >= 2048 { + // Emit the remaining copy, encoded as 3 bytes. + dst[i+0] = uint8(length-1)<<2 | tagCopy2 + dst[i+1] = uint8(offset) + dst[i+2] = uint8(offset >> 8) + return i + 3 + } + // Emit the remaining copy, encoded as 2 bytes. + dst[i+0] = uint8(offset>>8)<<5 | uint8(length-4)<<2 | tagCopy1 + dst[i+1] = uint8(offset) + return i + 2 +} + +// extendMatch returns the largest k such that k <= len(src) and that +// src[i:i+k-j] and src[j:k] have the same contents. +// +// It assumes that: +// 0 <= i && i < j && j <= len(src) +func extendMatch(src []byte, i, j int) int { + for ; j < len(src) && src[i] == src[j]; i, j = i+1, j+1 { + } + return j +} + +func hash(u, shift uint32) uint32 { + return (u * 0x1e35a7bd) >> shift +} + +// encodeBlock encodes a non-empty src to a guaranteed-large-enough dst. It +// assumes that the varint-encoded length of the decompressed bytes has already +// been written. +// +// It also assumes that: +// len(dst) >= MaxEncodedLen(len(src)) && +// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize +func encodeBlock(dst, src []byte) (d int) { + // Initialize the hash table. Its size ranges from 1<<8 to 1<<14 inclusive. + // The table element type is uint16, as s < sLimit and sLimit < len(src) + // and len(src) <= maxBlockSize and maxBlockSize == 65536. + const ( + maxTableSize = 1 << 14 + // tableMask is redundant, but helps the compiler eliminate bounds + // checks. + tableMask = maxTableSize - 1 + ) + shift := uint32(32 - 8) + for tableSize := 1 << 8; tableSize < maxTableSize && tableSize < len(src); tableSize *= 2 { + shift-- + } + // In Go, all array elements are zero-initialized, so there is no advantage + // to a smaller tableSize per se. However, it matches the C++ algorithm, + // and in the asm versions of this code, we can get away with zeroing only + // the first tableSize elements. + var table [maxTableSize]uint16 + + // sLimit is when to stop looking for offset/length copies. The inputMargin + // lets us use a fast path for emitLiteral in the main loop, while we are + // looking for copies. + sLimit := len(src) - inputMargin + + // nextEmit is where in src the next emitLiteral should start from. + nextEmit := 0 + + // The encoded form must start with a literal, as there are no previous + // bytes to copy, so we start looking for hash matches at s == 1. + s := 1 + nextHash := hash(load32(src, s), shift) + + for { + // Copied from the C++ snappy implementation: + // + // Heuristic match skipping: If 32 bytes are scanned with no matches + // found, start looking only at every other byte. If 32 more bytes are + // scanned (or skipped), look at every third byte, etc.. When a match + // is found, immediately go back to looking at every byte. This is a + // small loss (~5% performance, ~0.1% density) for compressible data + // due to more bookkeeping, but for non-compressible data (such as + // JPEG) it's a huge win since the compressor quickly "realizes" the + // data is incompressible and doesn't bother looking for matches + // everywhere. + // + // The "skip" variable keeps track of how many bytes there are since + // the last match; dividing it by 32 (ie. right-shifting by five) gives + // the number of bytes to move ahead for each iteration. + skip := 32 + + nextS := s + candidate := 0 + for { + s = nextS + bytesBetweenHashLookups := skip >> 5 + nextS = s + bytesBetweenHashLookups + skip += bytesBetweenHashLookups + if nextS > sLimit { + goto emitRemainder + } + candidate = int(table[nextHash&tableMask]) + table[nextHash&tableMask] = uint16(s) + nextHash = hash(load32(src, nextS), shift) + if load32(src, s) == load32(src, candidate) { + break + } + } + + // A 4-byte match has been found. We'll later see if more than 4 bytes + // match. But, prior to the match, src[nextEmit:s] are unmatched. Emit + // them as literal bytes. + d += emitLiteral(dst[d:], src[nextEmit:s]) + + // Call emitCopy, and then see if another emitCopy could be our next + // move. Repeat until we find no match for the input immediately after + // what was consumed by the last emitCopy call. + // + // If we exit this loop normally then we need to call emitLiteral next, + // though we don't yet know how big the literal will be. We handle that + // by proceeding to the next iteration of the main loop. We also can + // exit this loop via goto if we get close to exhausting the input. + for { + // Invariant: we have a 4-byte match at s, and no need to emit any + // literal bytes prior to s. + base := s + + // Extend the 4-byte match as long as possible. + // + // This is an inlined version of: + // s = extendMatch(src, candidate+4, s+4) + s += 4 + for i := candidate + 4; s < len(src) && src[i] == src[s]; i, s = i+1, s+1 { + } + + d += emitCopy(dst[d:], base-candidate, s-base) + nextEmit = s + if s >= sLimit { + goto emitRemainder + } + + // We could immediately start working at s now, but to improve + // compression we first update the hash table at s-1 and at s. If + // another emitCopy is not our next move, also calculate nextHash + // at s+1. At least on GOARCH=amd64, these three hash calculations + // are faster as one load64 call (with some shifts) instead of + // three load32 calls. + x := load64(src, s-1) + prevHash := hash(uint32(x>>0), shift) + table[prevHash&tableMask] = uint16(s - 1) + currHash := hash(uint32(x>>8), shift) + candidate = int(table[currHash&tableMask]) + table[currHash&tableMask] = uint16(s) + if uint32(x>>8) != load32(src, candidate) { + nextHash = hash(uint32(x>>16), shift) + s++ + break + } + } + } + +emitRemainder: + if nextEmit < len(src) { + d += emitLiteral(dst[d:], src[nextEmit:]) + } + return d +} diff --git a/vendor/github.com/golang/snappy/snappy.go b/vendor/github.com/golang/snappy/snappy.go new file mode 100644 index 0000000000..ece692ea46 --- /dev/null +++ b/vendor/github.com/golang/snappy/snappy.go @@ -0,0 +1,98 @@ +// Copyright 2011 The Snappy-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 snappy implements the Snappy compression format. It aims for very +// high speeds and reasonable compression. +// +// There are actually two Snappy formats: block and stream. They are related, +// but different: trying to decompress block-compressed data as a Snappy stream +// will fail, and vice versa. The block format is the Decode and Encode +// functions and the stream format is the Reader and Writer types. +// +// The block format, the more common case, is used when the complete size (the +// number of bytes) of the original data is known upfront, at the time +// compression starts. The stream format, also known as the framing format, is +// for when that isn't always true. +// +// The canonical, C++ implementation is at https://github.com/google/snappy and +// it only implements the block format. +package snappy // import "github.com/golang/snappy" + +import ( + "hash/crc32" +) + +/* +Each encoded block begins with the varint-encoded length of the decoded data, +followed by a sequence of chunks. Chunks begin and end on byte boundaries. The +first byte of each chunk is broken into its 2 least and 6 most significant bits +called l and m: l ranges in [0, 4) and m ranges in [0, 64). l is the chunk tag. +Zero means a literal tag. All other values mean a copy tag. + +For literal tags: + - If m < 60, the next 1 + m bytes are literal bytes. + - Otherwise, let n be the little-endian unsigned integer denoted by the next + m - 59 bytes. The next 1 + n bytes after that are literal bytes. + +For copy tags, length bytes are copied from offset bytes ago, in the style of +Lempel-Ziv compression algorithms. In particular: + - For l == 1, the offset ranges in [0, 1<<11) and the length in [4, 12). + The length is 4 + the low 3 bits of m. The high 3 bits of m form bits 8-10 + of the offset. The next byte is bits 0-7 of the offset. + - For l == 2, the offset ranges in [0, 1<<16) and the length in [1, 65). + The length is 1 + m. The offset is the little-endian unsigned integer + denoted by the next 2 bytes. + - For l == 3, this tag is a legacy format that is no longer issued by most + encoders. Nonetheless, the offset ranges in [0, 1<<32) and the length in + [1, 65). The length is 1 + m. The offset is the little-endian unsigned + integer denoted by the next 4 bytes. +*/ +const ( + tagLiteral = 0x00 + tagCopy1 = 0x01 + tagCopy2 = 0x02 + tagCopy4 = 0x03 +) + +const ( + checksumSize = 4 + chunkHeaderSize = 4 + magicChunk = "\xff\x06\x00\x00" + magicBody + magicBody = "sNaPpY" + + // maxBlockSize is the maximum size of the input to encodeBlock. It is not + // part of the wire format per se, but some parts of the encoder assume + // that an offset fits into a uint16. + // + // Also, for the framing format (Writer type instead of Encode function), + // https://github.com/google/snappy/blob/master/framing_format.txt says + // that "the uncompressed data in a chunk must be no longer than 65536 + // bytes". + maxBlockSize = 65536 + + // maxEncodedLenOfMaxBlockSize equals MaxEncodedLen(maxBlockSize), but is + // hard coded to be a const instead of a variable, so that obufLen can also + // be a const. Their equivalence is confirmed by + // TestMaxEncodedLenOfMaxBlockSize. + maxEncodedLenOfMaxBlockSize = 76490 + + obufHeaderLen = len(magicChunk) + checksumSize + chunkHeaderSize + obufLen = obufHeaderLen + maxEncodedLenOfMaxBlockSize +) + +const ( + chunkTypeCompressedData = 0x00 + chunkTypeUncompressedData = 0x01 + chunkTypePadding = 0xfe + chunkTypeStreamIdentifier = 0xff +) + +var crcTable = crc32.MakeTable(crc32.Castagnoli) + +// crc implements the checksum specified in section 3 of +// https://github.com/google/snappy/blob/master/framing_format.txt +func crc(b []byte) uint32 { + c := crc32.Update(0, crcTable, b) + return uint32(c>>15|c<<17) + 0xa282ead8 +} diff --git a/vendor/github.com/google/certificate-transparency-go/.gitignore b/vendor/github.com/google/certificate-transparency-go/.gitignore new file mode 100644 index 0000000000..8c13cd1c9d --- /dev/null +++ b/vendor/github.com/google/certificate-transparency-go/.gitignore @@ -0,0 +1,28 @@ +*.iml +*.swo +*.swp +*.tfstate +*.tfstate.backup +*~ +/.idea +/certcheck +/chainfix +/coverage.txt +/createtree +/crlcheck +/ctclient +/ct_server +/ct_hammer +/data +/dumpscts +/findlog +/goshawk +/gosmin +/gossip_server +/preloader +/scanlog +/sctcheck +/sctscan +/trillian_log_server +/trillian_log_signer +/trillian.json diff --git a/vendor/github.com/google/certificate-transparency-go/.golangci.yaml b/vendor/github.com/google/certificate-transparency-go/.golangci.yaml new file mode 100644 index 0000000000..34c803a8cd --- /dev/null +++ b/vendor/github.com/google/certificate-transparency-go/.golangci.yaml @@ -0,0 +1,38 @@ +run: + deadline: 90s + skip-dirs: + - (^|/)x509($|/) + - (^|/)x509util($|/) + - (^|/)asn1($|/) + +linters-settings: + gocyclo: + min-complexity: 40 + depguard: + list-type: blacklist + packages: + - ^golang.org/x/net/context$ + - github.com/gogo/protobuf/proto + - encoding/asn1 + - crypto/x509 + +linters: + disable-all: true + enable: + - deadcode + - depguard + - gocyclo + - gofmt + - goimports + - govet + - ineffassign + - megacheck + - misspell + - revive + - varcheck + # TODO(gbelvin): write license linter and commit to upstream. + # ./scripts/check_license.sh is run by ./scripts/presubmit.sh + +issues: + # Don't turn off any checks by default. We can do this explicitly if needed. + exclude-use-default: false diff --git a/vendor/github.com/google/certificate-transparency-go/AUTHORS b/vendor/github.com/google/certificate-transparency-go/AUTHORS new file mode 100644 index 0000000000..5b048dddf5 --- /dev/null +++ b/vendor/github.com/google/certificate-transparency-go/AUTHORS @@ -0,0 +1,27 @@ +# This is the official list of benchmark authors for copyright purposes. +# This file is distinct from the CONTRIBUTORS files. +# See the latter for an explanation. +# +# Names should be added to this file as: +# Name or Organization +# The email address is not required for organizations. +# +# Please keep the list sorted. + +Comodo CA Limited +Ed Maste +Fiaz Hossain +Google LLC +Internet Security Research Group +Jeff Trawick +Katriel Cohn-Gordon +Laël Cellier +Mark Schloesser +NORDUnet A/S +Nicholas Galbreath +Oliver Weidner +PrimeKey Solutions AB +Ruslan Kovalov +Venafi, Inc. +Vladimir Rutsky +Ximin Luo diff --git a/vendor/github.com/google/certificate-transparency-go/CHANGELOG.md b/vendor/github.com/google/certificate-transparency-go/CHANGELOG.md new file mode 100644 index 0000000000..813fc22214 --- /dev/null +++ b/vendor/github.com/google/certificate-transparency-go/CHANGELOG.md @@ -0,0 +1,586 @@ +# CERTIFICATE-TRANSPARENCY-GO Changelog + +## HEAD + +### Integration + + * Breaking change to API for `integration.HammerCTLog`: + * Added `ctx` as first argument, and terminate loop if it becomes cancelled + +### JSONClient + + * PostAndParseWithRetry now does backoff-and-retry upon receiving HTTP 429. + +### Cleanup + + * `WithBalancerName` is deprecated and removed, using the recommended way. + * `ctfe.PEMCertPool` type has been moved to `x509util.PEMCertPool` to reduce + dependencies (#903). + * Remove log list v1 package and its dependencies. + +### Migrillian + +* #960: Skip consistency check when root is size zero. + +### Misc + + * updated golangci-lint to v1.46.1 (developers should update to this version) + * update `google.golang.org/grpc` to v1.46.0 + * `ctclient` tool now uses Cobra for better CLI experience (#901). + * #800: Remove dependency from `ratelimit`. + * #927: Add read-only mode to CTFE config. + * Update Trillian to [0a389c4](https://github.com/google/trillian/commit/0a389c4bb8d97fb3be8f55d7e5b428cf4304986f) + * Migrate loglist dependency from v1 to v3 in ctclient cmd. + * Migrate loglist dependency from v1 to v3 in ctutil/loginfo.go + * Migrate loglist dependency from v1 to v3 in ctutil/sctscan.go + * Migrate loglist dependency from v1 to v3 in trillian/integration/ct_hammer/main.go + +## v1.1.2 + +### CTFE + + * Removed the `-by_range` flag. + +### Updated dependencies + + * Trillian from v1.3.11 to v1.4.0 + * protobuf to v2 + +## v1.1.1 +[Published 2020-10-06](https://github.com/google/certificate-transparency-go/releases/tag/v1.1.1) + +### Tools + +#### CT Hammer + +Added a flag (--strict_sth_consistency_size) which when set to true enforces the current behaviour of only request consistency proofs between tree sizes for which the hammer has seen valid STHs. +When setting this flag to false, if no two usable STHs are available the hammer will attempt to request a consistency proof between the latest STH it's seen and a random smaller (but > 0) tree size. + + +### CTFE + +#### Caching + +The CTFE now includes a Cache-Control header in responses containing purely +immutable data, e.g. those for get-entries and get-proof-by-hash. This allows +clients and proxies to cache these responses for up to 24 hours. + +#### EKU Filtering + +> :warning: **It is not yet recommended to enable this option in a production CT Log!** + +CTFE now supports filtering logging submissions by leaf certificate EKU. +This is enabled by adding an extKeyUsage list to a log's stanza in the +config file. + +The format is a list of strings corresponding to the supported golang x509 EKUs: + |Config string | Extended Key Usage | + |----------------------------|----------------------------------------| + |`Any` | ExtKeyUsageAny | + |`ServerAuth` | ExtKeyUsageServerAuth | + |`ClientAuth` | ExtKeyUsageClientAuth | + |`CodeSigning` | ExtKeyUsageCodeSigning | + |`EmailProtection` | ExtKeyUsageEmailProtection | + |`IPSECEndSystem` | ExtKeyUsageIPSECEndSystem | + |`IPSECTunnel` | ExtKeyUsageIPSECTunnel | + |`IPSECUser` | ExtKeyUsageIPSECUser | + |`TimeStamping` | ExtKeyUsageTimeStamping | + |`OCSPSigning` | ExtKeyUsageOCSPSigning | + |`MicrosoftServerGatedCrypto`| ExtKeyUsageMicrosoftServerGatedCrypto | + |`NetscapeServerGatedCrypto` | ExtKeyUsageNetscapeServerGatedCrypto | + +When an extKeyUsage list is specified, the CT Log will reject logging +submissions for leaf certificates that do not contain an EKU present in this +list. + +When enabled, EKU filtering is only performed at the leaf level (i.e. there is +no 'nested' EKU filtering performed). + +If no list is specified, or the list contains an `Any` entry, no EKU +filtering will be performed. + +#### GetEntries +Calls to `get-entries` which are at (or above) the maximum permitted number of +entries whose `start` parameter does not fall on a multiple of the maximum +permitted number of entries, will have their responses truncated such that +subsequent requests will align with this boundary. +This is intended to coerce callers of `get-entries` into all using the same +`start` and `end` parameters and thereby increase the cachability of +these requests. + +e.g.: + +