diff --git a/go.mod b/go.mod
index ebc992f170b..d1de106e6e6 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
module github.com/cortexproject/cortex
-go 1.24.0
+go 1.25.3
require (
github.com/Masterminds/squirrel v1.5.4
@@ -13,26 +13,26 @@ require (
github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb
github.com/felixge/fgprof v0.9.5
github.com/go-kit/log v0.2.1
- github.com/go-openapi/strfmt v0.24.0
+ github.com/go-openapi/strfmt v0.25.0
github.com/go-openapi/swag v0.25.1 // indirect
github.com/go-redis/redis/v8 v8.11.5
github.com/gogo/protobuf v1.3.2
github.com/gogo/status v1.1.1
- github.com/golang-migrate/migrate/v4 v4.18.1
+ github.com/golang-migrate/migrate/v4 v4.19.0
github.com/golang/protobuf v1.5.4
github.com/golang/snappy v1.0.0
github.com/gorilla/mux v1.8.1
github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
- github.com/hashicorp/consul/api v1.32.0
+ github.com/hashicorp/consul/api v1.33.0
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-metrics v0.5.4
github.com/hashicorp/go-sockaddr v1.0.7
github.com/hashicorp/memberlist v0.5.3
github.com/json-iterator/go v1.1.12
- github.com/klauspost/compress v1.18.0
+ github.com/klauspost/compress v1.18.1
github.com/lib/pq v1.10.9
- github.com/minio/minio-go/v7 v7.0.93
+ github.com/minio/minio-go/v7 v7.0.97
github.com/mitchellh/go-wordwrap v1.0.1
github.com/oklog/ulid v1.3.1
github.com/opentracing-contrib/go-grpc v0.1.2
@@ -42,45 +42,45 @@ require (
github.com/prometheus/alertmanager v0.29.0
github.com/prometheus/client_golang v1.23.2
github.com/prometheus/client_model v0.6.2
- github.com/prometheus/common v0.67.1
+ github.com/prometheus/common v0.67.3
// Prometheus maps version 3.x.y to tags v0.30x.y.
github.com/prometheus/prometheus v0.306.0
github.com/segmentio/fasthash v1.0.3
github.com/sony/gobreaker v1.0.0
- github.com/spf13/afero v1.11.0
+ github.com/spf13/afero v1.15.0
github.com/stretchr/testify v1.11.1
github.com/thanos-io/objstore v0.0.0-20250722142242-922b22272ee3
github.com/thanos-io/promql-engine v0.0.0-20250924193140-e9123dc11264
github.com/thanos-io/thanos v0.39.3-0.20250729120336-88d0ae8071cb
github.com/uber/jaeger-client-go v2.30.0+incompatible
github.com/weaveworks/common v0.0.0-20230728070032-dd9e68f319d5
- go.etcd.io/etcd/api/v3 v3.5.17
- go.etcd.io/etcd/client/pkg/v3 v3.5.17
- go.etcd.io/etcd/client/v3 v3.5.17
- go.opentelemetry.io/contrib/propagators/aws v1.36.0
+ go.etcd.io/etcd/api/v3 v3.6.6
+ go.etcd.io/etcd/client/pkg/v3 v3.6.6
+ go.etcd.io/etcd/client/v3 v3.6.6
+ go.opentelemetry.io/contrib/propagators/aws v1.38.0
go.opentelemetry.io/otel v1.38.0
- go.opentelemetry.io/otel/bridge/opentracing v1.36.0
- go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.36.0
- go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.36.0
+ go.opentelemetry.io/otel/bridge/opentracing v1.38.0
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0
+ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0
go.opentelemetry.io/otel/sdk v1.38.0
go.opentelemetry.io/otel/trace v1.38.0
go.uber.org/atomic v1.11.0
- golang.org/x/net v0.46.0
- golang.org/x/sync v0.17.0
- golang.org/x/time v0.12.0
- google.golang.org/grpc v1.73.0
+ golang.org/x/net v0.47.0
+ golang.org/x/sync v0.18.0
+ golang.org/x/time v0.14.0
+ google.golang.org/grpc v1.76.0
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
)
require (
- github.com/VictoriaMetrics/fastcache v1.12.2
- github.com/aws/aws-sdk-go-v2 v1.39.2
- github.com/aws/aws-sdk-go-v2/config v1.31.12
- github.com/aws/aws-sdk-go-v2/service/dynamodb v1.50.1
+ github.com/VictoriaMetrics/fastcache v1.13.2
+ github.com/aws/aws-sdk-go-v2 v1.40.0
+ github.com/aws/aws-sdk-go-v2/config v1.32.0
+ github.com/aws/aws-sdk-go-v2/service/dynamodb v1.53.1
github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3
github.com/cespare/xxhash/v2 v2.3.0
- github.com/go-openapi/swag/jsonutils v0.25.1
+ github.com/go-openapi/swag/jsonutils v0.25.3
github.com/google/go-cmp v0.7.0
github.com/google/uuid v1.6.0
github.com/hashicorp/golang-lru/v2 v2.0.7
@@ -89,10 +89,10 @@ require (
github.com/parquet-go/parquet-go v0.25.1
github.com/prometheus-community/parquet-common v0.0.0-20251023184424-4f977ece2a46
github.com/prometheus/client_golang/exp v0.0.0-20250914183048-a974e0d45e0a
- github.com/prometheus/procfs v0.16.1
+ github.com/prometheus/procfs v0.19.2
github.com/sercand/kuberesolver/v5 v5.1.1
- github.com/tjhop/slog-gokit v0.1.4
- go.opentelemetry.io/collector/pdata v1.35.0
+ github.com/tjhop/slog-gokit v0.1.5
+ go.opentelemetry.io/collector/pdata v1.46.0
go.uber.org/automaxprocs v1.6.0
google.golang.org/protobuf v1.36.10
)
@@ -117,28 +117,28 @@ require (
github.com/alecthomas/kingpin/v2 v2.4.0 // indirect
github.com/andybalholm/brotli v1.1.1 // indirect
github.com/armon/go-metrics v0.4.1 // indirect
- github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
- github.com/aws/aws-sdk-go-v2/credentials v1.18.16 // indirect
- github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.9 // indirect
- github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.9 // indirect
- github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.9 // indirect
- github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.11.6 // indirect
- github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.9 // indirect
+ github.com/aws/aws-sdk-go-v2/credentials v1.19.0 // indirect
+ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.14 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.14 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.14 // indirect
+ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.11.14 // indirect
+ github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.14 // indirect
+ github.com/aws/aws-sdk-go-v2/service/signin v1.0.1 // indirect
github.com/aws/aws-sdk-go-v2/service/sns v1.38.5 // indirect
- github.com/aws/aws-sdk-go-v2/service/sso v1.29.6 // indirect
- github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.1 // indirect
- github.com/aws/aws-sdk-go-v2/service/sts v1.38.6 // indirect
- github.com/aws/smithy-go v1.23.0 // indirect
+ github.com/aws/aws-sdk-go-v2/service/sso v1.30.4 // indirect
+ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.8 // indirect
+ github.com/aws/aws-sdk-go-v2/service/sts v1.41.1 // indirect
+ github.com/aws/smithy-go v1.23.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/caio/go-tdigest v3.1.0+incompatible // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
- github.com/cenkalti/backoff/v5 v5.0.2 // indirect
+ github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect
github.com/coder/quartz v0.2.1 // indirect
- github.com/coreos/go-semver v0.3.0 // indirect
+ github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.6.0 // indirect
github.com/cristalhq/hedgedhttp v0.9.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
@@ -155,33 +155,32 @@ require (
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-chi/chi/v5 v5.2.2 // indirect
github.com/go-ini/ini v1.67.0 // indirect
- github.com/go-logfmt/logfmt v0.6.0 // indirect
+ github.com/go-logfmt/logfmt v0.6.1 // indirect
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/analysis v0.24.0 // indirect
- github.com/go-openapi/errors v0.22.3 // indirect
+ github.com/go-openapi/errors v0.22.4 // indirect
github.com/go-openapi/jsonpointer v0.22.1 // indirect
github.com/go-openapi/jsonreference v0.21.2 // indirect
github.com/go-openapi/loads v0.23.1 // indirect
github.com/go-openapi/runtime v0.29.0 // indirect
github.com/go-openapi/spec v0.22.0 // indirect
github.com/go-openapi/swag/cmdutils v0.25.1 // indirect
- github.com/go-openapi/swag/conv v0.25.1 // indirect
+ github.com/go-openapi/swag/conv v0.25.3 // indirect
github.com/go-openapi/swag/fileutils v0.25.1 // indirect
github.com/go-openapi/swag/jsonname v0.25.1 // indirect
github.com/go-openapi/swag/loading v0.25.1 // indirect
github.com/go-openapi/swag/mangling v0.25.1 // indirect
github.com/go-openapi/swag/netutils v0.25.1 // indirect
github.com/go-openapi/swag/stringutils v0.25.1 // indirect
- github.com/go-openapi/swag/typeutils v0.25.1 // indirect
+ github.com/go-openapi/swag/typeutils v0.25.3 // indirect
github.com/go-openapi/swag/yamlutils v0.25.1 // indirect
github.com/go-openapi/validate v0.25.0 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect
- github.com/goccy/go-json v0.10.5 // indirect
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/gogo/googleapis v1.4.1 // indirect
- github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
+ github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/pprof v0.0.0-20250607225305-033d6d78b36a // indirect
@@ -189,7 +188,7 @@ require (
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
github.com/googleapis/gax-go/v2 v2.14.2 // indirect
github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.3.2 // indirect
- github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect
+ github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
@@ -202,7 +201,8 @@ require (
github.com/jessevdk/go-flags v1.6.1 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/julienschmidt/httprouter v1.3.0 // indirect
- github.com/klauspost/cpuid/v2 v2.2.10 // indirect
+ github.com/klauspost/cpuid/v2 v2.2.11 // indirect
+ github.com/klauspost/crc32 v1.3.0 // indirect
github.com/knadh/koanf/maps v0.1.2 // indirect
github.com/knadh/koanf/providers/confmap v1.0.0 // indirect
github.com/knadh/koanf/v2 v2.2.1 // indirect
@@ -216,22 +216,21 @@ require (
github.com/mdlayher/vsock v1.2.1 // indirect
github.com/metalmatze/signal v0.0.0-20210307161603-1c9aa721a97a // indirect
github.com/miekg/dns v1.1.66 // indirect
- github.com/minio/crc64nvme v1.0.1 // indirect
+ github.com/minio/crc64nvme v1.1.0 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
- github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
- github.com/modern-go/reflect2 v1.0.2 // indirect
+ github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/ncw/swift v1.0.53 // indirect
github.com/oklog/run v1.2.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/exp/metrics v0.129.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.129.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/processor/deltatocumulativeprocessor v0.129.0 // indirect
- github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect
+ github.com/philhofer/fwd v1.2.0 // indirect
github.com/pierrec/lz4/v4 v4.1.22 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
@@ -259,14 +258,14 @@ require (
github.com/weaveworks/promrus v1.2.0 // indirect
github.com/xhit/go-str2duration/v2 v2.1.0 // indirect
github.com/yuin/gopher-lua v1.1.1 // indirect
- go.mongodb.org/mongo-driver v1.17.4 // indirect
+ go.mongodb.org/mongo-driver v1.17.6 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/collector/component v1.35.0 // indirect
go.opentelemetry.io/collector/confmap v1.35.0 // indirect
go.opentelemetry.io/collector/confmap/xconfmap v0.129.0 // indirect
go.opentelemetry.io/collector/consumer v1.35.0 // indirect
- go.opentelemetry.io/collector/featuregate v1.35.0 // indirect
+ go.opentelemetry.io/collector/featuregate v1.46.0 // indirect
go.opentelemetry.io/collector/internal/telemetry v0.129.0 // indirect
go.opentelemetry.io/collector/pipeline v0.129.0 // indirect
go.opentelemetry.io/collector/processor v1.35.0 // indirect
@@ -283,7 +282,7 @@ require (
go.opentelemetry.io/otel/log v0.12.2 // indirect
go.opentelemetry.io/otel/metric v1.38.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect
- go.opentelemetry.io/proto/otlp v1.7.0 // indirect
+ go.opentelemetry.io/proto/otlp v1.7.1 // indirect
go.uber.org/goleak v1.3.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
@@ -291,18 +290,18 @@ require (
go.yaml.in/yaml/v3 v3.0.4 // indirect
go4.org/intern v0.0.0-20230525184215-6c62f75575cb // indirect
go4.org/unsafe/assume-no-moving-gc v0.0.0-20231121144256-b99613f794b6 // indirect
- golang.org/x/crypto v0.43.0 // indirect
- golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 // indirect
+ golang.org/x/crypto v0.44.0 // indirect
+ golang.org/x/exp v0.0.0-20250808145144-a408d31f581a // indirect
golang.org/x/mod v0.29.0 // indirect
- golang.org/x/oauth2 v0.31.0 // indirect
- golang.org/x/sys v0.37.0 // indirect
- golang.org/x/text v0.30.0 // indirect
+ golang.org/x/oauth2 v0.32.0 // indirect
+ golang.org/x/sys v0.38.0 // indirect
+ golang.org/x/text v0.31.0 // indirect
golang.org/x/tools v0.38.0 // indirect
gonum.org/v1/gonum v0.16.0 // indirect
google.golang.org/api v0.239.0 // indirect
google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2 // indirect
- google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect
- google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
+ google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 // indirect
+ google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 // indirect
gopkg.in/telebot.v3 v3.3.8 // indirect
k8s.io/apimachinery v0.33.1 // indirect
k8s.io/client-go v0.33.1 // indirect
diff --git a/go.sum b/go.sum
index 9fc1706b026..cfeffa68d81 100644
--- a/go.sum
+++ b/go.sum
@@ -824,8 +824,8 @@ github.com/Masterminds/squirrel v1.5.4 h1:uUcX/aBc8O7Fg9kaISIUsHXdKuqehiXAMQTYX8
github.com/Masterminds/squirrel v1.5.4/go.mod h1:NNaOrjSoIDfDA40n7sr2tPNZRfjzjA400rg+riTZj10=
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
-github.com/VictoriaMetrics/fastcache v1.12.2 h1:N0y9ASrJ0F6h0QaC3o6uJb3NIZ9VKLjCM7NQbSmF7WI=
-github.com/VictoriaMetrics/fastcache v1.12.2/go.mod h1:AmC+Nzz1+3G2eCPapF6UcsnkThDcMsQicp4xDukwJYI=
+github.com/VictoriaMetrics/fastcache v1.13.2 h1:2XTB49aLSuCex7e9P5rqrfQcMkzGjh5Vq3GMFa8YpCA=
+github.com/VictoriaMetrics/fastcache v1.13.2/go.mod h1:hHXhl4DA2fTL2HTZDJFXWgW0LNjo6B+4aj2Wmng3TjU=
github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY=
github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk=
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
@@ -861,42 +861,42 @@ github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJ
github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4=
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
-github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so=
-github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/aws/aws-sdk-go v1.55.7 h1:UJrkFq7es5CShfBwlWAC8DA077vp8PyVbQd3lqLiztE=
github.com/aws/aws-sdk-go v1.55.7/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
-github.com/aws/aws-sdk-go-v2 v1.39.2 h1:EJLg8IdbzgeD7xgvZ+I8M1e0fL0ptn/M47lianzth0I=
-github.com/aws/aws-sdk-go-v2 v1.39.2/go.mod h1:sDioUELIUO9Znk23YVmIk86/9DOpkbyyVb1i/gUNFXY=
-github.com/aws/aws-sdk-go-v2/config v1.31.12 h1:pYM1Qgy0dKZLHX2cXslNacbcEFMkDMl+Bcj5ROuS6p8=
-github.com/aws/aws-sdk-go-v2/config v1.31.12/go.mod h1:/MM0dyD7KSDPR+39p9ZNVKaHDLb9qnfDurvVS2KAhN8=
-github.com/aws/aws-sdk-go-v2/credentials v1.18.16 h1:4JHirI4zp958zC026Sm+V4pSDwW4pwLefKrc0bF2lwI=
-github.com/aws/aws-sdk-go-v2/credentials v1.18.16/go.mod h1:qQMtGx9OSw7ty1yLclzLxXCRbrkjWAM7JnObZjmCB7I=
-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.9 h1:Mv4Bc0mWmv6oDuSWTKnk+wgeqPL5DRFu5bQL9BGPQ8Y=
-github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.9/go.mod h1:IKlKfRppK2a1y0gy1yH6zD+yX5uplJ6UuPlgd48dJiQ=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.9 h1:se2vOWGD3dWQUtfn4wEjRQJb1HK1XsNIt825gskZ970=
-github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.9/go.mod h1:hijCGH2VfbZQxqCDN7bwz/4dzxV+hkyhjawAtdPWKZA=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.9 h1:6RBnKZLkJM4hQ+kN6E7yWFveOTg8NLPHAkqrs4ZPlTU=
-github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.9/go.mod h1:V9rQKRmK7AWuEsOMnHzKj8WyrIir1yUJbZxDuZLFvXI=
-github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3 h1:bIqFDwgGXXN1Kpp99pDOdKMTTb5d2KyU5X/BZxjOkRo=
-github.com/aws/aws-sdk-go-v2/internal/ini v1.8.3/go.mod h1:H5O/EsxDWyU+LP/V8i5sm8cxoZgc2fdNR9bxlOFrQTo=
-github.com/aws/aws-sdk-go-v2/service/dynamodb v1.50.1 h1:MXUnj1TKjwQvotPPHFMfynlUljcpl5UccMrkiauKdWI=
-github.com/aws/aws-sdk-go-v2/service/dynamodb v1.50.1/go.mod h1:fe3UQAYwylCQRlGnihsqU/tTQkrc2nrW/IhWYwlW9vg=
-github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1 h1:oegbebPEMA/1Jny7kvwejowCaHz1FWZAQ94WXFNCyTM=
-github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.1/go.mod h1:kemo5Myr9ac0U9JfSjMo9yHLtw+pECEHsFtJ9tqCEI8=
-github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.11.6 h1:34ojKW9OV123FZ6Q8Nua3Uwy6yVTcshZ+gLE4gpMDEs=
-github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.11.6/go.mod h1:sXXWh1G9LKKkNbuR0f0ZPd/IvDXlMGiag40opt4XEgY=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.9 h1:5r34CgVOD4WZudeEKZ9/iKpiT6cM1JyEROpXjOcdWv8=
-github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.9/go.mod h1:dB12CEbNWPbzO2uC6QSWHteqOg4JfBVJOojbAoAUb5I=
+github.com/aws/aws-sdk-go-v2 v1.40.0 h1:/WMUA0kjhZExjOQN2z3oLALDREea1A7TobfuiBrKlwc=
+github.com/aws/aws-sdk-go-v2 v1.40.0/go.mod h1:c9pm7VwuW0UPxAEYGyTmyurVcNrbF6Rt/wixFqDhcjE=
+github.com/aws/aws-sdk-go-v2/config v1.32.0 h1:T5WWJYnam9SzBLbsVYDu2HscLDe+GU1AUJtfcDAc/vA=
+github.com/aws/aws-sdk-go-v2/config v1.32.0/go.mod h1:pSRm/+D3TxBixGMXlgtX4+MPO9VNtEEtiFmNpxksoxw=
+github.com/aws/aws-sdk-go-v2/credentials v1.19.0 h1:7zm+ez+qEqLaNsCSRaistkvJRJv8sByDOVuCnyHbP7M=
+github.com/aws/aws-sdk-go-v2/credentials v1.19.0/go.mod h1:pHKPblrT7hqFGkNLxqoS3FlGoPrQg4hMIa+4asZzBfs=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.14 h1:WZVR5DbDgxzA0BJeudId89Kmgy6DIU4ORpxwsVHz0qA=
+github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.14/go.mod h1:Dadl9QO0kHgbrH1GRqGiZdYtW5w+IXXaBNCHTIaheM4=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.14 h1:PZHqQACxYb8mYgms4RZbhZG0a7dPW06xOjmaH0EJC/I=
+github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.14/go.mod h1:VymhrMJUWs69D8u0/lZ7jSB6WgaG/NqHi3gX0aYf6U0=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.14 h1:bOS19y6zlJwagBfHxs0ESzr1XCOU2KXJCWcq3E2vfjY=
+github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.14/go.mod h1:1ipeGBMAxZ0xcTm6y6paC2C/J6f6OO7LBODV9afuAyM=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk=
+github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc=
+github.com/aws/aws-sdk-go-v2/service/dynamodb v1.53.1 h1:94W5IklNYC4LSldDFfH9E+gQbczZjqRwEr6lN5wEpCM=
+github.com/aws/aws-sdk-go-v2/service/dynamodb v1.53.1/go.mod h1:bz4cZH7uK5fLxQbj7hL4MFDL+pjReC9en/nM2Wfwxsk=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 h1:x2Ibm/Af8Fi+BH+Hsn9TXGdT+hKbDd5XOTZxTMxDk7o=
+github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3/go.mod h1:IW1jwyrQgMdhisceG8fQLmQIydcT/jWY21rFhzgaKwo=
+github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.11.14 h1:3exo28cClRTVnxdj/LULxkESZSSv74RUIjZ7tfHXfWQ=
+github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.11.14/go.mod h1:yLon9pByjyB6JZq5IAmwnjE3ObIhD0QibfRWH7tUhLU=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.14 h1:FIouAnCE46kyYqyhs0XEBDFFSREtdnr8HQuLPQPLCrY=
+github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.14/go.mod h1:UTwDc5COa5+guonQU8qBikJo1ZJ4ln2r1MkF7Dqag1E=
+github.com/aws/aws-sdk-go-v2/service/signin v1.0.1 h1:BDgIUYGEo5TkayOWv/oBLPphWwNm/A91AebUjAu5L5g=
+github.com/aws/aws-sdk-go-v2/service/signin v1.0.1/go.mod h1:iS6EPmNeqCsGo+xQmXv0jIMjyYtQfnwg36zl2FwEouk=
github.com/aws/aws-sdk-go-v2/service/sns v1.38.5 h1:c0hINjMfDQvQLJJxfNNcIaLYVLC7E0W2zOQOVVKLnnU=
github.com/aws/aws-sdk-go-v2/service/sns v1.38.5/go.mod h1:E427ZzdOMWh/4KtD48AGfbWLX14iyw9URVOdIwtv80o=
-github.com/aws/aws-sdk-go-v2/service/sso v1.29.6 h1:A1oRkiSQOWstGh61y4Wc/yQ04sqrQZr1Si/oAXj20/s=
-github.com/aws/aws-sdk-go-v2/service/sso v1.29.6/go.mod h1:5PfYspyCU5Vw1wNPsxi15LZovOnULudOQuVxphSflQA=
-github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.1 h1:5fm5RTONng73/QA73LhCNR7UT9RpFH3hR6HWL6bIgVY=
-github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.1/go.mod h1:xBEjWD13h+6nq+z4AkqSfSvqRKFgDIQeaMguAJndOWo=
-github.com/aws/aws-sdk-go-v2/service/sts v1.38.6 h1:p3jIvqYwUZgu/XYeI48bJxOhvm47hZb5HUQ0tn6Q9kA=
-github.com/aws/aws-sdk-go-v2/service/sts v1.38.6/go.mod h1:WtKK+ppze5yKPkZ0XwqIVWD4beCwv056ZbPQNoeHqM8=
-github.com/aws/smithy-go v1.23.0 h1:8n6I3gXzWJB2DxBDnfxgBaSX6oe0d/t10qGz7OKqMCE=
-github.com/aws/smithy-go v1.23.0/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI=
+github.com/aws/aws-sdk-go-v2/service/sso v1.30.4 h1:U//SlnkE1wOQiIImxzdY5PXat4Wq+8rlfVEw4Y7J8as=
+github.com/aws/aws-sdk-go-v2/service/sso v1.30.4/go.mod h1:av+ArJpoYf3pgyrj6tcehSFW+y9/QvAY8kMooR9bZCw=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.8 h1:MvlNs/f+9eM0mOjD9JzBUbf5jghyTk3p+O9yHMXX94Y=
+github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.8/go.mod h1:/j67Z5XBVDx8nZVp9EuFM9/BS5dvBznbqILGuu73hug=
+github.com/aws/aws-sdk-go-v2/service/sts v1.41.1 h1:GdGmKtG+/Krag7VfyOXV17xjTCz0i9NT+JnqLTOI5nA=
+github.com/aws/aws-sdk-go-v2/service/sts v1.41.1/go.mod h1:6TxbXoDSgBQ225Qd8Q+MbxUxUh6TtNKwbRt/EPS9xso=
+github.com/aws/smithy-go v1.23.2 h1:Crv0eatJUQhaManss33hS5r40CG3ZFH+21XSkqMrIUM=
+github.com/aws/smithy-go v1.23.2/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0=
github.com/baidubce/bce-sdk-go v0.9.230 h1:HzELBKiD7QAgYqZ1qHZexoI2A3Lo/6zYGQFvcUbS5cA=
github.com/baidubce/bce-sdk-go v0.9.230/go.mod h1:zbYJMQwE4IZuyrJiFO8tO8NbtYiKTFTbwh4eIsqjVdg=
github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3 h1:6df1vn4bBlDDo4tARvBm7l6KA9iVMnE3NWizDeWSrps=
@@ -919,8 +919,8 @@ github.com/caio/go-tdigest v3.1.0+incompatible h1:uoVMJ3Q5lXmVLCCqaMGHLBWnbGoN6L
github.com/caio/go-tdigest v3.1.0+incompatible/go.mod h1:sHQM/ubZStBUmF1WbB8FAm8q9GjDajLC5T7ydxE3JHI=
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
-github.com/cenkalti/backoff/v5 v5.0.2 h1:rIfFVxEf1QsI7E1ZHfp/B4DF/6QBAUhmgkxc0H7Zss8=
-github.com/cenkalti/backoff/v5 v5.0.2/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
+github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM=
+github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw=
@@ -960,8 +960,9 @@ github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG
github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M=
github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE=
github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk=
-github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM=
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
+github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4=
+github.com/coreos/go-semver v0.3.1/go.mod h1:irMmmIw/7yzSRPWryHsK7EYSg09caPQL03VsM8rvUec=
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/coreos/go-systemd/v22 v22.6.0 h1:aGVa/v8B7hpb0TKl0MWoAavPDmHvobFe5R5zn0bCJWo=
github.com/coreos/go-systemd/v22 v22.6.0/go.mod h1:iG+pp635Fo7ZmV/j14KUcmEyWF+0X7Lua8rrTWzYgWU=
@@ -983,14 +984,14 @@ github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33 h1:ucRHb6/lvW/+mT
github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
-github.com/dhui/dktest v0.4.3 h1:wquqUxAFdcUgabAVLvSCOKOlag5cIZuaOjYIBOWdsR0=
-github.com/dhui/dktest v0.4.3/go.mod h1:zNK8IwktWzQRm6I/l2Wjp7MakiyaFWv4G1hjmodmMTs=
+github.com/dhui/dktest v0.4.6 h1:+DPKyScKSEp3VLtbMDHcUq6V5Lm5zfZZVb0Sk7Ahom4=
+github.com/dhui/dktest v0.4.6/go.mod h1:JHTSYDtKkvFNFHJKqCzVzqXecyv+tKt8EzceOmQOgbU=
github.com/digitalocean/godo v1.157.0 h1:ReELaS6FxXNf8gryUiVH0wmyUmZN8/NCmBX4gXd3F0o=
github.com/digitalocean/godo v1.157.0/go.mod h1:tYeiWY5ZXVpU48YaFv0M5irUFHXGorZpDNm7zzdWMzM=
github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5QvfrDyIgxBk=
github.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=
-github.com/docker/docker v28.3.0+incompatible h1:ffS62aKWupCWdvcee7nBU9fhnmknOqDPaJAMtfK0ImQ=
-github.com/docker/docker v28.3.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
+github.com/docker/docker v28.3.3+incompatible h1:Dypm25kh4rmk49v1eiVbsAtpAsYURjYkaKubwuBdxEI=
+github.com/docker/docker v28.3.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c=
github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc=
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
@@ -1076,8 +1077,8 @@ github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpx
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.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
-github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
+github.com/go-logfmt/logfmt v0.6.1 h1:4hvbpePJKnIzH1B+8OR/JPbTx37NktoI9LE2QZBBkvE=
+github.com/go-logfmt/logfmt v0.6.1/go.mod h1:EV2pOAQoZaT1ZXZbqDl5hrymndi4SY9ED9/z6CO0XAk=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI=
@@ -1086,8 +1087,8 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
github.com/go-openapi/analysis v0.24.0 h1:vE/VFFkICKyYuTWYnplQ+aVr45vlG6NcZKC7BdIXhsA=
github.com/go-openapi/analysis v0.24.0/go.mod h1:GLyoJA+bvmGGaHgpfeDh8ldpGo69fAJg7eeMDMRCIrw=
-github.com/go-openapi/errors v0.22.3 h1:k6Hxa5Jg1TUyZnOwV2Lh81j8ayNw5VVYLvKrp4zFKFs=
-github.com/go-openapi/errors v0.22.3/go.mod h1:+WvbaBBULWCOna//9B9TbLNGSFOfF8lY9dw4hGiEiKQ=
+github.com/go-openapi/errors v0.22.4 h1:oi2K9mHTOb5DPW2Zjdzs/NIvwi2N3fARKaTJLdNabaM=
+github.com/go-openapi/errors v0.22.4/go.mod h1:z9S8ASTUqx7+CP1Q8dD8ewGH/1JWFFLX/2PmAYNQLgk=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.22.1 h1:sHYI1He3b9NqJ4wXLoJDKmUmHkWy/L7rtEo92JUxBNk=
@@ -1101,24 +1102,24 @@ github.com/go-openapi/runtime v0.29.0 h1:Y7iDTFarS9XaFQ+fA+lBLngMwH6nYfqig1G+pHx
github.com/go-openapi/runtime v0.29.0/go.mod h1:52HOkEmLL/fE4Pg3Kf9nxc9fYQn0UsIWyGjGIJE9dkg=
github.com/go-openapi/spec v0.20.6 h1:ich1RQ3WDbfoeTqTAb+5EIxNmpKVJZWBNah9RAT0jIQ=
github.com/go-openapi/spec v0.20.6/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA=
-github.com/go-openapi/strfmt v0.24.0 h1:dDsopqbI3wrrlIzeXRbqMihRNnjzGC+ez4NQaAAJLuc=
-github.com/go-openapi/strfmt v0.24.0/go.mod h1:Lnn1Bk9rZjXxU9VMADbEEOo7D7CDyKGLsSKekhFr7s4=
+github.com/go-openapi/strfmt v0.25.0 h1:7R0RX7mbKLa9EYCTHRcCuIPcaqlyQiWNPTXwClK0saQ=
+github.com/go-openapi/strfmt v0.25.0/go.mod h1:nNXct7OzbwrMY9+5tLX4I21pzcmE6ccMGXl3jFdPfn8=
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
github.com/go-openapi/swag v0.25.1 h1:6uwVsx+/OuvFVPqfQmOOPsqTcm5/GkBhNwLqIR916n8=
github.com/go-openapi/swag v0.25.1/go.mod h1:bzONdGlT0fkStgGPd3bhZf1MnuPkf2YAys6h+jZipOo=
github.com/go-openapi/swag/cmdutils v0.25.1 h1:nDke3nAFDArAa631aitksFGj2omusks88GF1VwdYqPY=
github.com/go-openapi/swag/cmdutils v0.25.1/go.mod h1:pdae/AFo6WxLl5L0rq87eRzVPm/XRHM3MoYgRMvG4A0=
-github.com/go-openapi/swag/conv v0.25.1 h1:+9o8YUg6QuqqBM5X6rYL/p1dpWeZRhoIt9x7CCP+he0=
-github.com/go-openapi/swag/conv v0.25.1/go.mod h1:Z1mFEGPfyIKPu0806khI3zF+/EUXde+fdeksUl2NiDs=
+github.com/go-openapi/swag/conv v0.25.3 h1:PcB18wwfba7MN5BVlBIV+VxvUUeC2kEuCEyJ2/t2X7E=
+github.com/go-openapi/swag/conv v0.25.3/go.mod h1:n4Ibfwhn8NJnPXNRhBO5Cqb9ez7alBR40JS4rbASUPU=
github.com/go-openapi/swag/fileutils v0.25.1 h1:rSRXapjQequt7kqalKXdcpIegIShhTPXx7yw0kek2uU=
github.com/go-openapi/swag/fileutils v0.25.1/go.mod h1:+NXtt5xNZZqmpIpjqcujqojGFek9/w55b3ecmOdtg8M=
github.com/go-openapi/swag/jsonname v0.25.1 h1:Sgx+qbwa4ej6AomWC6pEfXrA6uP2RkaNjA9BR8a1RJU=
github.com/go-openapi/swag/jsonname v0.25.1/go.mod h1:71Tekow6UOLBD3wS7XhdT98g5J5GR13NOTQ9/6Q11Zo=
-github.com/go-openapi/swag/jsonutils v0.25.1 h1:AihLHaD0brrkJoMqEZOBNzTLnk81Kg9cWr+SPtxtgl8=
-github.com/go-openapi/swag/jsonutils v0.25.1/go.mod h1:JpEkAjxQXpiaHmRO04N1zE4qbUEg3b7Udll7AMGTNOo=
-github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.1 h1:DSQGcdB6G0N9c/KhtpYc71PzzGEIc/fZ1no35x4/XBY=
-github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.1/go.mod h1:kjmweouyPwRUEYMSrbAidoLMGeJ5p6zdHi9BgZiqmsg=
+github.com/go-openapi/swag/jsonutils v0.25.3 h1:kV7wer79KXUM4Ea4tBdAVTU842Rg6tWstX3QbM4fGdw=
+github.com/go-openapi/swag/jsonutils v0.25.3/go.mod h1:ILcKqe4HC1VEZmJx51cVuZQ6MF8QvdfXsQfiaCs0z9o=
+github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.3 h1:/i3E9hBujtXfHy91rjtwJ7Fgv5TuDHgnSrYjhFxwxOw=
+github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.3/go.mod h1:8kYfCR2rHyOj25HVvxL5Nm8wkfzggddgjZm6RgjT8Ao=
github.com/go-openapi/swag/loading v0.25.1 h1:6OruqzjWoJyanZOim58iG2vj934TysYVptyaoXS24kw=
github.com/go-openapi/swag/loading v0.25.1/go.mod h1:xoIe2EG32NOYYbqxvXgPzne989bWvSNoWoyQVWEZicc=
github.com/go-openapi/swag/mangling v0.25.1 h1:XzILnLzhZPZNtmxKaz/2xIGPQsBsvmCjrJOWGNz/ync=
@@ -1127,10 +1128,14 @@ github.com/go-openapi/swag/netutils v0.25.1 h1:2wFLYahe40tDUHfKT1GRC4rfa5T1B4GWZ
github.com/go-openapi/swag/netutils v0.25.1/go.mod h1:CAkkvqnUJX8NV96tNhEQvKz8SQo2KF0f7LleiJwIeRE=
github.com/go-openapi/swag/stringutils v0.25.1 h1:Xasqgjvk30eUe8VKdmyzKtjkVjeiXx1Iz0zDfMNpPbw=
github.com/go-openapi/swag/stringutils v0.25.1/go.mod h1:JLdSAq5169HaiDUbTvArA2yQxmgn4D6h4A+4HqVvAYg=
-github.com/go-openapi/swag/typeutils v0.25.1 h1:rD/9HsEQieewNt6/k+JBwkxuAHktFtH3I3ysiFZqukA=
-github.com/go-openapi/swag/typeutils v0.25.1/go.mod h1:9McMC/oCdS4BKwk2shEB7x17P6HmMmA6dQRtAkSnNb8=
+github.com/go-openapi/swag/typeutils v0.25.3 h1:2w4mEEo7DQt3V4veWMZw0yTPQibiL3ri2fdDV4t2TQc=
+github.com/go-openapi/swag/typeutils v0.25.3/go.mod h1:Ou7g//Wx8tTLS9vG0UmzfCsjZjKhpjxayRKTHXf2pTE=
github.com/go-openapi/swag/yamlutils v0.25.1 h1:mry5ez8joJwzvMbaTGLhw8pXUnhDK91oSJLDPF1bmGk=
github.com/go-openapi/swag/yamlutils v0.25.1/go.mod h1:cm9ywbzncy3y6uPm/97ysW8+wZ09qsks+9RS8fLWKqg=
+github.com/go-openapi/testify/enable/yaml/v2 v2.0.2 h1:0+Y41Pz1NkbTHz8NngxTuAXxEodtNSI1WG1c/m5Akw4=
+github.com/go-openapi/testify/enable/yaml/v2 v2.0.2/go.mod h1:kme83333GCtJQHXQ8UKX3IBZu6z8T5Dvy5+CW3NLUUg=
+github.com/go-openapi/testify/v2 v2.0.2 h1:X999g3jeLcoY8qctY/c/Z8iBHTbwLz7R2WXd6Ub6wls=
+github.com/go-openapi/testify/v2 v2.0.2/go.mod h1:HCPmvFFnheKK2BuwSA0TbbdxJ3I16pjwMkYkP4Ywn54=
github.com/go-openapi/validate v0.25.0 h1:JD9eGX81hDTjoY3WOzh6WqxVBVl7xjsLnvDo1GL5WPU=
github.com/go-openapi/validate v0.25.0/go.mod h1:SUY7vKrN5FiwK6LyvSwKjDfLNirSfWwHNgxd2l29Mmw=
github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M=
@@ -1154,8 +1159,6 @@ github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u1
github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw=
github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY=
github.com/goccy/go-json v0.9.11/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
-github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
-github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/goccy/go-yaml v1.9.5/go.mod h1:U/jl18uSupI5rdI2jmuCswEA2htH9eXfferR3KfscvA=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E=
@@ -1170,10 +1173,10 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/gogo/status v1.1.1 h1:DuHXlSFHNKqTQ+/ACf5Vs6r4X/dH2EgIzR9Vr+H65kg=
github.com/gogo/status v1.1.1/go.mod h1:jpG3dM5QPcqu19Hg8lkUhBFBa3TcLs1DG7+2Jqci7oU=
-github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8=
-github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
-github.com/golang-migrate/migrate/v4 v4.18.1 h1:JML/k+t4tpHCpQTCAD62Nu43NUFzHY4CV3uAuvHGC+Y=
-github.com/golang-migrate/migrate/v4 v4.18.1/go.mod h1:HAX6m3sQgcdO81tdjn5exv20+3Kb13cmGli1hrD6hks=
+github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo=
+github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE=
+github.com/golang-migrate/migrate/v4 v4.19.0 h1:RcjOnCGz3Or6HQYEJ/EEVLfWnmw9KnoigPSjzhCuaSE=
+github.com/golang-migrate/migrate/v4 v4.19.0/go.mod h1:9dyEcu+hO+G9hPSw8AIg50yg622pXJsoHItQnDGZkI0=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
@@ -1325,14 +1328,14 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFb
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0/go.mod h1:YN5jB8ie0yfIUg6VvR9Kz84aCaG7AsGZnLjhHbUqwPg=
-github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo=
-github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI=
+github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU=
+github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs=
github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0=
-github.com/hashicorp/consul/api v1.32.0 h1:5wp5u780Gri7c4OedGEPzmlUEzi0g2KyiPphSr6zjVg=
-github.com/hashicorp/consul/api v1.32.0/go.mod h1:Z8YgY0eVPukT/17ejW+l+C7zJmKwgPHtjU1q16v/Y40=
+github.com/hashicorp/consul/api v1.33.0 h1:MnFUzN1Bo6YDGi/EsRLbVNgA4pyCymmcswrE5j4OHBM=
+github.com/hashicorp/consul/api v1.33.0/go.mod h1:vLz2I/bqqCYiG0qRHGerComvbwSWKswc8rRFtnYBrIw=
github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms=
-github.com/hashicorp/consul/sdk v0.16.1 h1:V8TxTnImoPD5cj0U9Spl0TUxcytjcbbJeADFF07KdHg=
-github.com/hashicorp/consul/sdk v0.16.1/go.mod h1:fSXvwxB2hmh1FMZCNl6PwX0Q/1wdWtHJcZ7Ea5tns0s=
+github.com/hashicorp/consul/sdk v0.17.0 h1:N/JigV6y1yEMfTIhXoW0DXUecM2grQnFuRpY7PcLHLI=
+github.com/hashicorp/consul/sdk v0.17.0/go.mod h1:8dgIhY6VlPUprRH7o7UenVuFEgq017qUn3k9wS5mCt4=
github.com/hashicorp/cronexpr v1.1.2 h1:wG/ZYIKT+RT3QkOdgYc+xsKWVRgnxJ1OJtjjy84fJ9A=
github.com/hashicorp/cronexpr v1.1.2/go.mod h1:P4wA0KBl9C5q2hABiMO7cp6jcIg96CDh1Efb3g1PWA4=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -1429,12 +1432,14 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE=
github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU=
-github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
-github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
+github.com/klauspost/compress v1.18.1 h1:bcSGx7UbpBqMChDtsF28Lw6v/G94LPrrbMbdC3JH2co=
+github.com/klauspost/compress v1.18.1/go.mod h1:ZQFFVG+MdnR0P+l6wpXgIL4NTtwiKIdBnrBd8Nrxr+0=
github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
-github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
-github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
+github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU=
+github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
+github.com/klauspost/crc32 v1.3.0 h1:sSmTt3gUt81RP655XGZPElI0PelVTZ6YwCRnPSupoFM=
+github.com/klauspost/crc32 v1.3.0/go.mod h1:D7kQaZhnkX/Y0tstFGf8VUzv2UofNGqCjnC3zdHB0Hw=
github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo=
github.com/knadh/koanf/maps v0.1.2/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI=
github.com/knadh/koanf/providers/confmap v1.0.0 h1:mHKLJTE7iXEys6deO5p6olAiZdG5zwp8Aebir+/EaRE=
@@ -1518,12 +1523,12 @@ github.com/miekg/dns v1.1.66 h1:FeZXOS3VCVsKnEAd+wBkjMC3D2K+ww66Cq3VnCINuJE=
github.com/miekg/dns v1.1.66/go.mod h1:jGFzBsSNbJw6z1HYut1RKBKHA9PBdxeHrZG8J+gC2WE=
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY=
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE=
-github.com/minio/crc64nvme v1.0.1 h1:DHQPrYPdqK7jQG/Ls5CTBZWeex/2FMS3G5XGkycuFrY=
-github.com/minio/crc64nvme v1.0.1/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg=
+github.com/minio/crc64nvme v1.1.0 h1:e/tAguZ+4cw32D+IO/8GSf5UVr9y+3eJcxZI2WOO/7Q=
+github.com/minio/crc64nvme v1.1.0/go.mod h1:eVfm2fAzLlxMdUGc0EEBGSMmPwmXD5XiNRpnu9J3bvg=
github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34=
github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM=
-github.com/minio/minio-go/v7 v7.0.93 h1:lAB4QJp8Nq3vDMOU0eKgMuyBiEGMNlXQ5Glc8qAxqSU=
-github.com/minio/minio-go/v7 v7.0.93/go.mod h1:71t2CqDt3ThzESgZUlU1rBN54mksGGlkLcFgguDnnAc=
+github.com/minio/minio-go/v7 v7.0.97 h1:lqhREPyfgHTB/ciX8k2r8k0D93WaFqxbJX36UZq5occ=
+github.com/minio/minio-go/v7 v7.0.97/go.mod h1:re5VXuo0pwEtoNLsNuSr0RrLfT/MBtohwdaSmPPSRSk=
github.com/minio/sha256-simd v1.0.1 h1:6kaan5IFmwTNynnKKpDHe6FWHohJOHhCPchzK49dzMM=
github.com/minio/sha256-simd v1.0.1/go.mod h1:Pz6AKMiUdngCLpeTL/RJY1M9rUuPMYujV5xJjtbRSN8=
github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI=
@@ -1550,8 +1555,9 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
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/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8=
+github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc=
github.com/mozillazg/go-httpheader v0.4.0 h1:aBn6aRXtFzyDLZ4VIRLsZbbJloagQfMnCiYgOq6hK4w=
@@ -1590,6 +1596,8 @@ github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQ
github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM=
github.com/opentracing-contrib/go-grpc v0.1.2 h1:MP16Ozc59kqqwn1v18aQxpeGZhsBanJ2iurZYaQSZ+g=
github.com/opentracing-contrib/go-grpc v0.1.2/go.mod h1:glU6rl1Fhfp9aXUHkE36K2mR4ht8vih0ekOVlWKEUHM=
+github.com/opentracing-contrib/go-grpc/test v0.0.0-20250122020132-2f9c7e3db032 h1:HGsK6KQUCjUB/wh0h7kxtNWu8AMmiGTFMiv9s9JrDSs=
+github.com/opentracing-contrib/go-grpc/test v0.0.0-20250122020132-2f9c7e3db032/go.mod h1:lGUfQ7UdqHsl7maAepZ2isMI1odCvxR62U2m/Jfi0oQ=
github.com/opentracing-contrib/go-stdlib v1.1.0 h1:cZBWc4pA4e65tqTJddbflK435S0tDImj6c9BMvkdUH0=
github.com/opentracing-contrib/go-stdlib v1.1.0/go.mod h1:S0p+X9p6dcBkoMTL+Qq2VOvxKs9ys5PpYWXWqlCS0bQ=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
@@ -1608,8 +1616,8 @@ github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144T
github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas=
-github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c h1:dAMKvw0MlJT1GshSTtih8C2gDs04w8dReiOGXrGLNoY=
-github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM=
+github.com/philhofer/fwd v1.2.0 h1:e6DnBTl7vGY+Gz322/ASL4Gyp1FspeMvx1RNDoToZuM=
+github.com/philhofer/fwd v1.2.0/go.mod h1:RqIHx9QI14HlwKwm98g9Re5prTQ6LdeRQn+gXJFxsJM=
github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY=
github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI=
github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI=
@@ -1663,8 +1671,8 @@ github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
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.67.1 h1:OTSON1P4DNxzTg4hmKCc37o4ZAZDv0cfXLkOt0oEowI=
-github.com/prometheus/common v0.67.1/go.mod h1:RpmT9v35q2Y+lsieQsdOh5sXZ6ajUGC8NjZAmr8vb0Q=
+github.com/prometheus/common v0.67.3 h1:shd26MlnwTw5jksTDhC7rTQIteBxy+ZZDr3t7F2xN2Q=
+github.com/prometheus/common v0.67.3/go.mod h1:gP0fq6YjjNCLssJCQp0yk4M8W6ikLURwkdd/YKtTbyI=
github.com/prometheus/exporter-toolkit v0.14.1 h1:uKPE4ewweVRWFainwvAcHs3uw15pjw2dk3I7b+aNo9o=
github.com/prometheus/exporter-toolkit v0.14.1/go.mod h1:di7yaAJiaMkcjcz48f/u4yRPwtyuxTU5Jr4EnM2mhtQ=
github.com/prometheus/otlptranslator v0.0.0-20250620074007-94f535e0c588 h1:QlySqDdSESgWDePeAYskbbcKKdowI26m9aU9zloHyYE=
@@ -1674,8 +1682,8 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
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.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg=
-github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is=
+github.com/prometheus/procfs v0.19.2 h1:zUMhqEW66Ex7OXIiDkll3tl9a1ZdilUOd/F6ZXw4Vws=
+github.com/prometheus/procfs v0.19.2/go.mod h1:M0aotyiemPhBCM0z5w87kL22CxfcH05ZpYlu+b4J7mw=
github.com/prometheus/prometheus v0.306.0 h1:Q0Pvz/ZKS6vVWCa1VSgNyNJlEe8hxdRlKklFg7SRhNw=
github.com/prometheus/prometheus v0.306.0/go.mod h1:7hMSGyZHt0dcmZ5r4kFPJ/vxPQU99N5/BGwSPDxeZrQ=
github.com/prometheus/sigv4 v0.2.1 h1:hl8D3+QEzU9rRmbKIRwMKRwaFGyLkbPdH5ZerglRHY0=
@@ -1735,8 +1743,8 @@ github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z
github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo=
github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
github.com/spf13/afero v1.10.0/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
-github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
-github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
+github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
+github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
@@ -1780,8 +1788,8 @@ github.com/thanos-io/thanos v0.39.3-0.20250729120336-88d0ae8071cb h1:z/ePbn3lo/D
github.com/thanos-io/thanos v0.39.3-0.20250729120336-88d0ae8071cb/go.mod h1:gGUG3TDEoRSjTFVs/QO6QnQIILRgNF0P9l7BiiMfmHw=
github.com/tinylib/msgp v1.3.0 h1:ULuf7GPooDaIlbyvgAxBV/FI7ynli6LZ1/nVUNu+0ww=
github.com/tinylib/msgp v1.3.0/go.mod h1:ykjzy2wzgrlvpDCRc4LA8UXy6D8bzMSuAF3WD57Gok0=
-github.com/tjhop/slog-gokit v0.1.4 h1:uj/vbDt3HaF0Py8bHPV4ti/s0utnO0miRbO277FLBKM=
-github.com/tjhop/slog-gokit v0.1.4/go.mod h1:Bbu5v2748qpAWH7k6gse/kw3076IJf6owJmh7yArmJs=
+github.com/tjhop/slog-gokit v0.1.5 h1:ayloIUi5EK2QYB8eY4DOPO95/mRtMW42lUkp3quJohc=
+github.com/tjhop/slog-gokit v0.1.5/go.mod h1:yA48zAHvV+Sg4z4VRyeFyFUNNXd3JY5Zg84u3USICq0=
github.com/trivago/tgo v1.0.7 h1:uaWH/XIy9aWYWpjm2CU3RpcqZXmX2ysQ9/Go+d9gyrM=
github.com/trivago/tgo v1.0.7/go.mod h1:w4dpD+3tzNIIiIfkWWa85w5/B77tlvdZckQ+6PkFnhc=
github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
@@ -1813,17 +1821,17 @@ github.com/yuin/gopher-lua v1.1.1/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7
github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0=
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A=
-go.etcd.io/etcd/api/v3 v3.5.17 h1:cQB8eb8bxwuxOilBpMJAEo8fAONyrdXTHUNcMd8yT1w=
-go.etcd.io/etcd/api/v3 v3.5.17/go.mod h1:d1hvkRuXkts6PmaYk2Vrgqbv7H4ADfAKhyJqHNLJCB4=
+go.etcd.io/etcd/api/v3 v3.6.6 h1:mcaMp3+7JawWv69p6QShYWS8cIWUOl32bFLb6qf8pOQ=
+go.etcd.io/etcd/api/v3 v3.6.6/go.mod h1:f/om26iXl2wSkcTA1zGQv8reJRSLVdoEBsi4JdfMrx4=
go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
-go.etcd.io/etcd/client/pkg/v3 v3.5.17 h1:XxnDXAWq2pnxqx76ljWwiQ9jylbpC4rvkAeRVOUKKVw=
-go.etcd.io/etcd/client/pkg/v3 v3.5.17/go.mod h1:4DqK1TKacp/86nJk4FLQqo6Mn2vvQFBmruW3pP14H/w=
+go.etcd.io/etcd/client/pkg/v3 v3.6.6 h1:uoqgzSOv2H9KlIF5O1Lsd8sW+eMLuV6wzE3q5GJGQNs=
+go.etcd.io/etcd/client/pkg/v3 v3.6.6/go.mod h1:YngfUVmvsvOJ2rRgStIyHsKtOt9SZI2aBJrZiWJhCbI=
go.etcd.io/etcd/client/v2 v2.305.4/go.mod h1:Ud+VUwIi9/uQHOMA+4ekToJ12lTxlv0zB/+DHwTGEbU=
go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY=
-go.etcd.io/etcd/client/v3 v3.5.17 h1:o48sINNeWz5+pjy/Z0+HKpj/xSnBkuVhVvXkjEXbqZY=
-go.etcd.io/etcd/client/v3 v3.5.17/go.mod h1:j2d4eXTHWkT2ClBgnnEPm/Wuu7jsqku41v9DZ3OtjQo=
-go.mongodb.org/mongo-driver v1.17.4 h1:jUorfmVzljjr0FLzYQsGP8cgN/qzzxlY9Vh0C9KFXVw=
-go.mongodb.org/mongo-driver v1.17.4/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
+go.etcd.io/etcd/client/v3 v3.6.6 h1:G5z1wMf5B9SNexoxOHUGBaULurOZPIgGPsW6CN492ec=
+go.etcd.io/etcd/client/v3 v3.6.6/go.mod h1:36Qv6baQ07znPR3+n7t+Rk5VHEzVYPvFfGmfF4wBHV8=
+go.mongodb.org/mongo-driver v1.17.6 h1:87JUG1wZfWsr6rIz3ZmpH90rL5tea7O3IHuSwHUpsss=
+go.mongodb.org/mongo-driver v1.17.6/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
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=
@@ -1852,12 +1860,12 @@ go.opentelemetry.io/collector/consumer/consumertest v0.129.0 h1:kRmrAgVvPxH5c/rT
go.opentelemetry.io/collector/consumer/consumertest v0.129.0/go.mod h1:JgJKms1+v/CuAjkPH+ceTnKeDgUUGTQV4snGu5wTEHY=
go.opentelemetry.io/collector/consumer/xconsumer v0.129.0 h1:bRyJ9TGWwnrUnB5oQGTjPhxpVRbkIVeugmvks22bJ4A=
go.opentelemetry.io/collector/consumer/xconsumer v0.129.0/go.mod h1:pbe5ZyPJrtzdt/RRI0LqfT1GVBiJLbtkDKx3SBRTiTY=
-go.opentelemetry.io/collector/featuregate v1.35.0 h1:c/XRtA35odgxVc4VgOF/PTIk7ajw1wYdQ6QI562gzd4=
-go.opentelemetry.io/collector/featuregate v1.35.0/go.mod h1:Y/KsHbvREENKvvN9RlpiWk/IGBK+CATBYzIIpU7nccc=
+go.opentelemetry.io/collector/featuregate v1.46.0 h1:z3JlymFdWW6aDo9cYAJ6bCqT+OI2DlurJ9P8HqfuKWQ=
+go.opentelemetry.io/collector/featuregate v1.46.0/go.mod h1:d0tiRzVYrytB6LkcYgz2ESFTv7OktRPQe0QEQcPt1L4=
go.opentelemetry.io/collector/internal/telemetry v0.129.0 h1:jkzRpIyMxMGdAzVOcBe8aRNrbP7eUrMq6cxEHe0sbzA=
go.opentelemetry.io/collector/internal/telemetry v0.129.0/go.mod h1:riAPlR2LZBV7VEx4LicOKebg3N1Ja3izzkv5fl1Lhiw=
-go.opentelemetry.io/collector/pdata v1.35.0 h1:ck6WO6hCNjepADY/p9sT9/rLECTLO5ukYTumKzsqB/E=
-go.opentelemetry.io/collector/pdata v1.35.0/go.mod h1:pttpb089864qG1k0DMeXLgwwTFLk+o3fAW9I6MF9tzw=
+go.opentelemetry.io/collector/pdata v1.46.0 h1:XzhnIWNtc/gbOyFiewRvybR4s3phKHrWxL3yc/wVLDo=
+go.opentelemetry.io/collector/pdata v1.46.0/go.mod h1:D2e3BWCUC/bUg29WNzCDVN7Ab0Gzk7hGXZL2pnrDOn0=
go.opentelemetry.io/collector/pdata/pprofile v0.129.0 h1:DgZTvjOGmyZRx7Or80hz8XbEaGwHPkIh2SX1A5eXttQ=
go.opentelemetry.io/collector/pdata/pprofile v0.129.0/go.mod h1:uUBZxqJNOk6QIMvbx30qom//uD4hXJ1K/l3qysijMLE=
go.opentelemetry.io/collector/pdata/testdata v0.129.0 h1:n1QLnLOtrcAR57oMSVzmtPsQEpCc/nE5Avk1xfuAkjY=
@@ -1885,8 +1893,8 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 h1:F7Jx+6h
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0/go.mod h1:UHB22Z8QsdRDrnAtX4PntOl36ajSxcdUMt1sF7Y6E7Q=
go.opentelemetry.io/contrib/propagators/autoprop v0.61.0 h1:cxOVDJ30qfzV27G5p9WMtJUB/3cXC0iL+u9EV1fSOws=
go.opentelemetry.io/contrib/propagators/autoprop v0.61.0/go.mod h1:Y+xiUbWetg65vAroDZcIzJ5wyPNWRH32EoIV9rIaa0g=
-go.opentelemetry.io/contrib/propagators/aws v1.36.0 h1:Txhy/1LZIbbnutftc5pdU8Y9vOQuAkuIOFXuLsdDejs=
-go.opentelemetry.io/contrib/propagators/aws v1.36.0/go.mod h1:M3A0491jGFPNHU8b3zEW7r/gtsMpGOsFUO3WL+SZ1xw=
+go.opentelemetry.io/contrib/propagators/aws v1.38.0 h1:eRZ7asSbLc5dH7+TBzL6hFKb1dabz0IV51uUUwYRZts=
+go.opentelemetry.io/contrib/propagators/aws v1.38.0/go.mod h1:wXqc9NTGcXapBExHBDVLEZlByu6quiQL8w7Tjgv8TCg=
go.opentelemetry.io/contrib/propagators/b3 v1.36.0 h1:xrAb/G80z/l5JL6XlmUMSD1i6W8vXkWrLfmkD3w/zZo=
go.opentelemetry.io/contrib/propagators/b3 v1.36.0/go.mod h1:UREJtqioFu5awNaCR8aEx7MfJROFlAWb6lPaJFbHaG0=
go.opentelemetry.io/contrib/propagators/jaeger v1.36.0 h1:SoCgXYF4ISDtNyfLUzsGDaaudZVTx2yJhOyBO0+/GYk=
@@ -1897,12 +1905,12 @@ go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGi
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8=
go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM=
-go.opentelemetry.io/otel/bridge/opentracing v1.36.0 h1:GWGmcYhMCu6+K/Yz5KWSETU/esd/mkVGx+77uKtLjpk=
-go.opentelemetry.io/otel/bridge/opentracing v1.36.0/go.mod h1:bW7xTHgtWSNqY8QjhqXzloXBkw3iQIa8uBqCF/0EUbc=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.36.0 h1:dNzwXjZKpMpE2JhmO+9HsPl42NIXFIFSUSSs0fiqra0=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.36.0/go.mod h1:90PoxvaEB5n6AOdZvi+yWJQoE95U8Dhhw2bSyRqnTD0=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.36.0 h1:JgtbA0xkWHnTmYk7YusopJFX6uleBmAuZ8n05NEh8nQ=
-go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.36.0/go.mod h1:179AK5aar5R3eS9FucPy6rggvU0g52cvKId8pv4+v0c=
+go.opentelemetry.io/otel/bridge/opentracing v1.38.0 h1:D90TIU3MD4BohrGvLW2ZGXeiFrgFL3c1tMcSFPSX0Lc=
+go.opentelemetry.io/otel/bridge/opentracing v1.38.0/go.mod h1:0FOr06rtmkVGtQHeG8eTVS2rOmHkmz04peq5+VYNKzc=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 h1:lwI4Dc5leUqENgGuQImwLo4WnuXFPetmPpkLi2IrX54=
+go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0/go.mod h1:Kz/oCE7z5wuyhPxsXDuaPteSWqjSBD5YaSdbxZYGbGk=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.29.0 h1:WDdP9acbMYjbKIyJUhTvtzj601sVJOqgWdUxSdR/Ysc=
go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.29.0/go.mod h1:BLbf7zbNIONBLPwvFnwNHGj4zge8uTCM/UPIVW1Mq2I=
go.opentelemetry.io/otel/log v0.12.2 h1:yob9JVHn2ZY24byZeaXpTVoPS6l+UrrxmxmPKohXTwc=
@@ -1927,8 +1935,14 @@ go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqe
go.opentelemetry.io/proto/otlp v0.15.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
go.opentelemetry.io/proto/otlp v0.19.0/go.mod h1:H7XAot3MsfNsj7EXtrA2q5xSNQ10UqI405h3+duxN4U=
go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM=
-go.opentelemetry.io/proto/otlp v1.7.0 h1:jX1VolD6nHuFzOYso2E73H85i92Mv8JQYk0K9vz09os=
-go.opentelemetry.io/proto/otlp v1.7.0/go.mod h1:fSKjH6YJ7HDlwzltzyMj036AJ3ejJLCgCSHGj4efDDo=
+go.opentelemetry.io/proto/otlp v1.7.1 h1:gTOMpGDb0WTBOP8JaO72iL3auEZhVmAQg4ipjOVAtj4=
+go.opentelemetry.io/proto/otlp v1.7.1/go.mod h1:b2rVh6rfI/s2pHWNlB7ILJcRALpcNDzKhACevjI+ZnE=
+go.opentelemetry.io/proto/slim/otlp v1.9.0 h1:fPVMv8tP3TrsqlkH1HWYUpbCY9cAIemx184VGkS6vlE=
+go.opentelemetry.io/proto/slim/otlp v1.9.0/go.mod h1:xXdeJJ90Gqyll+orzUkY4bOd2HECo5JofeoLpymVqdI=
+go.opentelemetry.io/proto/slim/otlp/collector/profiles/v1development v0.2.0 h1:o13nadWDNkH/quoDomDUClnQBpdQQ2Qqv0lQBjIXjE8=
+go.opentelemetry.io/proto/slim/otlp/collector/profiles/v1development v0.2.0/go.mod h1:Gyb6Xe7FTi/6xBHwMmngGoHqL0w29Y4eW8TGFzpefGA=
+go.opentelemetry.io/proto/slim/otlp/profiles/v1development v0.2.0 h1:EiUYvtwu6PMrMHVjcPfnsG3v+ajPkbUeH+IL93+QYyk=
+go.opentelemetry.io/proto/slim/otlp/profiles/v1development v0.2.0/go.mod h1:mUUHKFiN2SST3AhJ8XhJxEoeVW12oqfXog0Bo8W3Ec4=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE=
go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
@@ -1979,8 +1993,8 @@ golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5D
golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc=
-golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04=
-golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0=
+golang.org/x/crypto v0.44.0 h1:A97SsFvM3AIwEEmTBiaxPPTYpDC47w720rdiiUvgoAU=
+golang.org/x/crypto v0.44.0/go.mod h1:013i+Nw79BMiQiMsOPcVCB5ZIJbYkerPrGnOa00tvmc=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -1996,8 +2010,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0
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-20220827204233-334a2380cb91/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
-golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 h1:bsqhLWFR6G6xiQcb+JoGqdKdRU6WzPWmK8E0jxTjzo4=
-golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8=
+golang.org/x/exp v0.0.0-20250808145144-a408d31f581a h1:Y+7uR/b1Mw2iSXZ3G//1haIiSElDQZ8KWh0h+sZPG90=
+golang.org/x/exp v0.0.0-20250808145144-a408d31f581a/go.mod h1:rT6SFzZ7oxADUDx58pcaKFTcZ+inxAa9fTrYx/uVYwg=
golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs=
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=
@@ -2119,8 +2133,8 @@ golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
-golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
-golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
+golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY=
+golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU=
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=
@@ -2152,8 +2166,8 @@ golang.org/x/oauth2 v0.6.0/go.mod h1:ycmewcwgD4Rpr3eZJLSB4Kyyljb3qDh40vJ8STE5HKw
golang.org/x/oauth2 v0.7.0/go.mod h1:hPLQkd9LyjfXTiRohC/41GhcFqxisoUQ99sCUOHO9x4=
golang.org/x/oauth2 v0.8.0/go.mod h1:yr7u4HXZRm1R1kBWqr/xKNqewf0plRYoB7sla+BCIXE=
golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
-golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo=
-golang.org/x/oauth2 v0.31.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
+golang.org/x/oauth2 v0.32.0 h1:jsCblLleRMDrxMN29H3z/k1KliIvpLgCkE6R8FXXNgY=
+golang.org/x/oauth2 v0.32.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA=
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=
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -2176,8 +2190,8 @@ golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
-golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
-golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
+golang.org/x/sync v0.18.0 h1:kr88TuHDroi+UVf+0hZnirlk8o8T+4MrK6mr60WkH/I=
+golang.org/x/sync v0.18.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/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-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -2278,7 +2292,6 @@ golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
@@ -2288,8 +2301,8 @@ golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
-golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
-golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
+golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc=
+golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/telemetry v0.0.0-20240521205824-bda55230c457/go.mod h1:pRgIJT+bRLFKnoM1ldnzKoxTIn14Yxz928LQRYYgIN0=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -2310,8 +2323,8 @@ golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0=
golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek=
-golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q=
-golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss=
+golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU=
+golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -2334,16 +2347,16 @@ golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
-golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
-golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
+golang.org/x/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM=
+golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM=
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/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.1.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
-golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
-golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
+golang.org/x/time v0.14.0 h1:MRx4UaLrDotUKUdCIqzPC48t1Y9hANFKIRpNx+Te8PI=
+golang.org/x/time v0.14.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4=
golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/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-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -2663,8 +2676,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.
google.golang.org/genproto/googleapis/api v0.0.0-20240814211410-ddb44dafa142/go.mod h1:d6be+8HhtEtucleCbxpPW9PA9XwISACu8nvpPqF0BVo=
google.golang.org/genproto/googleapis/api v0.0.0-20241202173237-19429a94021a/go.mod h1:jehYqy3+AhJU9ve55aNOaSml7wUXjF9x6z2LcCfpAhY=
google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422/go.mod h1:b6h1vNKhxaSoEI+5jc3PJUCustfli/mRab7295pY7rw=
-google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 h1:oWVWY3NzT7KJppx2UKhKmzPq4SRe0LdCijVRwvGeikY=
-google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822/go.mod h1:h3c4v36UTKzUiuaOKQ6gr3S+0hovBtUrXzTG/i3+XEc=
+google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5 h1:BIRfGDEjiHRrk0QKZe3Xv2ieMhtgRGeLcZQ0mIVn4EY=
+google.golang.org/genproto/googleapis/api v0.0.0-20250825161204-c5933d9347a5/go.mod h1:j3QtIyytwqGr1JUDtYXwtMXWPKsEa5LtzIFN1Wn5WvE=
google.golang.org/genproto/googleapis/bytestream v0.0.0-20230530153820-e85fd2cbaebc/go.mod h1:ylj+BE99M198VPbBh6A8d9n3w8fChvyLK3wwBOjXBFA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234015-3fc162c6f38a/go.mod h1:xURIpW9ES5+/GZhnV6beoEtxQrnkRGIfP5VQG2tCBLc=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA=
@@ -2683,8 +2696,8 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20241118233622-e639e219e697/go.
google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d/go.mod h1:3ENsm/5D1mzDyhpzeRi1NR784I0BcofWBoSc5QqqMK4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50=
-google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 h1:fc6jSaCT0vBduLYZHYrBBNY4dsWuvgyff9noRNDdBeE=
-google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5 h1:eaY8u2EuxbRv7c3NiGK0/NedzVsCcV6hDuU5qPX5EGE=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20250825161204-c5933d9347a5/go.mod h1:M4/wBTSeyLxupu3W3tJtOgB14jILAS/XWPSSa3TAlJc=
google.golang.org/grpc v1.71.2 h1:KnzCueW4s+8ojAPZ+NnyZAELjsIMJGteKjKejieEC7M=
google.golang.org/grpc v1.71.2/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
diff --git a/vendor/github.com/VictoriaMetrics/fastcache/fastcache.go b/vendor/github.com/VictoriaMetrics/fastcache/fastcache.go
index 046af6cebb1..9358a2b42b6 100644
--- a/vendor/github.com/VictoriaMetrics/fastcache/fastcache.go
+++ b/vendor/github.com/VictoriaMetrics/fastcache/fastcache.go
@@ -217,6 +217,10 @@ func (c *Cache) UpdateStats(s *Stats) {
type bucket struct {
mu sync.RWMutex
+ getCalls uint64
+ setCalls uint64
+ misses uint64
+
// chunks is a ring buffer with encoded (k, v) pairs.
// It consists of 64KB chunks.
chunks [][]byte
@@ -224,15 +228,12 @@ type bucket struct {
// m maps hash(k) to idx of (k, v) pair in chunks.
m map[uint64]uint64
- // idx points to chunks for writing the next (k, v) pair.
- idx uint64
-
// gen is the generation of chunks.
gen uint64
- getCalls uint64
- setCalls uint64
- misses uint64
+ // idx points to chunks for writing the next (k, v) pair.
+ idx uint64
+
collisions uint64
corruptions uint64
}
@@ -333,9 +334,9 @@ func (b *bucket) Set(k, v []byte, h uint64) {
return
}
+ b.mu.Lock()
chunks := b.chunks
needClean := false
- b.mu.Lock()
idx := b.idx
idxNew := idx + kvLen
chunkIdx := idx / chunkSize
@@ -375,10 +376,10 @@ func (b *bucket) Set(k, v []byte, h uint64) {
}
func (b *bucket) Get(dst, k []byte, h uint64, returnDst bool) ([]byte, bool) {
+ b.mu.RLock()
atomic.AddUint64(&b.getCalls, 1)
found := false
chunks := b.chunks
- b.mu.RLock()
v := b.m[h]
bGen := b.gen & ((1 << genSizeBits) - 1)
if v > 0 {
diff --git a/vendor/github.com/VictoriaMetrics/fastcache/file.go b/vendor/github.com/VictoriaMetrics/fastcache/file.go
index dfbc0701d93..46e3613bbcd 100644
--- a/vendor/github.com/VictoriaMetrics/fastcache/file.go
+++ b/vendor/github.com/VictoriaMetrics/fastcache/file.go
@@ -76,6 +76,16 @@ func (c *Cache) SaveToFileConcurrent(filePath string, concurrency int) error {
return nil
}
+// LoadFromFileMaxBytes loads cache data from the specified filePath,
+// enforcing that the cache capacity matches the provided maxBytes value.
+//
+// Returns an error if the stored cache's capacity differs from maxBytes.
+//
+// See SaveToFile* for functions that persist cache data to a file.
+func LoadFromFileMaxBytes(filePath string, maxBytes int) (*Cache, error) {
+ return load(filePath, maxBytes)
+}
+
// LoadFromFile loads cache data from the given filePath.
//
// See SaveToFile* for saving cache data to file.
@@ -134,14 +144,14 @@ func load(filePath string, maxBytes int) (*Cache, error) {
maxBucketBytes := uint64((maxBytes + bucketsCount - 1) / bucketsCount)
expectedBucketChunks := (maxBucketBytes + chunkSize - 1) / chunkSize
if maxBucketChunks != expectedBucketChunks {
- return nil, fmt.Errorf("cache file %s contains maxBytes=%d; want %d", filePath, maxBytes, expectedBucketChunks*chunkSize*bucketsCount)
+ return nil, fmt.Errorf("cache file %s contains unexpected number of bucket chunks; got %d; want %d", filePath, maxBucketChunks, expectedBucketChunks)
}
}
// Read bucket files from filePath dir.
d, err := os.Open(filePath)
if err != nil {
- return nil, fmt.Errorf("cannot open %q: %s", filePath, err)
+ return nil, fmt.Errorf("cannot open %q: %w", filePath, err)
}
defer func() {
_ = d.Close()
@@ -206,7 +216,7 @@ func loadMetadata(dir string) (uint64, error) {
metadataPath := dir + "/metadata.bin"
metadataFile, err := os.Open(metadataPath)
if err != nil {
- return 0, fmt.Errorf("cannot open %q: %s", metadataPath, err)
+ return 0, fmt.Errorf("cannot open %q: %w", metadataPath, err)
}
defer func() {
_ = metadataFile.Close()
diff --git a/vendor/github.com/VictoriaMetrics/fastcache/malloc_heap.go b/vendor/github.com/VictoriaMetrics/fastcache/malloc_heap.go
index 810d460b79e..54846f40f08 100644
--- a/vendor/github.com/VictoriaMetrics/fastcache/malloc_heap.go
+++ b/vendor/github.com/VictoriaMetrics/fastcache/malloc_heap.go
@@ -1,5 +1,5 @@
-//go:build appengine || windows
-// +build appengine windows
+//go:build appengine || windows || wasm || tinygo.wasm || js
+// +build appengine windows wasm tinygo.wasm js
package fastcache
diff --git a/vendor/github.com/VictoriaMetrics/fastcache/malloc_mmap.go b/vendor/github.com/VictoriaMetrics/fastcache/malloc_mmap.go
index e24d578bf75..c636b385f31 100644
--- a/vendor/github.com/VictoriaMetrics/fastcache/malloc_mmap.go
+++ b/vendor/github.com/VictoriaMetrics/fastcache/malloc_mmap.go
@@ -1,5 +1,5 @@
-//go:build !appengine && !windows
-// +build !appengine,!windows
+//go:build !appengine && !windows && !wasm && !tinygo.wasm && !js
+// +build !appengine,!windows,!wasm,!tinygo.wasm,!js
package fastcache
diff --git a/vendor/github.com/asaskevich/govalidator/.gitignore b/vendor/github.com/asaskevich/govalidator/.gitignore
deleted file mode 100644
index 8d69a9418aa..00000000000
--- a/vendor/github.com/asaskevich/govalidator/.gitignore
+++ /dev/null
@@ -1,15 +0,0 @@
-bin/
-.idea/
-# Binaries for programs and plugins
-*.exe
-*.exe~
-*.dll
-*.so
-*.dylib
-
-# Test binary, built with `go test -c`
-*.test
-
-# Output of the go coverage tool, specifically when used with LiteIDE
-*.out
-
diff --git a/vendor/github.com/asaskevich/govalidator/.travis.yml b/vendor/github.com/asaskevich/govalidator/.travis.yml
deleted file mode 100644
index bb83c6670df..00000000000
--- a/vendor/github.com/asaskevich/govalidator/.travis.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-language: go
-dist: xenial
-go:
- - '1.10'
- - '1.11'
- - '1.12'
- - '1.13'
- - 'tip'
-
-script:
- - go test -coverpkg=./... -coverprofile=coverage.info -timeout=5s
- - bash <(curl -s https://codecov.io/bash)
diff --git a/vendor/github.com/asaskevich/govalidator/CODE_OF_CONDUCT.md b/vendor/github.com/asaskevich/govalidator/CODE_OF_CONDUCT.md
deleted file mode 100644
index 4b462b0d81b..00000000000
--- a/vendor/github.com/asaskevich/govalidator/CODE_OF_CONDUCT.md
+++ /dev/null
@@ -1,43 +0,0 @@
-# Contributor Code of Conduct
-
-This project adheres to [The Code Manifesto](http://codemanifesto.com)
-as its guidelines for contributor interactions.
-
-## The Code Manifesto
-
-We want to work in an ecosystem that empowers developers to reach their
-potential — one that encourages growth and effective collaboration. A space
-that is safe for all.
-
-A space such as this benefits everyone that participates in it. It encourages
-new developers to enter our field. It is through discussion and collaboration
-that we grow, and through growth that we improve.
-
-In the effort to create such a place, we hold to these values:
-
-1. **Discrimination limits us.** This includes discrimination on the basis of
- race, gender, sexual orientation, gender identity, age, nationality,
- technology and any other arbitrary exclusion of a group of people.
-2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort
- levels. Remember that, and if brought to your attention, heed it.
-3. **We are our biggest assets.** None of us were born masters of our trade.
- Each of us has been helped along the way. Return that favor, when and where
- you can.
-4. **We are resources for the future.** As an extension of #3, share what you
- know. Make yourself a resource to help those that come after you.
-5. **Respect defines us.** Treat others as you wish to be treated. Make your
- discussions, criticisms and debates from a position of respectfulness. Ask
- yourself, is it true? Is it necessary? Is it constructive? Anything less is
- unacceptable.
-6. **Reactions require grace.** Angry responses are valid, but abusive language
- and vindictive actions are toxic. When something happens that offends you,
- handle it assertively, but be respectful. Escalate reasonably, and try to
- allow the offender an opportunity to explain themselves, and possibly
- correct the issue.
-7. **Opinions are just that: opinions.** Each and every one of us, due to our
- background and upbringing, have varying opinions. That is perfectly
- acceptable. Remember this: if you respect your own opinions, you should
- respect the opinions of others.
-8. **To err is human.** You might not intend it, but mistakes do happen and
- contribute to build experience. Tolerate honest mistakes, and don't
- hesitate to apologize if you make one yourself.
diff --git a/vendor/github.com/asaskevich/govalidator/CONTRIBUTING.md b/vendor/github.com/asaskevich/govalidator/CONTRIBUTING.md
deleted file mode 100644
index 7ed268a1edd..00000000000
--- a/vendor/github.com/asaskevich/govalidator/CONTRIBUTING.md
+++ /dev/null
@@ -1,63 +0,0 @@
-#### Support
-If you do have a contribution to the package, feel free to create a Pull Request or an Issue.
-
-#### What to contribute
-If you don't know what to do, there are some features and functions that need to be done
-
-- [ ] Refactor code
-- [ ] Edit docs and [README](https://github.com/asaskevich/govalidator/README.md): spellcheck, grammar and typo check
-- [ ] Create actual list of contributors and projects that currently using this package
-- [ ] Resolve [issues and bugs](https://github.com/asaskevich/govalidator/issues)
-- [ ] Update actual [list of functions](https://github.com/asaskevich/govalidator#list-of-functions)
-- [ ] Update [list of validators](https://github.com/asaskevich/govalidator#validatestruct-2) that available for `ValidateStruct` and add new
-- [ ] Implement new validators: `IsFQDN`, `IsIMEI`, `IsPostalCode`, `IsISIN`, `IsISRC` etc
-- [x] Implement [validation by maps](https://github.com/asaskevich/govalidator/issues/224)
-- [ ] Implement fuzzing testing
-- [ ] Implement some struct/map/array utilities
-- [ ] Implement map/array validation
-- [ ] Implement benchmarking
-- [ ] Implement batch of examples
-- [ ] Look at forks for new features and fixes
-
-#### Advice
-Feel free to create what you want, but keep in mind when you implement new features:
-- Code must be clear and readable, names of variables/constants clearly describes what they are doing
-- Public functions must be documented and described in source file and added to README.md to the list of available functions
-- There are must be unit-tests for any new functions and improvements
-
-## Financial contributions
-
-We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/govalidator).
-Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
-
-
-## Credits
-
-
-### Contributors
-
-Thank you to all the people who have already contributed to govalidator!
-
-
-
-### Backers
-
-Thank you to all our backers! [[Become a backer](https://opencollective.com/govalidator#backer)]
-
-
-
-
-### Sponsors
-
-Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/govalidator#sponsor))
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/vendor/github.com/asaskevich/govalidator/LICENSE b/vendor/github.com/asaskevich/govalidator/LICENSE
deleted file mode 100644
index cacba910240..00000000000
--- a/vendor/github.com/asaskevich/govalidator/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) 2014-2020 Alex Saskevich
-
-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/asaskevich/govalidator/README.md b/vendor/github.com/asaskevich/govalidator/README.md
deleted file mode 100644
index 2c3fc35eb64..00000000000
--- a/vendor/github.com/asaskevich/govalidator/README.md
+++ /dev/null
@@ -1,622 +0,0 @@
-govalidator
-===========
-[](https://gitter.im/asaskevich/govalidator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [](https://godoc.org/github.com/asaskevich/govalidator)
-[](https://travis-ci.org/asaskevich/govalidator)
-[](https://codecov.io/gh/asaskevich/govalidator) [](https://goreportcard.com/report/github.com/asaskevich/govalidator) [](http://go-search.org/view?id=github.com%2Fasaskevich%2Fgovalidator) [](#backers) [](#sponsors) [](https://app.fossa.io/projects/git%2Bgithub.com%2Fasaskevich%2Fgovalidator?ref=badge_shield)
-
-A package of validators and sanitizers for strings, structs and collections. Based on [validator.js](https://github.com/chriso/validator.js).
-
-#### Installation
-Make sure that Go is installed on your computer.
-Type the following command in your terminal:
-
- go get github.com/asaskevich/govalidator
-
-or you can get specified release of the package with `gopkg.in`:
-
- go get gopkg.in/asaskevich/govalidator.v10
-
-After it the package is ready to use.
-
-
-#### Import package in your project
-Add following line in your `*.go` file:
-```go
-import "github.com/asaskevich/govalidator"
-```
-If you are unhappy to use long `govalidator`, you can do something like this:
-```go
-import (
- valid "github.com/asaskevich/govalidator"
-)
-```
-
-#### Activate behavior to require all fields have a validation tag by default
-`SetFieldsRequiredByDefault` causes validation to fail when struct fields do not include validations or are not explicitly marked as exempt (using `valid:"-"` or `valid:"email,optional"`). A good place to activate this is a package init function or the main() function.
-
-`SetNilPtrAllowedByRequired` causes validation to pass when struct fields marked by `required` are set to nil. This is disabled by default for consistency, but some packages that need to be able to determine between `nil` and `zero value` state can use this. If disabled, both `nil` and `zero` values cause validation errors.
-
-```go
-import "github.com/asaskevich/govalidator"
-
-func init() {
- govalidator.SetFieldsRequiredByDefault(true)
-}
-```
-
-Here's some code to explain it:
-```go
-// this struct definition will fail govalidator.ValidateStruct() (and the field values do not matter):
-type exampleStruct struct {
- Name string ``
- Email string `valid:"email"`
-}
-
-// this, however, will only fail when Email is empty or an invalid email address:
-type exampleStruct2 struct {
- Name string `valid:"-"`
- Email string `valid:"email"`
-}
-
-// lastly, this will only fail when Email is an invalid email address but not when it's empty:
-type exampleStruct2 struct {
- Name string `valid:"-"`
- Email string `valid:"email,optional"`
-}
-```
-
-#### Recent breaking changes (see [#123](https://github.com/asaskevich/govalidator/pull/123))
-##### Custom validator function signature
-A context was added as the second parameter, for structs this is the object being validated – this makes dependent validation possible.
-```go
-import "github.com/asaskevich/govalidator"
-
-// old signature
-func(i interface{}) bool
-
-// new signature
-func(i interface{}, o interface{}) bool
-```
-
-##### Adding a custom validator
-This was changed to prevent data races when accessing custom validators.
-```go
-import "github.com/asaskevich/govalidator"
-
-// before
-govalidator.CustomTypeTagMap["customByteArrayValidator"] = func(i interface{}, o interface{}) bool {
- // ...
-}
-
-// after
-govalidator.CustomTypeTagMap.Set("customByteArrayValidator", func(i interface{}, o interface{}) bool {
- // ...
-})
-```
-
-#### List of functions:
-```go
-func Abs(value float64) float64
-func BlackList(str, chars string) string
-func ByteLength(str string, params ...string) bool
-func CamelCaseToUnderscore(str string) string
-func Contains(str, substring string) bool
-func Count(array []interface{}, iterator ConditionIterator) int
-func Each(array []interface{}, iterator Iterator)
-func ErrorByField(e error, field string) string
-func ErrorsByField(e error) map[string]string
-func Filter(array []interface{}, iterator ConditionIterator) []interface{}
-func Find(array []interface{}, iterator ConditionIterator) interface{}
-func GetLine(s string, index int) (string, error)
-func GetLines(s string) []string
-func HasLowerCase(str string) bool
-func HasUpperCase(str string) bool
-func HasWhitespace(str string) bool
-func HasWhitespaceOnly(str string) bool
-func InRange(value interface{}, left interface{}, right interface{}) bool
-func InRangeFloat32(value, left, right float32) bool
-func InRangeFloat64(value, left, right float64) bool
-func InRangeInt(value, left, right interface{}) bool
-func IsASCII(str string) bool
-func IsAlpha(str string) bool
-func IsAlphanumeric(str string) bool
-func IsBase64(str string) bool
-func IsByteLength(str string, min, max int) bool
-func IsCIDR(str string) bool
-func IsCRC32(str string) bool
-func IsCRC32b(str string) bool
-func IsCreditCard(str string) bool
-func IsDNSName(str string) bool
-func IsDataURI(str string) bool
-func IsDialString(str string) bool
-func IsDivisibleBy(str, num string) bool
-func IsEmail(str string) bool
-func IsExistingEmail(email string) bool
-func IsFilePath(str string) (bool, int)
-func IsFloat(str string) bool
-func IsFullWidth(str string) bool
-func IsHalfWidth(str string) bool
-func IsHash(str string, algorithm string) bool
-func IsHexadecimal(str string) bool
-func IsHexcolor(str string) bool
-func IsHost(str string) bool
-func IsIP(str string) bool
-func IsIPv4(str string) bool
-func IsIPv6(str string) bool
-func IsISBN(str string, version int) bool
-func IsISBN10(str string) bool
-func IsISBN13(str string) bool
-func IsISO3166Alpha2(str string) bool
-func IsISO3166Alpha3(str string) bool
-func IsISO4217(str string) bool
-func IsISO693Alpha2(str string) bool
-func IsISO693Alpha3b(str string) bool
-func IsIn(str string, params ...string) bool
-func IsInRaw(str string, params ...string) bool
-func IsInt(str string) bool
-func IsJSON(str string) bool
-func IsLatitude(str string) bool
-func IsLongitude(str string) bool
-func IsLowerCase(str string) bool
-func IsMAC(str string) bool
-func IsMD4(str string) bool
-func IsMD5(str string) bool
-func IsMagnetURI(str string) bool
-func IsMongoID(str string) bool
-func IsMultibyte(str string) bool
-func IsNatural(value float64) bool
-func IsNegative(value float64) bool
-func IsNonNegative(value float64) bool
-func IsNonPositive(value float64) bool
-func IsNotNull(str string) bool
-func IsNull(str string) bool
-func IsNumeric(str string) bool
-func IsPort(str string) bool
-func IsPositive(value float64) bool
-func IsPrintableASCII(str string) bool
-func IsRFC3339(str string) bool
-func IsRFC3339WithoutZone(str string) bool
-func IsRGBcolor(str string) bool
-func IsRegex(str string) bool
-func IsRequestURI(rawurl string) bool
-func IsRequestURL(rawurl string) bool
-func IsRipeMD128(str string) bool
-func IsRipeMD160(str string) bool
-func IsRsaPub(str string, params ...string) bool
-func IsRsaPublicKey(str string, keylen int) bool
-func IsSHA1(str string) bool
-func IsSHA256(str string) bool
-func IsSHA384(str string) bool
-func IsSHA512(str string) bool
-func IsSSN(str string) bool
-func IsSemver(str string) bool
-func IsTiger128(str string) bool
-func IsTiger160(str string) bool
-func IsTiger192(str string) bool
-func IsTime(str string, format string) bool
-func IsType(v interface{}, params ...string) bool
-func IsURL(str string) bool
-func IsUTFDigit(str string) bool
-func IsUTFLetter(str string) bool
-func IsUTFLetterNumeric(str string) bool
-func IsUTFNumeric(str string) bool
-func IsUUID(str string) bool
-func IsUUIDv3(str string) bool
-func IsUUIDv4(str string) bool
-func IsUUIDv5(str string) bool
-func IsULID(str string) bool
-func IsUnixTime(str string) bool
-func IsUpperCase(str string) bool
-func IsVariableWidth(str string) bool
-func IsWhole(value float64) bool
-func LeftTrim(str, chars string) string
-func Map(array []interface{}, iterator ResultIterator) []interface{}
-func Matches(str, pattern string) bool
-func MaxStringLength(str string, params ...string) bool
-func MinStringLength(str string, params ...string) bool
-func NormalizeEmail(str string) (string, error)
-func PadBoth(str string, padStr string, padLen int) string
-func PadLeft(str string, padStr string, padLen int) string
-func PadRight(str string, padStr string, padLen int) string
-func PrependPathToErrors(err error, path string) error
-func Range(str string, params ...string) bool
-func RemoveTags(s string) string
-func ReplacePattern(str, pattern, replace string) string
-func Reverse(s string) string
-func RightTrim(str, chars string) string
-func RuneLength(str string, params ...string) bool
-func SafeFileName(str string) string
-func SetFieldsRequiredByDefault(value bool)
-func SetNilPtrAllowedByRequired(value bool)
-func Sign(value float64) float64
-func StringLength(str string, params ...string) bool
-func StringMatches(s string, params ...string) bool
-func StripLow(str string, keepNewLines bool) string
-func ToBoolean(str string) (bool, error)
-func ToFloat(str string) (float64, error)
-func ToInt(value interface{}) (res int64, err error)
-func ToJSON(obj interface{}) (string, error)
-func ToString(obj interface{}) string
-func Trim(str, chars string) string
-func Truncate(str string, length int, ending string) string
-func TruncatingErrorf(str string, args ...interface{}) error
-func UnderscoreToCamelCase(s string) string
-func ValidateMap(inputMap map[string]interface{}, validationMap map[string]interface{}) (bool, error)
-func ValidateStruct(s interface{}) (bool, error)
-func WhiteList(str, chars string) string
-type ConditionIterator
-type CustomTypeValidator
-type Error
-func (e Error) Error() string
-type Errors
-func (es Errors) Error() string
-func (es Errors) Errors() []error
-type ISO3166Entry
-type ISO693Entry
-type InterfaceParamValidator
-type Iterator
-type ParamValidator
-type ResultIterator
-type UnsupportedTypeError
-func (e *UnsupportedTypeError) Error() string
-type Validator
-```
-
-#### Examples
-###### IsURL
-```go
-println(govalidator.IsURL(`http://user@pass:domain.com/path/page`))
-```
-###### IsType
-```go
-println(govalidator.IsType("Bob", "string"))
-println(govalidator.IsType(1, "int"))
-i := 1
-println(govalidator.IsType(&i, "*int"))
-```
-
-IsType can be used through the tag `type` which is essential for map validation:
-```go
-type User struct {
- Name string `valid:"type(string)"`
- Age int `valid:"type(int)"`
- Meta interface{} `valid:"type(string)"`
-}
-result, err := govalidator.ValidateStruct(User{"Bob", 20, "meta"})
-if err != nil {
- println("error: " + err.Error())
-}
-println(result)
-```
-###### ToString
-```go
-type User struct {
- FirstName string
- LastName string
-}
-
-str := govalidator.ToString(&User{"John", "Juan"})
-println(str)
-```
-###### Each, Map, Filter, Count for slices
-Each iterates over the slice/array and calls Iterator for every item
-```go
-data := []interface{}{1, 2, 3, 4, 5}
-var fn govalidator.Iterator = func(value interface{}, index int) {
- println(value.(int))
-}
-govalidator.Each(data, fn)
-```
-```go
-data := []interface{}{1, 2, 3, 4, 5}
-var fn govalidator.ResultIterator = func(value interface{}, index int) interface{} {
- return value.(int) * 3
-}
-_ = govalidator.Map(data, fn) // result = []interface{}{1, 6, 9, 12, 15}
-```
-```go
-data := []interface{}{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
-var fn govalidator.ConditionIterator = func(value interface{}, index int) bool {
- return value.(int)%2 == 0
-}
-_ = govalidator.Filter(data, fn) // result = []interface{}{2, 4, 6, 8, 10}
-_ = govalidator.Count(data, fn) // result = 5
-```
-###### ValidateStruct [#2](https://github.com/asaskevich/govalidator/pull/2)
-If you want to validate structs, you can use tag `valid` for any field in your structure. All validators used with this field in one tag are separated by comma. If you want to skip validation, place `-` in your tag. If you need a validator that is not on the list below, you can add it like this:
-```go
-govalidator.TagMap["duck"] = govalidator.Validator(func(str string) bool {
- return str == "duck"
-})
-```
-For completely custom validators (interface-based), see below.
-
-Here is a list of available validators for struct fields (validator - used function):
-```go
-"email": IsEmail,
-"url": IsURL,
-"dialstring": IsDialString,
-"requrl": IsRequestURL,
-"requri": IsRequestURI,
-"alpha": IsAlpha,
-"utfletter": IsUTFLetter,
-"alphanum": IsAlphanumeric,
-"utfletternum": IsUTFLetterNumeric,
-"numeric": IsNumeric,
-"utfnumeric": IsUTFNumeric,
-"utfdigit": IsUTFDigit,
-"hexadecimal": IsHexadecimal,
-"hexcolor": IsHexcolor,
-"rgbcolor": IsRGBcolor,
-"lowercase": IsLowerCase,
-"uppercase": IsUpperCase,
-"int": IsInt,
-"float": IsFloat,
-"null": IsNull,
-"uuid": IsUUID,
-"uuidv3": IsUUIDv3,
-"uuidv4": IsUUIDv4,
-"uuidv5": IsUUIDv5,
-"creditcard": IsCreditCard,
-"isbn10": IsISBN10,
-"isbn13": IsISBN13,
-"json": IsJSON,
-"multibyte": IsMultibyte,
-"ascii": IsASCII,
-"printableascii": IsPrintableASCII,
-"fullwidth": IsFullWidth,
-"halfwidth": IsHalfWidth,
-"variablewidth": IsVariableWidth,
-"base64": IsBase64,
-"datauri": IsDataURI,
-"ip": IsIP,
-"port": IsPort,
-"ipv4": IsIPv4,
-"ipv6": IsIPv6,
-"dns": IsDNSName,
-"host": IsHost,
-"mac": IsMAC,
-"latitude": IsLatitude,
-"longitude": IsLongitude,
-"ssn": IsSSN,
-"semver": IsSemver,
-"rfc3339": IsRFC3339,
-"rfc3339WithoutZone": IsRFC3339WithoutZone,
-"ISO3166Alpha2": IsISO3166Alpha2,
-"ISO3166Alpha3": IsISO3166Alpha3,
-"ulid": IsULID,
-```
-Validators with parameters
-
-```go
-"range(min|max)": Range,
-"length(min|max)": ByteLength,
-"runelength(min|max)": RuneLength,
-"stringlength(min|max)": StringLength,
-"matches(pattern)": StringMatches,
-"in(string1|string2|...|stringN)": IsIn,
-"rsapub(keylength)" : IsRsaPub,
-"minstringlength(int): MinStringLength,
-"maxstringlength(int): MaxStringLength,
-```
-Validators with parameters for any type
-
-```go
-"type(type)": IsType,
-```
-
-And here is small example of usage:
-```go
-type Post struct {
- Title string `valid:"alphanum,required"`
- Message string `valid:"duck,ascii"`
- Message2 string `valid:"animal(dog)"`
- AuthorIP string `valid:"ipv4"`
- Date string `valid:"-"`
-}
-post := &Post{
- Title: "My Example Post",
- Message: "duck",
- Message2: "dog",
- AuthorIP: "123.234.54.3",
-}
-
-// Add your own struct validation tags
-govalidator.TagMap["duck"] = govalidator.Validator(func(str string) bool {
- return str == "duck"
-})
-
-// Add your own struct validation tags with parameter
-govalidator.ParamTagMap["animal"] = govalidator.ParamValidator(func(str string, params ...string) bool {
- species := params[0]
- return str == species
-})
-govalidator.ParamTagRegexMap["animal"] = regexp.MustCompile("^animal\\((\\w+)\\)$")
-
-result, err := govalidator.ValidateStruct(post)
-if err != nil {
- println("error: " + err.Error())
-}
-println(result)
-```
-###### ValidateMap [#2](https://github.com/asaskevich/govalidator/pull/338)
-If you want to validate maps, you can use the map to be validated and a validation map that contain the same tags used in ValidateStruct, both maps have to be in the form `map[string]interface{}`
-
-So here is small example of usage:
-```go
-var mapTemplate = map[string]interface{}{
- "name":"required,alpha",
- "family":"required,alpha",
- "email":"required,email",
- "cell-phone":"numeric",
- "address":map[string]interface{}{
- "line1":"required,alphanum",
- "line2":"alphanum",
- "postal-code":"numeric",
- },
-}
-
-var inputMap = map[string]interface{}{
- "name":"Bob",
- "family":"Smith",
- "email":"foo@bar.baz",
- "address":map[string]interface{}{
- "line1":"",
- "line2":"",
- "postal-code":"",
- },
-}
-
-result, err := govalidator.ValidateMap(inputMap, mapTemplate)
-if err != nil {
- println("error: " + err.Error())
-}
-println(result)
-```
-
-###### WhiteList
-```go
-// Remove all characters from string ignoring characters between "a" and "z"
-println(govalidator.WhiteList("a3a43a5a4a3a2a23a4a5a4a3a4", "a-z") == "aaaaaaaaaaaa")
-```
-
-###### Custom validation functions
-Custom validation using your own domain specific validators is also available - here's an example of how to use it:
-```go
-import "github.com/asaskevich/govalidator"
-
-type CustomByteArray [6]byte // custom types are supported and can be validated
-
-type StructWithCustomByteArray struct {
- ID CustomByteArray `valid:"customByteArrayValidator,customMinLengthValidator"` // multiple custom validators are possible as well and will be evaluated in sequence
- Email string `valid:"email"`
- CustomMinLength int `valid:"-"`
-}
-
-govalidator.CustomTypeTagMap.Set("customByteArrayValidator", func(i interface{}, context interface{}) bool {
- switch v := context.(type) { // you can type switch on the context interface being validated
- case StructWithCustomByteArray:
- // you can check and validate against some other field in the context,
- // return early or not validate against the context at all – your choice
- case SomeOtherType:
- // ...
- default:
- // expecting some other type? Throw/panic here or continue
- }
-
- switch v := i.(type) { // type switch on the struct field being validated
- case CustomByteArray:
- for _, e := range v { // this validator checks that the byte array is not empty, i.e. not all zeroes
- if e != 0 {
- return true
- }
- }
- }
- return false
-})
-govalidator.CustomTypeTagMap.Set("customMinLengthValidator", func(i interface{}, context interface{}) bool {
- switch v := context.(type) { // this validates a field against the value in another field, i.e. dependent validation
- case StructWithCustomByteArray:
- return len(v.ID) >= v.CustomMinLength
- }
- return false
-})
-```
-
-###### Loop over Error()
-By default .Error() returns all errors in a single String. To access each error you can do this:
-```go
- if err != nil {
- errs := err.(govalidator.Errors).Errors()
- for _, e := range errs {
- fmt.Println(e.Error())
- }
- }
-```
-
-###### Custom error messages
-Custom error messages are supported via annotations by adding the `~` separator - here's an example of how to use it:
-```go
-type Ticket struct {
- Id int64 `json:"id"`
- FirstName string `json:"firstname" valid:"required~First name is blank"`
-}
-```
-
-#### Notes
-Documentation is available here: [godoc.org](https://godoc.org/github.com/asaskevich/govalidator).
-Full information about code coverage is also available here: [govalidator on gocover.io](http://gocover.io/github.com/asaskevich/govalidator).
-
-#### Support
-If you do have a contribution to the package, feel free to create a Pull Request or an Issue.
-
-#### What to contribute
-If you don't know what to do, there are some features and functions that need to be done
-
-- [ ] Refactor code
-- [ ] Edit docs and [README](https://github.com/asaskevich/govalidator/README.md): spellcheck, grammar and typo check
-- [ ] Create actual list of contributors and projects that currently using this package
-- [ ] Resolve [issues and bugs](https://github.com/asaskevich/govalidator/issues)
-- [ ] Update actual [list of functions](https://github.com/asaskevich/govalidator#list-of-functions)
-- [ ] Update [list of validators](https://github.com/asaskevich/govalidator#validatestruct-2) that available for `ValidateStruct` and add new
-- [ ] Implement new validators: `IsFQDN`, `IsIMEI`, `IsPostalCode`, `IsISIN`, `IsISRC` etc
-- [x] Implement [validation by maps](https://github.com/asaskevich/govalidator/issues/224)
-- [ ] Implement fuzzing testing
-- [ ] Implement some struct/map/array utilities
-- [ ] Implement map/array validation
-- [ ] Implement benchmarking
-- [ ] Implement batch of examples
-- [ ] Look at forks for new features and fixes
-
-#### Advice
-Feel free to create what you want, but keep in mind when you implement new features:
-- Code must be clear and readable, names of variables/constants clearly describes what they are doing
-- Public functions must be documented and described in source file and added to README.md to the list of available functions
-- There are must be unit-tests for any new functions and improvements
-
-## Credits
-### Contributors
-
-This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
-
-#### Special thanks to [contributors](https://github.com/asaskevich/govalidator/graphs/contributors)
-* [Daniel Lohse](https://github.com/annismckenzie)
-* [Attila Oláh](https://github.com/attilaolah)
-* [Daniel Korner](https://github.com/Dadie)
-* [Steven Wilkin](https://github.com/stevenwilkin)
-* [Deiwin Sarjas](https://github.com/deiwin)
-* [Noah Shibley](https://github.com/slugmobile)
-* [Nathan Davies](https://github.com/nathj07)
-* [Matt Sanford](https://github.com/mzsanford)
-* [Simon ccl1115](https://github.com/ccl1115)
-
-
-
-
-### Backers
-
-Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/govalidator#backer)]
-
-
-
-
-### Sponsors
-
-Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/govalidator#sponsor)]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-## License
-[](https://app.fossa.io/projects/git%2Bgithub.com%2Fasaskevich%2Fgovalidator?ref=badge_large)
diff --git a/vendor/github.com/asaskevich/govalidator/arrays.go b/vendor/github.com/asaskevich/govalidator/arrays.go
deleted file mode 100644
index 3e1da7cb480..00000000000
--- a/vendor/github.com/asaskevich/govalidator/arrays.go
+++ /dev/null
@@ -1,87 +0,0 @@
-package govalidator
-
-// Iterator is the function that accepts element of slice/array and its index
-type Iterator func(interface{}, int)
-
-// ResultIterator is the function that accepts element of slice/array and its index and returns any result
-type ResultIterator func(interface{}, int) interface{}
-
-// ConditionIterator is the function that accepts element of slice/array and its index and returns boolean
-type ConditionIterator func(interface{}, int) bool
-
-// ReduceIterator is the function that accepts two element of slice/array and returns result of merging those values
-type ReduceIterator func(interface{}, interface{}) interface{}
-
-// Some validates that any item of array corresponds to ConditionIterator. Returns boolean.
-func Some(array []interface{}, iterator ConditionIterator) bool {
- res := false
- for index, data := range array {
- res = res || iterator(data, index)
- }
- return res
-}
-
-// Every validates that every item of array corresponds to ConditionIterator. Returns boolean.
-func Every(array []interface{}, iterator ConditionIterator) bool {
- res := true
- for index, data := range array {
- res = res && iterator(data, index)
- }
- return res
-}
-
-// Reduce boils down a list of values into a single value by ReduceIterator
-func Reduce(array []interface{}, iterator ReduceIterator, initialValue interface{}) interface{} {
- for _, data := range array {
- initialValue = iterator(initialValue, data)
- }
- return initialValue
-}
-
-// Each iterates over the slice and apply Iterator to every item
-func Each(array []interface{}, iterator Iterator) {
- for index, data := range array {
- iterator(data, index)
- }
-}
-
-// Map iterates over the slice and apply ResultIterator to every item. Returns new slice as a result.
-func Map(array []interface{}, iterator ResultIterator) []interface{} {
- var result = make([]interface{}, len(array))
- for index, data := range array {
- result[index] = iterator(data, index)
- }
- return result
-}
-
-// Find iterates over the slice and apply ConditionIterator to every item. Returns first item that meet ConditionIterator or nil otherwise.
-func Find(array []interface{}, iterator ConditionIterator) interface{} {
- for index, data := range array {
- if iterator(data, index) {
- return data
- }
- }
- return nil
-}
-
-// Filter iterates over the slice and apply ConditionIterator to every item. Returns new slice.
-func Filter(array []interface{}, iterator ConditionIterator) []interface{} {
- var result = make([]interface{}, 0)
- for index, data := range array {
- if iterator(data, index) {
- result = append(result, data)
- }
- }
- return result
-}
-
-// Count iterates over the slice and apply ConditionIterator to every item. Returns count of items that meets ConditionIterator.
-func Count(array []interface{}, iterator ConditionIterator) int {
- count := 0
- for index, data := range array {
- if iterator(data, index) {
- count = count + 1
- }
- }
- return count
-}
diff --git a/vendor/github.com/asaskevich/govalidator/converter.go b/vendor/github.com/asaskevich/govalidator/converter.go
deleted file mode 100644
index d68e990fc25..00000000000
--- a/vendor/github.com/asaskevich/govalidator/converter.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package govalidator
-
-import (
- "encoding/json"
- "fmt"
- "reflect"
- "strconv"
-)
-
-// ToString convert the input to a string.
-func ToString(obj interface{}) string {
- res := fmt.Sprintf("%v", obj)
- return res
-}
-
-// ToJSON convert the input to a valid JSON string
-func ToJSON(obj interface{}) (string, error) {
- res, err := json.Marshal(obj)
- if err != nil {
- res = []byte("")
- }
- return string(res), err
-}
-
-// ToFloat convert the input string to a float, or 0.0 if the input is not a float.
-func ToFloat(value interface{}) (res float64, err error) {
- val := reflect.ValueOf(value)
-
- switch value.(type) {
- case int, int8, int16, int32, int64:
- res = float64(val.Int())
- case uint, uint8, uint16, uint32, uint64:
- res = float64(val.Uint())
- case float32, float64:
- res = val.Float()
- case string:
- res, err = strconv.ParseFloat(val.String(), 64)
- if err != nil {
- res = 0
- }
- default:
- err = fmt.Errorf("ToInt: unknown interface type %T", value)
- res = 0
- }
-
- return
-}
-
-// ToInt convert the input string or any int type to an integer type 64, or 0 if the input is not an integer.
-func ToInt(value interface{}) (res int64, err error) {
- val := reflect.ValueOf(value)
-
- switch value.(type) {
- case int, int8, int16, int32, int64:
- res = val.Int()
- case uint, uint8, uint16, uint32, uint64:
- res = int64(val.Uint())
- case float32, float64:
- res = int64(val.Float())
- case string:
- if IsInt(val.String()) {
- res, err = strconv.ParseInt(val.String(), 0, 64)
- if err != nil {
- res = 0
- }
- } else {
- err = fmt.Errorf("ToInt: invalid numeric format %g", value)
- res = 0
- }
- default:
- err = fmt.Errorf("ToInt: unknown interface type %T", value)
- res = 0
- }
-
- return
-}
-
-// ToBoolean convert the input string to a boolean.
-func ToBoolean(str string) (bool, error) {
- return strconv.ParseBool(str)
-}
diff --git a/vendor/github.com/asaskevich/govalidator/doc.go b/vendor/github.com/asaskevich/govalidator/doc.go
deleted file mode 100644
index 55dce62dc8c..00000000000
--- a/vendor/github.com/asaskevich/govalidator/doc.go
+++ /dev/null
@@ -1,3 +0,0 @@
-package govalidator
-
-// A package of validators and sanitizers for strings, structures and collections.
diff --git a/vendor/github.com/asaskevich/govalidator/error.go b/vendor/github.com/asaskevich/govalidator/error.go
deleted file mode 100644
index 1da2336f47e..00000000000
--- a/vendor/github.com/asaskevich/govalidator/error.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package govalidator
-
-import (
- "sort"
- "strings"
-)
-
-// Errors is an array of multiple errors and conforms to the error interface.
-type Errors []error
-
-// Errors returns itself.
-func (es Errors) Errors() []error {
- return es
-}
-
-func (es Errors) Error() string {
- var errs []string
- for _, e := range es {
- errs = append(errs, e.Error())
- }
- sort.Strings(errs)
- return strings.Join(errs, ";")
-}
-
-// Error encapsulates a name, an error and whether there's a custom error message or not.
-type Error struct {
- Name string
- Err error
- CustomErrorMessageExists bool
-
- // Validator indicates the name of the validator that failed
- Validator string
- Path []string
-}
-
-func (e Error) Error() string {
- if e.CustomErrorMessageExists {
- return e.Err.Error()
- }
-
- errName := e.Name
- if len(e.Path) > 0 {
- errName = strings.Join(append(e.Path, e.Name), ".")
- }
-
- return errName + ": " + e.Err.Error()
-}
diff --git a/vendor/github.com/asaskevich/govalidator/numerics.go b/vendor/github.com/asaskevich/govalidator/numerics.go
deleted file mode 100644
index 5041d9e8684..00000000000
--- a/vendor/github.com/asaskevich/govalidator/numerics.go
+++ /dev/null
@@ -1,100 +0,0 @@
-package govalidator
-
-import (
- "math"
-)
-
-// Abs returns absolute value of number
-func Abs(value float64) float64 {
- return math.Abs(value)
-}
-
-// Sign returns signum of number: 1 in case of value > 0, -1 in case of value < 0, 0 otherwise
-func Sign(value float64) float64 {
- if value > 0 {
- return 1
- } else if value < 0 {
- return -1
- } else {
- return 0
- }
-}
-
-// IsNegative returns true if value < 0
-func IsNegative(value float64) bool {
- return value < 0
-}
-
-// IsPositive returns true if value > 0
-func IsPositive(value float64) bool {
- return value > 0
-}
-
-// IsNonNegative returns true if value >= 0
-func IsNonNegative(value float64) bool {
- return value >= 0
-}
-
-// IsNonPositive returns true if value <= 0
-func IsNonPositive(value float64) bool {
- return value <= 0
-}
-
-// InRangeInt returns true if value lies between left and right border
-func InRangeInt(value, left, right interface{}) bool {
- value64, _ := ToInt(value)
- left64, _ := ToInt(left)
- right64, _ := ToInt(right)
- if left64 > right64 {
- left64, right64 = right64, left64
- }
- return value64 >= left64 && value64 <= right64
-}
-
-// InRangeFloat32 returns true if value lies between left and right border
-func InRangeFloat32(value, left, right float32) bool {
- if left > right {
- left, right = right, left
- }
- return value >= left && value <= right
-}
-
-// InRangeFloat64 returns true if value lies between left and right border
-func InRangeFloat64(value, left, right float64) bool {
- if left > right {
- left, right = right, left
- }
- return value >= left && value <= right
-}
-
-// InRange returns true if value lies between left and right border, generic type to handle int, float32, float64 and string.
-// All types must the same type.
-// False if value doesn't lie in range or if it incompatible or not comparable
-func InRange(value interface{}, left interface{}, right interface{}) bool {
- switch value.(type) {
- case int:
- intValue, _ := ToInt(value)
- intLeft, _ := ToInt(left)
- intRight, _ := ToInt(right)
- return InRangeInt(intValue, intLeft, intRight)
- case float32, float64:
- intValue, _ := ToFloat(value)
- intLeft, _ := ToFloat(left)
- intRight, _ := ToFloat(right)
- return InRangeFloat64(intValue, intLeft, intRight)
- case string:
- return value.(string) >= left.(string) && value.(string) <= right.(string)
- default:
- return false
- }
-}
-
-// IsWhole returns true if value is whole number
-func IsWhole(value float64) bool {
- return math.Remainder(value, 1) == 0
-}
-
-// IsNatural returns true if value is natural number (positive and whole)
-func IsNatural(value float64) bool {
- return IsWhole(value) && IsPositive(value)
-}
diff --git a/vendor/github.com/asaskevich/govalidator/patterns.go b/vendor/github.com/asaskevich/govalidator/patterns.go
deleted file mode 100644
index bafc3765ea1..00000000000
--- a/vendor/github.com/asaskevich/govalidator/patterns.go
+++ /dev/null
@@ -1,113 +0,0 @@
-package govalidator
-
-import "regexp"
-
-// Basic regular expressions for validating strings
-const (
- Email string = "^(((([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+(\\.([a-zA-Z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|\\.|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|\\d|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.)+(([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])|(([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])([a-zA-Z]|\\d|-|_|~|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])*([a-zA-Z]|[\\x{00A0}-\\x{D7FF}\\x{F900}-\\x{FDCF}\\x{FDF0}-\\x{FFEF}])))\\.?$"
- CreditCard string = "^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11}|6[27][0-9]{14})$"
- ISBN10 string = "^(?:[0-9]{9}X|[0-9]{10})$"
- ISBN13 string = "^(?:[0-9]{13})$"
- UUID3 string = "^[0-9a-f]{8}-[0-9a-f]{4}-3[0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$"
- UUID4 string = "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
- UUID5 string = "^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
- UUID string = "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
- Alpha string = "^[a-zA-Z]+$"
- Alphanumeric string = "^[a-zA-Z0-9]+$"
- Numeric string = "^[0-9]+$"
- Int string = "^(?:[-+]?(?:0|[1-9][0-9]*))$"
- Float string = "^(?:[-+]?(?:[0-9]+))?(?:\\.[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$"
- Hexadecimal string = "^[0-9a-fA-F]+$"
- Hexcolor string = "^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
- RGBcolor string = "^rgb\\(\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*\\)$"
- ASCII string = "^[\x00-\x7F]+$"
- Multibyte string = "[^\x00-\x7F]"
- FullWidth string = "[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]"
- HalfWidth string = "[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]"
- Base64 string = "^(?:[A-Za-z0-9+\\/]{4})*(?:[A-Za-z0-9+\\/]{2}==|[A-Za-z0-9+\\/]{3}=|[A-Za-z0-9+\\/]{4})$"
- PrintableASCII string = "^[\x20-\x7E]+$"
- DataURI string = "^data:.+\\/(.+);base64$"
- MagnetURI string = "^magnet:\\?xt=urn:[a-zA-Z0-9]+:[a-zA-Z0-9]{32,40}&dn=.+&tr=.+$"
- Latitude string = "^[-+]?([1-8]?\\d(\\.\\d+)?|90(\\.0+)?)$"
- Longitude string = "^[-+]?(180(\\.0+)?|((1[0-7]\\d)|([1-9]?\\d))(\\.\\d+)?)$"
- DNSName string = `^([a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62}){1}(\.[a-zA-Z0-9_]{1}[a-zA-Z0-9_-]{0,62})*[\._]?$`
- IP string = `(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))`
- URLSchema string = `((ftp|tcp|udp|wss?|https?):\/\/)`
- URLUsername string = `(\S+(:\S*)?@)`
- URLPath string = `((\/|\?|#)[^\s]*)`
- URLPort string = `(:(\d{1,5}))`
- URLIP string = `([1-9]\d?|1\d\d|2[01]\d|22[0-3]|24\d|25[0-5])(\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])){2}(?:\.([0-9]\d?|1\d\d|2[0-4]\d|25[0-5]))`
- URLSubdomain string = `((www\.)|([a-zA-Z0-9]+([-_\.]?[a-zA-Z0-9])*[a-zA-Z0-9]\.[a-zA-Z0-9]+))`
- URL = `^` + URLSchema + `?` + URLUsername + `?` + `((` + URLIP + `|(\[` + IP + `\])|(([a-zA-Z0-9]([a-zA-Z0-9-_]+)?[a-zA-Z0-9]([-\.][a-zA-Z0-9]+)*)|(` + URLSubdomain + `?))?(([a-zA-Z\x{00a1}-\x{ffff}0-9]+-?-?)*[a-zA-Z\x{00a1}-\x{ffff}0-9]+)(?:\.([a-zA-Z\x{00a1}-\x{ffff}]{1,}))?))\.?` + URLPort + `?` + URLPath + `?$`
- SSN string = `^\d{3}[- ]?\d{2}[- ]?\d{4}$`
- WinPath string = `^[a-zA-Z]:\\(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]*$`
- UnixPath string = `^(/[^/\x00]*)+/?$`
- WinARPath string = `^(?:(?:[a-zA-Z]:|\\\\[a-z0-9_.$●-]+\\[a-z0-9_.$●-]+)\\|\\?[^\\/:*?"<>|\r\n]+\\?)(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]*$`
- UnixARPath string = `^((\.{0,2}/)?([^/\x00]*))+/?$`
- Semver string = "^v?(?: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-]+)*)?$"
- tagName string = "valid"
- hasLowerCase string = ".*[[:lower:]]"
- hasUpperCase string = ".*[[:upper:]]"
- hasWhitespace string = ".*[[:space:]]"
- hasWhitespaceOnly string = "^[[:space:]]+$"
- IMEI string = "^[0-9a-f]{14}$|^\\d{15}$|^\\d{18}$"
- IMSI string = "^\\d{14,15}$"
- E164 string = `^\+?[1-9]\d{1,14}$`
-)
-
-// Used by IsFilePath func
-const (
- // Unknown is unresolved OS type
- Unknown = iota
- // Win is Windows type
- Win
- // Unix is *nix OS types
- Unix
-)
-
-var (
- userRegexp = regexp.MustCompile("^[a-zA-Z0-9!#$%&'*+/=?^_`{|}~.-]+$")
- hostRegexp = regexp.MustCompile("^[^\\s]+\\.[^\\s]+$")
- userDotRegexp = regexp.MustCompile("(^[.]{1})|([.]{1}$)|([.]{2,})")
- rxEmail = regexp.MustCompile(Email)
- rxCreditCard = regexp.MustCompile(CreditCard)
- rxISBN10 = regexp.MustCompile(ISBN10)
- rxISBN13 = regexp.MustCompile(ISBN13)
- rxUUID3 = regexp.MustCompile(UUID3)
- rxUUID4 = regexp.MustCompile(UUID4)
- rxUUID5 = regexp.MustCompile(UUID5)
- rxUUID = regexp.MustCompile(UUID)
- rxAlpha = regexp.MustCompile(Alpha)
- rxAlphanumeric = regexp.MustCompile(Alphanumeric)
- rxNumeric = regexp.MustCompile(Numeric)
- rxInt = regexp.MustCompile(Int)
- rxFloat = regexp.MustCompile(Float)
- rxHexadecimal = regexp.MustCompile(Hexadecimal)
- rxHexcolor = regexp.MustCompile(Hexcolor)
- rxRGBcolor = regexp.MustCompile(RGBcolor)
- rxASCII = regexp.MustCompile(ASCII)
- rxPrintableASCII = regexp.MustCompile(PrintableASCII)
- rxMultibyte = regexp.MustCompile(Multibyte)
- rxFullWidth = regexp.MustCompile(FullWidth)
- rxHalfWidth = regexp.MustCompile(HalfWidth)
- rxBase64 = regexp.MustCompile(Base64)
- rxDataURI = regexp.MustCompile(DataURI)
- rxMagnetURI = regexp.MustCompile(MagnetURI)
- rxLatitude = regexp.MustCompile(Latitude)
- rxLongitude = regexp.MustCompile(Longitude)
- rxDNSName = regexp.MustCompile(DNSName)
- rxURL = regexp.MustCompile(URL)
- rxSSN = regexp.MustCompile(SSN)
- rxWinPath = regexp.MustCompile(WinPath)
- rxUnixPath = regexp.MustCompile(UnixPath)
- rxARWinPath = regexp.MustCompile(WinARPath)
- rxARUnixPath = regexp.MustCompile(UnixARPath)
- rxSemver = regexp.MustCompile(Semver)
- rxHasLowerCase = regexp.MustCompile(hasLowerCase)
- rxHasUpperCase = regexp.MustCompile(hasUpperCase)
- rxHasWhitespace = regexp.MustCompile(hasWhitespace)
- rxHasWhitespaceOnly = regexp.MustCompile(hasWhitespaceOnly)
- rxIMEI = regexp.MustCompile(IMEI)
- rxIMSI = regexp.MustCompile(IMSI)
- rxE164 = regexp.MustCompile(E164)
-)
diff --git a/vendor/github.com/asaskevich/govalidator/types.go b/vendor/github.com/asaskevich/govalidator/types.go
deleted file mode 100644
index c573abb51af..00000000000
--- a/vendor/github.com/asaskevich/govalidator/types.go
+++ /dev/null
@@ -1,656 +0,0 @@
-package govalidator
-
-import (
- "reflect"
- "regexp"
- "sort"
- "sync"
-)
-
-// Validator is a wrapper for a validator function that returns bool and accepts string.
-type Validator func(str string) bool
-
-// CustomTypeValidator is a wrapper for validator functions that returns bool and accepts any type.
-// The second parameter should be the context (in the case of validating a struct: the whole object being validated).
-type CustomTypeValidator func(i interface{}, o interface{}) bool
-
-// ParamValidator is a wrapper for validator functions that accept additional parameters.
-type ParamValidator func(str string, params ...string) bool
-
-// InterfaceParamValidator is a wrapper for functions that accept variants parameters for an interface value
-type InterfaceParamValidator func(in interface{}, params ...string) bool
-type tagOptionsMap map[string]tagOption
-
-func (t tagOptionsMap) orderedKeys() []string {
- var keys []string
- for k := range t {
- keys = append(keys, k)
- }
-
- sort.Slice(keys, func(a, b int) bool {
- return t[keys[a]].order < t[keys[b]].order
- })
-
- return keys
-}
-
-type tagOption struct {
- name string
- customErrorMessage string
- order int
-}
-
-// UnsupportedTypeError is a wrapper for reflect.Type
-type UnsupportedTypeError struct {
- Type reflect.Type
-}
-
-// stringValues is a slice of reflect.Value holding *reflect.StringValue.
-// It implements the methods to sort by string.
-type stringValues []reflect.Value
-
-// InterfaceParamTagMap is a map of functions accept variants parameters for an interface value
-var InterfaceParamTagMap = map[string]InterfaceParamValidator{
- "type": IsType,
-}
-
-// InterfaceParamTagRegexMap maps interface param tags to their respective regexes.
-var InterfaceParamTagRegexMap = map[string]*regexp.Regexp{
- "type": regexp.MustCompile(`^type\((.*)\)$`),
-}
-
-// ParamTagMap is a map of functions accept variants parameters
-var ParamTagMap = map[string]ParamValidator{
- "length": ByteLength,
- "range": Range,
- "runelength": RuneLength,
- "stringlength": StringLength,
- "matches": StringMatches,
- "in": IsInRaw,
- "rsapub": IsRsaPub,
- "minstringlength": MinStringLength,
- "maxstringlength": MaxStringLength,
-}
-
-// ParamTagRegexMap maps param tags to their respective regexes.
-var ParamTagRegexMap = map[string]*regexp.Regexp{
- "range": regexp.MustCompile("^range\\((\\d+)\\|(\\d+)\\)$"),
- "length": regexp.MustCompile("^length\\((\\d+)\\|(\\d+)\\)$"),
- "runelength": regexp.MustCompile("^runelength\\((\\d+)\\|(\\d+)\\)$"),
- "stringlength": regexp.MustCompile("^stringlength\\((\\d+)\\|(\\d+)\\)$"),
- "in": regexp.MustCompile(`^in\((.*)\)`),
- "matches": regexp.MustCompile(`^matches\((.+)\)$`),
- "rsapub": regexp.MustCompile("^rsapub\\((\\d+)\\)$"),
- "minstringlength": regexp.MustCompile("^minstringlength\\((\\d+)\\)$"),
- "maxstringlength": regexp.MustCompile("^maxstringlength\\((\\d+)\\)$"),
-}
-
-type customTypeTagMap struct {
- validators map[string]CustomTypeValidator
-
- sync.RWMutex
-}
-
-func (tm *customTypeTagMap) Get(name string) (CustomTypeValidator, bool) {
- tm.RLock()
- defer tm.RUnlock()
- v, ok := tm.validators[name]
- return v, ok
-}
-
-func (tm *customTypeTagMap) Set(name string, ctv CustomTypeValidator) {
- tm.Lock()
- defer tm.Unlock()
- tm.validators[name] = ctv
-}
-
-// CustomTypeTagMap is a map of functions that can be used as tags for ValidateStruct function.
-// Use this to validate compound or custom types that need to be handled as a whole, e.g.
-// `type UUID [16]byte` (this would be handled as an array of bytes).
-var CustomTypeTagMap = &customTypeTagMap{validators: make(map[string]CustomTypeValidator)}
-
-// TagMap is a map of functions, that can be used as tags for ValidateStruct function.
-var TagMap = map[string]Validator{
- "email": IsEmail,
- "url": IsURL,
- "dialstring": IsDialString,
- "requrl": IsRequestURL,
- "requri": IsRequestURI,
- "alpha": IsAlpha,
- "utfletter": IsUTFLetter,
- "alphanum": IsAlphanumeric,
- "utfletternum": IsUTFLetterNumeric,
- "numeric": IsNumeric,
- "utfnumeric": IsUTFNumeric,
- "utfdigit": IsUTFDigit,
- "hexadecimal": IsHexadecimal,
- "hexcolor": IsHexcolor,
- "rgbcolor": IsRGBcolor,
- "lowercase": IsLowerCase,
- "uppercase": IsUpperCase,
- "int": IsInt,
- "float": IsFloat,
- "null": IsNull,
- "notnull": IsNotNull,
- "uuid": IsUUID,
- "uuidv3": IsUUIDv3,
- "uuidv4": IsUUIDv4,
- "uuidv5": IsUUIDv5,
- "creditcard": IsCreditCard,
- "isbn10": IsISBN10,
- "isbn13": IsISBN13,
- "json": IsJSON,
- "multibyte": IsMultibyte,
- "ascii": IsASCII,
- "printableascii": IsPrintableASCII,
- "fullwidth": IsFullWidth,
- "halfwidth": IsHalfWidth,
- "variablewidth": IsVariableWidth,
- "base64": IsBase64,
- "datauri": IsDataURI,
- "ip": IsIP,
- "port": IsPort,
- "ipv4": IsIPv4,
- "ipv6": IsIPv6,
- "dns": IsDNSName,
- "host": IsHost,
- "mac": IsMAC,
- "latitude": IsLatitude,
- "longitude": IsLongitude,
- "ssn": IsSSN,
- "semver": IsSemver,
- "rfc3339": IsRFC3339,
- "rfc3339WithoutZone": IsRFC3339WithoutZone,
- "ISO3166Alpha2": IsISO3166Alpha2,
- "ISO3166Alpha3": IsISO3166Alpha3,
- "ISO4217": IsISO4217,
- "IMEI": IsIMEI,
- "ulid": IsULID,
-}
-
-// ISO3166Entry stores country codes
-type ISO3166Entry struct {
- EnglishShortName string
- FrenchShortName string
- Alpha2Code string
- Alpha3Code string
- Numeric string
-}
-
-//ISO3166List based on https://www.iso.org/obp/ui/#search/code/ Code Type "Officially Assigned Codes"
-var ISO3166List = []ISO3166Entry{
- {"Afghanistan", "Afghanistan (l')", "AF", "AFG", "004"},
- {"Albania", "Albanie (l')", "AL", "ALB", "008"},
- {"Antarctica", "Antarctique (l')", "AQ", "ATA", "010"},
- {"Algeria", "Algérie (l')", "DZ", "DZA", "012"},
- {"American Samoa", "Samoa américaines (les)", "AS", "ASM", "016"},
- {"Andorra", "Andorre (l')", "AD", "AND", "020"},
- {"Angola", "Angola (l')", "AO", "AGO", "024"},
- {"Antigua and Barbuda", "Antigua-et-Barbuda", "AG", "ATG", "028"},
- {"Azerbaijan", "Azerbaïdjan (l')", "AZ", "AZE", "031"},
- {"Argentina", "Argentine (l')", "AR", "ARG", "032"},
- {"Australia", "Australie (l')", "AU", "AUS", "036"},
- {"Austria", "Autriche (l')", "AT", "AUT", "040"},
- {"Bahamas (the)", "Bahamas (les)", "BS", "BHS", "044"},
- {"Bahrain", "Bahreïn", "BH", "BHR", "048"},
- {"Bangladesh", "Bangladesh (le)", "BD", "BGD", "050"},
- {"Armenia", "Arménie (l')", "AM", "ARM", "051"},
- {"Barbados", "Barbade (la)", "BB", "BRB", "052"},
- {"Belgium", "Belgique (la)", "BE", "BEL", "056"},
- {"Bermuda", "Bermudes (les)", "BM", "BMU", "060"},
- {"Bhutan", "Bhoutan (le)", "BT", "BTN", "064"},
- {"Bolivia (Plurinational State of)", "Bolivie (État plurinational de)", "BO", "BOL", "068"},
- {"Bosnia and Herzegovina", "Bosnie-Herzégovine (la)", "BA", "BIH", "070"},
- {"Botswana", "Botswana (le)", "BW", "BWA", "072"},
- {"Bouvet Island", "Bouvet (l'Île)", "BV", "BVT", "074"},
- {"Brazil", "Brésil (le)", "BR", "BRA", "076"},
- {"Belize", "Belize (le)", "BZ", "BLZ", "084"},
- {"British Indian Ocean Territory (the)", "Indien (le Territoire britannique de l'océan)", "IO", "IOT", "086"},
- {"Solomon Islands", "Salomon (Îles)", "SB", "SLB", "090"},
- {"Virgin Islands (British)", "Vierges britanniques (les Îles)", "VG", "VGB", "092"},
- {"Brunei Darussalam", "Brunéi Darussalam (le)", "BN", "BRN", "096"},
- {"Bulgaria", "Bulgarie (la)", "BG", "BGR", "100"},
- {"Myanmar", "Myanmar (le)", "MM", "MMR", "104"},
- {"Burundi", "Burundi (le)", "BI", "BDI", "108"},
- {"Belarus", "Bélarus (le)", "BY", "BLR", "112"},
- {"Cambodia", "Cambodge (le)", "KH", "KHM", "116"},
- {"Cameroon", "Cameroun (le)", "CM", "CMR", "120"},
- {"Canada", "Canada (le)", "CA", "CAN", "124"},
- {"Cabo Verde", "Cabo Verde", "CV", "CPV", "132"},
- {"Cayman Islands (the)", "Caïmans (les Îles)", "KY", "CYM", "136"},
- {"Central African Republic (the)", "République centrafricaine (la)", "CF", "CAF", "140"},
- {"Sri Lanka", "Sri Lanka", "LK", "LKA", "144"},
- {"Chad", "Tchad (le)", "TD", "TCD", "148"},
- {"Chile", "Chili (le)", "CL", "CHL", "152"},
- {"China", "Chine (la)", "CN", "CHN", "156"},
- {"Taiwan (Province of China)", "Taïwan (Province de Chine)", "TW", "TWN", "158"},
- {"Christmas Island", "Christmas (l'Île)", "CX", "CXR", "162"},
- {"Cocos (Keeling) Islands (the)", "Cocos (les Îles)/ Keeling (les Îles)", "CC", "CCK", "166"},
- {"Colombia", "Colombie (la)", "CO", "COL", "170"},
- {"Comoros (the)", "Comores (les)", "KM", "COM", "174"},
- {"Mayotte", "Mayotte", "YT", "MYT", "175"},
- {"Congo (the)", "Congo (le)", "CG", "COG", "178"},
- {"Congo (the Democratic Republic of the)", "Congo (la République démocratique du)", "CD", "COD", "180"},
- {"Cook Islands (the)", "Cook (les Îles)", "CK", "COK", "184"},
- {"Costa Rica", "Costa Rica (le)", "CR", "CRI", "188"},
- {"Croatia", "Croatie (la)", "HR", "HRV", "191"},
- {"Cuba", "Cuba", "CU", "CUB", "192"},
- {"Cyprus", "Chypre", "CY", "CYP", "196"},
- {"Czech Republic (the)", "tchèque (la République)", "CZ", "CZE", "203"},
- {"Benin", "Bénin (le)", "BJ", "BEN", "204"},
- {"Denmark", "Danemark (le)", "DK", "DNK", "208"},
- {"Dominica", "Dominique (la)", "DM", "DMA", "212"},
- {"Dominican Republic (the)", "dominicaine (la République)", "DO", "DOM", "214"},
- {"Ecuador", "Équateur (l')", "EC", "ECU", "218"},
- {"El Salvador", "El Salvador", "SV", "SLV", "222"},
- {"Equatorial Guinea", "Guinée équatoriale (la)", "GQ", "GNQ", "226"},
- {"Ethiopia", "Éthiopie (l')", "ET", "ETH", "231"},
- {"Eritrea", "Érythrée (l')", "ER", "ERI", "232"},
- {"Estonia", "Estonie (l')", "EE", "EST", "233"},
- {"Faroe Islands (the)", "Féroé (les Îles)", "FO", "FRO", "234"},
- {"Falkland Islands (the) [Malvinas]", "Falkland (les Îles)/Malouines (les Îles)", "FK", "FLK", "238"},
- {"South Georgia and the South Sandwich Islands", "Géorgie du Sud-et-les Îles Sandwich du Sud (la)", "GS", "SGS", "239"},
- {"Fiji", "Fidji (les)", "FJ", "FJI", "242"},
- {"Finland", "Finlande (la)", "FI", "FIN", "246"},
- {"Åland Islands", "Åland(les Îles)", "AX", "ALA", "248"},
- {"France", "France (la)", "FR", "FRA", "250"},
- {"French Guiana", "Guyane française (la )", "GF", "GUF", "254"},
- {"French Polynesia", "Polynésie française (la)", "PF", "PYF", "258"},
- {"French Southern Territories (the)", "Terres australes françaises (les)", "TF", "ATF", "260"},
- {"Djibouti", "Djibouti", "DJ", "DJI", "262"},
- {"Gabon", "Gabon (le)", "GA", "GAB", "266"},
- {"Georgia", "Géorgie (la)", "GE", "GEO", "268"},
- {"Gambia (the)", "Gambie (la)", "GM", "GMB", "270"},
- {"Palestine, State of", "Palestine, État de", "PS", "PSE", "275"},
- {"Germany", "Allemagne (l')", "DE", "DEU", "276"},
- {"Ghana", "Ghana (le)", "GH", "GHA", "288"},
- {"Gibraltar", "Gibraltar", "GI", "GIB", "292"},
- {"Kiribati", "Kiribati", "KI", "KIR", "296"},
- {"Greece", "Grèce (la)", "GR", "GRC", "300"},
- {"Greenland", "Groenland (le)", "GL", "GRL", "304"},
- {"Grenada", "Grenade (la)", "GD", "GRD", "308"},
- {"Guadeloupe", "Guadeloupe (la)", "GP", "GLP", "312"},
- {"Guam", "Guam", "GU", "GUM", "316"},
- {"Guatemala", "Guatemala (le)", "GT", "GTM", "320"},
- {"Guinea", "Guinée (la)", "GN", "GIN", "324"},
- {"Guyana", "Guyana (le)", "GY", "GUY", "328"},
- {"Haiti", "Haïti", "HT", "HTI", "332"},
- {"Heard Island and McDonald Islands", "Heard-et-Îles MacDonald (l'Île)", "HM", "HMD", "334"},
- {"Holy See (the)", "Saint-Siège (le)", "VA", "VAT", "336"},
- {"Honduras", "Honduras (le)", "HN", "HND", "340"},
- {"Hong Kong", "Hong Kong", "HK", "HKG", "344"},
- {"Hungary", "Hongrie (la)", "HU", "HUN", "348"},
- {"Iceland", "Islande (l')", "IS", "ISL", "352"},
- {"India", "Inde (l')", "IN", "IND", "356"},
- {"Indonesia", "Indonésie (l')", "ID", "IDN", "360"},
- {"Iran (Islamic Republic of)", "Iran (République Islamique d')", "IR", "IRN", "364"},
- {"Iraq", "Iraq (l')", "IQ", "IRQ", "368"},
- {"Ireland", "Irlande (l')", "IE", "IRL", "372"},
- {"Israel", "Israël", "IL", "ISR", "376"},
- {"Italy", "Italie (l')", "IT", "ITA", "380"},
- {"Côte d'Ivoire", "Côte d'Ivoire (la)", "CI", "CIV", "384"},
- {"Jamaica", "Jamaïque (la)", "JM", "JAM", "388"},
- {"Japan", "Japon (le)", "JP", "JPN", "392"},
- {"Kazakhstan", "Kazakhstan (le)", "KZ", "KAZ", "398"},
- {"Jordan", "Jordanie (la)", "JO", "JOR", "400"},
- {"Kenya", "Kenya (le)", "KE", "KEN", "404"},
- {"Korea (the Democratic People's Republic of)", "Corée (la République populaire démocratique de)", "KP", "PRK", "408"},
- {"Korea (the Republic of)", "Corée (la République de)", "KR", "KOR", "410"},
- {"Kuwait", "Koweït (le)", "KW", "KWT", "414"},
- {"Kyrgyzstan", "Kirghizistan (le)", "KG", "KGZ", "417"},
- {"Lao People's Democratic Republic (the)", "Lao, République démocratique populaire", "LA", "LAO", "418"},
- {"Lebanon", "Liban (le)", "LB", "LBN", "422"},
- {"Lesotho", "Lesotho (le)", "LS", "LSO", "426"},
- {"Latvia", "Lettonie (la)", "LV", "LVA", "428"},
- {"Liberia", "Libéria (le)", "LR", "LBR", "430"},
- {"Libya", "Libye (la)", "LY", "LBY", "434"},
- {"Liechtenstein", "Liechtenstein (le)", "LI", "LIE", "438"},
- {"Lithuania", "Lituanie (la)", "LT", "LTU", "440"},
- {"Luxembourg", "Luxembourg (le)", "LU", "LUX", "442"},
- {"Macao", "Macao", "MO", "MAC", "446"},
- {"Madagascar", "Madagascar", "MG", "MDG", "450"},
- {"Malawi", "Malawi (le)", "MW", "MWI", "454"},
- {"Malaysia", "Malaisie (la)", "MY", "MYS", "458"},
- {"Maldives", "Maldives (les)", "MV", "MDV", "462"},
- {"Mali", "Mali (le)", "ML", "MLI", "466"},
- {"Malta", "Malte", "MT", "MLT", "470"},
- {"Martinique", "Martinique (la)", "MQ", "MTQ", "474"},
- {"Mauritania", "Mauritanie (la)", "MR", "MRT", "478"},
- {"Mauritius", "Maurice", "MU", "MUS", "480"},
- {"Mexico", "Mexique (le)", "MX", "MEX", "484"},
- {"Monaco", "Monaco", "MC", "MCO", "492"},
- {"Mongolia", "Mongolie (la)", "MN", "MNG", "496"},
- {"Moldova (the Republic of)", "Moldova , République de", "MD", "MDA", "498"},
- {"Montenegro", "Monténégro (le)", "ME", "MNE", "499"},
- {"Montserrat", "Montserrat", "MS", "MSR", "500"},
- {"Morocco", "Maroc (le)", "MA", "MAR", "504"},
- {"Mozambique", "Mozambique (le)", "MZ", "MOZ", "508"},
- {"Oman", "Oman", "OM", "OMN", "512"},
- {"Namibia", "Namibie (la)", "NA", "NAM", "516"},
- {"Nauru", "Nauru", "NR", "NRU", "520"},
- {"Nepal", "Népal (le)", "NP", "NPL", "524"},
- {"Netherlands (the)", "Pays-Bas (les)", "NL", "NLD", "528"},
- {"Curaçao", "Curaçao", "CW", "CUW", "531"},
- {"Aruba", "Aruba", "AW", "ABW", "533"},
- {"Sint Maarten (Dutch part)", "Saint-Martin (partie néerlandaise)", "SX", "SXM", "534"},
- {"Bonaire, Sint Eustatius and Saba", "Bonaire, Saint-Eustache et Saba", "BQ", "BES", "535"},
- {"New Caledonia", "Nouvelle-Calédonie (la)", "NC", "NCL", "540"},
- {"Vanuatu", "Vanuatu (le)", "VU", "VUT", "548"},
- {"New Zealand", "Nouvelle-Zélande (la)", "NZ", "NZL", "554"},
- {"Nicaragua", "Nicaragua (le)", "NI", "NIC", "558"},
- {"Niger (the)", "Niger (le)", "NE", "NER", "562"},
- {"Nigeria", "Nigéria (le)", "NG", "NGA", "566"},
- {"Niue", "Niue", "NU", "NIU", "570"},
- {"Norfolk Island", "Norfolk (l'Île)", "NF", "NFK", "574"},
- {"Norway", "Norvège (la)", "NO", "NOR", "578"},
- {"Northern Mariana Islands (the)", "Mariannes du Nord (les Îles)", "MP", "MNP", "580"},
- {"United States Minor Outlying Islands (the)", "Îles mineures éloignées des États-Unis (les)", "UM", "UMI", "581"},
- {"Micronesia (Federated States of)", "Micronésie (États fédérés de)", "FM", "FSM", "583"},
- {"Marshall Islands (the)", "Marshall (Îles)", "MH", "MHL", "584"},
- {"Palau", "Palaos (les)", "PW", "PLW", "585"},
- {"Pakistan", "Pakistan (le)", "PK", "PAK", "586"},
- {"Panama", "Panama (le)", "PA", "PAN", "591"},
- {"Papua New Guinea", "Papouasie-Nouvelle-Guinée (la)", "PG", "PNG", "598"},
- {"Paraguay", "Paraguay (le)", "PY", "PRY", "600"},
- {"Peru", "Pérou (le)", "PE", "PER", "604"},
- {"Philippines (the)", "Philippines (les)", "PH", "PHL", "608"},
- {"Pitcairn", "Pitcairn", "PN", "PCN", "612"},
- {"Poland", "Pologne (la)", "PL", "POL", "616"},
- {"Portugal", "Portugal (le)", "PT", "PRT", "620"},
- {"Guinea-Bissau", "Guinée-Bissau (la)", "GW", "GNB", "624"},
- {"Timor-Leste", "Timor-Leste (le)", "TL", "TLS", "626"},
- {"Puerto Rico", "Porto Rico", "PR", "PRI", "630"},
- {"Qatar", "Qatar (le)", "QA", "QAT", "634"},
- {"Réunion", "Réunion (La)", "RE", "REU", "638"},
- {"Romania", "Roumanie (la)", "RO", "ROU", "642"},
- {"Russian Federation (the)", "Russie (la Fédération de)", "RU", "RUS", "643"},
- {"Rwanda", "Rwanda (le)", "RW", "RWA", "646"},
- {"Saint Barthélemy", "Saint-Barthélemy", "BL", "BLM", "652"},
- {"Saint Helena, Ascension and Tristan da Cunha", "Sainte-Hélène, Ascension et Tristan da Cunha", "SH", "SHN", "654"},
- {"Saint Kitts and Nevis", "Saint-Kitts-et-Nevis", "KN", "KNA", "659"},
- {"Anguilla", "Anguilla", "AI", "AIA", "660"},
- {"Saint Lucia", "Sainte-Lucie", "LC", "LCA", "662"},
- {"Saint Martin (French part)", "Saint-Martin (partie française)", "MF", "MAF", "663"},
- {"Saint Pierre and Miquelon", "Saint-Pierre-et-Miquelon", "PM", "SPM", "666"},
- {"Saint Vincent and the Grenadines", "Saint-Vincent-et-les Grenadines", "VC", "VCT", "670"},
- {"San Marino", "Saint-Marin", "SM", "SMR", "674"},
- {"Sao Tome and Principe", "Sao Tomé-et-Principe", "ST", "STP", "678"},
- {"Saudi Arabia", "Arabie saoudite (l')", "SA", "SAU", "682"},
- {"Senegal", "Sénégal (le)", "SN", "SEN", "686"},
- {"Serbia", "Serbie (la)", "RS", "SRB", "688"},
- {"Seychelles", "Seychelles (les)", "SC", "SYC", "690"},
- {"Sierra Leone", "Sierra Leone (la)", "SL", "SLE", "694"},
- {"Singapore", "Singapour", "SG", "SGP", "702"},
- {"Slovakia", "Slovaquie (la)", "SK", "SVK", "703"},
- {"Viet Nam", "Viet Nam (le)", "VN", "VNM", "704"},
- {"Slovenia", "Slovénie (la)", "SI", "SVN", "705"},
- {"Somalia", "Somalie (la)", "SO", "SOM", "706"},
- {"South Africa", "Afrique du Sud (l')", "ZA", "ZAF", "710"},
- {"Zimbabwe", "Zimbabwe (le)", "ZW", "ZWE", "716"},
- {"Spain", "Espagne (l')", "ES", "ESP", "724"},
- {"South Sudan", "Soudan du Sud (le)", "SS", "SSD", "728"},
- {"Sudan (the)", "Soudan (le)", "SD", "SDN", "729"},
- {"Western Sahara*", "Sahara occidental (le)*", "EH", "ESH", "732"},
- {"Suriname", "Suriname (le)", "SR", "SUR", "740"},
- {"Svalbard and Jan Mayen", "Svalbard et l'Île Jan Mayen (le)", "SJ", "SJM", "744"},
- {"Swaziland", "Swaziland (le)", "SZ", "SWZ", "748"},
- {"Sweden", "Suède (la)", "SE", "SWE", "752"},
- {"Switzerland", "Suisse (la)", "CH", "CHE", "756"},
- {"Syrian Arab Republic", "République arabe syrienne (la)", "SY", "SYR", "760"},
- {"Tajikistan", "Tadjikistan (le)", "TJ", "TJK", "762"},
- {"Thailand", "Thaïlande (la)", "TH", "THA", "764"},
- {"Togo", "Togo (le)", "TG", "TGO", "768"},
- {"Tokelau", "Tokelau (les)", "TK", "TKL", "772"},
- {"Tonga", "Tonga (les)", "TO", "TON", "776"},
- {"Trinidad and Tobago", "Trinité-et-Tobago (la)", "TT", "TTO", "780"},
- {"United Arab Emirates (the)", "Émirats arabes unis (les)", "AE", "ARE", "784"},
- {"Tunisia", "Tunisie (la)", "TN", "TUN", "788"},
- {"Turkey", "Turquie (la)", "TR", "TUR", "792"},
- {"Turkmenistan", "Turkménistan (le)", "TM", "TKM", "795"},
- {"Turks and Caicos Islands (the)", "Turks-et-Caïcos (les Îles)", "TC", "TCA", "796"},
- {"Tuvalu", "Tuvalu (les)", "TV", "TUV", "798"},
- {"Uganda", "Ouganda (l')", "UG", "UGA", "800"},
- {"Ukraine", "Ukraine (l')", "UA", "UKR", "804"},
- {"Macedonia (the former Yugoslav Republic of)", "Macédoine (l'ex‑République yougoslave de)", "MK", "MKD", "807"},
- {"Egypt", "Égypte (l')", "EG", "EGY", "818"},
- {"United Kingdom of Great Britain and Northern Ireland (the)", "Royaume-Uni de Grande-Bretagne et d'Irlande du Nord (le)", "GB", "GBR", "826"},
- {"Guernsey", "Guernesey", "GG", "GGY", "831"},
- {"Jersey", "Jersey", "JE", "JEY", "832"},
- {"Isle of Man", "Île de Man", "IM", "IMN", "833"},
- {"Tanzania, United Republic of", "Tanzanie, République-Unie de", "TZ", "TZA", "834"},
- {"United States of America (the)", "États-Unis d'Amérique (les)", "US", "USA", "840"},
- {"Virgin Islands (U.S.)", "Vierges des États-Unis (les Îles)", "VI", "VIR", "850"},
- {"Burkina Faso", "Burkina Faso (le)", "BF", "BFA", "854"},
- {"Uruguay", "Uruguay (l')", "UY", "URY", "858"},
- {"Uzbekistan", "Ouzbékistan (l')", "UZ", "UZB", "860"},
- {"Venezuela (Bolivarian Republic of)", "Venezuela (République bolivarienne du)", "VE", "VEN", "862"},
- {"Wallis and Futuna", "Wallis-et-Futuna", "WF", "WLF", "876"},
- {"Samoa", "Samoa (le)", "WS", "WSM", "882"},
- {"Yemen", "Yémen (le)", "YE", "YEM", "887"},
- {"Zambia", "Zambie (la)", "ZM", "ZMB", "894"},
-}
-
-// ISO4217List is the list of ISO currency codes
-var ISO4217List = []string{
- "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", "AZN",
- "BAM", "BBD", "BDT", "BGN", "BHD", "BIF", "BMD", "BND", "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYN", "BZD",
- "CAD", "CDF", "CHE", "CHF", "CHW", "CLF", "CLP", "CNY", "COP", "COU", "CRC", "CUC", "CUP", "CVE", "CZK",
- "DJF", "DKK", "DOP", "DZD",
- "EGP", "ERN", "ETB", "EUR",
- "FJD", "FKP",
- "GBP", "GEL", "GHS", "GIP", "GMD", "GNF", "GTQ", "GYD",
- "HKD", "HNL", "HRK", "HTG", "HUF",
- "IDR", "ILS", "INR", "IQD", "IRR", "ISK",
- "JMD", "JOD", "JPY",
- "KES", "KGS", "KHR", "KMF", "KPW", "KRW", "KWD", "KYD", "KZT",
- "LAK", "LBP", "LKR", "LRD", "LSL", "LYD",
- "MAD", "MDL", "MGA", "MKD", "MMK", "MNT", "MOP", "MRO", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZN",
- "NAD", "NGN", "NIO", "NOK", "NPR", "NZD",
- "OMR",
- "PAB", "PEN", "PGK", "PHP", "PKR", "PLN", "PYG",
- "QAR",
- "RON", "RSD", "RUB", "RWF",
- "SAR", "SBD", "SCR", "SDG", "SEK", "SGD", "SHP", "SLL", "SOS", "SRD", "SSP", "STD", "STN", "SVC", "SYP", "SZL",
- "THB", "TJS", "TMT", "TND", "TOP", "TRY", "TTD", "TWD", "TZS",
- "UAH", "UGX", "USD", "USN", "UYI", "UYU", "UYW", "UZS",
- "VEF", "VES", "VND", "VUV",
- "WST",
- "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XOF", "XPD", "XPF", "XPT", "XSU", "XTS", "XUA", "XXX",
- "YER",
- "ZAR", "ZMW", "ZWL",
-}
-
-// ISO693Entry stores ISO language codes
-type ISO693Entry struct {
- Alpha3bCode string
- Alpha2Code string
- English string
-}
-
-//ISO693List based on http://data.okfn.org/data/core/language-codes/r/language-codes-3b2.json
-var ISO693List = []ISO693Entry{
- {Alpha3bCode: "aar", Alpha2Code: "aa", English: "Afar"},
- {Alpha3bCode: "abk", Alpha2Code: "ab", English: "Abkhazian"},
- {Alpha3bCode: "afr", Alpha2Code: "af", English: "Afrikaans"},
- {Alpha3bCode: "aka", Alpha2Code: "ak", English: "Akan"},
- {Alpha3bCode: "alb", Alpha2Code: "sq", English: "Albanian"},
- {Alpha3bCode: "amh", Alpha2Code: "am", English: "Amharic"},
- {Alpha3bCode: "ara", Alpha2Code: "ar", English: "Arabic"},
- {Alpha3bCode: "arg", Alpha2Code: "an", English: "Aragonese"},
- {Alpha3bCode: "arm", Alpha2Code: "hy", English: "Armenian"},
- {Alpha3bCode: "asm", Alpha2Code: "as", English: "Assamese"},
- {Alpha3bCode: "ava", Alpha2Code: "av", English: "Avaric"},
- {Alpha3bCode: "ave", Alpha2Code: "ae", English: "Avestan"},
- {Alpha3bCode: "aym", Alpha2Code: "ay", English: "Aymara"},
- {Alpha3bCode: "aze", Alpha2Code: "az", English: "Azerbaijani"},
- {Alpha3bCode: "bak", Alpha2Code: "ba", English: "Bashkir"},
- {Alpha3bCode: "bam", Alpha2Code: "bm", English: "Bambara"},
- {Alpha3bCode: "baq", Alpha2Code: "eu", English: "Basque"},
- {Alpha3bCode: "bel", Alpha2Code: "be", English: "Belarusian"},
- {Alpha3bCode: "ben", Alpha2Code: "bn", English: "Bengali"},
- {Alpha3bCode: "bih", Alpha2Code: "bh", English: "Bihari languages"},
- {Alpha3bCode: "bis", Alpha2Code: "bi", English: "Bislama"},
- {Alpha3bCode: "bos", Alpha2Code: "bs", English: "Bosnian"},
- {Alpha3bCode: "bre", Alpha2Code: "br", English: "Breton"},
- {Alpha3bCode: "bul", Alpha2Code: "bg", English: "Bulgarian"},
- {Alpha3bCode: "bur", Alpha2Code: "my", English: "Burmese"},
- {Alpha3bCode: "cat", Alpha2Code: "ca", English: "Catalan; Valencian"},
- {Alpha3bCode: "cha", Alpha2Code: "ch", English: "Chamorro"},
- {Alpha3bCode: "che", Alpha2Code: "ce", English: "Chechen"},
- {Alpha3bCode: "chi", Alpha2Code: "zh", English: "Chinese"},
- {Alpha3bCode: "chu", Alpha2Code: "cu", English: "Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic"},
- {Alpha3bCode: "chv", Alpha2Code: "cv", English: "Chuvash"},
- {Alpha3bCode: "cor", Alpha2Code: "kw", English: "Cornish"},
- {Alpha3bCode: "cos", Alpha2Code: "co", English: "Corsican"},
- {Alpha3bCode: "cre", Alpha2Code: "cr", English: "Cree"},
- {Alpha3bCode: "cze", Alpha2Code: "cs", English: "Czech"},
- {Alpha3bCode: "dan", Alpha2Code: "da", English: "Danish"},
- {Alpha3bCode: "div", Alpha2Code: "dv", English: "Divehi; Dhivehi; Maldivian"},
- {Alpha3bCode: "dut", Alpha2Code: "nl", English: "Dutch; Flemish"},
- {Alpha3bCode: "dzo", Alpha2Code: "dz", English: "Dzongkha"},
- {Alpha3bCode: "eng", Alpha2Code: "en", English: "English"},
- {Alpha3bCode: "epo", Alpha2Code: "eo", English: "Esperanto"},
- {Alpha3bCode: "est", Alpha2Code: "et", English: "Estonian"},
- {Alpha3bCode: "ewe", Alpha2Code: "ee", English: "Ewe"},
- {Alpha3bCode: "fao", Alpha2Code: "fo", English: "Faroese"},
- {Alpha3bCode: "fij", Alpha2Code: "fj", English: "Fijian"},
- {Alpha3bCode: "fin", Alpha2Code: "fi", English: "Finnish"},
- {Alpha3bCode: "fre", Alpha2Code: "fr", English: "French"},
- {Alpha3bCode: "fry", Alpha2Code: "fy", English: "Western Frisian"},
- {Alpha3bCode: "ful", Alpha2Code: "ff", English: "Fulah"},
- {Alpha3bCode: "geo", Alpha2Code: "ka", English: "Georgian"},
- {Alpha3bCode: "ger", Alpha2Code: "de", English: "German"},
- {Alpha3bCode: "gla", Alpha2Code: "gd", English: "Gaelic; Scottish Gaelic"},
- {Alpha3bCode: "gle", Alpha2Code: "ga", English: "Irish"},
- {Alpha3bCode: "glg", Alpha2Code: "gl", English: "Galician"},
- {Alpha3bCode: "glv", Alpha2Code: "gv", English: "Manx"},
- {Alpha3bCode: "gre", Alpha2Code: "el", English: "Greek, Modern (1453-)"},
- {Alpha3bCode: "grn", Alpha2Code: "gn", English: "Guarani"},
- {Alpha3bCode: "guj", Alpha2Code: "gu", English: "Gujarati"},
- {Alpha3bCode: "hat", Alpha2Code: "ht", English: "Haitian; Haitian Creole"},
- {Alpha3bCode: "hau", Alpha2Code: "ha", English: "Hausa"},
- {Alpha3bCode: "heb", Alpha2Code: "he", English: "Hebrew"},
- {Alpha3bCode: "her", Alpha2Code: "hz", English: "Herero"},
- {Alpha3bCode: "hin", Alpha2Code: "hi", English: "Hindi"},
- {Alpha3bCode: "hmo", Alpha2Code: "ho", English: "Hiri Motu"},
- {Alpha3bCode: "hrv", Alpha2Code: "hr", English: "Croatian"},
- {Alpha3bCode: "hun", Alpha2Code: "hu", English: "Hungarian"},
- {Alpha3bCode: "ibo", Alpha2Code: "ig", English: "Igbo"},
- {Alpha3bCode: "ice", Alpha2Code: "is", English: "Icelandic"},
- {Alpha3bCode: "ido", Alpha2Code: "io", English: "Ido"},
- {Alpha3bCode: "iii", Alpha2Code: "ii", English: "Sichuan Yi; Nuosu"},
- {Alpha3bCode: "iku", Alpha2Code: "iu", English: "Inuktitut"},
- {Alpha3bCode: "ile", Alpha2Code: "ie", English: "Interlingue; Occidental"},
- {Alpha3bCode: "ina", Alpha2Code: "ia", English: "Interlingua (International Auxiliary Language Association)"},
- {Alpha3bCode: "ind", Alpha2Code: "id", English: "Indonesian"},
- {Alpha3bCode: "ipk", Alpha2Code: "ik", English: "Inupiaq"},
- {Alpha3bCode: "ita", Alpha2Code: "it", English: "Italian"},
- {Alpha3bCode: "jav", Alpha2Code: "jv", English: "Javanese"},
- {Alpha3bCode: "jpn", Alpha2Code: "ja", English: "Japanese"},
- {Alpha3bCode: "kal", Alpha2Code: "kl", English: "Kalaallisut; Greenlandic"},
- {Alpha3bCode: "kan", Alpha2Code: "kn", English: "Kannada"},
- {Alpha3bCode: "kas", Alpha2Code: "ks", English: "Kashmiri"},
- {Alpha3bCode: "kau", Alpha2Code: "kr", English: "Kanuri"},
- {Alpha3bCode: "kaz", Alpha2Code: "kk", English: "Kazakh"},
- {Alpha3bCode: "khm", Alpha2Code: "km", English: "Central Khmer"},
- {Alpha3bCode: "kik", Alpha2Code: "ki", English: "Kikuyu; Gikuyu"},
- {Alpha3bCode: "kin", Alpha2Code: "rw", English: "Kinyarwanda"},
- {Alpha3bCode: "kir", Alpha2Code: "ky", English: "Kirghiz; Kyrgyz"},
- {Alpha3bCode: "kom", Alpha2Code: "kv", English: "Komi"},
- {Alpha3bCode: "kon", Alpha2Code: "kg", English: "Kongo"},
- {Alpha3bCode: "kor", Alpha2Code: "ko", English: "Korean"},
- {Alpha3bCode: "kua", Alpha2Code: "kj", English: "Kuanyama; Kwanyama"},
- {Alpha3bCode: "kur", Alpha2Code: "ku", English: "Kurdish"},
- {Alpha3bCode: "lao", Alpha2Code: "lo", English: "Lao"},
- {Alpha3bCode: "lat", Alpha2Code: "la", English: "Latin"},
- {Alpha3bCode: "lav", Alpha2Code: "lv", English: "Latvian"},
- {Alpha3bCode: "lim", Alpha2Code: "li", English: "Limburgan; Limburger; Limburgish"},
- {Alpha3bCode: "lin", Alpha2Code: "ln", English: "Lingala"},
- {Alpha3bCode: "lit", Alpha2Code: "lt", English: "Lithuanian"},
- {Alpha3bCode: "ltz", Alpha2Code: "lb", English: "Luxembourgish; Letzeburgesch"},
- {Alpha3bCode: "lub", Alpha2Code: "lu", English: "Luba-Katanga"},
- {Alpha3bCode: "lug", Alpha2Code: "lg", English: "Ganda"},
- {Alpha3bCode: "mac", Alpha2Code: "mk", English: "Macedonian"},
- {Alpha3bCode: "mah", Alpha2Code: "mh", English: "Marshallese"},
- {Alpha3bCode: "mal", Alpha2Code: "ml", English: "Malayalam"},
- {Alpha3bCode: "mao", Alpha2Code: "mi", English: "Maori"},
- {Alpha3bCode: "mar", Alpha2Code: "mr", English: "Marathi"},
- {Alpha3bCode: "may", Alpha2Code: "ms", English: "Malay"},
- {Alpha3bCode: "mlg", Alpha2Code: "mg", English: "Malagasy"},
- {Alpha3bCode: "mlt", Alpha2Code: "mt", English: "Maltese"},
- {Alpha3bCode: "mon", Alpha2Code: "mn", English: "Mongolian"},
- {Alpha3bCode: "nau", Alpha2Code: "na", English: "Nauru"},
- {Alpha3bCode: "nav", Alpha2Code: "nv", English: "Navajo; Navaho"},
- {Alpha3bCode: "nbl", Alpha2Code: "nr", English: "Ndebele, South; South Ndebele"},
- {Alpha3bCode: "nde", Alpha2Code: "nd", English: "Ndebele, North; North Ndebele"},
- {Alpha3bCode: "ndo", Alpha2Code: "ng", English: "Ndonga"},
- {Alpha3bCode: "nep", Alpha2Code: "ne", English: "Nepali"},
- {Alpha3bCode: "nno", Alpha2Code: "nn", English: "Norwegian Nynorsk; Nynorsk, Norwegian"},
- {Alpha3bCode: "nob", Alpha2Code: "nb", English: "Bokmål, Norwegian; Norwegian Bokmål"},
- {Alpha3bCode: "nor", Alpha2Code: "no", English: "Norwegian"},
- {Alpha3bCode: "nya", Alpha2Code: "ny", English: "Chichewa; Chewa; Nyanja"},
- {Alpha3bCode: "oci", Alpha2Code: "oc", English: "Occitan (post 1500); Provençal"},
- {Alpha3bCode: "oji", Alpha2Code: "oj", English: "Ojibwa"},
- {Alpha3bCode: "ori", Alpha2Code: "or", English: "Oriya"},
- {Alpha3bCode: "orm", Alpha2Code: "om", English: "Oromo"},
- {Alpha3bCode: "oss", Alpha2Code: "os", English: "Ossetian; Ossetic"},
- {Alpha3bCode: "pan", Alpha2Code: "pa", English: "Panjabi; Punjabi"},
- {Alpha3bCode: "per", Alpha2Code: "fa", English: "Persian"},
- {Alpha3bCode: "pli", Alpha2Code: "pi", English: "Pali"},
- {Alpha3bCode: "pol", Alpha2Code: "pl", English: "Polish"},
- {Alpha3bCode: "por", Alpha2Code: "pt", English: "Portuguese"},
- {Alpha3bCode: "pus", Alpha2Code: "ps", English: "Pushto; Pashto"},
- {Alpha3bCode: "que", Alpha2Code: "qu", English: "Quechua"},
- {Alpha3bCode: "roh", Alpha2Code: "rm", English: "Romansh"},
- {Alpha3bCode: "rum", Alpha2Code: "ro", English: "Romanian; Moldavian; Moldovan"},
- {Alpha3bCode: "run", Alpha2Code: "rn", English: "Rundi"},
- {Alpha3bCode: "rus", Alpha2Code: "ru", English: "Russian"},
- {Alpha3bCode: "sag", Alpha2Code: "sg", English: "Sango"},
- {Alpha3bCode: "san", Alpha2Code: "sa", English: "Sanskrit"},
- {Alpha3bCode: "sin", Alpha2Code: "si", English: "Sinhala; Sinhalese"},
- {Alpha3bCode: "slo", Alpha2Code: "sk", English: "Slovak"},
- {Alpha3bCode: "slv", Alpha2Code: "sl", English: "Slovenian"},
- {Alpha3bCode: "sme", Alpha2Code: "se", English: "Northern Sami"},
- {Alpha3bCode: "smo", Alpha2Code: "sm", English: "Samoan"},
- {Alpha3bCode: "sna", Alpha2Code: "sn", English: "Shona"},
- {Alpha3bCode: "snd", Alpha2Code: "sd", English: "Sindhi"},
- {Alpha3bCode: "som", Alpha2Code: "so", English: "Somali"},
- {Alpha3bCode: "sot", Alpha2Code: "st", English: "Sotho, Southern"},
- {Alpha3bCode: "spa", Alpha2Code: "es", English: "Spanish; Castilian"},
- {Alpha3bCode: "srd", Alpha2Code: "sc", English: "Sardinian"},
- {Alpha3bCode: "srp", Alpha2Code: "sr", English: "Serbian"},
- {Alpha3bCode: "ssw", Alpha2Code: "ss", English: "Swati"},
- {Alpha3bCode: "sun", Alpha2Code: "su", English: "Sundanese"},
- {Alpha3bCode: "swa", Alpha2Code: "sw", English: "Swahili"},
- {Alpha3bCode: "swe", Alpha2Code: "sv", English: "Swedish"},
- {Alpha3bCode: "tah", Alpha2Code: "ty", English: "Tahitian"},
- {Alpha3bCode: "tam", Alpha2Code: "ta", English: "Tamil"},
- {Alpha3bCode: "tat", Alpha2Code: "tt", English: "Tatar"},
- {Alpha3bCode: "tel", Alpha2Code: "te", English: "Telugu"},
- {Alpha3bCode: "tgk", Alpha2Code: "tg", English: "Tajik"},
- {Alpha3bCode: "tgl", Alpha2Code: "tl", English: "Tagalog"},
- {Alpha3bCode: "tha", Alpha2Code: "th", English: "Thai"},
- {Alpha3bCode: "tib", Alpha2Code: "bo", English: "Tibetan"},
- {Alpha3bCode: "tir", Alpha2Code: "ti", English: "Tigrinya"},
- {Alpha3bCode: "ton", Alpha2Code: "to", English: "Tonga (Tonga Islands)"},
- {Alpha3bCode: "tsn", Alpha2Code: "tn", English: "Tswana"},
- {Alpha3bCode: "tso", Alpha2Code: "ts", English: "Tsonga"},
- {Alpha3bCode: "tuk", Alpha2Code: "tk", English: "Turkmen"},
- {Alpha3bCode: "tur", Alpha2Code: "tr", English: "Turkish"},
- {Alpha3bCode: "twi", Alpha2Code: "tw", English: "Twi"},
- {Alpha3bCode: "uig", Alpha2Code: "ug", English: "Uighur; Uyghur"},
- {Alpha3bCode: "ukr", Alpha2Code: "uk", English: "Ukrainian"},
- {Alpha3bCode: "urd", Alpha2Code: "ur", English: "Urdu"},
- {Alpha3bCode: "uzb", Alpha2Code: "uz", English: "Uzbek"},
- {Alpha3bCode: "ven", Alpha2Code: "ve", English: "Venda"},
- {Alpha3bCode: "vie", Alpha2Code: "vi", English: "Vietnamese"},
- {Alpha3bCode: "vol", Alpha2Code: "vo", English: "Volapük"},
- {Alpha3bCode: "wel", Alpha2Code: "cy", English: "Welsh"},
- {Alpha3bCode: "wln", Alpha2Code: "wa", English: "Walloon"},
- {Alpha3bCode: "wol", Alpha2Code: "wo", English: "Wolof"},
- {Alpha3bCode: "xho", Alpha2Code: "xh", English: "Xhosa"},
- {Alpha3bCode: "yid", Alpha2Code: "yi", English: "Yiddish"},
- {Alpha3bCode: "yor", Alpha2Code: "yo", English: "Yoruba"},
- {Alpha3bCode: "zha", Alpha2Code: "za", English: "Zhuang; Chuang"},
- {Alpha3bCode: "zul", Alpha2Code: "zu", English: "Zulu"},
-}
diff --git a/vendor/github.com/asaskevich/govalidator/utils.go b/vendor/github.com/asaskevich/govalidator/utils.go
deleted file mode 100644
index f4c30f824a2..00000000000
--- a/vendor/github.com/asaskevich/govalidator/utils.go
+++ /dev/null
@@ -1,270 +0,0 @@
-package govalidator
-
-import (
- "errors"
- "fmt"
- "html"
- "math"
- "path"
- "regexp"
- "strings"
- "unicode"
- "unicode/utf8"
-)
-
-// Contains checks if the string contains the substring.
-func Contains(str, substring string) bool {
- return strings.Contains(str, substring)
-}
-
-// Matches checks if string matches the pattern (pattern is regular expression)
-// In case of error return false
-func Matches(str, pattern string) bool {
- match, _ := regexp.MatchString(pattern, str)
- return match
-}
-
-// LeftTrim trims characters from the left side of the input.
-// If second argument is empty, it will remove leading spaces.
-func LeftTrim(str, chars string) string {
- if chars == "" {
- return strings.TrimLeftFunc(str, unicode.IsSpace)
- }
- r, _ := regexp.Compile("^[" + chars + "]+")
- return r.ReplaceAllString(str, "")
-}
-
-// RightTrim trims characters from the right side of the input.
-// If second argument is empty, it will remove trailing spaces.
-func RightTrim(str, chars string) string {
- if chars == "" {
- return strings.TrimRightFunc(str, unicode.IsSpace)
- }
- r, _ := regexp.Compile("[" + chars + "]+$")
- return r.ReplaceAllString(str, "")
-}
-
-// Trim trims characters from both sides of the input.
-// If second argument is empty, it will remove spaces.
-func Trim(str, chars string) string {
- return LeftTrim(RightTrim(str, chars), chars)
-}
-
-// WhiteList removes characters that do not appear in the whitelist.
-func WhiteList(str, chars string) string {
- pattern := "[^" + chars + "]+"
- r, _ := regexp.Compile(pattern)
- return r.ReplaceAllString(str, "")
-}
-
-// BlackList removes characters that appear in the blacklist.
-func BlackList(str, chars string) string {
- pattern := "[" + chars + "]+"
- r, _ := regexp.Compile(pattern)
- return r.ReplaceAllString(str, "")
-}
-
-// StripLow removes characters with a numerical value < 32 and 127, mostly control characters.
-// If keep_new_lines is true, newline characters are preserved (\n and \r, hex 0xA and 0xD).
-func StripLow(str string, keepNewLines bool) string {
- chars := ""
- if keepNewLines {
- chars = "\x00-\x09\x0B\x0C\x0E-\x1F\x7F"
- } else {
- chars = "\x00-\x1F\x7F"
- }
- return BlackList(str, chars)
-}
-
-// ReplacePattern replaces regular expression pattern in string
-func ReplacePattern(str, pattern, replace string) string {
- r, _ := regexp.Compile(pattern)
- return r.ReplaceAllString(str, replace)
-}
-
-// Escape replaces <, >, & and " with HTML entities.
-var Escape = html.EscapeString
-
-func addSegment(inrune, segment []rune) []rune {
- if len(segment) == 0 {
- return inrune
- }
- if len(inrune) != 0 {
- inrune = append(inrune, '_')
- }
- inrune = append(inrune, segment...)
- return inrune
-}
-
-// UnderscoreToCamelCase converts from underscore separated form to camel case form.
-// Ex.: my_func => MyFunc
-func UnderscoreToCamelCase(s string) string {
- return strings.Replace(strings.Title(strings.Replace(strings.ToLower(s), "_", " ", -1)), " ", "", -1)
-}
-
-// CamelCaseToUnderscore converts from camel case form to underscore separated form.
-// Ex.: MyFunc => my_func
-func CamelCaseToUnderscore(str string) string {
- var output []rune
- var segment []rune
- for _, r := range str {
-
- // not treat number as separate segment
- if !unicode.IsLower(r) && string(r) != "_" && !unicode.IsNumber(r) {
- output = addSegment(output, segment)
- segment = nil
- }
- segment = append(segment, unicode.ToLower(r))
- }
- output = addSegment(output, segment)
- return string(output)
-}
-
-// Reverse returns reversed string
-func Reverse(s string) string {
- r := []rune(s)
- for i, j := 0, len(r)-1; i < j; i, j = i+1, j-1 {
- r[i], r[j] = r[j], r[i]
- }
- return string(r)
-}
-
-// GetLines splits string by "\n" and return array of lines
-func GetLines(s string) []string {
- return strings.Split(s, "\n")
-}
-
-// GetLine returns specified line of multiline string
-func GetLine(s string, index int) (string, error) {
- lines := GetLines(s)
- if index < 0 || index >= len(lines) {
- return "", errors.New("line index out of bounds")
- }
- return lines[index], nil
-}
-
-// RemoveTags removes all tags from HTML string
-func RemoveTags(s string) string {
- return ReplacePattern(s, "<[^>]*>", "")
-}
-
-// SafeFileName returns safe string that can be used in file names
-func SafeFileName(str string) string {
- name := strings.ToLower(str)
- name = path.Clean(path.Base(name))
- name = strings.Trim(name, " ")
- separators, err := regexp.Compile(`[ &_=+:]`)
- if err == nil {
- name = separators.ReplaceAllString(name, "-")
- }
- legal, err := regexp.Compile(`[^[:alnum:]-.]`)
- if err == nil {
- name = legal.ReplaceAllString(name, "")
- }
- for strings.Contains(name, "--") {
- name = strings.Replace(name, "--", "-", -1)
- }
- return name
-}
-
-// NormalizeEmail canonicalize an email address.
-// The local part of the email address is lowercased for all domains; the hostname is always lowercased and
-// the local part of the email address is always lowercased for hosts that are known to be case-insensitive (currently only GMail).
-// Normalization follows special rules for known providers: currently, GMail addresses have dots removed in the local part and
-// are stripped of tags (e.g. some.one+tag@gmail.com becomes someone@gmail.com) and all @googlemail.com addresses are
-// normalized to @gmail.com.
-func NormalizeEmail(str string) (string, error) {
- if !IsEmail(str) {
- return "", fmt.Errorf("%s is not an email", str)
- }
- parts := strings.Split(str, "@")
- parts[0] = strings.ToLower(parts[0])
- parts[1] = strings.ToLower(parts[1])
- if parts[1] == "gmail.com" || parts[1] == "googlemail.com" {
- parts[1] = "gmail.com"
- parts[0] = strings.Split(ReplacePattern(parts[0], `\.`, ""), "+")[0]
- }
- return strings.Join(parts, "@"), nil
-}
-
-// Truncate a string to the closest length without breaking words.
-func Truncate(str string, length int, ending string) string {
- var aftstr, befstr string
- if len(str) > length {
- words := strings.Fields(str)
- before, present := 0, 0
- for i := range words {
- befstr = aftstr
- before = present
- aftstr = aftstr + words[i] + " "
- present = len(aftstr)
- if present > length && i != 0 {
- if (length - before) < (present - length) {
- return Trim(befstr, " /\\.,\"'#!?&@+-") + ending
- }
- return Trim(aftstr, " /\\.,\"'#!?&@+-") + ending
- }
- }
- }
-
- return str
-}
-
-// PadLeft pads left side of a string if size of string is less then indicated pad length
-func PadLeft(str string, padStr string, padLen int) string {
- return buildPadStr(str, padStr, padLen, true, false)
-}
-
-// PadRight pads right side of a string if size of string is less then indicated pad length
-func PadRight(str string, padStr string, padLen int) string {
- return buildPadStr(str, padStr, padLen, false, true)
-}
-
-// PadBoth pads both sides of a string if size of string is less then indicated pad length
-func PadBoth(str string, padStr string, padLen int) string {
- return buildPadStr(str, padStr, padLen, true, true)
-}
-
-// PadString either left, right or both sides.
-// Note that padding string can be unicode and more then one character
-func buildPadStr(str string, padStr string, padLen int, padLeft bool, padRight bool) string {
-
- // When padded length is less then the current string size
- if padLen < utf8.RuneCountInString(str) {
- return str
- }
-
- padLen -= utf8.RuneCountInString(str)
-
- targetLen := padLen
-
- targetLenLeft := targetLen
- targetLenRight := targetLen
- if padLeft && padRight {
- targetLenLeft = padLen / 2
- targetLenRight = padLen - targetLenLeft
- }
-
- strToRepeatLen := utf8.RuneCountInString(padStr)
-
- repeatTimes := int(math.Ceil(float64(targetLen) / float64(strToRepeatLen)))
- repeatedString := strings.Repeat(padStr, repeatTimes)
-
- leftSide := ""
- if padLeft {
- leftSide = repeatedString[0:targetLenLeft]
- }
-
- rightSide := ""
- if padRight {
- rightSide = repeatedString[0:targetLenRight]
- }
-
- return leftSide + str + rightSide
-}
-
-// TruncatingErrorf removes extra args from fmt.Errorf if not formatted in the str object
-func TruncatingErrorf(str string, args ...interface{}) error {
- n := strings.Count(str, "%s")
- return fmt.Errorf(str, args[:n]...)
-}
diff --git a/vendor/github.com/asaskevich/govalidator/validator.go b/vendor/github.com/asaskevich/govalidator/validator.go
deleted file mode 100644
index c9c4fac0655..00000000000
--- a/vendor/github.com/asaskevich/govalidator/validator.go
+++ /dev/null
@@ -1,1768 +0,0 @@
-// Package govalidator is package of validators and sanitizers for strings, structs and collections.
-package govalidator
-
-import (
- "bytes"
- "crypto/rsa"
- "crypto/x509"
- "encoding/base64"
- "encoding/json"
- "encoding/pem"
- "fmt"
- "io/ioutil"
- "net"
- "net/url"
- "reflect"
- "regexp"
- "sort"
- "strconv"
- "strings"
- "time"
- "unicode"
- "unicode/utf8"
-)
-
-var (
- fieldsRequiredByDefault bool
- nilPtrAllowedByRequired = false
- notNumberRegexp = regexp.MustCompile("[^0-9]+")
- whiteSpacesAndMinus = regexp.MustCompile(`[\s-]+`)
- paramsRegexp = regexp.MustCompile(`\(.*\)$`)
-)
-
-const maxURLRuneCount = 2083
-const minURLRuneCount = 3
-const rfc3339WithoutZone = "2006-01-02T15:04:05"
-
-// SetFieldsRequiredByDefault causes validation to fail when struct fields
-// do not include validations or are not explicitly marked as exempt (using `valid:"-"` or `valid:"email,optional"`).
-// This struct definition will fail govalidator.ValidateStruct() (and the field values do not matter):
-// type exampleStruct struct {
-// Name string ``
-// Email string `valid:"email"`
-// This, however, will only fail when Email is empty or an invalid email address:
-// type exampleStruct2 struct {
-// Name string `valid:"-"`
-// Email string `valid:"email"`
-// Lastly, this will only fail when Email is an invalid email address but not when it's empty:
-// type exampleStruct2 struct {
-// Name string `valid:"-"`
-// Email string `valid:"email,optional"`
-func SetFieldsRequiredByDefault(value bool) {
- fieldsRequiredByDefault = value
-}
-
-// SetNilPtrAllowedByRequired causes validation to pass for nil ptrs when a field is set to required.
-// The validation will still reject ptr fields in their zero value state. Example with this enabled:
-// type exampleStruct struct {
-// Name *string `valid:"required"`
-// With `Name` set to "", this will be considered invalid input and will cause a validation error.
-// With `Name` set to nil, this will be considered valid by validation.
-// By default this is disabled.
-func SetNilPtrAllowedByRequired(value bool) {
- nilPtrAllowedByRequired = value
-}
-
-// IsEmail checks if the string is an email.
-func IsEmail(str string) bool {
- // TODO uppercase letters are not supported
- return rxEmail.MatchString(str)
-}
-
-// IsExistingEmail checks if the string is an email of existing domain
-func IsExistingEmail(email string) bool {
-
- if len(email) < 6 || len(email) > 254 {
- return false
- }
- at := strings.LastIndex(email, "@")
- if at <= 0 || at > len(email)-3 {
- return false
- }
- user := email[:at]
- host := email[at+1:]
- if len(user) > 64 {
- return false
- }
- switch host {
- case "localhost", "example.com":
- return true
- }
- if userDotRegexp.MatchString(user) || !userRegexp.MatchString(user) || !hostRegexp.MatchString(host) {
- return false
- }
- if _, err := net.LookupMX(host); err != nil {
- if _, err := net.LookupIP(host); err != nil {
- return false
- }
- }
-
- return true
-}
-
-// IsURL checks if the string is an URL.
-func IsURL(str string) bool {
- if str == "" || utf8.RuneCountInString(str) >= maxURLRuneCount || len(str) <= minURLRuneCount || strings.HasPrefix(str, ".") {
- return false
- }
- strTemp := str
- if strings.Contains(str, ":") && !strings.Contains(str, "://") {
- // support no indicated urlscheme but with colon for port number
- // http:// is appended so url.Parse will succeed, strTemp used so it does not impact rxURL.MatchString
- strTemp = "http://" + str
- }
- u, err := url.Parse(strTemp)
- if err != nil {
- return false
- }
- if strings.HasPrefix(u.Host, ".") {
- return false
- }
- if u.Host == "" && (u.Path != "" && !strings.Contains(u.Path, ".")) {
- return false
- }
- return rxURL.MatchString(str)
-}
-
-// IsRequestURL checks if the string rawurl, assuming
-// it was received in an HTTP request, is a valid
-// URL confirm to RFC 3986
-func IsRequestURL(rawurl string) bool {
- url, err := url.ParseRequestURI(rawurl)
- if err != nil {
- return false //Couldn't even parse the rawurl
- }
- if len(url.Scheme) == 0 {
- return false //No Scheme found
- }
- return true
-}
-
-// IsRequestURI checks if the string rawurl, assuming
-// it was received in an HTTP request, is an
-// absolute URI or an absolute path.
-func IsRequestURI(rawurl string) bool {
- _, err := url.ParseRequestURI(rawurl)
- return err == nil
-}
-
-// IsAlpha checks if the string contains only letters (a-zA-Z). Empty string is valid.
-func IsAlpha(str string) bool {
- if IsNull(str) {
- return true
- }
- return rxAlpha.MatchString(str)
-}
-
-//IsUTFLetter checks if the string contains only unicode letter characters.
-//Similar to IsAlpha but for all languages. Empty string is valid.
-func IsUTFLetter(str string) bool {
- if IsNull(str) {
- return true
- }
-
- for _, c := range str {
- if !unicode.IsLetter(c) {
- return false
- }
- }
- return true
-
-}
-
-// IsAlphanumeric checks if the string contains only letters and numbers. Empty string is valid.
-func IsAlphanumeric(str string) bool {
- if IsNull(str) {
- return true
- }
- return rxAlphanumeric.MatchString(str)
-}
-
-// IsUTFLetterNumeric checks if the string contains only unicode letters and numbers. Empty string is valid.
-func IsUTFLetterNumeric(str string) bool {
- if IsNull(str) {
- return true
- }
- for _, c := range str {
- if !unicode.IsLetter(c) && !unicode.IsNumber(c) { //letters && numbers are ok
- return false
- }
- }
- return true
-
-}
-
-// IsNumeric checks if the string contains only numbers. Empty string is valid.
-func IsNumeric(str string) bool {
- if IsNull(str) {
- return true
- }
- return rxNumeric.MatchString(str)
-}
-
-// IsUTFNumeric checks if the string contains only unicode numbers of any kind.
-// Numbers can be 0-9 but also Fractions ¾,Roman Ⅸ and Hangzhou 〩. Empty string is valid.
-func IsUTFNumeric(str string) bool {
- if IsNull(str) {
- return true
- }
- if strings.IndexAny(str, "+-") > 0 {
- return false
- }
- if len(str) > 1 {
- str = strings.TrimPrefix(str, "-")
- str = strings.TrimPrefix(str, "+")
- }
- for _, c := range str {
- if !unicode.IsNumber(c) { //numbers && minus sign are ok
- return false
- }
- }
- return true
-
-}
-
-// IsUTFDigit checks if the string contains only unicode radix-10 decimal digits. Empty string is valid.
-func IsUTFDigit(str string) bool {
- if IsNull(str) {
- return true
- }
- if strings.IndexAny(str, "+-") > 0 {
- return false
- }
- if len(str) > 1 {
- str = strings.TrimPrefix(str, "-")
- str = strings.TrimPrefix(str, "+")
- }
- for _, c := range str {
- if !unicode.IsDigit(c) { //digits && minus sign are ok
- return false
- }
- }
- return true
-
-}
-
-// IsHexadecimal checks if the string is a hexadecimal number.
-func IsHexadecimal(str string) bool {
- return rxHexadecimal.MatchString(str)
-}
-
-// IsHexcolor checks if the string is a hexadecimal color.
-func IsHexcolor(str string) bool {
- return rxHexcolor.MatchString(str)
-}
-
-// IsRGBcolor checks if the string is a valid RGB color in form rgb(RRR, GGG, BBB).
-func IsRGBcolor(str string) bool {
- return rxRGBcolor.MatchString(str)
-}
-
-// IsLowerCase checks if the string is lowercase. Empty string is valid.
-func IsLowerCase(str string) bool {
- if IsNull(str) {
- return true
- }
- return str == strings.ToLower(str)
-}
-
-// IsUpperCase checks if the string is uppercase. Empty string is valid.
-func IsUpperCase(str string) bool {
- if IsNull(str) {
- return true
- }
- return str == strings.ToUpper(str)
-}
-
-// HasLowerCase checks if the string contains at least 1 lowercase. Empty string is valid.
-func HasLowerCase(str string) bool {
- if IsNull(str) {
- return true
- }
- return rxHasLowerCase.MatchString(str)
-}
-
-// HasUpperCase checks if the string contains as least 1 uppercase. Empty string is valid.
-func HasUpperCase(str string) bool {
- if IsNull(str) {
- return true
- }
- return rxHasUpperCase.MatchString(str)
-}
-
-// IsInt checks if the string is an integer. Empty string is valid.
-func IsInt(str string) bool {
- if IsNull(str) {
- return true
- }
- return rxInt.MatchString(str)
-}
-
-// IsFloat checks if the string is a float.
-func IsFloat(str string) bool {
- return str != "" && rxFloat.MatchString(str)
-}
-
-// IsDivisibleBy checks if the string is a number that's divisible by another.
-// If second argument is not valid integer or zero, it's return false.
-// Otherwise, if first argument is not valid integer or zero, it's return true (Invalid string converts to zero).
-func IsDivisibleBy(str, num string) bool {
- f, _ := ToFloat(str)
- p := int64(f)
- q, _ := ToInt(num)
- if q == 0 {
- return false
- }
- return (p == 0) || (p%q == 0)
-}
-
-// IsNull checks if the string is null.
-func IsNull(str string) bool {
- return len(str) == 0
-}
-
-// IsNotNull checks if the string is not null.
-func IsNotNull(str string) bool {
- return !IsNull(str)
-}
-
-// HasWhitespaceOnly checks the string only contains whitespace
-func HasWhitespaceOnly(str string) bool {
- return len(str) > 0 && rxHasWhitespaceOnly.MatchString(str)
-}
-
-// HasWhitespace checks if the string contains any whitespace
-func HasWhitespace(str string) bool {
- return len(str) > 0 && rxHasWhitespace.MatchString(str)
-}
-
-// IsByteLength checks if the string's length (in bytes) falls in a range.
-func IsByteLength(str string, min, max int) bool {
- return len(str) >= min && len(str) <= max
-}
-
-// IsUUIDv3 checks if the string is a UUID version 3.
-func IsUUIDv3(str string) bool {
- return rxUUID3.MatchString(str)
-}
-
-// IsUUIDv4 checks if the string is a UUID version 4.
-func IsUUIDv4(str string) bool {
- return rxUUID4.MatchString(str)
-}
-
-// IsUUIDv5 checks if the string is a UUID version 5.
-func IsUUIDv5(str string) bool {
- return rxUUID5.MatchString(str)
-}
-
-// IsUUID checks if the string is a UUID (version 3, 4 or 5).
-func IsUUID(str string) bool {
- return rxUUID.MatchString(str)
-}
-
-// Byte to index table for O(1) lookups when unmarshaling.
-// We use 0xFF as sentinel value for invalid indexes.
-var ulidDec = [...]byte{
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x01,
- 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
- 0x0F, 0x10, 0x11, 0xFF, 0x12, 0x13, 0xFF, 0x14, 0x15, 0xFF,
- 0x16, 0x17, 0x18, 0x19, 0x1A, 0xFF, 0x1B, 0x1C, 0x1D, 0x1E,
- 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0A, 0x0B, 0x0C,
- 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0xFF, 0x12, 0x13, 0xFF, 0x14,
- 0x15, 0xFF, 0x16, 0x17, 0x18, 0x19, 0x1A, 0xFF, 0x1B, 0x1C,
- 0x1D, 0x1E, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-}
-
-// EncodedSize is the length of a text encoded ULID.
-const ulidEncodedSize = 26
-
-// IsULID checks if the string is a ULID.
-//
-// Implementation got from:
-// https://github.com/oklog/ulid (Apache-2.0 License)
-//
-func IsULID(str string) bool {
- // Check if a base32 encoded ULID is the right length.
- if len(str) != ulidEncodedSize {
- return false
- }
-
- // Check if all the characters in a base32 encoded ULID are part of the
- // expected base32 character set.
- if ulidDec[str[0]] == 0xFF ||
- ulidDec[str[1]] == 0xFF ||
- ulidDec[str[2]] == 0xFF ||
- ulidDec[str[3]] == 0xFF ||
- ulidDec[str[4]] == 0xFF ||
- ulidDec[str[5]] == 0xFF ||
- ulidDec[str[6]] == 0xFF ||
- ulidDec[str[7]] == 0xFF ||
- ulidDec[str[8]] == 0xFF ||
- ulidDec[str[9]] == 0xFF ||
- ulidDec[str[10]] == 0xFF ||
- ulidDec[str[11]] == 0xFF ||
- ulidDec[str[12]] == 0xFF ||
- ulidDec[str[13]] == 0xFF ||
- ulidDec[str[14]] == 0xFF ||
- ulidDec[str[15]] == 0xFF ||
- ulidDec[str[16]] == 0xFF ||
- ulidDec[str[17]] == 0xFF ||
- ulidDec[str[18]] == 0xFF ||
- ulidDec[str[19]] == 0xFF ||
- ulidDec[str[20]] == 0xFF ||
- ulidDec[str[21]] == 0xFF ||
- ulidDec[str[22]] == 0xFF ||
- ulidDec[str[23]] == 0xFF ||
- ulidDec[str[24]] == 0xFF ||
- ulidDec[str[25]] == 0xFF {
- return false
- }
-
- // Check if the first character in a base32 encoded ULID will overflow. This
- // happens because the base32 representation encodes 130 bits, while the
- // ULID is only 128 bits.
- //
- // See https://github.com/oklog/ulid/issues/9 for details.
- if str[0] > '7' {
- return false
- }
- return true
-}
-
-// IsCreditCard checks if the string is a credit card.
-func IsCreditCard(str string) bool {
- sanitized := whiteSpacesAndMinus.ReplaceAllString(str, "")
- if !rxCreditCard.MatchString(sanitized) {
- return false
- }
-
- number, _ := ToInt(sanitized)
- number, lastDigit := number / 10, number % 10
-
- var sum int64
- for i:=0; number > 0; i++ {
- digit := number % 10
-
- if i % 2 == 0 {
- digit *= 2
- if digit > 9 {
- digit -= 9
- }
- }
-
- sum += digit
- number = number / 10
- }
-
- return (sum + lastDigit) % 10 == 0
-}
-
-// IsISBN10 checks if the string is an ISBN version 10.
-func IsISBN10(str string) bool {
- return IsISBN(str, 10)
-}
-
-// IsISBN13 checks if the string is an ISBN version 13.
-func IsISBN13(str string) bool {
- return IsISBN(str, 13)
-}
-
-// IsISBN checks if the string is an ISBN (version 10 or 13).
-// If version value is not equal to 10 or 13, it will be checks both variants.
-func IsISBN(str string, version int) bool {
- sanitized := whiteSpacesAndMinus.ReplaceAllString(str, "")
- var checksum int32
- var i int32
- if version == 10 {
- if !rxISBN10.MatchString(sanitized) {
- return false
- }
- for i = 0; i < 9; i++ {
- checksum += (i + 1) * int32(sanitized[i]-'0')
- }
- if sanitized[9] == 'X' {
- checksum += 10 * 10
- } else {
- checksum += 10 * int32(sanitized[9]-'0')
- }
- if checksum%11 == 0 {
- return true
- }
- return false
- } else if version == 13 {
- if !rxISBN13.MatchString(sanitized) {
- return false
- }
- factor := []int32{1, 3}
- for i = 0; i < 12; i++ {
- checksum += factor[i%2] * int32(sanitized[i]-'0')
- }
- return (int32(sanitized[12]-'0'))-((10-(checksum%10))%10) == 0
- }
- return IsISBN(str, 10) || IsISBN(str, 13)
-}
-
-// IsJSON checks if the string is valid JSON (note: uses json.Unmarshal).
-func IsJSON(str string) bool {
- var js json.RawMessage
- return json.Unmarshal([]byte(str), &js) == nil
-}
-
-// IsMultibyte checks if the string contains one or more multibyte chars. Empty string is valid.
-func IsMultibyte(str string) bool {
- if IsNull(str) {
- return true
- }
- return rxMultibyte.MatchString(str)
-}
-
-// IsASCII checks if the string contains ASCII chars only. Empty string is valid.
-func IsASCII(str string) bool {
- if IsNull(str) {
- return true
- }
- return rxASCII.MatchString(str)
-}
-
-// IsPrintableASCII checks if the string contains printable ASCII chars only. Empty string is valid.
-func IsPrintableASCII(str string) bool {
- if IsNull(str) {
- return true
- }
- return rxPrintableASCII.MatchString(str)
-}
-
-// IsFullWidth checks if the string contains any full-width chars. Empty string is valid.
-func IsFullWidth(str string) bool {
- if IsNull(str) {
- return true
- }
- return rxFullWidth.MatchString(str)
-}
-
-// IsHalfWidth checks if the string contains any half-width chars. Empty string is valid.
-func IsHalfWidth(str string) bool {
- if IsNull(str) {
- return true
- }
- return rxHalfWidth.MatchString(str)
-}
-
-// IsVariableWidth checks if the string contains a mixture of full and half-width chars. Empty string is valid.
-func IsVariableWidth(str string) bool {
- if IsNull(str) {
- return true
- }
- return rxHalfWidth.MatchString(str) && rxFullWidth.MatchString(str)
-}
-
-// IsBase64 checks if a string is base64 encoded.
-func IsBase64(str string) bool {
- return rxBase64.MatchString(str)
-}
-
-// IsFilePath checks is a string is Win or Unix file path and returns it's type.
-func IsFilePath(str string) (bool, int) {
- if rxWinPath.MatchString(str) {
- //check windows path limit see:
- // http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#maxpath
- if len(str[3:]) > 32767 {
- return false, Win
- }
- return true, Win
- } else if rxUnixPath.MatchString(str) {
- return true, Unix
- }
- return false, Unknown
-}
-
-//IsWinFilePath checks both relative & absolute paths in Windows
-func IsWinFilePath(str string) bool {
- if rxARWinPath.MatchString(str) {
- //check windows path limit see:
- // http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx#maxpath
- if len(str[3:]) > 32767 {
- return false
- }
- return true
- }
- return false
-}
-
-//IsUnixFilePath checks both relative & absolute paths in Unix
-func IsUnixFilePath(str string) bool {
- if rxARUnixPath.MatchString(str) {
- return true
- }
- return false
-}
-
-// IsDataURI checks if a string is base64 encoded data URI such as an image
-func IsDataURI(str string) bool {
- dataURI := strings.Split(str, ",")
- if !rxDataURI.MatchString(dataURI[0]) {
- return false
- }
- return IsBase64(dataURI[1])
-}
-
-// IsMagnetURI checks if a string is valid magnet URI
-func IsMagnetURI(str string) bool {
- return rxMagnetURI.MatchString(str)
-}
-
-// IsISO3166Alpha2 checks if a string is valid two-letter country code
-func IsISO3166Alpha2(str string) bool {
- for _, entry := range ISO3166List {
- if str == entry.Alpha2Code {
- return true
- }
- }
- return false
-}
-
-// IsISO3166Alpha3 checks if a string is valid three-letter country code
-func IsISO3166Alpha3(str string) bool {
- for _, entry := range ISO3166List {
- if str == entry.Alpha3Code {
- return true
- }
- }
- return false
-}
-
-// IsISO693Alpha2 checks if a string is valid two-letter language code
-func IsISO693Alpha2(str string) bool {
- for _, entry := range ISO693List {
- if str == entry.Alpha2Code {
- return true
- }
- }
- return false
-}
-
-// IsISO693Alpha3b checks if a string is valid three-letter language code
-func IsISO693Alpha3b(str string) bool {
- for _, entry := range ISO693List {
- if str == entry.Alpha3bCode {
- return true
- }
- }
- return false
-}
-
-// IsDNSName will validate the given string as a DNS name
-func IsDNSName(str string) bool {
- if str == "" || len(strings.Replace(str, ".", "", -1)) > 255 {
- // constraints already violated
- return false
- }
- return !IsIP(str) && rxDNSName.MatchString(str)
-}
-
-// IsHash checks if a string is a hash of type algorithm.
-// Algorithm is one of ['md4', 'md5', 'sha1', 'sha256', 'sha384', 'sha512', 'ripemd128', 'ripemd160', 'tiger128', 'tiger160', 'tiger192', 'crc32', 'crc32b']
-func IsHash(str string, algorithm string) bool {
- var len string
- algo := strings.ToLower(algorithm)
-
- if algo == "crc32" || algo == "crc32b" {
- len = "8"
- } else if algo == "md5" || algo == "md4" || algo == "ripemd128" || algo == "tiger128" {
- len = "32"
- } else if algo == "sha1" || algo == "ripemd160" || algo == "tiger160" {
- len = "40"
- } else if algo == "tiger192" {
- len = "48"
- } else if algo == "sha3-224" {
- len = "56"
- } else if algo == "sha256" || algo == "sha3-256" {
- len = "64"
- } else if algo == "sha384" || algo == "sha3-384" {
- len = "96"
- } else if algo == "sha512" || algo == "sha3-512" {
- len = "128"
- } else {
- return false
- }
-
- return Matches(str, "^[a-f0-9]{"+len+"}$")
-}
-
-// IsSHA3224 checks is a string is a SHA3-224 hash. Alias for `IsHash(str, "sha3-224")`
-func IsSHA3224(str string) bool {
- return IsHash(str, "sha3-224")
-}
-
-// IsSHA3256 checks is a string is a SHA3-256 hash. Alias for `IsHash(str, "sha3-256")`
-func IsSHA3256(str string) bool {
- return IsHash(str, "sha3-256")
-}
-
-// IsSHA3384 checks is a string is a SHA3-384 hash. Alias for `IsHash(str, "sha3-384")`
-func IsSHA3384(str string) bool {
- return IsHash(str, "sha3-384")
-}
-
-// IsSHA3512 checks is a string is a SHA3-512 hash. Alias for `IsHash(str, "sha3-512")`
-func IsSHA3512(str string) bool {
- return IsHash(str, "sha3-512")
-}
-
-// IsSHA512 checks is a string is a SHA512 hash. Alias for `IsHash(str, "sha512")`
-func IsSHA512(str string) bool {
- return IsHash(str, "sha512")
-}
-
-// IsSHA384 checks is a string is a SHA384 hash. Alias for `IsHash(str, "sha384")`
-func IsSHA384(str string) bool {
- return IsHash(str, "sha384")
-}
-
-// IsSHA256 checks is a string is a SHA256 hash. Alias for `IsHash(str, "sha256")`
-func IsSHA256(str string) bool {
- return IsHash(str, "sha256")
-}
-
-// IsTiger192 checks is a string is a Tiger192 hash. Alias for `IsHash(str, "tiger192")`
-func IsTiger192(str string) bool {
- return IsHash(str, "tiger192")
-}
-
-// IsTiger160 checks is a string is a Tiger160 hash. Alias for `IsHash(str, "tiger160")`
-func IsTiger160(str string) bool {
- return IsHash(str, "tiger160")
-}
-
-// IsRipeMD160 checks is a string is a RipeMD160 hash. Alias for `IsHash(str, "ripemd160")`
-func IsRipeMD160(str string) bool {
- return IsHash(str, "ripemd160")
-}
-
-// IsSHA1 checks is a string is a SHA-1 hash. Alias for `IsHash(str, "sha1")`
-func IsSHA1(str string) bool {
- return IsHash(str, "sha1")
-}
-
-// IsTiger128 checks is a string is a Tiger128 hash. Alias for `IsHash(str, "tiger128")`
-func IsTiger128(str string) bool {
- return IsHash(str, "tiger128")
-}
-
-// IsRipeMD128 checks is a string is a RipeMD128 hash. Alias for `IsHash(str, "ripemd128")`
-func IsRipeMD128(str string) bool {
- return IsHash(str, "ripemd128")
-}
-
-// IsCRC32 checks is a string is a CRC32 hash. Alias for `IsHash(str, "crc32")`
-func IsCRC32(str string) bool {
- return IsHash(str, "crc32")
-}
-
-// IsCRC32b checks is a string is a CRC32b hash. Alias for `IsHash(str, "crc32b")`
-func IsCRC32b(str string) bool {
- return IsHash(str, "crc32b")
-}
-
-// IsMD5 checks is a string is a MD5 hash. Alias for `IsHash(str, "md5")`
-func IsMD5(str string) bool {
- return IsHash(str, "md5")
-}
-
-// IsMD4 checks is a string is a MD4 hash. Alias for `IsHash(str, "md4")`
-func IsMD4(str string) bool {
- return IsHash(str, "md4")
-}
-
-// IsDialString validates the given string for usage with the various Dial() functions
-func IsDialString(str string) bool {
- if h, p, err := net.SplitHostPort(str); err == nil && h != "" && p != "" && (IsDNSName(h) || IsIP(h)) && IsPort(p) {
- return true
- }
-
- return false
-}
-
-// IsIP checks if a string is either IP version 4 or 6. Alias for `net.ParseIP`
-func IsIP(str string) bool {
- return net.ParseIP(str) != nil
-}
-
-// IsPort checks if a string represents a valid port
-func IsPort(str string) bool {
- if i, err := strconv.Atoi(str); err == nil && i > 0 && i < 65536 {
- return true
- }
- return false
-}
-
-// IsIPv4 checks if the string is an IP version 4.
-func IsIPv4(str string) bool {
- ip := net.ParseIP(str)
- return ip != nil && strings.Contains(str, ".")
-}
-
-// IsIPv6 checks if the string is an IP version 6.
-func IsIPv6(str string) bool {
- ip := net.ParseIP(str)
- return ip != nil && strings.Contains(str, ":")
-}
-
-// IsCIDR checks if the string is an valid CIDR notiation (IPV4 & IPV6)
-func IsCIDR(str string) bool {
- _, _, err := net.ParseCIDR(str)
- return err == nil
-}
-
-// IsMAC checks if a string is valid MAC address.
-// Possible MAC formats:
-// 01:23:45:67:89:ab
-// 01:23:45:67:89:ab:cd:ef
-// 01-23-45-67-89-ab
-// 01-23-45-67-89-ab-cd-ef
-// 0123.4567.89ab
-// 0123.4567.89ab.cdef
-func IsMAC(str string) bool {
- _, err := net.ParseMAC(str)
- return err == nil
-}
-
-// IsHost checks if the string is a valid IP (both v4 and v6) or a valid DNS name
-func IsHost(str string) bool {
- return IsIP(str) || IsDNSName(str)
-}
-
-// IsMongoID checks if the string is a valid hex-encoded representation of a MongoDB ObjectId.
-func IsMongoID(str string) bool {
- return rxHexadecimal.MatchString(str) && (len(str) == 24)
-}
-
-// IsLatitude checks if a string is valid latitude.
-func IsLatitude(str string) bool {
- return rxLatitude.MatchString(str)
-}
-
-// IsLongitude checks if a string is valid longitude.
-func IsLongitude(str string) bool {
- return rxLongitude.MatchString(str)
-}
-
-// IsIMEI checks if a string is valid IMEI
-func IsIMEI(str string) bool {
- return rxIMEI.MatchString(str)
-}
-
-// IsIMSI checks if a string is valid IMSI
-func IsIMSI(str string) bool {
- if !rxIMSI.MatchString(str) {
- return false
- }
-
- mcc, err := strconv.ParseInt(str[0:3], 10, 32)
- if err != nil {
- return false
- }
-
- switch mcc {
- case 202, 204, 206, 208, 212, 213, 214, 216, 218, 219:
- case 220, 221, 222, 226, 228, 230, 231, 232, 234, 235:
- case 238, 240, 242, 244, 246, 247, 248, 250, 255, 257:
- case 259, 260, 262, 266, 268, 270, 272, 274, 276, 278:
- case 280, 282, 283, 284, 286, 288, 289, 290, 292, 293:
- case 294, 295, 297, 302, 308, 310, 311, 312, 313, 314:
- case 315, 316, 330, 332, 334, 338, 340, 342, 344, 346:
- case 348, 350, 352, 354, 356, 358, 360, 362, 363, 364:
- case 365, 366, 368, 370, 372, 374, 376, 400, 401, 402:
- case 404, 405, 406, 410, 412, 413, 414, 415, 416, 417:
- case 418, 419, 420, 421, 422, 424, 425, 426, 427, 428:
- case 429, 430, 431, 432, 434, 436, 437, 438, 440, 441:
- case 450, 452, 454, 455, 456, 457, 460, 461, 466, 467:
- case 470, 472, 502, 505, 510, 514, 515, 520, 525, 528:
- case 530, 536, 537, 539, 540, 541, 542, 543, 544, 545:
- case 546, 547, 548, 549, 550, 551, 552, 553, 554, 555:
- case 602, 603, 604, 605, 606, 607, 608, 609, 610, 611:
- case 612, 613, 614, 615, 616, 617, 618, 619, 620, 621:
- case 622, 623, 624, 625, 626, 627, 628, 629, 630, 631:
- case 632, 633, 634, 635, 636, 637, 638, 639, 640, 641:
- case 642, 643, 645, 646, 647, 648, 649, 650, 651, 652:
- case 653, 654, 655, 657, 658, 659, 702, 704, 706, 708:
- case 710, 712, 714, 716, 722, 724, 730, 732, 734, 736:
- case 738, 740, 742, 744, 746, 748, 750, 995:
- return true
- default:
- return false
- }
- return true
-}
-
-// IsRsaPublicKey checks if a string is valid public key with provided length
-func IsRsaPublicKey(str string, keylen int) bool {
- bb := bytes.NewBufferString(str)
- pemBytes, err := ioutil.ReadAll(bb)
- if err != nil {
- return false
- }
- block, _ := pem.Decode(pemBytes)
- if block != nil && block.Type != "PUBLIC KEY" {
- return false
- }
- var der []byte
-
- if block != nil {
- der = block.Bytes
- } else {
- der, err = base64.StdEncoding.DecodeString(str)
- if err != nil {
- return false
- }
- }
-
- key, err := x509.ParsePKIXPublicKey(der)
- if err != nil {
- return false
- }
- pubkey, ok := key.(*rsa.PublicKey)
- if !ok {
- return false
- }
- bitlen := len(pubkey.N.Bytes()) * 8
- return bitlen == int(keylen)
-}
-
-// IsRegex checks if a give string is a valid regex with RE2 syntax or not
-func IsRegex(str string) bool {
- if _, err := regexp.Compile(str); err == nil {
- return true
- }
- return false
-}
-
-func toJSONName(tag string) string {
- if tag == "" {
- return ""
- }
-
- // JSON name always comes first. If there's no options then split[0] is
- // JSON name, if JSON name is not set, then split[0] is an empty string.
- split := strings.SplitN(tag, ",", 2)
-
- name := split[0]
-
- // However it is possible that the field is skipped when
- // (de-)serializing from/to JSON, in which case assume that there is no
- // tag name to use
- if name == "-" {
- return ""
- }
- return name
-}
-
-func prependPathToErrors(err error, path string) error {
- switch err2 := err.(type) {
- case Error:
- err2.Path = append([]string{path}, err2.Path...)
- return err2
- case Errors:
- errors := err2.Errors()
- for i, err3 := range errors {
- errors[i] = prependPathToErrors(err3, path)
- }
- return err2
- }
- return err
-}
-
-// ValidateArray performs validation according to condition iterator that validates every element of the array
-func ValidateArray(array []interface{}, iterator ConditionIterator) bool {
- return Every(array, iterator)
-}
-
-// ValidateMap use validation map for fields.
-// result will be equal to `false` if there are any errors.
-// s is the map containing the data to be validated.
-// m is the validation map in the form:
-// map[string]interface{}{"name":"required,alpha","address":map[string]interface{}{"line1":"required,alphanum"}}
-func ValidateMap(s map[string]interface{}, m map[string]interface{}) (bool, error) {
- if s == nil {
- return true, nil
- }
- result := true
- var err error
- var errs Errors
- var index int
- val := reflect.ValueOf(s)
- for key, value := range s {
- presentResult := true
- validator, ok := m[key]
- if !ok {
- presentResult = false
- var err error
- err = fmt.Errorf("all map keys has to be present in the validation map; got %s", key)
- err = prependPathToErrors(err, key)
- errs = append(errs, err)
- }
- valueField := reflect.ValueOf(value)
- mapResult := true
- typeResult := true
- structResult := true
- resultField := true
- switch subValidator := validator.(type) {
- case map[string]interface{}:
- var err error
- if v, ok := value.(map[string]interface{}); !ok {
- mapResult = false
- err = fmt.Errorf("map validator has to be for the map type only; got %s", valueField.Type().String())
- err = prependPathToErrors(err, key)
- errs = append(errs, err)
- } else {
- mapResult, err = ValidateMap(v, subValidator)
- if err != nil {
- mapResult = false
- err = prependPathToErrors(err, key)
- errs = append(errs, err)
- }
- }
- case string:
- if (valueField.Kind() == reflect.Struct ||
- (valueField.Kind() == reflect.Ptr && valueField.Elem().Kind() == reflect.Struct)) &&
- subValidator != "-" {
- var err error
- structResult, err = ValidateStruct(valueField.Interface())
- if err != nil {
- err = prependPathToErrors(err, key)
- errs = append(errs, err)
- }
- }
- resultField, err = typeCheck(valueField, reflect.StructField{
- Name: key,
- PkgPath: "",
- Type: val.Type(),
- Tag: reflect.StructTag(fmt.Sprintf("%s:%q", tagName, subValidator)),
- Offset: 0,
- Index: []int{index},
- Anonymous: false,
- }, val, nil)
- if err != nil {
- errs = append(errs, err)
- }
- case nil:
- // already handlerd when checked before
- default:
- typeResult = false
- err = fmt.Errorf("map validator has to be either map[string]interface{} or string; got %s", valueField.Type().String())
- err = prependPathToErrors(err, key)
- errs = append(errs, err)
- }
- result = result && presentResult && typeResult && resultField && structResult && mapResult
- index++
- }
- // checks required keys
- requiredResult := true
- for key, value := range m {
- if schema, ok := value.(string); ok {
- tags := parseTagIntoMap(schema)
- if required, ok := tags["required"]; ok {
- if _, ok := s[key]; !ok {
- requiredResult = false
- if required.customErrorMessage != "" {
- err = Error{key, fmt.Errorf(required.customErrorMessage), true, "required", []string{}}
- } else {
- err = Error{key, fmt.Errorf("required field missing"), false, "required", []string{}}
- }
- errs = append(errs, err)
- }
- }
- }
- }
-
- if len(errs) > 0 {
- err = errs
- }
- return result && requiredResult, err
-}
-
-// ValidateStruct use tags for fields.
-// result will be equal to `false` if there are any errors.
-// todo currently there is no guarantee that errors will be returned in predictable order (tests may to fail)
-func ValidateStruct(s interface{}) (bool, error) {
- if s == nil {
- return true, nil
- }
- result := true
- var err error
- val := reflect.ValueOf(s)
- if val.Kind() == reflect.Interface || val.Kind() == reflect.Ptr {
- val = val.Elem()
- }
- // we only accept structs
- if val.Kind() != reflect.Struct {
- return false, fmt.Errorf("function only accepts structs; got %s", val.Kind())
- }
- var errs Errors
- for i := 0; i < val.NumField(); i++ {
- valueField := val.Field(i)
- typeField := val.Type().Field(i)
- if typeField.PkgPath != "" {
- continue // Private field
- }
- structResult := true
- if valueField.Kind() == reflect.Interface {
- valueField = valueField.Elem()
- }
- if (valueField.Kind() == reflect.Struct ||
- (valueField.Kind() == reflect.Ptr && valueField.Elem().Kind() == reflect.Struct)) &&
- typeField.Tag.Get(tagName) != "-" {
- var err error
- structResult, err = ValidateStruct(valueField.Interface())
- if err != nil {
- err = prependPathToErrors(err, typeField.Name)
- errs = append(errs, err)
- }
- }
- resultField, err2 := typeCheck(valueField, typeField, val, nil)
- if err2 != nil {
-
- // Replace structure name with JSON name if there is a tag on the variable
- jsonTag := toJSONName(typeField.Tag.Get("json"))
- if jsonTag != "" {
- switch jsonError := err2.(type) {
- case Error:
- jsonError.Name = jsonTag
- err2 = jsonError
- case Errors:
- for i2, err3 := range jsonError {
- switch customErr := err3.(type) {
- case Error:
- customErr.Name = jsonTag
- jsonError[i2] = customErr
- }
- }
-
- err2 = jsonError
- }
- }
-
- errs = append(errs, err2)
- }
- result = result && resultField && structResult
- }
- if len(errs) > 0 {
- err = errs
- }
- return result, err
-}
-
-// ValidateStructAsync performs async validation of the struct and returns results through the channels
-func ValidateStructAsync(s interface{}) (<-chan bool, <-chan error) {
- res := make(chan bool)
- errors := make(chan error)
-
- go func() {
- defer close(res)
- defer close(errors)
-
- isValid, isFailed := ValidateStruct(s)
-
- res <- isValid
- errors <- isFailed
- }()
-
- return res, errors
-}
-
-// ValidateMapAsync performs async validation of the map and returns results through the channels
-func ValidateMapAsync(s map[string]interface{}, m map[string]interface{}) (<-chan bool, <-chan error) {
- res := make(chan bool)
- errors := make(chan error)
-
- go func() {
- defer close(res)
- defer close(errors)
-
- isValid, isFailed := ValidateMap(s, m)
-
- res <- isValid
- errors <- isFailed
- }()
-
- return res, errors
-}
-
-// parseTagIntoMap parses a struct tag `valid:required~Some error message,length(2|3)` into map[string]string{"required": "Some error message", "length(2|3)": ""}
-func parseTagIntoMap(tag string) tagOptionsMap {
- optionsMap := make(tagOptionsMap)
- options := strings.Split(tag, ",")
-
- for i, option := range options {
- option = strings.TrimSpace(option)
-
- validationOptions := strings.Split(option, "~")
- if !isValidTag(validationOptions[0]) {
- continue
- }
- if len(validationOptions) == 2 {
- optionsMap[validationOptions[0]] = tagOption{validationOptions[0], validationOptions[1], i}
- } else {
- optionsMap[validationOptions[0]] = tagOption{validationOptions[0], "", i}
- }
- }
- return optionsMap
-}
-
-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.
- default:
- if !unicode.IsLetter(c) && !unicode.IsDigit(c) {
- return false
- }
- }
- }
- return true
-}
-
-// IsSSN will validate the given string as a U.S. Social Security Number
-func IsSSN(str string) bool {
- if str == "" || len(str) != 11 {
- return false
- }
- return rxSSN.MatchString(str)
-}
-
-// IsSemver checks if string is valid semantic version
-func IsSemver(str string) bool {
- return rxSemver.MatchString(str)
-}
-
-// IsType checks if interface is of some type
-func IsType(v interface{}, params ...string) bool {
- if len(params) == 1 {
- typ := params[0]
- return strings.Replace(reflect.TypeOf(v).String(), " ", "", -1) == strings.Replace(typ, " ", "", -1)
- }
- return false
-}
-
-// IsTime checks if string is valid according to given format
-func IsTime(str string, format string) bool {
- _, err := time.Parse(format, str)
- return err == nil
-}
-
-// IsUnixTime checks if string is valid unix timestamp value
-func IsUnixTime(str string) bool {
- if _, err := strconv.Atoi(str); err == nil {
- return true
- }
- return false
-}
-
-// IsRFC3339 checks if string is valid timestamp value according to RFC3339
-func IsRFC3339(str string) bool {
- return IsTime(str, time.RFC3339)
-}
-
-// IsRFC3339WithoutZone checks if string is valid timestamp value according to RFC3339 which excludes the timezone.
-func IsRFC3339WithoutZone(str string) bool {
- return IsTime(str, rfc3339WithoutZone)
-}
-
-// IsISO4217 checks if string is valid ISO currency code
-func IsISO4217(str string) bool {
- for _, currency := range ISO4217List {
- if str == currency {
- return true
- }
- }
-
- return false
-}
-
-// ByteLength checks string's length
-func ByteLength(str string, params ...string) bool {
- if len(params) == 2 {
- min, _ := ToInt(params[0])
- max, _ := ToInt(params[1])
- return len(str) >= int(min) && len(str) <= int(max)
- }
-
- return false
-}
-
-// RuneLength checks string's length
-// Alias for StringLength
-func RuneLength(str string, params ...string) bool {
- return StringLength(str, params...)
-}
-
-// IsRsaPub checks whether string is valid RSA key
-// Alias for IsRsaPublicKey
-func IsRsaPub(str string, params ...string) bool {
- if len(params) == 1 {
- len, _ := ToInt(params[0])
- return IsRsaPublicKey(str, int(len))
- }
-
- return false
-}
-
-// StringMatches checks if a string matches a given pattern.
-func StringMatches(s string, params ...string) bool {
- if len(params) == 1 {
- pattern := params[0]
- return Matches(s, pattern)
- }
- return false
-}
-
-// StringLength checks string's length (including multi byte strings)
-func StringLength(str string, params ...string) bool {
-
- if len(params) == 2 {
- strLength := utf8.RuneCountInString(str)
- min, _ := ToInt(params[0])
- max, _ := ToInt(params[1])
- return strLength >= int(min) && strLength <= int(max)
- }
-
- return false
-}
-
-// MinStringLength checks string's minimum length (including multi byte strings)
-func MinStringLength(str string, params ...string) bool {
-
- if len(params) == 1 {
- strLength := utf8.RuneCountInString(str)
- min, _ := ToInt(params[0])
- return strLength >= int(min)
- }
-
- return false
-}
-
-// MaxStringLength checks string's maximum length (including multi byte strings)
-func MaxStringLength(str string, params ...string) bool {
-
- if len(params) == 1 {
- strLength := utf8.RuneCountInString(str)
- max, _ := ToInt(params[0])
- return strLength <= int(max)
- }
-
- return false
-}
-
-// Range checks string's length
-func Range(str string, params ...string) bool {
- if len(params) == 2 {
- value, _ := ToFloat(str)
- min, _ := ToFloat(params[0])
- max, _ := ToFloat(params[1])
- return InRange(value, min, max)
- }
-
- return false
-}
-
-// IsInRaw checks if string is in list of allowed values
-func IsInRaw(str string, params ...string) bool {
- if len(params) == 1 {
- rawParams := params[0]
-
- parsedParams := strings.Split(rawParams, "|")
-
- return IsIn(str, parsedParams...)
- }
-
- return false
-}
-
-// IsIn checks if string str is a member of the set of strings params
-func IsIn(str string, params ...string) bool {
- for _, param := range params {
- if str == param {
- return true
- }
- }
-
- return false
-}
-
-func checkRequired(v reflect.Value, t reflect.StructField, options tagOptionsMap) (bool, error) {
- if nilPtrAllowedByRequired {
- k := v.Kind()
- if (k == reflect.Ptr || k == reflect.Interface) && v.IsNil() {
- return true, nil
- }
- }
-
- if requiredOption, isRequired := options["required"]; isRequired {
- if len(requiredOption.customErrorMessage) > 0 {
- return false, Error{t.Name, fmt.Errorf(requiredOption.customErrorMessage), true, "required", []string{}}
- }
- return false, Error{t.Name, fmt.Errorf("non zero value required"), false, "required", []string{}}
- } else if _, isOptional := options["optional"]; fieldsRequiredByDefault && !isOptional {
- return false, Error{t.Name, fmt.Errorf("Missing required field"), false, "required", []string{}}
- }
- // not required and empty is valid
- return true, nil
-}
-
-func typeCheck(v reflect.Value, t reflect.StructField, o reflect.Value, options tagOptionsMap) (isValid bool, resultErr error) {
- if !v.IsValid() {
- return false, nil
- }
-
- tag := t.Tag.Get(tagName)
-
- // checks if the field should be ignored
- switch tag {
- case "":
- if v.Kind() != reflect.Slice && v.Kind() != reflect.Map {
- if !fieldsRequiredByDefault {
- return true, nil
- }
- return false, Error{t.Name, fmt.Errorf("All fields are required to at least have one validation defined"), false, "required", []string{}}
- }
- case "-":
- return true, nil
- }
-
- isRootType := false
- if options == nil {
- isRootType = true
- options = parseTagIntoMap(tag)
- }
-
- if isEmptyValue(v) {
- // an empty value is not validated, checks only required
- isValid, resultErr = checkRequired(v, t, options)
- for key := range options {
- delete(options, key)
- }
- return isValid, resultErr
- }
-
- var customTypeErrors Errors
- optionsOrder := options.orderedKeys()
- for _, validatorName := range optionsOrder {
- validatorStruct := options[validatorName]
- if validatefunc, ok := CustomTypeTagMap.Get(validatorName); ok {
- delete(options, validatorName)
-
- if result := validatefunc(v.Interface(), o.Interface()); !result {
- if len(validatorStruct.customErrorMessage) > 0 {
- customTypeErrors = append(customTypeErrors, Error{Name: t.Name, Err: TruncatingErrorf(validatorStruct.customErrorMessage, fmt.Sprint(v), validatorName), CustomErrorMessageExists: true, Validator: stripParams(validatorName)})
- continue
- }
- customTypeErrors = append(customTypeErrors, Error{Name: t.Name, Err: fmt.Errorf("%s does not validate as %s", fmt.Sprint(v), validatorName), CustomErrorMessageExists: false, Validator: stripParams(validatorName)})
- }
- }
- }
-
- if len(customTypeErrors.Errors()) > 0 {
- return false, customTypeErrors
- }
-
- if isRootType {
- // Ensure that we've checked the value by all specified validators before report that the value is valid
- defer func() {
- delete(options, "optional")
- delete(options, "required")
-
- if isValid && resultErr == nil && len(options) != 0 {
- optionsOrder := options.orderedKeys()
- for _, validator := range optionsOrder {
- isValid = false
- resultErr = Error{t.Name, fmt.Errorf(
- "The following validator is invalid or can't be applied to the field: %q", validator), false, stripParams(validator), []string{}}
- return
- }
- }
- }()
- }
-
- for _, validatorSpec := range optionsOrder {
- validatorStruct := options[validatorSpec]
- var negate bool
- validator := validatorSpec
- customMsgExists := len(validatorStruct.customErrorMessage) > 0
-
- // checks whether the tag looks like '!something' or 'something'
- if validator[0] == '!' {
- validator = validator[1:]
- negate = true
- }
-
- // checks for interface param validators
- for key, value := range InterfaceParamTagRegexMap {
- ps := value.FindStringSubmatch(validator)
- if len(ps) == 0 {
- continue
- }
-
- validatefunc, ok := InterfaceParamTagMap[key]
- if !ok {
- continue
- }
-
- delete(options, validatorSpec)
-
- field := fmt.Sprint(v)
- if result := validatefunc(v.Interface(), ps[1:]...); (!result && !negate) || (result && negate) {
- if customMsgExists {
- return false, Error{t.Name, TruncatingErrorf(validatorStruct.customErrorMessage, field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
- }
- if negate {
- return false, Error{t.Name, fmt.Errorf("%s does validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
- }
- return false, Error{t.Name, fmt.Errorf("%s does not validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
- }
- }
- }
-
- switch v.Kind() {
- case reflect.Bool,
- 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,
- reflect.String:
- // for each tag option checks the map of validator functions
- for _, validatorSpec := range optionsOrder {
- validatorStruct := options[validatorSpec]
- var negate bool
- validator := validatorSpec
- customMsgExists := len(validatorStruct.customErrorMessage) > 0
-
- // checks whether the tag looks like '!something' or 'something'
- if validator[0] == '!' {
- validator = validator[1:]
- negate = true
- }
-
- // checks for param validators
- for key, value := range ParamTagRegexMap {
- ps := value.FindStringSubmatch(validator)
- if len(ps) == 0 {
- continue
- }
-
- validatefunc, ok := ParamTagMap[key]
- if !ok {
- continue
- }
-
- delete(options, validatorSpec)
-
- switch v.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.Float32, reflect.Float64:
-
- field := fmt.Sprint(v) // make value into string, then validate with regex
- if result := validatefunc(field, ps[1:]...); (!result && !negate) || (result && negate) {
- if customMsgExists {
- return false, Error{t.Name, TruncatingErrorf(validatorStruct.customErrorMessage, field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
- }
- if negate {
- return false, Error{t.Name, fmt.Errorf("%s does validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
- }
- return false, Error{t.Name, fmt.Errorf("%s does not validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
- }
- default:
- // type not yet supported, fail
- return false, Error{t.Name, fmt.Errorf("Validator %s doesn't support kind %s", validator, v.Kind()), false, stripParams(validatorSpec), []string{}}
- }
- }
-
- if validatefunc, ok := TagMap[validator]; ok {
- delete(options, validatorSpec)
-
- switch v.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.Float32, reflect.Float64:
- field := fmt.Sprint(v) // make value into string, then validate with regex
- if result := validatefunc(field); !result && !negate || result && negate {
- if customMsgExists {
- return false, Error{t.Name, TruncatingErrorf(validatorStruct.customErrorMessage, field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
- }
- if negate {
- return false, Error{t.Name, fmt.Errorf("%s does validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
- }
- return false, Error{t.Name, fmt.Errorf("%s does not validate as %s", field, validator), customMsgExists, stripParams(validatorSpec), []string{}}
- }
- default:
- //Not Yet Supported Types (Fail here!)
- err := fmt.Errorf("Validator %s doesn't support kind %s for value %v", validator, v.Kind(), v)
- return false, Error{t.Name, err, false, stripParams(validatorSpec), []string{}}
- }
- }
- }
- return true, nil
- case reflect.Map:
- if v.Type().Key().Kind() != reflect.String {
- return false, &UnsupportedTypeError{v.Type()}
- }
- var sv stringValues
- sv = v.MapKeys()
- sort.Sort(sv)
- result := true
- for i, k := range sv {
- var resultItem bool
- var err error
- if v.MapIndex(k).Kind() != reflect.Struct {
- resultItem, err = typeCheck(v.MapIndex(k), t, o, options)
- if err != nil {
- return false, err
- }
- } else {
- resultItem, err = ValidateStruct(v.MapIndex(k).Interface())
- if err != nil {
- err = prependPathToErrors(err, t.Name+"."+sv[i].Interface().(string))
- return false, err
- }
- }
- result = result && resultItem
- }
- return result, nil
- case reflect.Slice, reflect.Array:
- result := true
- for i := 0; i < v.Len(); i++ {
- var resultItem bool
- var err error
- if v.Index(i).Kind() != reflect.Struct {
- resultItem, err = typeCheck(v.Index(i), t, o, options)
- if err != nil {
- return false, err
- }
- } else {
- resultItem, err = ValidateStruct(v.Index(i).Interface())
- if err != nil {
- err = prependPathToErrors(err, t.Name+"."+strconv.Itoa(i))
- return false, err
- }
- }
- result = result && resultItem
- }
- return result, nil
- case reflect.Interface:
- // If the value is an interface then encode its element
- if v.IsNil() {
- return true, nil
- }
- return ValidateStruct(v.Interface())
- case reflect.Ptr:
- // If the value is a pointer then checks its element
- if v.IsNil() {
- return true, nil
- }
- return typeCheck(v.Elem(), t, o, options)
- case reflect.Struct:
- return true, nil
- default:
- return false, &UnsupportedTypeError{v.Type()}
- }
-}
-
-func stripParams(validatorString string) string {
- return paramsRegexp.ReplaceAllString(validatorString, "")
-}
-
-// isEmptyValue checks whether value empty or not
-func isEmptyValue(v reflect.Value) bool {
- switch v.Kind() {
- case reflect.String, reflect.Array:
- return v.Len() == 0
- case reflect.Map, reflect.Slice:
- return v.Len() == 0 || v.IsNil()
- case reflect.Bool:
- return !v.Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return v.Float() == 0
- case reflect.Interface, reflect.Ptr:
- return v.IsNil()
- }
-
- return reflect.DeepEqual(v.Interface(), reflect.Zero(v.Type()).Interface())
-}
-
-// ErrorByField returns error for specified field of the struct
-// validated by ValidateStruct or empty string if there are no errors
-// or this field doesn't exists or doesn't have any errors.
-func ErrorByField(e error, field string) string {
- if e == nil {
- return ""
- }
- return ErrorsByField(e)[field]
-}
-
-// ErrorsByField returns map of errors of the struct validated
-// by ValidateStruct or empty map if there are no errors.
-func ErrorsByField(e error) map[string]string {
- m := make(map[string]string)
- if e == nil {
- return m
- }
- // prototype for ValidateStruct
-
- switch e := e.(type) {
- case Error:
- m[e.Name] = e.Err.Error()
- case Errors:
- for _, item := range e.Errors() {
- n := ErrorsByField(item)
- for k, v := range n {
- m[k] = v
- }
- }
- }
-
- return m
-}
-
-// Error returns string equivalent for reflect.Type
-func (e *UnsupportedTypeError) Error() string {
- return "validator: unsupported type: " + e.Type.String()
-}
-
-func (sv stringValues) Len() int { return len(sv) }
-func (sv stringValues) Swap(i, j int) { sv[i], sv[j] = sv[j], sv[i] }
-func (sv stringValues) Less(i, j int) bool { return sv.get(i) < sv.get(j) }
-func (sv stringValues) get(i int) string { return sv[i].String() }
-
-func IsE164(str string) bool {
- return rxE164.MatchString(str)
-}
diff --git a/vendor/github.com/asaskevich/govalidator/wercker.yml b/vendor/github.com/asaskevich/govalidator/wercker.yml
deleted file mode 100644
index bc5f7b0864b..00000000000
--- a/vendor/github.com/asaskevich/govalidator/wercker.yml
+++ /dev/null
@@ -1,15 +0,0 @@
-box: golang
-build:
- steps:
- - setup-go-workspace
-
- - script:
- name: go get
- code: |
- go version
- go get -t ./...
-
- - script:
- name: go test
- code: |
- go test -race -v ./...
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/credentials.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/credentials.go
index 4ad2ee4405d..9f94cfe0046 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/aws/credentials.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/credentials.go
@@ -118,6 +118,10 @@ const (
CredentialSourceHTTP
// CredentialSourceIMDS credentials resolved from the instance metadata service (IMDS)
CredentialSourceIMDS
+ // CredentialSourceProfileLogin credentials resolved from an `aws login` session sourced from a profile
+ CredentialSourceProfileLogin
+ // CredentialSourceLogin credentials resolved from an `aws login` session
+ CredentialSourceLogin
)
// A Credentials is the AWS credentials value for individual credential fields.
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go
index 1820ff0fba3..97bc17f4f15 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go
@@ -3,4 +3,4 @@
package aws
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.39.2"
+const goModuleVersion = "1.40.0"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/middleware/user_agent.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/middleware/user_agent.go
index 3314230fd8c..157a71505cd 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/aws/middleware/user_agent.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/middleware/user_agent.go
@@ -137,6 +137,9 @@ const (
UserAgentFeatureCredentialsIMDS = "0"
UserAgentFeatureBearerServiceEnvVars = "3"
+
+ UserAgentFeatureCredentialsProfileLogin = "AC"
+ UserAgentFeatureCredentialsLogin = "AD"
)
var credentialSourceToFeature = map[aws.CredentialSource]UserAgentFeature{
@@ -160,6 +163,8 @@ var credentialSourceToFeature = map[aws.CredentialSource]UserAgentFeature{
aws.CredentialSourceProcess: UserAgentFeatureCredentialsProcess,
aws.CredentialSourceHTTP: UserAgentFeatureCredentialsHTTP,
aws.CredentialSourceIMDS: UserAgentFeatureCredentialsIMDS,
+ aws.CredentialSourceProfileLogin: UserAgentFeatureCredentialsProfileLogin,
+ aws.CredentialSourceLogin: UserAgentFeatureCredentialsLogin,
}
// RequestUserAgent is a build middleware that set the User-Agent for the request.
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/transport/http/timeout_read_closer.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/transport/http/timeout_read_closer.go
index 993929bd9b7..4881ae1445b 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/aws/transport/http/timeout_read_closer.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/transport/http/timeout_read_closer.go
@@ -64,6 +64,11 @@ func (r *timeoutReadCloser) Close() error {
// AddResponseReadTimeoutMiddleware adds a middleware to the stack that wraps the
// response body so that a read that takes too long will return an error.
+//
+// Deprecated: This API was previously exposed to customize behavior of the
+// Kinesis service. That customization has been removed and this middleware's
+// implementation can cause panics within the standard library networking loop.
+// See #2752.
func AddResponseReadTimeoutMiddleware(stack *middleware.Stack, duration time.Duration) error {
return stack.Deserialize.Add(&readTimeout{duration: duration}, middleware.After)
}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md
index 526537b8bb7..01537d92a29 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md
+++ b/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md
@@ -1,3 +1,46 @@
+# v1.32.0 (2025-11-19.2)
+
+* **Feature**: Add support for AWS Login credentials (package credentials/logincreds) to the default credential chain.
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.31.21 (2025-11-19)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.31.20 (2025-11-12)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.31.19 (2025-11-11)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.31.18 (2025-11-10)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.31.17 (2025-11-04)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+* **Dependency Update**: Upgrade to smithy-go v1.23.2 which should convey some passive reduction of overall allocations, especially when not using the metrics system.
+
+# v1.31.16 (2025-10-30)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.31.15 (2025-10-23)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.31.14 (2025-10-22)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.31.13 (2025-10-16)
+
+* **Dependency Update**: Bump minimum Go version to 1.23.
+* **Dependency Update**: Updated to the latest SDK module versions
+
# v1.31.12 (2025-09-29)
* **Dependency Update**: Updated to the latest SDK module versions
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go
index 8274236780f..234ba373fc1 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go
@@ -3,4 +3,4 @@
package config
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.31.12"
+const goModuleVersion = "1.32.0"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/config/resolve_credentials.go b/vendor/github.com/aws/aws-sdk-go-v2/config/resolve_credentials.go
index b00259df03a..de839859991 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/config/resolve_credentials.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/config/resolve_credentials.go
@@ -13,10 +13,12 @@ import (
"github.com/aws/aws-sdk-go-v2/credentials"
"github.com/aws/aws-sdk-go-v2/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go-v2/credentials/endpointcreds"
+ "github.com/aws/aws-sdk-go-v2/credentials/logincreds"
"github.com/aws/aws-sdk-go-v2/credentials/processcreds"
"github.com/aws/aws-sdk-go-v2/credentials/ssocreds"
"github.com/aws/aws-sdk-go-v2/credentials/stscreds"
"github.com/aws/aws-sdk-go-v2/feature/ec2/imds"
+ "github.com/aws/aws-sdk-go-v2/service/signin"
"github.com/aws/aws-sdk-go-v2/service/sso"
"github.com/aws/aws-sdk-go-v2/service/ssooidc"
"github.com/aws/aws-sdk-go-v2/service/sts"
@@ -172,7 +174,10 @@ func resolveCredsFromProfile(ctx context.Context, cfg *aws.Config, envConfig *En
ctx = addCredentialSource(ctx, aws.CredentialSourceProfileSSO)
}
err = resolveSSOCredentials(ctx, cfg, sharedConfig, configs)
-
+ case len(sharedConfig.LoginSession) > 0:
+ ctx = addCredentialSource(ctx, aws.CredentialSourceProfileLogin)
+ ctx = addCredentialSource(ctx, aws.CredentialSourceLogin)
+ err = resolveLoginCredentials(ctx, cfg, sharedConfig, configs)
case len(sharedConfig.CredentialProcess) != 0:
// Get credentials from CredentialProcess
ctx = addCredentialSource(ctx, aws.CredentialSourceProfileProcess)
@@ -625,3 +630,21 @@ func addCredentialSource(ctx context.Context, source aws.CredentialSource) conte
func getCredentialSources(ctx context.Context) []aws.CredentialSource {
return ctx.Value(credentialSource{}).([]aws.CredentialSource)
}
+
+func resolveLoginCredentials(ctx context.Context, cfg *aws.Config, sharedCfg *SharedConfig, configs configs) error {
+ cacheDir := os.Getenv("AWS_LOGIN_CACHE_DIRECTORY")
+ tokenPath, err := logincreds.StandardCachedTokenFilepath(sharedCfg.LoginSession, cacheDir)
+ if err != nil {
+ return err
+ }
+
+ svc := signin.NewFromConfig(*cfg)
+ provider := logincreds.New(svc, tokenPath, func(o *logincreds.Options) {
+ o.CredentialSources = getCredentialSources(ctx)
+ })
+ cfg.Credentials, err = wrapWithCredentialsCache(ctx, configs, provider)
+ if err != nil {
+ return err
+ }
+ return nil
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/config/shared_config.go b/vendor/github.com/aws/aws-sdk-go-v2/config/shared_config.go
index 97be3f75694..5a0fea22200 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/config/shared_config.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/config/shared_config.go
@@ -125,6 +125,8 @@ const (
checksumWhenRequired = "when_required"
authSchemePreferenceKey = "auth_scheme_preference"
+
+ loginSessionKey = "login_session"
)
// defaultSharedConfigProfile allows for swapping the default profile for testing
@@ -362,6 +364,9 @@ type SharedConfig struct {
// Priority list of preferred auth scheme names (e.g. sigv4a).
AuthSchemePreference []string
+
+ // Session ARN from an `aws login` session.
+ LoginSession string
}
func (c SharedConfig) getDefaultsMode(ctx context.Context) (value aws.DefaultsMode, ok bool, err error) {
@@ -897,6 +902,8 @@ func mergeSections(dst *ini.Sections, src ini.Sections) error {
ssoStartURLKey,
authSchemePreferenceKey,
+
+ loginSessionKey,
}
for i := range stringKeys {
if err := mergeStringKey(&srcSection, &dstSection, sectionName, stringKeys[i]); err != nil {
@@ -1175,6 +1182,8 @@ func (c *SharedConfig) setFromIniSection(profile string, section ini.Section) er
c.AuthSchemePreference = toAuthSchemePreferenceList(section.String(authSchemePreferenceKey))
+ updateString(&c.LoginSession, section, loginSessionKey)
+
return nil
}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md
index 015f24d3be7..7096ecb747c 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md
+++ b/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md
@@ -1,3 +1,46 @@
+# v1.19.0 (2025-11-19.2)
+
+* **Feature**: Add support for AWS Login credentials (package credentials/logincreds) to the default credential chain.
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.18.25 (2025-11-19)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.18.24 (2025-11-12)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.18.23 (2025-11-11)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.18.22 (2025-11-10)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.18.21 (2025-11-04)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+* **Dependency Update**: Upgrade to smithy-go v1.23.2 which should convey some passive reduction of overall allocations, especially when not using the metrics system.
+
+# v1.18.20 (2025-10-30)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.18.19 (2025-10-23)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.18.18 (2025-10-22)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.18.17 (2025-10-16)
+
+* **Dependency Update**: Bump minimum Go version to 1.23.
+* **Dependency Update**: Updated to the latest SDK module versions
+
# v1.18.16 (2025-09-29)
* **Dependency Update**: Updated to the latest SDK module versions
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go
index 03357b7603e..f21942dfb41 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go
@@ -3,4 +3,4 @@
package credentials
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.18.16"
+const goModuleVersion = "1.19.0"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/credentials/logincreds/dpop.go b/vendor/github.com/aws/aws-sdk-go-v2/credentials/logincreds/dpop.go
new file mode 100644
index 00000000000..6dc0845fdfd
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/credentials/logincreds/dpop.go
@@ -0,0 +1,150 @@
+package logincreds
+
+import (
+ "context"
+ "crypto/ecdsa"
+ cryptorand "crypto/rand"
+ "crypto/sha256"
+ "crypto/x509"
+ "encoding/base64"
+ "encoding/json"
+ "encoding/pem"
+ "fmt"
+
+ "github.com/aws/aws-sdk-go-v2/internal/sdk"
+ "github.com/aws/aws-sdk-go-v2/service/signin"
+ "github.com/aws/smithy-go/middleware"
+ smithyrand "github.com/aws/smithy-go/rand"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+)
+
+// AWS signin DPOP always uses the P256 curve
+const curvelen = 256 / 8 // bytes
+
+// https://datatracker.ietf.org/doc/html/rfc9449
+func mkdpop(token *loginToken, htu string) (string, error) {
+ key, err := parseKey(token.DPOPKey)
+ if err != nil {
+ return "", fmt.Errorf("parse key: %w", err)
+ }
+
+ header, err := jsonb64(&dpopHeader{
+ Typ: "dpop+jwt",
+ Alg: "ES256",
+ Jwk: &dpopHeaderJwk{
+ Kty: "EC",
+ X: base64.RawURLEncoding.EncodeToString(key.X.Bytes()),
+ Y: base64.RawURLEncoding.EncodeToString(key.Y.Bytes()),
+ Crv: "P-256",
+ },
+ })
+ if err != nil {
+ return "", fmt.Errorf("marshal header: %w", err)
+ }
+
+ uuid, err := smithyrand.NewUUID(cryptorand.Reader).GetUUID()
+ if err != nil {
+ return "", fmt.Errorf("uuid: %w", err)
+ }
+
+ payload, err := jsonb64(&dpopPayload{
+ Jti: uuid,
+ Htm: "POST",
+ Htu: htu,
+ Iat: sdk.NowTime().Unix(),
+ })
+ if err != nil {
+ return "", fmt.Errorf("marshal payload: %w", err)
+ }
+
+ msg := fmt.Sprintf("%s.%s", header, payload)
+
+ h := sha256.New()
+ h.Write([]byte(msg))
+
+ r, s, err := ecdsa.Sign(cryptorand.Reader, key, h.Sum(nil))
+ if err != nil {
+ return "", fmt.Errorf("sign: %w", err)
+ }
+
+ // DPOP signatures are formatted in RAW r || s form (with each value padded
+ // to fit in curve size which in our case is always the 256 bits) - rather
+ // than encoded in something like asn.1
+ sig := make([]byte, curvelen*2)
+ r.FillBytes(sig[0:curvelen])
+ s.FillBytes(sig[curvelen:])
+
+ dpop := fmt.Sprintf("%s.%s", msg, base64.RawURLEncoding.EncodeToString(sig))
+ return dpop, nil
+}
+
+func parseKey(pemBlock string) (*ecdsa.PrivateKey, error) {
+ block, _ := pem.Decode([]byte(pemBlock))
+ priv, err := x509.ParseECPrivateKey(block.Bytes)
+ if err != nil {
+ return nil, fmt.Errorf("parse ec private key: %w", err)
+ }
+
+ return priv, nil
+}
+
+func jsonb64(v any) (string, error) {
+ j, err := json.MarshalIndent(v, "", " ")
+ if err != nil {
+ return "", err
+ }
+
+ return base64.RawURLEncoding.EncodeToString(j), nil
+}
+
+type dpopHeader struct {
+ Typ string `json:"typ"`
+ Alg string `json:"alg"`
+ Jwk *dpopHeaderJwk `json:"jwk"`
+}
+
+type dpopHeaderJwk struct {
+ Kty string `json:"kty"`
+ X string `json:"x"`
+ Y string `json:"y"`
+ Crv string `json:"crv"`
+}
+
+type dpopPayload struct {
+ Jti string `json:"jti"`
+ Htm string `json:"htm"`
+ Htu string `json:"htu"`
+ Iat int64 `json:"iat"`
+}
+
+type signDPOP struct {
+ Token *loginToken
+}
+
+func addSignDPOP(token *loginToken) func(o *signin.Options) {
+ return signin.WithAPIOptions(func(stack *middleware.Stack) error {
+ return stack.Finalize.Add(&signDPOP{token}, middleware.After)
+ })
+}
+
+func (*signDPOP) ID() string {
+ return "signDPOP"
+}
+
+func (m *signDPOP) HandleFinalize(
+ ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
+ out middleware.FinalizeOutput, md middleware.Metadata, err error,
+) {
+ req, ok := in.Request.(*smithyhttp.Request)
+ if !ok {
+ return out, md, fmt.Errorf("unexpected transport type %T", req)
+ }
+
+ dpop, err := mkdpop(m.Token, req.URL.String())
+ if err != nil {
+ return out, md, fmt.Errorf("sign dpop: %w", err)
+ }
+
+ req.Header.Set("DPoP", dpop)
+ return next.HandleFinalize(ctx, in)
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/credentials/logincreds/file.go b/vendor/github.com/aws/aws-sdk-go-v2/credentials/logincreds/file.go
new file mode 100644
index 00000000000..6cd5281d49f
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/credentials/logincreds/file.go
@@ -0,0 +1,14 @@
+package logincreds
+
+import (
+ "io"
+ "os"
+)
+
+var openFile func(string) (io.ReadCloser, error) = func(name string) (io.ReadCloser, error) {
+ return os.Open(name)
+}
+
+var createFile func(string) (io.WriteCloser, error) = func(name string) (io.WriteCloser, error) {
+ return os.Create(name)
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/credentials/logincreds/provider.go b/vendor/github.com/aws/aws-sdk-go-v2/credentials/logincreds/provider.go
new file mode 100644
index 00000000000..3e6357b87c7
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/credentials/logincreds/provider.go
@@ -0,0 +1,172 @@
+// Package logincreds implements AWS credential provision for sessions created
+// via an `aws login` command.
+package logincreds
+
+import (
+ "context"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io"
+ "os"
+
+ "github.com/aws/aws-sdk-go-v2/aws"
+ "github.com/aws/aws-sdk-go-v2/internal/sdk"
+ "github.com/aws/aws-sdk-go-v2/service/signin"
+ "github.com/aws/aws-sdk-go-v2/service/signin/types"
+)
+
+// ProviderName identifies the login provider.
+const ProviderName = "LoginProvider"
+
+// TokenAPIClient provides the interface for the login session's token
+// retrieval operation.
+type TokenAPIClient interface {
+ CreateOAuth2Token(context.Context, *signin.CreateOAuth2TokenInput, ...func(*signin.Options)) (*signin.CreateOAuth2TokenOutput, error)
+}
+
+// Provider supplies credentials for an `aws login` session.
+type Provider struct {
+ options Options
+}
+
+var _ aws.CredentialsProvider = (*Provider)(nil)
+
+// Options configures the Provider.
+type Options struct {
+ Client TokenAPIClient
+
+ // APIOptions to pass to the underlying CreateOAuth2Token operation.
+ ClientOptions []func(*signin.Options)
+
+ // The path to the cached login token.
+ CachedTokenFilepath string
+
+ // The chain of providers that was used to create this provider.
+ //
+ // These values are for reporting purposes and are not meant to be set up
+ // directly.
+ CredentialSources []aws.CredentialSource
+}
+
+// New returns a new login session credentials provider.
+func New(client TokenAPIClient, path string, opts ...func(*Options)) *Provider {
+ options := Options{
+ Client: client,
+ CachedTokenFilepath: path,
+ }
+
+ for _, opt := range opts {
+ opt(&options)
+ }
+
+ return &Provider{options}
+}
+
+// Retrieve generates a new set of temporary credentials using an `aws login`
+// session.
+func (p *Provider) Retrieve(ctx context.Context) (aws.Credentials, error) {
+ token, err := p.loadToken()
+ if err != nil {
+ return aws.Credentials{}, fmt.Errorf("load login token: %w", err)
+ }
+ if err := token.Validate(); err != nil {
+ return aws.Credentials{}, fmt.Errorf("validate login token: %w", err)
+ }
+
+ // the token may have been refreshed elsewhere or the login session might
+ // have just been created
+ if sdk.NowTime().Before(token.AccessToken.ExpiresAt) {
+ return token.Credentials(), nil
+ }
+
+ opts := make([]func(*signin.Options), len(p.options.ClientOptions)+1)
+ opts[0] = addSignDPOP(token)
+ copy(opts[1:], p.options.ClientOptions)
+
+ out, err := p.options.Client.CreateOAuth2Token(ctx, &signin.CreateOAuth2TokenInput{
+ TokenInput: &types.CreateOAuth2TokenRequestBody{
+ ClientId: aws.String(token.ClientID),
+ GrantType: aws.String("refresh_token"),
+ RefreshToken: aws.String(token.RefreshToken),
+ },
+ }, opts...)
+ if err != nil {
+ var terr *types.AccessDeniedException
+ if errors.As(err, &terr) {
+ err = toAccessDeniedError(terr)
+ }
+ return aws.Credentials{}, fmt.Errorf("create oauth2 token: %w", err)
+ }
+
+ token.Update(out)
+ if err := p.saveToken(token); err != nil {
+ return aws.Credentials{}, fmt.Errorf("save token: %w", err)
+ }
+
+ return token.Credentials(), nil
+}
+
+// ProviderSources returns the credential chain that was used to construct this
+// provider.
+func (p *Provider) ProviderSources() []aws.CredentialSource {
+ if p.options.CredentialSources == nil {
+ return []aws.CredentialSource{aws.CredentialSourceLogin}
+ }
+ return p.options.CredentialSources
+}
+
+func (p *Provider) loadToken() (*loginToken, error) {
+ f, err := openFile(p.options.CachedTokenFilepath)
+ if err != nil && os.IsNotExist(err) {
+ return nil, fmt.Errorf("token file not found, please reauthenticate")
+ }
+ if err != nil {
+ return nil, err
+ }
+ defer f.Close()
+
+ j, err := io.ReadAll(f)
+ if err != nil {
+ return nil, err
+ }
+
+ var t *loginToken
+ if err := json.Unmarshal(j, &t); err != nil {
+ return nil, err
+ }
+
+ return t, nil
+}
+
+func (p *Provider) saveToken(token *loginToken) error {
+ j, err := json.Marshal(token)
+ if err != nil {
+ return err
+ }
+
+ f, err := createFile(p.options.CachedTokenFilepath)
+ if err != nil {
+ return err
+ }
+ defer f.Close()
+
+ if _, err := f.Write(j); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func toAccessDeniedError(err *types.AccessDeniedException) error {
+ switch err.Error_ {
+ case types.OAuth2ErrorCodeTokenExpired:
+ return fmt.Errorf("login session has expired, please reauthenticate")
+ case types.OAuth2ErrorCodeUserCredentialsChanged:
+ return fmt.Errorf("login session password has changed, please reauthenticate")
+ case types.OAuth2ErrorCodeInsufficientPermissions:
+ return fmt.Errorf("insufficient permissions, you may be missing permissions for the CreateOAuth2Token action")
+ default:
+ return err
+ }
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/credentials/logincreds/token.go b/vendor/github.com/aws/aws-sdk-go-v2/credentials/logincreds/token.go
new file mode 100644
index 00000000000..1a97b98cdc2
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/credentials/logincreds/token.go
@@ -0,0 +1,110 @@
+package logincreds
+
+import (
+ "crypto/sha256"
+ "encoding/hex"
+ "errors"
+ "fmt"
+ "path/filepath"
+ "strings"
+ "time"
+
+ "github.com/aws/aws-sdk-go-v2/aws"
+ "github.com/aws/aws-sdk-go-v2/internal/sdk"
+ "github.com/aws/aws-sdk-go-v2/internal/shareddefaults"
+ "github.com/aws/aws-sdk-go-v2/service/signin"
+)
+
+var userHomeDir = shareddefaults.UserHomeDir
+
+// StandardCachedTokenFilepath returns the filepath for the cached login token
+// file. Key that will be used to compute a SHA256 value that is hex encoded.
+//
+// An overriden root dir can be provided, if not set the path defaults to
+// ~/.aws/sso/cache.
+func StandardCachedTokenFilepath(session, dir string) (string, error) {
+ session = strings.TrimSpace(session)
+
+ if len(dir) == 0 {
+ dir = userHomeDir()
+ if len(dir) == 0 {
+ return "", errors.New("user home dir is blank")
+ }
+ dir = filepath.Join(dir, ".aws", "login", "cache")
+ }
+
+ h := sha256.New()
+ h.Write([]byte(session))
+
+ filename := strings.ToLower(hex.EncodeToString(h.Sum(nil))) + ".json"
+ return filepath.Join(dir, filename), nil
+}
+
+// contents of the token as they appear on disk
+type loginToken struct {
+ AccessToken *loginTokenAccessToken `json:"accessToken"`
+ TokenType string `json:"tokenType"`
+ RefreshToken string `json:"refreshToken"`
+ IdentityToken string `json:"identityToken"`
+ ClientID string `json:"clientId"`
+ DPOPKey string `json:"dpopKey"`
+}
+
+type loginTokenAccessToken struct {
+ AccessKeyID string `json:"accessKeyId"`
+ SecretAccessKey string `json:"secretAccessKey"`
+ SessionToken string `json:"sessionToken"`
+ AccountID string `json:"accountId"`
+ ExpiresAt time.Time `json:"expiresAt"`
+}
+
+func (t *loginToken) Validate() error {
+ if t.AccessToken == nil {
+ return fmt.Errorf("missing accessToken")
+ }
+ if t.AccessToken.AccessKeyID == "" {
+ return fmt.Errorf("missing accessToken.accessKeyId")
+ }
+ if t.AccessToken.SecretAccessKey == "" {
+ return fmt.Errorf("missing accessToken.secretAccessKey")
+ }
+ if t.AccessToken.SessionToken == "" {
+ return fmt.Errorf("missing accessToken.sessionToken")
+ }
+ if t.AccessToken.AccountID == "" {
+ return fmt.Errorf("missing accessToken.accountId")
+ }
+ if t.AccessToken.ExpiresAt.IsZero() {
+ return fmt.Errorf("missing accessToken.expiresAt")
+ }
+ if t.ClientID == "" {
+ return fmt.Errorf("missing clientId")
+ }
+ if t.RefreshToken == "" {
+ return fmt.Errorf("missing refreshToken")
+ }
+ if t.DPOPKey == "" {
+ return fmt.Errorf("missing dpopKey")
+ }
+ return nil
+}
+
+func (t *loginToken) Credentials() aws.Credentials {
+ return aws.Credentials{
+ AccessKeyID: t.AccessToken.AccessKeyID,
+ SecretAccessKey: t.AccessToken.SecretAccessKey,
+ SessionToken: t.AccessToken.SessionToken,
+ Source: ProviderName,
+ CanExpire: true,
+ Expires: t.AccessToken.ExpiresAt,
+ AccountID: t.AccessToken.AccountID,
+ }
+}
+
+func (t *loginToken) Update(out *signin.CreateOAuth2TokenOutput) {
+ t.AccessToken.AccessKeyID = *out.TokenOutput.AccessToken.AccessKeyId
+ t.AccessToken.SecretAccessKey = *out.TokenOutput.AccessToken.SecretAccessKey
+ t.AccessToken.SessionToken = *out.TokenOutput.AccessToken.SessionToken
+ t.AccessToken.ExpiresAt = sdk.NowTime().Add(time.Duration(*out.TokenOutput.ExpiresIn) * time.Second)
+ t.RefreshToken = *out.TokenOutput.RefreshToken
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md
index 6b8c454739d..1797e1d6653 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md
+++ b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md
@@ -1,3 +1,25 @@
+# v1.18.14 (2025-11-19.2)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.18.13 (2025-11-04)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+* **Dependency Update**: Upgrade to smithy-go v1.23.2 which should convey some passive reduction of overall allocations, especially when not using the metrics system.
+
+# v1.18.12 (2025-10-30)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.18.11 (2025-10-23)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.18.10 (2025-10-16)
+
+* **Dependency Update**: Bump minimum Go version to 1.23.
+* **Dependency Update**: Updated to the latest SDK module versions
+
# v1.18.9 (2025-09-26)
* **Dependency Update**: Updated to the latest SDK module versions
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go
index ce89f5829de..b763617b45a 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go
@@ -3,4 +3,4 @@
package imds
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.18.9"
+const goModuleVersion = "1.18.14"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md
index b34f47c9151..afcfb2cfdbd 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md
+++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md
@@ -1,3 +1,25 @@
+# v1.4.14 (2025-11-19.2)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.4.13 (2025-11-04)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+* **Dependency Update**: Upgrade to smithy-go v1.23.2 which should convey some passive reduction of overall allocations, especially when not using the metrics system.
+
+# v1.4.12 (2025-10-30)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.4.11 (2025-10-23)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.4.10 (2025-10-16)
+
+* **Dependency Update**: Bump minimum Go version to 1.23.
+* **Dependency Update**: Updated to the latest SDK module versions
+
# v1.4.9 (2025-09-26)
* **Dependency Update**: Updated to the latest SDK module versions
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go
index ebc2f6a7651..816dad7453d 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go
@@ -3,4 +3,4 @@
package configsources
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.4.9"
+const goModuleVersion = "1.4.14"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/partitions.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/partitions.go
index 6ad5df64691..6ab4d9669fb 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/partitions.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/partitions.go
@@ -386,6 +386,13 @@ var partitions = []Partition{
SupportsFIPS: nil,
SupportsDualStack: nil,
},
+ "us-isob-west-1": {
+ Name: nil,
+ DnsSuffix: nil,
+ DualStackDnsSuffix: nil,
+ SupportsFIPS: nil,
+ SupportsDualStack: nil,
+ },
},
},
{
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/partitions.json b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/partitions.json
index b346b0be9b9..c789264d2b0 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/partitions.json
+++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn/partitions.json
@@ -194,6 +194,9 @@
},
"us-isob-east-1" : {
"description" : "US ISOB East (Ohio)"
+ },
+ "us-isob-west-1" : {
+ "description" : "US ISOB West"
}
}
}, {
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md
index 8de3bfec8c7..caa16de3b37 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md
+++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md
@@ -1,3 +1,25 @@
+# v2.7.14 (2025-11-19.2)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v2.7.13 (2025-11-04)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+* **Dependency Update**: Upgrade to smithy-go v1.23.2 which should convey some passive reduction of overall allocations, especially when not using the metrics system.
+
+# v2.7.12 (2025-10-30)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v2.7.11 (2025-10-23)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v2.7.10 (2025-10-16)
+
+* **Dependency Update**: Bump minimum Go version to 1.23.
+* **Dependency Update**: Updated to the latest SDK module versions
+
# v2.7.9 (2025-09-26)
* **Dependency Update**: Updated to the latest SDK module versions
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go
index c5168da33a3..0606394d49e 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go
@@ -3,4 +3,4 @@
package endpoints
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "2.7.9"
+const goModuleVersion = "2.7.14"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/CHANGELOG.md
index f729db535b7..4791d328c04 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/CHANGELOG.md
+++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/CHANGELOG.md
@@ -1,3 +1,7 @@
+# v1.8.4 (2025-10-16)
+
+* **Dependency Update**: Bump minimum Go version to 1.23.
+
# v1.8.3 (2025-02-18)
* **Bug Fix**: Bump go version to 1.22
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/go_module_metadata.go
index 00df0e3cb9b..f94970e7742 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/go_module_metadata.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/ini/go_module_metadata.go
@@ -3,4 +3,4 @@
package ini
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.8.3"
+const goModuleVersion = "1.8.4"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/CHANGELOG.md
index 815e1331b7d..07982ad22e0 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/CHANGELOG.md
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/CHANGELOG.md
@@ -1,3 +1,67 @@
+# v1.53.1 (2025-11-19.2)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.53.0 (2025-11-19)
+
+* **Feature**: Extended Global Secondary Index (GSI) composite keys to support up to 8 attributes.
+
+# v1.52.6 (2025-11-12)
+
+* **Bug Fix**: Further reduce allocation overhead when the metrics system isn't in-use.
+* **Bug Fix**: Reduce allocation overhead when the client doesn't have any HTTP interceptors configured.
+* **Bug Fix**: Remove blank trace spans towards the beginning of the request that added no additional information. This conveys a slight reduction in overall allocations.
+
+# v1.52.5 (2025-11-11)
+
+* **Bug Fix**: Return validation error if input region is not a valid host label.
+
+# v1.52.4 (2025-11-04)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+* **Dependency Update**: Upgrade to smithy-go v1.23.2 which should convey some passive reduction of overall allocations, especially when not using the metrics system.
+
+# v1.52.3 (2025-10-30)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.52.2 (2025-10-23)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.52.1 (2025-10-22)
+
+* No change notes available for this release.
+
+# v1.52.0 (2025-10-21)
+
+* **Feature**: Add AccountID based endpoint metric to endpoint rules.
+
+# v1.51.1 (2025-10-16)
+
+* **Dependency Update**: Bump minimum Go version to 1.23.
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.51.0 (2025-10-02)
+
+* **Feature**: Add support for dual-stack account endpoint generation
+
+# v1.50.5 (2025-09-26)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.50.4 (2025-09-23)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.50.3 (2025-09-10)
+
+* No change notes available for this release.
+
+# v1.50.2 (2025-09-08)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
# v1.50.1 (2025-08-29)
* **Dependency Update**: Updated to the latest SDK module versions
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_client.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_client.go
index 487c8200a6a..8ddfebeaf5f 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_client.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_client.go
@@ -72,7 +72,12 @@ func timeOperationMetric[T any](
ctx context.Context, metric string, fn func() (T, error),
opts ...metrics.RecordMetricOption,
) (T, error) {
- instr := getOperationMetrics(ctx).histogramFor(metric)
+ mm := getOperationMetrics(ctx)
+ if mm == nil { // not using the metrics system
+ return fn()
+ }
+
+ instr := mm.histogramFor(metric)
opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...)
start := time.Now()
@@ -85,7 +90,12 @@ func timeOperationMetric[T any](
}
func startMetricTimer(ctx context.Context, metric string, opts ...metrics.RecordMetricOption) func() {
- instr := getOperationMetrics(ctx).histogramFor(metric)
+ mm := getOperationMetrics(ctx)
+ if mm == nil { // not using the metrics system
+ return func() {}
+ }
+
+ instr := mm.histogramFor(metric)
opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...)
var ended bool
@@ -113,6 +123,12 @@ func withOperationMetadata(ctx context.Context) metrics.RecordMetricOption {
type operationMetricsKey struct{}
func withOperationMetrics(parent context.Context, mp metrics.MeterProvider) (context.Context, error) {
+ if _, ok := mp.(metrics.NopMeterProvider); ok {
+ // not using the metrics system - setting up the metrics context is a memory-intensive operation
+ // so we should skip it in this case
+ return parent, nil
+ }
+
meter := mp.Meter("github.com/aws/aws-sdk-go-v2/service/dynamodb")
om := &operationMetrics{}
@@ -160,7 +176,10 @@ func operationMetricTimer(m metrics.Meter, name, desc string) (metrics.Float64Hi
}
func getOperationMetrics(ctx context.Context) *operationMetrics {
- return ctx.Value(operationMetricsKey{}).(*operationMetrics)
+ if v := ctx.Value(operationMetricsKey{}); v != nil {
+ return v.(*operationMetrics)
+ }
+ return nil
}
func operationTracer(p tracing.TracerProvider) tracing.Tracer {
@@ -1038,138 +1057,49 @@ func addInterceptAttempt(stack *middleware.Stack, opts Options) error {
}, "Retry", middleware.After)
}
-func addInterceptExecution(stack *middleware.Stack, opts Options) error {
- return stack.Initialize.Add(&smithyhttp.InterceptExecution{
- BeforeExecution: opts.Interceptors.BeforeExecution,
- AfterExecution: opts.Interceptors.AfterExecution,
- }, middleware.Before)
-}
-
-func addInterceptBeforeSerialization(stack *middleware.Stack, opts Options) error {
- return stack.Serialize.Insert(&smithyhttp.InterceptBeforeSerialization{
- Interceptors: opts.Interceptors.BeforeSerialization,
- }, "OperationSerializer", middleware.Before)
-}
-
-func addInterceptAfterSerialization(stack *middleware.Stack, opts Options) error {
- return stack.Serialize.Insert(&smithyhttp.InterceptAfterSerialization{
- Interceptors: opts.Interceptors.AfterSerialization,
- }, "OperationSerializer", middleware.After)
-}
-
-func addInterceptBeforeSigning(stack *middleware.Stack, opts Options) error {
- return stack.Finalize.Insert(&smithyhttp.InterceptBeforeSigning{
- Interceptors: opts.Interceptors.BeforeSigning,
- }, "Signing", middleware.Before)
-}
-
-func addInterceptAfterSigning(stack *middleware.Stack, opts Options) error {
- return stack.Finalize.Insert(&smithyhttp.InterceptAfterSigning{
- Interceptors: opts.Interceptors.AfterSigning,
- }, "Signing", middleware.After)
-}
-
-func addInterceptTransmit(stack *middleware.Stack, opts Options) error {
- return stack.Deserialize.Add(&smithyhttp.InterceptTransmit{
- BeforeTransmit: opts.Interceptors.BeforeTransmit,
- AfterTransmit: opts.Interceptors.AfterTransmit,
- }, middleware.After)
-}
-
-func addInterceptBeforeDeserialization(stack *middleware.Stack, opts Options) error {
- return stack.Deserialize.Insert(&smithyhttp.InterceptBeforeDeserialization{
- Interceptors: opts.Interceptors.BeforeDeserialization,
- }, "OperationDeserializer", middleware.After) // (deserialize stack is called in reverse)
-}
-
-func addInterceptAfterDeserialization(stack *middleware.Stack, opts Options) error {
- return stack.Deserialize.Insert(&smithyhttp.InterceptAfterDeserialization{
- Interceptors: opts.Interceptors.AfterDeserialization,
- }, "OperationDeserializer", middleware.Before)
-}
-
-type spanInitializeStart struct {
-}
-
-func (*spanInitializeStart) ID() string {
- return "spanInitializeStart"
-}
-
-func (m *spanInitializeStart) HandleInitialize(
- ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler,
-) (
- middleware.InitializeOutput, middleware.Metadata, error,
-) {
- ctx, _ = tracing.StartSpan(ctx, "Initialize")
-
- return next.HandleInitialize(ctx, in)
-}
-
-type spanInitializeEnd struct {
-}
-
-func (*spanInitializeEnd) ID() string {
- return "spanInitializeEnd"
-}
-
-func (m *spanInitializeEnd) HandleInitialize(
- ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler,
-) (
- middleware.InitializeOutput, middleware.Metadata, error,
-) {
- ctx, span := tracing.PopSpan(ctx)
- span.End()
-
- return next.HandleInitialize(ctx, in)
-}
-
-type spanBuildRequestStart struct {
-}
-
-func (*spanBuildRequestStart) ID() string {
- return "spanBuildRequestStart"
-}
-
-func (m *spanBuildRequestStart) HandleSerialize(
- ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler,
-) (
- middleware.SerializeOutput, middleware.Metadata, error,
-) {
- ctx, _ = tracing.StartSpan(ctx, "BuildRequest")
-
- return next.HandleSerialize(ctx, in)
-}
-
-type spanBuildRequestEnd struct {
-}
-
-func (*spanBuildRequestEnd) ID() string {
- return "spanBuildRequestEnd"
-}
-
-func (m *spanBuildRequestEnd) HandleBuild(
- ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler,
-) (
- middleware.BuildOutput, middleware.Metadata, error,
-) {
- ctx, span := tracing.PopSpan(ctx)
- span.End()
-
- return next.HandleBuild(ctx, in)
-}
-
-func addSpanInitializeStart(stack *middleware.Stack) error {
- return stack.Initialize.Add(&spanInitializeStart{}, middleware.Before)
-}
-
-func addSpanInitializeEnd(stack *middleware.Stack) error {
- return stack.Initialize.Add(&spanInitializeEnd{}, middleware.After)
-}
-
-func addSpanBuildRequestStart(stack *middleware.Stack) error {
- return stack.Serialize.Add(&spanBuildRequestStart{}, middleware.Before)
-}
+func addInterceptors(stack *middleware.Stack, opts Options) error {
+ // middlewares are expensive, don't add all of these interceptor ones unless the caller
+ // actually has at least one interceptor configured
+ //
+ // at the moment it's all-or-nothing because some of the middlewares here are responsible for
+ // setting fields in the interceptor context for future ones
+ if len(opts.Interceptors.BeforeExecution) == 0 &&
+ len(opts.Interceptors.BeforeSerialization) == 0 && len(opts.Interceptors.AfterSerialization) == 0 &&
+ len(opts.Interceptors.BeforeRetryLoop) == 0 &&
+ len(opts.Interceptors.BeforeAttempt) == 0 &&
+ len(opts.Interceptors.BeforeSigning) == 0 && len(opts.Interceptors.AfterSigning) == 0 &&
+ len(opts.Interceptors.BeforeTransmit) == 0 && len(opts.Interceptors.AfterTransmit) == 0 &&
+ len(opts.Interceptors.BeforeDeserialization) == 0 && len(opts.Interceptors.AfterDeserialization) == 0 &&
+ len(opts.Interceptors.AfterAttempt) == 0 && len(opts.Interceptors.AfterExecution) == 0 {
+ return nil
+ }
-func addSpanBuildRequestEnd(stack *middleware.Stack) error {
- return stack.Build.Add(&spanBuildRequestEnd{}, middleware.After)
+ return errors.Join(
+ stack.Initialize.Add(&smithyhttp.InterceptExecution{
+ BeforeExecution: opts.Interceptors.BeforeExecution,
+ AfterExecution: opts.Interceptors.AfterExecution,
+ }, middleware.Before),
+ stack.Serialize.Insert(&smithyhttp.InterceptBeforeSerialization{
+ Interceptors: opts.Interceptors.BeforeSerialization,
+ }, "OperationSerializer", middleware.Before),
+ stack.Serialize.Insert(&smithyhttp.InterceptAfterSerialization{
+ Interceptors: opts.Interceptors.AfterSerialization,
+ }, "OperationSerializer", middleware.After),
+ stack.Finalize.Insert(&smithyhttp.InterceptBeforeSigning{
+ Interceptors: opts.Interceptors.BeforeSigning,
+ }, "Signing", middleware.Before),
+ stack.Finalize.Insert(&smithyhttp.InterceptAfterSigning{
+ Interceptors: opts.Interceptors.AfterSigning,
+ }, "Signing", middleware.After),
+ stack.Deserialize.Add(&smithyhttp.InterceptTransmit{
+ BeforeTransmit: opts.Interceptors.BeforeTransmit,
+ AfterTransmit: opts.Interceptors.AfterTransmit,
+ }, middleware.After),
+ stack.Deserialize.Insert(&smithyhttp.InterceptBeforeDeserialization{
+ Interceptors: opts.Interceptors.BeforeDeserialization,
+ }, "OperationDeserializer", middleware.After), // (deserialize stack is called in reverse)
+ stack.Deserialize.Insert(&smithyhttp.InterceptAfterDeserialization{
+ Interceptors: opts.Interceptors.AfterDeserialization,
+ }, "OperationDeserializer", middleware.Before),
+ )
}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_BatchExecuteStatement.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_BatchExecuteStatement.go
index 0b4d0edaf22..5afc969d373 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_BatchExecuteStatement.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_BatchExecuteStatement.go
@@ -187,40 +187,7 @@ func (c *Client) addOperationBatchExecuteStatementMiddlewares(stack *middleware.
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_BatchGetItem.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_BatchGetItem.go
index 5e2394a8521..11b0ea5a641 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_BatchGetItem.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_BatchGetItem.go
@@ -337,40 +337,7 @@ func (c *Client) addOperationBatchGetItemMiddlewares(stack *middleware.Stack, op
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_BatchWriteItem.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_BatchWriteItem.go
index 2056cdd927f..a21c3691588 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_BatchWriteItem.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_BatchWriteItem.go
@@ -357,40 +357,7 @@ func (c *Client) addOperationBatchWriteItemMiddlewares(stack *middleware.Stack,
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_CreateBackup.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_CreateBackup.go
index db7e0776102..fd8eefd66e9 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_CreateBackup.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_CreateBackup.go
@@ -196,40 +196,7 @@ func (c *Client) addOperationCreateBackupMiddlewares(stack *middleware.Stack, op
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_CreateGlobalTable.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_CreateGlobalTable.go
index 163348c8280..bd2a8829e1a 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_CreateGlobalTable.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_CreateGlobalTable.go
@@ -218,40 +218,7 @@ func (c *Client) addOperationCreateGlobalTableMiddlewares(stack *middleware.Stac
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_CreateTable.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_CreateTable.go
index 7d4510adb83..1d8a0254b73 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_CreateTable.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_CreateTable.go
@@ -384,40 +384,7 @@ func (c *Client) addOperationCreateTableMiddlewares(stack *middleware.Stack, opt
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteBackup.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteBackup.go
index 799be66b63c..80f1a906013 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteBackup.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteBackup.go
@@ -163,40 +163,7 @@ func (c *Client) addOperationDeleteBackupMiddlewares(stack *middleware.Stack, op
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteItem.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteItem.go
index 386e2ecf1d6..b15f0f3edbb 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteItem.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteItem.go
@@ -359,40 +359,7 @@ func (c *Client) addOperationDeleteItemMiddlewares(stack *middleware.Stack, opti
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteResourcePolicy.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteResourcePolicy.go
index 768fb574dc7..6eb78bfabf1 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteResourcePolicy.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteResourcePolicy.go
@@ -190,40 +190,7 @@ func (c *Client) addOperationDeleteResourcePolicyMiddlewares(stack *middleware.S
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteTable.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteTable.go
index a9dbd30779e..4768b497308 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteTable.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DeleteTable.go
@@ -184,40 +184,7 @@ func (c *Client) addOperationDeleteTableMiddlewares(stack *middleware.Stack, opt
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeBackup.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeBackup.go
index be01e640700..0ba89f0be26 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeBackup.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeBackup.go
@@ -163,40 +163,7 @@ func (c *Client) addOperationDescribeBackupMiddlewares(stack *middleware.Stack,
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeContinuousBackups.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeContinuousBackups.go
index b814e0517fb..f82ed62343f 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeContinuousBackups.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeContinuousBackups.go
@@ -179,40 +179,7 @@ func (c *Client) addOperationDescribeContinuousBackupsMiddlewares(stack *middlew
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeContributorInsights.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeContributorInsights.go
index 338ff4df13d..dc54c3dbdf5 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeContributorInsights.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeContributorInsights.go
@@ -198,40 +198,7 @@ func (c *Client) addOperationDescribeContributorInsightsMiddlewares(stack *middl
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeEndpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeEndpoints.go
index 0e7c17b82f4..0818369b911 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeEndpoints.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeEndpoints.go
@@ -147,40 +147,7 @@ func (c *Client) addOperationDescribeEndpointsMiddlewares(stack *middleware.Stac
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeExport.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeExport.go
index 22eba3e4abe..57fd40aaea1 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeExport.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeExport.go
@@ -157,40 +157,7 @@ func (c *Client) addOperationDescribeExportMiddlewares(stack *middleware.Stack,
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeGlobalTable.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeGlobalTable.go
index 95b1fb4e63a..4e4a9d1cbd5 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeGlobalTable.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeGlobalTable.go
@@ -173,40 +173,7 @@ func (c *Client) addOperationDescribeGlobalTableMiddlewares(stack *middleware.St
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeGlobalTableSettings.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeGlobalTableSettings.go
index 78378b4c88f..3408736f217 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeGlobalTableSettings.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeGlobalTableSettings.go
@@ -176,40 +176,7 @@ func (c *Client) addOperationDescribeGlobalTableSettingsMiddlewares(stack *middl
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeImport.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeImport.go
index a4c70e5d5bb..def30e72d9e 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeImport.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeImport.go
@@ -161,40 +161,7 @@ func (c *Client) addOperationDescribeImportMiddlewares(stack *middleware.Stack,
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeKinesisStreamingDestination.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeKinesisStreamingDestination.go
index dd882cfe735..c68f3529fbf 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeKinesisStreamingDestination.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeKinesisStreamingDestination.go
@@ -165,40 +165,7 @@ func (c *Client) addOperationDescribeKinesisStreamingDestinationMiddlewares(stac
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeLimits.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeLimits.go
index 915a2a018ac..2d09b8b1d47 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeLimits.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeLimits.go
@@ -221,40 +221,7 @@ func (c *Client) addOperationDescribeLimitsMiddlewares(stack *middleware.Stack,
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeTable.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeTable.go
index 4a0cd9d29db..291062aa42e 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeTable.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeTable.go
@@ -175,40 +175,7 @@ func (c *Client) addOperationDescribeTableMiddlewares(stack *middleware.Stack, o
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeTableReplicaAutoScaling.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeTableReplicaAutoScaling.go
index f8e2f77b78a..a5a888718bd 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeTableReplicaAutoScaling.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeTableReplicaAutoScaling.go
@@ -158,40 +158,7 @@ func (c *Client) addOperationDescribeTableReplicaAutoScalingMiddlewares(stack *m
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeTimeToLive.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeTimeToLive.go
index 5ea9ab1eea7..834ba374970 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeTimeToLive.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DescribeTimeToLive.go
@@ -162,40 +162,7 @@ func (c *Client) addOperationDescribeTimeToLiveMiddlewares(stack *middleware.Sta
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DisableKinesisStreamingDestination.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DisableKinesisStreamingDestination.go
index 5df8f9ea0df..2f5ea263fc3 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DisableKinesisStreamingDestination.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_DisableKinesisStreamingDestination.go
@@ -180,40 +180,7 @@ func (c *Client) addOperationDisableKinesisStreamingDestinationMiddlewares(stack
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_EnableKinesisStreamingDestination.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_EnableKinesisStreamingDestination.go
index c7b047c7f27..b7cbb83d3bc 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_EnableKinesisStreamingDestination.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_EnableKinesisStreamingDestination.go
@@ -182,40 +182,7 @@ func (c *Client) addOperationEnableKinesisStreamingDestinationMiddlewares(stack
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ExecuteStatement.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ExecuteStatement.go
index 655372e1434..419cd10a616 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ExecuteStatement.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ExecuteStatement.go
@@ -235,40 +235,7 @@ func (c *Client) addOperationExecuteStatementMiddlewares(stack *middleware.Stack
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ExecuteTransaction.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ExecuteTransaction.go
index 85c587bc3b2..8d33b0c6940 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ExecuteTransaction.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ExecuteTransaction.go
@@ -177,40 +177,7 @@ func (c *Client) addOperationExecuteTransactionMiddlewares(stack *middleware.Sta
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ExportTableToPointInTime.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ExportTableToPointInTime.go
index 491a4482329..65f7de7f0f9 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ExportTableToPointInTime.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ExportTableToPointInTime.go
@@ -223,40 +223,7 @@ func (c *Client) addOperationExportTableToPointInTimeMiddlewares(stack *middlewa
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_GetItem.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_GetItem.go
index 5a8e1f6bedd..1186c3366a6 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_GetItem.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_GetItem.go
@@ -269,40 +269,7 @@ func (c *Client) addOperationGetItemMiddlewares(stack *middleware.Stack, options
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_GetResourcePolicy.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_GetResourcePolicy.go
index 31bae3f42ae..c4b6fb5c68f 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_GetResourcePolicy.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_GetResourcePolicy.go
@@ -195,40 +195,7 @@ func (c *Client) addOperationGetResourcePolicyMiddlewares(stack *middleware.Stac
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ImportTable.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ImportTable.go
index ab97739f8bc..e3cbba2674a 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ImportTable.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ImportTable.go
@@ -201,40 +201,7 @@ func (c *Client) addOperationImportTableMiddlewares(stack *middleware.Stack, opt
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListBackups.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListBackups.go
index 4d594fa5b04..7161f605b25 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListBackups.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListBackups.go
@@ -215,40 +215,7 @@ func (c *Client) addOperationListBackupsMiddlewares(stack *middleware.Stack, opt
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListContributorInsights.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListContributorInsights.go
index d4870973e5f..dc98ea16573 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListContributorInsights.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListContributorInsights.go
@@ -163,40 +163,7 @@ func (c *Client) addOperationListContributorInsightsMiddlewares(stack *middlewar
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListExports.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListExports.go
index 33c8aef4654..8bd9e56a037 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListExports.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListExports.go
@@ -164,40 +164,7 @@ func (c *Client) addOperationListExportsMiddlewares(stack *middleware.Stack, opt
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListGlobalTables.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListGlobalTables.go
index dcf73cdadb6..ef80d1c6172 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListGlobalTables.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListGlobalTables.go
@@ -177,40 +177,7 @@ func (c *Client) addOperationListGlobalTablesMiddlewares(stack *middleware.Stack
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListImports.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListImports.go
index 5a02bf9c9cb..77b305d3da5 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListImports.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListImports.go
@@ -164,40 +164,7 @@ func (c *Client) addOperationListImportsMiddlewares(stack *middleware.Stack, opt
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListTables.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListTables.go
index ec575e96791..9b5cc6707d0 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListTables.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListTables.go
@@ -172,40 +172,7 @@ func (c *Client) addOperationListTablesMiddlewares(stack *middleware.Stack, opti
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListTagsOfResource.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListTagsOfResource.go
index 6d9ed73927a..0c6deb06341 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListTagsOfResource.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_ListTagsOfResource.go
@@ -177,40 +177,7 @@ func (c *Client) addOperationListTagsOfResourceMiddlewares(stack *middleware.Sta
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_PutItem.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_PutItem.go
index 43bd113d2c0..2927b3e8f7a 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_PutItem.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_PutItem.go
@@ -392,40 +392,7 @@ func (c *Client) addOperationPutItemMiddlewares(stack *middleware.Stack, options
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_PutResourcePolicy.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_PutResourcePolicy.go
index d14c3e1f562..2ef9ef2757b 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_PutResourcePolicy.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_PutResourcePolicy.go
@@ -219,40 +219,7 @@ func (c *Client) addOperationPutResourcePolicyMiddlewares(stack *middleware.Stac
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_Query.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_Query.go
index d0e6f183624..37c934bf499 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_Query.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_Query.go
@@ -561,40 +561,7 @@ func (c *Client) addOperationQueryMiddlewares(stack *middleware.Stack, options O
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_RestoreTableFromBackup.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_RestoreTableFromBackup.go
index 250d963882f..5e3f0fb737a 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_RestoreTableFromBackup.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_RestoreTableFromBackup.go
@@ -207,40 +207,7 @@ func (c *Client) addOperationRestoreTableFromBackupMiddlewares(stack *middleware
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_RestoreTableToPointInTime.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_RestoreTableToPointInTime.go
index 380fcb85e96..fef6374a519 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_RestoreTableToPointInTime.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_RestoreTableToPointInTime.go
@@ -239,40 +239,7 @@ func (c *Client) addOperationRestoreTableToPointInTimeMiddlewares(stack *middlew
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_Scan.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_Scan.go
index d3604bc75c2..cb16c2804f5 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_Scan.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_Scan.go
@@ -492,40 +492,7 @@ func (c *Client) addOperationScanMiddlewares(stack *middleware.Stack, options Op
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_TagResource.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_TagResource.go
index f80afd79e96..8d23115e446 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_TagResource.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_TagResource.go
@@ -182,40 +182,7 @@ func (c *Client) addOperationTagResourceMiddlewares(stack *middleware.Stack, opt
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_TransactGetItems.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_TransactGetItems.go
index ce6db313c87..4a796353b0c 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_TransactGetItems.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_TransactGetItems.go
@@ -212,40 +212,7 @@ func (c *Client) addOperationTransactGetItemsMiddlewares(stack *middleware.Stack
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_TransactWriteItems.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_TransactWriteItems.go
index a345302a810..2ec6d35b745 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_TransactWriteItems.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_TransactWriteItems.go
@@ -317,40 +317,7 @@ func (c *Client) addOperationTransactWriteItemsMiddlewares(stack *middleware.Sta
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UntagResource.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UntagResource.go
index c481bb262d4..f887ae2575a 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UntagResource.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UntagResource.go
@@ -180,40 +180,7 @@ func (c *Client) addOperationUntagResourceMiddlewares(stack *middleware.Stack, o
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateContinuousBackups.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateContinuousBackups.go
index 4d9dcb86a7c..22112395ede 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateContinuousBackups.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateContinuousBackups.go
@@ -180,40 +180,7 @@ func (c *Client) addOperationUpdateContinuousBackupsMiddlewares(stack *middlewar
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateContributorInsights.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateContributorInsights.go
index edb045481ff..62a46fed045 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateContributorInsights.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateContributorInsights.go
@@ -187,40 +187,7 @@ func (c *Client) addOperationUpdateContributorInsightsMiddlewares(stack *middlew
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateGlobalTable.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateGlobalTable.go
index 25878256fc5..20000167cbb 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateGlobalTable.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateGlobalTable.go
@@ -201,40 +201,7 @@ func (c *Client) addOperationUpdateGlobalTableMiddlewares(stack *middleware.Stac
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateGlobalTableSettings.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateGlobalTableSettings.go
index 6505381e88e..60050aa8c7e 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateGlobalTableSettings.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateGlobalTableSettings.go
@@ -204,40 +204,7 @@ func (c *Client) addOperationUpdateGlobalTableSettingsMiddlewares(stack *middlew
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateItem.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateItem.go
index 8416ad88e78..36c44dbc112 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateItem.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateItem.go
@@ -445,40 +445,7 @@ func (c *Client) addOperationUpdateItemMiddlewares(stack *middleware.Stack, opti
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateKinesisStreamingDestination.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateKinesisStreamingDestination.go
index 9a1b68ebd00..127c84a2b5b 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateKinesisStreamingDestination.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateKinesisStreamingDestination.go
@@ -179,40 +179,7 @@ func (c *Client) addOperationUpdateKinesisStreamingDestinationMiddlewares(stack
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateTable.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateTable.go
index 325db35c8d1..16bec163fc8 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateTable.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateTable.go
@@ -290,40 +290,7 @@ func (c *Client) addOperationUpdateTableMiddlewares(stack *middleware.Stack, opt
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateTableReplicaAutoScaling.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateTableReplicaAutoScaling.go
index 26b33641df8..a76d1bd08a3 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateTableReplicaAutoScaling.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateTableReplicaAutoScaling.go
@@ -170,40 +170,7 @@ func (c *Client) addOperationUpdateTableReplicaAutoScalingMiddlewares(stack *mid
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateTimeToLive.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateTimeToLive.go
index 6c0fc24a13e..451070a5320 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateTimeToLive.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/api_op_UpdateTimeToLive.go
@@ -197,40 +197,7 @@ func (c *Client) addOperationUpdateTimeToLiveMiddlewares(stack *middleware.Stack
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/endpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/endpoints.go
index a859c043f04..de1af3bf2d0 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/endpoints.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/endpoints.go
@@ -219,11 +219,15 @@ func resolveBaseEndpoint(cfg aws.Config, o *Options) {
}
}
-func bindRegion(region string) *string {
+func bindRegion(region string) (*string, error) {
if region == "" {
- return nil
+ return nil, nil
+ }
+ if !smithyhttp.ValidHostLabel(region) {
+ return nil, fmt.Errorf("invalid input region %s", region)
}
- return aws.String(endpoints.MapFIPSRegion(region))
+
+ return aws.String(endpoints.MapFIPSRegion(region)), nil
}
// EndpointParameters provides the parameters that influence how endpoints are
@@ -356,8 +360,49 @@ func (r *resolver) ResolveEndpoint(
return endpoint, fmt.Errorf("endpoint parameters are not valid, %w", err)
}
_UseDualStack := *params.UseDualStack
+ _ = _UseDualStack
_UseFIPS := *params.UseFIPS
+ _ = _UseFIPS
+
+ if exprVal := params.Endpoint; exprVal != nil {
+ _Endpoint := *exprVal
+ _ = _Endpoint
+ if exprVal := params.Region; exprVal != nil {
+ _Region := *exprVal
+ _ = _Region
+ if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil {
+ _PartitionResult := *exprVal
+ _ = _PartitionResult
+ if _UseFIPS == true {
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: FIPS and custom endpoint are not supported")
+ }
+ if _UseDualStack == true {
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Dualstack and custom endpoint are not supported")
+ }
+ if _Endpoint == func() string {
+ var out strings.Builder
+ out.WriteString("https://dynamodb.")
+ out.WriteString(_Region)
+ out.WriteString(".")
+ out.WriteString(_PartitionResult.DualStackDnsSuffix)
+ return out.String()
+ }() {
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "Endpoint override is not supported for dual-stack endpoints. Please enable dual-stack functionality by enabling the configuration. For more details, see: https://docs.aws.amazon.com/sdkref/latest/guide/feature-endpoints.html")
+ }
+ uriString := _Endpoint
+
+ uri, err := url.Parse(uriString)
+ if err != nil {
+ return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
+ }
+ return smithyendpoints.Endpoint{
+ URI: *uri,
+ Headers: http.Header{},
+ }, nil
+ }
+ }
+ }
if exprVal := params.Endpoint; exprVal != nil {
_Endpoint := *exprVal
_ = _Endpoint
@@ -514,12 +559,169 @@ func (r *resolver) ResolveEndpoint(
}
if _UseDualStack == true {
if _PartitionResult.SupportsDualStack == true {
+ if exprVal := params.AccountIdEndpointMode; exprVal != nil {
+ _AccountIdEndpointMode := *exprVal
+ _ = _AccountIdEndpointMode
+ if !(_AccountIdEndpointMode == "disabled") {
+ if _PartitionResult.Name == "aws" {
+ if !(_UseFIPS == true) {
+ if exprVal := params.ResourceArn; exprVal != nil {
+ _ResourceArn := *exprVal
+ _ = _ResourceArn
+ if exprVal := awsrulesfn.ParseARN(_ResourceArn); exprVal != nil {
+ _ParsedArn := *exprVal
+ _ = _ParsedArn
+ if _ParsedArn.Service == "dynamodb" {
+ if rulesfn.IsValidHostLabel(_ParsedArn.Region, false) {
+ if _ParsedArn.Region == _Region {
+ if rulesfn.IsValidHostLabel(_ParsedArn.AccountId, false) {
+ uriString := func() string {
+ var out strings.Builder
+ out.WriteString("https://")
+ out.WriteString(_ParsedArn.AccountId)
+ out.WriteString(".ddb.")
+ out.WriteString(_Region)
+ out.WriteString(".")
+ out.WriteString(_PartitionResult.DualStackDnsSuffix)
+ return out.String()
+ }()
+
+ uri, err := url.Parse(uriString)
+ if err != nil {
+ return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
+ }
+
+ return smithyendpoints.Endpoint{
+ URI: *uri,
+ Headers: http.Header{},
+ Properties: func() smithy.Properties {
+ var out smithy.Properties
+ out.Set("metricValues", []interface{}{
+ "O",
+ })
+ return out
+ }(),
+ }, nil
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if exprVal := params.AccountIdEndpointMode; exprVal != nil {
+ _AccountIdEndpointMode := *exprVal
+ _ = _AccountIdEndpointMode
+ if !(_AccountIdEndpointMode == "disabled") {
+ if _PartitionResult.Name == "aws" {
+ if !(_UseFIPS == true) {
+ if exprVal := params.ResourceArnList; exprVal != nil {
+ _ResourceArnList := stringSlice(exprVal)
+ _ = _ResourceArnList
+ if exprVal := _ResourceArnList.Get(0); exprVal != nil {
+ _FirstArn := *exprVal
+ _ = _FirstArn
+ if exprVal := awsrulesfn.ParseARN(_FirstArn); exprVal != nil {
+ _ParsedArn := *exprVal
+ _ = _ParsedArn
+ if _ParsedArn.Service == "dynamodb" {
+ if rulesfn.IsValidHostLabel(_ParsedArn.Region, false) {
+ if _ParsedArn.Region == _Region {
+ if rulesfn.IsValidHostLabel(_ParsedArn.AccountId, false) {
+ uriString := func() string {
+ var out strings.Builder
+ out.WriteString("https://")
+ out.WriteString(_ParsedArn.AccountId)
+ out.WriteString(".ddb.")
+ out.WriteString(_Region)
+ out.WriteString(".")
+ out.WriteString(_PartitionResult.DualStackDnsSuffix)
+ return out.String()
+ }()
+
+ uri, err := url.Parse(uriString)
+ if err != nil {
+ return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
+ }
+
+ return smithyendpoints.Endpoint{
+ URI: *uri,
+ Headers: http.Header{},
+ Properties: func() smithy.Properties {
+ var out smithy.Properties
+ out.Set("metricValues", []interface{}{
+ "O",
+ })
+ return out
+ }(),
+ }, nil
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if exprVal := params.AccountIdEndpointMode; exprVal != nil {
+ _AccountIdEndpointMode := *exprVal
+ _ = _AccountIdEndpointMode
+ if !(_AccountIdEndpointMode == "disabled") {
+ if _PartitionResult.Name == "aws" {
+ if !(_UseFIPS == true) {
+ if exprVal := params.AccountId; exprVal != nil {
+ _AccountId := *exprVal
+ _ = _AccountId
+ if rulesfn.IsValidHostLabel(_AccountId, false) {
+ uriString := func() string {
+ var out strings.Builder
+ out.WriteString("https://")
+ out.WriteString(_AccountId)
+ out.WriteString(".ddb.")
+ out.WriteString(_Region)
+ out.WriteString(".")
+ out.WriteString(_PartitionResult.DualStackDnsSuffix)
+ return out.String()
+ }()
+
+ uri, err := url.Parse(uriString)
+ if err != nil {
+ return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
+ }
+
+ return smithyendpoints.Endpoint{
+ URI: *uri,
+ Headers: http.Header{},
+ Properties: func() smithy.Properties {
+ var out smithy.Properties
+ out.Set("metricValues", []interface{}{
+ "O",
+ })
+ return out
+ }(),
+ }, nil
+ }
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "Credentials-sourced account ID parameter is invalid")
+ }
+ }
+ }
+ }
+ }
if exprVal := params.AccountIdEndpointMode; exprVal != nil {
_AccountIdEndpointMode := *exprVal
_ = _AccountIdEndpointMode
if _AccountIdEndpointMode == "required" {
if !(_UseFIPS == true) {
- return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: AccountIdEndpointMode is required and DualStack is enabled, but DualStack account endpoints are not supported")
+ if _PartitionResult.Name == "aws" {
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "AccountIdEndpointMode is required but no AccountID was provided or able to be loaded")
+ }
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: AccountIdEndpointMode is required but account endpoints are not supported in this partition")
}
return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: AccountIdEndpointMode is required and FIPS is enabled, but FIPS account endpoints are not supported")
}
@@ -551,11 +753,66 @@ func (r *resolver) ResolveEndpoint(
if !(_AccountIdEndpointMode == "disabled") {
if _PartitionResult.Name == "aws" {
if !(_UseFIPS == true) {
- if !(_UseDualStack == true) {
- if exprVal := params.ResourceArn; exprVal != nil {
- _ResourceArn := *exprVal
- _ = _ResourceArn
- if exprVal := awsrulesfn.ParseARN(_ResourceArn); exprVal != nil {
+ if exprVal := params.ResourceArn; exprVal != nil {
+ _ResourceArn := *exprVal
+ _ = _ResourceArn
+ if exprVal := awsrulesfn.ParseARN(_ResourceArn); exprVal != nil {
+ _ParsedArn := *exprVal
+ _ = _ParsedArn
+ if _ParsedArn.Service == "dynamodb" {
+ if rulesfn.IsValidHostLabel(_ParsedArn.Region, false) {
+ if _ParsedArn.Region == _Region {
+ if rulesfn.IsValidHostLabel(_ParsedArn.AccountId, false) {
+ uriString := func() string {
+ var out strings.Builder
+ out.WriteString("https://")
+ out.WriteString(_ParsedArn.AccountId)
+ out.WriteString(".ddb.")
+ out.WriteString(_Region)
+ out.WriteString(".")
+ out.WriteString(_PartitionResult.DnsSuffix)
+ return out.String()
+ }()
+
+ uri, err := url.Parse(uriString)
+ if err != nil {
+ return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
+ }
+
+ return smithyendpoints.Endpoint{
+ URI: *uri,
+ Headers: http.Header{},
+ Properties: func() smithy.Properties {
+ var out smithy.Properties
+ out.Set("metricValues", []interface{}{
+ "O",
+ })
+ return out
+ }(),
+ }, nil
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if exprVal := params.AccountIdEndpointMode; exprVal != nil {
+ _AccountIdEndpointMode := *exprVal
+ _ = _AccountIdEndpointMode
+ if !(_AccountIdEndpointMode == "disabled") {
+ if _PartitionResult.Name == "aws" {
+ if !(_UseFIPS == true) {
+ if exprVal := params.ResourceArnList; exprVal != nil {
+ _ResourceArnList := stringSlice(exprVal)
+ _ = _ResourceArnList
+ if exprVal := _ResourceArnList.Get(0); exprVal != nil {
+ _FirstArn := *exprVal
+ _ = _FirstArn
+ if exprVal := awsrulesfn.ParseARN(_FirstArn); exprVal != nil {
_ParsedArn := *exprVal
_ = _ParsedArn
if _ParsedArn.Service == "dynamodb" {
@@ -581,6 +838,13 @@ func (r *resolver) ResolveEndpoint(
return smithyendpoints.Endpoint{
URI: *uri,
Headers: http.Header{},
+ Properties: func() smithy.Properties {
+ var out smithy.Properties
+ out.Set("metricValues", []interface{}{
+ "O",
+ })
+ return out
+ }(),
}, nil
}
}
@@ -599,86 +863,39 @@ func (r *resolver) ResolveEndpoint(
if !(_AccountIdEndpointMode == "disabled") {
if _PartitionResult.Name == "aws" {
if !(_UseFIPS == true) {
- if !(_UseDualStack == true) {
- if exprVal := params.ResourceArnList; exprVal != nil {
- _ResourceArnList := stringSlice(exprVal)
- _ = _ResourceArnList
- if exprVal := _ResourceArnList.Get(0); exprVal != nil {
- _FirstArn := *exprVal
- _ = _FirstArn
- if exprVal := awsrulesfn.ParseARN(_FirstArn); exprVal != nil {
- _ParsedArn := *exprVal
- _ = _ParsedArn
- if _ParsedArn.Service == "dynamodb" {
- if rulesfn.IsValidHostLabel(_ParsedArn.Region, false) {
- if _ParsedArn.Region == _Region {
- if rulesfn.IsValidHostLabel(_ParsedArn.AccountId, false) {
- uriString := func() string {
- var out strings.Builder
- out.WriteString("https://")
- out.WriteString(_ParsedArn.AccountId)
- out.WriteString(".ddb.")
- out.WriteString(_Region)
- out.WriteString(".")
- out.WriteString(_PartitionResult.DnsSuffix)
- return out.String()
- }()
-
- uri, err := url.Parse(uriString)
- if err != nil {
- return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
- }
-
- return smithyendpoints.Endpoint{
- URI: *uri,
- Headers: http.Header{},
- }, nil
- }
- }
- }
- }
- }
+ if exprVal := params.AccountId; exprVal != nil {
+ _AccountId := *exprVal
+ _ = _AccountId
+ if rulesfn.IsValidHostLabel(_AccountId, false) {
+ uriString := func() string {
+ var out strings.Builder
+ out.WriteString("https://")
+ out.WriteString(_AccountId)
+ out.WriteString(".ddb.")
+ out.WriteString(_Region)
+ out.WriteString(".")
+ out.WriteString(_PartitionResult.DnsSuffix)
+ return out.String()
+ }()
+
+ uri, err := url.Parse(uriString)
+ if err != nil {
+ return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
}
- }
- }
- }
- }
- }
- }
- if exprVal := params.AccountIdEndpointMode; exprVal != nil {
- _AccountIdEndpointMode := *exprVal
- _ = _AccountIdEndpointMode
- if !(_AccountIdEndpointMode == "disabled") {
- if _PartitionResult.Name == "aws" {
- if !(_UseFIPS == true) {
- if !(_UseDualStack == true) {
- if exprVal := params.AccountId; exprVal != nil {
- _AccountId := *exprVal
- _ = _AccountId
- if rulesfn.IsValidHostLabel(_AccountId, false) {
- uriString := func() string {
- var out strings.Builder
- out.WriteString("https://")
- out.WriteString(_AccountId)
- out.WriteString(".ddb.")
- out.WriteString(_Region)
- out.WriteString(".")
- out.WriteString(_PartitionResult.DnsSuffix)
- return out.String()
- }()
-
- uri, err := url.Parse(uriString)
- if err != nil {
- return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
- }
- return smithyendpoints.Endpoint{
- URI: *uri,
- Headers: http.Header{},
- }, nil
- }
- return endpoint, fmt.Errorf("endpoint rule error, %s", "Credentials-sourced account ID parameter is invalid")
+ return smithyendpoints.Endpoint{
+ URI: *uri,
+ Headers: http.Header{},
+ Properties: func() smithy.Properties {
+ var out smithy.Properties
+ out.Set("metricValues", []interface{}{
+ "O",
+ })
+ return out
+ }(),
+ }, nil
}
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "Credentials-sourced account ID parameter is invalid")
}
}
}
@@ -689,13 +906,10 @@ func (r *resolver) ResolveEndpoint(
_ = _AccountIdEndpointMode
if _AccountIdEndpointMode == "required" {
if !(_UseFIPS == true) {
- if !(_UseDualStack == true) {
- if _PartitionResult.Name == "aws" {
- return endpoint, fmt.Errorf("endpoint rule error, %s", "AccountIdEndpointMode is required but no AccountID was provided or able to be loaded")
- }
- return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: AccountIdEndpointMode is required but account endpoints are not supported in this partition")
+ if _PartitionResult.Name == "aws" {
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "AccountIdEndpointMode is required but no AccountID was provided or able to be loaded")
}
- return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: AccountIdEndpointMode is required and DualStack is enabled, but DualStack account endpoints are not supported")
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: AccountIdEndpointMode is required but account endpoints are not supported in this partition")
}
return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: AccountIdEndpointMode is required and FIPS is enabled, but FIPS account endpoints are not supported")
}
@@ -728,10 +942,15 @@ type endpointParamsBinder interface {
bindEndpointParams(*EndpointParameters)
}
-func bindEndpointParams(ctx context.Context, input interface{}, options Options) *EndpointParameters {
+func bindEndpointParams(ctx context.Context, input interface{}, options Options) (*EndpointParameters, error) {
params := &EndpointParameters{}
- params.Region = bindRegion(options.Region)
+ region, err := bindRegion(options.Region)
+ if err != nil {
+ return nil, err
+ }
+ params.Region = region
+
params.UseDualStack = aws.Bool(options.EndpointOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled)
params.UseFIPS = aws.Bool(options.EndpointOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled)
params.Endpoint = options.BaseEndpoint
@@ -742,7 +961,7 @@ func bindEndpointParams(ctx context.Context, input interface{}, options Options)
b.bindEndpointParams(params)
}
- return params
+ return params, nil
}
type resolveEndpointV2Middleware struct {
@@ -776,7 +995,10 @@ func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in mid
return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil")
}
- params := bindEndpointParams(ctx, getOperationInput(ctx), m.options)
+ params, err := bindEndpointParams(ctx, getOperationInput(ctx), m.options)
+ if err != nil {
+ return out, metadata, fmt.Errorf("failed to bind endpoint params, %w", err)
+ }
endpt, err := timeOperationMetric(ctx, "client.call.resolve_endpoint_duration",
func() (smithyendpoints.Endpoint, error) {
return m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params)
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/generated.json b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/generated.json
index b2746adbd16..5c4f744ee34 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/generated.json
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/generated.json
@@ -87,7 +87,7 @@
"types/types_exported_test.go",
"validators.go"
],
- "go": "1.22",
+ "go": "1.23",
"module": "github.com/aws/aws-sdk-go-v2/service/dynamodb",
"unstable": false
}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/go_module_metadata.go
index 6e1c54415cf..ebd2c1b1e96 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/go_module_metadata.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/go_module_metadata.go
@@ -3,4 +3,4 @@
package dynamodb
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.50.1"
+const goModuleVersion = "1.53.1"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/internal/endpoints/endpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/internal/endpoints/endpoints.go
index 09e2b0eed08..8a9d963fd7d 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/internal/endpoints/endpoints.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/dynamodb/internal/endpoints/endpoints.go
@@ -463,6 +463,9 @@ var defaultPartitions = endpoints.Partitions{
endpoints.EndpointKey{
Region: "us-isob-east-1",
}: endpoints.Endpoint{},
+ endpoints.EndpointKey{
+ Region: "us-isob-west-1",
+ }: endpoints.Endpoint{},
},
},
{
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md
index 607fc092204..c05f82ea411 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md
@@ -1,3 +1,11 @@
+# v1.13.3 (2025-11-04)
+
+* **Dependency Update**: Upgrade to smithy-go v1.23.2 which should convey some passive reduction of overall allocations, especially when not using the metrics system.
+
+# v1.13.2 (2025-10-16)
+
+* **Dependency Update**: Bump minimum Go version to 1.23.
+
# v1.13.1 (2025-08-27)
* **Dependency Update**: Update to smithy-go v1.23.0.
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go
index 7a0b6aae29a..6a4c336055a 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go
@@ -3,4 +3,4 @@
package acceptencoding
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.13.1"
+const goModuleVersion = "1.13.3"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery/CHANGELOG.md
index 6214ff2917a..b9ae6f37bb6 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery/CHANGELOG.md
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery/CHANGELOG.md
@@ -1,3 +1,37 @@
+# v1.11.14 (2025-11-19.2)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.11.13 (2025-11-04)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+* **Dependency Update**: Upgrade to smithy-go v1.23.2 which should convey some passive reduction of overall allocations, especially when not using the metrics system.
+
+# v1.11.12 (2025-10-30)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.11.11 (2025-10-23)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.11.10 (2025-10-16)
+
+* **Dependency Update**: Bump minimum Go version to 1.23.
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.11.9 (2025-09-26)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.11.8 (2025-09-23)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.11.7 (2025-09-08)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
# v1.11.6 (2025-08-29)
* **Dependency Update**: Updated to the latest SDK module versions
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery/go_module_metadata.go
index b83027a6e1d..d1c63c4c00f 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery/go_module_metadata.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery/go_module_metadata.go
@@ -3,4 +3,4 @@
package endpointdiscovery
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.11.6"
+const goModuleVersion = "1.11.14"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md
index 6f143784e12..0db87c8abbf 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md
@@ -1,3 +1,25 @@
+# v1.13.14 (2025-11-19.2)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.13.13 (2025-11-04)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+* **Dependency Update**: Upgrade to smithy-go v1.23.2 which should convey some passive reduction of overall allocations, especially when not using the metrics system.
+
+# v1.13.12 (2025-10-30)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.13.11 (2025-10-23)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.13.10 (2025-10-16)
+
+* **Dependency Update**: Bump minimum Go version to 1.23.
+* **Dependency Update**: Updated to the latest SDK module versions
+
# v1.13.9 (2025-09-26)
* **Dependency Update**: Updated to the latest SDK module versions
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go
index bc347369d8b..b9c350a2bd7 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go
@@ -3,4 +3,4 @@
package presignedurl
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.13.9"
+const goModuleVersion = "1.13.14"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/CHANGELOG.md
new file mode 100644
index 00000000000..420bc4949eb
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/CHANGELOG.md
@@ -0,0 +1,9 @@
+# v1.0.1 (2025-11-19.2)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.0.0 (2025-11-19)
+
+* **Release**: New AWS service client module
+* **Feature**: AWS Sign-In manages authentication for AWS services. This service provides secure authentication flows for accessing AWS resources from the console and developer tools. This release adds the CreateOAuth2Token API, which can be used to fetch OAuth2 access tokens and refresh tokens from Sign-In.
+
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/LICENSE.txt b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/LICENSE.txt
new file mode 100644
index 00000000000..d6456956733
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/LICENSE.txt
@@ -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/github.com/aws/aws-sdk-go-v2/service/signin/api_client.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/api_client.go
new file mode 100644
index 00000000000..d2db11d2aa1
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/api_client.go
@@ -0,0 +1,949 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package signin
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "github.com/aws/aws-sdk-go-v2/aws"
+ "github.com/aws/aws-sdk-go-v2/aws/defaults"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ "github.com/aws/aws-sdk-go-v2/aws/retry"
+ "github.com/aws/aws-sdk-go-v2/aws/signer/v4"
+ awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http"
+ internalauth "github.com/aws/aws-sdk-go-v2/internal/auth"
+ internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy"
+ internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources"
+ internalmiddleware "github.com/aws/aws-sdk-go-v2/internal/middleware"
+ smithy "github.com/aws/smithy-go"
+ smithyauth "github.com/aws/smithy-go/auth"
+ smithydocument "github.com/aws/smithy-go/document"
+ "github.com/aws/smithy-go/logging"
+ "github.com/aws/smithy-go/metrics"
+ "github.com/aws/smithy-go/middleware"
+ "github.com/aws/smithy-go/tracing"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+ "net"
+ "net/http"
+ "sync/atomic"
+ "time"
+)
+
+const ServiceID = "Signin"
+const ServiceAPIVersion = "2023-01-01"
+
+type operationMetrics struct {
+ Duration metrics.Float64Histogram
+ SerializeDuration metrics.Float64Histogram
+ ResolveIdentityDuration metrics.Float64Histogram
+ ResolveEndpointDuration metrics.Float64Histogram
+ SignRequestDuration metrics.Float64Histogram
+ DeserializeDuration metrics.Float64Histogram
+}
+
+func (m *operationMetrics) histogramFor(name string) metrics.Float64Histogram {
+ switch name {
+ case "client.call.duration":
+ return m.Duration
+ case "client.call.serialization_duration":
+ return m.SerializeDuration
+ case "client.call.resolve_identity_duration":
+ return m.ResolveIdentityDuration
+ case "client.call.resolve_endpoint_duration":
+ return m.ResolveEndpointDuration
+ case "client.call.signing_duration":
+ return m.SignRequestDuration
+ case "client.call.deserialization_duration":
+ return m.DeserializeDuration
+ default:
+ panic("unrecognized operation metric")
+ }
+}
+
+func timeOperationMetric[T any](
+ ctx context.Context, metric string, fn func() (T, error),
+ opts ...metrics.RecordMetricOption,
+) (T, error) {
+ mm := getOperationMetrics(ctx)
+ if mm == nil { // not using the metrics system
+ return fn()
+ }
+
+ instr := mm.histogramFor(metric)
+ opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...)
+
+ start := time.Now()
+ v, err := fn()
+ end := time.Now()
+
+ elapsed := end.Sub(start)
+ instr.Record(ctx, float64(elapsed)/1e9, opts...)
+ return v, err
+}
+
+func startMetricTimer(ctx context.Context, metric string, opts ...metrics.RecordMetricOption) func() {
+ mm := getOperationMetrics(ctx)
+ if mm == nil { // not using the metrics system
+ return func() {}
+ }
+
+ instr := mm.histogramFor(metric)
+ opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...)
+
+ var ended bool
+ start := time.Now()
+ return func() {
+ if ended {
+ return
+ }
+ ended = true
+
+ end := time.Now()
+
+ elapsed := end.Sub(start)
+ instr.Record(ctx, float64(elapsed)/1e9, opts...)
+ }
+}
+
+func withOperationMetadata(ctx context.Context) metrics.RecordMetricOption {
+ return func(o *metrics.RecordMetricOptions) {
+ o.Properties.Set("rpc.service", middleware.GetServiceID(ctx))
+ o.Properties.Set("rpc.method", middleware.GetOperationName(ctx))
+ }
+}
+
+type operationMetricsKey struct{}
+
+func withOperationMetrics(parent context.Context, mp metrics.MeterProvider) (context.Context, error) {
+ if _, ok := mp.(metrics.NopMeterProvider); ok {
+ // not using the metrics system - setting up the metrics context is a memory-intensive operation
+ // so we should skip it in this case
+ return parent, nil
+ }
+
+ meter := mp.Meter("github.com/aws/aws-sdk-go-v2/service/signin")
+ om := &operationMetrics{}
+
+ var err error
+
+ om.Duration, err = operationMetricTimer(meter, "client.call.duration",
+ "Overall call duration (including retries and time to send or receive request and response body)")
+ if err != nil {
+ return nil, err
+ }
+ om.SerializeDuration, err = operationMetricTimer(meter, "client.call.serialization_duration",
+ "The time it takes to serialize a message body")
+ if err != nil {
+ return nil, err
+ }
+ om.ResolveIdentityDuration, err = operationMetricTimer(meter, "client.call.auth.resolve_identity_duration",
+ "The time taken to acquire an identity (AWS credentials, bearer token, etc) from an Identity Provider")
+ if err != nil {
+ return nil, err
+ }
+ om.ResolveEndpointDuration, err = operationMetricTimer(meter, "client.call.resolve_endpoint_duration",
+ "The time it takes to resolve an endpoint (endpoint resolver, not DNS) for the request")
+ if err != nil {
+ return nil, err
+ }
+ om.SignRequestDuration, err = operationMetricTimer(meter, "client.call.auth.signing_duration",
+ "The time it takes to sign a request")
+ if err != nil {
+ return nil, err
+ }
+ om.DeserializeDuration, err = operationMetricTimer(meter, "client.call.deserialization_duration",
+ "The time it takes to deserialize a message body")
+ if err != nil {
+ return nil, err
+ }
+
+ return context.WithValue(parent, operationMetricsKey{}, om), nil
+}
+
+func operationMetricTimer(m metrics.Meter, name, desc string) (metrics.Float64Histogram, error) {
+ return m.Float64Histogram(name, func(o *metrics.InstrumentOptions) {
+ o.UnitLabel = "s"
+ o.Description = desc
+ })
+}
+
+func getOperationMetrics(ctx context.Context) *operationMetrics {
+ if v := ctx.Value(operationMetricsKey{}); v != nil {
+ return v.(*operationMetrics)
+ }
+ return nil
+}
+
+func operationTracer(p tracing.TracerProvider) tracing.Tracer {
+ return p.Tracer("github.com/aws/aws-sdk-go-v2/service/signin")
+}
+
+// Client provides the API client to make operations call for AWS Sign-In Service.
+type Client struct {
+ options Options
+
+ // Difference between the time reported by the server and the client
+ timeOffset *atomic.Int64
+}
+
+// New returns an initialized Client based on the functional options. Provide
+// additional functional options to further configure the behavior of the client,
+// such as changing the client's endpoint or adding custom middleware behavior.
+func New(options Options, optFns ...func(*Options)) *Client {
+ options = options.Copy()
+
+ resolveDefaultLogger(&options)
+
+ setResolvedDefaultsMode(&options)
+
+ resolveRetryer(&options)
+
+ resolveHTTPClient(&options)
+
+ resolveHTTPSignerV4(&options)
+
+ resolveEndpointResolverV2(&options)
+
+ resolveTracerProvider(&options)
+
+ resolveMeterProvider(&options)
+
+ resolveAuthSchemeResolver(&options)
+
+ for _, fn := range optFns {
+ fn(&options)
+ }
+
+ finalizeRetryMaxAttempts(&options)
+
+ ignoreAnonymousAuth(&options)
+
+ wrapWithAnonymousAuth(&options)
+
+ resolveAuthSchemes(&options)
+
+ client := &Client{
+ options: options,
+ }
+
+ initializeTimeOffsetResolver(client)
+
+ return client
+}
+
+// Options returns a copy of the client configuration.
+//
+// Callers SHOULD NOT perform mutations on any inner structures within client
+// config. Config overrides should instead be made on a per-operation basis through
+// functional options.
+func (c *Client) Options() Options {
+ return c.options.Copy()
+}
+
+func (c *Client) invokeOperation(
+ ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error,
+) (
+ result interface{}, metadata middleware.Metadata, err error,
+) {
+ ctx = middleware.ClearStackValues(ctx)
+ ctx = middleware.WithServiceID(ctx, ServiceID)
+ ctx = middleware.WithOperationName(ctx, opID)
+
+ stack := middleware.NewStack(opID, smithyhttp.NewStackRequest)
+ options := c.options.Copy()
+
+ for _, fn := range optFns {
+ fn(&options)
+ }
+
+ finalizeOperationRetryMaxAttempts(&options, *c)
+
+ finalizeClientEndpointResolverOptions(&options)
+
+ for _, fn := range stackFns {
+ if err := fn(stack, options); err != nil {
+ return nil, metadata, err
+ }
+ }
+
+ for _, fn := range options.APIOptions {
+ if err := fn(stack); err != nil {
+ return nil, metadata, err
+ }
+ }
+
+ ctx, err = withOperationMetrics(ctx, options.MeterProvider)
+ if err != nil {
+ return nil, metadata, err
+ }
+
+ tracer := operationTracer(options.TracerProvider)
+ spanName := fmt.Sprintf("%s.%s", ServiceID, opID)
+
+ ctx = tracing.WithOperationTracer(ctx, tracer)
+
+ ctx, span := tracer.StartSpan(ctx, spanName, func(o *tracing.SpanOptions) {
+ o.Kind = tracing.SpanKindClient
+ o.Properties.Set("rpc.system", "aws-api")
+ o.Properties.Set("rpc.method", opID)
+ o.Properties.Set("rpc.service", ServiceID)
+ })
+ endTimer := startMetricTimer(ctx, "client.call.duration")
+ defer endTimer()
+ defer span.End()
+
+ handler := smithyhttp.NewClientHandlerWithOptions(options.HTTPClient, func(o *smithyhttp.ClientHandler) {
+ o.Meter = options.MeterProvider.Meter("github.com/aws/aws-sdk-go-v2/service/signin")
+ })
+ decorated := middleware.DecorateHandler(handler, stack)
+ result, metadata, err = decorated.Handle(ctx, params)
+ if err != nil {
+ span.SetProperty("exception.type", fmt.Sprintf("%T", err))
+ span.SetProperty("exception.message", err.Error())
+
+ var aerr smithy.APIError
+ if errors.As(err, &aerr) {
+ span.SetProperty("api.error_code", aerr.ErrorCode())
+ span.SetProperty("api.error_message", aerr.ErrorMessage())
+ span.SetProperty("api.error_fault", aerr.ErrorFault().String())
+ }
+
+ err = &smithy.OperationError{
+ ServiceID: ServiceID,
+ OperationName: opID,
+ Err: err,
+ }
+ }
+
+ span.SetProperty("error", err != nil)
+ if err == nil {
+ span.SetStatus(tracing.SpanStatusOK)
+ } else {
+ span.SetStatus(tracing.SpanStatusError)
+ }
+
+ return result, metadata, err
+}
+
+type operationInputKey struct{}
+
+func setOperationInput(ctx context.Context, input interface{}) context.Context {
+ return middleware.WithStackValue(ctx, operationInputKey{}, input)
+}
+
+func getOperationInput(ctx context.Context) interface{} {
+ return middleware.GetStackValue(ctx, operationInputKey{})
+}
+
+type setOperationInputMiddleware struct {
+}
+
+func (*setOperationInputMiddleware) ID() string {
+ return "setOperationInput"
+}
+
+func (m *setOperationInputMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+ out middleware.SerializeOutput, metadata middleware.Metadata, err error,
+) {
+ ctx = setOperationInput(ctx, in.Parameters)
+ return next.HandleSerialize(ctx, in)
+}
+
+func addProtocolFinalizerMiddlewares(stack *middleware.Stack, options Options, operation string) error {
+ if err := stack.Finalize.Add(&resolveAuthSchemeMiddleware{operation: operation, options: options}, middleware.Before); err != nil {
+ return fmt.Errorf("add ResolveAuthScheme: %w", err)
+ }
+ if err := stack.Finalize.Insert(&getIdentityMiddleware{options: options}, "ResolveAuthScheme", middleware.After); err != nil {
+ return fmt.Errorf("add GetIdentity: %v", err)
+ }
+ if err := stack.Finalize.Insert(&resolveEndpointV2Middleware{options: options}, "GetIdentity", middleware.After); err != nil {
+ return fmt.Errorf("add ResolveEndpointV2: %v", err)
+ }
+ if err := stack.Finalize.Insert(&signRequestMiddleware{options: options}, "ResolveEndpointV2", middleware.After); err != nil {
+ return fmt.Errorf("add Signing: %w", err)
+ }
+ return nil
+}
+func resolveAuthSchemeResolver(options *Options) {
+ if options.AuthSchemeResolver == nil {
+ options.AuthSchemeResolver = &defaultAuthSchemeResolver{}
+ }
+}
+
+func resolveAuthSchemes(options *Options) {
+ if options.AuthSchemes == nil {
+ options.AuthSchemes = []smithyhttp.AuthScheme{
+ internalauth.NewHTTPAuthScheme("aws.auth#sigv4", &internalauthsmithy.V4SignerAdapter{
+ Signer: options.HTTPSignerV4,
+ Logger: options.Logger,
+ LogSigning: options.ClientLogMode.IsSigning(),
+ }),
+ }
+ }
+}
+
+type noSmithyDocumentSerde = smithydocument.NoSerde
+
+type legacyEndpointContextSetter struct {
+ LegacyResolver EndpointResolver
+}
+
+func (*legacyEndpointContextSetter) ID() string {
+ return "legacyEndpointContextSetter"
+}
+
+func (m *legacyEndpointContextSetter) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
+ out middleware.InitializeOutput, metadata middleware.Metadata, err error,
+) {
+ if m.LegacyResolver != nil {
+ ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, true)
+ }
+
+ return next.HandleInitialize(ctx, in)
+
+}
+func addlegacyEndpointContextSetter(stack *middleware.Stack, o Options) error {
+ return stack.Initialize.Add(&legacyEndpointContextSetter{
+ LegacyResolver: o.EndpointResolver,
+ }, middleware.Before)
+}
+
+func resolveDefaultLogger(o *Options) {
+ if o.Logger != nil {
+ return
+ }
+ o.Logger = logging.Nop{}
+}
+
+func addSetLoggerMiddleware(stack *middleware.Stack, o Options) error {
+ return middleware.AddSetLoggerMiddleware(stack, o.Logger)
+}
+
+func setResolvedDefaultsMode(o *Options) {
+ if len(o.resolvedDefaultsMode) > 0 {
+ return
+ }
+
+ var mode aws.DefaultsMode
+ mode.SetFromString(string(o.DefaultsMode))
+
+ if mode == aws.DefaultsModeAuto {
+ mode = defaults.ResolveDefaultsModeAuto(o.Region, o.RuntimeEnvironment)
+ }
+
+ o.resolvedDefaultsMode = mode
+}
+
+// NewFromConfig returns a new client from the provided config.
+func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client {
+ opts := Options{
+ Region: cfg.Region,
+ DefaultsMode: cfg.DefaultsMode,
+ RuntimeEnvironment: cfg.RuntimeEnvironment,
+ HTTPClient: cfg.HTTPClient,
+ Credentials: cfg.Credentials,
+ APIOptions: cfg.APIOptions,
+ Logger: cfg.Logger,
+ ClientLogMode: cfg.ClientLogMode,
+ AppID: cfg.AppID,
+ AuthSchemePreference: cfg.AuthSchemePreference,
+ }
+ resolveAWSRetryerProvider(cfg, &opts)
+ resolveAWSRetryMaxAttempts(cfg, &opts)
+ resolveAWSRetryMode(cfg, &opts)
+ resolveAWSEndpointResolver(cfg, &opts)
+ resolveInterceptors(cfg, &opts)
+ resolveUseDualStackEndpoint(cfg, &opts)
+ resolveUseFIPSEndpoint(cfg, &opts)
+ resolveBaseEndpoint(cfg, &opts)
+ return New(opts, func(o *Options) {
+ for _, opt := range cfg.ServiceOptions {
+ opt(ServiceID, o)
+ }
+ for _, opt := range optFns {
+ opt(o)
+ }
+ })
+}
+
+func resolveHTTPClient(o *Options) {
+ var buildable *awshttp.BuildableClient
+
+ if o.HTTPClient != nil {
+ var ok bool
+ buildable, ok = o.HTTPClient.(*awshttp.BuildableClient)
+ if !ok {
+ return
+ }
+ } else {
+ buildable = awshttp.NewBuildableClient()
+ }
+
+ modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode)
+ if err == nil {
+ buildable = buildable.WithDialerOptions(func(dialer *net.Dialer) {
+ if dialerTimeout, ok := modeConfig.GetConnectTimeout(); ok {
+ dialer.Timeout = dialerTimeout
+ }
+ })
+
+ buildable = buildable.WithTransportOptions(func(transport *http.Transport) {
+ if tlsHandshakeTimeout, ok := modeConfig.GetTLSNegotiationTimeout(); ok {
+ transport.TLSHandshakeTimeout = tlsHandshakeTimeout
+ }
+ })
+ }
+
+ o.HTTPClient = buildable
+}
+
+func resolveRetryer(o *Options) {
+ if o.Retryer != nil {
+ return
+ }
+
+ if len(o.RetryMode) == 0 {
+ modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode)
+ if err == nil {
+ o.RetryMode = modeConfig.RetryMode
+ }
+ }
+ if len(o.RetryMode) == 0 {
+ o.RetryMode = aws.RetryModeStandard
+ }
+
+ var standardOptions []func(*retry.StandardOptions)
+ if v := o.RetryMaxAttempts; v != 0 {
+ standardOptions = append(standardOptions, func(so *retry.StandardOptions) {
+ so.MaxAttempts = v
+ })
+ }
+
+ switch o.RetryMode {
+ case aws.RetryModeAdaptive:
+ var adaptiveOptions []func(*retry.AdaptiveModeOptions)
+ if len(standardOptions) != 0 {
+ adaptiveOptions = append(adaptiveOptions, func(ao *retry.AdaptiveModeOptions) {
+ ao.StandardOptions = append(ao.StandardOptions, standardOptions...)
+ })
+ }
+ o.Retryer = retry.NewAdaptiveMode(adaptiveOptions...)
+
+ default:
+ o.Retryer = retry.NewStandard(standardOptions...)
+ }
+}
+
+func resolveAWSRetryerProvider(cfg aws.Config, o *Options) {
+ if cfg.Retryer == nil {
+ return
+ }
+ o.Retryer = cfg.Retryer()
+}
+
+func resolveAWSRetryMode(cfg aws.Config, o *Options) {
+ if len(cfg.RetryMode) == 0 {
+ return
+ }
+ o.RetryMode = cfg.RetryMode
+}
+func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) {
+ if cfg.RetryMaxAttempts == 0 {
+ return
+ }
+ o.RetryMaxAttempts = cfg.RetryMaxAttempts
+}
+
+func finalizeRetryMaxAttempts(o *Options) {
+ if o.RetryMaxAttempts == 0 {
+ return
+ }
+
+ o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts)
+}
+
+func finalizeOperationRetryMaxAttempts(o *Options, client Client) {
+ if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts {
+ return
+ }
+
+ o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts)
+}
+
+func resolveAWSEndpointResolver(cfg aws.Config, o *Options) {
+ if cfg.EndpointResolver == nil && cfg.EndpointResolverWithOptions == nil {
+ return
+ }
+ o.EndpointResolver = withEndpointResolver(cfg.EndpointResolver, cfg.EndpointResolverWithOptions)
+}
+
+func resolveInterceptors(cfg aws.Config, o *Options) {
+ o.Interceptors = cfg.Interceptors.Copy()
+}
+
+func addClientUserAgent(stack *middleware.Stack, options Options) error {
+ ua, err := getOrAddRequestUserAgent(stack)
+ if err != nil {
+ return err
+ }
+
+ ua.AddSDKAgentKeyValue(awsmiddleware.APIMetadata, "signin", goModuleVersion)
+ if len(options.AppID) > 0 {
+ ua.AddSDKAgentKey(awsmiddleware.ApplicationIdentifier, options.AppID)
+ }
+
+ return nil
+}
+
+func getOrAddRequestUserAgent(stack *middleware.Stack) (*awsmiddleware.RequestUserAgent, error) {
+ id := (*awsmiddleware.RequestUserAgent)(nil).ID()
+ mw, ok := stack.Build.Get(id)
+ if !ok {
+ mw = awsmiddleware.NewRequestUserAgent()
+ if err := stack.Build.Add(mw, middleware.After); err != nil {
+ return nil, err
+ }
+ }
+
+ ua, ok := mw.(*awsmiddleware.RequestUserAgent)
+ if !ok {
+ return nil, fmt.Errorf("%T for %s middleware did not match expected type", mw, id)
+ }
+
+ return ua, nil
+}
+
+type HTTPSignerV4 interface {
+ SignHTTP(ctx context.Context, credentials aws.Credentials, r *http.Request, payloadHash string, service string, region string, signingTime time.Time, optFns ...func(*v4.SignerOptions)) error
+}
+
+func resolveHTTPSignerV4(o *Options) {
+ if o.HTTPSignerV4 != nil {
+ return
+ }
+ o.HTTPSignerV4 = newDefaultV4Signer(*o)
+}
+
+func newDefaultV4Signer(o Options) *v4.Signer {
+ return v4.NewSigner(func(so *v4.SignerOptions) {
+ so.Logger = o.Logger
+ so.LogSigning = o.ClientLogMode.IsSigning()
+ })
+}
+
+func addClientRequestID(stack *middleware.Stack) error {
+ return stack.Build.Add(&awsmiddleware.ClientRequestID{}, middleware.After)
+}
+
+func addComputeContentLength(stack *middleware.Stack) error {
+ return stack.Build.Add(&smithyhttp.ComputeContentLength{}, middleware.After)
+}
+
+func addRawResponseToMetadata(stack *middleware.Stack) error {
+ return stack.Deserialize.Add(&awsmiddleware.AddRawResponse{}, middleware.Before)
+}
+
+func addRecordResponseTiming(stack *middleware.Stack) error {
+ return stack.Deserialize.Add(&awsmiddleware.RecordResponseTiming{}, middleware.After)
+}
+
+func addSpanRetryLoop(stack *middleware.Stack, options Options) error {
+ return stack.Finalize.Insert(&spanRetryLoop{options: options}, "Retry", middleware.Before)
+}
+
+type spanRetryLoop struct {
+ options Options
+}
+
+func (*spanRetryLoop) ID() string {
+ return "spanRetryLoop"
+}
+
+func (m *spanRetryLoop) HandleFinalize(
+ ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler,
+) (
+ middleware.FinalizeOutput, middleware.Metadata, error,
+) {
+ tracer := operationTracer(m.options.TracerProvider)
+ ctx, span := tracer.StartSpan(ctx, "RetryLoop")
+ defer span.End()
+
+ return next.HandleFinalize(ctx, in)
+}
+func addStreamingEventsPayload(stack *middleware.Stack) error {
+ return stack.Finalize.Add(&v4.StreamingEventsPayload{}, middleware.Before)
+}
+
+func addUnsignedPayload(stack *middleware.Stack) error {
+ return stack.Finalize.Insert(&v4.UnsignedPayload{}, "ResolveEndpointV2", middleware.After)
+}
+
+func addComputePayloadSHA256(stack *middleware.Stack) error {
+ return stack.Finalize.Insert(&v4.ComputePayloadSHA256{}, "ResolveEndpointV2", middleware.After)
+}
+
+func addContentSHA256Header(stack *middleware.Stack) error {
+ return stack.Finalize.Insert(&v4.ContentSHA256Header{}, (*v4.ComputePayloadSHA256)(nil).ID(), middleware.After)
+}
+
+func addIsWaiterUserAgent(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ ua, err := getOrAddRequestUserAgent(stack)
+ if err != nil {
+ return err
+ }
+
+ ua.AddUserAgentFeature(awsmiddleware.UserAgentFeatureWaiter)
+ return nil
+ })
+}
+
+func addIsPaginatorUserAgent(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error {
+ ua, err := getOrAddRequestUserAgent(stack)
+ if err != nil {
+ return err
+ }
+
+ ua.AddUserAgentFeature(awsmiddleware.UserAgentFeaturePaginator)
+ return nil
+ })
+}
+
+func addRetry(stack *middleware.Stack, o Options) error {
+ attempt := retry.NewAttemptMiddleware(o.Retryer, smithyhttp.RequestCloner, func(m *retry.Attempt) {
+ m.LogAttempts = o.ClientLogMode.IsRetries()
+ m.OperationMeter = o.MeterProvider.Meter("github.com/aws/aws-sdk-go-v2/service/signin")
+ })
+ if err := stack.Finalize.Insert(attempt, "ResolveAuthScheme", middleware.Before); err != nil {
+ return err
+ }
+ if err := stack.Finalize.Insert(&retry.MetricsHeader{}, attempt.ID(), middleware.After); err != nil {
+ return err
+ }
+ return nil
+}
+
+// resolves dual-stack endpoint configuration
+func resolveUseDualStackEndpoint(cfg aws.Config, o *Options) error {
+ if len(cfg.ConfigSources) == 0 {
+ return nil
+ }
+ value, found, err := internalConfig.ResolveUseDualStackEndpoint(context.Background(), cfg.ConfigSources)
+ if err != nil {
+ return err
+ }
+ if found {
+ o.EndpointOptions.UseDualStackEndpoint = value
+ }
+ return nil
+}
+
+// resolves FIPS endpoint configuration
+func resolveUseFIPSEndpoint(cfg aws.Config, o *Options) error {
+ if len(cfg.ConfigSources) == 0 {
+ return nil
+ }
+ value, found, err := internalConfig.ResolveUseFIPSEndpoint(context.Background(), cfg.ConfigSources)
+ if err != nil {
+ return err
+ }
+ if found {
+ o.EndpointOptions.UseFIPSEndpoint = value
+ }
+ return nil
+}
+
+func resolveAccountID(identity smithyauth.Identity, mode aws.AccountIDEndpointMode) *string {
+ if mode == aws.AccountIDEndpointModeDisabled {
+ return nil
+ }
+
+ if ca, ok := identity.(*internalauthsmithy.CredentialsAdapter); ok && ca.Credentials.AccountID != "" {
+ return aws.String(ca.Credentials.AccountID)
+ }
+
+ return nil
+}
+
+func addTimeOffsetBuild(stack *middleware.Stack, c *Client) error {
+ mw := internalmiddleware.AddTimeOffsetMiddleware{Offset: c.timeOffset}
+ if err := stack.Build.Add(&mw, middleware.After); err != nil {
+ return err
+ }
+ return stack.Deserialize.Insert(&mw, "RecordResponseTiming", middleware.Before)
+}
+func initializeTimeOffsetResolver(c *Client) {
+ c.timeOffset = new(atomic.Int64)
+}
+
+func addUserAgentRetryMode(stack *middleware.Stack, options Options) error {
+ ua, err := getOrAddRequestUserAgent(stack)
+ if err != nil {
+ return err
+ }
+
+ switch options.Retryer.(type) {
+ case *retry.Standard:
+ ua.AddUserAgentFeature(awsmiddleware.UserAgentFeatureRetryModeStandard)
+ case *retry.AdaptiveMode:
+ ua.AddUserAgentFeature(awsmiddleware.UserAgentFeatureRetryModeAdaptive)
+ }
+ return nil
+}
+
+type setCredentialSourceMiddleware struct {
+ ua *awsmiddleware.RequestUserAgent
+ options Options
+}
+
+func (m setCredentialSourceMiddleware) ID() string { return "SetCredentialSourceMiddleware" }
+
+func (m setCredentialSourceMiddleware) HandleBuild(ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler) (
+ out middleware.BuildOutput, metadata middleware.Metadata, err error,
+) {
+ asProviderSource, ok := m.options.Credentials.(aws.CredentialProviderSource)
+ if !ok {
+ return next.HandleBuild(ctx, in)
+ }
+ providerSources := asProviderSource.ProviderSources()
+ for _, source := range providerSources {
+ m.ua.AddCredentialsSource(source)
+ }
+ return next.HandleBuild(ctx, in)
+}
+
+func addCredentialSource(stack *middleware.Stack, options Options) error {
+ ua, err := getOrAddRequestUserAgent(stack)
+ if err != nil {
+ return err
+ }
+
+ mw := setCredentialSourceMiddleware{ua: ua, options: options}
+ return stack.Build.Insert(&mw, "UserAgent", middleware.Before)
+}
+
+func resolveTracerProvider(options *Options) {
+ if options.TracerProvider == nil {
+ options.TracerProvider = &tracing.NopTracerProvider{}
+ }
+}
+
+func resolveMeterProvider(options *Options) {
+ if options.MeterProvider == nil {
+ options.MeterProvider = metrics.NopMeterProvider{}
+ }
+}
+
+func addRecursionDetection(stack *middleware.Stack) error {
+ return stack.Build.Add(&awsmiddleware.RecursionDetection{}, middleware.After)
+}
+
+func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error {
+ return stack.Deserialize.Insert(&awsmiddleware.RequestIDRetriever{}, "OperationDeserializer", middleware.Before)
+
+}
+
+func addResponseErrorMiddleware(stack *middleware.Stack) error {
+ return stack.Deserialize.Insert(&awshttp.ResponseErrorWrapper{}, "RequestIDRetriever", middleware.Before)
+
+}
+
+func addRequestResponseLogging(stack *middleware.Stack, o Options) error {
+ return stack.Deserialize.Add(&smithyhttp.RequestResponseLogger{
+ LogRequest: o.ClientLogMode.IsRequest(),
+ LogRequestWithBody: o.ClientLogMode.IsRequestWithBody(),
+ LogResponse: o.ClientLogMode.IsResponse(),
+ LogResponseWithBody: o.ClientLogMode.IsResponseWithBody(),
+ }, middleware.After)
+}
+
+type disableHTTPSMiddleware struct {
+ DisableHTTPS bool
+}
+
+func (*disableHTTPSMiddleware) ID() string {
+ return "disableHTTPS"
+}
+
+func (m *disableHTTPSMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
+ out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
+) {
+ req, ok := in.Request.(*smithyhttp.Request)
+ if !ok {
+ return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
+ }
+
+ if m.DisableHTTPS && !smithyhttp.GetHostnameImmutable(ctx) {
+ req.URL.Scheme = "http"
+ }
+
+ return next.HandleFinalize(ctx, in)
+}
+
+func addDisableHTTPSMiddleware(stack *middleware.Stack, o Options) error {
+ return stack.Finalize.Insert(&disableHTTPSMiddleware{
+ DisableHTTPS: o.EndpointOptions.DisableHTTPS,
+ }, "ResolveEndpointV2", middleware.After)
+}
+
+func addInterceptBeforeRetryLoop(stack *middleware.Stack, opts Options) error {
+ return stack.Finalize.Insert(&smithyhttp.InterceptBeforeRetryLoop{
+ Interceptors: opts.Interceptors.BeforeRetryLoop,
+ }, "Retry", middleware.Before)
+}
+
+func addInterceptAttempt(stack *middleware.Stack, opts Options) error {
+ return stack.Finalize.Insert(&smithyhttp.InterceptAttempt{
+ BeforeAttempt: opts.Interceptors.BeforeAttempt,
+ AfterAttempt: opts.Interceptors.AfterAttempt,
+ }, "Retry", middleware.After)
+}
+
+func addInterceptors(stack *middleware.Stack, opts Options) error {
+ // middlewares are expensive, don't add all of these interceptor ones unless the caller
+ // actually has at least one interceptor configured
+ //
+ // at the moment it's all-or-nothing because some of the middlewares here are responsible for
+ // setting fields in the interceptor context for future ones
+ if len(opts.Interceptors.BeforeExecution) == 0 &&
+ len(opts.Interceptors.BeforeSerialization) == 0 && len(opts.Interceptors.AfterSerialization) == 0 &&
+ len(opts.Interceptors.BeforeRetryLoop) == 0 &&
+ len(opts.Interceptors.BeforeAttempt) == 0 &&
+ len(opts.Interceptors.BeforeSigning) == 0 && len(opts.Interceptors.AfterSigning) == 0 &&
+ len(opts.Interceptors.BeforeTransmit) == 0 && len(opts.Interceptors.AfterTransmit) == 0 &&
+ len(opts.Interceptors.BeforeDeserialization) == 0 && len(opts.Interceptors.AfterDeserialization) == 0 &&
+ len(opts.Interceptors.AfterAttempt) == 0 && len(opts.Interceptors.AfterExecution) == 0 {
+ return nil
+ }
+
+ return errors.Join(
+ stack.Initialize.Add(&smithyhttp.InterceptExecution{
+ BeforeExecution: opts.Interceptors.BeforeExecution,
+ AfterExecution: opts.Interceptors.AfterExecution,
+ }, middleware.Before),
+ stack.Serialize.Insert(&smithyhttp.InterceptBeforeSerialization{
+ Interceptors: opts.Interceptors.BeforeSerialization,
+ }, "OperationSerializer", middleware.Before),
+ stack.Serialize.Insert(&smithyhttp.InterceptAfterSerialization{
+ Interceptors: opts.Interceptors.AfterSerialization,
+ }, "OperationSerializer", middleware.After),
+ stack.Finalize.Insert(&smithyhttp.InterceptBeforeSigning{
+ Interceptors: opts.Interceptors.BeforeSigning,
+ }, "Signing", middleware.Before),
+ stack.Finalize.Insert(&smithyhttp.InterceptAfterSigning{
+ Interceptors: opts.Interceptors.AfterSigning,
+ }, "Signing", middleware.After),
+ stack.Deserialize.Add(&smithyhttp.InterceptTransmit{
+ BeforeTransmit: opts.Interceptors.BeforeTransmit,
+ AfterTransmit: opts.Interceptors.AfterTransmit,
+ }, middleware.After),
+ stack.Deserialize.Insert(&smithyhttp.InterceptBeforeDeserialization{
+ Interceptors: opts.Interceptors.BeforeDeserialization,
+ }, "OperationDeserializer", middleware.After), // (deserialize stack is called in reverse)
+ stack.Deserialize.Insert(&smithyhttp.InterceptAfterDeserialization{
+ Interceptors: opts.Interceptors.AfterDeserialization,
+ }, "OperationDeserializer", middleware.Before),
+ )
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/api_op_CreateOAuth2Token.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/api_op_CreateOAuth2Token.go
new file mode 100644
index 00000000000..54ba42422d0
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/api_op_CreateOAuth2Token.go
@@ -0,0 +1,209 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package signin
+
+import (
+ "context"
+ "fmt"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ "github.com/aws/aws-sdk-go-v2/service/signin/types"
+ "github.com/aws/smithy-go/middleware"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+)
+
+// CreateOAuth2Token API
+//
+// Path: /v1/token Request Method: POST Content-Type: application/json or
+// application/x-www-form-urlencoded
+//
+// This API implements OAuth 2.0 flows for AWS Sign-In CLI clients, supporting
+// both:
+//
+// - Authorization code redemption (grant_type=authorization_code) - NOT
+// idempotent
+// - Token refresh (grant_type=refresh_token) - Idempotent within token validity
+// window
+//
+// The operation behavior is determined by the grant_type parameter in the request
+// body:
+//
+// Authorization Code Flow (NOT Idempotent):
+//
+// - JSON or form-encoded body with client_id, grant_type=authorization_code,
+// code, redirect_uri, code_verifier
+// - Returns access_token, token_type, expires_in, refresh_token, and id_token
+// - Each authorization code can only be used ONCE for security (prevents replay
+// attacks)
+//
+// Token Refresh Flow (Idempotent):
+//
+// - JSON or form-encoded body with client_id, grant_type=refresh_token,
+// refresh_token
+// - Returns access_token, token_type, expires_in, and refresh_token (no
+// id_token)
+// - Multiple calls with same refresh_token return consistent results within
+// validity window
+//
+// Authentication and authorization:
+//
+// - Confidential clients: sigv4 signing required with signin:ExchangeToken
+// permissions
+// - CLI clients (public): authn/authz skipped based on client_id & grant_type
+//
+// Note: This operation cannot be marked as @idempotent because it handles both
+// idempotent (token refresh) and non-idempotent (auth code redemption) flows in a
+// single endpoint.
+func (c *Client) CreateOAuth2Token(ctx context.Context, params *CreateOAuth2TokenInput, optFns ...func(*Options)) (*CreateOAuth2TokenOutput, error) {
+ if params == nil {
+ params = &CreateOAuth2TokenInput{}
+ }
+
+ result, metadata, err := c.invokeOperation(ctx, "CreateOAuth2Token", params, optFns, c.addOperationCreateOAuth2TokenMiddlewares)
+ if err != nil {
+ return nil, err
+ }
+
+ out := result.(*CreateOAuth2TokenOutput)
+ out.ResultMetadata = metadata
+ return out, nil
+}
+
+// Input structure for CreateOAuth2Token operation
+//
+// Contains flattened token operation inputs for both authorization code and
+// refresh token flows. The operation type is determined by the grant_type
+// parameter in the request body.
+type CreateOAuth2TokenInput struct {
+
+ // Flattened token operation inputs The specific operation is determined by
+ // grant_type in the request body
+ //
+ // This member is required.
+ TokenInput *types.CreateOAuth2TokenRequestBody
+
+ noSmithyDocumentSerde
+}
+
+// Output structure for CreateOAuth2Token operation
+//
+// Contains flattened token operation outputs for both authorization code and
+// refresh token flows. The response content depends on the grant_type from the
+// original request.
+type CreateOAuth2TokenOutput struct {
+
+ // Flattened token operation outputs The specific response fields depend on the
+ // grant_type used in the request
+ //
+ // This member is required.
+ TokenOutput *types.CreateOAuth2TokenResponseBody
+
+ // Metadata pertaining to the operation's result.
+ ResultMetadata middleware.Metadata
+
+ noSmithyDocumentSerde
+}
+
+func (c *Client) addOperationCreateOAuth2TokenMiddlewares(stack *middleware.Stack, options Options) (err error) {
+ if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
+ return err
+ }
+ err = stack.Serialize.Add(&awsRestjson1_serializeOpCreateOAuth2Token{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ err = stack.Deserialize.Add(&awsRestjson1_deserializeOpCreateOAuth2Token{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ if err := addProtocolFinalizerMiddlewares(stack, options, "CreateOAuth2Token"); err != nil {
+ return fmt.Errorf("add protocol finalizers: %v", err)
+ }
+
+ if err = addlegacyEndpointContextSetter(stack, options); err != nil {
+ return err
+ }
+ if err = addSetLoggerMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addClientRequestID(stack); err != nil {
+ return err
+ }
+ if err = addComputeContentLength(stack); err != nil {
+ return err
+ }
+ if err = addResolveEndpointMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addRetry(stack, options); err != nil {
+ return err
+ }
+ if err = addRawResponseToMetadata(stack); err != nil {
+ return err
+ }
+ if err = addRecordResponseTiming(stack); err != nil {
+ return err
+ }
+ if err = addSpanRetryLoop(stack, options); err != nil {
+ return err
+ }
+ if err = addClientUserAgent(stack, options); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addTimeOffsetBuild(stack, c); err != nil {
+ return err
+ }
+ if err = addUserAgentRetryMode(stack, options); err != nil {
+ return err
+ }
+ if err = addCredentialSource(stack, options); err != nil {
+ return err
+ }
+ if err = addOpCreateOAuth2TokenValidationMiddleware(stack); err != nil {
+ return err
+ }
+ if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateOAuth2Token(options.Region), middleware.Before); err != nil {
+ return err
+ }
+ if err = addRecursionDetection(stack); err != nil {
+ return err
+ }
+ if err = addRequestIDRetrieverMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addResponseErrorMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addRequestResponseLogging(stack, options); err != nil {
+ return err
+ }
+ if err = addDisableHTTPSMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
+ return err
+ }
+ if err = addInterceptAttempt(stack, options); err != nil {
+ return err
+ }
+ if err = addInterceptors(stack, options); err != nil {
+ return err
+ }
+ return nil
+}
+
+func newServiceMetadataMiddleware_opCreateOAuth2Token(region string) *awsmiddleware.RegisterServiceMetadata {
+ return &awsmiddleware.RegisterServiceMetadata{
+ Region: region,
+ ServiceID: ServiceID,
+ OperationName: "CreateOAuth2Token",
+ }
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/auth.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/auth.go
new file mode 100644
index 00000000000..a9fadf4d10a
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/auth.go
@@ -0,0 +1,345 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package signin
+
+import (
+ "context"
+ "fmt"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ smithy "github.com/aws/smithy-go"
+ smithyauth "github.com/aws/smithy-go/auth"
+ "github.com/aws/smithy-go/metrics"
+ "github.com/aws/smithy-go/middleware"
+ "github.com/aws/smithy-go/tracing"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+ "slices"
+ "strings"
+)
+
+func bindAuthParamsRegion(_ interface{}, params *AuthResolverParameters, _ interface{}, options Options) {
+ params.Region = options.Region
+}
+
+type setLegacyContextSigningOptionsMiddleware struct {
+}
+
+func (*setLegacyContextSigningOptionsMiddleware) ID() string {
+ return "setLegacyContextSigningOptions"
+}
+
+func (m *setLegacyContextSigningOptionsMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
+ out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
+) {
+ rscheme := getResolvedAuthScheme(ctx)
+ schemeID := rscheme.Scheme.SchemeID()
+
+ if sn := awsmiddleware.GetSigningName(ctx); sn != "" {
+ if schemeID == "aws.auth#sigv4" {
+ smithyhttp.SetSigV4SigningName(&rscheme.SignerProperties, sn)
+ } else if schemeID == "aws.auth#sigv4a" {
+ smithyhttp.SetSigV4ASigningName(&rscheme.SignerProperties, sn)
+ }
+ }
+
+ if sr := awsmiddleware.GetSigningRegion(ctx); sr != "" {
+ if schemeID == "aws.auth#sigv4" {
+ smithyhttp.SetSigV4SigningRegion(&rscheme.SignerProperties, sr)
+ } else if schemeID == "aws.auth#sigv4a" {
+ smithyhttp.SetSigV4ASigningRegions(&rscheme.SignerProperties, []string{sr})
+ }
+ }
+
+ return next.HandleFinalize(ctx, in)
+}
+
+func addSetLegacyContextSigningOptionsMiddleware(stack *middleware.Stack) error {
+ return stack.Finalize.Insert(&setLegacyContextSigningOptionsMiddleware{}, "Signing", middleware.Before)
+}
+
+type withAnonymous struct {
+ resolver AuthSchemeResolver
+}
+
+var _ AuthSchemeResolver = (*withAnonymous)(nil)
+
+func (v *withAnonymous) ResolveAuthSchemes(ctx context.Context, params *AuthResolverParameters) ([]*smithyauth.Option, error) {
+ opts, err := v.resolver.ResolveAuthSchemes(ctx, params)
+ if err != nil {
+ return nil, err
+ }
+
+ opts = append(opts, &smithyauth.Option{
+ SchemeID: smithyauth.SchemeIDAnonymous,
+ })
+ return opts, nil
+}
+
+func wrapWithAnonymousAuth(options *Options) {
+ if _, ok := options.AuthSchemeResolver.(*defaultAuthSchemeResolver); !ok {
+ return
+ }
+
+ options.AuthSchemeResolver = &withAnonymous{
+ resolver: options.AuthSchemeResolver,
+ }
+}
+
+// AuthResolverParameters contains the set of inputs necessary for auth scheme
+// resolution.
+type AuthResolverParameters struct {
+ // The name of the operation being invoked.
+ Operation string
+
+ // The region in which the operation is being invoked.
+ Region string
+}
+
+func bindAuthResolverParams(ctx context.Context, operation string, input interface{}, options Options) *AuthResolverParameters {
+ params := &AuthResolverParameters{
+ Operation: operation,
+ }
+
+ bindAuthParamsRegion(ctx, params, input, options)
+
+ return params
+}
+
+// AuthSchemeResolver returns a set of possible authentication options for an
+// operation.
+type AuthSchemeResolver interface {
+ ResolveAuthSchemes(context.Context, *AuthResolverParameters) ([]*smithyauth.Option, error)
+}
+
+type defaultAuthSchemeResolver struct{}
+
+var _ AuthSchemeResolver = (*defaultAuthSchemeResolver)(nil)
+
+func (*defaultAuthSchemeResolver) ResolveAuthSchemes(ctx context.Context, params *AuthResolverParameters) ([]*smithyauth.Option, error) {
+ if overrides, ok := operationAuthOptions[params.Operation]; ok {
+ return overrides(params), nil
+ }
+ return serviceAuthOptions(params), nil
+}
+
+var operationAuthOptions = map[string]func(*AuthResolverParameters) []*smithyauth.Option{
+ "CreateOAuth2Token": func(params *AuthResolverParameters) []*smithyauth.Option {
+ return []*smithyauth.Option{
+ {SchemeID: smithyauth.SchemeIDAnonymous},
+ }
+ },
+}
+
+func serviceAuthOptions(params *AuthResolverParameters) []*smithyauth.Option {
+ return []*smithyauth.Option{
+ {
+ SchemeID: smithyauth.SchemeIDSigV4,
+ SignerProperties: func() smithy.Properties {
+ var props smithy.Properties
+ smithyhttp.SetSigV4SigningName(&props, "signin")
+ smithyhttp.SetSigV4SigningRegion(&props, params.Region)
+ return props
+ }(),
+ },
+ }
+}
+
+type resolveAuthSchemeMiddleware struct {
+ operation string
+ options Options
+}
+
+func (*resolveAuthSchemeMiddleware) ID() string {
+ return "ResolveAuthScheme"
+}
+
+func (m *resolveAuthSchemeMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
+ out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
+) {
+ _, span := tracing.StartSpan(ctx, "ResolveAuthScheme")
+ defer span.End()
+
+ params := bindAuthResolverParams(ctx, m.operation, getOperationInput(ctx), m.options)
+ options, err := m.options.AuthSchemeResolver.ResolveAuthSchemes(ctx, params)
+ if err != nil {
+ return out, metadata, fmt.Errorf("resolve auth scheme: %w", err)
+ }
+
+ scheme, ok := m.selectScheme(options)
+ if !ok {
+ return out, metadata, fmt.Errorf("could not select an auth scheme")
+ }
+
+ ctx = setResolvedAuthScheme(ctx, scheme)
+
+ span.SetProperty("auth.scheme_id", scheme.Scheme.SchemeID())
+ span.End()
+ return next.HandleFinalize(ctx, in)
+}
+
+func (m *resolveAuthSchemeMiddleware) selectScheme(options []*smithyauth.Option) (*resolvedAuthScheme, bool) {
+ sorted := sortAuthOptions(options, m.options.AuthSchemePreference)
+ for _, option := range sorted {
+ if option.SchemeID == smithyauth.SchemeIDAnonymous {
+ return newResolvedAuthScheme(smithyhttp.NewAnonymousScheme(), option), true
+ }
+
+ for _, scheme := range m.options.AuthSchemes {
+ if scheme.SchemeID() != option.SchemeID {
+ continue
+ }
+
+ if scheme.IdentityResolver(m.options) != nil {
+ return newResolvedAuthScheme(scheme, option), true
+ }
+ }
+ }
+
+ return nil, false
+}
+
+func sortAuthOptions(options []*smithyauth.Option, preferred []string) []*smithyauth.Option {
+ byPriority := make([]*smithyauth.Option, 0, len(options))
+ for _, prefName := range preferred {
+ for _, option := range options {
+ optName := option.SchemeID
+ if parts := strings.Split(option.SchemeID, "#"); len(parts) == 2 {
+ optName = parts[1]
+ }
+ if prefName == optName {
+ byPriority = append(byPriority, option)
+ }
+ }
+ }
+ for _, option := range options {
+ if !slices.ContainsFunc(byPriority, func(o *smithyauth.Option) bool {
+ return o.SchemeID == option.SchemeID
+ }) {
+ byPriority = append(byPriority, option)
+ }
+ }
+ return byPriority
+}
+
+type resolvedAuthSchemeKey struct{}
+
+type resolvedAuthScheme struct {
+ Scheme smithyhttp.AuthScheme
+ IdentityProperties smithy.Properties
+ SignerProperties smithy.Properties
+}
+
+func newResolvedAuthScheme(scheme smithyhttp.AuthScheme, option *smithyauth.Option) *resolvedAuthScheme {
+ return &resolvedAuthScheme{
+ Scheme: scheme,
+ IdentityProperties: option.IdentityProperties,
+ SignerProperties: option.SignerProperties,
+ }
+}
+
+func setResolvedAuthScheme(ctx context.Context, scheme *resolvedAuthScheme) context.Context {
+ return middleware.WithStackValue(ctx, resolvedAuthSchemeKey{}, scheme)
+}
+
+func getResolvedAuthScheme(ctx context.Context) *resolvedAuthScheme {
+ v, _ := middleware.GetStackValue(ctx, resolvedAuthSchemeKey{}).(*resolvedAuthScheme)
+ return v
+}
+
+type getIdentityMiddleware struct {
+ options Options
+}
+
+func (*getIdentityMiddleware) ID() string {
+ return "GetIdentity"
+}
+
+func (m *getIdentityMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
+ out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
+) {
+ innerCtx, span := tracing.StartSpan(ctx, "GetIdentity")
+ defer span.End()
+
+ rscheme := getResolvedAuthScheme(innerCtx)
+ if rscheme == nil {
+ return out, metadata, fmt.Errorf("no resolved auth scheme")
+ }
+
+ resolver := rscheme.Scheme.IdentityResolver(m.options)
+ if resolver == nil {
+ return out, metadata, fmt.Errorf("no identity resolver")
+ }
+
+ identity, err := timeOperationMetric(ctx, "client.call.resolve_identity_duration",
+ func() (smithyauth.Identity, error) {
+ return resolver.GetIdentity(innerCtx, rscheme.IdentityProperties)
+ },
+ func(o *metrics.RecordMetricOptions) {
+ o.Properties.Set("auth.scheme_id", rscheme.Scheme.SchemeID())
+ })
+ if err != nil {
+ return out, metadata, fmt.Errorf("get identity: %w", err)
+ }
+
+ ctx = setIdentity(ctx, identity)
+
+ span.End()
+ return next.HandleFinalize(ctx, in)
+}
+
+type identityKey struct{}
+
+func setIdentity(ctx context.Context, identity smithyauth.Identity) context.Context {
+ return middleware.WithStackValue(ctx, identityKey{}, identity)
+}
+
+func getIdentity(ctx context.Context) smithyauth.Identity {
+ v, _ := middleware.GetStackValue(ctx, identityKey{}).(smithyauth.Identity)
+ return v
+}
+
+type signRequestMiddleware struct {
+ options Options
+}
+
+func (*signRequestMiddleware) ID() string {
+ return "Signing"
+}
+
+func (m *signRequestMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
+ out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
+) {
+ _, span := tracing.StartSpan(ctx, "SignRequest")
+ defer span.End()
+
+ req, ok := in.Request.(*smithyhttp.Request)
+ if !ok {
+ return out, metadata, fmt.Errorf("unexpected transport type %T", in.Request)
+ }
+
+ rscheme := getResolvedAuthScheme(ctx)
+ if rscheme == nil {
+ return out, metadata, fmt.Errorf("no resolved auth scheme")
+ }
+
+ identity := getIdentity(ctx)
+ if identity == nil {
+ return out, metadata, fmt.Errorf("no identity")
+ }
+
+ signer := rscheme.Scheme.Signer()
+ if signer == nil {
+ return out, metadata, fmt.Errorf("no signer")
+ }
+
+ _, err = timeOperationMetric(ctx, "client.call.signing_duration", func() (any, error) {
+ return nil, signer.SignRequest(ctx, req, identity, rscheme.SignerProperties)
+ }, func(o *metrics.RecordMetricOptions) {
+ o.Properties.Set("auth.scheme_id", rscheme.Scheme.SchemeID())
+ })
+ if err != nil {
+ return out, metadata, fmt.Errorf("sign request: %w", err)
+ }
+
+ span.End()
+ return next.HandleFinalize(ctx, in)
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/deserializers.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/deserializers.go
new file mode 100644
index 00000000000..b74b612e6b0
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/deserializers.go
@@ -0,0 +1,655 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package signin
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "fmt"
+ "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson"
+ "github.com/aws/aws-sdk-go-v2/service/signin/types"
+ smithy "github.com/aws/smithy-go"
+ smithyio "github.com/aws/smithy-go/io"
+ "github.com/aws/smithy-go/middleware"
+ "github.com/aws/smithy-go/ptr"
+ "github.com/aws/smithy-go/tracing"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+ "io"
+ "strings"
+)
+
+type awsRestjson1_deserializeOpCreateOAuth2Token struct {
+}
+
+func (*awsRestjson1_deserializeOpCreateOAuth2Token) ID() string {
+ return "OperationDeserializer"
+}
+
+func (m *awsRestjson1_deserializeOpCreateOAuth2Token) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
+ out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
+) {
+ out, metadata, err = next.HandleDeserialize(ctx, in)
+ if err != nil {
+ return out, metadata, err
+ }
+
+ _, span := tracing.StartSpan(ctx, "OperationDeserializer")
+ endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
+ defer endTimer()
+ defer span.End()
+ response, ok := out.RawResponse.(*smithyhttp.Response)
+ if !ok {
+ return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
+ }
+
+ if response.StatusCode < 200 || response.StatusCode >= 300 {
+ return out, metadata, awsRestjson1_deserializeOpErrorCreateOAuth2Token(response, &metadata)
+ }
+ output := &CreateOAuth2TokenOutput{}
+ out.Result = output
+
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(response.Body, ringBuffer)
+
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ var shape interface{}
+ if err := decoder.Decode(&shape); err != nil && err != io.EOF {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return out, metadata, err
+ }
+
+ err = awsRestjson1_deserializeDocumentCreateOAuth2TokenResponseBody(&output.TokenOutput, shape)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return out, metadata, &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ span.End()
+ return out, metadata, err
+}
+
+func awsRestjson1_deserializeOpErrorCreateOAuth2Token(response *smithyhttp.Response, metadata *middleware.Metadata) error {
+ var errorBuffer bytes.Buffer
+ if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
+ return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
+ }
+ errorBody := bytes.NewReader(errorBuffer.Bytes())
+
+ errorCode := "UnknownError"
+ errorMessage := errorCode
+
+ headerCode := response.Header.Get("X-Amzn-ErrorType")
+ if len(headerCode) != 0 {
+ errorCode = restjson.SanitizeErrorCode(headerCode)
+ }
+
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(errorBody, ringBuffer)
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ jsonCode, message, err := restjson.GetErrorInfo(decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ errorBody.Seek(0, io.SeekStart)
+ if len(headerCode) == 0 && len(jsonCode) != 0 {
+ errorCode = restjson.SanitizeErrorCode(jsonCode)
+ }
+ if len(message) != 0 {
+ errorMessage = message
+ }
+
+ switch {
+ case strings.EqualFold("AccessDeniedException", errorCode):
+ return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody)
+
+ case strings.EqualFold("InternalServerException", errorCode):
+ return awsRestjson1_deserializeErrorInternalServerException(response, errorBody)
+
+ case strings.EqualFold("TooManyRequestsError", errorCode):
+ return awsRestjson1_deserializeErrorTooManyRequestsError(response, errorBody)
+
+ case strings.EqualFold("ValidationException", errorCode):
+ return awsRestjson1_deserializeErrorValidationException(response, errorBody)
+
+ default:
+ genericError := &smithy.GenericAPIError{
+ Code: errorCode,
+ Message: errorMessage,
+ }
+ return genericError
+
+ }
+}
+
+func awsRestjson1_deserializeOpDocumentCreateOAuth2TokenOutput(v **CreateOAuth2TokenOutput, value interface{}) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ if value == nil {
+ return nil
+ }
+
+ shape, ok := value.(map[string]interface{})
+ if !ok {
+ return fmt.Errorf("unexpected JSON type %v", value)
+ }
+
+ var sv *CreateOAuth2TokenOutput
+ if *v == nil {
+ sv = &CreateOAuth2TokenOutput{}
+ } else {
+ sv = *v
+ }
+
+ for key, value := range shape {
+ switch key {
+ case "tokenOutput":
+ if err := awsRestjson1_deserializeDocumentCreateOAuth2TokenResponseBody(&sv.TokenOutput, value); err != nil {
+ return err
+ }
+
+ default:
+ _, _ = key, value
+
+ }
+ }
+ *v = sv
+ return nil
+}
+
+func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.AccessDeniedException{}
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(errorBody, ringBuffer)
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ var shape interface{}
+ if err := decoder.Decode(&shape); err != nil && err != io.EOF {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ err := awsRestjson1_deserializeDocumentAccessDeniedException(&output, shape)
+
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ errorBody.Seek(0, io.SeekStart)
+
+ return output
+}
+
+func awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.InternalServerException{}
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(errorBody, ringBuffer)
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ var shape interface{}
+ if err := decoder.Decode(&shape); err != nil && err != io.EOF {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ err := awsRestjson1_deserializeDocumentInternalServerException(&output, shape)
+
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ errorBody.Seek(0, io.SeekStart)
+
+ return output
+}
+
+func awsRestjson1_deserializeErrorTooManyRequestsError(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.TooManyRequestsError{}
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(errorBody, ringBuffer)
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ var shape interface{}
+ if err := decoder.Decode(&shape); err != nil && err != io.EOF {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ err := awsRestjson1_deserializeDocumentTooManyRequestsError(&output, shape)
+
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ errorBody.Seek(0, io.SeekStart)
+
+ return output
+}
+
+func awsRestjson1_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.ValidationException{}
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+
+ body := io.TeeReader(errorBody, ringBuffer)
+ decoder := json.NewDecoder(body)
+ decoder.UseNumber()
+ var shape interface{}
+ if err := decoder.Decode(&shape); err != nil && err != io.EOF {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ err := awsRestjson1_deserializeDocumentValidationException(&output, shape)
+
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return err
+ }
+
+ errorBody.Seek(0, io.SeekStart)
+
+ return output
+}
+
+func awsRestjson1_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ if value == nil {
+ return nil
+ }
+
+ shape, ok := value.(map[string]interface{})
+ if !ok {
+ return fmt.Errorf("unexpected JSON type %v", value)
+ }
+
+ var sv *types.AccessDeniedException
+ if *v == nil {
+ sv = &types.AccessDeniedException{}
+ } else {
+ sv = *v
+ }
+
+ for key, value := range shape {
+ switch key {
+ case "error":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected OAuth2ErrorCode to be of type string, got %T instead", value)
+ }
+ sv.Error_ = types.OAuth2ErrorCode(jtv)
+ }
+
+ case "message", "Message":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected String to be of type string, got %T instead", value)
+ }
+ sv.Message = ptr.String(jtv)
+ }
+
+ default:
+ _, _ = key, value
+
+ }
+ }
+ *v = sv
+ return nil
+}
+
+func awsRestjson1_deserializeDocumentAccessToken(v **types.AccessToken, value interface{}) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ if value == nil {
+ return nil
+ }
+
+ shape, ok := value.(map[string]interface{})
+ if !ok {
+ return fmt.Errorf("unexpected JSON type %v", value)
+ }
+
+ var sv *types.AccessToken
+ if *v == nil {
+ sv = &types.AccessToken{}
+ } else {
+ sv = *v
+ }
+
+ for key, value := range shape {
+ switch key {
+ case "accessKeyId":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected String to be of type string, got %T instead", value)
+ }
+ sv.AccessKeyId = ptr.String(jtv)
+ }
+
+ case "secretAccessKey":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected String to be of type string, got %T instead", value)
+ }
+ sv.SecretAccessKey = ptr.String(jtv)
+ }
+
+ case "sessionToken":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected String to be of type string, got %T instead", value)
+ }
+ sv.SessionToken = ptr.String(jtv)
+ }
+
+ default:
+ _, _ = key, value
+
+ }
+ }
+ *v = sv
+ return nil
+}
+
+func awsRestjson1_deserializeDocumentCreateOAuth2TokenResponseBody(v **types.CreateOAuth2TokenResponseBody, value interface{}) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ if value == nil {
+ return nil
+ }
+
+ shape, ok := value.(map[string]interface{})
+ if !ok {
+ return fmt.Errorf("unexpected JSON type %v", value)
+ }
+
+ var sv *types.CreateOAuth2TokenResponseBody
+ if *v == nil {
+ sv = &types.CreateOAuth2TokenResponseBody{}
+ } else {
+ sv = *v
+ }
+
+ for key, value := range shape {
+ switch key {
+ case "accessToken":
+ if err := awsRestjson1_deserializeDocumentAccessToken(&sv.AccessToken, value); err != nil {
+ return err
+ }
+
+ case "expiresIn":
+ if value != nil {
+ jtv, ok := value.(json.Number)
+ if !ok {
+ return fmt.Errorf("expected ExpiresIn to be json.Number, got %T instead", value)
+ }
+ i64, err := jtv.Int64()
+ if err != nil {
+ return err
+ }
+ sv.ExpiresIn = ptr.Int32(int32(i64))
+ }
+
+ case "idToken":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected IdToken to be of type string, got %T instead", value)
+ }
+ sv.IdToken = ptr.String(jtv)
+ }
+
+ case "refreshToken":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected RefreshToken to be of type string, got %T instead", value)
+ }
+ sv.RefreshToken = ptr.String(jtv)
+ }
+
+ case "tokenType":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected TokenType to be of type string, got %T instead", value)
+ }
+ sv.TokenType = ptr.String(jtv)
+ }
+
+ default:
+ _, _ = key, value
+
+ }
+ }
+ *v = sv
+ return nil
+}
+
+func awsRestjson1_deserializeDocumentInternalServerException(v **types.InternalServerException, value interface{}) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ if value == nil {
+ return nil
+ }
+
+ shape, ok := value.(map[string]interface{})
+ if !ok {
+ return fmt.Errorf("unexpected JSON type %v", value)
+ }
+
+ var sv *types.InternalServerException
+ if *v == nil {
+ sv = &types.InternalServerException{}
+ } else {
+ sv = *v
+ }
+
+ for key, value := range shape {
+ switch key {
+ case "error":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected OAuth2ErrorCode to be of type string, got %T instead", value)
+ }
+ sv.Error_ = types.OAuth2ErrorCode(jtv)
+ }
+
+ case "message", "Message":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected String to be of type string, got %T instead", value)
+ }
+ sv.Message = ptr.String(jtv)
+ }
+
+ default:
+ _, _ = key, value
+
+ }
+ }
+ *v = sv
+ return nil
+}
+
+func awsRestjson1_deserializeDocumentTooManyRequestsError(v **types.TooManyRequestsError, value interface{}) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ if value == nil {
+ return nil
+ }
+
+ shape, ok := value.(map[string]interface{})
+ if !ok {
+ return fmt.Errorf("unexpected JSON type %v", value)
+ }
+
+ var sv *types.TooManyRequestsError
+ if *v == nil {
+ sv = &types.TooManyRequestsError{}
+ } else {
+ sv = *v
+ }
+
+ for key, value := range shape {
+ switch key {
+ case "error":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected OAuth2ErrorCode to be of type string, got %T instead", value)
+ }
+ sv.Error_ = types.OAuth2ErrorCode(jtv)
+ }
+
+ case "message", "Message":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected String to be of type string, got %T instead", value)
+ }
+ sv.Message = ptr.String(jtv)
+ }
+
+ default:
+ _, _ = key, value
+
+ }
+ }
+ *v = sv
+ return nil
+}
+
+func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ if value == nil {
+ return nil
+ }
+
+ shape, ok := value.(map[string]interface{})
+ if !ok {
+ return fmt.Errorf("unexpected JSON type %v", value)
+ }
+
+ var sv *types.ValidationException
+ if *v == nil {
+ sv = &types.ValidationException{}
+ } else {
+ sv = *v
+ }
+
+ for key, value := range shape {
+ switch key {
+ case "error":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected OAuth2ErrorCode to be of type string, got %T instead", value)
+ }
+ sv.Error_ = types.OAuth2ErrorCode(jtv)
+ }
+
+ case "message", "Message":
+ if value != nil {
+ jtv, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("expected String to be of type string, got %T instead", value)
+ }
+ sv.Message = ptr.String(jtv)
+ }
+
+ default:
+ _, _ = key, value
+
+ }
+ }
+ *v = sv
+ return nil
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/doc.go
new file mode 100644
index 00000000000..dc1a8b62f09
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/doc.go
@@ -0,0 +1,9 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+// Package signin provides the API client, operations, and parameter types for AWS
+// Sign-In Service.
+//
+// AWS Sign-In manages authentication for AWS services. This service provides
+// secure authentication flows for accessing AWS resources from the console and
+// developer tools.
+package signin
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/endpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/endpoints.go
new file mode 100644
index 00000000000..b9b0eac28b8
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/endpoints.go
@@ -0,0 +1,623 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package signin
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "github.com/aws/aws-sdk-go-v2/aws"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources"
+ "github.com/aws/aws-sdk-go-v2/internal/endpoints"
+ "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn"
+ internalendpoints "github.com/aws/aws-sdk-go-v2/service/signin/internal/endpoints"
+ smithyauth "github.com/aws/smithy-go/auth"
+ smithyendpoints "github.com/aws/smithy-go/endpoints"
+ "github.com/aws/smithy-go/middleware"
+ "github.com/aws/smithy-go/ptr"
+ "github.com/aws/smithy-go/tracing"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+ "net/http"
+ "net/url"
+ "os"
+ "strings"
+)
+
+// EndpointResolverOptions is the service endpoint resolver options
+type EndpointResolverOptions = internalendpoints.Options
+
+// EndpointResolver interface for resolving service endpoints.
+type EndpointResolver interface {
+ ResolveEndpoint(region string, options EndpointResolverOptions) (aws.Endpoint, error)
+}
+
+var _ EndpointResolver = &internalendpoints.Resolver{}
+
+// NewDefaultEndpointResolver constructs a new service endpoint resolver
+func NewDefaultEndpointResolver() *internalendpoints.Resolver {
+ return internalendpoints.New()
+}
+
+// EndpointResolverFunc is a helper utility that wraps a function so it satisfies
+// the EndpointResolver interface. This is useful when you want to add additional
+// endpoint resolving logic, or stub out specific endpoints with custom values.
+type EndpointResolverFunc func(region string, options EndpointResolverOptions) (aws.Endpoint, error)
+
+func (fn EndpointResolverFunc) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) {
+ return fn(region, options)
+}
+
+// EndpointResolverFromURL returns an EndpointResolver configured using the
+// provided endpoint url. By default, the resolved endpoint resolver uses the
+// client region as signing region, and the endpoint source is set to
+// EndpointSourceCustom.You can provide functional options to configure endpoint
+// values for the resolved endpoint.
+func EndpointResolverFromURL(url string, optFns ...func(*aws.Endpoint)) EndpointResolver {
+ e := aws.Endpoint{URL: url, Source: aws.EndpointSourceCustom}
+ for _, fn := range optFns {
+ fn(&e)
+ }
+
+ return EndpointResolverFunc(
+ func(region string, options EndpointResolverOptions) (aws.Endpoint, error) {
+ if len(e.SigningRegion) == 0 {
+ e.SigningRegion = region
+ }
+ return e, nil
+ },
+ )
+}
+
+type ResolveEndpoint struct {
+ Resolver EndpointResolver
+ Options EndpointResolverOptions
+}
+
+func (*ResolveEndpoint) ID() string {
+ return "ResolveEndpoint"
+}
+
+func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+ out middleware.SerializeOutput, metadata middleware.Metadata, err error,
+) {
+ if !awsmiddleware.GetRequiresLegacyEndpoints(ctx) {
+ return next.HandleSerialize(ctx, in)
+ }
+
+ req, ok := in.Request.(*smithyhttp.Request)
+ if !ok {
+ return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
+ }
+
+ if m.Resolver == nil {
+ return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil")
+ }
+
+ eo := m.Options
+ eo.Logger = middleware.GetLogger(ctx)
+
+ var endpoint aws.Endpoint
+ endpoint, err = m.Resolver.ResolveEndpoint(awsmiddleware.GetRegion(ctx), eo)
+ if err != nil {
+ nf := (&aws.EndpointNotFoundError{})
+ if errors.As(err, &nf) {
+ ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, false)
+ return next.HandleSerialize(ctx, in)
+ }
+ return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err)
+ }
+
+ req.URL, err = url.Parse(endpoint.URL)
+ if err != nil {
+ return out, metadata, fmt.Errorf("failed to parse endpoint URL: %w", err)
+ }
+
+ if len(awsmiddleware.GetSigningName(ctx)) == 0 {
+ signingName := endpoint.SigningName
+ if len(signingName) == 0 {
+ signingName = "signin"
+ }
+ ctx = awsmiddleware.SetSigningName(ctx, signingName)
+ }
+ ctx = awsmiddleware.SetEndpointSource(ctx, endpoint.Source)
+ ctx = smithyhttp.SetHostnameImmutable(ctx, endpoint.HostnameImmutable)
+ ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion)
+ ctx = awsmiddleware.SetPartitionID(ctx, endpoint.PartitionID)
+ return next.HandleSerialize(ctx, in)
+}
+func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error {
+ return stack.Serialize.Insert(&ResolveEndpoint{
+ Resolver: o.EndpointResolver,
+ Options: o.EndpointOptions,
+ }, "OperationSerializer", middleware.Before)
+}
+
+func removeResolveEndpointMiddleware(stack *middleware.Stack) error {
+ _, err := stack.Serialize.Remove((&ResolveEndpoint{}).ID())
+ return err
+}
+
+type wrappedEndpointResolver struct {
+ awsResolver aws.EndpointResolverWithOptions
+}
+
+func (w *wrappedEndpointResolver) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) {
+ return w.awsResolver.ResolveEndpoint(ServiceID, region, options)
+}
+
+type awsEndpointResolverAdaptor func(service, region string) (aws.Endpoint, error)
+
+func (a awsEndpointResolverAdaptor) ResolveEndpoint(service, region string, options ...interface{}) (aws.Endpoint, error) {
+ return a(service, region)
+}
+
+var _ aws.EndpointResolverWithOptions = awsEndpointResolverAdaptor(nil)
+
+// withEndpointResolver returns an aws.EndpointResolverWithOptions that first delegates endpoint resolution to the awsResolver.
+// If awsResolver returns aws.EndpointNotFoundError error, the v1 resolver middleware will swallow the error,
+// and set an appropriate context flag such that fallback will occur when EndpointResolverV2 is invoked
+// via its middleware.
+//
+// If another error (besides aws.EndpointNotFoundError) is returned, then that error will be propagated.
+func withEndpointResolver(awsResolver aws.EndpointResolver, awsResolverWithOptions aws.EndpointResolverWithOptions) EndpointResolver {
+ var resolver aws.EndpointResolverWithOptions
+
+ if awsResolverWithOptions != nil {
+ resolver = awsResolverWithOptions
+ } else if awsResolver != nil {
+ resolver = awsEndpointResolverAdaptor(awsResolver.ResolveEndpoint)
+ }
+
+ return &wrappedEndpointResolver{
+ awsResolver: resolver,
+ }
+}
+
+func finalizeClientEndpointResolverOptions(options *Options) {
+ options.EndpointOptions.LogDeprecated = options.ClientLogMode.IsDeprecatedUsage()
+
+ if len(options.EndpointOptions.ResolvedRegion) == 0 {
+ const fipsInfix = "-fips-"
+ const fipsPrefix = "fips-"
+ const fipsSuffix = "-fips"
+
+ if strings.Contains(options.Region, fipsInfix) ||
+ strings.Contains(options.Region, fipsPrefix) ||
+ strings.Contains(options.Region, fipsSuffix) {
+ options.EndpointOptions.ResolvedRegion = strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(
+ options.Region, fipsInfix, "-"), fipsPrefix, ""), fipsSuffix, "")
+ options.EndpointOptions.UseFIPSEndpoint = aws.FIPSEndpointStateEnabled
+ }
+ }
+
+}
+
+func resolveEndpointResolverV2(options *Options) {
+ if options.EndpointResolverV2 == nil {
+ options.EndpointResolverV2 = NewDefaultEndpointResolverV2()
+ }
+}
+
+func resolveBaseEndpoint(cfg aws.Config, o *Options) {
+ if cfg.BaseEndpoint != nil {
+ o.BaseEndpoint = cfg.BaseEndpoint
+ }
+
+ _, g := os.LookupEnv("AWS_ENDPOINT_URL")
+ _, s := os.LookupEnv("AWS_ENDPOINT_URL_SIGNIN")
+
+ if g && !s {
+ return
+ }
+
+ value, found, err := internalConfig.ResolveServiceBaseEndpoint(context.Background(), "Signin", cfg.ConfigSources)
+ if found && err == nil {
+ o.BaseEndpoint = &value
+ }
+}
+
+func bindRegion(region string) (*string, error) {
+ if region == "" {
+ return nil, nil
+ }
+ if !smithyhttp.ValidHostLabel(region) {
+ return nil, fmt.Errorf("invalid input region %s", region)
+ }
+
+ return aws.String(endpoints.MapFIPSRegion(region)), nil
+}
+
+// EndpointParameters provides the parameters that influence how endpoints are
+// resolved.
+type EndpointParameters struct {
+ // When true, use the dual-stack endpoint. If the configured endpoint does not
+ // support dual-stack, dispatching the request MAY return an error.
+ //
+ // Defaults to
+ // false if no value is provided.
+ //
+ // AWS::UseDualStack
+ UseDualStack *bool
+
+ // When true, send this request to the FIPS-compliant regional endpoint. If the
+ // configured endpoint does not have a FIPS compliant endpoint, dispatching the
+ // request will return an error.
+ //
+ // Defaults to false if no value is
+ // provided.
+ //
+ // AWS::UseFIPS
+ UseFIPS *bool
+
+ // Override the endpoint used to send this request
+ //
+ // Parameter is
+ // required.
+ //
+ // SDK::Endpoint
+ Endpoint *string
+
+ // The AWS region used to dispatch the request.
+ //
+ // Parameter is
+ // required.
+ //
+ // AWS::Region
+ Region *string
+}
+
+// ValidateRequired validates required parameters are set.
+func (p EndpointParameters) ValidateRequired() error {
+ if p.UseDualStack == nil {
+ return fmt.Errorf("parameter UseDualStack is required")
+ }
+
+ if p.UseFIPS == nil {
+ return fmt.Errorf("parameter UseFIPS is required")
+ }
+
+ return nil
+}
+
+// WithDefaults returns a shallow copy of EndpointParameterswith default values
+// applied to members where applicable.
+func (p EndpointParameters) WithDefaults() EndpointParameters {
+ if p.UseDualStack == nil {
+ p.UseDualStack = ptr.Bool(false)
+ }
+
+ if p.UseFIPS == nil {
+ p.UseFIPS = ptr.Bool(false)
+ }
+ return p
+}
+
+type stringSlice []string
+
+func (s stringSlice) Get(i int) *string {
+ if i < 0 || i >= len(s) {
+ return nil
+ }
+
+ v := s[i]
+ return &v
+}
+
+// EndpointResolverV2 provides the interface for resolving service endpoints.
+type EndpointResolverV2 interface {
+ // ResolveEndpoint attempts to resolve the endpoint with the provided options,
+ // returning the endpoint if found. Otherwise an error is returned.
+ ResolveEndpoint(ctx context.Context, params EndpointParameters) (
+ smithyendpoints.Endpoint, error,
+ )
+}
+
+// resolver provides the implementation for resolving endpoints.
+type resolver struct{}
+
+func NewDefaultEndpointResolverV2() EndpointResolverV2 {
+ return &resolver{}
+}
+
+// ResolveEndpoint attempts to resolve the endpoint with the provided options,
+// returning the endpoint if found. Otherwise an error is returned.
+func (r *resolver) ResolveEndpoint(
+ ctx context.Context, params EndpointParameters,
+) (
+ endpoint smithyendpoints.Endpoint, err error,
+) {
+ params = params.WithDefaults()
+ if err = params.ValidateRequired(); err != nil {
+ return endpoint, fmt.Errorf("endpoint parameters are not valid, %w", err)
+ }
+ _UseDualStack := *params.UseDualStack
+ _ = _UseDualStack
+ _UseFIPS := *params.UseFIPS
+ _ = _UseFIPS
+
+ if exprVal := params.Endpoint; exprVal != nil {
+ _Endpoint := *exprVal
+ _ = _Endpoint
+ if _UseFIPS == true {
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: FIPS and custom endpoint are not supported")
+ }
+ if _UseDualStack == true {
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Dualstack and custom endpoint are not supported")
+ }
+ uriString := _Endpoint
+
+ uri, err := url.Parse(uriString)
+ if err != nil {
+ return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
+ }
+
+ return smithyendpoints.Endpoint{
+ URI: *uri,
+ Headers: http.Header{},
+ }, nil
+ }
+ if exprVal := params.Region; exprVal != nil {
+ _Region := *exprVal
+ _ = _Region
+ if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil {
+ _PartitionResult := *exprVal
+ _ = _PartitionResult
+ if _PartitionResult.Name == "aws" {
+ if _UseFIPS == false {
+ if _UseDualStack == false {
+ uriString := func() string {
+ var out strings.Builder
+ out.WriteString("https://")
+ out.WriteString(_Region)
+ out.WriteString(".signin.aws.amazon.com")
+ return out.String()
+ }()
+
+ uri, err := url.Parse(uriString)
+ if err != nil {
+ return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
+ }
+
+ return smithyendpoints.Endpoint{
+ URI: *uri,
+ Headers: http.Header{},
+ }, nil
+ }
+ }
+ }
+ if _PartitionResult.Name == "aws-cn" {
+ if _UseFIPS == false {
+ if _UseDualStack == false {
+ uriString := func() string {
+ var out strings.Builder
+ out.WriteString("https://")
+ out.WriteString(_Region)
+ out.WriteString(".signin.amazonaws.cn")
+ return out.String()
+ }()
+
+ uri, err := url.Parse(uriString)
+ if err != nil {
+ return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
+ }
+
+ return smithyendpoints.Endpoint{
+ URI: *uri,
+ Headers: http.Header{},
+ }, nil
+ }
+ }
+ }
+ if _PartitionResult.Name == "aws-us-gov" {
+ if _UseFIPS == false {
+ if _UseDualStack == false {
+ uriString := func() string {
+ var out strings.Builder
+ out.WriteString("https://")
+ out.WriteString(_Region)
+ out.WriteString(".signin.amazonaws-us-gov.com")
+ return out.String()
+ }()
+
+ uri, err := url.Parse(uriString)
+ if err != nil {
+ return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
+ }
+
+ return smithyendpoints.Endpoint{
+ URI: *uri,
+ Headers: http.Header{},
+ }, nil
+ }
+ }
+ }
+ if _UseFIPS == true {
+ if _UseDualStack == true {
+ if true == _PartitionResult.SupportsFIPS {
+ if true == _PartitionResult.SupportsDualStack {
+ uriString := func() string {
+ var out strings.Builder
+ out.WriteString("https://signin-fips.")
+ out.WriteString(_Region)
+ out.WriteString(".")
+ out.WriteString(_PartitionResult.DualStackDnsSuffix)
+ return out.String()
+ }()
+
+ uri, err := url.Parse(uriString)
+ if err != nil {
+ return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
+ }
+
+ return smithyendpoints.Endpoint{
+ URI: *uri,
+ Headers: http.Header{},
+ }, nil
+ }
+ }
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS and DualStack are enabled, but this partition does not support one or both")
+ }
+ }
+ if _UseFIPS == true {
+ if _UseDualStack == false {
+ if _PartitionResult.SupportsFIPS == true {
+ uriString := func() string {
+ var out strings.Builder
+ out.WriteString("https://signin-fips.")
+ out.WriteString(_Region)
+ out.WriteString(".")
+ out.WriteString(_PartitionResult.DnsSuffix)
+ return out.String()
+ }()
+
+ uri, err := url.Parse(uriString)
+ if err != nil {
+ return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
+ }
+
+ return smithyendpoints.Endpoint{
+ URI: *uri,
+ Headers: http.Header{},
+ }, nil
+ }
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS is enabled but this partition does not support FIPS")
+ }
+ }
+ if _UseFIPS == false {
+ if _UseDualStack == true {
+ if true == _PartitionResult.SupportsDualStack {
+ uriString := func() string {
+ var out strings.Builder
+ out.WriteString("https://signin.")
+ out.WriteString(_Region)
+ out.WriteString(".")
+ out.WriteString(_PartitionResult.DualStackDnsSuffix)
+ return out.String()
+ }()
+
+ uri, err := url.Parse(uriString)
+ if err != nil {
+ return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
+ }
+
+ return smithyendpoints.Endpoint{
+ URI: *uri,
+ Headers: http.Header{},
+ }, nil
+ }
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "DualStack is enabled but this partition does not support DualStack")
+ }
+ }
+ uriString := func() string {
+ var out strings.Builder
+ out.WriteString("https://signin.")
+ out.WriteString(_Region)
+ out.WriteString(".")
+ out.WriteString(_PartitionResult.DnsSuffix)
+ return out.String()
+ }()
+
+ uri, err := url.Parse(uriString)
+ if err != nil {
+ return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString)
+ }
+
+ return smithyendpoints.Endpoint{
+ URI: *uri,
+ Headers: http.Header{},
+ }, nil
+ }
+ return endpoint, fmt.Errorf("Endpoint resolution failed. Invalid operation or environment input.")
+ }
+ return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Missing Region")
+}
+
+type endpointParamsBinder interface {
+ bindEndpointParams(*EndpointParameters)
+}
+
+func bindEndpointParams(ctx context.Context, input interface{}, options Options) (*EndpointParameters, error) {
+ params := &EndpointParameters{}
+
+ params.UseDualStack = aws.Bool(options.EndpointOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled)
+ params.UseFIPS = aws.Bool(options.EndpointOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled)
+ params.Endpoint = options.BaseEndpoint
+ region, err := bindRegion(options.Region)
+ if err != nil {
+ return nil, err
+ }
+ params.Region = region
+
+ if b, ok := input.(endpointParamsBinder); ok {
+ b.bindEndpointParams(params)
+ }
+
+ return params, nil
+}
+
+type resolveEndpointV2Middleware struct {
+ options Options
+}
+
+func (*resolveEndpointV2Middleware) ID() string {
+ return "ResolveEndpointV2"
+}
+
+func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) (
+ out middleware.FinalizeOutput, metadata middleware.Metadata, err error,
+) {
+ _, span := tracing.StartSpan(ctx, "ResolveEndpoint")
+ defer span.End()
+
+ if awsmiddleware.GetRequiresLegacyEndpoints(ctx) {
+ return next.HandleFinalize(ctx, in)
+ }
+
+ req, ok := in.Request.(*smithyhttp.Request)
+ if !ok {
+ return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
+ }
+
+ if m.options.EndpointResolverV2 == nil {
+ return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil")
+ }
+
+ params, err := bindEndpointParams(ctx, getOperationInput(ctx), m.options)
+ if err != nil {
+ return out, metadata, fmt.Errorf("failed to bind endpoint params, %w", err)
+ }
+ endpt, err := timeOperationMetric(ctx, "client.call.resolve_endpoint_duration",
+ func() (smithyendpoints.Endpoint, error) {
+ return m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params)
+ })
+ if err != nil {
+ return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err)
+ }
+
+ span.SetProperty("client.call.resolved_endpoint", endpt.URI.String())
+
+ if endpt.URI.RawPath == "" && req.URL.RawPath != "" {
+ endpt.URI.RawPath = endpt.URI.Path
+ }
+ req.URL.Scheme = endpt.URI.Scheme
+ req.URL.Host = endpt.URI.Host
+ req.URL.Path = smithyhttp.JoinPath(endpt.URI.Path, req.URL.Path)
+ req.URL.RawPath = smithyhttp.JoinPath(endpt.URI.RawPath, req.URL.RawPath)
+ for k := range endpt.Headers {
+ req.Header.Set(k, endpt.Headers.Get(k))
+ }
+
+ rscheme := getResolvedAuthScheme(ctx)
+ if rscheme == nil {
+ return out, metadata, fmt.Errorf("no resolved auth scheme")
+ }
+
+ opts, _ := smithyauth.GetAuthOptions(&endpt.Properties)
+ for _, o := range opts {
+ rscheme.SignerProperties.SetAll(&o.SignerProperties)
+ }
+
+ span.End()
+ return next.HandleFinalize(ctx, in)
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/generated.json b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/generated.json
new file mode 100644
index 00000000000..8014c56167c
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/generated.json
@@ -0,0 +1,34 @@
+{
+ "dependencies": {
+ "github.com/aws/aws-sdk-go-v2": "v1.4.0",
+ "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000",
+ "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2": "v2.0.0-00010101000000-000000000000",
+ "github.com/aws/smithy-go": "v1.4.0"
+ },
+ "files": [
+ "api_client.go",
+ "api_client_test.go",
+ "api_op_CreateOAuth2Token.go",
+ "auth.go",
+ "deserializers.go",
+ "doc.go",
+ "endpoints.go",
+ "endpoints_config_test.go",
+ "endpoints_test.go",
+ "generated.json",
+ "internal/endpoints/endpoints.go",
+ "internal/endpoints/endpoints_test.go",
+ "options.go",
+ "protocol_test.go",
+ "serializers.go",
+ "snapshot_test.go",
+ "sra_operation_order_test.go",
+ "types/enums.go",
+ "types/errors.go",
+ "types/types.go",
+ "validators.go"
+ ],
+ "go": "1.23",
+ "module": "github.com/aws/aws-sdk-go-v2/service/signin",
+ "unstable": false
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/go_module_metadata.go
new file mode 100644
index 00000000000..f794373ee7f
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/go_module_metadata.go
@@ -0,0 +1,6 @@
+// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT.
+
+package signin
+
+// goModuleVersion is the tagged release for this module
+const goModuleVersion = "1.0.1"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/internal/endpoints/endpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/internal/endpoints/endpoints.go
new file mode 100644
index 00000000000..ad431b9e911
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/internal/endpoints/endpoints.go
@@ -0,0 +1,319 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package endpoints
+
+import (
+ "github.com/aws/aws-sdk-go-v2/aws"
+ endpoints "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2"
+ "github.com/aws/smithy-go/logging"
+ "regexp"
+)
+
+// Options is the endpoint resolver configuration options
+type Options struct {
+ // Logger is a logging implementation that log events should be sent to.
+ Logger logging.Logger
+
+ // LogDeprecated indicates that deprecated endpoints should be logged to the
+ // provided logger.
+ LogDeprecated bool
+
+ // ResolvedRegion is used to override the region to be resolved, rather then the
+ // using the value passed to the ResolveEndpoint method. This value is used by the
+ // SDK to translate regions like fips-us-east-1 or us-east-1-fips to an alternative
+ // name. You must not set this value directly in your application.
+ ResolvedRegion string
+
+ // DisableHTTPS informs the resolver to return an endpoint that does not use the
+ // HTTPS scheme.
+ DisableHTTPS bool
+
+ // UseDualStackEndpoint specifies the resolver must resolve a dual-stack endpoint.
+ UseDualStackEndpoint aws.DualStackEndpointState
+
+ // UseFIPSEndpoint specifies the resolver must resolve a FIPS endpoint.
+ UseFIPSEndpoint aws.FIPSEndpointState
+}
+
+func (o Options) GetResolvedRegion() string {
+ return o.ResolvedRegion
+}
+
+func (o Options) GetDisableHTTPS() bool {
+ return o.DisableHTTPS
+}
+
+func (o Options) GetUseDualStackEndpoint() aws.DualStackEndpointState {
+ return o.UseDualStackEndpoint
+}
+
+func (o Options) GetUseFIPSEndpoint() aws.FIPSEndpointState {
+ return o.UseFIPSEndpoint
+}
+
+func transformToSharedOptions(options Options) endpoints.Options {
+ return endpoints.Options{
+ Logger: options.Logger,
+ LogDeprecated: options.LogDeprecated,
+ ResolvedRegion: options.ResolvedRegion,
+ DisableHTTPS: options.DisableHTTPS,
+ UseDualStackEndpoint: options.UseDualStackEndpoint,
+ UseFIPSEndpoint: options.UseFIPSEndpoint,
+ }
+}
+
+// Resolver Signin endpoint resolver
+type Resolver struct {
+ partitions endpoints.Partitions
+}
+
+// ResolveEndpoint resolves the service endpoint for the given region and options
+func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws.Endpoint, err error) {
+ if len(region) == 0 {
+ return endpoint, &aws.MissingRegionError{}
+ }
+
+ opt := transformToSharedOptions(options)
+ return r.partitions.ResolveEndpoint(region, opt)
+}
+
+// New returns a new Resolver
+func New() *Resolver {
+ return &Resolver{
+ partitions: defaultPartitions,
+ }
+}
+
+var partitionRegexp = struct {
+ Aws *regexp.Regexp
+ AwsCn *regexp.Regexp
+ AwsEusc *regexp.Regexp
+ AwsIso *regexp.Regexp
+ AwsIsoB *regexp.Regexp
+ AwsIsoE *regexp.Regexp
+ AwsIsoF *regexp.Regexp
+ AwsUsGov *regexp.Regexp
+}{
+
+ Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$"),
+ AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"),
+ AwsEusc: regexp.MustCompile("^eusc\\-(de)\\-\\w+\\-\\d+$"),
+ AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"),
+ AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"),
+ AwsIsoE: regexp.MustCompile("^eu\\-isoe\\-\\w+\\-\\d+$"),
+ AwsIsoF: regexp.MustCompile("^us\\-isof\\-\\w+\\-\\d+$"),
+ AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"),
+}
+
+var defaultPartitions = endpoints.Partitions{
+ {
+ ID: "aws",
+ Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
+ {
+ Variant: endpoints.DualStackVariant,
+ }: {
+ Hostname: "signin.{region}.api.aws",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ {
+ Variant: endpoints.FIPSVariant,
+ }: {
+ Hostname: "signin-fips.{region}.amazonaws.com",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ {
+ Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
+ }: {
+ Hostname: "signin-fips.{region}.api.aws",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ {
+ Variant: 0,
+ }: {
+ Hostname: "signin.{region}.amazonaws.com",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ },
+ RegionRegex: partitionRegexp.Aws,
+ IsRegionalized: true,
+ },
+ {
+ ID: "aws-cn",
+ Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
+ {
+ Variant: endpoints.DualStackVariant,
+ }: {
+ Hostname: "signin.{region}.api.amazonwebservices.com.cn",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ {
+ Variant: endpoints.FIPSVariant,
+ }: {
+ Hostname: "signin-fips.{region}.amazonaws.com.cn",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ {
+ Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
+ }: {
+ Hostname: "signin-fips.{region}.api.amazonwebservices.com.cn",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ {
+ Variant: 0,
+ }: {
+ Hostname: "signin.{region}.amazonaws.com.cn",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ },
+ RegionRegex: partitionRegexp.AwsCn,
+ IsRegionalized: true,
+ },
+ {
+ ID: "aws-eusc",
+ Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
+ {
+ Variant: endpoints.FIPSVariant,
+ }: {
+ Hostname: "signin-fips.{region}.amazonaws.eu",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ {
+ Variant: 0,
+ }: {
+ Hostname: "signin.{region}.amazonaws.eu",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ },
+ RegionRegex: partitionRegexp.AwsEusc,
+ IsRegionalized: true,
+ },
+ {
+ ID: "aws-iso",
+ Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
+ {
+ Variant: endpoints.FIPSVariant,
+ }: {
+ Hostname: "signin-fips.{region}.c2s.ic.gov",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ {
+ Variant: 0,
+ }: {
+ Hostname: "signin.{region}.c2s.ic.gov",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ },
+ RegionRegex: partitionRegexp.AwsIso,
+ IsRegionalized: true,
+ },
+ {
+ ID: "aws-iso-b",
+ Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
+ {
+ Variant: endpoints.FIPSVariant,
+ }: {
+ Hostname: "signin-fips.{region}.sc2s.sgov.gov",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ {
+ Variant: 0,
+ }: {
+ Hostname: "signin.{region}.sc2s.sgov.gov",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ },
+ RegionRegex: partitionRegexp.AwsIsoB,
+ IsRegionalized: true,
+ },
+ {
+ ID: "aws-iso-e",
+ Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
+ {
+ Variant: endpoints.FIPSVariant,
+ }: {
+ Hostname: "signin-fips.{region}.cloud.adc-e.uk",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ {
+ Variant: 0,
+ }: {
+ Hostname: "signin.{region}.cloud.adc-e.uk",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ },
+ RegionRegex: partitionRegexp.AwsIsoE,
+ IsRegionalized: true,
+ },
+ {
+ ID: "aws-iso-f",
+ Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
+ {
+ Variant: endpoints.FIPSVariant,
+ }: {
+ Hostname: "signin-fips.{region}.csp.hci.ic.gov",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ {
+ Variant: 0,
+ }: {
+ Hostname: "signin.{region}.csp.hci.ic.gov",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ },
+ RegionRegex: partitionRegexp.AwsIsoF,
+ IsRegionalized: true,
+ },
+ {
+ ID: "aws-us-gov",
+ Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{
+ {
+ Variant: endpoints.DualStackVariant,
+ }: {
+ Hostname: "signin.{region}.api.aws",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ {
+ Variant: endpoints.FIPSVariant,
+ }: {
+ Hostname: "signin-fips.{region}.amazonaws.com",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ {
+ Variant: endpoints.FIPSVariant | endpoints.DualStackVariant,
+ }: {
+ Hostname: "signin-fips.{region}.api.aws",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ {
+ Variant: 0,
+ }: {
+ Hostname: "signin.{region}.amazonaws.com",
+ Protocols: []string{"https"},
+ SignatureVersions: []string{"v4"},
+ },
+ },
+ RegionRegex: partitionRegexp.AwsUsGov,
+ IsRegionalized: true,
+ },
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/options.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/options.go
new file mode 100644
index 00000000000..3262aa58224
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/options.go
@@ -0,0 +1,239 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package signin
+
+import (
+ "context"
+ "github.com/aws/aws-sdk-go-v2/aws"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy"
+ smithyauth "github.com/aws/smithy-go/auth"
+ "github.com/aws/smithy-go/logging"
+ "github.com/aws/smithy-go/metrics"
+ "github.com/aws/smithy-go/middleware"
+ "github.com/aws/smithy-go/tracing"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+ "net/http"
+)
+
+type HTTPClient interface {
+ Do(*http.Request) (*http.Response, error)
+}
+
+type Options struct {
+ // Set of options to modify how an operation is invoked. These apply to all
+ // operations invoked for this client. Use functional options on operation call to
+ // modify this list for per operation behavior.
+ APIOptions []func(*middleware.Stack) error
+
+ // The optional application specific identifier appended to the User-Agent header.
+ AppID string
+
+ // This endpoint will be given as input to an EndpointResolverV2. It is used for
+ // providing a custom base endpoint that is subject to modifications by the
+ // processing EndpointResolverV2.
+ BaseEndpoint *string
+
+ // Configures the events that will be sent to the configured logger.
+ ClientLogMode aws.ClientLogMode
+
+ // The credentials object to use when signing requests.
+ Credentials aws.CredentialsProvider
+
+ // The configuration DefaultsMode that the SDK should use when constructing the
+ // clients initial default settings.
+ DefaultsMode aws.DefaultsMode
+
+ // The endpoint options to be used when attempting to resolve an endpoint.
+ EndpointOptions EndpointResolverOptions
+
+ // The service endpoint resolver.
+ //
+ // Deprecated: Deprecated: EndpointResolver and WithEndpointResolver. Providing a
+ // value for this field will likely prevent you from using any endpoint-related
+ // service features released after the introduction of EndpointResolverV2 and
+ // BaseEndpoint.
+ //
+ // To migrate an EndpointResolver implementation that uses a custom endpoint, set
+ // the client option BaseEndpoint instead.
+ EndpointResolver EndpointResolver
+
+ // Resolves the endpoint used for a particular service operation. This should be
+ // used over the deprecated EndpointResolver.
+ EndpointResolverV2 EndpointResolverV2
+
+ // Signature Version 4 (SigV4) Signer
+ HTTPSignerV4 HTTPSignerV4
+
+ // The logger writer interface to write logging messages to.
+ Logger logging.Logger
+
+ // The client meter provider.
+ MeterProvider metrics.MeterProvider
+
+ // The region to send requests to. (Required)
+ Region string
+
+ // RetryMaxAttempts specifies the maximum number attempts an API client will call
+ // an operation that fails with a retryable error. A value of 0 is ignored, and
+ // will not be used to configure the API client created default retryer, or modify
+ // per operation call's retry max attempts.
+ //
+ // If specified in an operation call's functional options with a value that is
+ // different than the constructed client's Options, the Client's Retryer will be
+ // wrapped to use the operation's specific RetryMaxAttempts value.
+ RetryMaxAttempts int
+
+ // RetryMode specifies the retry mode the API client will be created with, if
+ // Retryer option is not also specified.
+ //
+ // When creating a new API Clients this member will only be used if the Retryer
+ // Options member is nil. This value will be ignored if Retryer is not nil.
+ //
+ // Currently does not support per operation call overrides, may in the future.
+ RetryMode aws.RetryMode
+
+ // Retryer guides how HTTP requests should be retried in case of recoverable
+ // failures. When nil the API client will use a default retryer. The kind of
+ // default retry created by the API client can be changed with the RetryMode
+ // option.
+ Retryer aws.Retryer
+
+ // The RuntimeEnvironment configuration, only populated if the DefaultsMode is set
+ // to DefaultsModeAuto and is initialized using config.LoadDefaultConfig . You
+ // should not populate this structure programmatically, or rely on the values here
+ // within your applications.
+ RuntimeEnvironment aws.RuntimeEnvironment
+
+ // The client tracer provider.
+ TracerProvider tracing.TracerProvider
+
+ // The initial DefaultsMode used when the client options were constructed. If the
+ // DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved
+ // value was at that point in time.
+ //
+ // Currently does not support per operation call overrides, may in the future.
+ resolvedDefaultsMode aws.DefaultsMode
+
+ // The HTTP client to invoke API calls with. Defaults to client's default HTTP
+ // implementation if nil.
+ HTTPClient HTTPClient
+
+ // Client registry of operation interceptors.
+ Interceptors smithyhttp.InterceptorRegistry
+
+ // The auth scheme resolver which determines how to authenticate for each
+ // operation.
+ AuthSchemeResolver AuthSchemeResolver
+
+ // The list of auth schemes supported by the client.
+ AuthSchemes []smithyhttp.AuthScheme
+
+ // Priority list of preferred auth scheme names (e.g. sigv4a).
+ AuthSchemePreference []string
+}
+
+// Copy creates a clone where the APIOptions list is deep copied.
+func (o Options) Copy() Options {
+ to := o
+ to.APIOptions = make([]func(*middleware.Stack) error, len(o.APIOptions))
+ copy(to.APIOptions, o.APIOptions)
+ to.Interceptors = o.Interceptors.Copy()
+
+ return to
+}
+
+func (o Options) GetIdentityResolver(schemeID string) smithyauth.IdentityResolver {
+ if schemeID == "aws.auth#sigv4" {
+ return getSigV4IdentityResolver(o)
+ }
+ if schemeID == "smithy.api#noAuth" {
+ return &smithyauth.AnonymousIdentityResolver{}
+ }
+ return nil
+}
+
+// WithAPIOptions returns a functional option for setting the Client's APIOptions
+// option.
+func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) {
+ return func(o *Options) {
+ o.APIOptions = append(o.APIOptions, optFns...)
+ }
+}
+
+// Deprecated: EndpointResolver and WithEndpointResolver. Providing a value for
+// this field will likely prevent you from using any endpoint-related service
+// features released after the introduction of EndpointResolverV2 and BaseEndpoint.
+//
+// To migrate an EndpointResolver implementation that uses a custom endpoint, set
+// the client option BaseEndpoint instead.
+func WithEndpointResolver(v EndpointResolver) func(*Options) {
+ return func(o *Options) {
+ o.EndpointResolver = v
+ }
+}
+
+// WithEndpointResolverV2 returns a functional option for setting the Client's
+// EndpointResolverV2 option.
+func WithEndpointResolverV2(v EndpointResolverV2) func(*Options) {
+ return func(o *Options) {
+ o.EndpointResolverV2 = v
+ }
+}
+
+func getSigV4IdentityResolver(o Options) smithyauth.IdentityResolver {
+ if o.Credentials != nil {
+ return &internalauthsmithy.CredentialsProviderAdapter{Provider: o.Credentials}
+ }
+ return nil
+}
+
+// WithSigV4SigningName applies an override to the authentication workflow to
+// use the given signing name for SigV4-authenticated operations.
+//
+// This is an advanced setting. The value here is FINAL, taking precedence over
+// the resolved signing name from both auth scheme resolution and endpoint
+// resolution.
+func WithSigV4SigningName(name string) func(*Options) {
+ fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
+ out middleware.InitializeOutput, metadata middleware.Metadata, err error,
+ ) {
+ return next.HandleInitialize(awsmiddleware.SetSigningName(ctx, name), in)
+ }
+ return func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error {
+ return s.Initialize.Add(
+ middleware.InitializeMiddlewareFunc("withSigV4SigningName", fn),
+ middleware.Before,
+ )
+ })
+ }
+}
+
+// WithSigV4SigningRegion applies an override to the authentication workflow to
+// use the given signing region for SigV4-authenticated operations.
+//
+// This is an advanced setting. The value here is FINAL, taking precedence over
+// the resolved signing region from both auth scheme resolution and endpoint
+// resolution.
+func WithSigV4SigningRegion(region string) func(*Options) {
+ fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
+ out middleware.InitializeOutput, metadata middleware.Metadata, err error,
+ ) {
+ return next.HandleInitialize(awsmiddleware.SetSigningRegion(ctx, region), in)
+ }
+ return func(o *Options) {
+ o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error {
+ return s.Initialize.Add(
+ middleware.InitializeMiddlewareFunc("withSigV4SigningRegion", fn),
+ middleware.Before,
+ )
+ })
+ }
+}
+
+func ignoreAnonymousAuth(options *Options) {
+ if aws.IsCredentialsProvider(options.Credentials, (*aws.AnonymousCredentials)(nil)) {
+ options.Credentials = nil
+ }
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/serializers.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/serializers.go
new file mode 100644
index 00000000000..958240275e3
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/serializers.go
@@ -0,0 +1,135 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package signin
+
+import (
+ "bytes"
+ "context"
+ "fmt"
+ "github.com/aws/aws-sdk-go-v2/service/signin/types"
+ smithy "github.com/aws/smithy-go"
+ "github.com/aws/smithy-go/encoding/httpbinding"
+ smithyjson "github.com/aws/smithy-go/encoding/json"
+ "github.com/aws/smithy-go/middleware"
+ "github.com/aws/smithy-go/tracing"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+)
+
+type awsRestjson1_serializeOpCreateOAuth2Token struct {
+}
+
+func (*awsRestjson1_serializeOpCreateOAuth2Token) ID() string {
+ return "OperationSerializer"
+}
+
+func (m *awsRestjson1_serializeOpCreateOAuth2Token) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+ out middleware.SerializeOutput, metadata middleware.Metadata, err error,
+) {
+ _, span := tracing.StartSpan(ctx, "OperationSerializer")
+ endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
+ defer endTimer()
+ defer span.End()
+ request, ok := in.Request.(*smithyhttp.Request)
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
+ }
+
+ input, ok := in.Parameters.(*CreateOAuth2TokenInput)
+ _ = input
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
+ }
+
+ opPath, opQuery := httpbinding.SplitURI("/v1/token")
+ request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath)
+ request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery)
+ request.Method = "POST"
+ var restEncoder *httpbinding.Encoder
+ if request.URL.RawPath == "" {
+ restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
+ } else {
+ request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath)
+ restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header)
+ }
+
+ if err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ if !restEncoder.HasHeader("Content-Type") {
+ ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true)
+ restEncoder.SetHeader("Content-Type").String("application/json")
+ }
+
+ if input.TokenInput != nil {
+ jsonEncoder := smithyjson.NewEncoder()
+ if err := awsRestjson1_serializeDocumentCreateOAuth2TokenRequestBody(input.TokenInput, jsonEncoder.Value); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+ payload := bytes.NewReader(jsonEncoder.Bytes())
+ if request, err = request.SetStream(payload); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+ } else {
+ jsonEncoder := smithyjson.NewEncoder()
+ jsonEncoder.Value.Object().Close()
+ payload := bytes.NewReader(jsonEncoder.Bytes())
+ if request, err = request.SetStream(payload); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ }
+
+ if request.Request, err = restEncoder.Encode(request.Request); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+ in.Request = request
+
+ endTimer()
+ span.End()
+ return next.HandleSerialize(ctx, in)
+}
+func awsRestjson1_serializeOpHttpBindingsCreateOAuth2TokenInput(v *CreateOAuth2TokenInput, encoder *httpbinding.Encoder) error {
+ if v == nil {
+ return fmt.Errorf("unsupported serialization of nil %T", v)
+ }
+
+ return nil
+}
+
+func awsRestjson1_serializeDocumentCreateOAuth2TokenRequestBody(v *types.CreateOAuth2TokenRequestBody, value smithyjson.Value) error {
+ object := value.Object()
+ defer object.Close()
+
+ if v.ClientId != nil {
+ ok := object.Key("clientId")
+ ok.String(*v.ClientId)
+ }
+
+ if v.Code != nil {
+ ok := object.Key("code")
+ ok.String(*v.Code)
+ }
+
+ if v.CodeVerifier != nil {
+ ok := object.Key("codeVerifier")
+ ok.String(*v.CodeVerifier)
+ }
+
+ if v.GrantType != nil {
+ ok := object.Key("grantType")
+ ok.String(*v.GrantType)
+ }
+
+ if v.RedirectUri != nil {
+ ok := object.Key("redirectUri")
+ ok.String(*v.RedirectUri)
+ }
+
+ if v.RefreshToken != nil {
+ ok := object.Key("refreshToken")
+ ok.String(*v.RefreshToken)
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/types/enums.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/types/enums.go
new file mode 100644
index 00000000000..ecfabb81f74
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/types/enums.go
@@ -0,0 +1,37 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package types
+
+type OAuth2ErrorCode string
+
+// Enum values for OAuth2ErrorCode
+const (
+ // Token has expired and needs to be refreshed
+ OAuth2ErrorCodeTokenExpired OAuth2ErrorCode = "TOKEN_EXPIRED"
+ // User credentials have been changed
+ OAuth2ErrorCodeUserCredentialsChanged OAuth2ErrorCode = "USER_CREDENTIALS_CHANGED"
+ // Insufficient permissions to perform this operation
+ OAuth2ErrorCodeInsufficientPermissions OAuth2ErrorCode = "INSUFFICIENT_PERMISSIONS"
+ // Authorization code has expired
+ OAuth2ErrorCodeAuthcodeExpired OAuth2ErrorCode = "AUTHCODE_EXPIRED"
+ // Internal server error occurred
+ OAuth2ErrorCodeServerError OAuth2ErrorCode = "server_error"
+ // The request is missing a required parameter, includes an invalid parameter
+ // value, or is otherwise malformed
+ OAuth2ErrorCodeInvalidRequest OAuth2ErrorCode = "INVALID_REQUEST"
+)
+
+// Values returns all known values for OAuth2ErrorCode. Note that this can be
+// expanded in the future, and so it is only as up to date as the client.
+//
+// The ordering of this slice is not guaranteed to be stable across updates.
+func (OAuth2ErrorCode) Values() []OAuth2ErrorCode {
+ return []OAuth2ErrorCode{
+ "TOKEN_EXPIRED",
+ "USER_CREDENTIALS_CHANGED",
+ "INSUFFICIENT_PERMISSIONS",
+ "AUTHCODE_EXPIRED",
+ "server_error",
+ "INVALID_REQUEST",
+ }
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/types/errors.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/types/errors.go
new file mode 100644
index 00000000000..ca4928a86c8
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/types/errors.go
@@ -0,0 +1,151 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package types
+
+import (
+ "fmt"
+ smithy "github.com/aws/smithy-go"
+)
+
+// Error thrown for access denied scenarios with flexible HTTP status mapping
+//
+// Runtime HTTP Status Code Mapping:
+//
+// - HTTP 401 (Unauthorized): TOKEN_EXPIRED, AUTHCODE_EXPIRED
+// - HTTP 403 (Forbidden): USER_CREDENTIALS_CHANGED, INSUFFICIENT_PERMISSIONS
+//
+// The specific HTTP status code is determined at runtime based on the error enum
+// value. Consumers should use the error field to determine the specific access
+// denial reason.
+type AccessDeniedException struct {
+ Message *string
+
+ ErrorCodeOverride *string
+
+ Error_ OAuth2ErrorCode
+
+ noSmithyDocumentSerde
+}
+
+func (e *AccessDeniedException) Error() string {
+ return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
+}
+func (e *AccessDeniedException) ErrorMessage() string {
+ if e.Message == nil {
+ return ""
+ }
+ return *e.Message
+}
+func (e *AccessDeniedException) ErrorCode() string {
+ if e == nil || e.ErrorCodeOverride == nil {
+ return "AccessDeniedException"
+ }
+ return *e.ErrorCodeOverride
+}
+func (e *AccessDeniedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
+
+// Error thrown when an internal server error occurs
+//
+// HTTP Status Code: 500 Internal Server Error
+//
+// Used for unexpected server-side errors that prevent request processing.
+type InternalServerException struct {
+ Message *string
+
+ ErrorCodeOverride *string
+
+ Error_ OAuth2ErrorCode
+
+ noSmithyDocumentSerde
+}
+
+func (e *InternalServerException) Error() string {
+ return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
+}
+func (e *InternalServerException) ErrorMessage() string {
+ if e.Message == nil {
+ return ""
+ }
+ return *e.Message
+}
+func (e *InternalServerException) ErrorCode() string {
+ if e == nil || e.ErrorCodeOverride == nil {
+ return "InternalServerException"
+ }
+ return *e.ErrorCodeOverride
+}
+func (e *InternalServerException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer }
+
+// Error thrown when rate limit is exceeded
+//
+// HTTP Status Code: 429 Too Many Requests
+//
+// Possible OAuth2ErrorCode values:
+//
+// - INVALID_REQUEST: Rate limiting, too many requests, abuse prevention
+//
+// Possible causes:
+//
+// - Too many token requests from the same client
+// - Rate limiting based on client_id or IP address
+// - Abuse prevention mechanisms triggered
+// - Service protection against excessive token generation
+type TooManyRequestsError struct {
+ Message *string
+
+ ErrorCodeOverride *string
+
+ Error_ OAuth2ErrorCode
+
+ noSmithyDocumentSerde
+}
+
+func (e *TooManyRequestsError) Error() string {
+ return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
+}
+func (e *TooManyRequestsError) ErrorMessage() string {
+ if e.Message == nil {
+ return ""
+ }
+ return *e.Message
+}
+func (e *TooManyRequestsError) ErrorCode() string {
+ if e == nil || e.ErrorCodeOverride == nil {
+ return "TooManyRequestsError"
+ }
+ return *e.ErrorCodeOverride
+}
+func (e *TooManyRequestsError) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
+
+// Error thrown when request validation fails
+//
+// HTTP Status Code: 400 Bad Request
+//
+// Used for request validation errors such as malformed parameters, missing
+// required fields, or invalid parameter values.
+type ValidationException struct {
+ Message *string
+
+ ErrorCodeOverride *string
+
+ Error_ OAuth2ErrorCode
+
+ noSmithyDocumentSerde
+}
+
+func (e *ValidationException) Error() string {
+ return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
+}
+func (e *ValidationException) ErrorMessage() string {
+ if e.Message == nil {
+ return ""
+ }
+ return *e.Message
+}
+func (e *ValidationException) ErrorCode() string {
+ if e == nil || e.ErrorCodeOverride == nil {
+ return "ValidationException"
+ }
+ return *e.ErrorCodeOverride
+}
+func (e *ValidationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/types/types.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/types/types.go
new file mode 100644
index 00000000000..98afa20bfcb
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/types/types.go
@@ -0,0 +1,115 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package types
+
+import (
+ smithydocument "github.com/aws/smithy-go/document"
+)
+
+// AWS credentials structure containing temporary access credentials
+//
+// The scoped-down, 15 minute duration AWS credentials. Scoping down will be based
+// on CLI policy (CLI team needs to create it). Similar to cloud shell
+// implementation.
+type AccessToken struct {
+
+ // AWS access key ID for temporary credentials
+ //
+ // This member is required.
+ AccessKeyId *string
+
+ // AWS secret access key for temporary credentials
+ //
+ // This member is required.
+ SecretAccessKey *string
+
+ // AWS session token for temporary credentials
+ //
+ // This member is required.
+ SessionToken *string
+
+ noSmithyDocumentSerde
+}
+
+// Request body payload for CreateOAuth2Token operation
+//
+// The operation type is determined by the grant_type parameter:
+//
+// - grant_type=authorization_code: Requires code, redirect_uri, code_verifier
+// - grant_type=refresh_token: Requires refresh_token
+type CreateOAuth2TokenRequestBody struct {
+
+ // The client identifier (ARN) used during Sign-In onboarding Required for both
+ // authorization code and refresh token flows
+ //
+ // This member is required.
+ ClientId *string
+
+ // OAuth 2.0 grant type - determines which flow is used Must be
+ // "authorization_code" or "refresh_token"
+ //
+ // This member is required.
+ GrantType *string
+
+ // The authorization code received from /v1/authorize Required only when
+ // grant_type=authorization_code
+ Code *string
+
+ // PKCE code verifier to prove possession of the original code challenge Required
+ // only when grant_type=authorization_code
+ CodeVerifier *string
+
+ // The redirect URI that must match the original authorization request Required
+ // only when grant_type=authorization_code
+ RedirectUri *string
+
+ // The refresh token returned from auth_code redemption Required only when
+ // grant_type=refresh_token
+ RefreshToken *string
+
+ noSmithyDocumentSerde
+}
+
+// Response body payload for CreateOAuth2Token operation
+//
+// The response content depends on the grant_type from the request:
+//
+// - grant_type=authorization_code: Returns all fields including refresh_token
+// and id_token
+// - grant_type=refresh_token: Returns access_token, token_type, expires_in,
+// refresh_token (no id_token)
+type CreateOAuth2TokenResponseBody struct {
+
+ // Scoped-down AWS credentials (15 minute duration) Present for both authorization
+ // code redemption and token refresh
+ //
+ // This member is required.
+ AccessToken *AccessToken
+
+ // Time to expiry in seconds (maximum 900) Present for both authorization code
+ // redemption and token refresh
+ //
+ // This member is required.
+ ExpiresIn *int32
+
+ // Encrypted refresh token with cnf.jkt (SHA-256 thumbprint of presented jwk)
+ // Always present in responses (required for both flows)
+ //
+ // This member is required.
+ RefreshToken *string
+
+ // Token type indicating this is AWS SigV4 credentials Value is "aws_sigv4" for
+ // both flows
+ //
+ // This member is required.
+ TokenType *string
+
+ // ID token containing user identity information Present only in authorization
+ // code redemption response (grant_type=authorization_code) Not included in token
+ // refresh responses
+ IdToken *string
+
+ noSmithyDocumentSerde
+}
+
+type noSmithyDocumentSerde = smithydocument.NoSerde
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/signin/validators.go b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/validators.go
new file mode 100644
index 00000000000..f07252341ad
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/signin/validators.go
@@ -0,0 +1,72 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package signin
+
+import (
+ "context"
+ "fmt"
+ "github.com/aws/aws-sdk-go-v2/service/signin/types"
+ smithy "github.com/aws/smithy-go"
+ "github.com/aws/smithy-go/middleware"
+)
+
+type validateOpCreateOAuth2Token struct {
+}
+
+func (*validateOpCreateOAuth2Token) ID() string {
+ return "OperationInputValidation"
+}
+
+func (m *validateOpCreateOAuth2Token) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
+ out middleware.InitializeOutput, metadata middleware.Metadata, err error,
+) {
+ input, ok := in.Parameters.(*CreateOAuth2TokenInput)
+ if !ok {
+ return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
+ }
+ if err := validateOpCreateOAuth2TokenInput(input); err != nil {
+ return out, metadata, err
+ }
+ return next.HandleInitialize(ctx, in)
+}
+
+func addOpCreateOAuth2TokenValidationMiddleware(stack *middleware.Stack) error {
+ return stack.Initialize.Add(&validateOpCreateOAuth2Token{}, middleware.After)
+}
+
+func validateCreateOAuth2TokenRequestBody(v *types.CreateOAuth2TokenRequestBody) error {
+ if v == nil {
+ return nil
+ }
+ invalidParams := smithy.InvalidParamsError{Context: "CreateOAuth2TokenRequestBody"}
+ if v.ClientId == nil {
+ invalidParams.Add(smithy.NewErrParamRequired("ClientId"))
+ }
+ if v.GrantType == nil {
+ invalidParams.Add(smithy.NewErrParamRequired("GrantType"))
+ }
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ } else {
+ return nil
+ }
+}
+
+func validateOpCreateOAuth2TokenInput(v *CreateOAuth2TokenInput) error {
+ if v == nil {
+ return nil
+ }
+ invalidParams := smithy.InvalidParamsError{Context: "CreateOAuth2TokenInput"}
+ if v.TokenInput == nil {
+ invalidParams.Add(smithy.NewErrParamRequired("TokenInput"))
+ } else if v.TokenInput != nil {
+ if err := validateCreateOAuth2TokenRequestBody(v.TokenInput); err != nil {
+ invalidParams.AddNested("TokenInput", err.(smithy.InvalidParamsError))
+ }
+ }
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ } else {
+ return nil
+ }
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md
index 4c5e39d8739..83a1199982f 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md
@@ -1,3 +1,36 @@
+# v1.30.4 (2025-11-19.2)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.30.3 (2025-11-12)
+
+* **Bug Fix**: Further reduce allocation overhead when the metrics system isn't in-use.
+* **Bug Fix**: Reduce allocation overhead when the client doesn't have any HTTP interceptors configured.
+* **Bug Fix**: Remove blank trace spans towards the beginning of the request that added no additional information. This conveys a slight reduction in overall allocations.
+
+# v1.30.2 (2025-11-11)
+
+* **Bug Fix**: Return validation error if input region is not a valid host label.
+
+# v1.30.1 (2025-11-04)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+* **Dependency Update**: Upgrade to smithy-go v1.23.2 which should convey some passive reduction of overall allocations, especially when not using the metrics system.
+
+# v1.30.0 (2025-10-30)
+
+* **Feature**: Update endpoint ruleset parameters casing
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.29.8 (2025-10-23)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.29.7 (2025-10-16)
+
+* **Dependency Update**: Bump minimum Go version to 1.23.
+* **Dependency Update**: Updated to the latest SDK module versions
+
# v1.29.6 (2025-09-29)
* No change notes available for this release.
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_client.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_client.go
index 2c498e4689a..8e5a2e77f87 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_client.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_client.go
@@ -65,7 +65,12 @@ func timeOperationMetric[T any](
ctx context.Context, metric string, fn func() (T, error),
opts ...metrics.RecordMetricOption,
) (T, error) {
- instr := getOperationMetrics(ctx).histogramFor(metric)
+ mm := getOperationMetrics(ctx)
+ if mm == nil { // not using the metrics system
+ return fn()
+ }
+
+ instr := mm.histogramFor(metric)
opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...)
start := time.Now()
@@ -78,7 +83,12 @@ func timeOperationMetric[T any](
}
func startMetricTimer(ctx context.Context, metric string, opts ...metrics.RecordMetricOption) func() {
- instr := getOperationMetrics(ctx).histogramFor(metric)
+ mm := getOperationMetrics(ctx)
+ if mm == nil { // not using the metrics system
+ return func() {}
+ }
+
+ instr := mm.histogramFor(metric)
opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...)
var ended bool
@@ -106,6 +116,12 @@ func withOperationMetadata(ctx context.Context) metrics.RecordMetricOption {
type operationMetricsKey struct{}
func withOperationMetrics(parent context.Context, mp metrics.MeterProvider) (context.Context, error) {
+ if _, ok := mp.(metrics.NopMeterProvider); ok {
+ // not using the metrics system - setting up the metrics context is a memory-intensive operation
+ // so we should skip it in this case
+ return parent, nil
+ }
+
meter := mp.Meter("github.com/aws/aws-sdk-go-v2/service/sso")
om := &operationMetrics{}
@@ -153,7 +169,10 @@ func operationMetricTimer(m metrics.Meter, name, desc string) (metrics.Float64Hi
}
func getOperationMetrics(ctx context.Context) *operationMetrics {
- return ctx.Value(operationMetricsKey{}).(*operationMetrics)
+ if v := ctx.Value(operationMetricsKey{}); v != nil {
+ return v.(*operationMetrics)
+ }
+ return nil
}
func operationTracer(p tracing.TracerProvider) tracing.Tracer {
@@ -882,138 +901,49 @@ func addInterceptAttempt(stack *middleware.Stack, opts Options) error {
}, "Retry", middleware.After)
}
-func addInterceptExecution(stack *middleware.Stack, opts Options) error {
- return stack.Initialize.Add(&smithyhttp.InterceptExecution{
- BeforeExecution: opts.Interceptors.BeforeExecution,
- AfterExecution: opts.Interceptors.AfterExecution,
- }, middleware.Before)
-}
-
-func addInterceptBeforeSerialization(stack *middleware.Stack, opts Options) error {
- return stack.Serialize.Insert(&smithyhttp.InterceptBeforeSerialization{
- Interceptors: opts.Interceptors.BeforeSerialization,
- }, "OperationSerializer", middleware.Before)
-}
-
-func addInterceptAfterSerialization(stack *middleware.Stack, opts Options) error {
- return stack.Serialize.Insert(&smithyhttp.InterceptAfterSerialization{
- Interceptors: opts.Interceptors.AfterSerialization,
- }, "OperationSerializer", middleware.After)
-}
-
-func addInterceptBeforeSigning(stack *middleware.Stack, opts Options) error {
- return stack.Finalize.Insert(&smithyhttp.InterceptBeforeSigning{
- Interceptors: opts.Interceptors.BeforeSigning,
- }, "Signing", middleware.Before)
-}
-
-func addInterceptAfterSigning(stack *middleware.Stack, opts Options) error {
- return stack.Finalize.Insert(&smithyhttp.InterceptAfterSigning{
- Interceptors: opts.Interceptors.AfterSigning,
- }, "Signing", middleware.After)
-}
-
-func addInterceptTransmit(stack *middleware.Stack, opts Options) error {
- return stack.Deserialize.Add(&smithyhttp.InterceptTransmit{
- BeforeTransmit: opts.Interceptors.BeforeTransmit,
- AfterTransmit: opts.Interceptors.AfterTransmit,
- }, middleware.After)
-}
-
-func addInterceptBeforeDeserialization(stack *middleware.Stack, opts Options) error {
- return stack.Deserialize.Insert(&smithyhttp.InterceptBeforeDeserialization{
- Interceptors: opts.Interceptors.BeforeDeserialization,
- }, "OperationDeserializer", middleware.After) // (deserialize stack is called in reverse)
-}
-
-func addInterceptAfterDeserialization(stack *middleware.Stack, opts Options) error {
- return stack.Deserialize.Insert(&smithyhttp.InterceptAfterDeserialization{
- Interceptors: opts.Interceptors.AfterDeserialization,
- }, "OperationDeserializer", middleware.Before)
-}
-
-type spanInitializeStart struct {
-}
-
-func (*spanInitializeStart) ID() string {
- return "spanInitializeStart"
-}
-
-func (m *spanInitializeStart) HandleInitialize(
- ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler,
-) (
- middleware.InitializeOutput, middleware.Metadata, error,
-) {
- ctx, _ = tracing.StartSpan(ctx, "Initialize")
-
- return next.HandleInitialize(ctx, in)
-}
-
-type spanInitializeEnd struct {
-}
-
-func (*spanInitializeEnd) ID() string {
- return "spanInitializeEnd"
-}
-
-func (m *spanInitializeEnd) HandleInitialize(
- ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler,
-) (
- middleware.InitializeOutput, middleware.Metadata, error,
-) {
- ctx, span := tracing.PopSpan(ctx)
- span.End()
-
- return next.HandleInitialize(ctx, in)
-}
-
-type spanBuildRequestStart struct {
-}
-
-func (*spanBuildRequestStart) ID() string {
- return "spanBuildRequestStart"
-}
-
-func (m *spanBuildRequestStart) HandleSerialize(
- ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler,
-) (
- middleware.SerializeOutput, middleware.Metadata, error,
-) {
- ctx, _ = tracing.StartSpan(ctx, "BuildRequest")
-
- return next.HandleSerialize(ctx, in)
-}
-
-type spanBuildRequestEnd struct {
-}
-
-func (*spanBuildRequestEnd) ID() string {
- return "spanBuildRequestEnd"
-}
-
-func (m *spanBuildRequestEnd) HandleBuild(
- ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler,
-) (
- middleware.BuildOutput, middleware.Metadata, error,
-) {
- ctx, span := tracing.PopSpan(ctx)
- span.End()
-
- return next.HandleBuild(ctx, in)
-}
-
-func addSpanInitializeStart(stack *middleware.Stack) error {
- return stack.Initialize.Add(&spanInitializeStart{}, middleware.Before)
-}
-
-func addSpanInitializeEnd(stack *middleware.Stack) error {
- return stack.Initialize.Add(&spanInitializeEnd{}, middleware.After)
-}
-
-func addSpanBuildRequestStart(stack *middleware.Stack) error {
- return stack.Serialize.Add(&spanBuildRequestStart{}, middleware.Before)
-}
+func addInterceptors(stack *middleware.Stack, opts Options) error {
+ // middlewares are expensive, don't add all of these interceptor ones unless the caller
+ // actually has at least one interceptor configured
+ //
+ // at the moment it's all-or-nothing because some of the middlewares here are responsible for
+ // setting fields in the interceptor context for future ones
+ if len(opts.Interceptors.BeforeExecution) == 0 &&
+ len(opts.Interceptors.BeforeSerialization) == 0 && len(opts.Interceptors.AfterSerialization) == 0 &&
+ len(opts.Interceptors.BeforeRetryLoop) == 0 &&
+ len(opts.Interceptors.BeforeAttempt) == 0 &&
+ len(opts.Interceptors.BeforeSigning) == 0 && len(opts.Interceptors.AfterSigning) == 0 &&
+ len(opts.Interceptors.BeforeTransmit) == 0 && len(opts.Interceptors.AfterTransmit) == 0 &&
+ len(opts.Interceptors.BeforeDeserialization) == 0 && len(opts.Interceptors.AfterDeserialization) == 0 &&
+ len(opts.Interceptors.AfterAttempt) == 0 && len(opts.Interceptors.AfterExecution) == 0 {
+ return nil
+ }
-func addSpanBuildRequestEnd(stack *middleware.Stack) error {
- return stack.Build.Add(&spanBuildRequestEnd{}, middleware.After)
+ return errors.Join(
+ stack.Initialize.Add(&smithyhttp.InterceptExecution{
+ BeforeExecution: opts.Interceptors.BeforeExecution,
+ AfterExecution: opts.Interceptors.AfterExecution,
+ }, middleware.Before),
+ stack.Serialize.Insert(&smithyhttp.InterceptBeforeSerialization{
+ Interceptors: opts.Interceptors.BeforeSerialization,
+ }, "OperationSerializer", middleware.Before),
+ stack.Serialize.Insert(&smithyhttp.InterceptAfterSerialization{
+ Interceptors: opts.Interceptors.AfterSerialization,
+ }, "OperationSerializer", middleware.After),
+ stack.Finalize.Insert(&smithyhttp.InterceptBeforeSigning{
+ Interceptors: opts.Interceptors.BeforeSigning,
+ }, "Signing", middleware.Before),
+ stack.Finalize.Insert(&smithyhttp.InterceptAfterSigning{
+ Interceptors: opts.Interceptors.AfterSigning,
+ }, "Signing", middleware.After),
+ stack.Deserialize.Add(&smithyhttp.InterceptTransmit{
+ BeforeTransmit: opts.Interceptors.BeforeTransmit,
+ AfterTransmit: opts.Interceptors.AfterTransmit,
+ }, middleware.After),
+ stack.Deserialize.Insert(&smithyhttp.InterceptBeforeDeserialization{
+ Interceptors: opts.Interceptors.BeforeDeserialization,
+ }, "OperationDeserializer", middleware.After), // (deserialize stack is called in reverse)
+ stack.Deserialize.Insert(&smithyhttp.InterceptAfterDeserialization{
+ Interceptors: opts.Interceptors.AfterDeserialization,
+ }, "OperationDeserializer", middleware.Before),
+ )
}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_GetRoleCredentials.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_GetRoleCredentials.go
index df5dc1674f3..c0b961fcf18 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_GetRoleCredentials.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_GetRoleCredentials.go
@@ -153,40 +153,7 @@ func (c *Client) addOperationGetRoleCredentialsMiddlewares(stack *middleware.Sta
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccountRoles.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccountRoles.go
index 2a3b2ad9021..f5ca09ac7d8 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccountRoles.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccountRoles.go
@@ -158,40 +158,7 @@ func (c *Client) addOperationListAccountRolesMiddlewares(stack *middleware.Stack
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccounts.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccounts.go
index f6114a7c105..54511d34a6e 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccounts.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_ListAccounts.go
@@ -157,40 +157,7 @@ func (c *Client) addOperationListAccountsMiddlewares(stack *middleware.Stack, op
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_Logout.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_Logout.go
index 2c7f181c344..a21116e96c1 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_Logout.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/api_op_Logout.go
@@ -152,40 +152,7 @@ func (c *Client) addOperationLogoutMiddlewares(stack *middleware.Stack, options
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/endpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/endpoints.go
index 2b22ab779c2..dfeacc10766 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/endpoints.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/endpoints.go
@@ -217,11 +217,15 @@ func resolveBaseEndpoint(cfg aws.Config, o *Options) {
}
}
-func bindRegion(region string) *string {
+func bindRegion(region string) (*string, error) {
if region == "" {
- return nil
+ return nil, nil
+ }
+ if !smithyhttp.ValidHostLabel(region) {
+ return nil, fmt.Errorf("invalid input region %s", region)
}
- return aws.String(endpoints.MapFIPSRegion(region))
+
+ return aws.String(endpoints.MapFIPSRegion(region)), nil
}
// EndpointParameters provides the parameters that influence how endpoints are
@@ -479,10 +483,15 @@ type endpointParamsBinder interface {
bindEndpointParams(*EndpointParameters)
}
-func bindEndpointParams(ctx context.Context, input interface{}, options Options) *EndpointParameters {
+func bindEndpointParams(ctx context.Context, input interface{}, options Options) (*EndpointParameters, error) {
params := &EndpointParameters{}
- params.Region = bindRegion(options.Region)
+ region, err := bindRegion(options.Region)
+ if err != nil {
+ return nil, err
+ }
+ params.Region = region
+
params.UseDualStack = aws.Bool(options.EndpointOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled)
params.UseFIPS = aws.Bool(options.EndpointOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled)
params.Endpoint = options.BaseEndpoint
@@ -491,7 +500,7 @@ func bindEndpointParams(ctx context.Context, input interface{}, options Options)
b.bindEndpointParams(params)
}
- return params
+ return params, nil
}
type resolveEndpointV2Middleware struct {
@@ -521,7 +530,10 @@ func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in mid
return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil")
}
- params := bindEndpointParams(ctx, getOperationInput(ctx), m.options)
+ params, err := bindEndpointParams(ctx, getOperationInput(ctx), m.options)
+ if err != nil {
+ return out, metadata, fmt.Errorf("failed to bind endpoint params, %w", err)
+ }
endpt, err := timeOperationMetric(ctx, "client.call.resolve_endpoint_duration",
func() (smithyendpoints.Endpoint, error) {
return m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params)
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/generated.json b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/generated.json
index 1a88fe4df8e..1499c0a9591 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/generated.json
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/generated.json
@@ -30,7 +30,7 @@
"types/types.go",
"validators.go"
],
- "go": "1.22",
+ "go": "1.23",
"module": "github.com/aws/aws-sdk-go-v2/service/sso",
"unstable": false
}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go
index 3628768ce40..376b96cbcbb 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go
@@ -3,4 +3,4 @@
package sso
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.29.6"
+const goModuleVersion = "1.30.4"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md
index dc5e399a88b..a8d0260eadc 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md
@@ -1,3 +1,35 @@
+# v1.35.8 (2025-11-19.2)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.35.7 (2025-11-12)
+
+* **Bug Fix**: Further reduce allocation overhead when the metrics system isn't in-use.
+* **Bug Fix**: Reduce allocation overhead when the client doesn't have any HTTP interceptors configured.
+* **Bug Fix**: Remove blank trace spans towards the beginning of the request that added no additional information. This conveys a slight reduction in overall allocations.
+
+# v1.35.6 (2025-11-11)
+
+* **Bug Fix**: Return validation error if input region is not a valid host label.
+
+# v1.35.5 (2025-11-04)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+* **Dependency Update**: Upgrade to smithy-go v1.23.2 which should convey some passive reduction of overall allocations, especially when not using the metrics system.
+
+# v1.35.4 (2025-10-30)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.35.3 (2025-10-23)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.35.2 (2025-10-16)
+
+* **Dependency Update**: Bump minimum Go version to 1.23.
+* **Dependency Update**: Updated to the latest SDK module versions
+
# v1.35.1 (2025-09-26)
* **Dependency Update**: Updated to the latest SDK module versions
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_client.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_client.go
index 12ad2f5d9d5..8e8508fa349 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_client.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_client.go
@@ -65,7 +65,12 @@ func timeOperationMetric[T any](
ctx context.Context, metric string, fn func() (T, error),
opts ...metrics.RecordMetricOption,
) (T, error) {
- instr := getOperationMetrics(ctx).histogramFor(metric)
+ mm := getOperationMetrics(ctx)
+ if mm == nil { // not using the metrics system
+ return fn()
+ }
+
+ instr := mm.histogramFor(metric)
opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...)
start := time.Now()
@@ -78,7 +83,12 @@ func timeOperationMetric[T any](
}
func startMetricTimer(ctx context.Context, metric string, opts ...metrics.RecordMetricOption) func() {
- instr := getOperationMetrics(ctx).histogramFor(metric)
+ mm := getOperationMetrics(ctx)
+ if mm == nil { // not using the metrics system
+ return func() {}
+ }
+
+ instr := mm.histogramFor(metric)
opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...)
var ended bool
@@ -106,6 +116,12 @@ func withOperationMetadata(ctx context.Context) metrics.RecordMetricOption {
type operationMetricsKey struct{}
func withOperationMetrics(parent context.Context, mp metrics.MeterProvider) (context.Context, error) {
+ if _, ok := mp.(metrics.NopMeterProvider); ok {
+ // not using the metrics system - setting up the metrics context is a memory-intensive operation
+ // so we should skip it in this case
+ return parent, nil
+ }
+
meter := mp.Meter("github.com/aws/aws-sdk-go-v2/service/ssooidc")
om := &operationMetrics{}
@@ -153,7 +169,10 @@ func operationMetricTimer(m metrics.Meter, name, desc string) (metrics.Float64Hi
}
func getOperationMetrics(ctx context.Context) *operationMetrics {
- return ctx.Value(operationMetricsKey{}).(*operationMetrics)
+ if v := ctx.Value(operationMetricsKey{}); v != nil {
+ return v.(*operationMetrics)
+ }
+ return nil
}
func operationTracer(p tracing.TracerProvider) tracing.Tracer {
@@ -882,138 +901,49 @@ func addInterceptAttempt(stack *middleware.Stack, opts Options) error {
}, "Retry", middleware.After)
}
-func addInterceptExecution(stack *middleware.Stack, opts Options) error {
- return stack.Initialize.Add(&smithyhttp.InterceptExecution{
- BeforeExecution: opts.Interceptors.BeforeExecution,
- AfterExecution: opts.Interceptors.AfterExecution,
- }, middleware.Before)
-}
-
-func addInterceptBeforeSerialization(stack *middleware.Stack, opts Options) error {
- return stack.Serialize.Insert(&smithyhttp.InterceptBeforeSerialization{
- Interceptors: opts.Interceptors.BeforeSerialization,
- }, "OperationSerializer", middleware.Before)
-}
-
-func addInterceptAfterSerialization(stack *middleware.Stack, opts Options) error {
- return stack.Serialize.Insert(&smithyhttp.InterceptAfterSerialization{
- Interceptors: opts.Interceptors.AfterSerialization,
- }, "OperationSerializer", middleware.After)
-}
-
-func addInterceptBeforeSigning(stack *middleware.Stack, opts Options) error {
- return stack.Finalize.Insert(&smithyhttp.InterceptBeforeSigning{
- Interceptors: opts.Interceptors.BeforeSigning,
- }, "Signing", middleware.Before)
-}
-
-func addInterceptAfterSigning(stack *middleware.Stack, opts Options) error {
- return stack.Finalize.Insert(&smithyhttp.InterceptAfterSigning{
- Interceptors: opts.Interceptors.AfterSigning,
- }, "Signing", middleware.After)
-}
-
-func addInterceptTransmit(stack *middleware.Stack, opts Options) error {
- return stack.Deserialize.Add(&smithyhttp.InterceptTransmit{
- BeforeTransmit: opts.Interceptors.BeforeTransmit,
- AfterTransmit: opts.Interceptors.AfterTransmit,
- }, middleware.After)
-}
-
-func addInterceptBeforeDeserialization(stack *middleware.Stack, opts Options) error {
- return stack.Deserialize.Insert(&smithyhttp.InterceptBeforeDeserialization{
- Interceptors: opts.Interceptors.BeforeDeserialization,
- }, "OperationDeserializer", middleware.After) // (deserialize stack is called in reverse)
-}
-
-func addInterceptAfterDeserialization(stack *middleware.Stack, opts Options) error {
- return stack.Deserialize.Insert(&smithyhttp.InterceptAfterDeserialization{
- Interceptors: opts.Interceptors.AfterDeserialization,
- }, "OperationDeserializer", middleware.Before)
-}
-
-type spanInitializeStart struct {
-}
-
-func (*spanInitializeStart) ID() string {
- return "spanInitializeStart"
-}
-
-func (m *spanInitializeStart) HandleInitialize(
- ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler,
-) (
- middleware.InitializeOutput, middleware.Metadata, error,
-) {
- ctx, _ = tracing.StartSpan(ctx, "Initialize")
-
- return next.HandleInitialize(ctx, in)
-}
-
-type spanInitializeEnd struct {
-}
-
-func (*spanInitializeEnd) ID() string {
- return "spanInitializeEnd"
-}
-
-func (m *spanInitializeEnd) HandleInitialize(
- ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler,
-) (
- middleware.InitializeOutput, middleware.Metadata, error,
-) {
- ctx, span := tracing.PopSpan(ctx)
- span.End()
-
- return next.HandleInitialize(ctx, in)
-}
-
-type spanBuildRequestStart struct {
-}
-
-func (*spanBuildRequestStart) ID() string {
- return "spanBuildRequestStart"
-}
-
-func (m *spanBuildRequestStart) HandleSerialize(
- ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler,
-) (
- middleware.SerializeOutput, middleware.Metadata, error,
-) {
- ctx, _ = tracing.StartSpan(ctx, "BuildRequest")
-
- return next.HandleSerialize(ctx, in)
-}
-
-type spanBuildRequestEnd struct {
-}
-
-func (*spanBuildRequestEnd) ID() string {
- return "spanBuildRequestEnd"
-}
-
-func (m *spanBuildRequestEnd) HandleBuild(
- ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler,
-) (
- middleware.BuildOutput, middleware.Metadata, error,
-) {
- ctx, span := tracing.PopSpan(ctx)
- span.End()
-
- return next.HandleBuild(ctx, in)
-}
-
-func addSpanInitializeStart(stack *middleware.Stack) error {
- return stack.Initialize.Add(&spanInitializeStart{}, middleware.Before)
-}
-
-func addSpanInitializeEnd(stack *middleware.Stack) error {
- return stack.Initialize.Add(&spanInitializeEnd{}, middleware.After)
-}
-
-func addSpanBuildRequestStart(stack *middleware.Stack) error {
- return stack.Serialize.Add(&spanBuildRequestStart{}, middleware.Before)
-}
+func addInterceptors(stack *middleware.Stack, opts Options) error {
+ // middlewares are expensive, don't add all of these interceptor ones unless the caller
+ // actually has at least one interceptor configured
+ //
+ // at the moment it's all-or-nothing because some of the middlewares here are responsible for
+ // setting fields in the interceptor context for future ones
+ if len(opts.Interceptors.BeforeExecution) == 0 &&
+ len(opts.Interceptors.BeforeSerialization) == 0 && len(opts.Interceptors.AfterSerialization) == 0 &&
+ len(opts.Interceptors.BeforeRetryLoop) == 0 &&
+ len(opts.Interceptors.BeforeAttempt) == 0 &&
+ len(opts.Interceptors.BeforeSigning) == 0 && len(opts.Interceptors.AfterSigning) == 0 &&
+ len(opts.Interceptors.BeforeTransmit) == 0 && len(opts.Interceptors.AfterTransmit) == 0 &&
+ len(opts.Interceptors.BeforeDeserialization) == 0 && len(opts.Interceptors.AfterDeserialization) == 0 &&
+ len(opts.Interceptors.AfterAttempt) == 0 && len(opts.Interceptors.AfterExecution) == 0 {
+ return nil
+ }
-func addSpanBuildRequestEnd(stack *middleware.Stack) error {
- return stack.Build.Add(&spanBuildRequestEnd{}, middleware.After)
+ return errors.Join(
+ stack.Initialize.Add(&smithyhttp.InterceptExecution{
+ BeforeExecution: opts.Interceptors.BeforeExecution,
+ AfterExecution: opts.Interceptors.AfterExecution,
+ }, middleware.Before),
+ stack.Serialize.Insert(&smithyhttp.InterceptBeforeSerialization{
+ Interceptors: opts.Interceptors.BeforeSerialization,
+ }, "OperationSerializer", middleware.Before),
+ stack.Serialize.Insert(&smithyhttp.InterceptAfterSerialization{
+ Interceptors: opts.Interceptors.AfterSerialization,
+ }, "OperationSerializer", middleware.After),
+ stack.Finalize.Insert(&smithyhttp.InterceptBeforeSigning{
+ Interceptors: opts.Interceptors.BeforeSigning,
+ }, "Signing", middleware.Before),
+ stack.Finalize.Insert(&smithyhttp.InterceptAfterSigning{
+ Interceptors: opts.Interceptors.AfterSigning,
+ }, "Signing", middleware.After),
+ stack.Deserialize.Add(&smithyhttp.InterceptTransmit{
+ BeforeTransmit: opts.Interceptors.BeforeTransmit,
+ AfterTransmit: opts.Interceptors.AfterTransmit,
+ }, middleware.After),
+ stack.Deserialize.Insert(&smithyhttp.InterceptBeforeDeserialization{
+ Interceptors: opts.Interceptors.BeforeDeserialization,
+ }, "OperationDeserializer", middleware.After), // (deserialize stack is called in reverse)
+ stack.Deserialize.Insert(&smithyhttp.InterceptAfterDeserialization{
+ Interceptors: opts.Interceptors.AfterDeserialization,
+ }, "OperationDeserializer", middleware.Before),
+ )
}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateToken.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateToken.go
index 681eb4087c5..3f622dbcb95 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateToken.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateToken.go
@@ -223,40 +223,7 @@ func (c *Client) addOperationCreateTokenMiddlewares(stack *middleware.Stack, opt
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateTokenWithIAM.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateTokenWithIAM.go
index d7a27da5953..24cb2fac8db 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateTokenWithIAM.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_CreateTokenWithIAM.go
@@ -270,40 +270,7 @@ func (c *Client) addOperationCreateTokenWithIAMMiddlewares(stack *middleware.Sta
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_RegisterClient.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_RegisterClient.go
index 8d50092fb15..14472ee3be6 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_RegisterClient.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_RegisterClient.go
@@ -194,40 +194,7 @@ func (c *Client) addOperationRegisterClientMiddlewares(stack *middleware.Stack,
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_StartDeviceAuthorization.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_StartDeviceAuthorization.go
index 7242ac82b68..92a6854a776 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_StartDeviceAuthorization.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/api_op_StartDeviceAuthorization.go
@@ -176,40 +176,7 @@ func (c *Client) addOperationStartDeviceAuthorizationMiddlewares(stack *middlewa
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/endpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/endpoints.go
index 1e001f7a9e8..3deb443b289 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/endpoints.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/endpoints.go
@@ -217,11 +217,15 @@ func resolveBaseEndpoint(cfg aws.Config, o *Options) {
}
}
-func bindRegion(region string) *string {
+func bindRegion(region string) (*string, error) {
if region == "" {
- return nil
+ return nil, nil
+ }
+ if !smithyhttp.ValidHostLabel(region) {
+ return nil, fmt.Errorf("invalid input region %s", region)
}
- return aws.String(endpoints.MapFIPSRegion(region))
+
+ return aws.String(endpoints.MapFIPSRegion(region)), nil
}
// EndpointParameters provides the parameters that influence how endpoints are
@@ -479,10 +483,15 @@ type endpointParamsBinder interface {
bindEndpointParams(*EndpointParameters)
}
-func bindEndpointParams(ctx context.Context, input interface{}, options Options) *EndpointParameters {
+func bindEndpointParams(ctx context.Context, input interface{}, options Options) (*EndpointParameters, error) {
params := &EndpointParameters{}
- params.Region = bindRegion(options.Region)
+ region, err := bindRegion(options.Region)
+ if err != nil {
+ return nil, err
+ }
+ params.Region = region
+
params.UseDualStack = aws.Bool(options.EndpointOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled)
params.UseFIPS = aws.Bool(options.EndpointOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled)
params.Endpoint = options.BaseEndpoint
@@ -491,7 +500,7 @@ func bindEndpointParams(ctx context.Context, input interface{}, options Options)
b.bindEndpointParams(params)
}
- return params
+ return params, nil
}
type resolveEndpointV2Middleware struct {
@@ -521,7 +530,10 @@ func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in mid
return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil")
}
- params := bindEndpointParams(ctx, getOperationInput(ctx), m.options)
+ params, err := bindEndpointParams(ctx, getOperationInput(ctx), m.options)
+ if err != nil {
+ return out, metadata, fmt.Errorf("failed to bind endpoint params, %w", err)
+ }
endpt, err := timeOperationMetric(ctx, "client.call.resolve_endpoint_duration",
func() (smithyendpoints.Endpoint, error) {
return m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params)
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/generated.json b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/generated.json
index f3b0b242acc..ee79b48eaa5 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/generated.json
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/generated.json
@@ -31,7 +31,7 @@
"types/types.go",
"validators.go"
],
- "go": "1.22",
+ "go": "1.23",
"module": "github.com/aws/aws-sdk-go-v2/service/ssooidc",
"unstable": false
}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go
index 765f6371dae..d7c3b047ead 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go
@@ -3,4 +3,4 @@
package ssooidc
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.35.1"
+const goModuleVersion = "1.35.8"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md
index 77183922d3c..cf957394d77 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md
@@ -1,3 +1,48 @@
+# v1.41.1 (2025-11-19.2)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.41.0 (2025-11-19)
+
+* **Feature**: IAM now supports outbound identity federation via the STS GetWebIdentityToken API, enabling AWS workloads to securely authenticate with external services using short-lived JSON Web Tokens.
+
+# v1.40.2 (2025-11-12)
+
+* **Bug Fix**: Further reduce allocation overhead when the metrics system isn't in-use.
+* **Bug Fix**: Reduce allocation overhead when the client doesn't have any HTTP interceptors configured.
+* **Bug Fix**: Remove blank trace spans towards the beginning of the request that added no additional information. This conveys a slight reduction in overall allocations.
+
+# v1.40.1 (2025-11-11)
+
+* **Bug Fix**: Return validation error if input region is not a valid host label.
+
+# v1.40.0 (2025-11-10)
+
+* **Feature**: Added GetDelegatedAccessToken API, which is not available for general use at this time.
+
+# v1.39.1 (2025-11-04)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+* **Dependency Update**: Upgrade to smithy-go v1.23.2 which should convey some passive reduction of overall allocations, especially when not using the metrics system.
+
+# v1.39.0 (2025-10-30)
+
+* **Feature**: Update endpoint ruleset parameters casing
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.38.9 (2025-10-23)
+
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# v1.38.8 (2025-10-22)
+
+* No change notes available for this release.
+
+# v1.38.7 (2025-10-16)
+
+* **Dependency Update**: Bump minimum Go version to 1.23.
+* **Dependency Update**: Updated to the latest SDK module versions
+
# v1.38.6 (2025-09-26)
* **Dependency Update**: Updated to the latest SDK module versions
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_client.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_client.go
index 6658babc95f..70228d0dfa7 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_client.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_client.go
@@ -68,7 +68,12 @@ func timeOperationMetric[T any](
ctx context.Context, metric string, fn func() (T, error),
opts ...metrics.RecordMetricOption,
) (T, error) {
- instr := getOperationMetrics(ctx).histogramFor(metric)
+ mm := getOperationMetrics(ctx)
+ if mm == nil { // not using the metrics system
+ return fn()
+ }
+
+ instr := mm.histogramFor(metric)
opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...)
start := time.Now()
@@ -81,7 +86,12 @@ func timeOperationMetric[T any](
}
func startMetricTimer(ctx context.Context, metric string, opts ...metrics.RecordMetricOption) func() {
- instr := getOperationMetrics(ctx).histogramFor(metric)
+ mm := getOperationMetrics(ctx)
+ if mm == nil { // not using the metrics system
+ return func() {}
+ }
+
+ instr := mm.histogramFor(metric)
opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...)
var ended bool
@@ -109,6 +119,12 @@ func withOperationMetadata(ctx context.Context) metrics.RecordMetricOption {
type operationMetricsKey struct{}
func withOperationMetrics(parent context.Context, mp metrics.MeterProvider) (context.Context, error) {
+ if _, ok := mp.(metrics.NopMeterProvider); ok {
+ // not using the metrics system - setting up the metrics context is a memory-intensive operation
+ // so we should skip it in this case
+ return parent, nil
+ }
+
meter := mp.Meter("github.com/aws/aws-sdk-go-v2/service/sts")
om := &operationMetrics{}
@@ -156,7 +172,10 @@ func operationMetricTimer(m metrics.Meter, name, desc string) (metrics.Float64Hi
}
func getOperationMetrics(ctx context.Context) *operationMetrics {
- return ctx.Value(operationMetricsKey{}).(*operationMetrics)
+ if v := ctx.Value(operationMetricsKey{}); v != nil {
+ return v.(*operationMetrics)
+ }
+ return nil
}
func operationTracer(p tracing.TracerProvider) tracing.Tracer {
@@ -1034,138 +1053,49 @@ func addInterceptAttempt(stack *middleware.Stack, opts Options) error {
}, "Retry", middleware.After)
}
-func addInterceptExecution(stack *middleware.Stack, opts Options) error {
- return stack.Initialize.Add(&smithyhttp.InterceptExecution{
- BeforeExecution: opts.Interceptors.BeforeExecution,
- AfterExecution: opts.Interceptors.AfterExecution,
- }, middleware.Before)
-}
-
-func addInterceptBeforeSerialization(stack *middleware.Stack, opts Options) error {
- return stack.Serialize.Insert(&smithyhttp.InterceptBeforeSerialization{
- Interceptors: opts.Interceptors.BeforeSerialization,
- }, "OperationSerializer", middleware.Before)
-}
-
-func addInterceptAfterSerialization(stack *middleware.Stack, opts Options) error {
- return stack.Serialize.Insert(&smithyhttp.InterceptAfterSerialization{
- Interceptors: opts.Interceptors.AfterSerialization,
- }, "OperationSerializer", middleware.After)
-}
-
-func addInterceptBeforeSigning(stack *middleware.Stack, opts Options) error {
- return stack.Finalize.Insert(&smithyhttp.InterceptBeforeSigning{
- Interceptors: opts.Interceptors.BeforeSigning,
- }, "Signing", middleware.Before)
-}
-
-func addInterceptAfterSigning(stack *middleware.Stack, opts Options) error {
- return stack.Finalize.Insert(&smithyhttp.InterceptAfterSigning{
- Interceptors: opts.Interceptors.AfterSigning,
- }, "Signing", middleware.After)
-}
-
-func addInterceptTransmit(stack *middleware.Stack, opts Options) error {
- return stack.Deserialize.Add(&smithyhttp.InterceptTransmit{
- BeforeTransmit: opts.Interceptors.BeforeTransmit,
- AfterTransmit: opts.Interceptors.AfterTransmit,
- }, middleware.After)
-}
-
-func addInterceptBeforeDeserialization(stack *middleware.Stack, opts Options) error {
- return stack.Deserialize.Insert(&smithyhttp.InterceptBeforeDeserialization{
- Interceptors: opts.Interceptors.BeforeDeserialization,
- }, "OperationDeserializer", middleware.After) // (deserialize stack is called in reverse)
-}
-
-func addInterceptAfterDeserialization(stack *middleware.Stack, opts Options) error {
- return stack.Deserialize.Insert(&smithyhttp.InterceptAfterDeserialization{
- Interceptors: opts.Interceptors.AfterDeserialization,
- }, "OperationDeserializer", middleware.Before)
-}
-
-type spanInitializeStart struct {
-}
-
-func (*spanInitializeStart) ID() string {
- return "spanInitializeStart"
-}
-
-func (m *spanInitializeStart) HandleInitialize(
- ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler,
-) (
- middleware.InitializeOutput, middleware.Metadata, error,
-) {
- ctx, _ = tracing.StartSpan(ctx, "Initialize")
-
- return next.HandleInitialize(ctx, in)
-}
-
-type spanInitializeEnd struct {
-}
-
-func (*spanInitializeEnd) ID() string {
- return "spanInitializeEnd"
-}
-
-func (m *spanInitializeEnd) HandleInitialize(
- ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler,
-) (
- middleware.InitializeOutput, middleware.Metadata, error,
-) {
- ctx, span := tracing.PopSpan(ctx)
- span.End()
-
- return next.HandleInitialize(ctx, in)
-}
-
-type spanBuildRequestStart struct {
-}
-
-func (*spanBuildRequestStart) ID() string {
- return "spanBuildRequestStart"
-}
-
-func (m *spanBuildRequestStart) HandleSerialize(
- ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler,
-) (
- middleware.SerializeOutput, middleware.Metadata, error,
-) {
- ctx, _ = tracing.StartSpan(ctx, "BuildRequest")
-
- return next.HandleSerialize(ctx, in)
-}
-
-type spanBuildRequestEnd struct {
-}
-
-func (*spanBuildRequestEnd) ID() string {
- return "spanBuildRequestEnd"
-}
-
-func (m *spanBuildRequestEnd) HandleBuild(
- ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler,
-) (
- middleware.BuildOutput, middleware.Metadata, error,
-) {
- ctx, span := tracing.PopSpan(ctx)
- span.End()
-
- return next.HandleBuild(ctx, in)
-}
-
-func addSpanInitializeStart(stack *middleware.Stack) error {
- return stack.Initialize.Add(&spanInitializeStart{}, middleware.Before)
-}
-
-func addSpanInitializeEnd(stack *middleware.Stack) error {
- return stack.Initialize.Add(&spanInitializeEnd{}, middleware.After)
-}
-
-func addSpanBuildRequestStart(stack *middleware.Stack) error {
- return stack.Serialize.Add(&spanBuildRequestStart{}, middleware.Before)
-}
+func addInterceptors(stack *middleware.Stack, opts Options) error {
+ // middlewares are expensive, don't add all of these interceptor ones unless the caller
+ // actually has at least one interceptor configured
+ //
+ // at the moment it's all-or-nothing because some of the middlewares here are responsible for
+ // setting fields in the interceptor context for future ones
+ if len(opts.Interceptors.BeforeExecution) == 0 &&
+ len(opts.Interceptors.BeforeSerialization) == 0 && len(opts.Interceptors.AfterSerialization) == 0 &&
+ len(opts.Interceptors.BeforeRetryLoop) == 0 &&
+ len(opts.Interceptors.BeforeAttempt) == 0 &&
+ len(opts.Interceptors.BeforeSigning) == 0 && len(opts.Interceptors.AfterSigning) == 0 &&
+ len(opts.Interceptors.BeforeTransmit) == 0 && len(opts.Interceptors.AfterTransmit) == 0 &&
+ len(opts.Interceptors.BeforeDeserialization) == 0 && len(opts.Interceptors.AfterDeserialization) == 0 &&
+ len(opts.Interceptors.AfterAttempt) == 0 && len(opts.Interceptors.AfterExecution) == 0 {
+ return nil
+ }
-func addSpanBuildRequestEnd(stack *middleware.Stack) error {
- return stack.Build.Add(&spanBuildRequestEnd{}, middleware.After)
+ return errors.Join(
+ stack.Initialize.Add(&smithyhttp.InterceptExecution{
+ BeforeExecution: opts.Interceptors.BeforeExecution,
+ AfterExecution: opts.Interceptors.AfterExecution,
+ }, middleware.Before),
+ stack.Serialize.Insert(&smithyhttp.InterceptBeforeSerialization{
+ Interceptors: opts.Interceptors.BeforeSerialization,
+ }, "OperationSerializer", middleware.Before),
+ stack.Serialize.Insert(&smithyhttp.InterceptAfterSerialization{
+ Interceptors: opts.Interceptors.AfterSerialization,
+ }, "OperationSerializer", middleware.After),
+ stack.Finalize.Insert(&smithyhttp.InterceptBeforeSigning{
+ Interceptors: opts.Interceptors.BeforeSigning,
+ }, "Signing", middleware.Before),
+ stack.Finalize.Insert(&smithyhttp.InterceptAfterSigning{
+ Interceptors: opts.Interceptors.AfterSigning,
+ }, "Signing", middleware.After),
+ stack.Deserialize.Add(&smithyhttp.InterceptTransmit{
+ BeforeTransmit: opts.Interceptors.BeforeTransmit,
+ AfterTransmit: opts.Interceptors.AfterTransmit,
+ }, middleware.After),
+ stack.Deserialize.Insert(&smithyhttp.InterceptBeforeDeserialization{
+ Interceptors: opts.Interceptors.BeforeDeserialization,
+ }, "OperationDeserializer", middleware.After), // (deserialize stack is called in reverse)
+ stack.Deserialize.Insert(&smithyhttp.InterceptAfterDeserialization{
+ Interceptors: opts.Interceptors.AfterDeserialization,
+ }, "OperationDeserializer", middleware.Before),
+ )
}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRole.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRole.go
index f3a93418fa0..0ddd3623ae5 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRole.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRole.go
@@ -147,7 +147,7 @@ type AssumeRoleInput struct {
//
// The regex used to validate this parameter is a string of characters consisting
// of upper- and lower-case alphanumeric characters with no spaces. You can also
- // include underscores or any of the following characters: =,.@-
+ // include underscores or any of the following characters: +=,.@-
//
// [CloudTrail logs]: https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-integration.html#cloudtrail-integration_signin-tempcreds
// [sts:RoleSessionName]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_iam-condition-keys.html#ck_rolesessionname
@@ -196,7 +196,7 @@ type AssumeRoleInput struct {
//
// The regex used to validate this parameter is a string of characters consisting
// of upper- and lower-case alphanumeric characters with no spaces. You can also
- // include underscores or any of the following characters: =,.@:/-
+ // include underscores or any of the following characters: +=,.@:\/-
//
// [How to Use an External ID When Granting Access to Your Amazon Web Services Resources to a Third Party]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user_externalid.html
ExternalId *string
@@ -279,7 +279,7 @@ type AssumeRoleInput struct {
//
// The regex used to validate this parameter is a string of characters consisting
// of upper- and lower-case alphanumeric characters with no spaces. You can also
- // include underscores or any of the following characters: =,.@-
+ // include underscores or any of the following characters: +=/:,.@-
SerialNumber *string
// The source identity specified by the principal that is calling the AssumeRole
@@ -508,40 +508,7 @@ func (c *Client) addOperationAssumeRoleMiddlewares(stack *middleware.Stack, opti
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithSAML.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithSAML.go
index 9dcceec12a2..15f1dd91d29 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithSAML.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithSAML.go
@@ -23,6 +23,9 @@ import (
// these temporary security credentials to sign calls to Amazon Web Services
// services.
//
+// AssumeRoleWithSAML will not work on IAM Identity Center managed roles. These
+// roles' names start with AWSReservedSSO_ .
+//
// # Session Duration
//
// By default, the temporary security credentials created by AssumeRoleWithSAML
@@ -440,40 +443,7 @@ func (c *Client) addOperationAssumeRoleWithSAMLMiddlewares(stack *middleware.Sta
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithWebIdentity.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithWebIdentity.go
index 5975a0cdee8..7006eb3b7fb 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithWebIdentity.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoleWithWebIdentity.go
@@ -75,7 +75,7 @@ import (
//
// (Optional) You can configure your IdP to pass attributes into your web identity
// token as session tags. Each session tag consists of a key name and an associated
-// value. For more information about session tags, see [Passing Session Tags in STS]in the IAM User Guide.
+// value. For more information about session tags, see [Passing session tags using AssumeRoleWithWebIdentity]in the IAM User Guide.
//
// You can pass up to 50 session tags. The plaintext session tag keys can’t exceed
// 128 characters and the values can’t exceed 256 characters. For these and
@@ -123,6 +123,7 @@ import (
// providers to get and use temporary security credentials.
//
// [Amazon Web Services SDK for iOS Developer Guide]: http://aws.amazon.com/sdkforios/
+// [Passing session tags using AssumeRoleWithWebIdentity]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_adding-assume-role-idp
// [Amazon Web Services SDK for Android Developer Guide]: http://aws.amazon.com/sdkforandroid/
// [IAM and STS Character Limits]: https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-limits.html#reference_iam-limits-entity-length
// [session policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session
@@ -135,7 +136,6 @@ import (
// [Using IAM Roles]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html
// [Session Policies]: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session
// [Amazon Cognito federated identities]: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-identity.html
-// [Passing Session Tags in STS]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html
// [Chaining Roles with Session Tags]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html#id_session-tags_role-chaining
// [Update the maximum session duration for a role]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_update-role-settings.html#id_roles_update-session-duration
// [Using Web Identity Federation API Operations for Mobile Apps]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual.html
@@ -460,40 +460,7 @@ func (c *Client) addOperationAssumeRoleWithWebIdentityMiddlewares(stack *middlew
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoot.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoot.go
index 571f06728a5..009c4055838 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoot.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_AssumeRoot.go
@@ -12,7 +12,9 @@ import (
)
// Returns a set of short term credentials you can use to perform privileged tasks
-// on a member account in your organization.
+// on a member account in your organization. You must use credentials from an
+// Organizations management account or a delegated administrator account for IAM to
+// call AssumeRoot . You cannot use root user credentials to make this call.
//
// Before you can launch a privileged session, you must have centralized root
// access in your organization. For steps to enable this feature, see [Centralize root access for member accounts]in the IAM
@@ -24,8 +26,16 @@ import (
// You can track AssumeRoot in CloudTrail logs to determine what actions were
// performed in a session. For more information, see [Track privileged tasks in CloudTrail]in the IAM User Guide.
//
+// When granting access to privileged tasks you should only grant the necessary
+// permissions required to perform that task. For more information, see [Security best practices in IAM]. In
+// addition, you can use [service control policies](SCPs) to manage and limit permissions in your
+// organization. See [General examples]in the Organizations User Guide for more information on SCPs.
+//
// [Endpoints]: https://docs.aws.amazon.com/STS/latest/APIReference/welcome.html#sts-endpoints
+// [Security best practices in IAM]: https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html
// [Track privileged tasks in CloudTrail]: https://docs.aws.amazon.com/IAM/latest/UserGuide/cloudtrail-track-privileged-tasks.html
+// [General examples]: https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples_general.html
+// [service control policies]: https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps.html
// [Centralize root access for member accounts]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-enable-root-access.html
func (c *Client) AssumeRoot(ctx context.Context, params *AssumeRootInput, optFns ...func(*Options)) (*AssumeRootOutput, error) {
if params == nil {
@@ -50,8 +60,10 @@ type AssumeRootInput struct {
TargetPrincipal *string
// The identity based policy that scopes the session to the privileged tasks that
- // can be performed. You can use one of following Amazon Web Services managed
- // policies to scope root session actions.
+ // can be performed. You must
+ //
+ // use one of following Amazon Web Services managed policies to scope root session
+ // actions:
//
// [IAMAuditRootUserCredentials]
//
@@ -205,40 +217,7 @@ func (c *Client) addOperationAssumeRootMiddlewares(stack *middleware.Stack, opti
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_DecodeAuthorizationMessage.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_DecodeAuthorizationMessage.go
index 786bac89b8a..b00b0c4096c 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_DecodeAuthorizationMessage.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_DecodeAuthorizationMessage.go
@@ -177,40 +177,7 @@ func (c *Client) addOperationDecodeAuthorizationMessageMiddlewares(stack *middle
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetAccessKeyInfo.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetAccessKeyInfo.go
index 6c1f878981c..887bb081f3b 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetAccessKeyInfo.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetAccessKeyInfo.go
@@ -168,40 +168,7 @@ func (c *Client) addOperationGetAccessKeyInfoMiddlewares(stack *middleware.Stack
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetCallerIdentity.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetCallerIdentity.go
index 7d0653398b3..2c8d8867013 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetCallerIdentity.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetCallerIdentity.go
@@ -156,40 +156,7 @@ func (c *Client) addOperationGetCallerIdentityMiddlewares(stack *middleware.Stac
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetDelegatedAccessToken.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetDelegatedAccessToken.go
new file mode 100644
index 00000000000..092ec13e3a3
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetDelegatedAccessToken.go
@@ -0,0 +1,172 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package sts
+
+import (
+ "context"
+ "fmt"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ "github.com/aws/aws-sdk-go-v2/service/sts/types"
+ "github.com/aws/smithy-go/middleware"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+)
+
+// Exchanges a trade-in token for temporary Amazon Web Services credentials with
+// the permissions associated with the assumed principal. This operation allows you
+// to obtain credentials for a specific principal based on a trade-in token,
+// enabling delegation of access to Amazon Web Services resources.
+func (c *Client) GetDelegatedAccessToken(ctx context.Context, params *GetDelegatedAccessTokenInput, optFns ...func(*Options)) (*GetDelegatedAccessTokenOutput, error) {
+ if params == nil {
+ params = &GetDelegatedAccessTokenInput{}
+ }
+
+ result, metadata, err := c.invokeOperation(ctx, "GetDelegatedAccessToken", params, optFns, c.addOperationGetDelegatedAccessTokenMiddlewares)
+ if err != nil {
+ return nil, err
+ }
+
+ out := result.(*GetDelegatedAccessTokenOutput)
+ out.ResultMetadata = metadata
+ return out, nil
+}
+
+type GetDelegatedAccessTokenInput struct {
+
+ // The token to exchange for temporary Amazon Web Services credentials. This token
+ // must be valid and unexpired at the time of the request.
+ //
+ // This member is required.
+ TradeInToken *string
+
+ noSmithyDocumentSerde
+}
+
+type GetDelegatedAccessTokenOutput struct {
+
+ // The Amazon Resource Name (ARN) of the principal that was assumed when obtaining
+ // the delegated access token. This ARN identifies the IAM entity whose permissions
+ // are granted by the temporary credentials.
+ AssumedPrincipal *string
+
+ // Amazon Web Services credentials for API authentication.
+ Credentials *types.Credentials
+
+ // The percentage of the maximum policy size that is used by the session policy.
+ // The policy size is calculated as the sum of all the session policies and
+ // permission boundaries attached to the session. If the packed size exceeds 100%,
+ // the request fails.
+ PackedPolicySize *int32
+
+ // Metadata pertaining to the operation's result.
+ ResultMetadata middleware.Metadata
+
+ noSmithyDocumentSerde
+}
+
+func (c *Client) addOperationGetDelegatedAccessTokenMiddlewares(stack *middleware.Stack, options Options) (err error) {
+ if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
+ return err
+ }
+ err = stack.Serialize.Add(&awsAwsquery_serializeOpGetDelegatedAccessToken{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetDelegatedAccessToken{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ if err := addProtocolFinalizerMiddlewares(stack, options, "GetDelegatedAccessToken"); err != nil {
+ return fmt.Errorf("add protocol finalizers: %v", err)
+ }
+
+ if err = addlegacyEndpointContextSetter(stack, options); err != nil {
+ return err
+ }
+ if err = addSetLoggerMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addClientRequestID(stack); err != nil {
+ return err
+ }
+ if err = addComputeContentLength(stack); err != nil {
+ return err
+ }
+ if err = addResolveEndpointMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addComputePayloadSHA256(stack); err != nil {
+ return err
+ }
+ if err = addRetry(stack, options); err != nil {
+ return err
+ }
+ if err = addRawResponseToMetadata(stack); err != nil {
+ return err
+ }
+ if err = addRecordResponseTiming(stack); err != nil {
+ return err
+ }
+ if err = addSpanRetryLoop(stack, options); err != nil {
+ return err
+ }
+ if err = addClientUserAgent(stack, options); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addTimeOffsetBuild(stack, c); err != nil {
+ return err
+ }
+ if err = addUserAgentRetryMode(stack, options); err != nil {
+ return err
+ }
+ if err = addCredentialSource(stack, options); err != nil {
+ return err
+ }
+ if err = addOpGetDelegatedAccessTokenValidationMiddleware(stack); err != nil {
+ return err
+ }
+ if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDelegatedAccessToken(options.Region), middleware.Before); err != nil {
+ return err
+ }
+ if err = addRecursionDetection(stack); err != nil {
+ return err
+ }
+ if err = addRequestIDRetrieverMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addResponseErrorMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addRequestResponseLogging(stack, options); err != nil {
+ return err
+ }
+ if err = addDisableHTTPSMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
+ return err
+ }
+ if err = addInterceptAttempt(stack, options); err != nil {
+ return err
+ }
+ if err = addInterceptors(stack, options); err != nil {
+ return err
+ }
+ return nil
+}
+
+func newServiceMetadataMiddleware_opGetDelegatedAccessToken(region string) *awsmiddleware.RegisterServiceMetadata {
+ return &awsmiddleware.RegisterServiceMetadata{
+ Region: region,
+ ServiceID: ServiceID,
+ OperationName: "GetDelegatedAccessToken",
+ }
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetFederationToken.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetFederationToken.go
index 1c2f28e519c..e0fc9a54848 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetFederationToken.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetFederationToken.go
@@ -381,40 +381,7 @@ func (c *Client) addOperationGetFederationTokenMiddlewares(stack *middleware.Sta
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetSessionToken.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetSessionToken.go
index 25604699009..2f931f4446d 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetSessionToken.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetSessionToken.go
@@ -227,40 +227,7 @@ func (c *Client) addOperationGetSessionTokenMiddlewares(stack *middleware.Stack,
if err = addInterceptAttempt(stack, options); err != nil {
return err
}
- if err = addInterceptExecution(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSerialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterSigning(stack, options); err != nil {
- return err
- }
- if err = addInterceptTransmit(stack, options); err != nil {
- return err
- }
- if err = addInterceptBeforeDeserialization(stack, options); err != nil {
- return err
- }
- if err = addInterceptAfterDeserialization(stack, options); err != nil {
- return err
- }
- if err = addSpanInitializeStart(stack); err != nil {
- return err
- }
- if err = addSpanInitializeEnd(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestStart(stack); err != nil {
- return err
- }
- if err = addSpanBuildRequestEnd(stack); err != nil {
+ if err = addInterceptors(stack, options); err != nil {
return err
}
return nil
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetWebIdentityToken.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetWebIdentityToken.go
new file mode 100644
index 00000000000..306ee43b1e2
--- /dev/null
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/api_op_GetWebIdentityToken.go
@@ -0,0 +1,195 @@
+// Code generated by smithy-go-codegen DO NOT EDIT.
+
+package sts
+
+import (
+ "context"
+ "fmt"
+ awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
+ "github.com/aws/aws-sdk-go-v2/service/sts/types"
+ "github.com/aws/smithy-go/middleware"
+ smithyhttp "github.com/aws/smithy-go/transport/http"
+ "time"
+)
+
+// Returns a signed JSON Web Token (JWT) that represents the calling Amazon Web
+// Services identity. The returned JWT can be used to authenticate with external
+// services that support OIDC discovery. The token is signed by Amazon Web Services
+// STS and can be publicly verified using the verification keys published at the
+// issuer's JWKS endpoint.
+func (c *Client) GetWebIdentityToken(ctx context.Context, params *GetWebIdentityTokenInput, optFns ...func(*Options)) (*GetWebIdentityTokenOutput, error) {
+ if params == nil {
+ params = &GetWebIdentityTokenInput{}
+ }
+
+ result, metadata, err := c.invokeOperation(ctx, "GetWebIdentityToken", params, optFns, c.addOperationGetWebIdentityTokenMiddlewares)
+ if err != nil {
+ return nil, err
+ }
+
+ out := result.(*GetWebIdentityTokenOutput)
+ out.ResultMetadata = metadata
+ return out, nil
+}
+
+type GetWebIdentityTokenInput struct {
+
+ // The intended recipient of the web identity token. This value populates the aud
+ // claim in the JWT and should identify the service or application that will
+ // validate and use the token. The external service should verify this claim to
+ // ensure the token was intended for their use.
+ //
+ // This member is required.
+ Audience []string
+
+ // The cryptographic algorithm to use for signing the JSON Web Token (JWT). Valid
+ // values are RS256 (RSA with SHA-256) and ES384 (ECDSA using P-384 curve with
+ // SHA-384).
+ //
+ // This member is required.
+ SigningAlgorithm *string
+
+ // The duration, in seconds, for which the JSON Web Token (JWT) will remain valid.
+ // The value can range from 60 seconds (1 minute) to 3600 seconds (1 hour). If not
+ // specified, the default duration is 300 seconds (5 minutes). The token is
+ // designed to be short-lived and should be used for proof of identity, then
+ // exchanged for credentials or short-lived tokens in the external service.
+ DurationSeconds *int32
+
+ // An optional list of tags to include in the JSON Web Token (JWT). These tags are
+ // added as custom claims to the JWT and can be used by the downstream service for
+ // authorization decisions.
+ Tags []types.Tag
+
+ noSmithyDocumentSerde
+}
+
+type GetWebIdentityTokenOutput struct {
+
+ // The date and time when the web identity token expires, in UTC. The expiration
+ // is determined by adding the DurationSeconds value to the time the token was
+ // issued. After this time, the token should no longer be considered valid.
+ Expiration *time.Time
+
+ // A signed JSON Web Token (JWT) that represents the caller's Amazon Web Services
+ // identity. The token contains standard JWT claims such as subject, audience,
+ // expiration time, and additional identity attributes added by STS as custom
+ // claims. You can also add your own custom claims to the token by passing tags as
+ // request parameters to the GetWebIdentityToken API. The token is signed using
+ // the specified signing algorithm and can be verified using the verification keys
+ // available at the issuer's JWKS endpoint.
+ WebIdentityToken *string
+
+ // Metadata pertaining to the operation's result.
+ ResultMetadata middleware.Metadata
+
+ noSmithyDocumentSerde
+}
+
+func (c *Client) addOperationGetWebIdentityTokenMiddlewares(stack *middleware.Stack, options Options) (err error) {
+ if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil {
+ return err
+ }
+ err = stack.Serialize.Add(&awsAwsquery_serializeOpGetWebIdentityToken{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ err = stack.Deserialize.Add(&awsAwsquery_deserializeOpGetWebIdentityToken{}, middleware.After)
+ if err != nil {
+ return err
+ }
+ if err := addProtocolFinalizerMiddlewares(stack, options, "GetWebIdentityToken"); err != nil {
+ return fmt.Errorf("add protocol finalizers: %v", err)
+ }
+
+ if err = addlegacyEndpointContextSetter(stack, options); err != nil {
+ return err
+ }
+ if err = addSetLoggerMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addClientRequestID(stack); err != nil {
+ return err
+ }
+ if err = addComputeContentLength(stack); err != nil {
+ return err
+ }
+ if err = addResolveEndpointMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addComputePayloadSHA256(stack); err != nil {
+ return err
+ }
+ if err = addRetry(stack, options); err != nil {
+ return err
+ }
+ if err = addRawResponseToMetadata(stack); err != nil {
+ return err
+ }
+ if err = addRecordResponseTiming(stack); err != nil {
+ return err
+ }
+ if err = addSpanRetryLoop(stack, options); err != nil {
+ return err
+ }
+ if err = addClientUserAgent(stack, options); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addTimeOffsetBuild(stack, c); err != nil {
+ return err
+ }
+ if err = addUserAgentRetryMode(stack, options); err != nil {
+ return err
+ }
+ if err = addCredentialSource(stack, options); err != nil {
+ return err
+ }
+ if err = addOpGetWebIdentityTokenValidationMiddleware(stack); err != nil {
+ return err
+ }
+ if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetWebIdentityToken(options.Region), middleware.Before); err != nil {
+ return err
+ }
+ if err = addRecursionDetection(stack); err != nil {
+ return err
+ }
+ if err = addRequestIDRetrieverMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addResponseErrorMiddleware(stack); err != nil {
+ return err
+ }
+ if err = addRequestResponseLogging(stack, options); err != nil {
+ return err
+ }
+ if err = addDisableHTTPSMiddleware(stack, options); err != nil {
+ return err
+ }
+ if err = addInterceptBeforeRetryLoop(stack, options); err != nil {
+ return err
+ }
+ if err = addInterceptAttempt(stack, options); err != nil {
+ return err
+ }
+ if err = addInterceptors(stack, options); err != nil {
+ return err
+ }
+ return nil
+}
+
+func newServiceMetadataMiddleware_opGetWebIdentityToken(region string) *awsmiddleware.RegisterServiceMetadata {
+ return &awsmiddleware.RegisterServiceMetadata{
+ Region: region,
+ ServiceID: ServiceID,
+ OperationName: "GetWebIdentityToken",
+ }
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/deserializers.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/deserializers.go
index a1ac917ec6a..8c1ce351616 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/deserializers.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/deserializers.go
@@ -846,6 +846,124 @@ func awsAwsquery_deserializeOpErrorGetCallerIdentity(response *smithyhttp.Respon
}
}
+type awsAwsquery_deserializeOpGetDelegatedAccessToken struct {
+}
+
+func (*awsAwsquery_deserializeOpGetDelegatedAccessToken) ID() string {
+ return "OperationDeserializer"
+}
+
+func (m *awsAwsquery_deserializeOpGetDelegatedAccessToken) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
+ out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
+) {
+ out, metadata, err = next.HandleDeserialize(ctx, in)
+ if err != nil {
+ return out, metadata, err
+ }
+
+ _, span := tracing.StartSpan(ctx, "OperationDeserializer")
+ endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
+ defer endTimer()
+ defer span.End()
+ response, ok := out.RawResponse.(*smithyhttp.Response)
+ if !ok {
+ return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
+ }
+
+ if response.StatusCode < 200 || response.StatusCode >= 300 {
+ return out, metadata, awsAwsquery_deserializeOpErrorGetDelegatedAccessToken(response, &metadata)
+ }
+ output := &GetDelegatedAccessTokenOutput{}
+ out.Result = output
+
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+ body := io.TeeReader(response.Body, ringBuffer)
+ rootDecoder := xml.NewDecoder(body)
+ t, err := smithyxml.FetchRootElement(rootDecoder)
+ if err == io.EOF {
+ return out, metadata, nil
+ }
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return out, metadata, &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ decoder := smithyxml.WrapNodeDecoder(rootDecoder, t)
+ t, err = decoder.GetElement("GetDelegatedAccessTokenResult")
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return out, metadata, err
+ }
+
+ decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t)
+ err = awsAwsquery_deserializeOpDocumentGetDelegatedAccessTokenOutput(&output, decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return out, metadata, err
+ }
+
+ return out, metadata, err
+}
+
+func awsAwsquery_deserializeOpErrorGetDelegatedAccessToken(response *smithyhttp.Response, metadata *middleware.Metadata) error {
+ var errorBuffer bytes.Buffer
+ if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
+ return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
+ }
+ errorBody := bytes.NewReader(errorBuffer.Bytes())
+
+ errorCode := "UnknownError"
+ errorMessage := errorCode
+
+ errorComponents, err := awsxml.GetErrorResponseComponents(errorBody, false)
+ if err != nil {
+ return err
+ }
+ if reqID := errorComponents.RequestID; len(reqID) != 0 {
+ awsmiddleware.SetRequestIDMetadata(metadata, reqID)
+ }
+ if len(errorComponents.Code) != 0 {
+ errorCode = errorComponents.Code
+ }
+ if len(errorComponents.Message) != 0 {
+ errorMessage = errorComponents.Message
+ }
+ errorBody.Seek(0, io.SeekStart)
+ switch {
+ case strings.EqualFold("ExpiredTradeInTokenException", errorCode):
+ return awsAwsquery_deserializeErrorExpiredTradeInTokenException(response, errorBody)
+
+ case strings.EqualFold("PackedPolicyTooLarge", errorCode):
+ return awsAwsquery_deserializeErrorPackedPolicyTooLargeException(response, errorBody)
+
+ case strings.EqualFold("RegionDisabledException", errorCode):
+ return awsAwsquery_deserializeErrorRegionDisabledException(response, errorBody)
+
+ default:
+ genericError := &smithy.GenericAPIError{
+ Code: errorCode,
+ Message: errorMessage,
+ }
+ return genericError
+
+ }
+}
+
type awsAwsquery_deserializeOpGetFederationToken struct {
}
@@ -1076,6 +1194,124 @@ func awsAwsquery_deserializeOpErrorGetSessionToken(response *smithyhttp.Response
}
}
+type awsAwsquery_deserializeOpGetWebIdentityToken struct {
+}
+
+func (*awsAwsquery_deserializeOpGetWebIdentityToken) ID() string {
+ return "OperationDeserializer"
+}
+
+func (m *awsAwsquery_deserializeOpGetWebIdentityToken) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) (
+ out middleware.DeserializeOutput, metadata middleware.Metadata, err error,
+) {
+ out, metadata, err = next.HandleDeserialize(ctx, in)
+ if err != nil {
+ return out, metadata, err
+ }
+
+ _, span := tracing.StartSpan(ctx, "OperationDeserializer")
+ endTimer := startMetricTimer(ctx, "client.call.deserialization_duration")
+ defer endTimer()
+ defer span.End()
+ response, ok := out.RawResponse.(*smithyhttp.Response)
+ if !ok {
+ return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)}
+ }
+
+ if response.StatusCode < 200 || response.StatusCode >= 300 {
+ return out, metadata, awsAwsquery_deserializeOpErrorGetWebIdentityToken(response, &metadata)
+ }
+ output := &GetWebIdentityTokenOutput{}
+ out.Result = output
+
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+ body := io.TeeReader(response.Body, ringBuffer)
+ rootDecoder := xml.NewDecoder(body)
+ t, err := smithyxml.FetchRootElement(rootDecoder)
+ if err == io.EOF {
+ return out, metadata, nil
+ }
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return out, metadata, &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ decoder := smithyxml.WrapNodeDecoder(rootDecoder, t)
+ t, err = decoder.GetElement("GetWebIdentityTokenResult")
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return out, metadata, err
+ }
+
+ decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t)
+ err = awsAwsquery_deserializeOpDocumentGetWebIdentityTokenOutput(&output, decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ err = &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ return out, metadata, err
+ }
+
+ return out, metadata, err
+}
+
+func awsAwsquery_deserializeOpErrorGetWebIdentityToken(response *smithyhttp.Response, metadata *middleware.Metadata) error {
+ var errorBuffer bytes.Buffer
+ if _, err := io.Copy(&errorBuffer, response.Body); err != nil {
+ return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)}
+ }
+ errorBody := bytes.NewReader(errorBuffer.Bytes())
+
+ errorCode := "UnknownError"
+ errorMessage := errorCode
+
+ errorComponents, err := awsxml.GetErrorResponseComponents(errorBody, false)
+ if err != nil {
+ return err
+ }
+ if reqID := errorComponents.RequestID; len(reqID) != 0 {
+ awsmiddleware.SetRequestIDMetadata(metadata, reqID)
+ }
+ if len(errorComponents.Code) != 0 {
+ errorCode = errorComponents.Code
+ }
+ if len(errorComponents.Message) != 0 {
+ errorMessage = errorComponents.Message
+ }
+ errorBody.Seek(0, io.SeekStart)
+ switch {
+ case strings.EqualFold("JWTPayloadSizeExceededException", errorCode):
+ return awsAwsquery_deserializeErrorJWTPayloadSizeExceededException(response, errorBody)
+
+ case strings.EqualFold("OutboundWebIdentityFederationDisabledException", errorCode):
+ return awsAwsquery_deserializeErrorOutboundWebIdentityFederationDisabledException(response, errorBody)
+
+ case strings.EqualFold("SessionDurationEscalationException", errorCode):
+ return awsAwsquery_deserializeErrorSessionDurationEscalationException(response, errorBody)
+
+ default:
+ genericError := &smithy.GenericAPIError{
+ Code: errorCode,
+ Message: errorMessage,
+ }
+ return genericError
+
+ }
+}
+
func awsAwsquery_deserializeErrorExpiredTokenException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
output := &types.ExpiredTokenException{}
var buff [1024]byte
@@ -1120,8 +1356,8 @@ func awsAwsquery_deserializeErrorExpiredTokenException(response *smithyhttp.Resp
return output
}
-func awsAwsquery_deserializeErrorIDPCommunicationErrorException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
- output := &types.IDPCommunicationErrorException{}
+func awsAwsquery_deserializeErrorExpiredTradeInTokenException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.ExpiredTradeInTokenException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
@@ -1151,7 +1387,7 @@ func awsAwsquery_deserializeErrorIDPCommunicationErrorException(response *smithy
}
decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t)
- err = awsAwsquery_deserializeDocumentIDPCommunicationErrorException(&output, decoder)
+ err = awsAwsquery_deserializeDocumentExpiredTradeInTokenException(&output, decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
@@ -1164,8 +1400,8 @@ func awsAwsquery_deserializeErrorIDPCommunicationErrorException(response *smithy
return output
}
-func awsAwsquery_deserializeErrorIDPRejectedClaimException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
- output := &types.IDPRejectedClaimException{}
+func awsAwsquery_deserializeErrorIDPCommunicationErrorException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.IDPCommunicationErrorException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
@@ -1195,7 +1431,7 @@ func awsAwsquery_deserializeErrorIDPRejectedClaimException(response *smithyhttp.
}
decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t)
- err = awsAwsquery_deserializeDocumentIDPRejectedClaimException(&output, decoder)
+ err = awsAwsquery_deserializeDocumentIDPCommunicationErrorException(&output, decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
@@ -1208,8 +1444,8 @@ func awsAwsquery_deserializeErrorIDPRejectedClaimException(response *smithyhttp.
return output
}
-func awsAwsquery_deserializeErrorInvalidAuthorizationMessageException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
- output := &types.InvalidAuthorizationMessageException{}
+func awsAwsquery_deserializeErrorIDPRejectedClaimException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.IDPRejectedClaimException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
@@ -1239,7 +1475,7 @@ func awsAwsquery_deserializeErrorInvalidAuthorizationMessageException(response *
}
decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t)
- err = awsAwsquery_deserializeDocumentInvalidAuthorizationMessageException(&output, decoder)
+ err = awsAwsquery_deserializeDocumentIDPRejectedClaimException(&output, decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
@@ -1252,8 +1488,8 @@ func awsAwsquery_deserializeErrorInvalidAuthorizationMessageException(response *
return output
}
-func awsAwsquery_deserializeErrorInvalidIdentityTokenException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
- output := &types.InvalidIdentityTokenException{}
+func awsAwsquery_deserializeErrorInvalidAuthorizationMessageException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.InvalidAuthorizationMessageException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
@@ -1283,7 +1519,7 @@ func awsAwsquery_deserializeErrorInvalidIdentityTokenException(response *smithyh
}
decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t)
- err = awsAwsquery_deserializeDocumentInvalidIdentityTokenException(&output, decoder)
+ err = awsAwsquery_deserializeDocumentInvalidAuthorizationMessageException(&output, decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
@@ -1296,8 +1532,8 @@ func awsAwsquery_deserializeErrorInvalidIdentityTokenException(response *smithyh
return output
}
-func awsAwsquery_deserializeErrorMalformedPolicyDocumentException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
- output := &types.MalformedPolicyDocumentException{}
+func awsAwsquery_deserializeErrorInvalidIdentityTokenException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.InvalidIdentityTokenException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
@@ -1327,7 +1563,7 @@ func awsAwsquery_deserializeErrorMalformedPolicyDocumentException(response *smit
}
decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t)
- err = awsAwsquery_deserializeDocumentMalformedPolicyDocumentException(&output, decoder)
+ err = awsAwsquery_deserializeDocumentInvalidIdentityTokenException(&output, decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
@@ -1340,8 +1576,8 @@ func awsAwsquery_deserializeErrorMalformedPolicyDocumentException(response *smit
return output
}
-func awsAwsquery_deserializeErrorPackedPolicyTooLargeException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
- output := &types.PackedPolicyTooLargeException{}
+func awsAwsquery_deserializeErrorJWTPayloadSizeExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.JWTPayloadSizeExceededException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
@@ -1371,7 +1607,7 @@ func awsAwsquery_deserializeErrorPackedPolicyTooLargeException(response *smithyh
}
decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t)
- err = awsAwsquery_deserializeDocumentPackedPolicyTooLargeException(&output, decoder)
+ err = awsAwsquery_deserializeDocumentJWTPayloadSizeExceededException(&output, decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
@@ -1384,8 +1620,8 @@ func awsAwsquery_deserializeErrorPackedPolicyTooLargeException(response *smithyh
return output
}
-func awsAwsquery_deserializeErrorRegionDisabledException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
- output := &types.RegionDisabledException{}
+func awsAwsquery_deserializeErrorMalformedPolicyDocumentException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.MalformedPolicyDocumentException{}
var buff [1024]byte
ringBuffer := smithyio.NewRingBuffer(buff[:])
body := io.TeeReader(errorBody, ringBuffer)
@@ -1415,7 +1651,7 @@ func awsAwsquery_deserializeErrorRegionDisabledException(response *smithyhttp.Re
}
decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t)
- err = awsAwsquery_deserializeDocumentRegionDisabledException(&output, decoder)
+ err = awsAwsquery_deserializeDocumentMalformedPolicyDocumentException(&output, decoder)
if err != nil {
var snapshot bytes.Buffer
io.Copy(&snapshot, ringBuffer)
@@ -1428,13 +1664,441 @@ func awsAwsquery_deserializeErrorRegionDisabledException(response *smithyhttp.Re
return output
}
-func awsAwsquery_deserializeDocumentAssumedRoleUser(v **types.AssumedRoleUser, decoder smithyxml.NodeDecoder) error {
+func awsAwsquery_deserializeErrorOutboundWebIdentityFederationDisabledException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.OutboundWebIdentityFederationDisabledException{}
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+ body := io.TeeReader(errorBody, ringBuffer)
+ rootDecoder := xml.NewDecoder(body)
+ t, err := smithyxml.FetchRootElement(rootDecoder)
+ if err == io.EOF {
+ return output
+ }
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ decoder := smithyxml.WrapNodeDecoder(rootDecoder, t)
+ t, err = decoder.GetElement("Error")
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t)
+ err = awsAwsquery_deserializeDocumentOutboundWebIdentityFederationDisabledException(&output, decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ return output
+}
+
+func awsAwsquery_deserializeErrorPackedPolicyTooLargeException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.PackedPolicyTooLargeException{}
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+ body := io.TeeReader(errorBody, ringBuffer)
+ rootDecoder := xml.NewDecoder(body)
+ t, err := smithyxml.FetchRootElement(rootDecoder)
+ if err == io.EOF {
+ return output
+ }
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ decoder := smithyxml.WrapNodeDecoder(rootDecoder, t)
+ t, err = decoder.GetElement("Error")
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t)
+ err = awsAwsquery_deserializeDocumentPackedPolicyTooLargeException(&output, decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ return output
+}
+
+func awsAwsquery_deserializeErrorRegionDisabledException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.RegionDisabledException{}
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+ body := io.TeeReader(errorBody, ringBuffer)
+ rootDecoder := xml.NewDecoder(body)
+ t, err := smithyxml.FetchRootElement(rootDecoder)
+ if err == io.EOF {
+ return output
+ }
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ decoder := smithyxml.WrapNodeDecoder(rootDecoder, t)
+ t, err = decoder.GetElement("Error")
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t)
+ err = awsAwsquery_deserializeDocumentRegionDisabledException(&output, decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ return output
+}
+
+func awsAwsquery_deserializeErrorSessionDurationEscalationException(response *smithyhttp.Response, errorBody *bytes.Reader) error {
+ output := &types.SessionDurationEscalationException{}
+ var buff [1024]byte
+ ringBuffer := smithyio.NewRingBuffer(buff[:])
+ body := io.TeeReader(errorBody, ringBuffer)
+ rootDecoder := xml.NewDecoder(body)
+ t, err := smithyxml.FetchRootElement(rootDecoder)
+ if err == io.EOF {
+ return output
+ }
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ decoder := smithyxml.WrapNodeDecoder(rootDecoder, t)
+ t, err = decoder.GetElement("Error")
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ decoder = smithyxml.WrapNodeDecoder(decoder.Decoder, t)
+ err = awsAwsquery_deserializeDocumentSessionDurationEscalationException(&output, decoder)
+ if err != nil {
+ var snapshot bytes.Buffer
+ io.Copy(&snapshot, ringBuffer)
+ return &smithy.DeserializationError{
+ Err: fmt.Errorf("failed to decode response body, %w", err),
+ Snapshot: snapshot.Bytes(),
+ }
+ }
+
+ return output
+}
+
+func awsAwsquery_deserializeDocumentAssumedRoleUser(v **types.AssumedRoleUser, decoder smithyxml.NodeDecoder) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ var sv *types.AssumedRoleUser
+ if *v == nil {
+ sv = &types.AssumedRoleUser{}
+ } else {
+ sv = *v
+ }
+
+ for {
+ t, done, err := decoder.Token()
+ if err != nil {
+ return err
+ }
+ if done {
+ break
+ }
+ originalDecoder := decoder
+ decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t)
+ switch {
+ case strings.EqualFold("Arn", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ sv.Arn = ptr.String(xtv)
+ }
+
+ case strings.EqualFold("AssumedRoleId", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ sv.AssumedRoleId = ptr.String(xtv)
+ }
+
+ default:
+ // Do nothing and ignore the unexpected tag element
+ err = decoder.Decoder.Skip()
+ if err != nil {
+ return err
+ }
+
+ }
+ decoder = originalDecoder
+ }
+ *v = sv
+ return nil
+}
+
+func awsAwsquery_deserializeDocumentCredentials(v **types.Credentials, decoder smithyxml.NodeDecoder) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ var sv *types.Credentials
+ if *v == nil {
+ sv = &types.Credentials{}
+ } else {
+ sv = *v
+ }
+
+ for {
+ t, done, err := decoder.Token()
+ if err != nil {
+ return err
+ }
+ if done {
+ break
+ }
+ originalDecoder := decoder
+ decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t)
+ switch {
+ case strings.EqualFold("AccessKeyId", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ sv.AccessKeyId = ptr.String(xtv)
+ }
+
+ case strings.EqualFold("Expiration", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ t, err := smithytime.ParseDateTime(xtv)
+ if err != nil {
+ return err
+ }
+ sv.Expiration = ptr.Time(t)
+ }
+
+ case strings.EqualFold("SecretAccessKey", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ sv.SecretAccessKey = ptr.String(xtv)
+ }
+
+ case strings.EqualFold("SessionToken", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ sv.SessionToken = ptr.String(xtv)
+ }
+
+ default:
+ // Do nothing and ignore the unexpected tag element
+ err = decoder.Decoder.Skip()
+ if err != nil {
+ return err
+ }
+
+ }
+ decoder = originalDecoder
+ }
+ *v = sv
+ return nil
+}
+
+func awsAwsquery_deserializeDocumentExpiredTokenException(v **types.ExpiredTokenException, decoder smithyxml.NodeDecoder) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ var sv *types.ExpiredTokenException
+ if *v == nil {
+ sv = &types.ExpiredTokenException{}
+ } else {
+ sv = *v
+ }
+
+ for {
+ t, done, err := decoder.Token()
+ if err != nil {
+ return err
+ }
+ if done {
+ break
+ }
+ originalDecoder := decoder
+ decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t)
+ switch {
+ case strings.EqualFold("message", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ sv.Message = ptr.String(xtv)
+ }
+
+ default:
+ // Do nothing and ignore the unexpected tag element
+ err = decoder.Decoder.Skip()
+ if err != nil {
+ return err
+ }
+
+ }
+ decoder = originalDecoder
+ }
+ *v = sv
+ return nil
+}
+
+func awsAwsquery_deserializeDocumentExpiredTradeInTokenException(v **types.ExpiredTradeInTokenException, decoder smithyxml.NodeDecoder) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ var sv *types.ExpiredTradeInTokenException
+ if *v == nil {
+ sv = &types.ExpiredTradeInTokenException{}
+ } else {
+ sv = *v
+ }
+
+ for {
+ t, done, err := decoder.Token()
+ if err != nil {
+ return err
+ }
+ if done {
+ break
+ }
+ originalDecoder := decoder
+ decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t)
+ switch {
+ case strings.EqualFold("message", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ sv.Message = ptr.String(xtv)
+ }
+
+ default:
+ // Do nothing and ignore the unexpected tag element
+ err = decoder.Decoder.Skip()
+ if err != nil {
+ return err
+ }
+
+ }
+ decoder = originalDecoder
+ }
+ *v = sv
+ return nil
+}
+
+func awsAwsquery_deserializeDocumentFederatedUser(v **types.FederatedUser, decoder smithyxml.NodeDecoder) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
- var sv *types.AssumedRoleUser
+ var sv *types.FederatedUser
if *v == nil {
- sv = &types.AssumedRoleUser{}
+ sv = &types.FederatedUser{}
} else {
sv = *v
}
@@ -1463,7 +2127,7 @@ func awsAwsquery_deserializeDocumentAssumedRoleUser(v **types.AssumedRoleUser, d
sv.Arn = ptr.String(xtv)
}
- case strings.EqualFold("AssumedRoleId", t.Name.Local):
+ case strings.EqualFold("FederatedUserId", t.Name.Local):
val, err := decoder.Value()
if err != nil {
return err
@@ -1473,7 +2137,7 @@ func awsAwsquery_deserializeDocumentAssumedRoleUser(v **types.AssumedRoleUser, d
}
{
xtv := string(val)
- sv.AssumedRoleId = ptr.String(xtv)
+ sv.FederatedUserId = ptr.String(xtv)
}
default:
@@ -1490,13 +2154,13 @@ func awsAwsquery_deserializeDocumentAssumedRoleUser(v **types.AssumedRoleUser, d
return nil
}
-func awsAwsquery_deserializeDocumentCredentials(v **types.Credentials, decoder smithyxml.NodeDecoder) error {
+func awsAwsquery_deserializeDocumentIDPCommunicationErrorException(v **types.IDPCommunicationErrorException, decoder smithyxml.NodeDecoder) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
- var sv *types.Credentials
+ var sv *types.IDPCommunicationErrorException
if *v == nil {
- sv = &types.Credentials{}
+ sv = &types.IDPCommunicationErrorException{}
} else {
sv = *v
}
@@ -1512,50 +2176,7 @@ func awsAwsquery_deserializeDocumentCredentials(v **types.Credentials, decoder s
originalDecoder := decoder
decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t)
switch {
- case strings.EqualFold("AccessKeyId", t.Name.Local):
- val, err := decoder.Value()
- if err != nil {
- return err
- }
- if val == nil {
- break
- }
- {
- xtv := string(val)
- sv.AccessKeyId = ptr.String(xtv)
- }
-
- case strings.EqualFold("Expiration", t.Name.Local):
- val, err := decoder.Value()
- if err != nil {
- return err
- }
- if val == nil {
- break
- }
- {
- xtv := string(val)
- t, err := smithytime.ParseDateTime(xtv)
- if err != nil {
- return err
- }
- sv.Expiration = ptr.Time(t)
- }
-
- case strings.EqualFold("SecretAccessKey", t.Name.Local):
- val, err := decoder.Value()
- if err != nil {
- return err
- }
- if val == nil {
- break
- }
- {
- xtv := string(val)
- sv.SecretAccessKey = ptr.String(xtv)
- }
-
- case strings.EqualFold("SessionToken", t.Name.Local):
+ case strings.EqualFold("message", t.Name.Local):
val, err := decoder.Value()
if err != nil {
return err
@@ -1565,7 +2186,7 @@ func awsAwsquery_deserializeDocumentCredentials(v **types.Credentials, decoder s
}
{
xtv := string(val)
- sv.SessionToken = ptr.String(xtv)
+ sv.Message = ptr.String(xtv)
}
default:
@@ -1582,13 +2203,13 @@ func awsAwsquery_deserializeDocumentCredentials(v **types.Credentials, decoder s
return nil
}
-func awsAwsquery_deserializeDocumentExpiredTokenException(v **types.ExpiredTokenException, decoder smithyxml.NodeDecoder) error {
+func awsAwsquery_deserializeDocumentIDPRejectedClaimException(v **types.IDPRejectedClaimException, decoder smithyxml.NodeDecoder) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
- var sv *types.ExpiredTokenException
+ var sv *types.IDPRejectedClaimException
if *v == nil {
- sv = &types.ExpiredTokenException{}
+ sv = &types.IDPRejectedClaimException{}
} else {
sv = *v
}
@@ -1631,13 +2252,13 @@ func awsAwsquery_deserializeDocumentExpiredTokenException(v **types.ExpiredToken
return nil
}
-func awsAwsquery_deserializeDocumentFederatedUser(v **types.FederatedUser, decoder smithyxml.NodeDecoder) error {
+func awsAwsquery_deserializeDocumentInvalidAuthorizationMessageException(v **types.InvalidAuthorizationMessageException, decoder smithyxml.NodeDecoder) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
- var sv *types.FederatedUser
+ var sv *types.InvalidAuthorizationMessageException
if *v == nil {
- sv = &types.FederatedUser{}
+ sv = &types.InvalidAuthorizationMessageException{}
} else {
sv = *v
}
@@ -1653,20 +2274,7 @@ func awsAwsquery_deserializeDocumentFederatedUser(v **types.FederatedUser, decod
originalDecoder := decoder
decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t)
switch {
- case strings.EqualFold("Arn", t.Name.Local):
- val, err := decoder.Value()
- if err != nil {
- return err
- }
- if val == nil {
- break
- }
- {
- xtv := string(val)
- sv.Arn = ptr.String(xtv)
- }
-
- case strings.EqualFold("FederatedUserId", t.Name.Local):
+ case strings.EqualFold("message", t.Name.Local):
val, err := decoder.Value()
if err != nil {
return err
@@ -1676,7 +2284,7 @@ func awsAwsquery_deserializeDocumentFederatedUser(v **types.FederatedUser, decod
}
{
xtv := string(val)
- sv.FederatedUserId = ptr.String(xtv)
+ sv.Message = ptr.String(xtv)
}
default:
@@ -1693,13 +2301,13 @@ func awsAwsquery_deserializeDocumentFederatedUser(v **types.FederatedUser, decod
return nil
}
-func awsAwsquery_deserializeDocumentIDPCommunicationErrorException(v **types.IDPCommunicationErrorException, decoder smithyxml.NodeDecoder) error {
+func awsAwsquery_deserializeDocumentInvalidIdentityTokenException(v **types.InvalidIdentityTokenException, decoder smithyxml.NodeDecoder) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
- var sv *types.IDPCommunicationErrorException
+ var sv *types.InvalidIdentityTokenException
if *v == nil {
- sv = &types.IDPCommunicationErrorException{}
+ sv = &types.InvalidIdentityTokenException{}
} else {
sv = *v
}
@@ -1742,13 +2350,13 @@ func awsAwsquery_deserializeDocumentIDPCommunicationErrorException(v **types.IDP
return nil
}
-func awsAwsquery_deserializeDocumentIDPRejectedClaimException(v **types.IDPRejectedClaimException, decoder smithyxml.NodeDecoder) error {
+func awsAwsquery_deserializeDocumentJWTPayloadSizeExceededException(v **types.JWTPayloadSizeExceededException, decoder smithyxml.NodeDecoder) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
- var sv *types.IDPRejectedClaimException
+ var sv *types.JWTPayloadSizeExceededException
if *v == nil {
- sv = &types.IDPRejectedClaimException{}
+ sv = &types.JWTPayloadSizeExceededException{}
} else {
sv = *v
}
@@ -1791,13 +2399,13 @@ func awsAwsquery_deserializeDocumentIDPRejectedClaimException(v **types.IDPRejec
return nil
}
-func awsAwsquery_deserializeDocumentInvalidAuthorizationMessageException(v **types.InvalidAuthorizationMessageException, decoder smithyxml.NodeDecoder) error {
+func awsAwsquery_deserializeDocumentMalformedPolicyDocumentException(v **types.MalformedPolicyDocumentException, decoder smithyxml.NodeDecoder) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
- var sv *types.InvalidAuthorizationMessageException
+ var sv *types.MalformedPolicyDocumentException
if *v == nil {
- sv = &types.InvalidAuthorizationMessageException{}
+ sv = &types.MalformedPolicyDocumentException{}
} else {
sv = *v
}
@@ -1840,13 +2448,13 @@ func awsAwsquery_deserializeDocumentInvalidAuthorizationMessageException(v **typ
return nil
}
-func awsAwsquery_deserializeDocumentInvalidIdentityTokenException(v **types.InvalidIdentityTokenException, decoder smithyxml.NodeDecoder) error {
+func awsAwsquery_deserializeDocumentOutboundWebIdentityFederationDisabledException(v **types.OutboundWebIdentityFederationDisabledException, decoder smithyxml.NodeDecoder) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
- var sv *types.InvalidIdentityTokenException
+ var sv *types.OutboundWebIdentityFederationDisabledException
if *v == nil {
- sv = &types.InvalidIdentityTokenException{}
+ sv = &types.OutboundWebIdentityFederationDisabledException{}
} else {
sv = *v
}
@@ -1889,13 +2497,13 @@ func awsAwsquery_deserializeDocumentInvalidIdentityTokenException(v **types.Inva
return nil
}
-func awsAwsquery_deserializeDocumentMalformedPolicyDocumentException(v **types.MalformedPolicyDocumentException, decoder smithyxml.NodeDecoder) error {
+func awsAwsquery_deserializeDocumentPackedPolicyTooLargeException(v **types.PackedPolicyTooLargeException, decoder smithyxml.NodeDecoder) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
- var sv *types.MalformedPolicyDocumentException
+ var sv *types.PackedPolicyTooLargeException
if *v == nil {
- sv = &types.MalformedPolicyDocumentException{}
+ sv = &types.PackedPolicyTooLargeException{}
} else {
sv = *v
}
@@ -1938,13 +2546,13 @@ func awsAwsquery_deserializeDocumentMalformedPolicyDocumentException(v **types.M
return nil
}
-func awsAwsquery_deserializeDocumentPackedPolicyTooLargeException(v **types.PackedPolicyTooLargeException, decoder smithyxml.NodeDecoder) error {
+func awsAwsquery_deserializeDocumentRegionDisabledException(v **types.RegionDisabledException, decoder smithyxml.NodeDecoder) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
- var sv *types.PackedPolicyTooLargeException
+ var sv *types.RegionDisabledException
if *v == nil {
- sv = &types.PackedPolicyTooLargeException{}
+ sv = &types.RegionDisabledException{}
} else {
sv = *v
}
@@ -1987,13 +2595,13 @@ func awsAwsquery_deserializeDocumentPackedPolicyTooLargeException(v **types.Pack
return nil
}
-func awsAwsquery_deserializeDocumentRegionDisabledException(v **types.RegionDisabledException, decoder smithyxml.NodeDecoder) error {
+func awsAwsquery_deserializeDocumentSessionDurationEscalationException(v **types.SessionDurationEscalationException, decoder smithyxml.NodeDecoder) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
}
- var sv *types.RegionDisabledException
+ var sv *types.SessionDurationEscalationException
if *v == nil {
- sv = &types.RegionDisabledException{}
+ sv = &types.SessionDurationEscalationException{}
} else {
sv = *v
}
@@ -2602,6 +3210,78 @@ func awsAwsquery_deserializeOpDocumentGetCallerIdentityOutput(v **GetCallerIdent
return nil
}
+func awsAwsquery_deserializeOpDocumentGetDelegatedAccessTokenOutput(v **GetDelegatedAccessTokenOutput, decoder smithyxml.NodeDecoder) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ var sv *GetDelegatedAccessTokenOutput
+ if *v == nil {
+ sv = &GetDelegatedAccessTokenOutput{}
+ } else {
+ sv = *v
+ }
+
+ for {
+ t, done, err := decoder.Token()
+ if err != nil {
+ return err
+ }
+ if done {
+ break
+ }
+ originalDecoder := decoder
+ decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t)
+ switch {
+ case strings.EqualFold("AssumedPrincipal", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ sv.AssumedPrincipal = ptr.String(xtv)
+ }
+
+ case strings.EqualFold("Credentials", t.Name.Local):
+ nodeDecoder := smithyxml.WrapNodeDecoder(decoder.Decoder, t)
+ if err := awsAwsquery_deserializeDocumentCredentials(&sv.Credentials, nodeDecoder); err != nil {
+ return err
+ }
+
+ case strings.EqualFold("PackedPolicySize", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ i64, err := strconv.ParseInt(xtv, 10, 64)
+ if err != nil {
+ return err
+ }
+ sv.PackedPolicySize = ptr.Int32(int32(i64))
+ }
+
+ default:
+ // Do nothing and ignore the unexpected tag element
+ err = decoder.Decoder.Skip()
+ if err != nil {
+ return err
+ }
+
+ }
+ decoder = originalDecoder
+ }
+ *v = sv
+ return nil
+}
+
func awsAwsquery_deserializeOpDocumentGetFederationTokenOutput(v **GetFederationTokenOutput, decoder smithyxml.NodeDecoder) error {
if v == nil {
return fmt.Errorf("unexpected nil of type %T", v)
@@ -2708,3 +3388,69 @@ func awsAwsquery_deserializeOpDocumentGetSessionTokenOutput(v **GetSessionTokenO
*v = sv
return nil
}
+
+func awsAwsquery_deserializeOpDocumentGetWebIdentityTokenOutput(v **GetWebIdentityTokenOutput, decoder smithyxml.NodeDecoder) error {
+ if v == nil {
+ return fmt.Errorf("unexpected nil of type %T", v)
+ }
+ var sv *GetWebIdentityTokenOutput
+ if *v == nil {
+ sv = &GetWebIdentityTokenOutput{}
+ } else {
+ sv = *v
+ }
+
+ for {
+ t, done, err := decoder.Token()
+ if err != nil {
+ return err
+ }
+ if done {
+ break
+ }
+ originalDecoder := decoder
+ decoder = smithyxml.WrapNodeDecoder(originalDecoder.Decoder, t)
+ switch {
+ case strings.EqualFold("Expiration", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ t, err := smithytime.ParseDateTime(xtv)
+ if err != nil {
+ return err
+ }
+ sv.Expiration = ptr.Time(t)
+ }
+
+ case strings.EqualFold("WebIdentityToken", t.Name.Local):
+ val, err := decoder.Value()
+ if err != nil {
+ return err
+ }
+ if val == nil {
+ break
+ }
+ {
+ xtv := string(val)
+ sv.WebIdentityToken = ptr.String(xtv)
+ }
+
+ default:
+ // Do nothing and ignore the unexpected tag element
+ err = decoder.Decoder.Skip()
+ if err != nil {
+ return err
+ }
+
+ }
+ decoder = originalDecoder
+ }
+ *v = sv
+ return nil
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/endpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/endpoints.go
index 945682e1a50..962596a6ef9 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/endpoints.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/endpoints.go
@@ -218,11 +218,15 @@ func resolveBaseEndpoint(cfg aws.Config, o *Options) {
}
}
-func bindRegion(region string) *string {
+func bindRegion(region string) (*string, error) {
if region == "" {
- return nil
+ return nil, nil
+ }
+ if !smithyhttp.ValidHostLabel(region) {
+ return nil, fmt.Errorf("invalid input region %s", region)
}
- return aws.String(endpoints.MapFIPSRegion(region))
+
+ return aws.String(endpoints.MapFIPSRegion(region)), nil
}
// EndpointParameters provides the parameters that influence how endpoints are
@@ -1060,10 +1064,15 @@ type endpointParamsBinder interface {
bindEndpointParams(*EndpointParameters)
}
-func bindEndpointParams(ctx context.Context, input interface{}, options Options) *EndpointParameters {
+func bindEndpointParams(ctx context.Context, input interface{}, options Options) (*EndpointParameters, error) {
params := &EndpointParameters{}
- params.Region = bindRegion(options.Region)
+ region, err := bindRegion(options.Region)
+ if err != nil {
+ return nil, err
+ }
+ params.Region = region
+
params.UseDualStack = aws.Bool(options.EndpointOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled)
params.UseFIPS = aws.Bool(options.EndpointOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled)
params.Endpoint = options.BaseEndpoint
@@ -1072,7 +1081,7 @@ func bindEndpointParams(ctx context.Context, input interface{}, options Options)
b.bindEndpointParams(params)
}
- return params
+ return params, nil
}
type resolveEndpointV2Middleware struct {
@@ -1102,7 +1111,10 @@ func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in mid
return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil")
}
- params := bindEndpointParams(ctx, getOperationInput(ctx), m.options)
+ params, err := bindEndpointParams(ctx, getOperationInput(ctx), m.options)
+ if err != nil {
+ return out, metadata, fmt.Errorf("failed to bind endpoint params, %w", err)
+ }
endpt, err := timeOperationMetric(ctx, "client.call.resolve_endpoint_duration",
func() (smithyendpoints.Endpoint, error) {
return m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params)
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/generated.json b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/generated.json
index 86bb3b79be4..e61823ea016 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/generated.json
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/generated.json
@@ -17,8 +17,10 @@
"api_op_DecodeAuthorizationMessage.go",
"api_op_GetAccessKeyInfo.go",
"api_op_GetCallerIdentity.go",
+ "api_op_GetDelegatedAccessToken.go",
"api_op_GetFederationToken.go",
"api_op_GetSessionToken.go",
+ "api_op_GetWebIdentityToken.go",
"auth.go",
"deserializers.go",
"doc.go",
@@ -37,7 +39,7 @@
"types/types.go",
"validators.go"
],
- "go": "1.22",
+ "go": "1.23",
"module": "github.com/aws/aws-sdk-go-v2/service/sts",
"unstable": false
}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go
index dd0eacf56c2..6bae0079f37 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go
@@ -3,4 +3,4 @@
package sts
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.38.6"
+const goModuleVersion = "1.41.1"
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/internal/endpoints/endpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/internal/endpoints/endpoints.go
index 1dc87dd6bf1..1ec1ecf6525 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/internal/endpoints/endpoints.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/internal/endpoints/endpoints.go
@@ -430,6 +430,9 @@ var defaultPartitions = endpoints.Partitions{
endpoints.EndpointKey{
Region: "us-isob-east-1",
}: endpoints.Endpoint{},
+ endpoints.EndpointKey{
+ Region: "us-isob-west-1",
+ }: endpoints.Endpoint{},
},
},
{
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/serializers.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/serializers.go
index 96b222136bf..5e227387827 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/serializers.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/serializers.go
@@ -502,6 +502,76 @@ func (m *awsAwsquery_serializeOpGetCallerIdentity) HandleSerialize(ctx context.C
return next.HandleSerialize(ctx, in)
}
+type awsAwsquery_serializeOpGetDelegatedAccessToken struct {
+}
+
+func (*awsAwsquery_serializeOpGetDelegatedAccessToken) ID() string {
+ return "OperationSerializer"
+}
+
+func (m *awsAwsquery_serializeOpGetDelegatedAccessToken) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+ out middleware.SerializeOutput, metadata middleware.Metadata, err error,
+) {
+ _, span := tracing.StartSpan(ctx, "OperationSerializer")
+ endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
+ defer endTimer()
+ defer span.End()
+ request, ok := in.Request.(*smithyhttp.Request)
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
+ }
+
+ input, ok := in.Parameters.(*GetDelegatedAccessTokenInput)
+ _ = input
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
+ }
+
+ operationPath := "/"
+ if len(request.Request.URL.Path) == 0 {
+ request.Request.URL.Path = operationPath
+ } else {
+ request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath)
+ if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' {
+ request.Request.URL.Path += "/"
+ }
+ }
+ request.Request.Method = "POST"
+ httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
+ if err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+ httpBindingEncoder.SetHeader("Content-Type").String("application/x-www-form-urlencoded")
+
+ bodyWriter := bytes.NewBuffer(nil)
+ bodyEncoder := query.NewEncoder(bodyWriter)
+ body := bodyEncoder.Object()
+ body.Key("Action").String("GetDelegatedAccessToken")
+ body.Key("Version").String("2011-06-15")
+
+ if err := awsAwsquery_serializeOpDocumentGetDelegatedAccessTokenInput(input, bodyEncoder.Value); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ err = bodyEncoder.Encode()
+ if err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ if request, err = request.SetStream(bytes.NewReader(bodyWriter.Bytes())); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+ in.Request = request
+
+ endTimer()
+ span.End()
+ return next.HandleSerialize(ctx, in)
+}
+
type awsAwsquery_serializeOpGetFederationToken struct {
}
@@ -641,6 +711,76 @@ func (m *awsAwsquery_serializeOpGetSessionToken) HandleSerialize(ctx context.Con
span.End()
return next.HandleSerialize(ctx, in)
}
+
+type awsAwsquery_serializeOpGetWebIdentityToken struct {
+}
+
+func (*awsAwsquery_serializeOpGetWebIdentityToken) ID() string {
+ return "OperationSerializer"
+}
+
+func (m *awsAwsquery_serializeOpGetWebIdentityToken) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
+ out middleware.SerializeOutput, metadata middleware.Metadata, err error,
+) {
+ _, span := tracing.StartSpan(ctx, "OperationSerializer")
+ endTimer := startMetricTimer(ctx, "client.call.serialization_duration")
+ defer endTimer()
+ defer span.End()
+ request, ok := in.Request.(*smithyhttp.Request)
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)}
+ }
+
+ input, ok := in.Parameters.(*GetWebIdentityTokenInput)
+ _ = input
+ if !ok {
+ return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)}
+ }
+
+ operationPath := "/"
+ if len(request.Request.URL.Path) == 0 {
+ request.Request.URL.Path = operationPath
+ } else {
+ request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath)
+ if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' {
+ request.Request.URL.Path += "/"
+ }
+ }
+ request.Request.Method = "POST"
+ httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header)
+ if err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+ httpBindingEncoder.SetHeader("Content-Type").String("application/x-www-form-urlencoded")
+
+ bodyWriter := bytes.NewBuffer(nil)
+ bodyEncoder := query.NewEncoder(bodyWriter)
+ body := bodyEncoder.Object()
+ body.Key("Action").String("GetWebIdentityToken")
+ body.Key("Version").String("2011-06-15")
+
+ if err := awsAwsquery_serializeOpDocumentGetWebIdentityTokenInput(input, bodyEncoder.Value); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ err = bodyEncoder.Encode()
+ if err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ if request, err = request.SetStream(bytes.NewReader(bodyWriter.Bytes())); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+
+ if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil {
+ return out, metadata, &smithy.SerializationError{Err: err}
+ }
+ in.Request = request
+
+ endTimer()
+ span.End()
+ return next.HandleSerialize(ctx, in)
+}
func awsAwsquery_serializeDocumentPolicyDescriptorListType(v []types.PolicyDescriptorType, value query.Value) error {
array := value.Array("member")
@@ -733,6 +873,16 @@ func awsAwsquery_serializeDocumentTagListType(v []types.Tag, value query.Value)
return nil
}
+func awsAwsquery_serializeDocumentWebIdentityTokenAudienceListType(v []string, value query.Value) error {
+ array := value.Array("member")
+
+ for i := range v {
+ av := array.Value()
+ av.String(v[i])
+ }
+ return nil
+}
+
func awsAwsquery_serializeOpDocumentAssumeRoleInput(v *AssumeRoleInput, value query.Value) error {
object := value.Object()
_ = object
@@ -946,6 +1096,18 @@ func awsAwsquery_serializeOpDocumentGetCallerIdentityInput(v *GetCallerIdentityI
return nil
}
+func awsAwsquery_serializeOpDocumentGetDelegatedAccessTokenInput(v *GetDelegatedAccessTokenInput, value query.Value) error {
+ object := value.Object()
+ _ = object
+
+ if v.TradeInToken != nil {
+ objectKey := object.Key("TradeInToken")
+ objectKey.String(*v.TradeInToken)
+ }
+
+ return nil
+}
+
func awsAwsquery_serializeOpDocumentGetFederationTokenInput(v *GetFederationTokenInput, value query.Value) error {
object := value.Object()
_ = object
@@ -1003,3 +1165,34 @@ func awsAwsquery_serializeOpDocumentGetSessionTokenInput(v *GetSessionTokenInput
return nil
}
+
+func awsAwsquery_serializeOpDocumentGetWebIdentityTokenInput(v *GetWebIdentityTokenInput, value query.Value) error {
+ object := value.Object()
+ _ = object
+
+ if v.Audience != nil {
+ objectKey := object.Key("Audience")
+ if err := awsAwsquery_serializeDocumentWebIdentityTokenAudienceListType(v.Audience, objectKey); err != nil {
+ return err
+ }
+ }
+
+ if v.DurationSeconds != nil {
+ objectKey := object.Key("DurationSeconds")
+ objectKey.Integer(*v.DurationSeconds)
+ }
+
+ if v.SigningAlgorithm != nil {
+ objectKey := object.Key("SigningAlgorithm")
+ objectKey.String(*v.SigningAlgorithm)
+ }
+
+ if v.Tags != nil {
+ objectKey := object.Key("Tags")
+ if err := awsAwsquery_serializeDocumentTagListType(v.Tags, objectKey); err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/types/errors.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/types/errors.go
index 041629bba2c..70d99a220b8 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/types/errors.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/types/errors.go
@@ -34,6 +34,33 @@ func (e *ExpiredTokenException) ErrorCode() string {
}
func (e *ExpiredTokenException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
+// The trade-in token provided in the request has expired and can no longer be
+// exchanged for credentials. Request a new token and retry the operation.
+type ExpiredTradeInTokenException struct {
+ Message *string
+
+ ErrorCodeOverride *string
+
+ noSmithyDocumentSerde
+}
+
+func (e *ExpiredTradeInTokenException) Error() string {
+ return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
+}
+func (e *ExpiredTradeInTokenException) ErrorMessage() string {
+ if e.Message == nil {
+ return ""
+ }
+ return *e.Message
+}
+func (e *ExpiredTradeInTokenException) ErrorCode() string {
+ if e == nil || e.ErrorCodeOverride == nil {
+ return "ExpiredTradeInTokenException"
+ }
+ return *e.ErrorCodeOverride
+}
+func (e *ExpiredTradeInTokenException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
+
// The request could not be fulfilled because the identity provider (IDP) that was
// asked to verify the incoming identity token could not be reached. This is often
// a transient error caused by network conditions. Retry the request a limited
@@ -152,6 +179,34 @@ func (e *InvalidIdentityTokenException) ErrorCode() string {
}
func (e *InvalidIdentityTokenException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
+// The requested token payload size exceeds the maximum allowed size. Reduce the
+// number of request tags included in the GetWebIdentityToken API call to reduce
+// the token payload size.
+type JWTPayloadSizeExceededException struct {
+ Message *string
+
+ ErrorCodeOverride *string
+
+ noSmithyDocumentSerde
+}
+
+func (e *JWTPayloadSizeExceededException) Error() string {
+ return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
+}
+func (e *JWTPayloadSizeExceededException) ErrorMessage() string {
+ if e.Message == nil {
+ return ""
+ }
+ return *e.Message
+}
+func (e *JWTPayloadSizeExceededException) ErrorCode() string {
+ if e == nil || e.ErrorCodeOverride == nil {
+ return "JWTPayloadSizeExceededException"
+ }
+ return *e.ErrorCodeOverride
+}
+func (e *JWTPayloadSizeExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
+
// The request was rejected because the policy document was malformed. The error
// message describes the specific error.
type MalformedPolicyDocumentException struct {
@@ -179,6 +234,36 @@ func (e *MalformedPolicyDocumentException) ErrorCode() string {
}
func (e *MalformedPolicyDocumentException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
+// The outbound web identity federation feature is not enabled for this account.
+// To use this feature, you must first enable it through the Amazon Web Services
+// Management Console or API.
+type OutboundWebIdentityFederationDisabledException struct {
+ Message *string
+
+ ErrorCodeOverride *string
+
+ noSmithyDocumentSerde
+}
+
+func (e *OutboundWebIdentityFederationDisabledException) Error() string {
+ return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
+}
+func (e *OutboundWebIdentityFederationDisabledException) ErrorMessage() string {
+ if e.Message == nil {
+ return ""
+ }
+ return *e.Message
+}
+func (e *OutboundWebIdentityFederationDisabledException) ErrorCode() string {
+ if e == nil || e.ErrorCodeOverride == nil {
+ return "OutboundWebIdentityFederationDisabledException"
+ }
+ return *e.ErrorCodeOverride
+}
+func (e *OutboundWebIdentityFederationDisabledException) ErrorFault() smithy.ErrorFault {
+ return smithy.FaultClient
+}
+
// The request was rejected because the total packed size of the session policies
// and session tags combined was too large. An Amazon Web Services conversion
// compresses the session policy document, session policy ARNs, and session tags
@@ -221,7 +306,7 @@ func (e *PackedPolicyTooLargeException) ErrorFault() smithy.ErrorFault { return
// console to activate STS in that region. For more information, see [Activating and Deactivating STS in an Amazon Web Services Region]in the IAM
// User Guide.
//
-// [Activating and Deactivating STS in an Amazon Web Services Region]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html
+// [Activating and Deactivating STS in an Amazon Web Services Region]: https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html#sts-regions-activate-deactivate
type RegionDisabledException struct {
Message *string
@@ -246,3 +331,33 @@ func (e *RegionDisabledException) ErrorCode() string {
return *e.ErrorCodeOverride
}
func (e *RegionDisabledException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
+
+// The requested token duration would extend the session beyond its original
+// expiration time. You cannot use this operation to extend the lifetime of a
+// session beyond what was granted when the session was originally created.
+type SessionDurationEscalationException struct {
+ Message *string
+
+ ErrorCodeOverride *string
+
+ noSmithyDocumentSerde
+}
+
+func (e *SessionDurationEscalationException) Error() string {
+ return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage())
+}
+func (e *SessionDurationEscalationException) ErrorMessage() string {
+ if e.Message == nil {
+ return ""
+ }
+ return *e.Message
+}
+func (e *SessionDurationEscalationException) ErrorCode() string {
+ if e == nil || e.ErrorCodeOverride == nil {
+ return "SessionDurationEscalationException"
+ }
+ return *e.ErrorCodeOverride
+}
+func (e *SessionDurationEscalationException) ErrorFault() smithy.ErrorFault {
+ return smithy.FaultClient
+}
diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/validators.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/validators.go
index 1026e22118d..4d37dd22a1d 100644
--- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/validators.go
+++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/validators.go
@@ -130,6 +130,26 @@ func (m *validateOpGetAccessKeyInfo) HandleInitialize(ctx context.Context, in mi
return next.HandleInitialize(ctx, in)
}
+type validateOpGetDelegatedAccessToken struct {
+}
+
+func (*validateOpGetDelegatedAccessToken) ID() string {
+ return "OperationInputValidation"
+}
+
+func (m *validateOpGetDelegatedAccessToken) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
+ out middleware.InitializeOutput, metadata middleware.Metadata, err error,
+) {
+ input, ok := in.Parameters.(*GetDelegatedAccessTokenInput)
+ if !ok {
+ return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
+ }
+ if err := validateOpGetDelegatedAccessTokenInput(input); err != nil {
+ return out, metadata, err
+ }
+ return next.HandleInitialize(ctx, in)
+}
+
type validateOpGetFederationToken struct {
}
@@ -150,6 +170,26 @@ func (m *validateOpGetFederationToken) HandleInitialize(ctx context.Context, in
return next.HandleInitialize(ctx, in)
}
+type validateOpGetWebIdentityToken struct {
+}
+
+func (*validateOpGetWebIdentityToken) ID() string {
+ return "OperationInputValidation"
+}
+
+func (m *validateOpGetWebIdentityToken) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) (
+ out middleware.InitializeOutput, metadata middleware.Metadata, err error,
+) {
+ input, ok := in.Parameters.(*GetWebIdentityTokenInput)
+ if !ok {
+ return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters)
+ }
+ if err := validateOpGetWebIdentityTokenInput(input); err != nil {
+ return out, metadata, err
+ }
+ return next.HandleInitialize(ctx, in)
+}
+
func addOpAssumeRoleValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpAssumeRole{}, middleware.After)
}
@@ -174,10 +214,18 @@ func addOpGetAccessKeyInfoValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetAccessKeyInfo{}, middleware.After)
}
+func addOpGetDelegatedAccessTokenValidationMiddleware(stack *middleware.Stack) error {
+ return stack.Initialize.Add(&validateOpGetDelegatedAccessToken{}, middleware.After)
+}
+
func addOpGetFederationTokenValidationMiddleware(stack *middleware.Stack) error {
return stack.Initialize.Add(&validateOpGetFederationToken{}, middleware.After)
}
+func addOpGetWebIdentityTokenValidationMiddleware(stack *middleware.Stack) error {
+ return stack.Initialize.Add(&validateOpGetWebIdentityToken{}, middleware.After)
+}
+
func validateTag(v *types.Tag) error {
if v == nil {
return nil
@@ -326,6 +374,21 @@ func validateOpGetAccessKeyInfoInput(v *GetAccessKeyInfoInput) error {
}
}
+func validateOpGetDelegatedAccessTokenInput(v *GetDelegatedAccessTokenInput) error {
+ if v == nil {
+ return nil
+ }
+ invalidParams := smithy.InvalidParamsError{Context: "GetDelegatedAccessTokenInput"}
+ if v.TradeInToken == nil {
+ invalidParams.Add(smithy.NewErrParamRequired("TradeInToken"))
+ }
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ } else {
+ return nil
+ }
+}
+
func validateOpGetFederationTokenInput(v *GetFederationTokenInput) error {
if v == nil {
return nil
@@ -345,3 +408,26 @@ func validateOpGetFederationTokenInput(v *GetFederationTokenInput) error {
return nil
}
}
+
+func validateOpGetWebIdentityTokenInput(v *GetWebIdentityTokenInput) error {
+ if v == nil {
+ return nil
+ }
+ invalidParams := smithy.InvalidParamsError{Context: "GetWebIdentityTokenInput"}
+ if v.Audience == nil {
+ invalidParams.Add(smithy.NewErrParamRequired("Audience"))
+ }
+ if v.SigningAlgorithm == nil {
+ invalidParams.Add(smithy.NewErrParamRequired("SigningAlgorithm"))
+ }
+ if v.Tags != nil {
+ if err := validateTagListType(v.Tags); err != nil {
+ invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError))
+ }
+ }
+ if invalidParams.Len() > 0 {
+ return invalidParams
+ } else {
+ return nil
+ }
+}
diff --git a/vendor/github.com/aws/smithy-go/CHANGELOG.md b/vendor/github.com/aws/smithy-go/CHANGELOG.md
index 8b6ab295004..8193f4b3964 100644
--- a/vendor/github.com/aws/smithy-go/CHANGELOG.md
+++ b/vendor/github.com/aws/smithy-go/CHANGELOG.md
@@ -1,3 +1,25 @@
+# Release (2025-11-03)
+
+## General Highlights
+* **Dependency Update**: Updated to the latest SDK module versions
+
+## Module Highlights
+* `github.com/aws/smithy-go`: v1.23.2
+ * **Bug Fix**: Adjust the initial sizes of each middleware phase to avoid some unnecessary reallocation.
+ * **Bug Fix**: Avoid unnecessary allocation overhead from the metrics system when not in use.
+
+# Release (2025-10-15)
+
+## General Highlights
+* **Dependency Update**: Bump minimum go version to 1.23.
+* **Dependency Update**: Updated to the latest SDK module versions
+
+# Release (2025-09-18)
+
+## Module Highlights
+* `github.com/aws/smithy-go/aws-http-auth`: [v1.1.0](aws-http-auth/CHANGELOG.md#v110-2025-09-18)
+ * **Feature**: Added support for SIG4/SIGV4A querystring authentication.
+
# Release (2025-08-27)
## General Highlights
diff --git a/vendor/github.com/aws/smithy-go/Makefile b/vendor/github.com/aws/smithy-go/Makefile
index 34b17ab2fe0..a12b124d505 100644
--- a/vendor/github.com/aws/smithy-go/Makefile
+++ b/vendor/github.com/aws/smithy-go/Makefile
@@ -13,6 +13,7 @@ REPOTOOLS_CMD_GENERATE_CHANGELOG = ${REPOTOOLS_MODULE}/cmd/generatechangelog@${R
REPOTOOLS_CMD_CHANGELOG = ${REPOTOOLS_MODULE}/cmd/changelog@${REPOTOOLS_VERSION}
REPOTOOLS_CMD_TAG_RELEASE = ${REPOTOOLS_MODULE}/cmd/tagrelease@${REPOTOOLS_VERSION}
REPOTOOLS_CMD_MODULE_VERSION = ${REPOTOOLS_MODULE}/cmd/moduleversion@${REPOTOOLS_VERSION}
+REPOTOOLS_CMD_EACHMODULE = ${REPOTOOLS_MODULE}/cmd/eachmodule@${REPOTOOLS_VERSION}
UNIT_TEST_TAGS=
BUILD_TAGS=
@@ -55,8 +56,11 @@ ensure-gradle-up:
verify: vet
-vet:
- go vet ${BUILD_TAGS} --all ./...
+vet: vet-modules-.
+
+vet-modules-%:
+ go run ${REPOTOOLS_CMD_EACHMODULE} -p $(subst vet-modules-,,$@) \
+ "go vet ${BUILD_TAGS} --all ./..."
cover:
go test ${BUILD_TAGS} -coverprofile c.out ./...
@@ -66,21 +70,22 @@ cover:
################
# Unit Testing #
################
-.PHONY: unit unit-race unit-test unit-race-test
+.PHONY: test unit unit-race
+
+test: unit-race
+
+unit: verify unit-modules-.
-unit: verify
- go test ${BUILD_TAGS} ${RUN_NONE} ./... && \
- go test -timeout=1m ${UNIT_TEST_TAGS} ./...
+unit-modules-%:
+ go run ${REPOTOOLS_CMD_EACHMODULE} -p $(subst unit-modules-,,$@) \
+ "go test -timeout=1m ${UNIT_TEST_TAGS} ./..."
-unit-race: verify
- go test ${BUILD_TAGS} ${RUN_NONE} ./... && \
- go test -timeout=1m ${UNIT_TEST_TAGS} -race -cpu=4 ./...
+unit-race: verify unit-race-modules-.
-unit-test: verify
- go test -timeout=1m ${UNIT_TEST_TAGS} ./...
+unit-race-modules-%:
+ go run ${REPOTOOLS_CMD_EACHMODULE} -p $(subst unit-race-modules-,,$@) \
+ "go test -timeout=1m ${UNIT_TEST_TAGS} -race -cpu=4 ./..."
-unit-race-test: verify
- go test -timeout=1m ${UNIT_TEST_TAGS} -race -cpu=4 ./...
#####################
# Release Process #
diff --git a/vendor/github.com/aws/smithy-go/README.md b/vendor/github.com/aws/smithy-go/README.md
index 77a74ae0c2c..ddce37b99ef 100644
--- a/vendor/github.com/aws/smithy-go/README.md
+++ b/vendor/github.com/aws/smithy-go/README.md
@@ -4,7 +4,7 @@
[Smithy](https://smithy.io/) code generators for Go and the accompanying smithy-go runtime.
-The smithy-go runtime requires a minimum version of Go 1.22.
+The smithy-go runtime requires a minimum version of Go 1.23.
**WARNING: All interfaces are subject to change.**
@@ -80,7 +80,7 @@ example created from `smithy init`:
"service": "example.weather#Weather",
"module": "github.com/example/weather",
"generateGoMod": true,
- "goDirective": "1.22"
+ "goDirective": "1.23"
}
}
}
diff --git a/vendor/github.com/aws/smithy-go/go_module_metadata.go b/vendor/github.com/aws/smithy-go/go_module_metadata.go
index 945db0af309..263059014b8 100644
--- a/vendor/github.com/aws/smithy-go/go_module_metadata.go
+++ b/vendor/github.com/aws/smithy-go/go_module_metadata.go
@@ -3,4 +3,4 @@
package smithy
// goModuleVersion is the tagged release for this module
-const goModuleVersion = "1.23.0"
+const goModuleVersion = "1.23.2"
diff --git a/vendor/github.com/aws/smithy-go/metrics/nop.go b/vendor/github.com/aws/smithy-go/metrics/nop.go
index fb374e1fb85..444126df5a0 100644
--- a/vendor/github.com/aws/smithy-go/metrics/nop.go
+++ b/vendor/github.com/aws/smithy-go/metrics/nop.go
@@ -9,54 +9,82 @@ var _ MeterProvider = (*NopMeterProvider)(nil)
// Meter returns a meter which creates no-op instruments.
func (NopMeterProvider) Meter(string, ...MeterOption) Meter {
- return nopMeter{}
+ return NopMeter{}
}
-type nopMeter struct{}
+// NopMeter creates no-op instruments.
+type NopMeter struct{}
-var _ Meter = (*nopMeter)(nil)
+var _ Meter = (*NopMeter)(nil)
-func (nopMeter) Int64Counter(string, ...InstrumentOption) (Int64Counter, error) {
- return nopInstrument[int64]{}, nil
+// Int64Counter creates a no-op instrument.
+func (NopMeter) Int64Counter(string, ...InstrumentOption) (Int64Counter, error) {
+ return nopInstrumentInt64, nil
}
-func (nopMeter) Int64UpDownCounter(string, ...InstrumentOption) (Int64UpDownCounter, error) {
- return nopInstrument[int64]{}, nil
+
+// Int64UpDownCounter creates a no-op instrument.
+func (NopMeter) Int64UpDownCounter(string, ...InstrumentOption) (Int64UpDownCounter, error) {
+ return nopInstrumentInt64, nil
}
-func (nopMeter) Int64Gauge(string, ...InstrumentOption) (Int64Gauge, error) {
- return nopInstrument[int64]{}, nil
+
+// Int64Gauge creates a no-op instrument.
+func (NopMeter) Int64Gauge(string, ...InstrumentOption) (Int64Gauge, error) {
+ return nopInstrumentInt64, nil
}
-func (nopMeter) Int64Histogram(string, ...InstrumentOption) (Int64Histogram, error) {
- return nopInstrument[int64]{}, nil
+
+// Int64Histogram creates a no-op instrument.
+func (NopMeter) Int64Histogram(string, ...InstrumentOption) (Int64Histogram, error) {
+ return nopInstrumentInt64, nil
}
-func (nopMeter) Int64AsyncCounter(string, Int64Callback, ...InstrumentOption) (AsyncInstrument, error) {
- return nopInstrument[int64]{}, nil
+
+// Int64AsyncCounter creates a no-op instrument.
+func (NopMeter) Int64AsyncCounter(string, Int64Callback, ...InstrumentOption) (AsyncInstrument, error) {
+ return nopInstrumentInt64, nil
}
-func (nopMeter) Int64AsyncUpDownCounter(string, Int64Callback, ...InstrumentOption) (AsyncInstrument, error) {
- return nopInstrument[int64]{}, nil
+
+// Int64AsyncUpDownCounter creates a no-op instrument.
+func (NopMeter) Int64AsyncUpDownCounter(string, Int64Callback, ...InstrumentOption) (AsyncInstrument, error) {
+ return nopInstrumentInt64, nil
}
-func (nopMeter) Int64AsyncGauge(string, Int64Callback, ...InstrumentOption) (AsyncInstrument, error) {
- return nopInstrument[int64]{}, nil
+
+// Int64AsyncGauge creates a no-op instrument.
+func (NopMeter) Int64AsyncGauge(string, Int64Callback, ...InstrumentOption) (AsyncInstrument, error) {
+ return nopInstrumentInt64, nil
}
-func (nopMeter) Float64Counter(string, ...InstrumentOption) (Float64Counter, error) {
- return nopInstrument[float64]{}, nil
+
+// Float64Counter creates a no-op instrument.
+func (NopMeter) Float64Counter(string, ...InstrumentOption) (Float64Counter, error) {
+ return nopInstrumentFloat64, nil
}
-func (nopMeter) Float64UpDownCounter(string, ...InstrumentOption) (Float64UpDownCounter, error) {
- return nopInstrument[float64]{}, nil
+
+// Float64UpDownCounter creates a no-op instrument.
+func (NopMeter) Float64UpDownCounter(string, ...InstrumentOption) (Float64UpDownCounter, error) {
+ return nopInstrumentFloat64, nil
}
-func (nopMeter) Float64Gauge(string, ...InstrumentOption) (Float64Gauge, error) {
- return nopInstrument[float64]{}, nil
+
+// Float64Gauge creates a no-op instrument.
+func (NopMeter) Float64Gauge(string, ...InstrumentOption) (Float64Gauge, error) {
+ return nopInstrumentFloat64, nil
}
-func (nopMeter) Float64Histogram(string, ...InstrumentOption) (Float64Histogram, error) {
- return nopInstrument[float64]{}, nil
+
+// Float64Histogram creates a no-op instrument.
+func (NopMeter) Float64Histogram(string, ...InstrumentOption) (Float64Histogram, error) {
+ return nopInstrumentFloat64, nil
}
-func (nopMeter) Float64AsyncCounter(string, Float64Callback, ...InstrumentOption) (AsyncInstrument, error) {
- return nopInstrument[float64]{}, nil
+
+// Float64AsyncCounter creates a no-op instrument.
+func (NopMeter) Float64AsyncCounter(string, Float64Callback, ...InstrumentOption) (AsyncInstrument, error) {
+ return nopInstrumentFloat64, nil
}
-func (nopMeter) Float64AsyncUpDownCounter(string, Float64Callback, ...InstrumentOption) (AsyncInstrument, error) {
- return nopInstrument[float64]{}, nil
+
+// Float64AsyncUpDownCounter creates a no-op instrument.
+func (NopMeter) Float64AsyncUpDownCounter(string, Float64Callback, ...InstrumentOption) (AsyncInstrument, error) {
+ return nopInstrumentFloat64, nil
}
-func (nopMeter) Float64AsyncGauge(string, Float64Callback, ...InstrumentOption) (AsyncInstrument, error) {
- return nopInstrument[float64]{}, nil
+
+// Float64AsyncGauge creates a no-op instrument.
+func (NopMeter) Float64AsyncGauge(string, Float64Callback, ...InstrumentOption) (AsyncInstrument, error) {
+ return nopInstrumentFloat64, nil
}
type nopInstrument[N any] struct{}
@@ -65,3 +93,6 @@ func (nopInstrument[N]) Add(context.Context, N, ...RecordMetricOption) {}
func (nopInstrument[N]) Sample(context.Context, N, ...RecordMetricOption) {}
func (nopInstrument[N]) Record(context.Context, N, ...RecordMetricOption) {}
func (nopInstrument[_]) Stop() {}
+
+var nopInstrumentInt64 = nopInstrument[int64]{}
+var nopInstrumentFloat64 = nopInstrument[float64]{}
diff --git a/vendor/github.com/aws/smithy-go/middleware/ordered_group.go b/vendor/github.com/aws/smithy-go/middleware/ordered_group.go
index 4b195308c59..daf90136e96 100644
--- a/vendor/github.com/aws/smithy-go/middleware/ordered_group.go
+++ b/vendor/github.com/aws/smithy-go/middleware/ordered_group.go
@@ -23,12 +23,14 @@ type orderedIDs struct {
items map[string]ider
}
-const baseOrderedItems = 5
+// selected based on the general upper bound of # of middlewares in each step
+// in the downstream aws-sdk-go-v2
+const baseOrderedItems = 8
-func newOrderedIDs() *orderedIDs {
+func newOrderedIDs(cap int) *orderedIDs {
return &orderedIDs{
- order: newRelativeOrder(),
- items: make(map[string]ider, baseOrderedItems),
+ order: newRelativeOrder(cap),
+ items: make(map[string]ider, cap),
}
}
@@ -141,9 +143,9 @@ type relativeOrder struct {
order []string
}
-func newRelativeOrder() *relativeOrder {
+func newRelativeOrder(cap int) *relativeOrder {
return &relativeOrder{
- order: make([]string, 0, baseOrderedItems),
+ order: make([]string, 0, cap),
}
}
diff --git a/vendor/github.com/aws/smithy-go/middleware/step_build.go b/vendor/github.com/aws/smithy-go/middleware/step_build.go
index 7e1d94caeef..cc7fe89c94a 100644
--- a/vendor/github.com/aws/smithy-go/middleware/step_build.go
+++ b/vendor/github.com/aws/smithy-go/middleware/step_build.go
@@ -79,7 +79,7 @@ type BuildStep struct {
// initialization added to it.
func NewBuildStep() *BuildStep {
return &BuildStep{
- ids: newOrderedIDs(),
+ ids: newOrderedIDs(baseOrderedItems),
}
}
diff --git a/vendor/github.com/aws/smithy-go/middleware/step_deserialize.go b/vendor/github.com/aws/smithy-go/middleware/step_deserialize.go
index 44860721571..9a6679a59b3 100644
--- a/vendor/github.com/aws/smithy-go/middleware/step_deserialize.go
+++ b/vendor/github.com/aws/smithy-go/middleware/step_deserialize.go
@@ -85,7 +85,8 @@ type DeserializeStep struct {
// initialization added to it.
func NewDeserializeStep() *DeserializeStep {
return &DeserializeStep{
- ids: newOrderedIDs(),
+ // downstream SDK typically has larger Deserialize step
+ ids: newOrderedIDs(baseOrderedItems * 2),
}
}
diff --git a/vendor/github.com/aws/smithy-go/middleware/step_finalize.go b/vendor/github.com/aws/smithy-go/middleware/step_finalize.go
index 065e3885de9..76eab249093 100644
--- a/vendor/github.com/aws/smithy-go/middleware/step_finalize.go
+++ b/vendor/github.com/aws/smithy-go/middleware/step_finalize.go
@@ -79,7 +79,8 @@ type FinalizeStep struct {
// initialization added to it.
func NewFinalizeStep() *FinalizeStep {
return &FinalizeStep{
- ids: newOrderedIDs(),
+ // downstream SDK typically has larger Finalize step
+ ids: newOrderedIDs(baseOrderedItems * 2),
}
}
diff --git a/vendor/github.com/aws/smithy-go/middleware/step_initialize.go b/vendor/github.com/aws/smithy-go/middleware/step_initialize.go
index fe359144d24..312be3a331e 100644
--- a/vendor/github.com/aws/smithy-go/middleware/step_initialize.go
+++ b/vendor/github.com/aws/smithy-go/middleware/step_initialize.go
@@ -79,7 +79,7 @@ type InitializeStep struct {
// initialization added to it.
func NewInitializeStep() *InitializeStep {
return &InitializeStep{
- ids: newOrderedIDs(),
+ ids: newOrderedIDs(baseOrderedItems),
}
}
diff --git a/vendor/github.com/aws/smithy-go/middleware/step_serialize.go b/vendor/github.com/aws/smithy-go/middleware/step_serialize.go
index 114bafcedea..a4ce4bee3b7 100644
--- a/vendor/github.com/aws/smithy-go/middleware/step_serialize.go
+++ b/vendor/github.com/aws/smithy-go/middleware/step_serialize.go
@@ -85,7 +85,7 @@ type SerializeStep struct {
// serialize the input parameters into.
func NewSerializeStep(newRequest func() interface{}) *SerializeStep {
return &SerializeStep{
- ids: newOrderedIDs(),
+ ids: newOrderedIDs(baseOrderedItems),
newRequest: newRequest,
}
}
diff --git a/vendor/github.com/aws/smithy-go/transport/http/metrics.go b/vendor/github.com/aws/smithy-go/transport/http/metrics.go
index d1beaa595d9..b4cd4a47e36 100644
--- a/vendor/github.com/aws/smithy-go/transport/http/metrics.go
+++ b/vendor/github.com/aws/smithy-go/transport/http/metrics.go
@@ -17,6 +17,12 @@ var now = time.Now
func withMetrics(parent context.Context, client ClientDo, meter metrics.Meter) (
context.Context, ClientDo, error,
) {
+ // WithClientTrace is an expensive operation - avoid calling it if we're
+ // not actually using a metrics sink.
+ if _, ok := meter.(metrics.NopMeter); ok {
+ return parent, client, nil
+ }
+
hm, err := newHTTPMetrics(meter)
if err != nil {
return nil, nil, err
diff --git a/vendor/github.com/cenkalti/backoff/v5/exponential.go b/vendor/github.com/cenkalti/backoff/v5/exponential.go
index c1f3e442d36..79d425e8746 100644
--- a/vendor/github.com/cenkalti/backoff/v5/exponential.go
+++ b/vendor/github.com/cenkalti/backoff/v5/exponential.go
@@ -1,7 +1,7 @@
package backoff
import (
- "math/rand"
+ "math/rand/v2"
"time"
)
@@ -28,13 +28,7 @@ multiplied by the exponential, that is, between 2 and 6 seconds.
Note: MaxInterval caps the RetryInterval and not the randomized interval.
-If the time elapsed since an ExponentialBackOff instance is created goes past the
-MaxElapsedTime, then the method NextBackOff() starts returning backoff.Stop.
-
-The elapsed time can be reset by calling Reset().
-
-Example: Given the following default arguments, for 10 tries the sequence will be,
-and assuming we go over the MaxElapsedTime on the 10th try:
+Example: Given the following default arguments, for 9 tries the sequence will be:
Request # RetryInterval (seconds) Randomized Interval (seconds)
@@ -47,7 +41,6 @@ and assuming we go over the MaxElapsedTime on the 10th try:
7 5.692 [2.846, 8.538]
8 8.538 [4.269, 12.807]
9 12.807 [6.403, 19.210]
- 10 19.210 backoff.Stop
Note: Implementation is not thread-safe.
*/
diff --git a/vendor/github.com/cenkalti/backoff/v5/retry.go b/vendor/github.com/cenkalti/backoff/v5/retry.go
index e43f47fb8a5..32a7f988347 100644
--- a/vendor/github.com/cenkalti/backoff/v5/retry.go
+++ b/vendor/github.com/cenkalti/backoff/v5/retry.go
@@ -47,7 +47,7 @@ func WithNotify(n Notify) RetryOption {
}
}
-// WithMaxTries limits the number of retry attempts.
+// WithMaxTries limits the number of all attempts.
func WithMaxTries(n uint) RetryOption {
return func(args *retryOptions) {
args.MaxTries = n
@@ -97,7 +97,7 @@ func Retry[T any](ctx context.Context, operation Operation[T], opts ...RetryOpti
// Handle permanent errors without retrying.
var permanent *PermanentError
if errors.As(err, &permanent) {
- return res, err
+ return res, permanent.Unwrap()
}
// Stop retrying if context is cancelled.
diff --git a/vendor/github.com/coreos/go-semver/semver/semver.go b/vendor/github.com/coreos/go-semver/semver/semver.go
index 76cf4852c76..eb9fb7ff2d8 100644
--- a/vendor/github.com/coreos/go-semver/semver/semver.go
+++ b/vendor/github.com/coreos/go-semver/semver/semver.go
@@ -85,7 +85,7 @@ func (v *Version) Set(version string) error {
return fmt.Errorf("failed to validate metadata: %v", err)
}
- parsed := make([]int64, 3, 3)
+ parsed := make([]int64, 3)
for i, v := range dotParts[:3] {
val, err := strconv.ParseInt(v, 10, 64)
diff --git a/vendor/github.com/go-logfmt/logfmt/CHANGELOG.md b/vendor/github.com/go-logfmt/logfmt/CHANGELOG.md
index 8f349c4b8f5..9a7c0ca730e 100644
--- a/vendor/github.com/go-logfmt/logfmt/CHANGELOG.md
+++ b/vendor/github.com/go-logfmt/logfmt/CHANGELOG.md
@@ -5,6 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [0.6.1] - 2025-10-05
+
+### Fixed
+
+- Encode DEL (0x7f) control character by [@spaceone]
+- Modernize code through Go 1.21 by [@ChrisHines]
+
+[0.6.1]: https://github.com/go-logfmt/logfmt/compare/v0.6.0...v0.6.1
+
## [0.6.0] - 2023-01-30
[0.6.0]: https://github.com/go-logfmt/logfmt/compare/v0.5.1...v0.6.0
@@ -80,3 +89,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[@judwhite]: https://github.com/judwhite
[@nussjustin]: https://github.com/nussjustin
[@alexanderjophus]: https://github.com/alexanderjophus
+[@spaceone]: https://github.com/spaceone
diff --git a/vendor/github.com/go-logfmt/logfmt/encode.go b/vendor/github.com/go-logfmt/logfmt/encode.go
index 4ea9d23998c..d8f69351a72 100644
--- a/vendor/github.com/go-logfmt/logfmt/encode.go
+++ b/vendor/github.com/go-logfmt/logfmt/encode.go
@@ -13,7 +13,7 @@ import (
// MarshalKeyvals returns the logfmt encoding of keyvals, a variadic sequence
// of alternating keys and values.
-func MarshalKeyvals(keyvals ...interface{}) ([]byte, error) {
+func MarshalKeyvals(keyvals ...any) ([]byte, error) {
buf := &bytes.Buffer{}
if err := NewEncoder(buf).EncodeKeyvals(keyvals...); err != nil {
return nil, err
@@ -45,7 +45,7 @@ var (
// EncodeKeyval writes the logfmt encoding of key and value to the stream. A
// single space is written before the second and subsequent keys in a record.
// Nothing is written if a non-nil error is returned.
-func (enc *Encoder) EncodeKeyval(key, value interface{}) error {
+func (enc *Encoder) EncodeKeyval(key, value any) error {
enc.scratch.Reset()
if enc.needSep {
if _, err := enc.scratch.Write(space); err != nil {
@@ -72,7 +72,7 @@ func (enc *Encoder) EncodeKeyval(key, value interface{}) error {
// unsupported type or that cause a MarshalerError are replaced by their error
// but do not cause EncodeKeyvals to return an error. If a non-nil error is
// returned some key/value pairs may not have be written.
-func (enc *Encoder) EncodeKeyvals(keyvals ...interface{}) error {
+func (enc *Encoder) EncodeKeyvals(keyvals ...any) error {
if len(keyvals) == 0 {
return nil
}
@@ -122,7 +122,7 @@ var ErrUnsupportedKeyType = errors.New("unsupported key type")
// unsupported type.
var ErrUnsupportedValueType = errors.New("unsupported value type")
-func writeKey(w io.Writer, key interface{}) error {
+func writeKey(w io.Writer, key any) error {
if key == nil {
return ErrNilKey
}
@@ -155,7 +155,7 @@ func writeKey(w io.Writer, key interface{}) error {
switch rkey.Kind() {
case reflect.Array, reflect.Chan, reflect.Func, reflect.Map, reflect.Slice, reflect.Struct:
return ErrUnsupportedKeyType
- case reflect.Ptr:
+ case reflect.Pointer:
if rkey.IsNil() {
return ErrNilKey
}
@@ -170,7 +170,7 @@ func writeKey(w io.Writer, key interface{}) error {
// functions it causes them to remove invalid key runes from strings or byte
// slices respectively.
func keyRuneFilter(r rune) rune {
- if r <= ' ' || r == '=' || r == '"' || r == utf8.RuneError {
+ if r <= ' ' || r == '=' || r == '"' || r == 0x7f || r == utf8.RuneError {
return -1
}
return r
@@ -194,7 +194,7 @@ func writeBytesKey(w io.Writer, key []byte) error {
return err
}
-func writeValue(w io.Writer, value interface{}) error {
+func writeValue(w io.Writer, value any) error {
switch v := value.(type) {
case nil:
return writeBytesValue(w, null)
@@ -222,7 +222,7 @@ func writeValue(w io.Writer, value interface{}) error {
switch rvalue.Kind() {
case reflect.Array, reflect.Chan, reflect.Func, reflect.Map, reflect.Slice, reflect.Struct:
return ErrUnsupportedValueType
- case reflect.Ptr:
+ case reflect.Pointer:
if rvalue.IsNil() {
return writeBytesValue(w, null)
}
@@ -233,7 +233,7 @@ func writeValue(w io.Writer, value interface{}) error {
}
func needsQuotedValueRune(r rune) bool {
- return r <= ' ' || r == '=' || r == '"' || r == utf8.RuneError
+ return r <= ' ' || r == '=' || r == '"' || r == 0x7f || r == utf8.RuneError
}
func writeStringValue(w io.Writer, value string, ok bool) error {
@@ -276,7 +276,7 @@ func (enc *Encoder) Reset() {
func safeError(err error) (s string, ok bool) {
defer func() {
if panicVal := recover(); panicVal != nil {
- if v := reflect.ValueOf(err); v.Kind() == reflect.Ptr && v.IsNil() {
+ if v := reflect.ValueOf(err); v.Kind() == reflect.Pointer && v.IsNil() {
s, ok = "null", false
} else {
s, ok = fmt.Sprintf("PANIC:%v", panicVal), false
@@ -290,7 +290,7 @@ func safeError(err error) (s string, ok bool) {
func safeString(str fmt.Stringer) (s string, ok bool) {
defer func() {
if panicVal := recover(); panicVal != nil {
- if v := reflect.ValueOf(str); v.Kind() == reflect.Ptr && v.IsNil() {
+ if v := reflect.ValueOf(str); v.Kind() == reflect.Pointer && v.IsNil() {
s, ok = "null", false
} else {
s, ok = fmt.Sprintf("PANIC:%v", panicVal), true
@@ -304,7 +304,7 @@ func safeString(str fmt.Stringer) (s string, ok bool) {
func safeMarshal(tm encoding.TextMarshaler) (b []byte, err error) {
defer func() {
if panicVal := recover(); panicVal != nil {
- if v := reflect.ValueOf(tm); v.Kind() == reflect.Ptr && v.IsNil() {
+ if v := reflect.ValueOf(tm); v.Kind() == reflect.Pointer && v.IsNil() {
b, err = nil, nil
} else {
b, err = nil, fmt.Errorf("panic when marshalling: %s", panicVal)
diff --git a/vendor/github.com/go-logfmt/logfmt/jsonstring.go b/vendor/github.com/go-logfmt/logfmt/jsonstring.go
index 030ac85fcc2..26e1b1c137c 100644
--- a/vendor/github.com/go-logfmt/logfmt/jsonstring.go
+++ b/vendor/github.com/go-logfmt/logfmt/jsonstring.go
@@ -19,7 +19,7 @@ import (
var hex = "0123456789abcdef"
var bufferPool = sync.Pool{
- New: func() interface{} {
+ New: func() any {
return &bytes.Buffer{}
},
}
@@ -40,7 +40,7 @@ func writeQuotedString(w io.Writer, s string) (int, error) {
start := 0
for i := 0; i < len(s); {
if b := s[i]; b < utf8.RuneSelf {
- if 0x20 <= b && b != '\\' && b != '"' {
+ if 0x20 <= b && b != '\\' && b != '"' && b != 0x7f {
i++
continue
}
@@ -91,14 +91,14 @@ func writeQuotedString(w io.Writer, s string) (int, error) {
return n, err
}
-// NOTE: keep in sync with writeQuoteString above.
+// NOTE: keep in sync with writeQuotedString above.
func writeQuotedBytes(w io.Writer, s []byte) (int, error) {
buf := getBuffer()
buf.WriteByte('"')
start := 0
for i := 0; i < len(s); {
if b := s[i]; b < utf8.RuneSelf {
- if 0x20 <= b && b != '\\' && b != '"' {
+ if 0x20 <= b && b != '\\' && b != '"' && b != 0x7f {
i++
continue
}
diff --git a/vendor/github.com/go-openapi/errors/README.md b/vendor/github.com/go-openapi/errors/README.md
index 6d57ea55c7c..d7e3a18bcf5 100644
--- a/vendor/github.com/go-openapi/errors/README.md
+++ b/vendor/github.com/go-openapi/errors/README.md
@@ -6,3 +6,7 @@
[](https://goreportcard.com/report/github.com/go-openapi/errors)
Shared errors and error interface used throughout the various libraries found in the go-openapi toolkit.
+
+## Licensing
+
+This library ships under the [SPDX-License-Identifier: Apache-2.0](./LICENSE).
diff --git a/vendor/github.com/go-openapi/errors/api.go b/vendor/github.com/go-openapi/errors/api.go
index 52d45777280..d39233bafe4 100644
--- a/vendor/github.com/go-openapi/errors/api.go
+++ b/vendor/github.com/go-openapi/errors/api.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package errors
@@ -46,14 +35,14 @@ func (a *apiError) Code() int32 {
// MarshalJSON implements the JSON encoding interface
func (a apiError) MarshalJSON() ([]byte, error) {
- return json.Marshal(map[string]interface{}{
+ return json.Marshal(map[string]any{
"code": a.code,
"message": a.message,
})
}
// New creates a new API error with a code and a message
-func New(code int32, message string, args ...interface{}) Error {
+func New(code int32, message string, args ...any) Error {
if len(args) > 0 {
return &apiError{
code: code,
@@ -67,7 +56,7 @@ func New(code int32, message string, args ...interface{}) Error {
}
// NotFound creates a new not found error
-func NotFound(message string, args ...interface{}) Error {
+func NotFound(message string, args ...any) Error {
if message == "" {
message = "Not found"
}
@@ -97,7 +86,7 @@ func (m *MethodNotAllowedError) Code() int32 {
// MarshalJSON implements the JSON encoding interface
func (m MethodNotAllowedError) MarshalJSON() ([]byte, error) {
- return json.Marshal(map[string]interface{}{
+ return json.Marshal(map[string]any{
"code": m.code,
"message": m.message,
"allowed": m.Allowed,
diff --git a/vendor/github.com/go-openapi/errors/auth.go b/vendor/github.com/go-openapi/errors/auth.go
index 0545b501bd7..08de582e5db 100644
--- a/vendor/github.com/go-openapi/errors/auth.go
+++ b/vendor/github.com/go-openapi/errors/auth.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package errors
diff --git a/vendor/github.com/go-openapi/errors/doc.go b/vendor/github.com/go-openapi/errors/doc.go
index af01190ce61..b4627f30f4c 100644
--- a/vendor/github.com/go-openapi/errors/doc.go
+++ b/vendor/github.com/go-openapi/errors/doc.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
/*
Package errors provides an Error interface and several concrete types
diff --git a/vendor/github.com/go-openapi/errors/headers.go b/vendor/github.com/go-openapi/errors/headers.go
index 6ea1151f415..2d837c34ac4 100644
--- a/vendor/github.com/go-openapi/errors/headers.go
+++ b/vendor/github.com/go-openapi/errors/headers.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package errors
@@ -25,9 +14,9 @@ type Validation struct { //nolint: errname
code int32
Name string
In string
- Value interface{}
+ Value any
message string
- Values []interface{}
+ Values []any
}
func (e *Validation) Error() string {
@@ -41,7 +30,7 @@ func (e *Validation) Code() int32 {
// MarshalJSON implements the JSON encoding interface
func (e Validation) MarshalJSON() ([]byte, error) {
- return json.Marshal(map[string]interface{}{
+ return json.Marshal(map[string]any{
"code": e.code,
"message": e.message,
"in": e.In,
@@ -72,7 +61,7 @@ const (
// InvalidContentType error for an invalid content type
func InvalidContentType(value string, allowed []string) *Validation {
- values := make([]interface{}, 0, len(allowed))
+ values := make([]any, 0, len(allowed))
for _, v := range allowed {
values = append(values, v)
}
@@ -88,7 +77,7 @@ func InvalidContentType(value string, allowed []string) *Validation {
// InvalidResponseFormat error for an unacceptable response format request
func InvalidResponseFormat(value string, allowed []string) *Validation {
- values := make([]interface{}, 0, len(allowed))
+ values := make([]any, 0, len(allowed))
for _, v := range allowed {
values = append(values, v)
}
diff --git a/vendor/github.com/go-openapi/errors/middleware.go b/vendor/github.com/go-openapi/errors/middleware.go
index 1b9f3a93016..c434e59a6fa 100644
--- a/vendor/github.com/go-openapi/errors/middleware.go
+++ b/vendor/github.com/go-openapi/errors/middleware.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package errors
diff --git a/vendor/github.com/go-openapi/errors/parsing.go b/vendor/github.com/go-openapi/errors/parsing.go
index 34930c087a7..ea2a7c60377 100644
--- a/vendor/github.com/go-openapi/errors/parsing.go
+++ b/vendor/github.com/go-openapi/errors/parsing.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package errors
@@ -63,7 +52,7 @@ func (e ParseError) MarshalJSON() ([]byte, error) {
if e.Reason != nil {
reason = e.Reason.Error()
}
- return json.Marshal(map[string]interface{}{
+ return json.Marshal(map[string]any{
"code": e.code,
"message": e.message,
"in": e.In,
diff --git a/vendor/github.com/go-openapi/errors/schema.go b/vendor/github.com/go-openapi/errors/schema.go
index 8f3239dfd9b..e59ca4f863f 100644
--- a/vendor/github.com/go-openapi/errors/schema.go
+++ b/vendor/github.com/go-openapi/errors/schema.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package errors
@@ -130,7 +119,7 @@ func (c *CompositeError) Unwrap() []error {
// MarshalJSON implements the JSON encoding interface
func (c CompositeError) MarshalJSON() ([]byte, error) {
- return json.Marshal(map[string]interface{}{
+ return json.Marshal(map[string]any{
"code": c.code,
"message": c.message,
"errors": c.Errors,
@@ -254,7 +243,7 @@ func InvalidTypeName(typeName string) *Validation {
}
// InvalidType creates an error for when the type is invalid
-func InvalidType(name, in, typeName string, value interface{}) *Validation {
+func InvalidType(name, in, typeName string, value any) *Validation {
var message string
if in != "" {
@@ -302,7 +291,7 @@ func DuplicateItems(name, in string) *Validation {
}
// TooManyItems error for when an array contains too many items
-func TooManyItems(name, in string, maximum int64, value interface{}) *Validation {
+func TooManyItems(name, in string, maximum int64, value any) *Validation {
msg := fmt.Sprintf(maximumItemsFail, name, in, maximum)
if in == "" {
msg = fmt.Sprintf(maximumItemsFailNoIn, name, maximum)
@@ -318,7 +307,7 @@ func TooManyItems(name, in string, maximum int64, value interface{}) *Validation
}
// TooFewItems error for when an array contains too few items
-func TooFewItems(name, in string, minimum int64, value interface{}) *Validation {
+func TooFewItems(name, in string, minimum int64, value any) *Validation {
msg := fmt.Sprintf(minItemsFail, name, in, minimum)
if in == "" {
msg = fmt.Sprintf(minItemsFailNoIn, name, minimum)
@@ -333,7 +322,7 @@ func TooFewItems(name, in string, minimum int64, value interface{}) *Validation
}
// ExceedsMaximumInt error for when maximumimum validation fails
-func ExceedsMaximumInt(name, in string, maximum int64, exclusive bool, value interface{}) *Validation {
+func ExceedsMaximumInt(name, in string, maximum int64, exclusive bool, value any) *Validation {
var message string
if in == "" {
m := maximumIncFailNoIn
@@ -358,7 +347,7 @@ func ExceedsMaximumInt(name, in string, maximum int64, exclusive bool, value int
}
// ExceedsMaximumUint error for when maximumimum validation fails
-func ExceedsMaximumUint(name, in string, maximum uint64, exclusive bool, value interface{}) *Validation {
+func ExceedsMaximumUint(name, in string, maximum uint64, exclusive bool, value any) *Validation {
var message string
if in == "" {
m := maximumIncFailNoIn
@@ -383,7 +372,7 @@ func ExceedsMaximumUint(name, in string, maximum uint64, exclusive bool, value i
}
// ExceedsMaximum error for when maximumimum validation fails
-func ExceedsMaximum(name, in string, maximum float64, exclusive bool, value interface{}) *Validation {
+func ExceedsMaximum(name, in string, maximum float64, exclusive bool, value any) *Validation {
var message string
if in == "" {
m := maximumIncFailNoIn
@@ -408,7 +397,7 @@ func ExceedsMaximum(name, in string, maximum float64, exclusive bool, value inte
}
// ExceedsMinimumInt error for when minimum validation fails
-func ExceedsMinimumInt(name, in string, minimum int64, exclusive bool, value interface{}) *Validation {
+func ExceedsMinimumInt(name, in string, minimum int64, exclusive bool, value any) *Validation {
var message string
if in == "" {
m := minIncFailNoIn
@@ -433,7 +422,7 @@ func ExceedsMinimumInt(name, in string, minimum int64, exclusive bool, value int
}
// ExceedsMinimumUint error for when minimum validation fails
-func ExceedsMinimumUint(name, in string, minimum uint64, exclusive bool, value interface{}) *Validation {
+func ExceedsMinimumUint(name, in string, minimum uint64, exclusive bool, value any) *Validation {
var message string
if in == "" {
m := minIncFailNoIn
@@ -458,7 +447,7 @@ func ExceedsMinimumUint(name, in string, minimum uint64, exclusive bool, value i
}
// ExceedsMinimum error for when minimum validation fails
-func ExceedsMinimum(name, in string, minimum float64, exclusive bool, value interface{}) *Validation {
+func ExceedsMinimum(name, in string, minimum float64, exclusive bool, value any) *Validation {
var message string
if in == "" {
m := minIncFailNoIn
@@ -483,7 +472,7 @@ func ExceedsMinimum(name, in string, minimum float64, exclusive bool, value inte
}
// NotMultipleOf error for when multiple of validation fails
-func NotMultipleOf(name, in string, multiple, value interface{}) *Validation {
+func NotMultipleOf(name, in string, multiple, value any) *Validation {
var msg string
if in == "" {
msg = fmt.Sprintf(multipleOfFailNoIn, name, multiple)
@@ -500,7 +489,7 @@ func NotMultipleOf(name, in string, multiple, value interface{}) *Validation {
}
// EnumFail error for when an enum validation fails
-func EnumFail(name, in string, value interface{}, values []interface{}) *Validation {
+func EnumFail(name, in string, value any, values []any) *Validation {
var msg string
if in == "" {
msg = fmt.Sprintf(enumFailNoIn, name, values)
@@ -519,7 +508,7 @@ func EnumFail(name, in string, value interface{}, values []interface{}) *Validat
}
// Required error for when a value is missing
-func Required(name, in string, value interface{}) *Validation {
+func Required(name, in string, value any) *Validation {
var msg string
if in == "" {
msg = fmt.Sprintf(requiredFailNoIn, name)
@@ -536,7 +525,7 @@ func Required(name, in string, value interface{}) *Validation {
}
// ReadOnly error for when a value is present in request
-func ReadOnly(name, in string, value interface{}) *Validation {
+func ReadOnly(name, in string, value any) *Validation {
var msg string
if in == "" {
msg = fmt.Sprintf(readOnlyFailNoIn, name)
@@ -553,7 +542,7 @@ func ReadOnly(name, in string, value interface{}) *Validation {
}
// TooLong error for when a string is too long
-func TooLong(name, in string, maximum int64, value interface{}) *Validation {
+func TooLong(name, in string, maximum int64, value any) *Validation {
var msg string
if in == "" {
msg = fmt.Sprintf(tooLongMessageNoIn, name, maximum)
@@ -570,7 +559,7 @@ func TooLong(name, in string, maximum int64, value interface{}) *Validation {
}
// TooShort error for when a string is too short
-func TooShort(name, in string, minimum int64, value interface{}) *Validation {
+func TooShort(name, in string, minimum int64, value any) *Validation {
var msg string
if in == "" {
msg = fmt.Sprintf(tooShortMessageNoIn, name, minimum)
@@ -589,7 +578,7 @@ func TooShort(name, in string, minimum int64, value interface{}) *Validation {
// FailedPattern error for when a string fails a regex pattern match
// the pattern that is returned is the ECMA syntax version of the pattern not the golang version.
-func FailedPattern(name, in, pattern string, value interface{}) *Validation {
+func FailedPattern(name, in, pattern string, value any) *Validation {
var msg string
if in == "" {
msg = fmt.Sprintf(patternFailNoIn, name, pattern)
@@ -608,7 +597,7 @@ func FailedPattern(name, in, pattern string, value interface{}) *Validation {
// MultipleOfMustBePositive error for when a
// multipleOf factor is negative
-func MultipleOfMustBePositive(name, in string, factor interface{}) *Validation {
+func MultipleOfMustBePositive(name, in string, factor any) *Validation {
return &Validation{
code: MultipleOfMustBePositiveCode,
Name: name,
diff --git a/vendor/github.com/go-openapi/strfmt/.golangci.yml b/vendor/github.com/go-openapi/strfmt/.golangci.yml
index 7cea1af8b52..1ad5adf47e6 100644
--- a/vendor/github.com/go-openapi/strfmt/.golangci.yml
+++ b/vendor/github.com/go-openapi/strfmt/.golangci.yml
@@ -16,7 +16,7 @@ linters:
- godox
- gosmopolitan
- inamedparam
- #- intrange # disabled while < go1.22
+ - intrange
- ireturn
- lll
- musttag
diff --git a/vendor/github.com/go-openapi/strfmt/README.md b/vendor/github.com/go-openapi/strfmt/README.md
index f6b39c6c56c..de5afe13760 100644
--- a/vendor/github.com/go-openapi/strfmt/README.md
+++ b/vendor/github.com/go-openapi/strfmt/README.md
@@ -35,7 +35,7 @@ It also provides convenient extensions to go-openapi users.
- mac (e.g "01:02:03:04:05:06")
- rgbcolor (e.g. "rgb(100,100,100)")
- ssn
- - uuid, uuid3, uuid4, uuid5
+ - uuid, uuid3, uuid4, uuid5, uuid7
- cidr (e.g. "192.0.2.1/24", "2001:db8:a0b:12f0::1/32")
- ulid (e.g. "00000PP9HGSBSSDZ1JTEXBJ0PW", [spec](https://github.com/ulid/spec))
@@ -81,7 +81,12 @@ List of defined types:
- SSN
- URI
- UUID
-- UUID3
-- UUID4
-- UUID5
+- [UUID3](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-3)
+- [UUID4](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-4)
+- [UUID5](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-5)
+- [UUID7](https://www.rfc-editor.org/rfc/rfc9562.html#name-uuid-version-7)
- [ULID](https://github.com/ulid/spec)
+
+## Licensing
+
+This library ships under the [SPDX-License-Identifier: Apache-2.0](./LICENSE).
diff --git a/vendor/github.com/go-openapi/strfmt/bson.go b/vendor/github.com/go-openapi/strfmt/bson.go
index 78d6e073587..0eec8f6432c 100644
--- a/vendor/github.com/go-openapi/strfmt/bson.go
+++ b/vendor/github.com/go-openapi/strfmt/bson.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package strfmt
@@ -18,9 +7,6 @@ import (
"database/sql/driver"
"fmt"
- "go.mongodb.org/mongo-driver/bson"
-
- "go.mongodb.org/mongo-driver/bson/bsontype"
bsonprim "go.mongodb.org/mongo-driver/bson/primitive"
)
@@ -75,7 +61,7 @@ func (id *ObjectId) UnmarshalText(data []byte) error { // validation is performe
}
// Scan read a value from a database driver
-func (id *ObjectId) Scan(raw interface{}) error {
+func (id *ObjectId) Scan(raw any) error {
var data []byte
switch v := raw.(type) {
case []byte:
@@ -113,42 +99,6 @@ func (id *ObjectId) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON renders the object id as a BSON document
-func (id ObjectId) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": bsonprim.ObjectID(id)})
-}
-
-// UnmarshalBSON reads the objectId from a BSON document
-func (id *ObjectId) UnmarshalBSON(data []byte) error {
- var obj struct {
- Data bsonprim.ObjectID
- }
- if err := bson.Unmarshal(data, &obj); err != nil {
- return err
- }
- *id = ObjectId(obj.Data)
- return nil
-}
-
-// MarshalBSONValue is an interface implemented by types that can marshal themselves
-// into a BSON document represented as bytes. The bytes returned must be a valid
-// BSON document if the error is nil.
-func (id ObjectId) MarshalBSONValue() (bsontype.Type, []byte, error) {
- oid := bsonprim.ObjectID(id)
- return bson.TypeObjectID, oid[:], nil
-}
-
-// UnmarshalBSONValue is an interface implemented by types that can unmarshal a
-// BSON value representation of themselves. The BSON bytes and type can be
-// assumed to be valid. UnmarshalBSONValue must copy the BSON value bytes if it
-// wishes to retain the data after returning.
-func (id *ObjectId) UnmarshalBSONValue(_ bsontype.Type, data []byte) error {
- var oid bsonprim.ObjectID
- copy(oid[:], data)
- *id = ObjectId(oid)
- return nil
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (id *ObjectId) DeepCopyInto(out *ObjectId) {
*out = *id
diff --git a/vendor/github.com/go-openapi/strfmt/date.go b/vendor/github.com/go-openapi/strfmt/date.go
index a8f52ff354d..8aa17b8ea55 100644
--- a/vendor/github.com/go-openapi/strfmt/date.go
+++ b/vendor/github.com/go-openapi/strfmt/date.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package strfmt
@@ -19,8 +8,6 @@ import (
"encoding/json"
"fmt"
"time"
-
- "go.mongodb.org/mongo-driver/bson"
)
func init() {
@@ -70,7 +57,7 @@ func (d Date) MarshalText() ([]byte, error) {
}
// Scan scans a Date value from database driver type.
-func (d *Date) Scan(raw interface{}) error {
+func (d *Date) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
return d.UnmarshalText(v)
@@ -114,28 +101,6 @@ func (d *Date) UnmarshalJSON(data []byte) error {
return nil
}
-func (d Date) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": d.String()})
-}
-
-func (d *Date) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if data, ok := m["data"].(string); ok {
- rd, err := time.ParseInLocation(RFC3339FullDate, data, DefaultTimeLocation)
- if err != nil {
- return err
- }
- *d = Date(rd)
- return nil
- }
-
- return fmt.Errorf("couldn't unmarshal bson bytes value as Date: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (d *Date) DeepCopyInto(out *Date) {
*out = *d
diff --git a/vendor/github.com/go-openapi/strfmt/default.go b/vendor/github.com/go-openapi/strfmt/default.go
index 02e11122937..8a80cfbdb8a 100644
--- a/vendor/github.com/go-openapi/strfmt/default.go
+++ b/vendor/github.com/go-openapi/strfmt/default.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package strfmt
@@ -19,14 +8,15 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
+ "net"
"net/mail"
"net/netip"
+ "net/url"
+ "regexp"
"strconv"
"strings"
- "github.com/asaskevich/govalidator"
"github.com/google/uuid"
- "go.mongodb.org/mongo-driver/bson"
"golang.org/x/net/idna"
)
@@ -60,10 +50,33 @@ const (
//
// Deprecated: strfmt no longer uses regular expressions to validate UUIDs.
UUID5Pattern = `(?i)(^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$)|(^[0-9a-f]{12}5[0-9a-f]{3}[89ab][0-9a-f]{15}$)`
+
+ isbn10Pattern string = "^(?:[0-9]{9}X|[0-9]{10})$"
+ isbn13Pattern string = "^(?:[0-9]{13})$"
+ usCardPattern string = "^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11}|6[27][0-9]{14})$"
+ ssnPattern string = `^\d{3}[- ]?\d{2}[- ]?\d{4}$`
+ hexColorPattern string = "^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$"
+ rgbColorPattern string = "^rgb\\(\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*,\\s*(0|[1-9]\\d?|1\\d\\d?|2[0-4]\\d|25[0-5])\\s*\\)$"
+)
+
+const (
+ isbnVersion10 = 10
+ isbnVersion13 = 13
+ decimalBase = 10
)
-var idnaHostChecker = idna.New(
- idna.ValidateForRegistration(), // shorthand for [idna.StrictDomainName], [idna.ValidateLabels], [idna.VerifyDNSLength], [idna.BidiRule]
+var (
+ idnaHostChecker = idna.New(
+ idna.ValidateForRegistration(), // shorthand for [idna.StrictDomainName], [idna.ValidateLabels], [idna.VerifyDNSLength], [idna.BidiRule]
+ )
+
+ whiteSpacesAndMinus = regexp.MustCompile(`[\s-]+`)
+ rxISBN10 = regexp.MustCompile(isbn10Pattern)
+ rxISBN13 = regexp.MustCompile(isbn13Pattern)
+ rxCreditCard = regexp.MustCompile(usCardPattern)
+ rxSSN = regexp.MustCompile(ssnPattern)
+ rxHexcolor = regexp.MustCompile(hexColorPattern)
+ rxRGBcolor = regexp.MustCompile(rgbColorPattern)
)
// IsHostname returns true when the string is a valid hostname.
@@ -322,6 +335,7 @@ const (
uuidV3 = 3
uuidV4 = 4
uuidV5 = 5
+ uuidV7 = 7
)
// IsUUID3 returns true is the string matches a UUID v3, upper case is allowed
@@ -342,6 +356,12 @@ func IsUUID5(str string) bool {
return err == nil && id.Version() == uuid.Version(uuidV5)
}
+// IsUUID7 returns true is the string matches a UUID v7, upper case is allowed
+func IsUUID7(str string) bool {
+ id, err := uuid.Parse(str)
+ return err == nil && id.Version() == uuid.Version(uuidV7)
+}
+
// IsEmail validates an email address.
func IsEmail(str string) bool {
addr, e := mail.ParseAddress(str)
@@ -370,8 +390,9 @@ func init() {
// - uuid3
// - uuid4
// - uuid5
+ // - uuid7
u := URI("")
- Default.Add("uri", &u, govalidator.IsRequestURI)
+ Default.Add("uri", &u, isRequestURI)
eml := Email("")
Default.Add("email", &eml, IsEmail)
@@ -380,16 +401,16 @@ func init() {
Default.Add("hostname", &hn, IsHostname)
ip4 := IPv4("")
- Default.Add("ipv4", &ip4, govalidator.IsIPv4)
+ Default.Add("ipv4", &ip4, isIPv4)
ip6 := IPv6("")
- Default.Add("ipv6", &ip6, govalidator.IsIPv6)
+ Default.Add("ipv6", &ip6, isIPv6)
cidr := CIDR("")
- Default.Add("cidr", &cidr, govalidator.IsCIDR)
+ Default.Add("cidr", &cidr, isCIDR)
mac := MAC("")
- Default.Add("mac", &mac, govalidator.IsMAC)
+ Default.Add("mac", &mac, isMAC)
uid := UUID("")
Default.Add("uuid", &uid, IsUUID)
@@ -403,29 +424,32 @@ func init() {
uid5 := UUID5("")
Default.Add("uuid5", &uid5, IsUUID5)
+ uid7 := UUID7("")
+ Default.Add("uuid7", &uid7, IsUUID7)
+
isbn := ISBN("")
- Default.Add("isbn", &isbn, func(str string) bool { return govalidator.IsISBN10(str) || govalidator.IsISBN13(str) })
+ Default.Add("isbn", &isbn, func(str string) bool { return isISBN10(str) || isISBN13(str) })
isbn10 := ISBN10("")
- Default.Add("isbn10", &isbn10, govalidator.IsISBN10)
+ Default.Add("isbn10", &isbn10, isISBN10)
isbn13 := ISBN13("")
- Default.Add("isbn13", &isbn13, govalidator.IsISBN13)
+ Default.Add("isbn13", &isbn13, isISBN13)
cc := CreditCard("")
- Default.Add("creditcard", &cc, govalidator.IsCreditCard)
+ Default.Add("creditcard", &cc, isCreditCard)
ssn := SSN("")
- Default.Add("ssn", &ssn, govalidator.IsSSN)
+ Default.Add("ssn", &ssn, isSSN)
hc := HexColor("")
- Default.Add("hexcolor", &hc, govalidator.IsHexcolor)
+ Default.Add("hexcolor", &hc, isHexcolor)
rc := RGBColor("")
- Default.Add("rgbcolor", &rc, govalidator.IsRGBcolor)
+ Default.Add("rgbcolor", &rc, isRGBcolor)
b64 := Base64([]byte(nil))
- Default.Add("byte", &b64, govalidator.IsBase64)
+ Default.Add("byte", &b64, isBase64)
pw := Password("")
Default.Add("password", &pw, func(_ string) bool { return true })
@@ -460,7 +484,7 @@ func (b *Base64) UnmarshalText(data []byte) error { // validation is performed l
}
// Scan read a value from a database driver
-func (b *Base64) Scan(raw interface{}) error {
+func (b *Base64) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
dbuf := make([]byte, base64.StdEncoding.DecodedLen(len(v)))
@@ -510,29 +534,6 @@ func (b *Base64) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (b Base64) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": b.String()})
-}
-
-// UnmarshalBSON document into this value
-func (b *Base64) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if bd, ok := m["data"].(string); ok {
- vb, err := base64.StdEncoding.DecodeString(bd)
- if err != nil {
- return err
- }
- *b = Base64(vb)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as base64: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (b *Base64) DeepCopyInto(out *Base64) {
*out = *b
@@ -565,7 +566,7 @@ func (u *URI) UnmarshalText(data []byte) error { // validation is performed late
}
// Scan read a value from a database driver
-func (u *URI) Scan(raw interface{}) error {
+func (u *URI) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*u = URI(string(v))
@@ -602,25 +603,6 @@ func (u *URI) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u URI) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
-}
-
-// UnmarshalBSON document into this value
-func (u *URI) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *u = URI(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as uri: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (u *URI) DeepCopyInto(out *URI) {
*out = *u
@@ -653,7 +635,7 @@ func (e *Email) UnmarshalText(data []byte) error { // validation is performed la
}
// Scan read a value from a database driver
-func (e *Email) Scan(raw interface{}) error {
+func (e *Email) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*e = Email(string(v))
@@ -690,25 +672,6 @@ func (e *Email) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (e Email) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": e.String()})
-}
-
-// UnmarshalBSON document into this value
-func (e *Email) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *e = Email(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as email: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (e *Email) DeepCopyInto(out *Email) {
*out = *e
@@ -741,7 +704,7 @@ func (h *Hostname) UnmarshalText(data []byte) error { // validation is performed
}
// Scan read a value from a database driver
-func (h *Hostname) Scan(raw interface{}) error {
+func (h *Hostname) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*h = Hostname(string(v))
@@ -778,25 +741,6 @@ func (h *Hostname) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (h Hostname) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": h.String()})
-}
-
-// UnmarshalBSON document into this value
-func (h *Hostname) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *h = Hostname(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as hostname: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (h *Hostname) DeepCopyInto(out *Hostname) {
*out = *h
@@ -829,7 +773,7 @@ func (u *IPv4) UnmarshalText(data []byte) error { // validation is performed lat
}
// Scan read a value from a database driver
-func (u *IPv4) Scan(raw interface{}) error {
+func (u *IPv4) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*u = IPv4(string(v))
@@ -866,25 +810,6 @@ func (u *IPv4) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u IPv4) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
-}
-
-// UnmarshalBSON document into this value
-func (u *IPv4) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *u = IPv4(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as ipv4: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (u *IPv4) DeepCopyInto(out *IPv4) {
*out = *u
@@ -917,7 +842,7 @@ func (u *IPv6) UnmarshalText(data []byte) error { // validation is performed lat
}
// Scan read a value from a database driver
-func (u *IPv6) Scan(raw interface{}) error {
+func (u *IPv6) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*u = IPv6(string(v))
@@ -954,25 +879,6 @@ func (u *IPv6) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u IPv6) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
-}
-
-// UnmarshalBSON document into this value
-func (u *IPv6) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *u = IPv6(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as ipv6: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (u *IPv6) DeepCopyInto(out *IPv6) {
*out = *u
@@ -1005,7 +911,7 @@ func (u *CIDR) UnmarshalText(data []byte) error { // validation is performed lat
}
// Scan read a value from a database driver
-func (u *CIDR) Scan(raw interface{}) error {
+func (u *CIDR) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*u = CIDR(string(v))
@@ -1042,25 +948,6 @@ func (u *CIDR) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u CIDR) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
-}
-
-// UnmarshalBSON document into this value
-func (u *CIDR) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *u = CIDR(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as CIDR: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (u *CIDR) DeepCopyInto(out *CIDR) {
*out = *u
@@ -1093,7 +980,7 @@ func (u *MAC) UnmarshalText(data []byte) error { // validation is performed late
}
// Scan read a value from a database driver
-func (u *MAC) Scan(raw interface{}) error {
+func (u *MAC) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*u = MAC(string(v))
@@ -1130,25 +1017,6 @@ func (u *MAC) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u MAC) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
-}
-
-// UnmarshalBSON document into this value
-func (u *MAC) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *u = MAC(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as MAC: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (u *MAC) DeepCopyInto(out *MAC) {
*out = *u
@@ -1181,7 +1049,7 @@ func (u *UUID) UnmarshalText(data []byte) error { // validation is performed lat
}
// Scan read a value from a database driver
-func (u *UUID) Scan(raw interface{}) error {
+func (u *UUID) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*u = UUID(string(v))
@@ -1221,25 +1089,6 @@ func (u *UUID) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u UUID) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
-}
-
-// UnmarshalBSON document into this value
-func (u *UUID) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *u = UUID(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as UUID: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (u *UUID) DeepCopyInto(out *UUID) {
*out = *u
@@ -1272,7 +1121,7 @@ func (u *UUID3) UnmarshalText(data []byte) error { // validation is performed la
}
// Scan read a value from a database driver
-func (u *UUID3) Scan(raw interface{}) error {
+func (u *UUID3) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*u = UUID3(string(v))
@@ -1312,25 +1161,6 @@ func (u *UUID3) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u UUID3) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
-}
-
-// UnmarshalBSON document into this value
-func (u *UUID3) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *u = UUID3(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as UUID3: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (u *UUID3) DeepCopyInto(out *UUID3) {
*out = *u
@@ -1363,7 +1193,7 @@ func (u *UUID4) UnmarshalText(data []byte) error { // validation is performed la
}
// Scan read a value from a database driver
-func (u *UUID4) Scan(raw interface{}) error {
+func (u *UUID4) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*u = UUID4(string(v))
@@ -1403,25 +1233,6 @@ func (u *UUID4) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u UUID4) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
-}
-
-// UnmarshalBSON document into this value
-func (u *UUID4) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *u = UUID4(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as UUID4: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (u *UUID4) DeepCopyInto(out *UUID4) {
*out = *u
@@ -1454,7 +1265,7 @@ func (u *UUID5) UnmarshalText(data []byte) error { // validation is performed la
}
// Scan read a value from a database driver
-func (u *UUID5) Scan(raw interface{}) error {
+func (u *UUID5) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*u = UUID5(string(v))
@@ -1494,36 +1305,89 @@ func (u *UUID5) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u UUID5) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
+// DeepCopyInto copies the receiver and writes its value into out.
+func (u *UUID5) DeepCopyInto(out *UUID5) {
+ *out = *u
}
-// UnmarshalBSON document into this value
-func (u *UUID5) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
+// DeepCopy copies the receiver into a new UUID5.
+func (u *UUID5) DeepCopy() *UUID5 {
+ if u == nil {
+ return nil
}
+ out := new(UUID5)
+ u.DeepCopyInto(out)
+ return out
+}
- if ud, ok := m["data"].(string); ok {
- *u = UUID5(ud)
+// UUID7 represents a uuid7 string format
+//
+// swagger:strfmt uuid7
+type UUID7 string
+
+// MarshalText turns this instance into text
+func (u UUID7) MarshalText() ([]byte, error) {
+ return []byte(string(u)), nil
+}
+
+// UnmarshalText hydrates this instance from text
+func (u *UUID7) UnmarshalText(data []byte) error { // validation is performed later on
+ *u = UUID7(string(data))
+ return nil
+}
+
+// Scan read a value from a database driver
+func (u *UUID7) Scan(raw any) error {
+ switch v := raw.(type) {
+ case []byte:
+ *u = UUID7(string(v))
+ case string:
+ *u = UUID7(v)
+ default:
+ return fmt.Errorf("cannot sql.Scan() strfmt.UUID7 from: %#v: %w", v, ErrFormat)
+ }
+
+ return nil
+}
+
+// Value converts a value to a database driver value
+func (u UUID7) Value() (driver.Value, error) {
+ return driver.Value(string(u)), nil
+}
+
+func (u UUID7) String() string {
+ return string(u)
+}
+
+// MarshalJSON returns the UUID as JSON
+func (u UUID7) MarshalJSON() ([]byte, error) {
+ return json.Marshal(string(u))
+}
+
+// UnmarshalJSON sets the UUID from JSON
+func (u *UUID7) UnmarshalJSON(data []byte) error {
+ if string(data) == jsonNull {
return nil
}
- return fmt.Errorf("couldn't unmarshal bson bytes as UUID5: %w", ErrFormat)
+ var ustr string
+ if err := json.Unmarshal(data, &ustr); err != nil {
+ return err
+ }
+ *u = UUID7(ustr)
+ return nil
}
// DeepCopyInto copies the receiver and writes its value into out.
-func (u *UUID5) DeepCopyInto(out *UUID5) {
+func (u *UUID7) DeepCopyInto(out *UUID7) {
*out = *u
}
-// DeepCopy copies the receiver into a new UUID5.
-func (u *UUID5) DeepCopy() *UUID5 {
+// DeepCopy copies the receiver into a new UUID7.
+func (u *UUID7) DeepCopy() *UUID7 {
if u == nil {
return nil
}
- out := new(UUID5)
+ out := new(UUID7)
u.DeepCopyInto(out)
return out
}
@@ -1545,7 +1409,7 @@ func (u *ISBN) UnmarshalText(data []byte) error { // validation is performed lat
}
// Scan read a value from a database driver
-func (u *ISBN) Scan(raw interface{}) error {
+func (u *ISBN) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*u = ISBN(string(v))
@@ -1585,25 +1449,6 @@ func (u *ISBN) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u ISBN) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
-}
-
-// UnmarshalBSON document into this value
-func (u *ISBN) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *u = ISBN(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as ISBN: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (u *ISBN) DeepCopyInto(out *ISBN) {
*out = *u
@@ -1636,7 +1481,7 @@ func (u *ISBN10) UnmarshalText(data []byte) error { // validation is performed l
}
// Scan read a value from a database driver
-func (u *ISBN10) Scan(raw interface{}) error {
+func (u *ISBN10) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*u = ISBN10(string(v))
@@ -1676,25 +1521,6 @@ func (u *ISBN10) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u ISBN10) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
-}
-
-// UnmarshalBSON document into this value
-func (u *ISBN10) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *u = ISBN10(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as ISBN10: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (u *ISBN10) DeepCopyInto(out *ISBN10) {
*out = *u
@@ -1727,7 +1553,7 @@ func (u *ISBN13) UnmarshalText(data []byte) error { // validation is performed l
}
// Scan read a value from a database driver
-func (u *ISBN13) Scan(raw interface{}) error {
+func (u *ISBN13) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*u = ISBN13(string(v))
@@ -1767,25 +1593,6 @@ func (u *ISBN13) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u ISBN13) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
-}
-
-// UnmarshalBSON document into this value
-func (u *ISBN13) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *u = ISBN13(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as ISBN13: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (u *ISBN13) DeepCopyInto(out *ISBN13) {
*out = *u
@@ -1818,7 +1625,7 @@ func (u *CreditCard) UnmarshalText(data []byte) error { // validation is perform
}
// Scan read a value from a database driver
-func (u *CreditCard) Scan(raw interface{}) error {
+func (u *CreditCard) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*u = CreditCard(string(v))
@@ -1858,25 +1665,6 @@ func (u *CreditCard) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u CreditCard) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
-}
-
-// UnmarshalBSON document into this value
-func (u *CreditCard) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *u = CreditCard(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as CreditCard: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (u *CreditCard) DeepCopyInto(out *CreditCard) {
*out = *u
@@ -1909,7 +1697,7 @@ func (u *SSN) UnmarshalText(data []byte) error { // validation is performed late
}
// Scan read a value from a database driver
-func (u *SSN) Scan(raw interface{}) error {
+func (u *SSN) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*u = SSN(string(v))
@@ -1949,25 +1737,6 @@ func (u *SSN) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u SSN) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
-}
-
-// UnmarshalBSON document into this value
-func (u *SSN) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *u = SSN(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as SSN: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (u *SSN) DeepCopyInto(out *SSN) {
*out = *u
@@ -2000,7 +1769,7 @@ func (h *HexColor) UnmarshalText(data []byte) error { // validation is performed
}
// Scan read a value from a database driver
-func (h *HexColor) Scan(raw interface{}) error {
+func (h *HexColor) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*h = HexColor(string(v))
@@ -2040,25 +1809,6 @@ func (h *HexColor) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (h HexColor) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": h.String()})
-}
-
-// UnmarshalBSON document into this value
-func (h *HexColor) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *h = HexColor(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as HexColor: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (h *HexColor) DeepCopyInto(out *HexColor) {
*out = *h
@@ -2091,7 +1841,7 @@ func (r *RGBColor) UnmarshalText(data []byte) error { // validation is performed
}
// Scan read a value from a database driver
-func (r *RGBColor) Scan(raw interface{}) error {
+func (r *RGBColor) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*r = RGBColor(string(v))
@@ -2131,25 +1881,6 @@ func (r *RGBColor) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (r RGBColor) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": r.String()})
-}
-
-// UnmarshalBSON document into this value
-func (r *RGBColor) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *r = RGBColor(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as RGBColor: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (r *RGBColor) DeepCopyInto(out *RGBColor) {
*out = *r
@@ -2183,7 +1914,7 @@ func (r *Password) UnmarshalText(data []byte) error { // validation is performed
}
// Scan read a value from a database driver
-func (r *Password) Scan(raw interface{}) error {
+func (r *Password) Scan(raw any) error {
switch v := raw.(type) {
case []byte:
*r = Password(string(v))
@@ -2223,25 +1954,6 @@ func (r *Password) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (r Password) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": r.String()})
-}
-
-// UnmarshalBSON document into this value
-func (r *Password) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- *r = Password(ud)
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as Password: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (r *Password) DeepCopyInto(out *Password) {
*out = *r
@@ -2256,3 +1968,143 @@ func (r *Password) DeepCopy() *Password {
r.DeepCopyInto(out)
return out
}
+
+func isRequestURI(rawurl string) bool {
+ _, err := url.ParseRequestURI(rawurl)
+ return err == nil
+}
+
+// isIPv4 checks if the string is an IP version 4.
+func isIPv4(str string) bool {
+ ip := net.ParseIP(str)
+ return ip != nil && strings.Contains(str, ".")
+}
+
+// isIPv6 checks if the string is an IP version 6.
+func isIPv6(str string) bool {
+ ip := net.ParseIP(str)
+ return ip != nil && strings.Contains(str, ":")
+}
+
+// isCIDR checks if the string is an valid CIDR notiation (IPV4 & IPV6)
+func isCIDR(str string) bool {
+ _, _, err := net.ParseCIDR(str)
+ return err == nil
+}
+
+// isMAC checks if a string is valid MAC address.
+// Possible MAC formats:
+// 01:23:45:67:89:ab
+// 01:23:45:67:89:ab:cd:ef
+// 01-23-45-67-89-ab
+// 01-23-45-67-89-ab-cd-ef
+// 0123.4567.89ab
+// 0123.4567.89ab.cdef
+func isMAC(str string) bool {
+ _, err := net.ParseMAC(str)
+ return err == nil
+}
+
+// isISBN checks if the string is an ISBN (version 10 or 13).
+// If version value is not equal to 10 or 13, it will be checks both variants.
+func isISBN(str string, version int) bool {
+ sanitized := whiteSpacesAndMinus.ReplaceAllString(str, "")
+ var checksum int32
+ var i int32
+
+ switch version {
+ case isbnVersion10:
+ if !rxISBN10.MatchString(sanitized) {
+ return false
+ }
+ for i = range isbnVersion10 - 1 {
+ checksum += (i + 1) * int32(sanitized[i]-'0')
+ }
+ if sanitized[isbnVersion10-1] == 'X' {
+ checksum += isbnVersion10 * isbnVersion10
+ } else {
+ checksum += isbnVersion10 * int32(sanitized[isbnVersion10-1]-'0')
+ }
+ if checksum%(isbnVersion10+1) == 0 {
+ return true
+ }
+ return false
+ case isbnVersion13:
+ if !rxISBN13.MatchString(sanitized) {
+ return false
+ }
+ factor := []int32{1, 3}
+ for i = range isbnVersion13 - 1 {
+ checksum += factor[i%2] * int32(sanitized[i]-'0')
+ }
+ return (int32(sanitized[isbnVersion13-1]-'0'))-((decimalBase-(checksum%decimalBase))%decimalBase) == 0
+ default:
+ return isISBN(str, isbnVersion10) || isISBN(str, isbnVersion13)
+ }
+}
+
+// isISBN10 checks if the string is an ISBN version 10.
+func isISBN10(str string) bool {
+ return isISBN(str, isbnVersion10)
+}
+
+// isISBN13 checks if the string is an ISBN version 13.
+func isISBN13(str string) bool {
+ return isISBN(str, isbnVersion13)
+}
+
+// isCreditCard checks if the string is a credit card.
+func isCreditCard(str string) bool {
+ sanitized := whiteSpacesAndMinus.ReplaceAllString(str, "")
+ if !rxCreditCard.MatchString(sanitized) {
+ return false
+ }
+
+ number, err := strconv.ParseInt(sanitized, 0, 64)
+ if err != nil {
+ return false
+ }
+ number, lastDigit := number/decimalBase, number%decimalBase
+
+ var sum int64
+ for i := 0; number > 0; i++ {
+ digit := number % decimalBase
+
+ if i%2 == 0 {
+ digit *= 2
+ if digit > decimalBase-1 {
+ digit -= decimalBase - 1
+ }
+ }
+
+ sum += digit
+ number /= decimalBase
+ }
+
+ return (sum+lastDigit)%decimalBase == 0
+}
+
+// isSSN will validate the given string as a U.S. Social Security Number
+func isSSN(str string) bool {
+ if str == "" || len(str) != 11 {
+ return false
+ }
+ return rxSSN.MatchString(str)
+}
+
+// isHexcolor checks if the string is a hexadecimal color.
+func isHexcolor(str string) bool {
+ return rxHexcolor.MatchString(str)
+}
+
+// isRGBcolor checks if the string is a valid RGB color in form rgb(RRR, GGG, BBB).
+func isRGBcolor(str string) bool {
+ return rxRGBcolor.MatchString(str)
+}
+
+// isBase64 checks if a string is base64 encoded.
+func isBase64(str string) bool {
+ _, err := base64.StdEncoding.DecodeString(str)
+
+ return err == nil
+}
diff --git a/vendor/github.com/go-openapi/strfmt/doc.go b/vendor/github.com/go-openapi/strfmt/doc.go
index 41aebe6d51a..5825b72108e 100644
--- a/vendor/github.com/go-openapi/strfmt/doc.go
+++ b/vendor/github.com/go-openapi/strfmt/doc.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
// Package strfmt contains custom string formats
//
diff --git a/vendor/github.com/go-openapi/strfmt/duration.go b/vendor/github.com/go-openapi/strfmt/duration.go
index 749c4b561c2..908c1b02f3c 100644
--- a/vendor/github.com/go-openapi/strfmt/duration.go
+++ b/vendor/github.com/go-openapi/strfmt/duration.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package strfmt
@@ -23,8 +12,6 @@ import (
"strconv"
"strings"
"time"
-
- "go.mongodb.org/mongo-driver/bson"
)
func init() {
@@ -154,7 +141,7 @@ func ParseDuration(cand string) (time.Duration, error) {
}
// Scan reads a Duration value from database driver type.
-func (d *Duration) Scan(raw interface{}) error {
+func (d *Duration) Scan(raw any) error {
switch v := raw.(type) {
// TODO: case []byte: // ?
case int64:
@@ -203,28 +190,6 @@ func (d *Duration) UnmarshalJSON(data []byte) error {
return nil
}
-func (d Duration) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": d.String()})
-}
-
-func (d *Duration) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if data, ok := m["data"].(string); ok {
- rd, err := ParseDuration(data)
- if err != nil {
- return err
- }
- *d = Duration(rd)
- return nil
- }
-
- return fmt.Errorf("couldn't unmarshal bson bytes value as Date: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (d *Duration) DeepCopyInto(out *Duration) {
*out = *d
diff --git a/vendor/github.com/go-openapi/strfmt/errors.go b/vendor/github.com/go-openapi/strfmt/errors.go
index 9a9240363de..9faa37cf2e5 100644
--- a/vendor/github.com/go-openapi/strfmt/errors.go
+++ b/vendor/github.com/go-openapi/strfmt/errors.go
@@ -1,3 +1,6 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
package strfmt
type strfmtError string
diff --git a/vendor/github.com/go-openapi/strfmt/format.go b/vendor/github.com/go-openapi/strfmt/format.go
index 73f83af9c92..d9d9e04c208 100644
--- a/vendor/github.com/go-openapi/strfmt/format.go
+++ b/vendor/github.com/go-openapi/strfmt/format.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package strfmt
@@ -18,6 +7,7 @@ import (
"encoding"
"fmt"
"reflect"
+ "slices"
"strings"
"sync"
"time"
@@ -32,27 +22,6 @@ var Default = NewSeededFormats(nil, nil)
// Validator represents a validator for a string format.
type Validator func(string) bool
-// Format represents a string format.
-//
-// All implementations of Format provide a string representation and text
-// marshaling/unmarshaling interface to be used by encoders (e.g. encoding/json).
-type Format interface {
- String() string
- encoding.TextMarshaler
- encoding.TextUnmarshaler
-}
-
-// Registry is a registry of string formats, with a validation method.
-type Registry interface {
- Add(string, Format, Validator) bool
- DelByName(string) bool
- GetType(string) (reflect.Type, bool)
- ContainsName(string) bool
- Validates(string, string) bool
- Parse(string, string) (any, error)
- MapStructureHookFunc() mapstructure.DecodeHookFunc
-}
-
// NewFormats creates a new formats registry seeded with the values from the default
func NewFormats() Registry {
//nolint:forcetypeassert
@@ -64,10 +33,9 @@ func NewSeededFormats(seeds []knownFormat, normalizer NameNormalizer) Registry {
if normalizer == nil {
normalizer = DefaultNameNormalizer
}
- // copy here, don't modify original
- d := append([]knownFormat(nil), seeds...)
+ // copy here, don't modify the original
return &defaultFormats{
- data: d,
+ data: slices.Clone(seeds),
normalizeName: normalizer,
}
}
@@ -139,6 +107,8 @@ func (f *defaultFormats) MapStructureHookFunc() mapstructure.DecodeHookFunc {
return UUID4(data), nil
case "uuid5":
return UUID5(data), nil
+ case "uuid7":
+ return UUID7(data), nil
case "hostname":
return Hostname(data), nil
case "ipv4":
diff --git a/vendor/github.com/go-openapi/strfmt/ifaces.go b/vendor/github.com/go-openapi/strfmt/ifaces.go
new file mode 100644
index 00000000000..1b9e72c64eb
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/ifaces.go
@@ -0,0 +1,32 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
+package strfmt
+
+import (
+ "encoding"
+ "reflect"
+
+ "github.com/go-viper/mapstructure/v2"
+)
+
+// Format represents a string format.
+//
+// All implementations of Format provide a string representation and text
+// marshaling/unmarshaling interface to be used by encoders (e.g. encoding/json).
+type Format interface {
+ String() string
+ encoding.TextMarshaler
+ encoding.TextUnmarshaler
+}
+
+// Registry is a registry of string formats, with a validation method.
+type Registry interface {
+ Add(string, Format, Validator) bool
+ DelByName(string) bool
+ GetType(string) (reflect.Type, bool)
+ ContainsName(string) bool
+ Validates(string, string) bool
+ Parse(string, string) (any, error)
+ MapStructureHookFunc() mapstructure.DecodeHookFunc
+}
diff --git a/vendor/github.com/go-openapi/strfmt/mongo.go b/vendor/github.com/go-openapi/strfmt/mongo.go
new file mode 100644
index 00000000000..641fed9b1a6
--- /dev/null
+++ b/vendor/github.com/go-openapi/strfmt/mongo.go
@@ -0,0 +1,646 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
+package strfmt
+
+import (
+ "encoding/base64"
+ "encoding/binary"
+ "fmt"
+ "time"
+
+ "github.com/oklog/ulid"
+ "go.mongodb.org/mongo-driver/bson"
+ "go.mongodb.org/mongo-driver/bson/bsontype"
+ bsonprim "go.mongodb.org/mongo-driver/bson/primitive"
+)
+
+var (
+ _ bson.Marshaler = Date{}
+ _ bson.Unmarshaler = &Date{}
+ _ bson.Marshaler = Base64{}
+ _ bson.Unmarshaler = &Base64{}
+ _ bson.Marshaler = Duration(0)
+ _ bson.Unmarshaler = (*Duration)(nil)
+ _ bson.Marshaler = DateTime{}
+ _ bson.Unmarshaler = &DateTime{}
+ _ bson.Marshaler = ULID{}
+ _ bson.Unmarshaler = &ULID{}
+ _ bson.Marshaler = URI("")
+ _ bson.Unmarshaler = (*URI)(nil)
+ _ bson.Marshaler = Email("")
+ _ bson.Unmarshaler = (*Email)(nil)
+ _ bson.Marshaler = Hostname("")
+ _ bson.Unmarshaler = (*Hostname)(nil)
+ _ bson.Marshaler = IPv4("")
+ _ bson.Unmarshaler = (*IPv4)(nil)
+ _ bson.Marshaler = IPv6("")
+ _ bson.Unmarshaler = (*IPv6)(nil)
+ _ bson.Marshaler = CIDR("")
+ _ bson.Unmarshaler = (*CIDR)(nil)
+ _ bson.Marshaler = MAC("")
+ _ bson.Unmarshaler = (*MAC)(nil)
+ _ bson.Marshaler = Password("")
+ _ bson.Unmarshaler = (*Password)(nil)
+ _ bson.Marshaler = UUID("")
+ _ bson.Unmarshaler = (*UUID)(nil)
+ _ bson.Marshaler = UUID3("")
+ _ bson.Unmarshaler = (*UUID3)(nil)
+ _ bson.Marshaler = UUID4("")
+ _ bson.Unmarshaler = (*UUID4)(nil)
+ _ bson.Marshaler = UUID5("")
+ _ bson.Unmarshaler = (*UUID5)(nil)
+ _ bson.Marshaler = UUID7("")
+ _ bson.Unmarshaler = (*UUID7)(nil)
+ _ bson.Marshaler = ISBN("")
+ _ bson.Unmarshaler = (*ISBN)(nil)
+ _ bson.Marshaler = ISBN10("")
+ _ bson.Unmarshaler = (*ISBN10)(nil)
+ _ bson.Marshaler = ISBN13("")
+ _ bson.Unmarshaler = (*ISBN13)(nil)
+ _ bson.Marshaler = CreditCard("")
+ _ bson.Unmarshaler = (*CreditCard)(nil)
+ _ bson.Marshaler = SSN("")
+ _ bson.Unmarshaler = (*SSN)(nil)
+ _ bson.Marshaler = HexColor("")
+ _ bson.Unmarshaler = (*HexColor)(nil)
+ _ bson.Marshaler = RGBColor("")
+ _ bson.Unmarshaler = (*RGBColor)(nil)
+ _ bson.Marshaler = ObjectId{}
+ _ bson.Unmarshaler = &ObjectId{}
+
+ _ bson.ValueMarshaler = DateTime{}
+ _ bson.ValueUnmarshaler = &DateTime{}
+ _ bson.ValueMarshaler = ObjectId{}
+ _ bson.ValueUnmarshaler = &ObjectId{}
+)
+
+const (
+ millisec = 1000
+ microsec = 1_000_000
+ bsonDateTimeSize = 8
+)
+
+func (d Date) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": d.String()})
+}
+
+func (d *Date) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if data, ok := m["data"].(string); ok {
+ rd, err := time.ParseInLocation(RFC3339FullDate, data, DefaultTimeLocation)
+ if err != nil {
+ return err
+ }
+ *d = Date(rd)
+ return nil
+ }
+
+ return fmt.Errorf("couldn't unmarshal bson bytes value as Date: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (b Base64) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": b.String()})
+}
+
+// UnmarshalBSON document into this value
+func (b *Base64) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if bd, ok := m["data"].(string); ok {
+ vb, err := base64.StdEncoding.DecodeString(bd)
+ if err != nil {
+ return err
+ }
+ *b = Base64(vb)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as base64: %w", ErrFormat)
+}
+
+func (d Duration) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": d.String()})
+}
+
+func (d *Duration) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if data, ok := m["data"].(string); ok {
+ rd, err := ParseDuration(data)
+ if err != nil {
+ return err
+ }
+ *d = Duration(rd)
+ return nil
+ }
+
+ return fmt.Errorf("couldn't unmarshal bson bytes value as Date: %w", ErrFormat)
+}
+
+// MarshalBSON renders the DateTime as a BSON document
+func (t DateTime) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": t})
+}
+
+// UnmarshalBSON reads the DateTime from a BSON document
+func (t *DateTime) UnmarshalBSON(data []byte) error {
+ var obj struct {
+ Data DateTime
+ }
+
+ if err := bson.Unmarshal(data, &obj); err != nil {
+ return err
+ }
+
+ *t = obj.Data
+
+ return nil
+}
+
+// MarshalBSONValue is an interface implemented by types that can marshal themselves
+// into a BSON document represented as bytes. The bytes returned must be a valid
+// BSON document if the error is nil.
+//
+// Marshals a DateTime as a bson.TypeDateTime, an int64 representing
+// milliseconds since epoch.
+func (t DateTime) MarshalBSONValue() (bsontype.Type, []byte, error) {
+ // UnixNano cannot be used directly, the result of calling UnixNano on the zero
+ // Time is undefined. Thats why we use time.Nanosecond() instead.
+
+ tNorm := NormalizeTimeForMarshal(time.Time(t))
+ i64 := tNorm.Unix()*millisec + int64(tNorm.Nanosecond())/microsec
+ buf := make([]byte, bsonDateTimeSize)
+ binary.LittleEndian.PutUint64(buf, uint64(i64)) //nolint:gosec // it's okay to handle negative int64 this way
+
+ return bson.TypeDateTime, buf, nil
+}
+
+// UnmarshalBSONValue is an interface implemented by types that can unmarshal a
+// BSON value representation of themselves. The BSON bytes and type can be
+// assumed to be valid. UnmarshalBSONValue must copy the BSON value bytes if it
+// wishes to retain the data after returning.
+func (t *DateTime) UnmarshalBSONValue(tpe bsontype.Type, data []byte) error {
+ if tpe == bson.TypeNull {
+ *t = DateTime{}
+ return nil
+ }
+
+ if len(data) != bsonDateTimeSize {
+ return fmt.Errorf("bson date field length not exactly %d bytes: %w", bsonDateTimeSize, ErrFormat)
+ }
+
+ i64 := int64(binary.LittleEndian.Uint64(data)) //nolint:gosec // it's okay if we overflow and get a negative datetime
+ *t = DateTime(time.Unix(i64/millisec, i64%millisec*microsec))
+
+ return nil
+}
+
+// MarshalBSON document from this value
+func (u ULID) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *ULID) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ id, err := ulid.ParseStrict(ud)
+ if err != nil {
+ return fmt.Errorf("couldn't parse bson bytes as ULID: %w: %w", err, ErrFormat)
+ }
+ u.ULID = id
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as ULID: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u URI) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *URI) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = URI(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as uri: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (e Email) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": e.String()})
+}
+
+// UnmarshalBSON document into this value
+func (e *Email) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *e = Email(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as email: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (h Hostname) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": h.String()})
+}
+
+// UnmarshalBSON document into this value
+func (h *Hostname) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *h = Hostname(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as hostname: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u IPv4) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *IPv4) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = IPv4(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as ipv4: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u IPv6) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *IPv6) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = IPv6(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as ipv6: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u CIDR) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *CIDR) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = CIDR(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as CIDR: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u MAC) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *MAC) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = MAC(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as MAC: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (r Password) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": r.String()})
+}
+
+// UnmarshalBSON document into this value
+func (r *Password) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *r = Password(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as Password: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u UUID) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *UUID) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = UUID(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as UUID: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u UUID3) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *UUID3) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = UUID3(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as UUID3: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u UUID4) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *UUID4) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = UUID4(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as UUID4: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u UUID5) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *UUID5) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = UUID5(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as UUID5: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u UUID7) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *UUID7) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = UUID7(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as UUID7: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u ISBN) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *ISBN) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = ISBN(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as ISBN: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u ISBN10) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *ISBN10) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = ISBN10(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as ISBN10: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u ISBN13) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *ISBN13) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = ISBN13(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as ISBN13: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u CreditCard) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *CreditCard) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = CreditCard(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as CreditCard: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (u SSN) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": u.String()})
+}
+
+// UnmarshalBSON document into this value
+func (u *SSN) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *u = SSN(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as SSN: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (h HexColor) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": h.String()})
+}
+
+// UnmarshalBSON document into this value
+func (h *HexColor) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *h = HexColor(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as HexColor: %w", ErrFormat)
+}
+
+// MarshalBSON document from this value
+func (r RGBColor) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": r.String()})
+}
+
+// UnmarshalBSON document into this value
+func (r *RGBColor) UnmarshalBSON(data []byte) error {
+ var m bson.M
+ if err := bson.Unmarshal(data, &m); err != nil {
+ return err
+ }
+
+ if ud, ok := m["data"].(string); ok {
+ *r = RGBColor(ud)
+ return nil
+ }
+ return fmt.Errorf("couldn't unmarshal bson bytes as RGBColor: %w", ErrFormat)
+}
+
+// MarshalBSON renders the object id as a BSON document
+func (id ObjectId) MarshalBSON() ([]byte, error) {
+ return bson.Marshal(bson.M{"data": bsonprim.ObjectID(id)})
+}
+
+// UnmarshalBSON reads the objectId from a BSON document
+func (id *ObjectId) UnmarshalBSON(data []byte) error {
+ var obj struct {
+ Data bsonprim.ObjectID
+ }
+ if err := bson.Unmarshal(data, &obj); err != nil {
+ return err
+ }
+ *id = ObjectId(obj.Data)
+ return nil
+}
+
+// MarshalBSONValue is an interface implemented by types that can marshal themselves
+// into a BSON document represented as bytes. The bytes returned must be a valid
+// BSON document if the error is nil.
+func (id ObjectId) MarshalBSONValue() (bsontype.Type, []byte, error) {
+ oid := bsonprim.ObjectID(id)
+ return bson.TypeObjectID, oid[:], nil
+}
+
+// UnmarshalBSONValue is an interface implemented by types that can unmarshal a
+// BSON value representation of themselves. The BSON bytes and type can be
+// assumed to be valid. UnmarshalBSONValue must copy the BSON value bytes if it
+// wishes to retain the data after returning.
+func (id *ObjectId) UnmarshalBSONValue(_ bsontype.Type, data []byte) error {
+ var oid bsonprim.ObjectID
+ copy(oid[:], data)
+ *id = ObjectId(oid)
+ return nil
+}
diff --git a/vendor/github.com/go-openapi/strfmt/time.go b/vendor/github.com/go-openapi/strfmt/time.go
index 84e2412b937..8085aaf6965 100644
--- a/vendor/github.com/go-openapi/strfmt/time.go
+++ b/vendor/github.com/go-openapi/strfmt/time.go
@@ -1,31 +1,15 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package strfmt
import (
"database/sql/driver"
- "encoding/binary"
"encoding/json"
"fmt"
"regexp"
"strings"
"time"
-
- "go.mongodb.org/mongo-driver/bson"
-
- "go.mongodb.org/mongo-driver/bson/bsontype"
)
var (
@@ -178,7 +162,7 @@ func (t *DateTime) UnmarshalText(text []byte) error {
}
// Scan scans a DateTime value from database driver type.
-func (t *DateTime) Scan(raw interface{}) error {
+func (t *DateTime) Scan(raw any) error {
// TODO: case int64: and case float64: ?
switch v := raw.(type) {
case []byte:
@@ -224,69 +208,6 @@ func (t *DateTime) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON renders the DateTime as a BSON document
-func (t DateTime) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": t})
-}
-
-// UnmarshalBSON reads the DateTime from a BSON document
-func (t *DateTime) UnmarshalBSON(data []byte) error {
- var obj struct {
- Data DateTime
- }
-
- if err := bson.Unmarshal(data, &obj); err != nil {
- return err
- }
-
- *t = obj.Data
-
- return nil
-}
-
-const bsonDateLength = 8
-
-// MarshalBSONValue is an interface implemented by types that can marshal themselves
-// into a BSON document represented as bytes. The bytes returned must be a valid
-// BSON document if the error is nil.
-//
-// Marshals a DateTime as a bsontype.DateTime, an int64 representing
-// milliseconds since epoch.
-func (t DateTime) MarshalBSONValue() (bsontype.Type, []byte, error) {
- // UnixNano cannot be used directly, the result of calling UnixNano on the zero
- // Time is undefined. That's why we use time.Nanosecond() instead.
- tNorm := NormalizeTimeForMarshal(time.Time(t))
- i64 := tNorm.UnixMilli()
-
- buf := make([]byte, bsonDateLength)
- // int64 -> uint64 conversion is safe here
- binary.LittleEndian.PutUint64(buf, uint64(i64)) //nolint:gosec
-
- return bson.TypeDateTime, buf, nil
-}
-
-// UnmarshalBSONValue is an interface implemented by types that can unmarshal a
-// BSON value representation of themselves. The BSON bytes and type can be
-// assumed to be valid. UnmarshalBSONValue must copy the BSON value bytes if it
-// wishes to retain the data after returning.
-func (t *DateTime) UnmarshalBSONValue(tpe bsontype.Type, data []byte) error {
- if tpe == bson.TypeNull {
- *t = DateTime{}
- return nil
- }
-
- if len(data) != bsonDateLength {
- return fmt.Errorf("bson date field length not exactly 8 bytes: %w", ErrFormat)
- }
-
- // it's ok to get negative values after conversion
- i64 := int64(binary.LittleEndian.Uint64(data)) //nolint:gosec
- // TODO: Use bsonprim.DateTime.Time() method
- *t = DateTime(time.UnixMilli(i64))
-
- return nil
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (t *DateTime) DeepCopyInto(out *DateTime) {
*out = *t
diff --git a/vendor/github.com/go-openapi/strfmt/ulid.go b/vendor/github.com/go-openapi/strfmt/ulid.go
index 434eb01baa5..85c5b53e6c7 100644
--- a/vendor/github.com/go-openapi/strfmt/ulid.go
+++ b/vendor/github.com/go-openapi/strfmt/ulid.go
@@ -1,3 +1,6 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
package strfmt
import (
@@ -9,7 +12,6 @@ import (
"sync"
"github.com/oklog/ulid"
- "go.mongodb.org/mongo-driver/bson"
)
// ULID represents a ulid string format
@@ -28,12 +30,12 @@ type ULID struct {
var (
ulidEntropyPool = sync.Pool{
- New: func() interface{} {
+ New: func() any {
return cryptorand.Reader
},
}
- ULIDScanDefaultFunc = func(raw interface{}) (ULID, error) {
+ ULIDScanDefaultFunc = func(raw any) (ULID, error) {
u := NewULIDZero()
switch x := raw.(type) {
case nil:
@@ -111,7 +113,7 @@ func NewULID() (ULID, error) {
}
// GetULID returns underlying instance of ULID
-func (u *ULID) GetULID() interface{} {
+func (u *ULID) GetULID() any {
return u.ULID
}
@@ -126,7 +128,7 @@ func (u *ULID) UnmarshalText(data []byte) error { // validation is performed lat
}
// Scan reads a value from a database driver
-func (u *ULID) Scan(raw interface{}) error {
+func (u *ULID) Scan(raw any) error {
ul, err := ULIDScanOverrideFunc(raw)
if err == nil {
*u = ul
@@ -165,29 +167,6 @@ func (u *ULID) UnmarshalJSON(data []byte) error {
return nil
}
-// MarshalBSON document from this value
-func (u ULID) MarshalBSON() ([]byte, error) {
- return bson.Marshal(bson.M{"data": u.String()})
-}
-
-// UnmarshalBSON document into this value
-func (u *ULID) UnmarshalBSON(data []byte) error {
- var m bson.M
- if err := bson.Unmarshal(data, &m); err != nil {
- return err
- }
-
- if ud, ok := m["data"].(string); ok {
- id, err := ulid.ParseStrict(ud)
- if err != nil {
- return fmt.Errorf("couldn't parse bson bytes as ULID: %w: %w", err, ErrFormat)
- }
- u.ULID = id
- return nil
- }
- return fmt.Errorf("couldn't unmarshal bson bytes as ULID: %w", ErrFormat)
-}
-
// DeepCopyInto copies the receiver and writes its value into out.
func (u *ULID) DeepCopyInto(out *ULID) {
*out = *u
diff --git a/vendor/github.com/go-openapi/swag/conv/convert.go b/vendor/github.com/go-openapi/swag/conv/convert.go
index b9b8698543a..f205c391345 100644
--- a/vendor/github.com/go-openapi/swag/conv/convert.go
+++ b/vendor/github.com/go-openapi/swag/conv/convert.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package conv
diff --git a/vendor/github.com/go-openapi/swag/conv/convert_types.go b/vendor/github.com/go-openapi/swag/conv/convert_types.go
index 423e8663f8e..cf4c6495ebc 100644
--- a/vendor/github.com/go-openapi/swag/conv/convert_types.go
+++ b/vendor/github.com/go-openapi/swag/conv/convert_types.go
@@ -1,20 +1,13 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package conv
-// The original version of this file, eons ago, was taken from the aws go sdk
+// Unlicensed credits (idea, concept)
+//
+// The idea to convert values to pointers and the other way around, was inspired, eons ago, by the aws go sdk.
+//
+// Nowadays, all sensible API sdk's expose a similar functionality.
// Pointer returns a pointer to the value passed in.
func Pointer[T any](v T) *T {
diff --git a/vendor/github.com/go-openapi/swag/conv/doc.go b/vendor/github.com/go-openapi/swag/conv/doc.go
index b02711f422c..1bd6ead6e2d 100644
--- a/vendor/github.com/go-openapi/swag/conv/doc.go
+++ b/vendor/github.com/go-openapi/swag/conv/doc.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
// Package conv exposes utilities to convert types.
//
diff --git a/vendor/github.com/go-openapi/swag/conv/format.go b/vendor/github.com/go-openapi/swag/conv/format.go
index db7562a4a34..5b87b8e146b 100644
--- a/vendor/github.com/go-openapi/swag/conv/format.go
+++ b/vendor/github.com/go-openapi/swag/conv/format.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package conv
diff --git a/vendor/github.com/go-openapi/swag/conv/sizeof.go b/vendor/github.com/go-openapi/swag/conv/sizeof.go
index 646f8be9aa3..49434655738 100644
--- a/vendor/github.com/go-openapi/swag/conv/sizeof.go
+++ b/vendor/github.com/go-openapi/swag/conv/sizeof.go
@@ -1,3 +1,6 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
package conv
import "unsafe"
diff --git a/vendor/github.com/go-openapi/swag/conv/type_constraints.go b/vendor/github.com/go-openapi/swag/conv/type_constraints.go
index 3c61498361c..81135e827e5 100644
--- a/vendor/github.com/go-openapi/swag/conv/type_constraints.go
+++ b/vendor/github.com/go-openapi/swag/conv/type_constraints.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package conv
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/README.md b/vendor/github.com/go-openapi/swag/jsonutils/README.md
index c8d0cab67b6..d745cdb466e 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/README.md
+++ b/vendor/github.com/go-openapi/swag/jsonutils/README.md
@@ -78,7 +78,7 @@ Each adapter is an independent go module. Hence you'll pick its dependencies onl
At this moment we provide:
* `stdlib`: JSON adapter based on the standard library
-* `easyjson`: JSON adapter based on the `github.com/mailru/easyyjson`
+* `easyjson`: JSON adapter based on the `github.com/mailru/easyjson`
The adapters provide the basic `Marshal` and `Unmarshal` capabilities, plus an implementation
of the `MapSlice` pattern.
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/doc.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/doc.go
index dbb38c2f0cf..76d3898fca5 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/doc.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/doc.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
// Package adapters exposes a registry of adapters to multiple
// JSON serialization libraries.
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/ifaces/doc.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/ifaces/doc.go
index 49649859af6..1fd43a1fad5 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/ifaces/doc.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/ifaces/doc.go
@@ -1,2 +1,5 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
// Package ifaces exposes all interfaces to work with adapters.
package ifaces
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/ifaces/ifaces.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/ifaces/ifaces.go
index 4927d872dab..7805e5e5e39 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/ifaces/ifaces.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/ifaces/ifaces.go
@@ -1,3 +1,6 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
package ifaces
import (
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/ifaces/registry_iface.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/ifaces/registry_iface.go
index d1fe6a0adb6..2d6c69f4e60 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/ifaces/registry_iface.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/ifaces/registry_iface.go
@@ -1,3 +1,6 @@
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
+
package ifaces
import (
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/registry.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/registry.go
index b34a2305181..3062acaff26 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/registry.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/registry.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package adapters
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/adapter.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/adapter.go
index 4df831b62dd..0213ff5c29f 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/adapter.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/adapter.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package json
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/doc.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/doc.go
index 2ff6b212fc8..5ea1b440425 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/doc.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/doc.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
// Package json implements an [ifaces.Adapter] using the standard library.
package json
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/lexer.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/lexer.go
index 6d919199d03..b5aa1c7972e 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/lexer.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/lexer.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package json
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/ordered_map.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/ordered_map.go
index 18e6294e50e..54deef406f3 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/ordered_map.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/ordered_map.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package json
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/pool.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/pool.go
index 0f51d3a20cd..709b97c3046 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/pool.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/pool.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package json
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/register.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/register.go
index 18bbc377450..fc8818694ea 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/register.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/register.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package json
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/writer.go b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/writer.go
index 38e9b6e034a..dc2325c1a30 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/writer.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/adapters/stdlib/json/writer.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package json
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/concat.go b/vendor/github.com/go-openapi/swag/jsonutils/concat.go
index 049d4698bf8..2068503af05 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/concat.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/concat.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package jsonutils
@@ -34,7 +23,7 @@ func init() {
// ConcatJSON concatenates multiple json objects or arrays efficiently.
//
-// Note that [ConcatJSON] performs a very simmple (and fast) concatenation
+// Note that [ConcatJSON] performs a very simple (and fast) concatenation
// operation: it does not attempt to merge objects.
func ConcatJSON(blobs ...[]byte) []byte {
if len(blobs) == 0 {
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/doc.go b/vendor/github.com/go-openapi/swag/jsonutils/doc.go
index 495ef834134..3926cc58d1b 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/doc.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/doc.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
// Package jsonutils provides helpers to work with JSON.
//
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/json.go b/vendor/github.com/go-openapi/swag/jsonutils/json.go
index a33b89bd4d9..40753ce03fd 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/json.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/json.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package jsonutils
diff --git a/vendor/github.com/go-openapi/swag/jsonutils/ordered_map.go b/vendor/github.com/go-openapi/swag/jsonutils/ordered_map.go
index 931ce2559d8..38dd3e24442 100644
--- a/vendor/github.com/go-openapi/swag/jsonutils/ordered_map.go
+++ b/vendor/github.com/go-openapi/swag/jsonutils/ordered_map.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package jsonutils
diff --git a/vendor/github.com/go-openapi/swag/typeutils/doc.go b/vendor/github.com/go-openapi/swag/typeutils/doc.go
index 67e49d12ec5..66bed20dff0 100644
--- a/vendor/github.com/go-openapi/swag/typeutils/doc.go
+++ b/vendor/github.com/go-openapi/swag/typeutils/doc.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
// Package typeutils exposes utilities to inspect generic types.
package typeutils
diff --git a/vendor/github.com/go-openapi/swag/typeutils/types.go b/vendor/github.com/go-openapi/swag/typeutils/types.go
index f0ddd3cd3df..55487a673c4 100644
--- a/vendor/github.com/go-openapi/swag/typeutils/types.go
+++ b/vendor/github.com/go-openapi/swag/typeutils/types.go
@@ -1,16 +1,5 @@
-// Copyright 2015 go-swagger maintainers
-//
-// 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.
+// SPDX-FileCopyrightText: Copyright 2015-2025 go-swagger maintainers
+// SPDX-License-Identifier: Apache-2.0
package typeutils
diff --git a/vendor/github.com/goccy/go-json/.codecov.yml b/vendor/github.com/goccy/go-json/.codecov.yml
deleted file mode 100644
index e98134570c4..00000000000
--- a/vendor/github.com/goccy/go-json/.codecov.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-codecov:
- require_ci_to_pass: yes
-
-coverage:
- precision: 2
- round: down
- range: "70...100"
-
- status:
- project:
- default:
- target: 70%
- threshold: 2%
- patch: off
- changes: no
-
-parsers:
- gcov:
- branch_detection:
- conditional: yes
- loop: yes
- method: no
- macro: no
-
-comment:
- layout: "header,diff"
- behavior: default
- require_changes: no
-
-ignore:
- - internal/encoder/vm_color
- - internal/encoder/vm_color_indent
diff --git a/vendor/github.com/goccy/go-json/.gitignore b/vendor/github.com/goccy/go-json/.gitignore
deleted file mode 100644
index 378283829cf..00000000000
--- a/vendor/github.com/goccy/go-json/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-cover.html
-cover.out
diff --git a/vendor/github.com/goccy/go-json/.golangci.yml b/vendor/github.com/goccy/go-json/.golangci.yml
deleted file mode 100644
index 977accaa9f4..00000000000
--- a/vendor/github.com/goccy/go-json/.golangci.yml
+++ /dev/null
@@ -1,86 +0,0 @@
-run:
- skip-files:
- - encode_optype.go
- - ".*_test\\.go$"
-
-linters-settings:
- govet:
- enable-all: true
- disable:
- - shadow
-
-linters:
- enable-all: true
- disable:
- - dogsled
- - dupl
- - exhaustive
- - exhaustivestruct
- - errorlint
- - forbidigo
- - funlen
- - gci
- - gochecknoglobals
- - gochecknoinits
- - gocognit
- - gocritic
- - gocyclo
- - godot
- - godox
- - goerr113
- - gofumpt
- - gomnd
- - gosec
- - ifshort
- - lll
- - makezero
- - nakedret
- - nestif
- - nlreturn
- - paralleltest
- - testpackage
- - thelper
- - wrapcheck
- - interfacer
- - lll
- - nakedret
- - nestif
- - nlreturn
- - testpackage
- - wsl
- - varnamelen
- - nilnil
- - ireturn
- - govet
- - forcetypeassert
- - cyclop
- - containedctx
- - revive
- - nosnakecase
- - exhaustruct
- - depguard
-
-issues:
- exclude-rules:
- # not needed
- - path: /*.go
- text: "ST1003: should not use underscores in package names"
- linters:
- - stylecheck
- - path: /*.go
- text: "don't use an underscore in package name"
- linters:
- - golint
- - path: rtype.go
- linters:
- - golint
- - stylecheck
- - path: error.go
- linters:
- - staticcheck
-
- # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
- max-issues-per-linter: 0
-
- # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
- max-same-issues: 0
diff --git a/vendor/github.com/goccy/go-json/CHANGELOG.md b/vendor/github.com/goccy/go-json/CHANGELOG.md
deleted file mode 100644
index d09bb89c318..00000000000
--- a/vendor/github.com/goccy/go-json/CHANGELOG.md
+++ /dev/null
@@ -1,425 +0,0 @@
-# v0.10.2 - 2023/03/20
-
-### New features
-
-* Support DebugDOT option for debugging encoder ( #440 )
-
-### Fix bugs
-
-* Fix combination of embedding structure and omitempty option ( #442 )
-
-# v0.10.1 - 2023/03/13
-
-### Fix bugs
-
-* Fix checkptr error for array decoder ( #415 )
-* Fix added buffer size check when decoding key ( #430 )
-* Fix handling of anonymous fields other than struct ( #431 )
-* Fix to not optimize when lower conversion can't handle byte-by-byte ( #432 )
-* Fix a problem that MarshalIndent does not work when UnorderedMap is specified ( #435 )
-* Fix mapDecoder.DecodeStream() for empty objects containing whitespace ( #425 )
-* Fix an issue that could not set the correct NextField for fields in the embedded structure ( #438 )
-
-# v0.10.0 - 2022/11/29
-
-### New features
-
-* Support JSON Path ( #250 )
-
-### Fix bugs
-
-* Fix marshaler for map's key ( #409 )
-
-# v0.9.11 - 2022/08/18
-
-### Fix bugs
-
-* Fix unexpected behavior when buffer ends with backslash ( #383 )
-* Fix stream decoding of escaped character ( #387 )
-
-# v0.9.10 - 2022/07/15
-
-### Fix bugs
-
-* Fix boundary exception of type caching ( #382 )
-
-# v0.9.9 - 2022/07/15
-
-### Fix bugs
-
-* Fix encoding of directed interface with typed nil ( #377 )
-* Fix embedded primitive type encoding using alias ( #378 )
-* Fix slice/array type encoding with types implementing MarshalJSON ( #379 )
-* Fix unicode decoding when the expected buffer state is not met after reading ( #380 )
-
-# v0.9.8 - 2022/06/30
-
-### Fix bugs
-
-* Fix decoding of surrogate-pair ( #365 )
-* Fix handling of embedded primitive type ( #366 )
-* Add validation of escape sequence for decoder ( #367 )
-* Fix stream tokenizing respecting UseNumber ( #369 )
-* Fix encoding when struct pointer type that implements Marshal JSON is embedded ( #375 )
-
-### Improve performance
-
-* Improve performance of linkRecursiveCode ( #368 )
-
-# v0.9.7 - 2022/04/22
-
-### Fix bugs
-
-#### Encoder
-
-* Add filtering process for encoding on slow path ( #355 )
-* Fix encoding of interface{} with pointer type ( #363 )
-
-#### Decoder
-
-* Fix map key decoder that implements UnmarshalJSON ( #353 )
-* Fix decoding of []uint8 type ( #361 )
-
-### New features
-
-* Add DebugWith option for encoder ( #356 )
-
-# v0.9.6 - 2022/03/22
-
-### Fix bugs
-
-* Correct the handling of the minimum value of int type for decoder ( #344 )
-* Fix bugs of stream decoder's bufferSize ( #349 )
-* Add a guard to use typeptr more safely ( #351 )
-
-### Improve decoder performance
-
-* Improve escapeString's performance ( #345 )
-
-### Others
-
-* Update go version for CI ( #347 )
-
-# v0.9.5 - 2022/03/04
-
-### Fix bugs
-
-* Fix panic when decoding time.Time with context ( #328 )
-* Fix reading the next character in buffer to nul consideration ( #338 )
-* Fix incorrect handling on skipValue ( #341 )
-
-### Improve decoder performance
-
-* Improve performance when a payload contains escape sequence ( #334 )
-
-# v0.9.4 - 2022/01/21
-
-* Fix IsNilForMarshaler for string type with omitempty ( #323 )
-* Fix the case where the embedded field is at the end ( #326 )
-
-# v0.9.3 - 2022/01/14
-
-* Fix logic of removing struct field for decoder ( #322 )
-
-# v0.9.2 - 2022/01/14
-
-* Add invalid decoder to delay type error judgment at decode ( #321 )
-
-# v0.9.1 - 2022/01/11
-
-* Fix encoding of MarshalText/MarshalJSON operation with head offset ( #319 )
-
-# v0.9.0 - 2022/01/05
-
-### New feature
-
-* Supports dynamic filtering of struct fields ( #314 )
-
-### Improve encoding performance
-
-* Improve map encoding performance ( #310 )
-* Optimize encoding path for escaped string ( #311 )
-* Add encoding option for performance ( #312 )
-
-### Fix bugs
-
-* Fix panic at encoding map value on 1.18 ( #310 )
-* Fix MarshalIndent for interface type ( #317 )
-
-# v0.8.1 - 2021/12/05
-
-* Fix operation conversion from PtrHead to Head in Recursive type ( #305 )
-
-# v0.8.0 - 2021/12/02
-
-* Fix embedded field conflict behavior ( #300 )
-* Refactor compiler for encoder ( #301 #302 )
-
-# v0.7.10 - 2021/10/16
-
-* Fix conversion from pointer to uint64 ( #294 )
-
-# v0.7.9 - 2021/09/28
-
-* Fix encoding of nil value about interface type that has method ( #291 )
-
-# v0.7.8 - 2021/09/01
-
-* Fix mapassign_faststr for indirect struct type ( #283 )
-* Fix encoding of not empty interface type ( #284 )
-* Fix encoding of empty struct interface type ( #286 )
-
-# v0.7.7 - 2021/08/25
-
-* Fix invalid utf8 on stream decoder ( #279 )
-* Fix buffer length bug on string stream decoder ( #280 )
-
-Thank you @orisano !!
-
-# v0.7.6 - 2021/08/13
-
-* Fix nil slice assignment ( #276 )
-* Improve error message ( #277 )
-
-# v0.7.5 - 2021/08/12
-
-* Fix encoding of embedded struct with tags ( #265 )
-* Fix encoding of embedded struct that isn't first field ( #272 )
-* Fix decoding of binary type with escaped char ( #273 )
-
-# v0.7.4 - 2021/07/06
-
-* Fix encoding of indirect layout structure ( #264 )
-
-# v0.7.3 - 2021/06/29
-
-* Fix encoding of pointer type in empty interface ( #262 )
-
-# v0.7.2 - 2021/06/26
-
-### Fix decoder
-
-* Add decoder for func type to fix decoding of nil function value ( #257 )
-* Fix stream decoding of []byte type ( #258 )
-
-### Performance
-
-* Improve decoding performance of map[string]interface{} type ( use `mapassign_faststr` ) ( #256 )
-* Improve encoding performance of empty interface type ( remove recursive calling of `vm.Run` ) ( #259 )
-
-### Benchmark
-
-* Add bytedance/sonic as benchmark target ( #254 )
-
-# v0.7.1 - 2021/06/18
-
-### Fix decoder
-
-* Fix error when unmarshal empty array ( #253 )
-
-# v0.7.0 - 2021/06/12
-
-### Support context for MarshalJSON and UnmarshalJSON ( #248 )
-
-* json.MarshalContext(context.Context, interface{}, ...json.EncodeOption) ([]byte, error)
-* json.NewEncoder(io.Writer).EncodeContext(context.Context, interface{}, ...json.EncodeOption) error
-* json.UnmarshalContext(context.Context, []byte, interface{}, ...json.DecodeOption) error
-* json.NewDecoder(io.Reader).DecodeContext(context.Context, interface{}) error
-
-```go
-type MarshalerContext interface {
- MarshalJSON(context.Context) ([]byte, error)
-}
-
-type UnmarshalerContext interface {
- UnmarshalJSON(context.Context, []byte) error
-}
-```
-
-### Add DecodeFieldPriorityFirstWin option ( #242 )
-
-In the default behavior, go-json, like encoding/json, will reflect the result of the last evaluation when a field with the same name exists. I've added new options to allow you to change this behavior. `json.DecodeFieldPriorityFirstWin` option reflects the result of the first evaluation if a field with the same name exists. This behavior has a performance advantage as it allows the subsequent strings to be skipped if all fields have been evaluated.
-
-### Fix encoder
-
-* Fix indent number contains recursive type ( #249 )
-* Fix encoding of using empty interface as map key ( #244 )
-
-### Fix decoder
-
-* Fix decoding fields containing escaped characters ( #237 )
-
-### Refactor
-
-* Move some tests to subdirectory ( #243 )
-* Refactor package layout for decoder ( #238 )
-
-# v0.6.1 - 2021/06/02
-
-### Fix encoder
-
-* Fix value of totalLength for encoding ( #236 )
-
-# v0.6.0 - 2021/06/01
-
-### Support Colorize option for encoding (#233)
-
-```go
-b, err := json.MarshalWithOption(v, json.Colorize(json.DefaultColorScheme))
-if err != nil {
- ...
-}
-fmt.Println(string(b)) // print colored json
-```
-
-### Refactor
-
-* Fix opcode layout - Adjust memory layout of the opcode to 128 bytes in a 64-bit environment ( #230 )
-* Refactor encode option ( #231 )
-* Refactor escape string ( #232 )
-
-# v0.5.1 - 2021/5/20
-
-### Optimization
-
-* Add type addrShift to enable bigger encoder/decoder cache ( #213 )
-
-### Fix decoder
-
-* Keep original reference of slice element ( #229 )
-
-### Refactor
-
-* Refactor Debug mode for encoding ( #226 )
-* Generate VM sources for encoding ( #227 )
-* Refactor validator for null/true/false for decoding ( #221 )
-
-# v0.5.0 - 2021/5/9
-
-### Supports using omitempty and string tags at the same time ( #216 )
-
-### Fix decoder
-
-* Fix stream decoder for unicode char ( #215 )
-* Fix decoding of slice element ( #219 )
-* Fix calculating of buffer length for stream decoder ( #220 )
-
-### Refactor
-
-* replace skipWhiteSpace goto by loop ( #212 )
-
-# v0.4.14 - 2021/5/4
-
-### Benchmark
-
-* Add valyala/fastjson to benchmark ( #193 )
-* Add benchmark task for CI ( #211 )
-
-### Fix decoder
-
-* Fix decoding of slice with unmarshal json type ( #198 )
-* Fix decoding of null value for interface type that does not implement Unmarshaler ( #205 )
-* Fix decoding of null value to []byte by json.Unmarshal ( #206 )
-* Fix decoding of backslash char at the end of string ( #207 )
-* Fix stream decoder for null/true/false value ( #208 )
-* Fix stream decoder for slow reader ( #211 )
-
-### Performance
-
-* If cap of slice is enough, reuse slice data for compatibility with encoding/json ( #200 )
-
-# v0.4.13 - 2021/4/20
-
-### Fix json.Compact and json.Indent
-
-* Support validation the input buffer for json.Compact and json.Indent ( #189 )
-* Optimize json.Compact and json.Indent ( improve memory footprint ) ( #190 )
-
-# v0.4.12 - 2021/4/15
-
-### Fix encoder
-
-* Fix unnecessary indent for empty slice type ( #181 )
-* Fix encoding of omitempty feature for the slice or interface type ( #183 )
-* Fix encoding custom types zero values with omitempty when marshaller exists ( #187 )
-
-### Fix decoder
-
-* Fix decoder for invalid top level value ( #184 )
-* Fix decoder for invalid number value ( #185 )
-
-# v0.4.11 - 2021/4/3
-
-* Improve decoder performance for interface type
-
-# v0.4.10 - 2021/4/2
-
-### Fix encoder
-
-* Fixed a bug when encoding slice and map containing recursive structures
-* Fixed a logic to determine if indirect reference
-
-# v0.4.9 - 2021/3/29
-
-### Add debug mode
-
-If you use `json.MarshalWithOption(v, json.Debug())` and `panic` occurred in `go-json`, produces debug information to console.
-
-### Support a new feature to compatible with encoding/json
-
-- invalid UTF-8 is coerced to valid UTF-8 ( without performance down )
-
-### Fix encoder
-
-- Fixed handling of MarshalJSON of function type
-
-### Fix decoding of slice of pointer type
-
-If there is a pointer value, go-json will use it. (This behavior is necessary to achieve the ability to prioritize pre-filled values). However, since slices are reused internally, there was a bug that referred to the previous pointer value. Therefore, it is not necessary to refer to the pointer value in advance for the slice element, so we explicitly initialize slice element by `nil`.
-
-# v0.4.8 - 2021/3/21
-
-### Reduce memory usage at compile time
-
-* go-json have used about 2GB of memory at compile time, but now it can compile with about less than 550MB.
-
-### Fix any encoder's bug
-
-* Add many test cases for encoder
-* Fix composite type ( slice/array/map )
-* Fix pointer types
-* Fix encoding of MarshalJSON or MarshalText or json.Number type
-
-### Refactor encoder
-
-* Change package layout for reducing memory usage at compile
-* Remove anonymous and only operation
-* Remove root property from encodeCompileContext and opcode
-
-### Fix CI
-
-* Add Go 1.16
-* Remove Go 1.13
-* Fix `make cover` task
-
-### Number/Delim/Token/RawMessage use the types defined in encoding/json by type alias
-
-# v0.4.7 - 2021/02/22
-
-### Fix decoder
-
-* Fix decoding of deep recursive structure
-* Fix decoding of embedded unexported pointer field
-* Fix invalid test case
-* Fix decoding of invalid value
-* Fix decoding of prefilled value
-* Fix not being able to return UnmarshalTypeError when it should be returned
-* Fix decoding of null value
-* Fix decoding of type of null string
-* Use pre allocated pointer if exists it at decoding
-
-### Reduce memory usage at compile
-
-* Integrate int/int8/int16/int32/int64 and uint/uint8/uint16/uint32/uint64 operation to reduce memory usage at compile
-
-### Remove unnecessary optype
diff --git a/vendor/github.com/goccy/go-json/LICENSE b/vendor/github.com/goccy/go-json/LICENSE
deleted file mode 100644
index 6449c8bff65..00000000000
--- a/vendor/github.com/goccy/go-json/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (c) 2020 Masaaki Goshima
-
-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/goccy/go-json/Makefile b/vendor/github.com/goccy/go-json/Makefile
deleted file mode 100644
index c030577dcf9..00000000000
--- a/vendor/github.com/goccy/go-json/Makefile
+++ /dev/null
@@ -1,39 +0,0 @@
-PKG := github.com/goccy/go-json
-
-BIN_DIR := $(CURDIR)/bin
-PKGS := $(shell go list ./... | grep -v internal/cmd|grep -v test)
-COVER_PKGS := $(foreach pkg,$(PKGS),$(subst $(PKG),.,$(pkg)))
-
-COMMA := ,
-EMPTY :=
-SPACE := $(EMPTY) $(EMPTY)
-COVERPKG_OPT := $(subst $(SPACE),$(COMMA),$(COVER_PKGS))
-
-$(BIN_DIR):
- @mkdir -p $(BIN_DIR)
-
-.PHONY: cover
-cover:
- go test -coverpkg=$(COVERPKG_OPT) -coverprofile=cover.out ./...
-
-.PHONY: cover-html
-cover-html: cover
- go tool cover -html=cover.out
-
-.PHONY: lint
-lint: golangci-lint
- $(BIN_DIR)/golangci-lint run
-
-golangci-lint: | $(BIN_DIR)
- @{ \
- set -e; \
- GOLANGCI_LINT_TMP_DIR=$$(mktemp -d); \
- cd $$GOLANGCI_LINT_TMP_DIR; \
- go mod init tmp; \
- GOBIN=$(BIN_DIR) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.2; \
- rm -rf $$GOLANGCI_LINT_TMP_DIR; \
- }
-
-.PHONY: generate
-generate:
- go generate ./internal/...
diff --git a/vendor/github.com/goccy/go-json/README.md b/vendor/github.com/goccy/go-json/README.md
deleted file mode 100644
index 7bacc54f9cd..00000000000
--- a/vendor/github.com/goccy/go-json/README.md
+++ /dev/null
@@ -1,529 +0,0 @@
-# go-json
-
-
-[](https://pkg.go.dev/github.com/goccy/go-json?tab=doc)
-[](https://codecov.io/gh/goccy/go-json)
-
-Fast JSON encoder/decoder compatible with encoding/json for Go
-
-
-
-# Roadmap
-
-```
-* version ( expected release date )
-
-* v0.9.0
- |
- | while maintaining compatibility with encoding/json, we will add convenient APIs
- |
- v
-* v1.0.0
-```
-
-We are accepting requests for features that will be implemented between v0.9.0 and v.1.0.0.
-If you have the API you need, please submit your issue [here](https://github.com/goccy/go-json/issues).
-
-# Features
-
-- Drop-in replacement of `encoding/json`
-- Fast ( See [Benchmark section](https://github.com/goccy/go-json#benchmarks) )
-- Flexible customization with options
-- Coloring the encoded string
-- Can propagate context.Context to `MarshalJSON` or `UnmarshalJSON`
-- Can dynamically filter the fields of the structure type-safely
-
-# Installation
-
-```
-go get github.com/goccy/go-json
-```
-
-# How to use
-
-Replace import statement from `encoding/json` to `github.com/goccy/go-json`
-
-```
--import "encoding/json"
-+import "github.com/goccy/go-json"
-```
-
-# JSON library comparison
-
-| name | encoder | decoder | compatible with `encoding/json` |
-| :----: | :------: | :-----: | :-----------------------------: |
-| encoding/json | yes | yes | N/A |
-| [json-iterator/go](https://github.com/json-iterator/go) | yes | yes | partial |
-| [easyjson](https://github.com/mailru/easyjson) | yes | yes | no |
-| [gojay](https://github.com/francoispqt/gojay) | yes | yes | no |
-| [segmentio/encoding/json](https://github.com/segmentio/encoding/tree/master/json) | yes | yes | partial |
-| [jettison](https://github.com/wI2L/jettison) | yes | no | no |
-| [simdjson-go](https://github.com/minio/simdjson-go) | no | yes | no |
-| goccy/go-json | yes | yes | yes |
-
-- `json-iterator/go` isn't compatible with `encoding/json` in many ways (e.g. https://github.com/json-iterator/go/issues/229 ), but it hasn't been supported for a long time.
-- `segmentio/encoding/json` is well supported for encoders, but some are not supported for decoder APIs such as `Token` ( streaming decode )
-
-## Other libraries
-
-- [jingo](https://github.com/bet365/jingo)
-
-I tried the benchmark but it didn't work.
-Also, it seems to panic when it receives an unexpected value because there is no error handling...
-
-- [ffjson](https://github.com/pquerna/ffjson)
-
-Benchmarking gave very slow results.
-It seems that it is assumed that the user will use the buffer pool properly.
-Also, development seems to have already stopped
-
-# Benchmarks
-
-```
-$ cd benchmarks
-$ go test -bench .
-```
-
-## Encode
-
-
-
-
-## Decode
-
-
-
-
-
-
-# Fuzzing
-
-[go-json-fuzz](https://github.com/goccy/go-json-fuzz) is the repository for fuzzing tests.
-If you run the test in this repository and find a bug, please commit to corpus to go-json-fuzz and report the issue to [go-json](https://github.com/goccy/go-json/issues).
-
-# How it works
-
-`go-json` is very fast in both encoding and decoding compared to other libraries.
-It's easier to implement by using automatic code generation for performance or by using a dedicated interface, but `go-json` dares to stick to compatibility with `encoding/json` and is the simple interface. Despite this, we are developing with the aim of being the fastest library.
-
-Here, we explain the various speed-up techniques implemented by `go-json`.
-
-## Basic technique
-
-The techniques listed here are the ones used by most of the libraries listed above.
-
-### Buffer reuse
-
-Since the only value required for the result of `json.Marshal(interface{}) ([]byte, error)` is `[]byte`, the only value that must be allocated during encoding is the return value `[]byte` .
-
-Also, as the number of allocations increases, the performance will be affected, so the number of allocations should be kept as low as possible when creating `[]byte`.
-
-Therefore, there is a technique to reduce the number of times a new buffer must be allocated by reusing the buffer used for the previous encoding by using `sync.Pool`.
-
-Finally, you allocate a buffer that is as long as the resulting buffer and copy the contents into it, you only need to allocate the buffer once in theory.
-
-```go
-type buffer struct {
- data []byte
-}
-
-var bufPool = sync.Pool{
- New: func() interface{} {
- return &buffer{data: make([]byte, 0, 1024)}
- },
-}
-
-buf := bufPool.Get().(*buffer)
-data := encode(buf.data) // reuse buf.data
-
-newBuf := make([]byte, len(data))
-copy(newBuf, buf)
-
-buf.data = data
-bufPool.Put(buf)
-```
-
-### Elimination of reflection
-
-As you know, the reflection operation is very slow.
-
-Therefore, using the fact that the address position where the type information is stored is fixed for each binary ( we call this `typeptr` ),
-we can use the address in the type information to call a pre-built optimized process.
-
-For example, you can get the address to the type information from `interface{}` as follows and you can use that information to call a process that does not have reflection.
-
-To process without reflection, pass a pointer (`unsafe.Pointer`) to the value is stored.
-
-```go
-
-type emptyInterface struct {
- typ unsafe.Pointer
- ptr unsafe.Pointer
-}
-
-var typeToEncoder = map[uintptr]func(unsafe.Pointer)([]byte, error){}
-
-func Marshal(v interface{}) ([]byte, error) {
- iface := (*emptyInterface)(unsafe.Pointer(&v)
- typeptr := uintptr(iface.typ)
- if enc, exists := typeToEncoder[typeptr]; exists {
- return enc(iface.ptr)
- }
- ...
-}
-```
-
-※ In reality, `typeToEncoder` can be referenced by multiple goroutines, so exclusive control is required.
-
-## Unique speed-up technique
-
-## Encoder
-
-### Do not escape arguments of `Marshal`
-
-`json.Marshal` and `json.Unmarshal` receive `interface{}` value and they perform type determination dynamically to process.
-In normal case, you need to use the `reflect` library to determine the type dynamically, but since `reflect.Type` is defined as `interface`, when you call the method of `reflect.Type`, The reflect's argument is escaped.
-
-Therefore, the arguments for `Marshal` and `Unmarshal` are always escaped to the heap.
-However, `go-json` can use the feature of `reflect.Type` while avoiding escaping.
-
-`reflect.Type` is defined as `interface`, but in reality `reflect.Type` is implemented only by the structure `rtype` defined in the `reflect` package.
-For this reason, to date `reflect.Type` is the same as `*reflect.rtype`.
-
-Therefore, by directly handling `*reflect.rtype`, which is an implementation of `reflect.Type`, it is possible to avoid escaping because it changes from `interface` to using `struct`.
-
-The technique for working with `*reflect.rtype` directly from `go-json` is implemented at [rtype.go](https://github.com/goccy/go-json/blob/master/internal/runtime/rtype.go)
-
-Also, the same technique is cut out as a library ( https://github.com/goccy/go-reflect )
-
-Initially this feature was the default behavior of `go-json`.
-But after careful testing, I found that I passed a large value to `json.Marshal()` and if the argument could not be assigned to the stack, it could not be properly escaped to the heap (a bug in the Go compiler).
-
-Therefore, this feature will be provided as an **optional** until this issue is resolved.
-
-To use it, add `NoEscape` like `MarshalNoEscape()`
-
-### Encoding using opcode sequence
-
-I explained that you can use `typeptr` to call a pre-built process from type information.
-
-In other libraries, this dedicated process is processed by making it an function calling like anonymous function, but function calls are inherently slow processes and should be avoided as much as possible.
-
-Therefore, `go-json` adopted the Instruction-based execution processing system, which is also used to implement virtual machines for programming language.
-
-If it is the first type to encode, create the opcode ( instruction ) sequence required for encoding.
-From the second time onward, use `typeptr` to get the cached pre-built opcode sequence and encode it based on it. An example of the opcode sequence is shown below.
-
-```go
-json.Marshal(struct{
- X int `json:"x"`
- Y string `json:"y"`
-}{X: 1, Y: "hello"})
-```
-
-When encoding a structure like the one above, create a sequence of opcodes like this:
-
-```
-- opStructFieldHead ( `{` )
-- opStructFieldInt ( `"x": 1,` )
-- opStructFieldString ( `"y": "hello"` )
-- opStructEnd ( `}` )
-- opEnd
-```
-
-※ When processing each operation, write the letters on the right.
-
-In addition, each opcode is managed by the following structure (
-Pseudo code ).
-
-```go
-type opType int
-const (
- opStructFieldHead opType = iota
- opStructFieldInt
- opStructFieldStirng
- opStructEnd
- opEnd
-)
-type opcode struct {
- op opType
- key []byte
- next *opcode
-}
-```
-
-The process of encoding using the opcode sequence is roughly implemented as follows.
-
-```go
-func encode(code *opcode, b []byte, p unsafe.Pointer) ([]byte, error) {
- for {
- switch code.op {
- case opStructFieldHead:
- b = append(b, '{')
- code = code.next
- case opStructFieldInt:
- b = append(b, code.key...)
- b = appendInt((*int)(unsafe.Pointer(uintptr(p)+code.offset)))
- code = code.next
- case opStructFieldString:
- b = append(b, code.key...)
- b = appendString((*string)(unsafe.Pointer(uintptr(p)+code.offset)))
- code = code.next
- case opStructEnd:
- b = append(b, '}')
- code = code.next
- case opEnd:
- goto END
- }
- }
-END:
- return b, nil
-}
-```
-
-In this way, the huge `switch-case` is used to encode by manipulating the linked list opcodes to avoid unnecessary function calls.
-
-### Opcode sequence optimization
-
-One of the advantages of encoding using the opcode sequence is the ease of optimization.
-The opcode sequence mentioned above is actually converted into the following optimized operations and used.
-
-```
-- opStructFieldHeadInt ( `{"x": 1,` )
-- opStructEndString ( `"y": "hello"}` )
-- opEnd
-```
-
-It has been reduced from 5 opcodes to 3 opcodes !
-Reducing the number of opcodees means reducing the number of branches with `switch-case`.
-In other words, the closer the number of operations is to 1, the faster the processing can be performed.
-
-In `go-json`, optimization to reduce the number of opcodes itself like the above and it speeds up by preparing opcodes with optimized paths.
-
-### Change recursive call from CALL to JMP
-
-Recursive processing is required during encoding if the type is defined recursively as follows:
-
-```go
-type T struct {
- X int
- U *U
-}
-
-type U struct {
- T *T
-}
-
-b, err := json.Marshal(&T{
- X: 1,
- U: &U{
- T: &T{
- X: 2,
- },
- },
-})
-fmt.Println(string(b)) // {"X":1,"U":{"T":{"X":2,"U":null}}}
-```
-
-In `go-json`, recursive processing is processed by the operation type of ` opStructFieldRecursive`.
-
-In this operation, after acquiring the opcode sequence used for recursive processing, the function is **not** called recursively as it is, but the necessary values are saved by itself and implemented by moving to the next operation.
-
-The technique of implementing recursive processing with the `JMP` operation while avoiding the `CALL` operation is a famous technique for implementing a high-speed virtual machine.
-
-For more details, please refer to [the article](https://engineering.mercari.com/blog/entry/1599563768-081104c850) ( but Japanese only ).
-
-### Dispatch by typeptr from map to slice
-
-When retrieving the data cached from the type information by `typeptr`, we usually use map.
-Map requires exclusive control, so use `sync.Map` for a naive implementation.
-
-However, this is slow, so it's a good idea to use the `atomic` package for exclusive control as implemented by `segmentio/encoding/json` ( https://github.com/segmentio/encoding/blob/master/json/codec.go#L41-L55 ).
-
-This implementation slows down the set instead of speeding up the get, but it works well because of the nature of the library, it encodes much more for the same type.
-
-However, as a result of profiling, I noticed that `runtime.mapaccess2` accounts for a significant percentage of the execution time. So I thought if I could change the lookup from map to slice.
-
-There is an API named `typelinks` defined in the `runtime` package that the `reflect` package uses internally.
-This allows you to get all the type information defined in the binary at runtime.
-
-The fact that all type information can be acquired means that by constructing slices in advance with the acquired total number of type information, it is possible to look up with the value of `typeptr` without worrying about out-of-range access.
-
-However, if there is too much type information, it will use a lot of memory, so by default we will only use this optimization if the slice size fits within **2Mib** .
-
-If this approach is not available, it will fall back to the `atomic` based process described above.
-
-If you want to know more, please refer to the implementation [here](https://github.com/goccy/go-json/blob/master/internal/runtime/type.go#L36-L100)
-
-## Decoder
-
-### Dispatch by typeptr from map to slice
-
-Like the encoder, the decoder also uses typeptr to call the dedicated process.
-
-### Faster termination character inspection using NUL character
-
-In order to decode, you have to traverse the input buffer character by position.
-At that time, if you check whether the buffer has reached the end, it will be very slow.
-
-`buf` : `[]byte` type variable. holds the string passed to the decoder
-`cursor` : `int64` type variable. holds the current read position
-
-```go
-buflen := len(buf)
-for ; cursor < buflen; cursor++ { // compare cursor and buflen at all times, it is so slow.
- switch buf[cursor] {
- case ' ', '\n', '\r', '\t':
- }
-}
-```
-
-Therefore, by adding the `NUL` (`\000`) character to the end of the read buffer as shown below, it is possible to check the termination character at the same time as other characters.
-
-```go
-for {
- switch buf[cursor] {
- case ' ', '\n', '\r', '\t':
- case '\000':
- return nil
- }
- cursor++
-}
-```
-
-### Use Boundary Check Elimination
-
-Due to the `NUL` character optimization, the Go compiler does a boundary check every time, even though `buf[cursor]` does not cause out-of-range access.
-
-Therefore, `go-json` eliminates boundary check by fetching characters for hotspot by pointer operation. For example, the following code.
-
-```go
-func char(ptr unsafe.Pointer, offset int64) byte {
- return *(*byte)(unsafe.Pointer(uintptr(ptr) + uintptr(offset)))
-}
-
-p := (*sliceHeader)(&unsafe.Pointer(buf)).data
-for {
- switch char(p, cursor) {
- case ' ', '\n', '\r', '\t':
- case '\000':
- return nil
- }
- cursor++
-}
-```
-
-### Checking the existence of fields of struct using Bitmaps
-
-I found by the profiling result, in the struct decode, lookup process for field was taking a long time.
-
-For example, consider decoding a string like `{"a":1,"b":2,"c":3}` into the following structure:
-
-```go
-type T struct {
- A int `json:"a"`
- B int `json:"b"`
- C int `json:"c"`
-}
-```
-
-At this time, it was found that it takes a lot of time to acquire the decoding process corresponding to the field from the field name as shown below during the decoding process.
-
-```go
-fieldName := decodeKey(buf, cursor) // "a" or "b" or "c"
-decoder, exists := fieldToDecoderMap[fieldName] // so slow
-if exists {
- decoder(buf, cursor)
-} else {
- skipValue(buf, cursor)
-}
-```
-
-To improve this process, `json-iterator/go` is optimized so that it can be branched by switch-case when the number of fields in the structure is 10 or less (switch-case is faster than map). However, there is a risk of hash collision because the value hashed by the FNV algorithm is used for conditional branching. Also, `gojay` processes this part at high speed by letting the library user yourself write `switch-case`.
-
-
-`go-json` considers and implements a new approach that is different from these. I call this **bitmap field optimization**.
-
-The range of values per character can be represented by `[256]byte`. Also, if the number of fields in the structure is 8 or less, `int8` type can represent the state of each field.
-In other words, it has the following structure.
-
-- Base ( 8bit ): `00000000`
-- Key "a": `00000001` ( assign key "a" to the first bit )
-- Key "b": `00000010` ( assign key "b" to the second bit )
-- Key "c": `00000100` ( assign key "c" to the third bit )
-
-Bitmap structure is the following
-
-```
- | key index(0) |
-------------------------
- 0 | 00000000 |
- 1 | 00000000 |
-~~ | |
-97 (a) | 00000001 |
-98 (b) | 00000010 |
-99 (c) | 00000100 |
-~~ | |
-255 | 00000000 |
-```
-
-You can think of this as a Bitmap with a height of `256` and a width of the maximum string length in the field name.
-In other words, it can be represented by the following type .
-
-```go
-[maxFieldKeyLength][256]int8
-```
-
-When decoding a field character, check whether the corresponding character exists by referring to the pre-built bitmap like the following.
-
-```go
-var curBit int8 = math.MaxInt8 // 11111111
-
-c := char(buf, cursor)
-bit := bitmap[keyIdx][c]
-curBit &= bit
-if curBit == 0 {
- // not found field
-}
-```
-
-If `curBit` is not `0` until the end of the field string, then the string is
-You may have hit one of the fields.
-But the possibility is that if the decoded string is shorter than the field string, you will get a false hit.
-
-- input: `{"a":1}`
-```go
-type T struct {
- X int `json:"abc"`
-}
-```
-※ Since `a` is shorter than `abc`, it can decode to the end of the field character without `curBit` being 0.
-
-Rest assured. In this case, it doesn't matter because you can tell if you hit by comparing the string length of `a` with the string length of `abc`.
-
-Finally, calculate the position of the bit where `1` is set and get the corresponding value, and you're done.
-
-Using this technique, field lookups are possible with only bitwise operations and access to slices.
-
-`go-json` uses a similar technique for fields with 9 or more and 16 or less fields. At this time, Bitmap is constructed as `[maxKeyLen][256]int16` type.
-
-Currently, this optimization is not performed when the maximum length of the field name is long (specifically, 64 bytes or more) in addition to the limitation of the number of fields from the viewpoint of saving memory usage.
-
-### Others
-
-I have done a lot of other optimizations. I will find time to write about them. If you have any questions about what's written here or other optimizations, please visit the `#go-json` channel on `gophers.slack.com` .
-
-## Reference
-
-Regarding the story of go-json, there are the following articles in Japanese only.
-
-- https://speakerdeck.com/goccy/zui-su-falsejsonraiburariwoqiu-mete
-- https://engineering.mercari.com/blog/entry/1599563768-081104c850/
-
-# Looking for Sponsors
-
-I'm looking for sponsors this library. This library is being developed as a personal project in my spare time. If you want a quick response or problem resolution when using this library in your project, please register as a [sponsor](https://github.com/sponsors/goccy). I will cooperate as much as possible. Of course, this library is developed as an MIT license, so you can use it freely for free.
-
-# License
-
-MIT
diff --git a/vendor/github.com/goccy/go-json/color.go b/vendor/github.com/goccy/go-json/color.go
deleted file mode 100644
index e80b22b4869..00000000000
--- a/vendor/github.com/goccy/go-json/color.go
+++ /dev/null
@@ -1,68 +0,0 @@
-package json
-
-import (
- "fmt"
-
- "github.com/goccy/go-json/internal/encoder"
-)
-
-type (
- ColorFormat = encoder.ColorFormat
- ColorScheme = encoder.ColorScheme
-)
-
-const escape = "\x1b"
-
-type colorAttr int
-
-//nolint:deadcode,varcheck
-const (
- fgBlackColor colorAttr = iota + 30
- fgRedColor
- fgGreenColor
- fgYellowColor
- fgBlueColor
- fgMagentaColor
- fgCyanColor
- fgWhiteColor
-)
-
-//nolint:deadcode,varcheck
-const (
- fgHiBlackColor colorAttr = iota + 90
- fgHiRedColor
- fgHiGreenColor
- fgHiYellowColor
- fgHiBlueColor
- fgHiMagentaColor
- fgHiCyanColor
- fgHiWhiteColor
-)
-
-func createColorFormat(attr colorAttr) ColorFormat {
- return ColorFormat{
- Header: wrapColor(attr),
- Footer: resetColor(),
- }
-}
-
-func wrapColor(attr colorAttr) string {
- return fmt.Sprintf("%s[%dm", escape, attr)
-}
-
-func resetColor() string {
- return wrapColor(colorAttr(0))
-}
-
-var (
- DefaultColorScheme = &ColorScheme{
- Int: createColorFormat(fgHiMagentaColor),
- Uint: createColorFormat(fgHiMagentaColor),
- Float: createColorFormat(fgHiMagentaColor),
- Bool: createColorFormat(fgHiYellowColor),
- String: createColorFormat(fgHiGreenColor),
- Binary: createColorFormat(fgHiRedColor),
- ObjectKey: createColorFormat(fgHiCyanColor),
- Null: createColorFormat(fgBlueColor),
- }
-)
diff --git a/vendor/github.com/goccy/go-json/decode.go b/vendor/github.com/goccy/go-json/decode.go
deleted file mode 100644
index 74c6ac3bcad..00000000000
--- a/vendor/github.com/goccy/go-json/decode.go
+++ /dev/null
@@ -1,263 +0,0 @@
-package json
-
-import (
- "context"
- "fmt"
- "io"
- "reflect"
- "unsafe"
-
- "github.com/goccy/go-json/internal/decoder"
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type Decoder struct {
- s *decoder.Stream
-}
-
-const (
- nul = '\000'
-)
-
-type emptyInterface struct {
- typ *runtime.Type
- ptr unsafe.Pointer
-}
-
-func unmarshal(data []byte, v interface{}, optFuncs ...DecodeOptionFunc) error {
- src := make([]byte, len(data)+1) // append nul byte to the end
- copy(src, data)
-
- header := (*emptyInterface)(unsafe.Pointer(&v))
-
- if err := validateType(header.typ, uintptr(header.ptr)); err != nil {
- return err
- }
- dec, err := decoder.CompileToGetDecoder(header.typ)
- if err != nil {
- return err
- }
- ctx := decoder.TakeRuntimeContext()
- ctx.Buf = src
- ctx.Option.Flags = 0
- for _, optFunc := range optFuncs {
- optFunc(ctx.Option)
- }
- cursor, err := dec.Decode(ctx, 0, 0, header.ptr)
- if err != nil {
- decoder.ReleaseRuntimeContext(ctx)
- return err
- }
- decoder.ReleaseRuntimeContext(ctx)
- return validateEndBuf(src, cursor)
-}
-
-func unmarshalContext(ctx context.Context, data []byte, v interface{}, optFuncs ...DecodeOptionFunc) error {
- src := make([]byte, len(data)+1) // append nul byte to the end
- copy(src, data)
-
- header := (*emptyInterface)(unsafe.Pointer(&v))
-
- if err := validateType(header.typ, uintptr(header.ptr)); err != nil {
- return err
- }
- dec, err := decoder.CompileToGetDecoder(header.typ)
- if err != nil {
- return err
- }
- rctx := decoder.TakeRuntimeContext()
- rctx.Buf = src
- rctx.Option.Flags = 0
- rctx.Option.Flags |= decoder.ContextOption
- rctx.Option.Context = ctx
- for _, optFunc := range optFuncs {
- optFunc(rctx.Option)
- }
- cursor, err := dec.Decode(rctx, 0, 0, header.ptr)
- if err != nil {
- decoder.ReleaseRuntimeContext(rctx)
- return err
- }
- decoder.ReleaseRuntimeContext(rctx)
- return validateEndBuf(src, cursor)
-}
-
-var (
- pathDecoder = decoder.NewPathDecoder()
-)
-
-func extractFromPath(path *Path, data []byte, optFuncs ...DecodeOptionFunc) ([][]byte, error) {
- if path.path.RootSelectorOnly {
- return [][]byte{data}, nil
- }
- src := make([]byte, len(data)+1) // append nul byte to the end
- copy(src, data)
-
- ctx := decoder.TakeRuntimeContext()
- ctx.Buf = src
- ctx.Option.Flags = 0
- ctx.Option.Flags |= decoder.PathOption
- ctx.Option.Path = path.path
- for _, optFunc := range optFuncs {
- optFunc(ctx.Option)
- }
- paths, cursor, err := pathDecoder.DecodePath(ctx, 0, 0)
- if err != nil {
- decoder.ReleaseRuntimeContext(ctx)
- return nil, err
- }
- decoder.ReleaseRuntimeContext(ctx)
- if err := validateEndBuf(src, cursor); err != nil {
- return nil, err
- }
- return paths, nil
-}
-
-func unmarshalNoEscape(data []byte, v interface{}, optFuncs ...DecodeOptionFunc) error {
- src := make([]byte, len(data)+1) // append nul byte to the end
- copy(src, data)
-
- header := (*emptyInterface)(unsafe.Pointer(&v))
-
- if err := validateType(header.typ, uintptr(header.ptr)); err != nil {
- return err
- }
- dec, err := decoder.CompileToGetDecoder(header.typ)
- if err != nil {
- return err
- }
-
- ctx := decoder.TakeRuntimeContext()
- ctx.Buf = src
- ctx.Option.Flags = 0
- for _, optFunc := range optFuncs {
- optFunc(ctx.Option)
- }
- cursor, err := dec.Decode(ctx, 0, 0, noescape(header.ptr))
- if err != nil {
- decoder.ReleaseRuntimeContext(ctx)
- return err
- }
- decoder.ReleaseRuntimeContext(ctx)
- return validateEndBuf(src, cursor)
-}
-
-func validateEndBuf(src []byte, cursor int64) error {
- for {
- switch src[cursor] {
- case ' ', '\t', '\n', '\r':
- cursor++
- continue
- case nul:
- return nil
- }
- return errors.ErrSyntax(
- fmt.Sprintf("invalid character '%c' after top-level value", src[cursor]),
- cursor+1,
- )
- }
-}
-
-//nolint:staticcheck
-//go:nosplit
-func noescape(p unsafe.Pointer) unsafe.Pointer {
- x := uintptr(p)
- return unsafe.Pointer(x ^ 0)
-}
-
-func validateType(typ *runtime.Type, p uintptr) error {
- if typ == nil || typ.Kind() != reflect.Ptr || p == 0 {
- return &InvalidUnmarshalError{Type: runtime.RType2Type(typ)}
- }
- return nil
-}
-
-// NewDecoder returns a new decoder that reads from r.
-//
-// The decoder introduces its own buffering and may
-// read data from r beyond the JSON values requested.
-func NewDecoder(r io.Reader) *Decoder {
- s := decoder.NewStream(r)
- return &Decoder{
- s: s,
- }
-}
-
-// Buffered returns a reader of the data remaining in the Decoder's
-// buffer. The reader is valid until the next call to Decode.
-func (d *Decoder) Buffered() io.Reader {
- return d.s.Buffered()
-}
-
-// Decode reads the next JSON-encoded value from its
-// input and stores it in the value pointed to by v.
-//
-// See the documentation for Unmarshal for details about
-// the conversion of JSON into a Go value.
-func (d *Decoder) Decode(v interface{}) error {
- return d.DecodeWithOption(v)
-}
-
-// DecodeContext reads the next JSON-encoded value from its
-// input and stores it in the value pointed to by v with context.Context.
-func (d *Decoder) DecodeContext(ctx context.Context, v interface{}) error {
- d.s.Option.Flags |= decoder.ContextOption
- d.s.Option.Context = ctx
- return d.DecodeWithOption(v)
-}
-
-func (d *Decoder) DecodeWithOption(v interface{}, optFuncs ...DecodeOptionFunc) error {
- header := (*emptyInterface)(unsafe.Pointer(&v))
- typ := header.typ
- ptr := uintptr(header.ptr)
- typeptr := uintptr(unsafe.Pointer(typ))
- // noescape trick for header.typ ( reflect.*rtype )
- copiedType := *(**runtime.Type)(unsafe.Pointer(&typeptr))
-
- if err := validateType(copiedType, ptr); err != nil {
- return err
- }
-
- dec, err := decoder.CompileToGetDecoder(typ)
- if err != nil {
- return err
- }
- if err := d.s.PrepareForDecode(); err != nil {
- return err
- }
- s := d.s
- for _, optFunc := range optFuncs {
- optFunc(s.Option)
- }
- if err := dec.DecodeStream(s, 0, header.ptr); err != nil {
- return err
- }
- s.Reset()
- return nil
-}
-
-func (d *Decoder) More() bool {
- return d.s.More()
-}
-
-func (d *Decoder) Token() (Token, error) {
- return d.s.Token()
-}
-
-// DisallowUnknownFields causes the Decoder to return an error when the destination
-// is a struct and the input contains object keys which do not match any
-// non-ignored, exported fields in the destination.
-func (d *Decoder) DisallowUnknownFields() {
- d.s.DisallowUnknownFields = true
-}
-
-func (d *Decoder) InputOffset() int64 {
- return d.s.TotalOffset()
-}
-
-// UseNumber causes the Decoder to unmarshal a number into an interface{} as a
-// Number instead of as a float64.
-func (d *Decoder) UseNumber() {
- d.s.UseNumber = true
-}
diff --git a/vendor/github.com/goccy/go-json/docker-compose.yml b/vendor/github.com/goccy/go-json/docker-compose.yml
deleted file mode 100644
index db40c79ad5d..00000000000
--- a/vendor/github.com/goccy/go-json/docker-compose.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-version: '2'
-services:
- go-json:
- image: golang:1.18
- volumes:
- - '.:/go/src/go-json'
- deploy:
- resources:
- limits:
- memory: 620M
- working_dir: /go/src/go-json
- command: |
- sh -c "go test -c . && ls go-json.test"
diff --git a/vendor/github.com/goccy/go-json/encode.go b/vendor/github.com/goccy/go-json/encode.go
deleted file mode 100644
index c5173825a95..00000000000
--- a/vendor/github.com/goccy/go-json/encode.go
+++ /dev/null
@@ -1,326 +0,0 @@
-package json
-
-import (
- "context"
- "io"
- "os"
- "unsafe"
-
- "github.com/goccy/go-json/internal/encoder"
- "github.com/goccy/go-json/internal/encoder/vm"
- "github.com/goccy/go-json/internal/encoder/vm_color"
- "github.com/goccy/go-json/internal/encoder/vm_color_indent"
- "github.com/goccy/go-json/internal/encoder/vm_indent"
-)
-
-// An Encoder writes JSON values to an output stream.
-type Encoder struct {
- w io.Writer
- enabledIndent bool
- enabledHTMLEscape bool
- prefix string
- indentStr string
-}
-
-// NewEncoder returns a new encoder that writes to w.
-func NewEncoder(w io.Writer) *Encoder {
- return &Encoder{w: w, enabledHTMLEscape: true}
-}
-
-// Encode writes the JSON encoding of v to the stream, followed by a newline character.
-//
-// See the documentation for Marshal for details about the conversion of Go values to JSON.
-func (e *Encoder) Encode(v interface{}) error {
- return e.EncodeWithOption(v)
-}
-
-// EncodeWithOption call Encode with EncodeOption.
-func (e *Encoder) EncodeWithOption(v interface{}, optFuncs ...EncodeOptionFunc) error {
- ctx := encoder.TakeRuntimeContext()
- ctx.Option.Flag = 0
-
- err := e.encodeWithOption(ctx, v, optFuncs...)
-
- encoder.ReleaseRuntimeContext(ctx)
- return err
-}
-
-// EncodeContext call Encode with context.Context and EncodeOption.
-func (e *Encoder) EncodeContext(ctx context.Context, v interface{}, optFuncs ...EncodeOptionFunc) error {
- rctx := encoder.TakeRuntimeContext()
- rctx.Option.Flag = 0
- rctx.Option.Flag |= encoder.ContextOption
- rctx.Option.Context = ctx
-
- err := e.encodeWithOption(rctx, v, optFuncs...) //nolint: contextcheck
-
- encoder.ReleaseRuntimeContext(rctx)
- return err
-}
-
-func (e *Encoder) encodeWithOption(ctx *encoder.RuntimeContext, v interface{}, optFuncs ...EncodeOptionFunc) error {
- if e.enabledHTMLEscape {
- ctx.Option.Flag |= encoder.HTMLEscapeOption
- }
- ctx.Option.Flag |= encoder.NormalizeUTF8Option
- ctx.Option.DebugOut = os.Stdout
- for _, optFunc := range optFuncs {
- optFunc(ctx.Option)
- }
- var (
- buf []byte
- err error
- )
- if e.enabledIndent {
- buf, err = encodeIndent(ctx, v, e.prefix, e.indentStr)
- } else {
- buf, err = encode(ctx, v)
- }
- if err != nil {
- return err
- }
- if e.enabledIndent {
- buf = buf[:len(buf)-2]
- } else {
- buf = buf[:len(buf)-1]
- }
- buf = append(buf, '\n')
- if _, err := e.w.Write(buf); err != nil {
- return err
- }
- return nil
-}
-
-// SetEscapeHTML specifies whether problematic HTML characters should be escaped inside JSON quoted strings.
-// The default behavior is to escape &, <, and > to \u0026, \u003c, and \u003e to avoid certain safety problems that can arise when embedding JSON in HTML.
-//
-// In non-HTML settings where the escaping interferes with the readability of the output, SetEscapeHTML(false) disables this behavior.
-func (e *Encoder) SetEscapeHTML(on bool) {
- e.enabledHTMLEscape = on
-}
-
-// SetIndent instructs the encoder to format each subsequent encoded value as if indented by the package-level function Indent(dst, src, prefix, indent).
-// Calling SetIndent("", "") disables indentation.
-func (e *Encoder) SetIndent(prefix, indent string) {
- if prefix == "" && indent == "" {
- e.enabledIndent = false
- return
- }
- e.prefix = prefix
- e.indentStr = indent
- e.enabledIndent = true
-}
-
-func marshalContext(ctx context.Context, v interface{}, optFuncs ...EncodeOptionFunc) ([]byte, error) {
- rctx := encoder.TakeRuntimeContext()
- rctx.Option.Flag = 0
- rctx.Option.Flag = encoder.HTMLEscapeOption | encoder.NormalizeUTF8Option | encoder.ContextOption
- rctx.Option.Context = ctx
- for _, optFunc := range optFuncs {
- optFunc(rctx.Option)
- }
-
- buf, err := encode(rctx, v) //nolint: contextcheck
- if err != nil {
- encoder.ReleaseRuntimeContext(rctx)
- return nil, err
- }
-
- // this line exists to escape call of `runtime.makeslicecopy` .
- // if use `make([]byte, len(buf)-1)` and `copy(copied, buf)`,
- // dst buffer size and src buffer size are differrent.
- // in this case, compiler uses `runtime.makeslicecopy`, but it is slow.
- buf = buf[:len(buf)-1]
- copied := make([]byte, len(buf))
- copy(copied, buf)
-
- encoder.ReleaseRuntimeContext(rctx)
- return copied, nil
-}
-
-func marshal(v interface{}, optFuncs ...EncodeOptionFunc) ([]byte, error) {
- ctx := encoder.TakeRuntimeContext()
-
- ctx.Option.Flag = 0
- ctx.Option.Flag |= (encoder.HTMLEscapeOption | encoder.NormalizeUTF8Option)
- for _, optFunc := range optFuncs {
- optFunc(ctx.Option)
- }
-
- buf, err := encode(ctx, v)
- if err != nil {
- encoder.ReleaseRuntimeContext(ctx)
- return nil, err
- }
-
- // this line exists to escape call of `runtime.makeslicecopy` .
- // if use `make([]byte, len(buf)-1)` and `copy(copied, buf)`,
- // dst buffer size and src buffer size are differrent.
- // in this case, compiler uses `runtime.makeslicecopy`, but it is slow.
- buf = buf[:len(buf)-1]
- copied := make([]byte, len(buf))
- copy(copied, buf)
-
- encoder.ReleaseRuntimeContext(ctx)
- return copied, nil
-}
-
-func marshalNoEscape(v interface{}) ([]byte, error) {
- ctx := encoder.TakeRuntimeContext()
-
- ctx.Option.Flag = 0
- ctx.Option.Flag |= (encoder.HTMLEscapeOption | encoder.NormalizeUTF8Option)
-
- buf, err := encodeNoEscape(ctx, v)
- if err != nil {
- encoder.ReleaseRuntimeContext(ctx)
- return nil, err
- }
-
- // this line exists to escape call of `runtime.makeslicecopy` .
- // if use `make([]byte, len(buf)-1)` and `copy(copied, buf)`,
- // dst buffer size and src buffer size are differrent.
- // in this case, compiler uses `runtime.makeslicecopy`, but it is slow.
- buf = buf[:len(buf)-1]
- copied := make([]byte, len(buf))
- copy(copied, buf)
-
- encoder.ReleaseRuntimeContext(ctx)
- return copied, nil
-}
-
-func marshalIndent(v interface{}, prefix, indent string, optFuncs ...EncodeOptionFunc) ([]byte, error) {
- ctx := encoder.TakeRuntimeContext()
-
- ctx.Option.Flag = 0
- ctx.Option.Flag |= (encoder.HTMLEscapeOption | encoder.NormalizeUTF8Option | encoder.IndentOption)
- for _, optFunc := range optFuncs {
- optFunc(ctx.Option)
- }
-
- buf, err := encodeIndent(ctx, v, prefix, indent)
- if err != nil {
- encoder.ReleaseRuntimeContext(ctx)
- return nil, err
- }
-
- buf = buf[:len(buf)-2]
- copied := make([]byte, len(buf))
- copy(copied, buf)
-
- encoder.ReleaseRuntimeContext(ctx)
- return copied, nil
-}
-
-func encode(ctx *encoder.RuntimeContext, v interface{}) ([]byte, error) {
- b := ctx.Buf[:0]
- if v == nil {
- b = encoder.AppendNull(ctx, b)
- b = encoder.AppendComma(ctx, b)
- return b, nil
- }
- header := (*emptyInterface)(unsafe.Pointer(&v))
- typ := header.typ
-
- typeptr := uintptr(unsafe.Pointer(typ))
- codeSet, err := encoder.CompileToGetCodeSet(ctx, typeptr)
- if err != nil {
- return nil, err
- }
-
- p := uintptr(header.ptr)
- ctx.Init(p, codeSet.CodeLength)
- ctx.KeepRefs = append(ctx.KeepRefs, header.ptr)
-
- buf, err := encodeRunCode(ctx, b, codeSet)
- if err != nil {
- return nil, err
- }
- ctx.Buf = buf
- return buf, nil
-}
-
-func encodeNoEscape(ctx *encoder.RuntimeContext, v interface{}) ([]byte, error) {
- b := ctx.Buf[:0]
- if v == nil {
- b = encoder.AppendNull(ctx, b)
- b = encoder.AppendComma(ctx, b)
- return b, nil
- }
- header := (*emptyInterface)(unsafe.Pointer(&v))
- typ := header.typ
-
- typeptr := uintptr(unsafe.Pointer(typ))
- codeSet, err := encoder.CompileToGetCodeSet(ctx, typeptr)
- if err != nil {
- return nil, err
- }
-
- p := uintptr(header.ptr)
- ctx.Init(p, codeSet.CodeLength)
- buf, err := encodeRunCode(ctx, b, codeSet)
- if err != nil {
- return nil, err
- }
-
- ctx.Buf = buf
- return buf, nil
-}
-
-func encodeIndent(ctx *encoder.RuntimeContext, v interface{}, prefix, indent string) ([]byte, error) {
- b := ctx.Buf[:0]
- if v == nil {
- b = encoder.AppendNull(ctx, b)
- b = encoder.AppendCommaIndent(ctx, b)
- return b, nil
- }
- header := (*emptyInterface)(unsafe.Pointer(&v))
- typ := header.typ
-
- typeptr := uintptr(unsafe.Pointer(typ))
- codeSet, err := encoder.CompileToGetCodeSet(ctx, typeptr)
- if err != nil {
- return nil, err
- }
-
- p := uintptr(header.ptr)
- ctx.Init(p, codeSet.CodeLength)
- buf, err := encodeRunIndentCode(ctx, b, codeSet, prefix, indent)
-
- ctx.KeepRefs = append(ctx.KeepRefs, header.ptr)
-
- if err != nil {
- return nil, err
- }
-
- ctx.Buf = buf
- return buf, nil
-}
-
-func encodeRunCode(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) {
- if (ctx.Option.Flag & encoder.DebugOption) != 0 {
- if (ctx.Option.Flag & encoder.ColorizeOption) != 0 {
- return vm_color.DebugRun(ctx, b, codeSet)
- }
- return vm.DebugRun(ctx, b, codeSet)
- }
- if (ctx.Option.Flag & encoder.ColorizeOption) != 0 {
- return vm_color.Run(ctx, b, codeSet)
- }
- return vm.Run(ctx, b, codeSet)
-}
-
-func encodeRunIndentCode(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, prefix, indent string) ([]byte, error) {
- ctx.Prefix = []byte(prefix)
- ctx.IndentStr = []byte(indent)
- if (ctx.Option.Flag & encoder.DebugOption) != 0 {
- if (ctx.Option.Flag & encoder.ColorizeOption) != 0 {
- return vm_color_indent.DebugRun(ctx, b, codeSet)
- }
- return vm_indent.DebugRun(ctx, b, codeSet)
- }
- if (ctx.Option.Flag & encoder.ColorizeOption) != 0 {
- return vm_color_indent.Run(ctx, b, codeSet)
- }
- return vm_indent.Run(ctx, b, codeSet)
-}
diff --git a/vendor/github.com/goccy/go-json/error.go b/vendor/github.com/goccy/go-json/error.go
deleted file mode 100644
index 5b2dcee50ec..00000000000
--- a/vendor/github.com/goccy/go-json/error.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package json
-
-import (
- "github.com/goccy/go-json/internal/errors"
-)
-
-// Before Go 1.2, an InvalidUTF8Error was returned by Marshal when
-// attempting to encode a string value with invalid UTF-8 sequences.
-// As of Go 1.2, Marshal instead coerces the string to valid UTF-8 by
-// replacing invalid bytes with the Unicode replacement rune U+FFFD.
-//
-// Deprecated: No longer used; kept for compatibility.
-type InvalidUTF8Error = errors.InvalidUTF8Error
-
-// An InvalidUnmarshalError describes an invalid argument passed to Unmarshal.
-// (The argument to Unmarshal must be a non-nil pointer.)
-type InvalidUnmarshalError = errors.InvalidUnmarshalError
-
-// A MarshalerError represents an error from calling a MarshalJSON or MarshalText method.
-type MarshalerError = errors.MarshalerError
-
-// A SyntaxError is a description of a JSON syntax error.
-type SyntaxError = errors.SyntaxError
-
-// An UnmarshalFieldError describes a JSON object key that
-// led to an unexported (and therefore unwritable) struct field.
-//
-// Deprecated: No longer used; kept for compatibility.
-type UnmarshalFieldError = errors.UnmarshalFieldError
-
-// An UnmarshalTypeError describes a JSON value that was
-// not appropriate for a value of a specific Go type.
-type UnmarshalTypeError = errors.UnmarshalTypeError
-
-// An UnsupportedTypeError is returned by Marshal when attempting
-// to encode an unsupported value type.
-type UnsupportedTypeError = errors.UnsupportedTypeError
-
-type UnsupportedValueError = errors.UnsupportedValueError
-
-type PathError = errors.PathError
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/anonymous_field.go b/vendor/github.com/goccy/go-json/internal/decoder/anonymous_field.go
deleted file mode 100644
index b6876cf0d04..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/anonymous_field.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package decoder
-
-import (
- "unsafe"
-
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type anonymousFieldDecoder struct {
- structType *runtime.Type
- offset uintptr
- dec Decoder
-}
-
-func newAnonymousFieldDecoder(structType *runtime.Type, offset uintptr, dec Decoder) *anonymousFieldDecoder {
- return &anonymousFieldDecoder{
- structType: structType,
- offset: offset,
- dec: dec,
- }
-}
-
-func (d *anonymousFieldDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- if *(*unsafe.Pointer)(p) == nil {
- *(*unsafe.Pointer)(p) = unsafe_New(d.structType)
- }
- p = *(*unsafe.Pointer)(p)
- return d.dec.DecodeStream(s, depth, unsafe.Pointer(uintptr(p)+d.offset))
-}
-
-func (d *anonymousFieldDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- if *(*unsafe.Pointer)(p) == nil {
- *(*unsafe.Pointer)(p) = unsafe_New(d.structType)
- }
- p = *(*unsafe.Pointer)(p)
- return d.dec.Decode(ctx, cursor, depth, unsafe.Pointer(uintptr(p)+d.offset))
-}
-
-func (d *anonymousFieldDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- return d.dec.DecodePath(ctx, cursor, depth)
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/array.go b/vendor/github.com/goccy/go-json/internal/decoder/array.go
deleted file mode 100644
index 4b23ed43fe2..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/array.go
+++ /dev/null
@@ -1,176 +0,0 @@
-package decoder
-
-import (
- "fmt"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type arrayDecoder struct {
- elemType *runtime.Type
- size uintptr
- valueDecoder Decoder
- alen int
- structName string
- fieldName string
- zeroValue unsafe.Pointer
-}
-
-func newArrayDecoder(dec Decoder, elemType *runtime.Type, alen int, structName, fieldName string) *arrayDecoder {
- // workaround to avoid checkptr errors. cannot use `*(*unsafe.Pointer)(unsafe_New(elemType))` directly.
- zeroValuePtr := unsafe_New(elemType)
- zeroValue := **(**unsafe.Pointer)(unsafe.Pointer(&zeroValuePtr))
- return &arrayDecoder{
- valueDecoder: dec,
- elemType: elemType,
- size: elemType.Size(),
- alen: alen,
- structName: structName,
- fieldName: fieldName,
- zeroValue: zeroValue,
- }
-}
-
-func (d *arrayDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- depth++
- if depth > maxDecodeNestingDepth {
- return errors.ErrExceededMaxDepth(s.char(), s.cursor)
- }
-
- for {
- switch s.char() {
- case ' ', '\n', '\t', '\r':
- case 'n':
- if err := nullBytes(s); err != nil {
- return err
- }
- return nil
- case '[':
- idx := 0
- s.cursor++
- if s.skipWhiteSpace() == ']' {
- for idx < d.alen {
- *(*unsafe.Pointer)(unsafe.Pointer(uintptr(p) + uintptr(idx)*d.size)) = d.zeroValue
- idx++
- }
- s.cursor++
- return nil
- }
- for {
- if idx < d.alen {
- if err := d.valueDecoder.DecodeStream(s, depth, unsafe.Pointer(uintptr(p)+uintptr(idx)*d.size)); err != nil {
- return err
- }
- } else {
- if err := s.skipValue(depth); err != nil {
- return err
- }
- }
- idx++
- switch s.skipWhiteSpace() {
- case ']':
- for idx < d.alen {
- *(*unsafe.Pointer)(unsafe.Pointer(uintptr(p) + uintptr(idx)*d.size)) = d.zeroValue
- idx++
- }
- s.cursor++
- return nil
- case ',':
- s.cursor++
- continue
- case nul:
- if s.read() {
- s.cursor++
- continue
- }
- goto ERROR
- default:
- goto ERROR
- }
- }
- case nul:
- if s.read() {
- continue
- }
- goto ERROR
- default:
- goto ERROR
- }
- s.cursor++
- }
-ERROR:
- return errors.ErrUnexpectedEndOfJSON("array", s.totalOffset())
-}
-
-func (d *arrayDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- buf := ctx.Buf
- depth++
- if depth > maxDecodeNestingDepth {
- return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor)
- }
-
- for {
- switch buf[cursor] {
- case ' ', '\n', '\t', '\r':
- cursor++
- continue
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 4
- return cursor, nil
- case '[':
- idx := 0
- cursor++
- cursor = skipWhiteSpace(buf, cursor)
- if buf[cursor] == ']' {
- for idx < d.alen {
- *(*unsafe.Pointer)(unsafe.Pointer(uintptr(p) + uintptr(idx)*d.size)) = d.zeroValue
- idx++
- }
- cursor++
- return cursor, nil
- }
- for {
- if idx < d.alen {
- c, err := d.valueDecoder.Decode(ctx, cursor, depth, unsafe.Pointer(uintptr(p)+uintptr(idx)*d.size))
- if err != nil {
- return 0, err
- }
- cursor = c
- } else {
- c, err := skipValue(buf, cursor, depth)
- if err != nil {
- return 0, err
- }
- cursor = c
- }
- idx++
- cursor = skipWhiteSpace(buf, cursor)
- switch buf[cursor] {
- case ']':
- for idx < d.alen {
- *(*unsafe.Pointer)(unsafe.Pointer(uintptr(p) + uintptr(idx)*d.size)) = d.zeroValue
- idx++
- }
- cursor++
- return cursor, nil
- case ',':
- cursor++
- continue
- default:
- return 0, errors.ErrInvalidCharacter(buf[cursor], "array", cursor)
- }
- }
- default:
- return 0, errors.ErrUnexpectedEndOfJSON("array", cursor)
- }
- }
-}
-
-func (d *arrayDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- return nil, 0, fmt.Errorf("json: array decoder does not support decode path")
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/assign.go b/vendor/github.com/goccy/go-json/internal/decoder/assign.go
deleted file mode 100644
index c53e6ad9fc5..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/assign.go
+++ /dev/null
@@ -1,438 +0,0 @@
-package decoder
-
-import (
- "fmt"
- "reflect"
- "strconv"
-)
-
-var (
- nilValue = reflect.ValueOf(nil)
-)
-
-func AssignValue(src, dst reflect.Value) error {
- if dst.Type().Kind() != reflect.Ptr {
- return fmt.Errorf("invalid dst type. required pointer type: %T", dst.Type())
- }
- casted, err := castValue(dst.Elem().Type(), src)
- if err != nil {
- return err
- }
- dst.Elem().Set(casted)
- return nil
-}
-
-func castValue(t reflect.Type, v reflect.Value) (reflect.Value, error) {
- switch t.Kind() {
- case reflect.Int:
- vv, err := castInt(v)
- if err != nil {
- return nilValue, err
- }
- return reflect.ValueOf(int(vv.Int())), nil
- case reflect.Int8:
- vv, err := castInt(v)
- if err != nil {
- return nilValue, err
- }
- return reflect.ValueOf(int8(vv.Int())), nil
- case reflect.Int16:
- vv, err := castInt(v)
- if err != nil {
- return nilValue, err
- }
- return reflect.ValueOf(int16(vv.Int())), nil
- case reflect.Int32:
- vv, err := castInt(v)
- if err != nil {
- return nilValue, err
- }
- return reflect.ValueOf(int32(vv.Int())), nil
- case reflect.Int64:
- return castInt(v)
- case reflect.Uint:
- vv, err := castUint(v)
- if err != nil {
- return nilValue, err
- }
- return reflect.ValueOf(uint(vv.Uint())), nil
- case reflect.Uint8:
- vv, err := castUint(v)
- if err != nil {
- return nilValue, err
- }
- return reflect.ValueOf(uint8(vv.Uint())), nil
- case reflect.Uint16:
- vv, err := castUint(v)
- if err != nil {
- return nilValue, err
- }
- return reflect.ValueOf(uint16(vv.Uint())), nil
- case reflect.Uint32:
- vv, err := castUint(v)
- if err != nil {
- return nilValue, err
- }
- return reflect.ValueOf(uint32(vv.Uint())), nil
- case reflect.Uint64:
- return castUint(v)
- case reflect.Uintptr:
- vv, err := castUint(v)
- if err != nil {
- return nilValue, err
- }
- return reflect.ValueOf(uintptr(vv.Uint())), nil
- case reflect.String:
- return castString(v)
- case reflect.Bool:
- return castBool(v)
- case reflect.Float32:
- vv, err := castFloat(v)
- if err != nil {
- return nilValue, err
- }
- return reflect.ValueOf(float32(vv.Float())), nil
- case reflect.Float64:
- return castFloat(v)
- case reflect.Array:
- return castArray(t, v)
- case reflect.Slice:
- return castSlice(t, v)
- case reflect.Map:
- return castMap(t, v)
- case reflect.Struct:
- return castStruct(t, v)
- }
- return v, nil
-}
-
-func castInt(v reflect.Value) (reflect.Value, error) {
- switch v.Type().Kind() {
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return v, nil
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return reflect.ValueOf(int64(v.Uint())), nil
- case reflect.String:
- i64, err := strconv.ParseInt(v.String(), 10, 64)
- if err != nil {
- return nilValue, err
- }
- return reflect.ValueOf(i64), nil
- case reflect.Bool:
- if v.Bool() {
- return reflect.ValueOf(int64(1)), nil
- }
- return reflect.ValueOf(int64(0)), nil
- case reflect.Float32, reflect.Float64:
- return reflect.ValueOf(int64(v.Float())), nil
- case reflect.Array:
- if v.Len() > 0 {
- return castInt(v.Index(0))
- }
- return nilValue, fmt.Errorf("failed to cast to int64 from empty array")
- case reflect.Slice:
- if v.Len() > 0 {
- return castInt(v.Index(0))
- }
- return nilValue, fmt.Errorf("failed to cast to int64 from empty slice")
- case reflect.Interface:
- return castInt(reflect.ValueOf(v.Interface()))
- case reflect.Map:
- return nilValue, fmt.Errorf("failed to cast to int64 from map")
- case reflect.Struct:
- return nilValue, fmt.Errorf("failed to cast to int64 from struct")
- case reflect.Ptr:
- return castInt(v.Elem())
- }
- return nilValue, fmt.Errorf("failed to cast to int64 from %s", v.Type().Kind())
-}
-
-func castUint(v reflect.Value) (reflect.Value, error) {
- switch v.Type().Kind() {
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return reflect.ValueOf(uint64(v.Int())), nil
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return v, nil
- case reflect.String:
- u64, err := strconv.ParseUint(v.String(), 10, 64)
- if err != nil {
- return nilValue, err
- }
- return reflect.ValueOf(u64), nil
- case reflect.Bool:
- if v.Bool() {
- return reflect.ValueOf(uint64(1)), nil
- }
- return reflect.ValueOf(uint64(0)), nil
- case reflect.Float32, reflect.Float64:
- return reflect.ValueOf(uint64(v.Float())), nil
- case reflect.Array:
- if v.Len() > 0 {
- return castUint(v.Index(0))
- }
- return nilValue, fmt.Errorf("failed to cast to uint64 from empty array")
- case reflect.Slice:
- if v.Len() > 0 {
- return castUint(v.Index(0))
- }
- return nilValue, fmt.Errorf("failed to cast to uint64 from empty slice")
- case reflect.Interface:
- return castUint(reflect.ValueOf(v.Interface()))
- case reflect.Map:
- return nilValue, fmt.Errorf("failed to cast to uint64 from map")
- case reflect.Struct:
- return nilValue, fmt.Errorf("failed to cast to uint64 from struct")
- case reflect.Ptr:
- return castUint(v.Elem())
- }
- return nilValue, fmt.Errorf("failed to cast to uint64 from %s", v.Type().Kind())
-}
-
-func castString(v reflect.Value) (reflect.Value, error) {
- switch v.Type().Kind() {
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return reflect.ValueOf(fmt.Sprint(v.Int())), nil
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return reflect.ValueOf(fmt.Sprint(v.Uint())), nil
- case reflect.String:
- return v, nil
- case reflect.Bool:
- if v.Bool() {
- return reflect.ValueOf("true"), nil
- }
- return reflect.ValueOf("false"), nil
- case reflect.Float32, reflect.Float64:
- return reflect.ValueOf(fmt.Sprint(v.Float())), nil
- case reflect.Array:
- if v.Len() > 0 {
- return castString(v.Index(0))
- }
- return nilValue, fmt.Errorf("failed to cast to string from empty array")
- case reflect.Slice:
- if v.Len() > 0 {
- return castString(v.Index(0))
- }
- return nilValue, fmt.Errorf("failed to cast to string from empty slice")
- case reflect.Interface:
- return castString(reflect.ValueOf(v.Interface()))
- case reflect.Map:
- return nilValue, fmt.Errorf("failed to cast to string from map")
- case reflect.Struct:
- return nilValue, fmt.Errorf("failed to cast to string from struct")
- case reflect.Ptr:
- return castString(v.Elem())
- }
- return nilValue, fmt.Errorf("failed to cast to string from %s", v.Type().Kind())
-}
-
-func castBool(v reflect.Value) (reflect.Value, error) {
- switch v.Type().Kind() {
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- switch v.Int() {
- case 0:
- return reflect.ValueOf(false), nil
- case 1:
- return reflect.ValueOf(true), nil
- }
- return nilValue, fmt.Errorf("failed to cast to bool from %d", v.Int())
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- switch v.Uint() {
- case 0:
- return reflect.ValueOf(false), nil
- case 1:
- return reflect.ValueOf(true), nil
- }
- return nilValue, fmt.Errorf("failed to cast to bool from %d", v.Uint())
- case reflect.String:
- b, err := strconv.ParseBool(v.String())
- if err != nil {
- return nilValue, err
- }
- return reflect.ValueOf(b), nil
- case reflect.Bool:
- return v, nil
- case reflect.Float32, reflect.Float64:
- switch v.Float() {
- case 0:
- return reflect.ValueOf(false), nil
- case 1:
- return reflect.ValueOf(true), nil
- }
- return nilValue, fmt.Errorf("failed to cast to bool from %f", v.Float())
- case reflect.Array:
- if v.Len() > 0 {
- return castBool(v.Index(0))
- }
- return nilValue, fmt.Errorf("failed to cast to string from empty array")
- case reflect.Slice:
- if v.Len() > 0 {
- return castBool(v.Index(0))
- }
- return nilValue, fmt.Errorf("failed to cast to string from empty slice")
- case reflect.Interface:
- return castBool(reflect.ValueOf(v.Interface()))
- case reflect.Map:
- return nilValue, fmt.Errorf("failed to cast to string from map")
- case reflect.Struct:
- return nilValue, fmt.Errorf("failed to cast to string from struct")
- case reflect.Ptr:
- return castBool(v.Elem())
- }
- return nilValue, fmt.Errorf("failed to cast to bool from %s", v.Type().Kind())
-}
-
-func castFloat(v reflect.Value) (reflect.Value, error) {
- switch v.Type().Kind() {
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return reflect.ValueOf(float64(v.Int())), nil
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return reflect.ValueOf(float64(v.Uint())), nil
- case reflect.String:
- f64, err := strconv.ParseFloat(v.String(), 64)
- if err != nil {
- return nilValue, err
- }
- return reflect.ValueOf(f64), nil
- case reflect.Bool:
- if v.Bool() {
- return reflect.ValueOf(float64(1)), nil
- }
- return reflect.ValueOf(float64(0)), nil
- case reflect.Float32, reflect.Float64:
- return v, nil
- case reflect.Array:
- if v.Len() > 0 {
- return castFloat(v.Index(0))
- }
- return nilValue, fmt.Errorf("failed to cast to float64 from empty array")
- case reflect.Slice:
- if v.Len() > 0 {
- return castFloat(v.Index(0))
- }
- return nilValue, fmt.Errorf("failed to cast to float64 from empty slice")
- case reflect.Interface:
- return castFloat(reflect.ValueOf(v.Interface()))
- case reflect.Map:
- return nilValue, fmt.Errorf("failed to cast to float64 from map")
- case reflect.Struct:
- return nilValue, fmt.Errorf("failed to cast to float64 from struct")
- case reflect.Ptr:
- return castFloat(v.Elem())
- }
- return nilValue, fmt.Errorf("failed to cast to float64 from %s", v.Type().Kind())
-}
-
-func castArray(t reflect.Type, v reflect.Value) (reflect.Value, error) {
- kind := v.Type().Kind()
- if kind == reflect.Interface {
- return castArray(t, reflect.ValueOf(v.Interface()))
- }
- if kind != reflect.Slice && kind != reflect.Array {
- return nilValue, fmt.Errorf("failed to cast to array from %s", kind)
- }
- if t.Elem() == v.Type().Elem() {
- return v, nil
- }
- if t.Len() != v.Len() {
- return nilValue, fmt.Errorf("failed to cast [%d]array from slice of %d length", t.Len(), v.Len())
- }
- ret := reflect.New(t).Elem()
- for i := 0; i < v.Len(); i++ {
- vv, err := castValue(t.Elem(), v.Index(i))
- if err != nil {
- return nilValue, err
- }
- ret.Index(i).Set(vv)
- }
- return ret, nil
-}
-
-func castSlice(t reflect.Type, v reflect.Value) (reflect.Value, error) {
- kind := v.Type().Kind()
- if kind == reflect.Interface {
- return castSlice(t, reflect.ValueOf(v.Interface()))
- }
- if kind != reflect.Slice && kind != reflect.Array {
- return nilValue, fmt.Errorf("failed to cast to slice from %s", kind)
- }
- if t.Elem() == v.Type().Elem() {
- return v, nil
- }
- ret := reflect.MakeSlice(t, v.Len(), v.Len())
- for i := 0; i < v.Len(); i++ {
- vv, err := castValue(t.Elem(), v.Index(i))
- if err != nil {
- return nilValue, err
- }
- ret.Index(i).Set(vv)
- }
- return ret, nil
-}
-
-func castMap(t reflect.Type, v reflect.Value) (reflect.Value, error) {
- ret := reflect.MakeMap(t)
- switch v.Type().Kind() {
- case reflect.Map:
- iter := v.MapRange()
- for iter.Next() {
- key, err := castValue(t.Key(), iter.Key())
- if err != nil {
- return nilValue, err
- }
- value, err := castValue(t.Elem(), iter.Value())
- if err != nil {
- return nilValue, err
- }
- ret.SetMapIndex(key, value)
- }
- return ret, nil
- case reflect.Interface:
- return castMap(t, reflect.ValueOf(v.Interface()))
- case reflect.Slice:
- if v.Len() > 0 {
- return castMap(t, v.Index(0))
- }
- return nilValue, fmt.Errorf("failed to cast to map from empty slice")
- }
- return nilValue, fmt.Errorf("failed to cast to map from %s", v.Type().Kind())
-}
-
-func castStruct(t reflect.Type, v reflect.Value) (reflect.Value, error) {
- ret := reflect.New(t).Elem()
- switch v.Type().Kind() {
- case reflect.Map:
- iter := v.MapRange()
- for iter.Next() {
- key := iter.Key()
- k, err := castString(key)
- if err != nil {
- return nilValue, err
- }
- fieldName := k.String()
- field, ok := t.FieldByName(fieldName)
- if ok {
- value, err := castValue(field.Type, iter.Value())
- if err != nil {
- return nilValue, err
- }
- ret.FieldByName(fieldName).Set(value)
- }
- }
- return ret, nil
- case reflect.Struct:
- for i := 0; i < v.Type().NumField(); i++ {
- name := v.Type().Field(i).Name
- ret.FieldByName(name).Set(v.FieldByName(name))
- }
- return ret, nil
- case reflect.Interface:
- return castStruct(t, reflect.ValueOf(v.Interface()))
- case reflect.Slice:
- if v.Len() > 0 {
- return castStruct(t, v.Index(0))
- }
- return nilValue, fmt.Errorf("failed to cast to struct from empty slice")
- default:
- return nilValue, fmt.Errorf("failed to cast to struct from %s", v.Type().Kind())
- }
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/bool.go b/vendor/github.com/goccy/go-json/internal/decoder/bool.go
deleted file mode 100644
index ba6cf5bc496..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/bool.go
+++ /dev/null
@@ -1,83 +0,0 @@
-package decoder
-
-import (
- "fmt"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
-)
-
-type boolDecoder struct {
- structName string
- fieldName string
-}
-
-func newBoolDecoder(structName, fieldName string) *boolDecoder {
- return &boolDecoder{structName: structName, fieldName: fieldName}
-}
-
-func (d *boolDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- c := s.skipWhiteSpace()
- for {
- switch c {
- case 't':
- if err := trueBytes(s); err != nil {
- return err
- }
- **(**bool)(unsafe.Pointer(&p)) = true
- return nil
- case 'f':
- if err := falseBytes(s); err != nil {
- return err
- }
- **(**bool)(unsafe.Pointer(&p)) = false
- return nil
- case 'n':
- if err := nullBytes(s); err != nil {
- return err
- }
- return nil
- case nul:
- if s.read() {
- c = s.char()
- continue
- }
- goto ERROR
- }
- break
- }
-ERROR:
- return errors.ErrUnexpectedEndOfJSON("bool", s.totalOffset())
-}
-
-func (d *boolDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- buf := ctx.Buf
- cursor = skipWhiteSpace(buf, cursor)
- switch buf[cursor] {
- case 't':
- if err := validateTrue(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 4
- **(**bool)(unsafe.Pointer(&p)) = true
- return cursor, nil
- case 'f':
- if err := validateFalse(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 5
- **(**bool)(unsafe.Pointer(&p)) = false
- return cursor, nil
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 4
- return cursor, nil
- }
- return 0, errors.ErrUnexpectedEndOfJSON("bool", cursor)
-}
-
-func (d *boolDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- return nil, 0, fmt.Errorf("json: bool decoder does not support decode path")
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/bytes.go b/vendor/github.com/goccy/go-json/internal/decoder/bytes.go
deleted file mode 100644
index 939bf432741..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/bytes.go
+++ /dev/null
@@ -1,118 +0,0 @@
-package decoder
-
-import (
- "encoding/base64"
- "fmt"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type bytesDecoder struct {
- typ *runtime.Type
- sliceDecoder Decoder
- stringDecoder *stringDecoder
- structName string
- fieldName string
-}
-
-func byteUnmarshalerSliceDecoder(typ *runtime.Type, structName string, fieldName string) Decoder {
- var unmarshalDecoder Decoder
- switch {
- case runtime.PtrTo(typ).Implements(unmarshalJSONType):
- unmarshalDecoder = newUnmarshalJSONDecoder(runtime.PtrTo(typ), structName, fieldName)
- case runtime.PtrTo(typ).Implements(unmarshalTextType):
- unmarshalDecoder = newUnmarshalTextDecoder(runtime.PtrTo(typ), structName, fieldName)
- default:
- unmarshalDecoder, _ = compileUint8(typ, structName, fieldName)
- }
- return newSliceDecoder(unmarshalDecoder, typ, 1, structName, fieldName)
-}
-
-func newBytesDecoder(typ *runtime.Type, structName string, fieldName string) *bytesDecoder {
- return &bytesDecoder{
- typ: typ,
- sliceDecoder: byteUnmarshalerSliceDecoder(typ, structName, fieldName),
- stringDecoder: newStringDecoder(structName, fieldName),
- structName: structName,
- fieldName: fieldName,
- }
-}
-
-func (d *bytesDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- bytes, err := d.decodeStreamBinary(s, depth, p)
- if err != nil {
- return err
- }
- if bytes == nil {
- s.reset()
- return nil
- }
- decodedLen := base64.StdEncoding.DecodedLen(len(bytes))
- buf := make([]byte, decodedLen)
- n, err := base64.StdEncoding.Decode(buf, bytes)
- if err != nil {
- return err
- }
- *(*[]byte)(p) = buf[:n]
- s.reset()
- return nil
-}
-
-func (d *bytesDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- bytes, c, err := d.decodeBinary(ctx, cursor, depth, p)
- if err != nil {
- return 0, err
- }
- if bytes == nil {
- return c, nil
- }
- cursor = c
- decodedLen := base64.StdEncoding.DecodedLen(len(bytes))
- b := make([]byte, decodedLen)
- n, err := base64.StdEncoding.Decode(b, bytes)
- if err != nil {
- return 0, err
- }
- *(*[]byte)(p) = b[:n]
- return cursor, nil
-}
-
-func (d *bytesDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- return nil, 0, fmt.Errorf("json: []byte decoder does not support decode path")
-}
-
-func (d *bytesDecoder) decodeStreamBinary(s *Stream, depth int64, p unsafe.Pointer) ([]byte, error) {
- c := s.skipWhiteSpace()
- if c == '[' {
- if d.sliceDecoder == nil {
- return nil, &errors.UnmarshalTypeError{
- Type: runtime.RType2Type(d.typ),
- Offset: s.totalOffset(),
- }
- }
- err := d.sliceDecoder.DecodeStream(s, depth, p)
- return nil, err
- }
- return d.stringDecoder.decodeStreamByte(s)
-}
-
-func (d *bytesDecoder) decodeBinary(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) ([]byte, int64, error) {
- buf := ctx.Buf
- cursor = skipWhiteSpace(buf, cursor)
- if buf[cursor] == '[' {
- if d.sliceDecoder == nil {
- return nil, 0, &errors.UnmarshalTypeError{
- Type: runtime.RType2Type(d.typ),
- Offset: cursor,
- }
- }
- c, err := d.sliceDecoder.Decode(ctx, cursor, depth, p)
- if err != nil {
- return nil, 0, err
- }
- return nil, c, nil
- }
- return d.stringDecoder.decodeByte(buf, cursor)
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/compile.go b/vendor/github.com/goccy/go-json/internal/decoder/compile.go
deleted file mode 100644
index 8ad50936c0c..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/compile.go
+++ /dev/null
@@ -1,493 +0,0 @@
-package decoder
-
-import (
- "encoding/json"
- "fmt"
- "reflect"
- "strings"
- "sync"
- "sync/atomic"
- "unicode"
- "unsafe"
-
- "github.com/goccy/go-json/internal/runtime"
-)
-
-var (
- jsonNumberType = reflect.TypeOf(json.Number(""))
- typeAddr *runtime.TypeAddr
- cachedDecoderMap unsafe.Pointer // map[uintptr]decoder
- cachedDecoder []Decoder
- initOnce sync.Once
-)
-
-func initDecoder() {
- initOnce.Do(func() {
- typeAddr = runtime.AnalyzeTypeAddr()
- if typeAddr == nil {
- typeAddr = &runtime.TypeAddr{}
- }
- cachedDecoder = make([]Decoder, typeAddr.AddrRange>>typeAddr.AddrShift+1)
- })
-}
-
-func loadDecoderMap() map[uintptr]Decoder {
- initDecoder()
- p := atomic.LoadPointer(&cachedDecoderMap)
- return *(*map[uintptr]Decoder)(unsafe.Pointer(&p))
-}
-
-func storeDecoder(typ uintptr, dec Decoder, m map[uintptr]Decoder) {
- initDecoder()
- newDecoderMap := make(map[uintptr]Decoder, len(m)+1)
- newDecoderMap[typ] = dec
-
- for k, v := range m {
- newDecoderMap[k] = v
- }
-
- atomic.StorePointer(&cachedDecoderMap, *(*unsafe.Pointer)(unsafe.Pointer(&newDecoderMap)))
-}
-
-func compileToGetDecoderSlowPath(typeptr uintptr, typ *runtime.Type) (Decoder, error) {
- decoderMap := loadDecoderMap()
- if dec, exists := decoderMap[typeptr]; exists {
- return dec, nil
- }
-
- dec, err := compileHead(typ, map[uintptr]Decoder{})
- if err != nil {
- return nil, err
- }
- storeDecoder(typeptr, dec, decoderMap)
- return dec, nil
-}
-
-func compileHead(typ *runtime.Type, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) {
- switch {
- case implementsUnmarshalJSONType(runtime.PtrTo(typ)):
- return newUnmarshalJSONDecoder(runtime.PtrTo(typ), "", ""), nil
- case runtime.PtrTo(typ).Implements(unmarshalTextType):
- return newUnmarshalTextDecoder(runtime.PtrTo(typ), "", ""), nil
- }
- return compile(typ.Elem(), "", "", structTypeToDecoder)
-}
-
-func compile(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) {
- switch {
- case implementsUnmarshalJSONType(runtime.PtrTo(typ)):
- return newUnmarshalJSONDecoder(runtime.PtrTo(typ), structName, fieldName), nil
- case runtime.PtrTo(typ).Implements(unmarshalTextType):
- return newUnmarshalTextDecoder(runtime.PtrTo(typ), structName, fieldName), nil
- }
-
- switch typ.Kind() {
- case reflect.Ptr:
- return compilePtr(typ, structName, fieldName, structTypeToDecoder)
- case reflect.Struct:
- return compileStruct(typ, structName, fieldName, structTypeToDecoder)
- case reflect.Slice:
- elem := typ.Elem()
- if elem.Kind() == reflect.Uint8 {
- return compileBytes(elem, structName, fieldName)
- }
- return compileSlice(typ, structName, fieldName, structTypeToDecoder)
- case reflect.Array:
- return compileArray(typ, structName, fieldName, structTypeToDecoder)
- case reflect.Map:
- return compileMap(typ, structName, fieldName, structTypeToDecoder)
- case reflect.Interface:
- return compileInterface(typ, structName, fieldName)
- case reflect.Uintptr:
- return compileUint(typ, structName, fieldName)
- case reflect.Int:
- return compileInt(typ, structName, fieldName)
- case reflect.Int8:
- return compileInt8(typ, structName, fieldName)
- case reflect.Int16:
- return compileInt16(typ, structName, fieldName)
- case reflect.Int32:
- return compileInt32(typ, structName, fieldName)
- case reflect.Int64:
- return compileInt64(typ, structName, fieldName)
- case reflect.Uint:
- return compileUint(typ, structName, fieldName)
- case reflect.Uint8:
- return compileUint8(typ, structName, fieldName)
- case reflect.Uint16:
- return compileUint16(typ, structName, fieldName)
- case reflect.Uint32:
- return compileUint32(typ, structName, fieldName)
- case reflect.Uint64:
- return compileUint64(typ, structName, fieldName)
- case reflect.String:
- return compileString(typ, structName, fieldName)
- case reflect.Bool:
- return compileBool(structName, fieldName)
- case reflect.Float32:
- return compileFloat32(structName, fieldName)
- case reflect.Float64:
- return compileFloat64(structName, fieldName)
- case reflect.Func:
- return compileFunc(typ, structName, fieldName)
- }
- return newInvalidDecoder(typ, structName, fieldName), nil
-}
-
-func isStringTagSupportedType(typ *runtime.Type) bool {
- switch {
- case implementsUnmarshalJSONType(runtime.PtrTo(typ)):
- return false
- case runtime.PtrTo(typ).Implements(unmarshalTextType):
- return false
- }
- switch typ.Kind() {
- case reflect.Map:
- return false
- case reflect.Slice:
- return false
- case reflect.Array:
- return false
- case reflect.Struct:
- return false
- case reflect.Interface:
- return false
- }
- return true
-}
-
-func compileMapKey(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) {
- if runtime.PtrTo(typ).Implements(unmarshalTextType) {
- return newUnmarshalTextDecoder(runtime.PtrTo(typ), structName, fieldName), nil
- }
- if typ.Kind() == reflect.String {
- return newStringDecoder(structName, fieldName), nil
- }
- dec, err := compile(typ, structName, fieldName, structTypeToDecoder)
- if err != nil {
- return nil, err
- }
- for {
- switch t := dec.(type) {
- case *stringDecoder, *interfaceDecoder:
- return dec, nil
- case *boolDecoder, *intDecoder, *uintDecoder, *numberDecoder:
- return newWrappedStringDecoder(typ, dec, structName, fieldName), nil
- case *ptrDecoder:
- dec = t.dec
- default:
- return newInvalidDecoder(typ, structName, fieldName), nil
- }
- }
-}
-
-func compilePtr(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) {
- dec, err := compile(typ.Elem(), structName, fieldName, structTypeToDecoder)
- if err != nil {
- return nil, err
- }
- return newPtrDecoder(dec, typ.Elem(), structName, fieldName), nil
-}
-
-func compileInt(typ *runtime.Type, structName, fieldName string) (Decoder, error) {
- return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) {
- *(*int)(p) = int(v)
- }), nil
-}
-
-func compileInt8(typ *runtime.Type, structName, fieldName string) (Decoder, error) {
- return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) {
- *(*int8)(p) = int8(v)
- }), nil
-}
-
-func compileInt16(typ *runtime.Type, structName, fieldName string) (Decoder, error) {
- return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) {
- *(*int16)(p) = int16(v)
- }), nil
-}
-
-func compileInt32(typ *runtime.Type, structName, fieldName string) (Decoder, error) {
- return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) {
- *(*int32)(p) = int32(v)
- }), nil
-}
-
-func compileInt64(typ *runtime.Type, structName, fieldName string) (Decoder, error) {
- return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) {
- *(*int64)(p) = v
- }), nil
-}
-
-func compileUint(typ *runtime.Type, structName, fieldName string) (Decoder, error) {
- return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) {
- *(*uint)(p) = uint(v)
- }), nil
-}
-
-func compileUint8(typ *runtime.Type, structName, fieldName string) (Decoder, error) {
- return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) {
- *(*uint8)(p) = uint8(v)
- }), nil
-}
-
-func compileUint16(typ *runtime.Type, structName, fieldName string) (Decoder, error) {
- return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) {
- *(*uint16)(p) = uint16(v)
- }), nil
-}
-
-func compileUint32(typ *runtime.Type, structName, fieldName string) (Decoder, error) {
- return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) {
- *(*uint32)(p) = uint32(v)
- }), nil
-}
-
-func compileUint64(typ *runtime.Type, structName, fieldName string) (Decoder, error) {
- return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) {
- *(*uint64)(p) = v
- }), nil
-}
-
-func compileFloat32(structName, fieldName string) (Decoder, error) {
- return newFloatDecoder(structName, fieldName, func(p unsafe.Pointer, v float64) {
- *(*float32)(p) = float32(v)
- }), nil
-}
-
-func compileFloat64(structName, fieldName string) (Decoder, error) {
- return newFloatDecoder(structName, fieldName, func(p unsafe.Pointer, v float64) {
- *(*float64)(p) = v
- }), nil
-}
-
-func compileString(typ *runtime.Type, structName, fieldName string) (Decoder, error) {
- if typ == runtime.Type2RType(jsonNumberType) {
- return newNumberDecoder(structName, fieldName, func(p unsafe.Pointer, v json.Number) {
- *(*json.Number)(p) = v
- }), nil
- }
- return newStringDecoder(structName, fieldName), nil
-}
-
-func compileBool(structName, fieldName string) (Decoder, error) {
- return newBoolDecoder(structName, fieldName), nil
-}
-
-func compileBytes(typ *runtime.Type, structName, fieldName string) (Decoder, error) {
- return newBytesDecoder(typ, structName, fieldName), nil
-}
-
-func compileSlice(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) {
- elem := typ.Elem()
- decoder, err := compile(elem, structName, fieldName, structTypeToDecoder)
- if err != nil {
- return nil, err
- }
- return newSliceDecoder(decoder, elem, elem.Size(), structName, fieldName), nil
-}
-
-func compileArray(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) {
- elem := typ.Elem()
- decoder, err := compile(elem, structName, fieldName, structTypeToDecoder)
- if err != nil {
- return nil, err
- }
- return newArrayDecoder(decoder, elem, typ.Len(), structName, fieldName), nil
-}
-
-func compileMap(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) {
- keyDec, err := compileMapKey(typ.Key(), structName, fieldName, structTypeToDecoder)
- if err != nil {
- return nil, err
- }
- valueDec, err := compile(typ.Elem(), structName, fieldName, structTypeToDecoder)
- if err != nil {
- return nil, err
- }
- return newMapDecoder(typ, typ.Key(), keyDec, typ.Elem(), valueDec, structName, fieldName), nil
-}
-
-func compileInterface(typ *runtime.Type, structName, fieldName string) (Decoder, error) {
- return newInterfaceDecoder(typ, structName, fieldName), nil
-}
-
-func compileFunc(typ *runtime.Type, strutName, fieldName string) (Decoder, error) {
- return newFuncDecoder(typ, strutName, fieldName), nil
-}
-
-func typeToStructTags(typ *runtime.Type) runtime.StructTags {
- tags := runtime.StructTags{}
- fieldNum := typ.NumField()
- for i := 0; i < fieldNum; i++ {
- field := typ.Field(i)
- if runtime.IsIgnoredStructField(field) {
- continue
- }
- tags = append(tags, runtime.StructTagFromField(field))
- }
- return tags
-}
-
-func compileStruct(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) {
- fieldNum := typ.NumField()
- fieldMap := map[string]*structFieldSet{}
- typeptr := uintptr(unsafe.Pointer(typ))
- if dec, exists := structTypeToDecoder[typeptr]; exists {
- return dec, nil
- }
- structDec := newStructDecoder(structName, fieldName, fieldMap)
- structTypeToDecoder[typeptr] = structDec
- structName = typ.Name()
- tags := typeToStructTags(typ)
- allFields := []*structFieldSet{}
- for i := 0; i < fieldNum; i++ {
- field := typ.Field(i)
- if runtime.IsIgnoredStructField(field) {
- continue
- }
- isUnexportedField := unicode.IsLower([]rune(field.Name)[0])
- tag := runtime.StructTagFromField(field)
- dec, err := compile(runtime.Type2RType(field.Type), structName, field.Name, structTypeToDecoder)
- if err != nil {
- return nil, err
- }
- if field.Anonymous && !tag.IsTaggedKey {
- if stDec, ok := dec.(*structDecoder); ok {
- if runtime.Type2RType(field.Type) == typ {
- // recursive definition
- continue
- }
- for k, v := range stDec.fieldMap {
- if tags.ExistsKey(k) {
- continue
- }
- fieldSet := &structFieldSet{
- dec: v.dec,
- offset: field.Offset + v.offset,
- isTaggedKey: v.isTaggedKey,
- key: k,
- keyLen: int64(len(k)),
- }
- allFields = append(allFields, fieldSet)
- }
- } else if pdec, ok := dec.(*ptrDecoder); ok {
- contentDec := pdec.contentDecoder()
- if pdec.typ == typ {
- // recursive definition
- continue
- }
- var fieldSetErr error
- if isUnexportedField {
- fieldSetErr = fmt.Errorf(
- "json: cannot set embedded pointer to unexported struct: %v",
- field.Type.Elem(),
- )
- }
- if dec, ok := contentDec.(*structDecoder); ok {
- for k, v := range dec.fieldMap {
- if tags.ExistsKey(k) {
- continue
- }
- fieldSet := &structFieldSet{
- dec: newAnonymousFieldDecoder(pdec.typ, v.offset, v.dec),
- offset: field.Offset,
- isTaggedKey: v.isTaggedKey,
- key: k,
- keyLen: int64(len(k)),
- err: fieldSetErr,
- }
- allFields = append(allFields, fieldSet)
- }
- } else {
- fieldSet := &structFieldSet{
- dec: pdec,
- offset: field.Offset,
- isTaggedKey: tag.IsTaggedKey,
- key: field.Name,
- keyLen: int64(len(field.Name)),
- }
- allFields = append(allFields, fieldSet)
- }
- } else {
- fieldSet := &structFieldSet{
- dec: dec,
- offset: field.Offset,
- isTaggedKey: tag.IsTaggedKey,
- key: field.Name,
- keyLen: int64(len(field.Name)),
- }
- allFields = append(allFields, fieldSet)
- }
- } else {
- if tag.IsString && isStringTagSupportedType(runtime.Type2RType(field.Type)) {
- dec = newWrappedStringDecoder(runtime.Type2RType(field.Type), dec, structName, field.Name)
- }
- var key string
- if tag.Key != "" {
- key = tag.Key
- } else {
- key = field.Name
- }
- fieldSet := &structFieldSet{
- dec: dec,
- offset: field.Offset,
- isTaggedKey: tag.IsTaggedKey,
- key: key,
- keyLen: int64(len(key)),
- }
- allFields = append(allFields, fieldSet)
- }
- }
- for _, set := range filterDuplicatedFields(allFields) {
- fieldMap[set.key] = set
- lower := strings.ToLower(set.key)
- if _, exists := fieldMap[lower]; !exists {
- // first win
- fieldMap[lower] = set
- }
- }
- delete(structTypeToDecoder, typeptr)
- structDec.tryOptimize()
- return structDec, nil
-}
-
-func filterDuplicatedFields(allFields []*structFieldSet) []*structFieldSet {
- fieldMap := map[string][]*structFieldSet{}
- for _, field := range allFields {
- fieldMap[field.key] = append(fieldMap[field.key], field)
- }
- duplicatedFieldMap := map[string]struct{}{}
- for k, sets := range fieldMap {
- sets = filterFieldSets(sets)
- if len(sets) != 1 {
- duplicatedFieldMap[k] = struct{}{}
- }
- }
-
- filtered := make([]*structFieldSet, 0, len(allFields))
- for _, field := range allFields {
- if _, exists := duplicatedFieldMap[field.key]; exists {
- continue
- }
- filtered = append(filtered, field)
- }
- return filtered
-}
-
-func filterFieldSets(sets []*structFieldSet) []*structFieldSet {
- if len(sets) == 1 {
- return sets
- }
- filtered := make([]*structFieldSet, 0, len(sets))
- for _, set := range sets {
- if set.isTaggedKey {
- filtered = append(filtered, set)
- }
- }
- return filtered
-}
-
-func implementsUnmarshalJSONType(typ *runtime.Type) bool {
- return typ.Implements(unmarshalJSONType) || typ.Implements(unmarshalJSONContextType)
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/compile_norace.go b/vendor/github.com/goccy/go-json/internal/decoder/compile_norace.go
deleted file mode 100644
index 025ca85b5e2..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/compile_norace.go
+++ /dev/null
@@ -1,30 +0,0 @@
-//go:build !race
-// +build !race
-
-package decoder
-
-import (
- "unsafe"
-
- "github.com/goccy/go-json/internal/runtime"
-)
-
-func CompileToGetDecoder(typ *runtime.Type) (Decoder, error) {
- initDecoder()
- typeptr := uintptr(unsafe.Pointer(typ))
- if typeptr > typeAddr.MaxTypeAddr {
- return compileToGetDecoderSlowPath(typeptr, typ)
- }
-
- index := (typeptr - typeAddr.BaseTypeAddr) >> typeAddr.AddrShift
- if dec := cachedDecoder[index]; dec != nil {
- return dec, nil
- }
-
- dec, err := compileHead(typ, map[uintptr]Decoder{})
- if err != nil {
- return nil, err
- }
- cachedDecoder[index] = dec
- return dec, nil
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/compile_race.go b/vendor/github.com/goccy/go-json/internal/decoder/compile_race.go
deleted file mode 100644
index 023b817c368..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/compile_race.go
+++ /dev/null
@@ -1,38 +0,0 @@
-//go:build race
-// +build race
-
-package decoder
-
-import (
- "sync"
- "unsafe"
-
- "github.com/goccy/go-json/internal/runtime"
-)
-
-var decMu sync.RWMutex
-
-func CompileToGetDecoder(typ *runtime.Type) (Decoder, error) {
- initDecoder()
- typeptr := uintptr(unsafe.Pointer(typ))
- if typeptr > typeAddr.MaxTypeAddr {
- return compileToGetDecoderSlowPath(typeptr, typ)
- }
-
- index := (typeptr - typeAddr.BaseTypeAddr) >> typeAddr.AddrShift
- decMu.RLock()
- if dec := cachedDecoder[index]; dec != nil {
- decMu.RUnlock()
- return dec, nil
- }
- decMu.RUnlock()
-
- dec, err := compileHead(typ, map[uintptr]Decoder{})
- if err != nil {
- return nil, err
- }
- decMu.Lock()
- cachedDecoder[index] = dec
- decMu.Unlock()
- return dec, nil
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/context.go b/vendor/github.com/goccy/go-json/internal/decoder/context.go
deleted file mode 100644
index cb2ffdafd03..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/context.go
+++ /dev/null
@@ -1,254 +0,0 @@
-package decoder
-
-import (
- "sync"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
-)
-
-type RuntimeContext struct {
- Buf []byte
- Option *Option
-}
-
-var (
- runtimeContextPool = sync.Pool{
- New: func() interface{} {
- return &RuntimeContext{
- Option: &Option{},
- }
- },
- }
-)
-
-func TakeRuntimeContext() *RuntimeContext {
- return runtimeContextPool.Get().(*RuntimeContext)
-}
-
-func ReleaseRuntimeContext(ctx *RuntimeContext) {
- runtimeContextPool.Put(ctx)
-}
-
-var (
- isWhiteSpace = [256]bool{}
-)
-
-func init() {
- isWhiteSpace[' '] = true
- isWhiteSpace['\n'] = true
- isWhiteSpace['\t'] = true
- isWhiteSpace['\r'] = true
-}
-
-func char(ptr unsafe.Pointer, offset int64) byte {
- return *(*byte)(unsafe.Pointer(uintptr(ptr) + uintptr(offset)))
-}
-
-func skipWhiteSpace(buf []byte, cursor int64) int64 {
- for isWhiteSpace[buf[cursor]] {
- cursor++
- }
- return cursor
-}
-
-func skipObject(buf []byte, cursor, depth int64) (int64, error) {
- braceCount := 1
- for {
- switch buf[cursor] {
- case '{':
- braceCount++
- depth++
- if depth > maxDecodeNestingDepth {
- return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor)
- }
- case '}':
- depth--
- braceCount--
- if braceCount == 0 {
- return cursor + 1, nil
- }
- case '[':
- depth++
- if depth > maxDecodeNestingDepth {
- return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor)
- }
- case ']':
- depth--
- case '"':
- for {
- cursor++
- switch buf[cursor] {
- case '\\':
- cursor++
- if buf[cursor] == nul {
- return 0, errors.ErrUnexpectedEndOfJSON("string of object", cursor)
- }
- case '"':
- goto SWITCH_OUT
- case nul:
- return 0, errors.ErrUnexpectedEndOfJSON("string of object", cursor)
- }
- }
- case nul:
- return 0, errors.ErrUnexpectedEndOfJSON("object of object", cursor)
- }
- SWITCH_OUT:
- cursor++
- }
-}
-
-func skipArray(buf []byte, cursor, depth int64) (int64, error) {
- bracketCount := 1
- for {
- switch buf[cursor] {
- case '[':
- bracketCount++
- depth++
- if depth > maxDecodeNestingDepth {
- return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor)
- }
- case ']':
- bracketCount--
- depth--
- if bracketCount == 0 {
- return cursor + 1, nil
- }
- case '{':
- depth++
- if depth > maxDecodeNestingDepth {
- return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor)
- }
- case '}':
- depth--
- case '"':
- for {
- cursor++
- switch buf[cursor] {
- case '\\':
- cursor++
- if buf[cursor] == nul {
- return 0, errors.ErrUnexpectedEndOfJSON("string of object", cursor)
- }
- case '"':
- goto SWITCH_OUT
- case nul:
- return 0, errors.ErrUnexpectedEndOfJSON("string of object", cursor)
- }
- }
- case nul:
- return 0, errors.ErrUnexpectedEndOfJSON("array of object", cursor)
- }
- SWITCH_OUT:
- cursor++
- }
-}
-
-func skipValue(buf []byte, cursor, depth int64) (int64, error) {
- for {
- switch buf[cursor] {
- case ' ', '\t', '\n', '\r':
- cursor++
- continue
- case '{':
- return skipObject(buf, cursor+1, depth+1)
- case '[':
- return skipArray(buf, cursor+1, depth+1)
- case '"':
- for {
- cursor++
- switch buf[cursor] {
- case '\\':
- cursor++
- if buf[cursor] == nul {
- return 0, errors.ErrUnexpectedEndOfJSON("string of object", cursor)
- }
- case '"':
- return cursor + 1, nil
- case nul:
- return 0, errors.ErrUnexpectedEndOfJSON("string of object", cursor)
- }
- }
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- for {
- cursor++
- if floatTable[buf[cursor]] {
- continue
- }
- break
- }
- return cursor, nil
- case 't':
- if err := validateTrue(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 4
- return cursor, nil
- case 'f':
- if err := validateFalse(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 5
- return cursor, nil
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 4
- return cursor, nil
- default:
- return cursor, errors.ErrUnexpectedEndOfJSON("null", cursor)
- }
- }
-}
-
-func validateTrue(buf []byte, cursor int64) error {
- if cursor+3 >= int64(len(buf)) {
- return errors.ErrUnexpectedEndOfJSON("true", cursor)
- }
- if buf[cursor+1] != 'r' {
- return errors.ErrInvalidCharacter(buf[cursor+1], "true", cursor)
- }
- if buf[cursor+2] != 'u' {
- return errors.ErrInvalidCharacter(buf[cursor+2], "true", cursor)
- }
- if buf[cursor+3] != 'e' {
- return errors.ErrInvalidCharacter(buf[cursor+3], "true", cursor)
- }
- return nil
-}
-
-func validateFalse(buf []byte, cursor int64) error {
- if cursor+4 >= int64(len(buf)) {
- return errors.ErrUnexpectedEndOfJSON("false", cursor)
- }
- if buf[cursor+1] != 'a' {
- return errors.ErrInvalidCharacter(buf[cursor+1], "false", cursor)
- }
- if buf[cursor+2] != 'l' {
- return errors.ErrInvalidCharacter(buf[cursor+2], "false", cursor)
- }
- if buf[cursor+3] != 's' {
- return errors.ErrInvalidCharacter(buf[cursor+3], "false", cursor)
- }
- if buf[cursor+4] != 'e' {
- return errors.ErrInvalidCharacter(buf[cursor+4], "false", cursor)
- }
- return nil
-}
-
-func validateNull(buf []byte, cursor int64) error {
- if cursor+3 >= int64(len(buf)) {
- return errors.ErrUnexpectedEndOfJSON("null", cursor)
- }
- if buf[cursor+1] != 'u' {
- return errors.ErrInvalidCharacter(buf[cursor+1], "null", cursor)
- }
- if buf[cursor+2] != 'l' {
- return errors.ErrInvalidCharacter(buf[cursor+2], "null", cursor)
- }
- if buf[cursor+3] != 'l' {
- return errors.ErrInvalidCharacter(buf[cursor+3], "null", cursor)
- }
- return nil
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/float.go b/vendor/github.com/goccy/go-json/internal/decoder/float.go
deleted file mode 100644
index 9b2eb8b35a4..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/float.go
+++ /dev/null
@@ -1,170 +0,0 @@
-package decoder
-
-import (
- "strconv"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
-)
-
-type floatDecoder struct {
- op func(unsafe.Pointer, float64)
- structName string
- fieldName string
-}
-
-func newFloatDecoder(structName, fieldName string, op func(unsafe.Pointer, float64)) *floatDecoder {
- return &floatDecoder{op: op, structName: structName, fieldName: fieldName}
-}
-
-var (
- floatTable = [256]bool{
- '0': true,
- '1': true,
- '2': true,
- '3': true,
- '4': true,
- '5': true,
- '6': true,
- '7': true,
- '8': true,
- '9': true,
- '.': true,
- 'e': true,
- 'E': true,
- '+': true,
- '-': true,
- }
-
- validEndNumberChar = [256]bool{
- nul: true,
- ' ': true,
- '\t': true,
- '\r': true,
- '\n': true,
- ',': true,
- ':': true,
- '}': true,
- ']': true,
- }
-)
-
-func floatBytes(s *Stream) []byte {
- start := s.cursor
- for {
- s.cursor++
- if floatTable[s.char()] {
- continue
- } else if s.char() == nul {
- if s.read() {
- s.cursor-- // for retry current character
- continue
- }
- }
- break
- }
- return s.buf[start:s.cursor]
-}
-
-func (d *floatDecoder) decodeStreamByte(s *Stream) ([]byte, error) {
- for {
- switch s.char() {
- case ' ', '\n', '\t', '\r':
- s.cursor++
- continue
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return floatBytes(s), nil
- case 'n':
- if err := nullBytes(s); err != nil {
- return nil, err
- }
- return nil, nil
- case nul:
- if s.read() {
- continue
- }
- goto ERROR
- default:
- goto ERROR
- }
- }
-ERROR:
- return nil, errors.ErrUnexpectedEndOfJSON("float", s.totalOffset())
-}
-
-func (d *floatDecoder) decodeByte(buf []byte, cursor int64) ([]byte, int64, error) {
- for {
- switch buf[cursor] {
- case ' ', '\n', '\t', '\r':
- cursor++
- continue
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- start := cursor
- cursor++
- for floatTable[buf[cursor]] {
- cursor++
- }
- num := buf[start:cursor]
- return num, cursor, nil
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return nil, 0, err
- }
- cursor += 4
- return nil, cursor, nil
- default:
- return nil, 0, errors.ErrUnexpectedEndOfJSON("float", cursor)
- }
- }
-}
-
-func (d *floatDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- bytes, err := d.decodeStreamByte(s)
- if err != nil {
- return err
- }
- if bytes == nil {
- return nil
- }
- str := *(*string)(unsafe.Pointer(&bytes))
- f64, err := strconv.ParseFloat(str, 64)
- if err != nil {
- return errors.ErrSyntax(err.Error(), s.totalOffset())
- }
- d.op(p, f64)
- return nil
-}
-
-func (d *floatDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- buf := ctx.Buf
- bytes, c, err := d.decodeByte(buf, cursor)
- if err != nil {
- return 0, err
- }
- if bytes == nil {
- return c, nil
- }
- cursor = c
- if !validEndNumberChar[buf[cursor]] {
- return 0, errors.ErrUnexpectedEndOfJSON("float", cursor)
- }
- s := *(*string)(unsafe.Pointer(&bytes))
- f64, err := strconv.ParseFloat(s, 64)
- if err != nil {
- return 0, errors.ErrSyntax(err.Error(), cursor)
- }
- d.op(p, f64)
- return cursor, nil
-}
-
-func (d *floatDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- buf := ctx.Buf
- bytes, c, err := d.decodeByte(buf, cursor)
- if err != nil {
- return nil, 0, err
- }
- if bytes == nil {
- return [][]byte{nullbytes}, c, nil
- }
- return [][]byte{bytes}, c, nil
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/func.go b/vendor/github.com/goccy/go-json/internal/decoder/func.go
deleted file mode 100644
index 4cc12ca81f1..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/func.go
+++ /dev/null
@@ -1,146 +0,0 @@
-package decoder
-
-import (
- "bytes"
- "fmt"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type funcDecoder struct {
- typ *runtime.Type
- structName string
- fieldName string
-}
-
-func newFuncDecoder(typ *runtime.Type, structName, fieldName string) *funcDecoder {
- fnDecoder := &funcDecoder{typ, structName, fieldName}
- return fnDecoder
-}
-
-func (d *funcDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- s.skipWhiteSpace()
- start := s.cursor
- if err := s.skipValue(depth); err != nil {
- return err
- }
- src := s.buf[start:s.cursor]
- if len(src) > 0 {
- switch src[0] {
- case '"':
- return &errors.UnmarshalTypeError{
- Value: "string",
- Type: runtime.RType2Type(d.typ),
- Offset: s.totalOffset(),
- }
- case '[':
- return &errors.UnmarshalTypeError{
- Value: "array",
- Type: runtime.RType2Type(d.typ),
- Offset: s.totalOffset(),
- }
- case '{':
- return &errors.UnmarshalTypeError{
- Value: "object",
- Type: runtime.RType2Type(d.typ),
- Offset: s.totalOffset(),
- }
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return &errors.UnmarshalTypeError{
- Value: "number",
- Type: runtime.RType2Type(d.typ),
- Offset: s.totalOffset(),
- }
- case 'n':
- if err := nullBytes(s); err != nil {
- return err
- }
- *(*unsafe.Pointer)(p) = nil
- return nil
- case 't':
- if err := trueBytes(s); err == nil {
- return &errors.UnmarshalTypeError{
- Value: "boolean",
- Type: runtime.RType2Type(d.typ),
- Offset: s.totalOffset(),
- }
- }
- case 'f':
- if err := falseBytes(s); err == nil {
- return &errors.UnmarshalTypeError{
- Value: "boolean",
- Type: runtime.RType2Type(d.typ),
- Offset: s.totalOffset(),
- }
- }
- }
- }
- return errors.ErrInvalidBeginningOfValue(s.buf[s.cursor], s.totalOffset())
-}
-
-func (d *funcDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- buf := ctx.Buf
- cursor = skipWhiteSpace(buf, cursor)
- start := cursor
- end, err := skipValue(buf, cursor, depth)
- if err != nil {
- return 0, err
- }
- src := buf[start:end]
- if len(src) > 0 {
- switch src[0] {
- case '"':
- return 0, &errors.UnmarshalTypeError{
- Value: "string",
- Type: runtime.RType2Type(d.typ),
- Offset: start,
- }
- case '[':
- return 0, &errors.UnmarshalTypeError{
- Value: "array",
- Type: runtime.RType2Type(d.typ),
- Offset: start,
- }
- case '{':
- return 0, &errors.UnmarshalTypeError{
- Value: "object",
- Type: runtime.RType2Type(d.typ),
- Offset: start,
- }
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return 0, &errors.UnmarshalTypeError{
- Value: "number",
- Type: runtime.RType2Type(d.typ),
- Offset: start,
- }
- case 'n':
- if bytes.Equal(src, nullbytes) {
- *(*unsafe.Pointer)(p) = nil
- return end, nil
- }
- case 't':
- if err := validateTrue(buf, start); err == nil {
- return 0, &errors.UnmarshalTypeError{
- Value: "boolean",
- Type: runtime.RType2Type(d.typ),
- Offset: start,
- }
- }
- case 'f':
- if err := validateFalse(buf, start); err == nil {
- return 0, &errors.UnmarshalTypeError{
- Value: "boolean",
- Type: runtime.RType2Type(d.typ),
- Offset: start,
- }
- }
- }
- }
- return cursor, errors.ErrInvalidBeginningOfValue(buf[cursor], cursor)
-}
-
-func (d *funcDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- return nil, 0, fmt.Errorf("json: func decoder does not support decode path")
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/int.go b/vendor/github.com/goccy/go-json/internal/decoder/int.go
deleted file mode 100644
index 1a7f081994c..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/int.go
+++ /dev/null
@@ -1,246 +0,0 @@
-package decoder
-
-import (
- "fmt"
- "reflect"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type intDecoder struct {
- typ *runtime.Type
- kind reflect.Kind
- op func(unsafe.Pointer, int64)
- structName string
- fieldName string
-}
-
-func newIntDecoder(typ *runtime.Type, structName, fieldName string, op func(unsafe.Pointer, int64)) *intDecoder {
- return &intDecoder{
- typ: typ,
- kind: typ.Kind(),
- op: op,
- structName: structName,
- fieldName: fieldName,
- }
-}
-
-func (d *intDecoder) typeError(buf []byte, offset int64) *errors.UnmarshalTypeError {
- return &errors.UnmarshalTypeError{
- Value: fmt.Sprintf("number %s", string(buf)),
- Type: runtime.RType2Type(d.typ),
- Struct: d.structName,
- Field: d.fieldName,
- Offset: offset,
- }
-}
-
-var (
- pow10i64 = [...]int64{
- 1e00, 1e01, 1e02, 1e03, 1e04, 1e05, 1e06, 1e07, 1e08, 1e09,
- 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18,
- }
- pow10i64Len = len(pow10i64)
-)
-
-func (d *intDecoder) parseInt(b []byte) (int64, error) {
- isNegative := false
- if b[0] == '-' {
- b = b[1:]
- isNegative = true
- }
- maxDigit := len(b)
- if maxDigit > pow10i64Len {
- return 0, fmt.Errorf("invalid length of number")
- }
- sum := int64(0)
- for i := 0; i < maxDigit; i++ {
- c := int64(b[i]) - 48
- digitValue := pow10i64[maxDigit-i-1]
- sum += c * digitValue
- }
- if isNegative {
- return -1 * sum, nil
- }
- return sum, nil
-}
-
-var (
- numTable = [256]bool{
- '0': true,
- '1': true,
- '2': true,
- '3': true,
- '4': true,
- '5': true,
- '6': true,
- '7': true,
- '8': true,
- '9': true,
- }
-)
-
-var (
- numZeroBuf = []byte{'0'}
-)
-
-func (d *intDecoder) decodeStreamByte(s *Stream) ([]byte, error) {
- for {
- switch s.char() {
- case ' ', '\n', '\t', '\r':
- s.cursor++
- continue
- case '-':
- start := s.cursor
- for {
- s.cursor++
- if numTable[s.char()] {
- continue
- } else if s.char() == nul {
- if s.read() {
- s.cursor-- // for retry current character
- continue
- }
- }
- break
- }
- num := s.buf[start:s.cursor]
- if len(num) < 2 {
- goto ERROR
- }
- return num, nil
- case '0':
- s.cursor++
- return numZeroBuf, nil
- case '1', '2', '3', '4', '5', '6', '7', '8', '9':
- start := s.cursor
- for {
- s.cursor++
- if numTable[s.char()] {
- continue
- } else if s.char() == nul {
- if s.read() {
- s.cursor-- // for retry current character
- continue
- }
- }
- break
- }
- num := s.buf[start:s.cursor]
- return num, nil
- case 'n':
- if err := nullBytes(s); err != nil {
- return nil, err
- }
- return nil, nil
- case nul:
- if s.read() {
- continue
- }
- goto ERROR
- default:
- return nil, d.typeError([]byte{s.char()}, s.totalOffset())
- }
- }
-ERROR:
- return nil, errors.ErrUnexpectedEndOfJSON("number(integer)", s.totalOffset())
-}
-
-func (d *intDecoder) decodeByte(buf []byte, cursor int64) ([]byte, int64, error) {
- b := (*sliceHeader)(unsafe.Pointer(&buf)).data
- for {
- switch char(b, cursor) {
- case ' ', '\n', '\t', '\r':
- cursor++
- continue
- case '0':
- cursor++
- return numZeroBuf, cursor, nil
- case '-', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- start := cursor
- cursor++
- for numTable[char(b, cursor)] {
- cursor++
- }
- num := buf[start:cursor]
- return num, cursor, nil
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return nil, 0, err
- }
- cursor += 4
- return nil, cursor, nil
- default:
- return nil, 0, d.typeError([]byte{char(b, cursor)}, cursor)
- }
- }
-}
-
-func (d *intDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- bytes, err := d.decodeStreamByte(s)
- if err != nil {
- return err
- }
- if bytes == nil {
- return nil
- }
- i64, err := d.parseInt(bytes)
- if err != nil {
- return d.typeError(bytes, s.totalOffset())
- }
- switch d.kind {
- case reflect.Int8:
- if i64 < -1*(1<<7) || (1<<7) <= i64 {
- return d.typeError(bytes, s.totalOffset())
- }
- case reflect.Int16:
- if i64 < -1*(1<<15) || (1<<15) <= i64 {
- return d.typeError(bytes, s.totalOffset())
- }
- case reflect.Int32:
- if i64 < -1*(1<<31) || (1<<31) <= i64 {
- return d.typeError(bytes, s.totalOffset())
- }
- }
- d.op(p, i64)
- s.reset()
- return nil
-}
-
-func (d *intDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- bytes, c, err := d.decodeByte(ctx.Buf, cursor)
- if err != nil {
- return 0, err
- }
- if bytes == nil {
- return c, nil
- }
- cursor = c
-
- i64, err := d.parseInt(bytes)
- if err != nil {
- return 0, d.typeError(bytes, cursor)
- }
- switch d.kind {
- case reflect.Int8:
- if i64 < -1*(1<<7) || (1<<7) <= i64 {
- return 0, d.typeError(bytes, cursor)
- }
- case reflect.Int16:
- if i64 < -1*(1<<15) || (1<<15) <= i64 {
- return 0, d.typeError(bytes, cursor)
- }
- case reflect.Int32:
- if i64 < -1*(1<<31) || (1<<31) <= i64 {
- return 0, d.typeError(bytes, cursor)
- }
- }
- d.op(p, i64)
- return cursor, nil
-}
-
-func (d *intDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- return nil, 0, fmt.Errorf("json: int decoder does not support decode path")
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/interface.go b/vendor/github.com/goccy/go-json/internal/decoder/interface.go
deleted file mode 100644
index 45c69ab8c70..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/interface.go
+++ /dev/null
@@ -1,528 +0,0 @@
-package decoder
-
-import (
- "bytes"
- "encoding"
- "encoding/json"
- "reflect"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type interfaceDecoder struct {
- typ *runtime.Type
- structName string
- fieldName string
- sliceDecoder *sliceDecoder
- mapDecoder *mapDecoder
- floatDecoder *floatDecoder
- numberDecoder *numberDecoder
- stringDecoder *stringDecoder
-}
-
-func newEmptyInterfaceDecoder(structName, fieldName string) *interfaceDecoder {
- ifaceDecoder := &interfaceDecoder{
- typ: emptyInterfaceType,
- structName: structName,
- fieldName: fieldName,
- floatDecoder: newFloatDecoder(structName, fieldName, func(p unsafe.Pointer, v float64) {
- *(*interface{})(p) = v
- }),
- numberDecoder: newNumberDecoder(structName, fieldName, func(p unsafe.Pointer, v json.Number) {
- *(*interface{})(p) = v
- }),
- stringDecoder: newStringDecoder(structName, fieldName),
- }
- ifaceDecoder.sliceDecoder = newSliceDecoder(
- ifaceDecoder,
- emptyInterfaceType,
- emptyInterfaceType.Size(),
- structName, fieldName,
- )
- ifaceDecoder.mapDecoder = newMapDecoder(
- interfaceMapType,
- stringType,
- ifaceDecoder.stringDecoder,
- interfaceMapType.Elem(),
- ifaceDecoder,
- structName,
- fieldName,
- )
- return ifaceDecoder
-}
-
-func newInterfaceDecoder(typ *runtime.Type, structName, fieldName string) *interfaceDecoder {
- emptyIfaceDecoder := newEmptyInterfaceDecoder(structName, fieldName)
- stringDecoder := newStringDecoder(structName, fieldName)
- return &interfaceDecoder{
- typ: typ,
- structName: structName,
- fieldName: fieldName,
- sliceDecoder: newSliceDecoder(
- emptyIfaceDecoder,
- emptyInterfaceType,
- emptyInterfaceType.Size(),
- structName, fieldName,
- ),
- mapDecoder: newMapDecoder(
- interfaceMapType,
- stringType,
- stringDecoder,
- interfaceMapType.Elem(),
- emptyIfaceDecoder,
- structName,
- fieldName,
- ),
- floatDecoder: newFloatDecoder(structName, fieldName, func(p unsafe.Pointer, v float64) {
- *(*interface{})(p) = v
- }),
- numberDecoder: newNumberDecoder(structName, fieldName, func(p unsafe.Pointer, v json.Number) {
- *(*interface{})(p) = v
- }),
- stringDecoder: stringDecoder,
- }
-}
-
-func (d *interfaceDecoder) numDecoder(s *Stream) Decoder {
- if s.UseNumber {
- return d.numberDecoder
- }
- return d.floatDecoder
-}
-
-var (
- emptyInterfaceType = runtime.Type2RType(reflect.TypeOf((*interface{})(nil)).Elem())
- EmptyInterfaceType = emptyInterfaceType
- interfaceMapType = runtime.Type2RType(
- reflect.TypeOf((*map[string]interface{})(nil)).Elem(),
- )
- stringType = runtime.Type2RType(
- reflect.TypeOf(""),
- )
-)
-
-func decodeStreamUnmarshaler(s *Stream, depth int64, unmarshaler json.Unmarshaler) error {
- start := s.cursor
- if err := s.skipValue(depth); err != nil {
- return err
- }
- src := s.buf[start:s.cursor]
- dst := make([]byte, len(src))
- copy(dst, src)
-
- if err := unmarshaler.UnmarshalJSON(dst); err != nil {
- return err
- }
- return nil
-}
-
-func decodeStreamUnmarshalerContext(s *Stream, depth int64, unmarshaler unmarshalerContext) error {
- start := s.cursor
- if err := s.skipValue(depth); err != nil {
- return err
- }
- src := s.buf[start:s.cursor]
- dst := make([]byte, len(src))
- copy(dst, src)
-
- if err := unmarshaler.UnmarshalJSON(s.Option.Context, dst); err != nil {
- return err
- }
- return nil
-}
-
-func decodeUnmarshaler(buf []byte, cursor, depth int64, unmarshaler json.Unmarshaler) (int64, error) {
- cursor = skipWhiteSpace(buf, cursor)
- start := cursor
- end, err := skipValue(buf, cursor, depth)
- if err != nil {
- return 0, err
- }
- src := buf[start:end]
- dst := make([]byte, len(src))
- copy(dst, src)
-
- if err := unmarshaler.UnmarshalJSON(dst); err != nil {
- return 0, err
- }
- return end, nil
-}
-
-func decodeUnmarshalerContext(ctx *RuntimeContext, buf []byte, cursor, depth int64, unmarshaler unmarshalerContext) (int64, error) {
- cursor = skipWhiteSpace(buf, cursor)
- start := cursor
- end, err := skipValue(buf, cursor, depth)
- if err != nil {
- return 0, err
- }
- src := buf[start:end]
- dst := make([]byte, len(src))
- copy(dst, src)
-
- if err := unmarshaler.UnmarshalJSON(ctx.Option.Context, dst); err != nil {
- return 0, err
- }
- return end, nil
-}
-
-func decodeStreamTextUnmarshaler(s *Stream, depth int64, unmarshaler encoding.TextUnmarshaler, p unsafe.Pointer) error {
- start := s.cursor
- if err := s.skipValue(depth); err != nil {
- return err
- }
- src := s.buf[start:s.cursor]
- if bytes.Equal(src, nullbytes) {
- *(*unsafe.Pointer)(p) = nil
- return nil
- }
-
- dst := make([]byte, len(src))
- copy(dst, src)
-
- if err := unmarshaler.UnmarshalText(dst); err != nil {
- return err
- }
- return nil
-}
-
-func decodeTextUnmarshaler(buf []byte, cursor, depth int64, unmarshaler encoding.TextUnmarshaler, p unsafe.Pointer) (int64, error) {
- cursor = skipWhiteSpace(buf, cursor)
- start := cursor
- end, err := skipValue(buf, cursor, depth)
- if err != nil {
- return 0, err
- }
- src := buf[start:end]
- if bytes.Equal(src, nullbytes) {
- *(*unsafe.Pointer)(p) = nil
- return end, nil
- }
- if s, ok := unquoteBytes(src); ok {
- src = s
- }
- if err := unmarshaler.UnmarshalText(src); err != nil {
- return 0, err
- }
- return end, nil
-}
-
-func (d *interfaceDecoder) decodeStreamEmptyInterface(s *Stream, depth int64, p unsafe.Pointer) error {
- c := s.skipWhiteSpace()
- for {
- switch c {
- case '{':
- var v map[string]interface{}
- ptr := unsafe.Pointer(&v)
- if err := d.mapDecoder.DecodeStream(s, depth, ptr); err != nil {
- return err
- }
- *(*interface{})(p) = v
- return nil
- case '[':
- var v []interface{}
- ptr := unsafe.Pointer(&v)
- if err := d.sliceDecoder.DecodeStream(s, depth, ptr); err != nil {
- return err
- }
- *(*interface{})(p) = v
- return nil
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return d.numDecoder(s).DecodeStream(s, depth, p)
- case '"':
- s.cursor++
- start := s.cursor
- for {
- switch s.char() {
- case '\\':
- if _, err := decodeEscapeString(s, nil); err != nil {
- return err
- }
- case '"':
- literal := s.buf[start:s.cursor]
- s.cursor++
- *(*interface{})(p) = string(literal)
- return nil
- case nul:
- if s.read() {
- continue
- }
- return errors.ErrUnexpectedEndOfJSON("string", s.totalOffset())
- }
- s.cursor++
- }
- case 't':
- if err := trueBytes(s); err != nil {
- return err
- }
- **(**interface{})(unsafe.Pointer(&p)) = true
- return nil
- case 'f':
- if err := falseBytes(s); err != nil {
- return err
- }
- **(**interface{})(unsafe.Pointer(&p)) = false
- return nil
- case 'n':
- if err := nullBytes(s); err != nil {
- return err
- }
- *(*interface{})(p) = nil
- return nil
- case nul:
- if s.read() {
- c = s.char()
- continue
- }
- }
- break
- }
- return errors.ErrInvalidBeginningOfValue(c, s.totalOffset())
-}
-
-type emptyInterface struct {
- typ *runtime.Type
- ptr unsafe.Pointer
-}
-
-func (d *interfaceDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- runtimeInterfaceValue := *(*interface{})(unsafe.Pointer(&emptyInterface{
- typ: d.typ,
- ptr: p,
- }))
- rv := reflect.ValueOf(runtimeInterfaceValue)
- if rv.NumMethod() > 0 && rv.CanInterface() {
- if u, ok := rv.Interface().(unmarshalerContext); ok {
- return decodeStreamUnmarshalerContext(s, depth, u)
- }
- if u, ok := rv.Interface().(json.Unmarshaler); ok {
- return decodeStreamUnmarshaler(s, depth, u)
- }
- if u, ok := rv.Interface().(encoding.TextUnmarshaler); ok {
- return decodeStreamTextUnmarshaler(s, depth, u, p)
- }
- if s.skipWhiteSpace() == 'n' {
- if err := nullBytes(s); err != nil {
- return err
- }
- *(*interface{})(p) = nil
- return nil
- }
- return d.errUnmarshalType(rv.Type(), s.totalOffset())
- }
- iface := rv.Interface()
- ifaceHeader := (*emptyInterface)(unsafe.Pointer(&iface))
- typ := ifaceHeader.typ
- if ifaceHeader.ptr == nil || d.typ == typ || typ == nil {
- // concrete type is empty interface
- return d.decodeStreamEmptyInterface(s, depth, p)
- }
- if typ.Kind() == reflect.Ptr && typ.Elem() == d.typ || typ.Kind() != reflect.Ptr {
- return d.decodeStreamEmptyInterface(s, depth, p)
- }
- if s.skipWhiteSpace() == 'n' {
- if err := nullBytes(s); err != nil {
- return err
- }
- *(*interface{})(p) = nil
- return nil
- }
- decoder, err := CompileToGetDecoder(typ)
- if err != nil {
- return err
- }
- return decoder.DecodeStream(s, depth, ifaceHeader.ptr)
-}
-
-func (d *interfaceDecoder) errUnmarshalType(typ reflect.Type, offset int64) *errors.UnmarshalTypeError {
- return &errors.UnmarshalTypeError{
- Value: typ.String(),
- Type: typ,
- Offset: offset,
- Struct: d.structName,
- Field: d.fieldName,
- }
-}
-
-func (d *interfaceDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- buf := ctx.Buf
- runtimeInterfaceValue := *(*interface{})(unsafe.Pointer(&emptyInterface{
- typ: d.typ,
- ptr: p,
- }))
- rv := reflect.ValueOf(runtimeInterfaceValue)
- if rv.NumMethod() > 0 && rv.CanInterface() {
- if u, ok := rv.Interface().(unmarshalerContext); ok {
- return decodeUnmarshalerContext(ctx, buf, cursor, depth, u)
- }
- if u, ok := rv.Interface().(json.Unmarshaler); ok {
- return decodeUnmarshaler(buf, cursor, depth, u)
- }
- if u, ok := rv.Interface().(encoding.TextUnmarshaler); ok {
- return decodeTextUnmarshaler(buf, cursor, depth, u, p)
- }
- cursor = skipWhiteSpace(buf, cursor)
- if buf[cursor] == 'n' {
- if err := validateNull(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 4
- **(**interface{})(unsafe.Pointer(&p)) = nil
- return cursor, nil
- }
- return 0, d.errUnmarshalType(rv.Type(), cursor)
- }
-
- iface := rv.Interface()
- ifaceHeader := (*emptyInterface)(unsafe.Pointer(&iface))
- typ := ifaceHeader.typ
- if ifaceHeader.ptr == nil || d.typ == typ || typ == nil {
- // concrete type is empty interface
- return d.decodeEmptyInterface(ctx, cursor, depth, p)
- }
- if typ.Kind() == reflect.Ptr && typ.Elem() == d.typ || typ.Kind() != reflect.Ptr {
- return d.decodeEmptyInterface(ctx, cursor, depth, p)
- }
- cursor = skipWhiteSpace(buf, cursor)
- if buf[cursor] == 'n' {
- if err := validateNull(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 4
- **(**interface{})(unsafe.Pointer(&p)) = nil
- return cursor, nil
- }
- decoder, err := CompileToGetDecoder(typ)
- if err != nil {
- return 0, err
- }
- return decoder.Decode(ctx, cursor, depth, ifaceHeader.ptr)
-}
-
-func (d *interfaceDecoder) decodeEmptyInterface(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- buf := ctx.Buf
- cursor = skipWhiteSpace(buf, cursor)
- switch buf[cursor] {
- case '{':
- var v map[string]interface{}
- ptr := unsafe.Pointer(&v)
- cursor, err := d.mapDecoder.Decode(ctx, cursor, depth, ptr)
- if err != nil {
- return 0, err
- }
- **(**interface{})(unsafe.Pointer(&p)) = v
- return cursor, nil
- case '[':
- var v []interface{}
- ptr := unsafe.Pointer(&v)
- cursor, err := d.sliceDecoder.Decode(ctx, cursor, depth, ptr)
- if err != nil {
- return 0, err
- }
- **(**interface{})(unsafe.Pointer(&p)) = v
- return cursor, nil
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return d.floatDecoder.Decode(ctx, cursor, depth, p)
- case '"':
- var v string
- ptr := unsafe.Pointer(&v)
- cursor, err := d.stringDecoder.Decode(ctx, cursor, depth, ptr)
- if err != nil {
- return 0, err
- }
- **(**interface{})(unsafe.Pointer(&p)) = v
- return cursor, nil
- case 't':
- if err := validateTrue(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 4
- **(**interface{})(unsafe.Pointer(&p)) = true
- return cursor, nil
- case 'f':
- if err := validateFalse(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 5
- **(**interface{})(unsafe.Pointer(&p)) = false
- return cursor, nil
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 4
- **(**interface{})(unsafe.Pointer(&p)) = nil
- return cursor, nil
- }
- return cursor, errors.ErrInvalidBeginningOfValue(buf[cursor], cursor)
-}
-
-func NewPathDecoder() Decoder {
- ifaceDecoder := &interfaceDecoder{
- typ: emptyInterfaceType,
- structName: "",
- fieldName: "",
- floatDecoder: newFloatDecoder("", "", func(p unsafe.Pointer, v float64) {
- *(*interface{})(p) = v
- }),
- numberDecoder: newNumberDecoder("", "", func(p unsafe.Pointer, v json.Number) {
- *(*interface{})(p) = v
- }),
- stringDecoder: newStringDecoder("", ""),
- }
- ifaceDecoder.sliceDecoder = newSliceDecoder(
- ifaceDecoder,
- emptyInterfaceType,
- emptyInterfaceType.Size(),
- "", "",
- )
- ifaceDecoder.mapDecoder = newMapDecoder(
- interfaceMapType,
- stringType,
- ifaceDecoder.stringDecoder,
- interfaceMapType.Elem(),
- ifaceDecoder,
- "", "",
- )
- return ifaceDecoder
-}
-
-var (
- truebytes = []byte("true")
- falsebytes = []byte("false")
-)
-
-func (d *interfaceDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- buf := ctx.Buf
- cursor = skipWhiteSpace(buf, cursor)
- switch buf[cursor] {
- case '{':
- return d.mapDecoder.DecodePath(ctx, cursor, depth)
- case '[':
- return d.sliceDecoder.DecodePath(ctx, cursor, depth)
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return d.floatDecoder.DecodePath(ctx, cursor, depth)
- case '"':
- return d.stringDecoder.DecodePath(ctx, cursor, depth)
- case 't':
- if err := validateTrue(buf, cursor); err != nil {
- return nil, 0, err
- }
- cursor += 4
- return [][]byte{truebytes}, cursor, nil
- case 'f':
- if err := validateFalse(buf, cursor); err != nil {
- return nil, 0, err
- }
- cursor += 5
- return [][]byte{falsebytes}, cursor, nil
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return nil, 0, err
- }
- cursor += 4
- return [][]byte{nullbytes}, cursor, nil
- }
- return nil, cursor, errors.ErrInvalidBeginningOfValue(buf[cursor], cursor)
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/invalid.go b/vendor/github.com/goccy/go-json/internal/decoder/invalid.go
deleted file mode 100644
index 4c9721b0989..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/invalid.go
+++ /dev/null
@@ -1,55 +0,0 @@
-package decoder
-
-import (
- "reflect"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type invalidDecoder struct {
- typ *runtime.Type
- kind reflect.Kind
- structName string
- fieldName string
-}
-
-func newInvalidDecoder(typ *runtime.Type, structName, fieldName string) *invalidDecoder {
- return &invalidDecoder{
- typ: typ,
- kind: typ.Kind(),
- structName: structName,
- fieldName: fieldName,
- }
-}
-
-func (d *invalidDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- return &errors.UnmarshalTypeError{
- Value: "object",
- Type: runtime.RType2Type(d.typ),
- Offset: s.totalOffset(),
- Struct: d.structName,
- Field: d.fieldName,
- }
-}
-
-func (d *invalidDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- return 0, &errors.UnmarshalTypeError{
- Value: "object",
- Type: runtime.RType2Type(d.typ),
- Offset: cursor,
- Struct: d.structName,
- Field: d.fieldName,
- }
-}
-
-func (d *invalidDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- return nil, 0, &errors.UnmarshalTypeError{
- Value: "object",
- Type: runtime.RType2Type(d.typ),
- Offset: cursor,
- Struct: d.structName,
- Field: d.fieldName,
- }
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/map.go b/vendor/github.com/goccy/go-json/internal/decoder/map.go
deleted file mode 100644
index 07a9caea651..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/map.go
+++ /dev/null
@@ -1,280 +0,0 @@
-package decoder
-
-import (
- "reflect"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type mapDecoder struct {
- mapType *runtime.Type
- keyType *runtime.Type
- valueType *runtime.Type
- canUseAssignFaststrType bool
- keyDecoder Decoder
- valueDecoder Decoder
- structName string
- fieldName string
-}
-
-func newMapDecoder(mapType *runtime.Type, keyType *runtime.Type, keyDec Decoder, valueType *runtime.Type, valueDec Decoder, structName, fieldName string) *mapDecoder {
- return &mapDecoder{
- mapType: mapType,
- keyDecoder: keyDec,
- keyType: keyType,
- canUseAssignFaststrType: canUseAssignFaststrType(keyType, valueType),
- valueType: valueType,
- valueDecoder: valueDec,
- structName: structName,
- fieldName: fieldName,
- }
-}
-
-const (
- mapMaxElemSize = 128
-)
-
-// See detail: https://github.com/goccy/go-json/pull/283
-func canUseAssignFaststrType(key *runtime.Type, value *runtime.Type) bool {
- indirectElem := value.Size() > mapMaxElemSize
- if indirectElem {
- return false
- }
- return key.Kind() == reflect.String
-}
-
-//go:linkname makemap reflect.makemap
-func makemap(*runtime.Type, int) unsafe.Pointer
-
-//nolint:golint
-//go:linkname mapassign_faststr runtime.mapassign_faststr
-//go:noescape
-func mapassign_faststr(t *runtime.Type, m unsafe.Pointer, s string) unsafe.Pointer
-
-//go:linkname mapassign reflect.mapassign
-//go:noescape
-func mapassign(t *runtime.Type, m unsafe.Pointer, k, v unsafe.Pointer)
-
-func (d *mapDecoder) mapassign(t *runtime.Type, m, k, v unsafe.Pointer) {
- if d.canUseAssignFaststrType {
- mapV := mapassign_faststr(t, m, *(*string)(k))
- typedmemmove(d.valueType, mapV, v)
- } else {
- mapassign(t, m, k, v)
- }
-}
-
-func (d *mapDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- depth++
- if depth > maxDecodeNestingDepth {
- return errors.ErrExceededMaxDepth(s.char(), s.cursor)
- }
-
- switch s.skipWhiteSpace() {
- case 'n':
- if err := nullBytes(s); err != nil {
- return err
- }
- **(**unsafe.Pointer)(unsafe.Pointer(&p)) = nil
- return nil
- case '{':
- default:
- return errors.ErrExpected("{ character for map value", s.totalOffset())
- }
- mapValue := *(*unsafe.Pointer)(p)
- if mapValue == nil {
- mapValue = makemap(d.mapType, 0)
- }
- s.cursor++
- if s.skipWhiteSpace() == '}' {
- *(*unsafe.Pointer)(p) = mapValue
- s.cursor++
- return nil
- }
- for {
- k := unsafe_New(d.keyType)
- if err := d.keyDecoder.DecodeStream(s, depth, k); err != nil {
- return err
- }
- s.skipWhiteSpace()
- if !s.equalChar(':') {
- return errors.ErrExpected("colon after object key", s.totalOffset())
- }
- s.cursor++
- v := unsafe_New(d.valueType)
- if err := d.valueDecoder.DecodeStream(s, depth, v); err != nil {
- return err
- }
- d.mapassign(d.mapType, mapValue, k, v)
- s.skipWhiteSpace()
- if s.equalChar('}') {
- **(**unsafe.Pointer)(unsafe.Pointer(&p)) = mapValue
- s.cursor++
- return nil
- }
- if !s.equalChar(',') {
- return errors.ErrExpected("comma after object value", s.totalOffset())
- }
- s.cursor++
- }
-}
-
-func (d *mapDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- buf := ctx.Buf
- depth++
- if depth > maxDecodeNestingDepth {
- return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor)
- }
-
- cursor = skipWhiteSpace(buf, cursor)
- buflen := int64(len(buf))
- if buflen < 2 {
- return 0, errors.ErrExpected("{} for map", cursor)
- }
- switch buf[cursor] {
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 4
- **(**unsafe.Pointer)(unsafe.Pointer(&p)) = nil
- return cursor, nil
- case '{':
- default:
- return 0, errors.ErrExpected("{ character for map value", cursor)
- }
- cursor++
- cursor = skipWhiteSpace(buf, cursor)
- mapValue := *(*unsafe.Pointer)(p)
- if mapValue == nil {
- mapValue = makemap(d.mapType, 0)
- }
- if buf[cursor] == '}' {
- **(**unsafe.Pointer)(unsafe.Pointer(&p)) = mapValue
- cursor++
- return cursor, nil
- }
- for {
- k := unsafe_New(d.keyType)
- keyCursor, err := d.keyDecoder.Decode(ctx, cursor, depth, k)
- if err != nil {
- return 0, err
- }
- cursor = skipWhiteSpace(buf, keyCursor)
- if buf[cursor] != ':' {
- return 0, errors.ErrExpected("colon after object key", cursor)
- }
- cursor++
- v := unsafe_New(d.valueType)
- valueCursor, err := d.valueDecoder.Decode(ctx, cursor, depth, v)
- if err != nil {
- return 0, err
- }
- d.mapassign(d.mapType, mapValue, k, v)
- cursor = skipWhiteSpace(buf, valueCursor)
- if buf[cursor] == '}' {
- **(**unsafe.Pointer)(unsafe.Pointer(&p)) = mapValue
- cursor++
- return cursor, nil
- }
- if buf[cursor] != ',' {
- return 0, errors.ErrExpected("comma after object value", cursor)
- }
- cursor++
- }
-}
-
-func (d *mapDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- buf := ctx.Buf
- depth++
- if depth > maxDecodeNestingDepth {
- return nil, 0, errors.ErrExceededMaxDepth(buf[cursor], cursor)
- }
-
- cursor = skipWhiteSpace(buf, cursor)
- buflen := int64(len(buf))
- if buflen < 2 {
- return nil, 0, errors.ErrExpected("{} for map", cursor)
- }
- switch buf[cursor] {
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return nil, 0, err
- }
- cursor += 4
- return [][]byte{nullbytes}, cursor, nil
- case '{':
- default:
- return nil, 0, errors.ErrExpected("{ character for map value", cursor)
- }
- cursor++
- cursor = skipWhiteSpace(buf, cursor)
- if buf[cursor] == '}' {
- cursor++
- return nil, cursor, nil
- }
- keyDecoder, ok := d.keyDecoder.(*stringDecoder)
- if !ok {
- return nil, 0, &errors.UnmarshalTypeError{
- Value: "string",
- Type: reflect.TypeOf(""),
- Offset: cursor,
- Struct: d.structName,
- Field: d.fieldName,
- }
- }
- ret := [][]byte{}
- for {
- key, keyCursor, err := keyDecoder.decodeByte(buf, cursor)
- if err != nil {
- return nil, 0, err
- }
- cursor = skipWhiteSpace(buf, keyCursor)
- if buf[cursor] != ':' {
- return nil, 0, errors.ErrExpected("colon after object key", cursor)
- }
- cursor++
- child, found, err := ctx.Option.Path.Field(string(key))
- if err != nil {
- return nil, 0, err
- }
- if found {
- if child != nil {
- oldPath := ctx.Option.Path.node
- ctx.Option.Path.node = child
- paths, c, err := d.valueDecoder.DecodePath(ctx, cursor, depth)
- if err != nil {
- return nil, 0, err
- }
- ctx.Option.Path.node = oldPath
- ret = append(ret, paths...)
- cursor = c
- } else {
- start := cursor
- end, err := skipValue(buf, cursor, depth)
- if err != nil {
- return nil, 0, err
- }
- ret = append(ret, buf[start:end])
- cursor = end
- }
- } else {
- c, err := skipValue(buf, cursor, depth)
- if err != nil {
- return nil, 0, err
- }
- cursor = c
- }
- cursor = skipWhiteSpace(buf, cursor)
- if buf[cursor] == '}' {
- cursor++
- return ret, cursor, nil
- }
- if buf[cursor] != ',' {
- return nil, 0, errors.ErrExpected("comma after object value", cursor)
- }
- cursor++
- }
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/number.go b/vendor/github.com/goccy/go-json/internal/decoder/number.go
deleted file mode 100644
index 10e5435e6ce..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/number.go
+++ /dev/null
@@ -1,123 +0,0 @@
-package decoder
-
-import (
- "encoding/json"
- "strconv"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
-)
-
-type numberDecoder struct {
- stringDecoder *stringDecoder
- op func(unsafe.Pointer, json.Number)
- structName string
- fieldName string
-}
-
-func newNumberDecoder(structName, fieldName string, op func(unsafe.Pointer, json.Number)) *numberDecoder {
- return &numberDecoder{
- stringDecoder: newStringDecoder(structName, fieldName),
- op: op,
- structName: structName,
- fieldName: fieldName,
- }
-}
-
-func (d *numberDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- bytes, err := d.decodeStreamByte(s)
- if err != nil {
- return err
- }
- if _, err := strconv.ParseFloat(*(*string)(unsafe.Pointer(&bytes)), 64); err != nil {
- return errors.ErrSyntax(err.Error(), s.totalOffset())
- }
- d.op(p, json.Number(string(bytes)))
- s.reset()
- return nil
-}
-
-func (d *numberDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- bytes, c, err := d.decodeByte(ctx.Buf, cursor)
- if err != nil {
- return 0, err
- }
- if _, err := strconv.ParseFloat(*(*string)(unsafe.Pointer(&bytes)), 64); err != nil {
- return 0, errors.ErrSyntax(err.Error(), c)
- }
- cursor = c
- s := *(*string)(unsafe.Pointer(&bytes))
- d.op(p, json.Number(s))
- return cursor, nil
-}
-
-func (d *numberDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- bytes, c, err := d.decodeByte(ctx.Buf, cursor)
- if err != nil {
- return nil, 0, err
- }
- if bytes == nil {
- return [][]byte{nullbytes}, c, nil
- }
- return [][]byte{bytes}, c, nil
-}
-
-func (d *numberDecoder) decodeStreamByte(s *Stream) ([]byte, error) {
- start := s.cursor
- for {
- switch s.char() {
- case ' ', '\n', '\t', '\r':
- s.cursor++
- continue
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return floatBytes(s), nil
- case 'n':
- if err := nullBytes(s); err != nil {
- return nil, err
- }
- return nil, nil
- case '"':
- return d.stringDecoder.decodeStreamByte(s)
- case nul:
- if s.read() {
- continue
- }
- goto ERROR
- default:
- goto ERROR
- }
- }
-ERROR:
- if s.cursor == start {
- return nil, errors.ErrInvalidBeginningOfValue(s.char(), s.totalOffset())
- }
- return nil, errors.ErrUnexpectedEndOfJSON("json.Number", s.totalOffset())
-}
-
-func (d *numberDecoder) decodeByte(buf []byte, cursor int64) ([]byte, int64, error) {
- for {
- switch buf[cursor] {
- case ' ', '\n', '\t', '\r':
- cursor++
- continue
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- start := cursor
- cursor++
- for floatTable[buf[cursor]] {
- cursor++
- }
- num := buf[start:cursor]
- return num, cursor, nil
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return nil, 0, err
- }
- cursor += 4
- return nil, cursor, nil
- case '"':
- return d.stringDecoder.decodeByte(buf, cursor)
- default:
- return nil, 0, errors.ErrUnexpectedEndOfJSON("json.Number", cursor)
- }
- }
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/option.go b/vendor/github.com/goccy/go-json/internal/decoder/option.go
deleted file mode 100644
index 502f772eba0..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/option.go
+++ /dev/null
@@ -1,17 +0,0 @@
-package decoder
-
-import "context"
-
-type OptionFlags uint8
-
-const (
- FirstWinOption OptionFlags = 1 << iota
- ContextOption
- PathOption
-)
-
-type Option struct {
- Flags OptionFlags
- Context context.Context
- Path *Path
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/path.go b/vendor/github.com/goccy/go-json/internal/decoder/path.go
deleted file mode 100644
index a15ff69e3cd..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/path.go
+++ /dev/null
@@ -1,670 +0,0 @@
-package decoder
-
-import (
- "fmt"
- "reflect"
- "strconv"
-
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type PathString string
-
-func (s PathString) Build() (*Path, error) {
- builder := new(PathBuilder)
- return builder.Build([]rune(s))
-}
-
-type PathBuilder struct {
- root PathNode
- node PathNode
- singleQuotePathSelector bool
- doubleQuotePathSelector bool
-}
-
-func (b *PathBuilder) Build(buf []rune) (*Path, error) {
- node, err := b.build(buf)
- if err != nil {
- return nil, err
- }
- return &Path{
- node: node,
- RootSelectorOnly: node == nil,
- SingleQuotePathSelector: b.singleQuotePathSelector,
- DoubleQuotePathSelector: b.doubleQuotePathSelector,
- }, nil
-}
-
-func (b *PathBuilder) build(buf []rune) (PathNode, error) {
- if len(buf) == 0 {
- return nil, errors.ErrEmptyPath()
- }
- if buf[0] != '$' {
- return nil, errors.ErrInvalidPath("JSON Path must start with a $ character")
- }
- if len(buf) == 1 {
- return nil, nil
- }
- buf = buf[1:]
- offset, err := b.buildNext(buf)
- if err != nil {
- return nil, err
- }
- if len(buf) > offset {
- return nil, errors.ErrInvalidPath("remain invalid path %q", buf[offset:])
- }
- return b.root, nil
-}
-
-func (b *PathBuilder) buildNextCharIfExists(buf []rune, cursor int) (int, error) {
- if len(buf) > cursor {
- offset, err := b.buildNext(buf[cursor:])
- if err != nil {
- return 0, err
- }
- return cursor + 1 + offset, nil
- }
- return cursor, nil
-}
-
-func (b *PathBuilder) buildNext(buf []rune) (int, error) {
- switch buf[0] {
- case '.':
- if len(buf) == 1 {
- return 0, errors.ErrInvalidPath("JSON Path ends with dot character")
- }
- offset, err := b.buildSelector(buf[1:])
- if err != nil {
- return 0, err
- }
- return offset + 1, nil
- case '[':
- if len(buf) == 1 {
- return 0, errors.ErrInvalidPath("JSON Path ends with left bracket character")
- }
- offset, err := b.buildIndex(buf[1:])
- if err != nil {
- return 0, err
- }
- return offset + 1, nil
- default:
- return 0, errors.ErrInvalidPath("expect dot or left bracket character. but found %c character", buf[0])
- }
-}
-
-func (b *PathBuilder) buildSelector(buf []rune) (int, error) {
- switch buf[0] {
- case '.':
- if len(buf) == 1 {
- return 0, errors.ErrInvalidPath("JSON Path ends with double dot character")
- }
- offset, err := b.buildPathRecursive(buf[1:])
- if err != nil {
- return 0, err
- }
- return 1 + offset, nil
- case '[', ']', '$', '*':
- return 0, errors.ErrInvalidPath("found invalid path character %c after dot", buf[0])
- }
- for cursor := 0; cursor < len(buf); cursor++ {
- switch buf[cursor] {
- case '$', '*', ']':
- return 0, errors.ErrInvalidPath("found %c character in field selector context", buf[cursor])
- case '.':
- if cursor+1 >= len(buf) {
- return 0, errors.ErrInvalidPath("JSON Path ends with dot character")
- }
- selector := buf[:cursor]
- b.addSelectorNode(string(selector))
- offset, err := b.buildSelector(buf[cursor+1:])
- if err != nil {
- return 0, err
- }
- return cursor + 1 + offset, nil
- case '[':
- if cursor+1 >= len(buf) {
- return 0, errors.ErrInvalidPath("JSON Path ends with left bracket character")
- }
- selector := buf[:cursor]
- b.addSelectorNode(string(selector))
- offset, err := b.buildIndex(buf[cursor+1:])
- if err != nil {
- return 0, err
- }
- return cursor + 1 + offset, nil
- case '"':
- if cursor+1 >= len(buf) {
- return 0, errors.ErrInvalidPath("JSON Path ends with double quote character")
- }
- offset, err := b.buildQuoteSelector(buf[cursor+1:], DoubleQuotePathSelector)
- if err != nil {
- return 0, err
- }
- return cursor + 1 + offset, nil
- }
- }
- b.addSelectorNode(string(buf))
- return len(buf), nil
-}
-
-func (b *PathBuilder) buildQuoteSelector(buf []rune, sel QuotePathSelector) (int, error) {
- switch buf[0] {
- case '[', ']', '$', '.', '*', '\'', '"':
- return 0, errors.ErrInvalidPath("found invalid path character %c after quote", buf[0])
- }
- for cursor := 0; cursor < len(buf); cursor++ {
- switch buf[cursor] {
- case '\'':
- if sel != SingleQuotePathSelector {
- return 0, errors.ErrInvalidPath("found double quote character in field selector with single quote context")
- }
- if len(buf) <= cursor+1 {
- return 0, errors.ErrInvalidPath("JSON Path ends with single quote character in field selector context")
- }
- if buf[cursor+1] != ']' {
- return 0, errors.ErrInvalidPath("expect right bracket for field selector with single quote but found %c", buf[cursor+1])
- }
- selector := buf[:cursor]
- b.addSelectorNode(string(selector))
- b.singleQuotePathSelector = true
- return b.buildNextCharIfExists(buf, cursor+2)
- case '"':
- if sel != DoubleQuotePathSelector {
- return 0, errors.ErrInvalidPath("found single quote character in field selector with double quote context")
- }
- selector := buf[:cursor]
- b.addSelectorNode(string(selector))
- b.doubleQuotePathSelector = true
- return b.buildNextCharIfExists(buf, cursor+1)
- }
- }
- return 0, errors.ErrInvalidPath("couldn't find quote character in selector quote path context")
-}
-
-func (b *PathBuilder) buildPathRecursive(buf []rune) (int, error) {
- switch buf[0] {
- case '.', '[', ']', '$', '*':
- return 0, errors.ErrInvalidPath("found invalid path character %c after double dot", buf[0])
- }
- for cursor := 0; cursor < len(buf); cursor++ {
- switch buf[cursor] {
- case '$', '*', ']':
- return 0, errors.ErrInvalidPath("found %c character in field selector context", buf[cursor])
- case '.':
- if cursor+1 >= len(buf) {
- return 0, errors.ErrInvalidPath("JSON Path ends with dot character")
- }
- selector := buf[:cursor]
- b.addRecursiveNode(string(selector))
- offset, err := b.buildSelector(buf[cursor+1:])
- if err != nil {
- return 0, err
- }
- return cursor + 1 + offset, nil
- case '[':
- if cursor+1 >= len(buf) {
- return 0, errors.ErrInvalidPath("JSON Path ends with left bracket character")
- }
- selector := buf[:cursor]
- b.addRecursiveNode(string(selector))
- offset, err := b.buildIndex(buf[cursor+1:])
- if err != nil {
- return 0, err
- }
- return cursor + 1 + offset, nil
- }
- }
- b.addRecursiveNode(string(buf))
- return len(buf), nil
-}
-
-func (b *PathBuilder) buildIndex(buf []rune) (int, error) {
- switch buf[0] {
- case '.', '[', ']', '$':
- return 0, errors.ErrInvalidPath("found invalid path character %c after left bracket", buf[0])
- case '\'':
- if len(buf) == 1 {
- return 0, errors.ErrInvalidPath("JSON Path ends with single quote character")
- }
- offset, err := b.buildQuoteSelector(buf[1:], SingleQuotePathSelector)
- if err != nil {
- return 0, err
- }
- return 1 + offset, nil
- case '*':
- if len(buf) == 1 {
- return 0, errors.ErrInvalidPath("JSON Path ends with star character")
- }
- if buf[1] != ']' {
- return 0, errors.ErrInvalidPath("expect right bracket character for index all path but found %c character", buf[1])
- }
- b.addIndexAllNode()
- offset := len("*]")
- if len(buf) > 2 {
- buildOffset, err := b.buildNext(buf[2:])
- if err != nil {
- return 0, err
- }
- return offset + buildOffset, nil
- }
- return offset, nil
- }
-
- for cursor := 0; cursor < len(buf); cursor++ {
- switch buf[cursor] {
- case ']':
- index, err := strconv.ParseInt(string(buf[:cursor]), 10, 64)
- if err != nil {
- return 0, errors.ErrInvalidPath("%q is unexpected index path", buf[:cursor])
- }
- b.addIndexNode(int(index))
- return b.buildNextCharIfExists(buf, cursor+1)
- }
- }
- return 0, errors.ErrInvalidPath("couldn't find right bracket character in index path context")
-}
-
-func (b *PathBuilder) addIndexAllNode() {
- node := newPathIndexAllNode()
- if b.root == nil {
- b.root = node
- b.node = node
- } else {
- b.node = b.node.chain(node)
- }
-}
-
-func (b *PathBuilder) addRecursiveNode(selector string) {
- node := newPathRecursiveNode(selector)
- if b.root == nil {
- b.root = node
- b.node = node
- } else {
- b.node = b.node.chain(node)
- }
-}
-
-func (b *PathBuilder) addSelectorNode(name string) {
- node := newPathSelectorNode(name)
- if b.root == nil {
- b.root = node
- b.node = node
- } else {
- b.node = b.node.chain(node)
- }
-}
-
-func (b *PathBuilder) addIndexNode(idx int) {
- node := newPathIndexNode(idx)
- if b.root == nil {
- b.root = node
- b.node = node
- } else {
- b.node = b.node.chain(node)
- }
-}
-
-type QuotePathSelector int
-
-const (
- SingleQuotePathSelector QuotePathSelector = 1
- DoubleQuotePathSelector QuotePathSelector = 2
-)
-
-type Path struct {
- node PathNode
- RootSelectorOnly bool
- SingleQuotePathSelector bool
- DoubleQuotePathSelector bool
-}
-
-func (p *Path) Field(sel string) (PathNode, bool, error) {
- if p.node == nil {
- return nil, false, nil
- }
- return p.node.Field(sel)
-}
-
-func (p *Path) Get(src, dst reflect.Value) error {
- if p.node == nil {
- return nil
- }
- return p.node.Get(src, dst)
-}
-
-func (p *Path) String() string {
- if p.node == nil {
- return "$"
- }
- return p.node.String()
-}
-
-type PathNode interface {
- fmt.Stringer
- Index(idx int) (PathNode, bool, error)
- Field(fieldName string) (PathNode, bool, error)
- Get(src, dst reflect.Value) error
- chain(PathNode) PathNode
- target() bool
- single() bool
-}
-
-type BasePathNode struct {
- child PathNode
-}
-
-func (n *BasePathNode) chain(node PathNode) PathNode {
- n.child = node
- return node
-}
-
-func (n *BasePathNode) target() bool {
- return n.child == nil
-}
-
-func (n *BasePathNode) single() bool {
- return true
-}
-
-type PathSelectorNode struct {
- *BasePathNode
- selector string
-}
-
-func newPathSelectorNode(selector string) *PathSelectorNode {
- return &PathSelectorNode{
- BasePathNode: &BasePathNode{},
- selector: selector,
- }
-}
-
-func (n *PathSelectorNode) Index(idx int) (PathNode, bool, error) {
- return nil, false, &errors.PathError{}
-}
-
-func (n *PathSelectorNode) Field(fieldName string) (PathNode, bool, error) {
- if n.selector == fieldName {
- return n.child, true, nil
- }
- return nil, false, nil
-}
-
-func (n *PathSelectorNode) Get(src, dst reflect.Value) error {
- switch src.Type().Kind() {
- case reflect.Map:
- iter := src.MapRange()
- for iter.Next() {
- key, ok := iter.Key().Interface().(string)
- if !ok {
- return fmt.Errorf("invalid map key type %T", src.Type().Key())
- }
- child, found, err := n.Field(key)
- if err != nil {
- return err
- }
- if found {
- if child != nil {
- return child.Get(iter.Value(), dst)
- }
- return AssignValue(iter.Value(), dst)
- }
- }
- case reflect.Struct:
- typ := src.Type()
- for i := 0; i < typ.Len(); i++ {
- tag := runtime.StructTagFromField(typ.Field(i))
- child, found, err := n.Field(tag.Key)
- if err != nil {
- return err
- }
- if found {
- if child != nil {
- return child.Get(src.Field(i), dst)
- }
- return AssignValue(src.Field(i), dst)
- }
- }
- case reflect.Ptr:
- return n.Get(src.Elem(), dst)
- case reflect.Interface:
- return n.Get(reflect.ValueOf(src.Interface()), dst)
- case reflect.Float64, reflect.String, reflect.Bool:
- return AssignValue(src, dst)
- }
- return fmt.Errorf("failed to get %s value from %s", n.selector, src.Type())
-}
-
-func (n *PathSelectorNode) String() string {
- s := fmt.Sprintf(".%s", n.selector)
- if n.child != nil {
- s += n.child.String()
- }
- return s
-}
-
-type PathIndexNode struct {
- *BasePathNode
- selector int
-}
-
-func newPathIndexNode(selector int) *PathIndexNode {
- return &PathIndexNode{
- BasePathNode: &BasePathNode{},
- selector: selector,
- }
-}
-
-func (n *PathIndexNode) Index(idx int) (PathNode, bool, error) {
- if n.selector == idx {
- return n.child, true, nil
- }
- return nil, false, nil
-}
-
-func (n *PathIndexNode) Field(fieldName string) (PathNode, bool, error) {
- return nil, false, &errors.PathError{}
-}
-
-func (n *PathIndexNode) Get(src, dst reflect.Value) error {
- switch src.Type().Kind() {
- case reflect.Array, reflect.Slice:
- if src.Len() > n.selector {
- if n.child != nil {
- return n.child.Get(src.Index(n.selector), dst)
- }
- return AssignValue(src.Index(n.selector), dst)
- }
- case reflect.Ptr:
- return n.Get(src.Elem(), dst)
- case reflect.Interface:
- return n.Get(reflect.ValueOf(src.Interface()), dst)
- }
- return fmt.Errorf("failed to get [%d] value from %s", n.selector, src.Type())
-}
-
-func (n *PathIndexNode) String() string {
- s := fmt.Sprintf("[%d]", n.selector)
- if n.child != nil {
- s += n.child.String()
- }
- return s
-}
-
-type PathIndexAllNode struct {
- *BasePathNode
-}
-
-func newPathIndexAllNode() *PathIndexAllNode {
- return &PathIndexAllNode{
- BasePathNode: &BasePathNode{},
- }
-}
-
-func (n *PathIndexAllNode) Index(idx int) (PathNode, bool, error) {
- return n.child, true, nil
-}
-
-func (n *PathIndexAllNode) Field(fieldName string) (PathNode, bool, error) {
- return nil, false, &errors.PathError{}
-}
-
-func (n *PathIndexAllNode) Get(src, dst reflect.Value) error {
- switch src.Type().Kind() {
- case reflect.Array, reflect.Slice:
- var arr []interface{}
- for i := 0; i < src.Len(); i++ {
- var v interface{}
- rv := reflect.ValueOf(&v)
- if n.child != nil {
- if err := n.child.Get(src.Index(i), rv); err != nil {
- return err
- }
- } else {
- if err := AssignValue(src.Index(i), rv); err != nil {
- return err
- }
- }
- arr = append(arr, v)
- }
- if err := AssignValue(reflect.ValueOf(arr), dst); err != nil {
- return err
- }
- return nil
- case reflect.Ptr:
- return n.Get(src.Elem(), dst)
- case reflect.Interface:
- return n.Get(reflect.ValueOf(src.Interface()), dst)
- }
- return fmt.Errorf("failed to get all value from %s", src.Type())
-}
-
-func (n *PathIndexAllNode) String() string {
- s := "[*]"
- if n.child != nil {
- s += n.child.String()
- }
- return s
-}
-
-type PathRecursiveNode struct {
- *BasePathNode
- selector string
-}
-
-func newPathRecursiveNode(selector string) *PathRecursiveNode {
- node := newPathSelectorNode(selector)
- return &PathRecursiveNode{
- BasePathNode: &BasePathNode{
- child: node,
- },
- selector: selector,
- }
-}
-
-func (n *PathRecursiveNode) Field(fieldName string) (PathNode, bool, error) {
- if n.selector == fieldName {
- return n.child, true, nil
- }
- return nil, false, nil
-}
-
-func (n *PathRecursiveNode) Index(_ int) (PathNode, bool, error) {
- return n, true, nil
-}
-
-func valueToSliceValue(v interface{}) []interface{} {
- rv := reflect.ValueOf(v)
- ret := []interface{}{}
- if rv.Type().Kind() == reflect.Slice || rv.Type().Kind() == reflect.Array {
- for i := 0; i < rv.Len(); i++ {
- ret = append(ret, rv.Index(i).Interface())
- }
- return ret
- }
- return []interface{}{v}
-}
-
-func (n *PathRecursiveNode) Get(src, dst reflect.Value) error {
- if n.child == nil {
- return fmt.Errorf("failed to get by recursive path ..%s", n.selector)
- }
- var arr []interface{}
- switch src.Type().Kind() {
- case reflect.Map:
- iter := src.MapRange()
- for iter.Next() {
- key, ok := iter.Key().Interface().(string)
- if !ok {
- return fmt.Errorf("invalid map key type %T", src.Type().Key())
- }
- child, found, err := n.Field(key)
- if err != nil {
- return err
- }
- if found {
- var v interface{}
- rv := reflect.ValueOf(&v)
- _ = child.Get(iter.Value(), rv)
- arr = append(arr, valueToSliceValue(v)...)
- } else {
- var v interface{}
- rv := reflect.ValueOf(&v)
- _ = n.Get(iter.Value(), rv)
- if v != nil {
- arr = append(arr, valueToSliceValue(v)...)
- }
- }
- }
- _ = AssignValue(reflect.ValueOf(arr), dst)
- return nil
- case reflect.Struct:
- typ := src.Type()
- for i := 0; i < typ.Len(); i++ {
- tag := runtime.StructTagFromField(typ.Field(i))
- child, found, err := n.Field(tag.Key)
- if err != nil {
- return err
- }
- if found {
- var v interface{}
- rv := reflect.ValueOf(&v)
- _ = child.Get(src.Field(i), rv)
- arr = append(arr, valueToSliceValue(v)...)
- } else {
- var v interface{}
- rv := reflect.ValueOf(&v)
- _ = n.Get(src.Field(i), rv)
- if v != nil {
- arr = append(arr, valueToSliceValue(v)...)
- }
- }
- }
- _ = AssignValue(reflect.ValueOf(arr), dst)
- return nil
- case reflect.Array, reflect.Slice:
- for i := 0; i < src.Len(); i++ {
- var v interface{}
- rv := reflect.ValueOf(&v)
- _ = n.Get(src.Index(i), rv)
- if v != nil {
- arr = append(arr, valueToSliceValue(v)...)
- }
- }
- _ = AssignValue(reflect.ValueOf(arr), dst)
- return nil
- case reflect.Ptr:
- return n.Get(src.Elem(), dst)
- case reflect.Interface:
- return n.Get(reflect.ValueOf(src.Interface()), dst)
- }
- return fmt.Errorf("failed to get %s value from %s", n.selector, src.Type())
-}
-
-func (n *PathRecursiveNode) String() string {
- s := fmt.Sprintf("..%s", n.selector)
- if n.child != nil {
- s += n.child.String()
- }
- return s
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/ptr.go b/vendor/github.com/goccy/go-json/internal/decoder/ptr.go
deleted file mode 100644
index ae2299466af..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/ptr.go
+++ /dev/null
@@ -1,97 +0,0 @@
-package decoder
-
-import (
- "fmt"
- "unsafe"
-
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type ptrDecoder struct {
- dec Decoder
- typ *runtime.Type
- structName string
- fieldName string
-}
-
-func newPtrDecoder(dec Decoder, typ *runtime.Type, structName, fieldName string) *ptrDecoder {
- return &ptrDecoder{
- dec: dec,
- typ: typ,
- structName: structName,
- fieldName: fieldName,
- }
-}
-
-func (d *ptrDecoder) contentDecoder() Decoder {
- dec, ok := d.dec.(*ptrDecoder)
- if !ok {
- return d.dec
- }
- return dec.contentDecoder()
-}
-
-//nolint:golint
-//go:linkname unsafe_New reflect.unsafe_New
-func unsafe_New(*runtime.Type) unsafe.Pointer
-
-func UnsafeNew(t *runtime.Type) unsafe.Pointer {
- return unsafe_New(t)
-}
-
-func (d *ptrDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- if s.skipWhiteSpace() == nul {
- s.read()
- }
- if s.char() == 'n' {
- if err := nullBytes(s); err != nil {
- return err
- }
- *(*unsafe.Pointer)(p) = nil
- return nil
- }
- var newptr unsafe.Pointer
- if *(*unsafe.Pointer)(p) == nil {
- newptr = unsafe_New(d.typ)
- *(*unsafe.Pointer)(p) = newptr
- } else {
- newptr = *(*unsafe.Pointer)(p)
- }
- if err := d.dec.DecodeStream(s, depth, newptr); err != nil {
- return err
- }
- return nil
-}
-
-func (d *ptrDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- buf := ctx.Buf
- cursor = skipWhiteSpace(buf, cursor)
- if buf[cursor] == 'n' {
- if err := validateNull(buf, cursor); err != nil {
- return 0, err
- }
- if p != nil {
- *(*unsafe.Pointer)(p) = nil
- }
- cursor += 4
- return cursor, nil
- }
- var newptr unsafe.Pointer
- if *(*unsafe.Pointer)(p) == nil {
- newptr = unsafe_New(d.typ)
- *(*unsafe.Pointer)(p) = newptr
- } else {
- newptr = *(*unsafe.Pointer)(p)
- }
- c, err := d.dec.Decode(ctx, cursor, depth, newptr)
- if err != nil {
- *(*unsafe.Pointer)(p) = nil
- return 0, err
- }
- cursor = c
- return cursor, nil
-}
-
-func (d *ptrDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- return nil, 0, fmt.Errorf("json: ptr decoder does not support decode path")
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/slice.go b/vendor/github.com/goccy/go-json/internal/decoder/slice.go
deleted file mode 100644
index 30a23e4b51e..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/slice.go
+++ /dev/null
@@ -1,380 +0,0 @@
-package decoder
-
-import (
- "reflect"
- "sync"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-var (
- sliceType = runtime.Type2RType(
- reflect.TypeOf((*sliceHeader)(nil)).Elem(),
- )
- nilSlice = unsafe.Pointer(&sliceHeader{})
-)
-
-type sliceDecoder struct {
- elemType *runtime.Type
- isElemPointerType bool
- valueDecoder Decoder
- size uintptr
- arrayPool sync.Pool
- structName string
- fieldName string
-}
-
-// If use reflect.SliceHeader, data type is uintptr.
-// In this case, Go compiler cannot trace reference created by newArray().
-// So, define using unsafe.Pointer as data type
-type sliceHeader struct {
- data unsafe.Pointer
- len int
- cap int
-}
-
-const (
- defaultSliceCapacity = 2
-)
-
-func newSliceDecoder(dec Decoder, elemType *runtime.Type, size uintptr, structName, fieldName string) *sliceDecoder {
- return &sliceDecoder{
- valueDecoder: dec,
- elemType: elemType,
- isElemPointerType: elemType.Kind() == reflect.Ptr || elemType.Kind() == reflect.Map,
- size: size,
- arrayPool: sync.Pool{
- New: func() interface{} {
- return &sliceHeader{
- data: newArray(elemType, defaultSliceCapacity),
- len: 0,
- cap: defaultSliceCapacity,
- }
- },
- },
- structName: structName,
- fieldName: fieldName,
- }
-}
-
-func (d *sliceDecoder) newSlice(src *sliceHeader) *sliceHeader {
- slice := d.arrayPool.Get().(*sliceHeader)
- if src.len > 0 {
- // copy original elem
- if slice.cap < src.cap {
- data := newArray(d.elemType, src.cap)
- slice = &sliceHeader{data: data, len: src.len, cap: src.cap}
- } else {
- slice.len = src.len
- }
- copySlice(d.elemType, *slice, *src)
- } else {
- slice.len = 0
- }
- return slice
-}
-
-func (d *sliceDecoder) releaseSlice(p *sliceHeader) {
- d.arrayPool.Put(p)
-}
-
-//go:linkname copySlice reflect.typedslicecopy
-func copySlice(elemType *runtime.Type, dst, src sliceHeader) int
-
-//go:linkname newArray reflect.unsafe_NewArray
-func newArray(*runtime.Type, int) unsafe.Pointer
-
-//go:linkname typedmemmove reflect.typedmemmove
-func typedmemmove(t *runtime.Type, dst, src unsafe.Pointer)
-
-func (d *sliceDecoder) errNumber(offset int64) *errors.UnmarshalTypeError {
- return &errors.UnmarshalTypeError{
- Value: "number",
- Type: reflect.SliceOf(runtime.RType2Type(d.elemType)),
- Struct: d.structName,
- Field: d.fieldName,
- Offset: offset,
- }
-}
-
-func (d *sliceDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- depth++
- if depth > maxDecodeNestingDepth {
- return errors.ErrExceededMaxDepth(s.char(), s.cursor)
- }
-
- for {
- switch s.char() {
- case ' ', '\n', '\t', '\r':
- s.cursor++
- continue
- case 'n':
- if err := nullBytes(s); err != nil {
- return err
- }
- typedmemmove(sliceType, p, nilSlice)
- return nil
- case '[':
- s.cursor++
- if s.skipWhiteSpace() == ']' {
- dst := (*sliceHeader)(p)
- if dst.data == nil {
- dst.data = newArray(d.elemType, 0)
- } else {
- dst.len = 0
- }
- s.cursor++
- return nil
- }
- idx := 0
- slice := d.newSlice((*sliceHeader)(p))
- srcLen := slice.len
- capacity := slice.cap
- data := slice.data
- for {
- if capacity <= idx {
- src := sliceHeader{data: data, len: idx, cap: capacity}
- capacity *= 2
- data = newArray(d.elemType, capacity)
- dst := sliceHeader{data: data, len: idx, cap: capacity}
- copySlice(d.elemType, dst, src)
- }
- ep := unsafe.Pointer(uintptr(data) + uintptr(idx)*d.size)
-
- // if srcLen is greater than idx, keep the original reference
- if srcLen <= idx {
- if d.isElemPointerType {
- **(**unsafe.Pointer)(unsafe.Pointer(&ep)) = nil // initialize elem pointer
- } else {
- // assign new element to the slice
- typedmemmove(d.elemType, ep, unsafe_New(d.elemType))
- }
- }
-
- if err := d.valueDecoder.DecodeStream(s, depth, ep); err != nil {
- return err
- }
- s.skipWhiteSpace()
- RETRY:
- switch s.char() {
- case ']':
- slice.cap = capacity
- slice.len = idx + 1
- slice.data = data
- dst := (*sliceHeader)(p)
- dst.len = idx + 1
- if dst.len > dst.cap {
- dst.data = newArray(d.elemType, dst.len)
- dst.cap = dst.len
- }
- copySlice(d.elemType, *dst, *slice)
- d.releaseSlice(slice)
- s.cursor++
- return nil
- case ',':
- idx++
- case nul:
- if s.read() {
- goto RETRY
- }
- slice.cap = capacity
- slice.data = data
- d.releaseSlice(slice)
- goto ERROR
- default:
- slice.cap = capacity
- slice.data = data
- d.releaseSlice(slice)
- goto ERROR
- }
- s.cursor++
- }
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return d.errNumber(s.totalOffset())
- case nul:
- if s.read() {
- continue
- }
- goto ERROR
- default:
- goto ERROR
- }
- }
-ERROR:
- return errors.ErrUnexpectedEndOfJSON("slice", s.totalOffset())
-}
-
-func (d *sliceDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- buf := ctx.Buf
- depth++
- if depth > maxDecodeNestingDepth {
- return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor)
- }
-
- for {
- switch buf[cursor] {
- case ' ', '\n', '\t', '\r':
- cursor++
- continue
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 4
- typedmemmove(sliceType, p, nilSlice)
- return cursor, nil
- case '[':
- cursor++
- cursor = skipWhiteSpace(buf, cursor)
- if buf[cursor] == ']' {
- dst := (*sliceHeader)(p)
- if dst.data == nil {
- dst.data = newArray(d.elemType, 0)
- } else {
- dst.len = 0
- }
- cursor++
- return cursor, nil
- }
- idx := 0
- slice := d.newSlice((*sliceHeader)(p))
- srcLen := slice.len
- capacity := slice.cap
- data := slice.data
- for {
- if capacity <= idx {
- src := sliceHeader{data: data, len: idx, cap: capacity}
- capacity *= 2
- data = newArray(d.elemType, capacity)
- dst := sliceHeader{data: data, len: idx, cap: capacity}
- copySlice(d.elemType, dst, src)
- }
- ep := unsafe.Pointer(uintptr(data) + uintptr(idx)*d.size)
- // if srcLen is greater than idx, keep the original reference
- if srcLen <= idx {
- if d.isElemPointerType {
- **(**unsafe.Pointer)(unsafe.Pointer(&ep)) = nil // initialize elem pointer
- } else {
- // assign new element to the slice
- typedmemmove(d.elemType, ep, unsafe_New(d.elemType))
- }
- }
- c, err := d.valueDecoder.Decode(ctx, cursor, depth, ep)
- if err != nil {
- return 0, err
- }
- cursor = c
- cursor = skipWhiteSpace(buf, cursor)
- switch buf[cursor] {
- case ']':
- slice.cap = capacity
- slice.len = idx + 1
- slice.data = data
- dst := (*sliceHeader)(p)
- dst.len = idx + 1
- if dst.len > dst.cap {
- dst.data = newArray(d.elemType, dst.len)
- dst.cap = dst.len
- }
- copySlice(d.elemType, *dst, *slice)
- d.releaseSlice(slice)
- cursor++
- return cursor, nil
- case ',':
- idx++
- default:
- slice.cap = capacity
- slice.data = data
- d.releaseSlice(slice)
- return 0, errors.ErrInvalidCharacter(buf[cursor], "slice", cursor)
- }
- cursor++
- }
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return 0, d.errNumber(cursor)
- default:
- return 0, errors.ErrUnexpectedEndOfJSON("slice", cursor)
- }
- }
-}
-
-func (d *sliceDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- buf := ctx.Buf
- depth++
- if depth > maxDecodeNestingDepth {
- return nil, 0, errors.ErrExceededMaxDepth(buf[cursor], cursor)
- }
-
- ret := [][]byte{}
- for {
- switch buf[cursor] {
- case ' ', '\n', '\t', '\r':
- cursor++
- continue
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return nil, 0, err
- }
- cursor += 4
- return [][]byte{nullbytes}, cursor, nil
- case '[':
- cursor++
- cursor = skipWhiteSpace(buf, cursor)
- if buf[cursor] == ']' {
- cursor++
- return ret, cursor, nil
- }
- idx := 0
- for {
- child, found, err := ctx.Option.Path.node.Index(idx)
- if err != nil {
- return nil, 0, err
- }
- if found {
- if child != nil {
- oldPath := ctx.Option.Path.node
- ctx.Option.Path.node = child
- paths, c, err := d.valueDecoder.DecodePath(ctx, cursor, depth)
- if err != nil {
- return nil, 0, err
- }
- ctx.Option.Path.node = oldPath
- ret = append(ret, paths...)
- cursor = c
- } else {
- start := cursor
- end, err := skipValue(buf, cursor, depth)
- if err != nil {
- return nil, 0, err
- }
- ret = append(ret, buf[start:end])
- cursor = end
- }
- } else {
- c, err := skipValue(buf, cursor, depth)
- if err != nil {
- return nil, 0, err
- }
- cursor = c
- }
- cursor = skipWhiteSpace(buf, cursor)
- switch buf[cursor] {
- case ']':
- cursor++
- return ret, cursor, nil
- case ',':
- idx++
- default:
- return nil, 0, errors.ErrInvalidCharacter(buf[cursor], "slice", cursor)
- }
- cursor++
- }
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return nil, 0, d.errNumber(cursor)
- default:
- return nil, 0, errors.ErrUnexpectedEndOfJSON("slice", cursor)
- }
- }
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/stream.go b/vendor/github.com/goccy/go-json/internal/decoder/stream.go
deleted file mode 100644
index a383f725969..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/stream.go
+++ /dev/null
@@ -1,556 +0,0 @@
-package decoder
-
-import (
- "bytes"
- "encoding/json"
- "io"
- "strconv"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
-)
-
-const (
- initBufSize = 512
-)
-
-type Stream struct {
- buf []byte
- bufSize int64
- length int64
- r io.Reader
- offset int64
- cursor int64
- filledBuffer bool
- allRead bool
- UseNumber bool
- DisallowUnknownFields bool
- Option *Option
-}
-
-func NewStream(r io.Reader) *Stream {
- return &Stream{
- r: r,
- bufSize: initBufSize,
- buf: make([]byte, initBufSize),
- Option: &Option{},
- }
-}
-
-func (s *Stream) TotalOffset() int64 {
- return s.totalOffset()
-}
-
-func (s *Stream) Buffered() io.Reader {
- buflen := int64(len(s.buf))
- for i := s.cursor; i < buflen; i++ {
- if s.buf[i] == nul {
- return bytes.NewReader(s.buf[s.cursor:i])
- }
- }
- return bytes.NewReader(s.buf[s.cursor:])
-}
-
-func (s *Stream) PrepareForDecode() error {
- for {
- switch s.char() {
- case ' ', '\t', '\r', '\n':
- s.cursor++
- continue
- case ',', ':':
- s.cursor++
- return nil
- case nul:
- if s.read() {
- continue
- }
- return io.EOF
- }
- break
- }
- return nil
-}
-
-func (s *Stream) totalOffset() int64 {
- return s.offset + s.cursor
-}
-
-func (s *Stream) char() byte {
- return s.buf[s.cursor]
-}
-
-func (s *Stream) equalChar(c byte) bool {
- cur := s.buf[s.cursor]
- if cur == nul {
- s.read()
- cur = s.buf[s.cursor]
- }
- return cur == c
-}
-
-func (s *Stream) stat() ([]byte, int64, unsafe.Pointer) {
- return s.buf, s.cursor, (*sliceHeader)(unsafe.Pointer(&s.buf)).data
-}
-
-func (s *Stream) bufptr() unsafe.Pointer {
- return (*sliceHeader)(unsafe.Pointer(&s.buf)).data
-}
-
-func (s *Stream) statForRetry() ([]byte, int64, unsafe.Pointer) {
- s.cursor-- // for retry ( because caller progress cursor position in each loop )
- return s.buf, s.cursor, (*sliceHeader)(unsafe.Pointer(&s.buf)).data
-}
-
-func (s *Stream) Reset() {
- s.reset()
- s.bufSize = int64(len(s.buf))
-}
-
-func (s *Stream) More() bool {
- for {
- switch s.char() {
- case ' ', '\n', '\r', '\t':
- s.cursor++
- continue
- case '}', ']':
- return false
- case nul:
- if s.read() {
- continue
- }
- return false
- }
- break
- }
- return true
-}
-
-func (s *Stream) Token() (interface{}, error) {
- for {
- c := s.char()
- switch c {
- case ' ', '\n', '\r', '\t':
- s.cursor++
- case '{', '[', ']', '}':
- s.cursor++
- return json.Delim(c), nil
- case ',', ':':
- s.cursor++
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- bytes := floatBytes(s)
- str := *(*string)(unsafe.Pointer(&bytes))
- if s.UseNumber {
- return json.Number(str), nil
- }
- f64, err := strconv.ParseFloat(str, 64)
- if err != nil {
- return nil, err
- }
- return f64, nil
- case '"':
- bytes, err := stringBytes(s)
- if err != nil {
- return nil, err
- }
- return string(bytes), nil
- case 't':
- if err := trueBytes(s); err != nil {
- return nil, err
- }
- return true, nil
- case 'f':
- if err := falseBytes(s); err != nil {
- return nil, err
- }
- return false, nil
- case 'n':
- if err := nullBytes(s); err != nil {
- return nil, err
- }
- return nil, nil
- case nul:
- if s.read() {
- continue
- }
- goto END
- default:
- return nil, errors.ErrInvalidCharacter(s.char(), "token", s.totalOffset())
- }
- }
-END:
- return nil, io.EOF
-}
-
-func (s *Stream) reset() {
- s.offset += s.cursor
- s.buf = s.buf[s.cursor:]
- s.length -= s.cursor
- s.cursor = 0
-}
-
-func (s *Stream) readBuf() []byte {
- if s.filledBuffer {
- s.bufSize *= 2
- remainBuf := s.buf
- s.buf = make([]byte, s.bufSize)
- copy(s.buf, remainBuf)
- }
- remainLen := s.length - s.cursor
- remainNotNulCharNum := int64(0)
- for i := int64(0); i < remainLen; i++ {
- if s.buf[s.cursor+i] == nul {
- break
- }
- remainNotNulCharNum++
- }
- s.length = s.cursor + remainNotNulCharNum
- return s.buf[s.cursor+remainNotNulCharNum:]
-}
-
-func (s *Stream) read() bool {
- if s.allRead {
- return false
- }
- buf := s.readBuf()
- last := len(buf) - 1
- buf[last] = nul
- n, err := s.r.Read(buf[:last])
- s.length += int64(n)
- if n == last {
- s.filledBuffer = true
- } else {
- s.filledBuffer = false
- }
- if err == io.EOF {
- s.allRead = true
- } else if err != nil {
- return false
- }
- return true
-}
-
-func (s *Stream) skipWhiteSpace() byte {
- p := s.bufptr()
-LOOP:
- c := char(p, s.cursor)
- switch c {
- case ' ', '\n', '\t', '\r':
- s.cursor++
- goto LOOP
- case nul:
- if s.read() {
- p = s.bufptr()
- goto LOOP
- }
- }
- return c
-}
-
-func (s *Stream) skipObject(depth int64) error {
- braceCount := 1
- _, cursor, p := s.stat()
- for {
- switch char(p, cursor) {
- case '{':
- braceCount++
- depth++
- if depth > maxDecodeNestingDepth {
- return errors.ErrExceededMaxDepth(s.char(), s.cursor)
- }
- case '}':
- braceCount--
- depth--
- if braceCount == 0 {
- s.cursor = cursor + 1
- return nil
- }
- case '[':
- depth++
- if depth > maxDecodeNestingDepth {
- return errors.ErrExceededMaxDepth(s.char(), s.cursor)
- }
- case ']':
- depth--
- case '"':
- for {
- cursor++
- switch char(p, cursor) {
- case '\\':
- cursor++
- if char(p, cursor) == nul {
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.stat()
- continue
- }
- return errors.ErrUnexpectedEndOfJSON("string of object", cursor)
- }
- case '"':
- goto SWITCH_OUT
- case nul:
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.statForRetry()
- continue
- }
- return errors.ErrUnexpectedEndOfJSON("string of object", cursor)
- }
- }
- case nul:
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.stat()
- continue
- }
- return errors.ErrUnexpectedEndOfJSON("object of object", cursor)
- }
- SWITCH_OUT:
- cursor++
- }
-}
-
-func (s *Stream) skipArray(depth int64) error {
- bracketCount := 1
- _, cursor, p := s.stat()
- for {
- switch char(p, cursor) {
- case '[':
- bracketCount++
- depth++
- if depth > maxDecodeNestingDepth {
- return errors.ErrExceededMaxDepth(s.char(), s.cursor)
- }
- case ']':
- bracketCount--
- depth--
- if bracketCount == 0 {
- s.cursor = cursor + 1
- return nil
- }
- case '{':
- depth++
- if depth > maxDecodeNestingDepth {
- return errors.ErrExceededMaxDepth(s.char(), s.cursor)
- }
- case '}':
- depth--
- case '"':
- for {
- cursor++
- switch char(p, cursor) {
- case '\\':
- cursor++
- if char(p, cursor) == nul {
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.stat()
- continue
- }
- return errors.ErrUnexpectedEndOfJSON("string of object", cursor)
- }
- case '"':
- goto SWITCH_OUT
- case nul:
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.statForRetry()
- continue
- }
- return errors.ErrUnexpectedEndOfJSON("string of object", cursor)
- }
- }
- case nul:
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.stat()
- continue
- }
- return errors.ErrUnexpectedEndOfJSON("array of object", cursor)
- }
- SWITCH_OUT:
- cursor++
- }
-}
-
-func (s *Stream) skipValue(depth int64) error {
- _, cursor, p := s.stat()
- for {
- switch char(p, cursor) {
- case ' ', '\n', '\t', '\r':
- cursor++
- continue
- case nul:
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.stat()
- continue
- }
- return errors.ErrUnexpectedEndOfJSON("value of object", s.totalOffset())
- case '{':
- s.cursor = cursor + 1
- return s.skipObject(depth + 1)
- case '[':
- s.cursor = cursor + 1
- return s.skipArray(depth + 1)
- case '"':
- for {
- cursor++
- switch char(p, cursor) {
- case '\\':
- cursor++
- if char(p, cursor) == nul {
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.stat()
- continue
- }
- return errors.ErrUnexpectedEndOfJSON("value of string", s.totalOffset())
- }
- case '"':
- s.cursor = cursor + 1
- return nil
- case nul:
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.statForRetry()
- continue
- }
- return errors.ErrUnexpectedEndOfJSON("value of string", s.totalOffset())
- }
- }
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- for {
- cursor++
- c := char(p, cursor)
- if floatTable[c] {
- continue
- } else if c == nul {
- if s.read() {
- _, cursor, p = s.stat()
- continue
- }
- }
- s.cursor = cursor
- return nil
- }
- case 't':
- s.cursor = cursor
- if err := trueBytes(s); err != nil {
- return err
- }
- return nil
- case 'f':
- s.cursor = cursor
- if err := falseBytes(s); err != nil {
- return err
- }
- return nil
- case 'n':
- s.cursor = cursor
- if err := nullBytes(s); err != nil {
- return err
- }
- return nil
- }
- cursor++
- }
-}
-
-func nullBytes(s *Stream) error {
- // current cursor's character is 'n'
- s.cursor++
- if s.char() != 'u' {
- if err := retryReadNull(s); err != nil {
- return err
- }
- }
- s.cursor++
- if s.char() != 'l' {
- if err := retryReadNull(s); err != nil {
- return err
- }
- }
- s.cursor++
- if s.char() != 'l' {
- if err := retryReadNull(s); err != nil {
- return err
- }
- }
- s.cursor++
- return nil
-}
-
-func retryReadNull(s *Stream) error {
- if s.char() == nul && s.read() {
- return nil
- }
- return errors.ErrInvalidCharacter(s.char(), "null", s.totalOffset())
-}
-
-func trueBytes(s *Stream) error {
- // current cursor's character is 't'
- s.cursor++
- if s.char() != 'r' {
- if err := retryReadTrue(s); err != nil {
- return err
- }
- }
- s.cursor++
- if s.char() != 'u' {
- if err := retryReadTrue(s); err != nil {
- return err
- }
- }
- s.cursor++
- if s.char() != 'e' {
- if err := retryReadTrue(s); err != nil {
- return err
- }
- }
- s.cursor++
- return nil
-}
-
-func retryReadTrue(s *Stream) error {
- if s.char() == nul && s.read() {
- return nil
- }
- return errors.ErrInvalidCharacter(s.char(), "bool(true)", s.totalOffset())
-}
-
-func falseBytes(s *Stream) error {
- // current cursor's character is 'f'
- s.cursor++
- if s.char() != 'a' {
- if err := retryReadFalse(s); err != nil {
- return err
- }
- }
- s.cursor++
- if s.char() != 'l' {
- if err := retryReadFalse(s); err != nil {
- return err
- }
- }
- s.cursor++
- if s.char() != 's' {
- if err := retryReadFalse(s); err != nil {
- return err
- }
- }
- s.cursor++
- if s.char() != 'e' {
- if err := retryReadFalse(s); err != nil {
- return err
- }
- }
- s.cursor++
- return nil
-}
-
-func retryReadFalse(s *Stream) error {
- if s.char() == nul && s.read() {
- return nil
- }
- return errors.ErrInvalidCharacter(s.char(), "bool(false)", s.totalOffset())
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/string.go b/vendor/github.com/goccy/go-json/internal/decoder/string.go
deleted file mode 100644
index 32602c908ae..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/string.go
+++ /dev/null
@@ -1,452 +0,0 @@
-package decoder
-
-import (
- "bytes"
- "fmt"
- "reflect"
- "unicode"
- "unicode/utf16"
- "unicode/utf8"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
-)
-
-type stringDecoder struct {
- structName string
- fieldName string
-}
-
-func newStringDecoder(structName, fieldName string) *stringDecoder {
- return &stringDecoder{
- structName: structName,
- fieldName: fieldName,
- }
-}
-
-func (d *stringDecoder) errUnmarshalType(typeName string, offset int64) *errors.UnmarshalTypeError {
- return &errors.UnmarshalTypeError{
- Value: typeName,
- Type: reflect.TypeOf(""),
- Offset: offset,
- Struct: d.structName,
- Field: d.fieldName,
- }
-}
-
-func (d *stringDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- bytes, err := d.decodeStreamByte(s)
- if err != nil {
- return err
- }
- if bytes == nil {
- return nil
- }
- **(**string)(unsafe.Pointer(&p)) = *(*string)(unsafe.Pointer(&bytes))
- s.reset()
- return nil
-}
-
-func (d *stringDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- bytes, c, err := d.decodeByte(ctx.Buf, cursor)
- if err != nil {
- return 0, err
- }
- if bytes == nil {
- return c, nil
- }
- cursor = c
- **(**string)(unsafe.Pointer(&p)) = *(*string)(unsafe.Pointer(&bytes))
- return cursor, nil
-}
-
-func (d *stringDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- bytes, c, err := d.decodeByte(ctx.Buf, cursor)
- if err != nil {
- return nil, 0, err
- }
- if bytes == nil {
- return [][]byte{nullbytes}, c, nil
- }
- return [][]byte{bytes}, c, nil
-}
-
-var (
- hexToInt = [256]int{
- '0': 0,
- '1': 1,
- '2': 2,
- '3': 3,
- '4': 4,
- '5': 5,
- '6': 6,
- '7': 7,
- '8': 8,
- '9': 9,
- 'A': 10,
- 'B': 11,
- 'C': 12,
- 'D': 13,
- 'E': 14,
- 'F': 15,
- 'a': 10,
- 'b': 11,
- 'c': 12,
- 'd': 13,
- 'e': 14,
- 'f': 15,
- }
-)
-
-func unicodeToRune(code []byte) rune {
- var r rune
- for i := 0; i < len(code); i++ {
- r = r*16 + rune(hexToInt[code[i]])
- }
- return r
-}
-
-func readAtLeast(s *Stream, n int64, p *unsafe.Pointer) bool {
- for s.cursor+n >= s.length {
- if !s.read() {
- return false
- }
- *p = s.bufptr()
- }
- return true
-}
-
-func decodeUnicodeRune(s *Stream, p unsafe.Pointer) (rune, int64, unsafe.Pointer, error) {
- const defaultOffset = 5
- const surrogateOffset = 11
-
- if !readAtLeast(s, defaultOffset, &p) {
- return rune(0), 0, nil, errors.ErrInvalidCharacter(s.char(), "escaped string", s.totalOffset())
- }
-
- r := unicodeToRune(s.buf[s.cursor+1 : s.cursor+defaultOffset])
- if utf16.IsSurrogate(r) {
- if !readAtLeast(s, surrogateOffset, &p) {
- return unicode.ReplacementChar, defaultOffset, p, nil
- }
- if s.buf[s.cursor+defaultOffset] != '\\' || s.buf[s.cursor+defaultOffset+1] != 'u' {
- return unicode.ReplacementChar, defaultOffset, p, nil
- }
- r2 := unicodeToRune(s.buf[s.cursor+defaultOffset+2 : s.cursor+surrogateOffset])
- if r := utf16.DecodeRune(r, r2); r != unicode.ReplacementChar {
- return r, surrogateOffset, p, nil
- }
- }
- return r, defaultOffset, p, nil
-}
-
-func decodeUnicode(s *Stream, p unsafe.Pointer) (unsafe.Pointer, error) {
- const backSlashAndULen = 2 // length of \u
-
- r, offset, pp, err := decodeUnicodeRune(s, p)
- if err != nil {
- return nil, err
- }
- unicode := []byte(string(r))
- unicodeLen := int64(len(unicode))
- s.buf = append(append(s.buf[:s.cursor-1], unicode...), s.buf[s.cursor+offset:]...)
- unicodeOrgLen := offset - 1
- s.length = s.length - (backSlashAndULen + (unicodeOrgLen - unicodeLen))
- s.cursor = s.cursor - backSlashAndULen + unicodeLen
- return pp, nil
-}
-
-func decodeEscapeString(s *Stream, p unsafe.Pointer) (unsafe.Pointer, error) {
- s.cursor++
-RETRY:
- switch s.buf[s.cursor] {
- case '"':
- s.buf[s.cursor] = '"'
- case '\\':
- s.buf[s.cursor] = '\\'
- case '/':
- s.buf[s.cursor] = '/'
- case 'b':
- s.buf[s.cursor] = '\b'
- case 'f':
- s.buf[s.cursor] = '\f'
- case 'n':
- s.buf[s.cursor] = '\n'
- case 'r':
- s.buf[s.cursor] = '\r'
- case 't':
- s.buf[s.cursor] = '\t'
- case 'u':
- return decodeUnicode(s, p)
- case nul:
- if !s.read() {
- return nil, errors.ErrInvalidCharacter(s.char(), "escaped string", s.totalOffset())
- }
- p = s.bufptr()
- goto RETRY
- default:
- return nil, errors.ErrUnexpectedEndOfJSON("string", s.totalOffset())
- }
- s.buf = append(s.buf[:s.cursor-1], s.buf[s.cursor:]...)
- s.length--
- s.cursor--
- p = s.bufptr()
- return p, nil
-}
-
-var (
- runeErrBytes = []byte(string(utf8.RuneError))
- runeErrBytesLen = int64(len(runeErrBytes))
-)
-
-func stringBytes(s *Stream) ([]byte, error) {
- _, cursor, p := s.stat()
- cursor++ // skip double quote char
- start := cursor
- for {
- switch char(p, cursor) {
- case '\\':
- s.cursor = cursor
- pp, err := decodeEscapeString(s, p)
- if err != nil {
- return nil, err
- }
- p = pp
- cursor = s.cursor
- case '"':
- literal := s.buf[start:cursor]
- cursor++
- s.cursor = cursor
- return literal, nil
- case
- // 0x00 is nul, 0x5c is '\\', 0x22 is '"' .
- 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, // 0x00-0x0F
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, // 0x10-0x1F
- 0x20, 0x21 /*0x22,*/, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, // 0x20-0x2F
- 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, // 0x30-0x3F
- 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, // 0x40-0x4F
- 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B /*0x5C,*/, 0x5D, 0x5E, 0x5F, // 0x50-0x5F
- 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, // 0x60-0x6F
- 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F: // 0x70-0x7F
- // character is ASCII. skip to next char
- case
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, // 0x80-0x8F
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, 0x9E, 0x9F, // 0x90-0x9F
- 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, // 0xA0-0xAF
- 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, 0xBF, // 0xB0-0xBF
- 0xC0, 0xC1, // 0xC0-0xC1
- 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF: // 0xF5-0xFE
- // character is invalid
- s.buf = append(append(append([]byte{}, s.buf[:cursor]...), runeErrBytes...), s.buf[cursor+1:]...)
- _, _, p = s.stat()
- cursor += runeErrBytesLen
- s.length += runeErrBytesLen
- continue
- case nul:
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.stat()
- continue
- }
- goto ERROR
- case 0xEF:
- // RuneError is {0xEF, 0xBF, 0xBD}
- if s.buf[cursor+1] == 0xBF && s.buf[cursor+2] == 0xBD {
- // found RuneError: skip
- cursor += 2
- break
- }
- fallthrough
- default:
- // multi bytes character
- if !utf8.FullRune(s.buf[cursor : len(s.buf)-1]) {
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.stat()
- continue
- }
- goto ERROR
- }
- r, size := utf8.DecodeRune(s.buf[cursor:])
- if r == utf8.RuneError {
- s.buf = append(append(append([]byte{}, s.buf[:cursor]...), runeErrBytes...), s.buf[cursor+1:]...)
- cursor += runeErrBytesLen
- s.length += runeErrBytesLen
- _, _, p = s.stat()
- } else {
- cursor += int64(size)
- }
- continue
- }
- cursor++
- }
-ERROR:
- return nil, errors.ErrUnexpectedEndOfJSON("string", s.totalOffset())
-}
-
-func (d *stringDecoder) decodeStreamByte(s *Stream) ([]byte, error) {
- for {
- switch s.char() {
- case ' ', '\n', '\t', '\r':
- s.cursor++
- continue
- case '[':
- return nil, d.errUnmarshalType("array", s.totalOffset())
- case '{':
- return nil, d.errUnmarshalType("object", s.totalOffset())
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return nil, d.errUnmarshalType("number", s.totalOffset())
- case '"':
- return stringBytes(s)
- case 'n':
- if err := nullBytes(s); err != nil {
- return nil, err
- }
- return nil, nil
- case nul:
- if s.read() {
- continue
- }
- }
- break
- }
- return nil, errors.ErrInvalidBeginningOfValue(s.char(), s.totalOffset())
-}
-
-func (d *stringDecoder) decodeByte(buf []byte, cursor int64) ([]byte, int64, error) {
- for {
- switch buf[cursor] {
- case ' ', '\n', '\t', '\r':
- cursor++
- case '[':
- return nil, 0, d.errUnmarshalType("array", cursor)
- case '{':
- return nil, 0, d.errUnmarshalType("object", cursor)
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return nil, 0, d.errUnmarshalType("number", cursor)
- case '"':
- cursor++
- start := cursor
- b := (*sliceHeader)(unsafe.Pointer(&buf)).data
- escaped := 0
- for {
- switch char(b, cursor) {
- case '\\':
- escaped++
- cursor++
- switch char(b, cursor) {
- case '"', '\\', '/', 'b', 'f', 'n', 'r', 't':
- cursor++
- case 'u':
- buflen := int64(len(buf))
- if cursor+5 >= buflen {
- return nil, 0, errors.ErrUnexpectedEndOfJSON("escaped string", cursor)
- }
- for i := int64(1); i <= 4; i++ {
- c := char(b, cursor+i)
- if !(('0' <= c && c <= '9') || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F')) {
- return nil, 0, errors.ErrSyntax(fmt.Sprintf("json: invalid character %c in \\u hexadecimal character escape", c), cursor+i)
- }
- }
- cursor += 5
- default:
- return nil, 0, errors.ErrUnexpectedEndOfJSON("escaped string", cursor)
- }
- continue
- case '"':
- literal := buf[start:cursor]
- if escaped > 0 {
- literal = literal[:unescapeString(literal)]
- }
- cursor++
- return literal, cursor, nil
- case nul:
- return nil, 0, errors.ErrUnexpectedEndOfJSON("string", cursor)
- }
- cursor++
- }
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return nil, 0, err
- }
- cursor += 4
- return nil, cursor, nil
- default:
- return nil, 0, errors.ErrInvalidBeginningOfValue(buf[cursor], cursor)
- }
- }
-}
-
-var unescapeMap = [256]byte{
- '"': '"',
- '\\': '\\',
- '/': '/',
- 'b': '\b',
- 'f': '\f',
- 'n': '\n',
- 'r': '\r',
- 't': '\t',
-}
-
-func unsafeAdd(ptr unsafe.Pointer, offset int) unsafe.Pointer {
- return unsafe.Pointer(uintptr(ptr) + uintptr(offset))
-}
-
-func unescapeString(buf []byte) int {
- p := (*sliceHeader)(unsafe.Pointer(&buf)).data
- end := unsafeAdd(p, len(buf))
- src := unsafeAdd(p, bytes.IndexByte(buf, '\\'))
- dst := src
- for src != end {
- c := char(src, 0)
- if c == '\\' {
- escapeChar := char(src, 1)
- if escapeChar != 'u' {
- *(*byte)(dst) = unescapeMap[escapeChar]
- src = unsafeAdd(src, 2)
- dst = unsafeAdd(dst, 1)
- } else {
- v1 := hexToInt[char(src, 2)]
- v2 := hexToInt[char(src, 3)]
- v3 := hexToInt[char(src, 4)]
- v4 := hexToInt[char(src, 5)]
- code := rune((v1 << 12) | (v2 << 8) | (v3 << 4) | v4)
- if code >= 0xd800 && code < 0xdc00 && uintptr(unsafeAdd(src, 11)) < uintptr(end) {
- if char(src, 6) == '\\' && char(src, 7) == 'u' {
- v1 := hexToInt[char(src, 8)]
- v2 := hexToInt[char(src, 9)]
- v3 := hexToInt[char(src, 10)]
- v4 := hexToInt[char(src, 11)]
- lo := rune((v1 << 12) | (v2 << 8) | (v3 << 4) | v4)
- if lo >= 0xdc00 && lo < 0xe000 {
- code = (code-0xd800)<<10 | (lo - 0xdc00) + 0x10000
- src = unsafeAdd(src, 6)
- }
- }
- }
- var b [utf8.UTFMax]byte
- n := utf8.EncodeRune(b[:], code)
- switch n {
- case 4:
- *(*byte)(unsafeAdd(dst, 3)) = b[3]
- fallthrough
- case 3:
- *(*byte)(unsafeAdd(dst, 2)) = b[2]
- fallthrough
- case 2:
- *(*byte)(unsafeAdd(dst, 1)) = b[1]
- fallthrough
- case 1:
- *(*byte)(unsafeAdd(dst, 0)) = b[0]
- }
- src = unsafeAdd(src, 6)
- dst = unsafeAdd(dst, n)
- }
- } else {
- *(*byte)(dst) = c
- src = unsafeAdd(src, 1)
- dst = unsafeAdd(dst, 1)
- }
- }
- return int(uintptr(dst) - uintptr(p))
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/struct.go b/vendor/github.com/goccy/go-json/internal/decoder/struct.go
deleted file mode 100644
index 313da153b36..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/struct.go
+++ /dev/null
@@ -1,845 +0,0 @@
-package decoder
-
-import (
- "fmt"
- "math"
- "math/bits"
- "sort"
- "strings"
- "unicode"
- "unicode/utf16"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
-)
-
-type structFieldSet struct {
- dec Decoder
- offset uintptr
- isTaggedKey bool
- fieldIdx int
- key string
- keyLen int64
- err error
-}
-
-type structDecoder struct {
- fieldMap map[string]*structFieldSet
- fieldUniqueNameNum int
- stringDecoder *stringDecoder
- structName string
- fieldName string
- isTriedOptimize bool
- keyBitmapUint8 [][256]uint8
- keyBitmapUint16 [][256]uint16
- sortedFieldSets []*structFieldSet
- keyDecoder func(*structDecoder, []byte, int64) (int64, *structFieldSet, error)
- keyStreamDecoder func(*structDecoder, *Stream) (*structFieldSet, string, error)
-}
-
-var (
- largeToSmallTable [256]byte
-)
-
-func init() {
- for i := 0; i < 256; i++ {
- c := i
- if 'A' <= c && c <= 'Z' {
- c += 'a' - 'A'
- }
- largeToSmallTable[i] = byte(c)
- }
-}
-
-func toASCIILower(s string) string {
- b := []byte(s)
- for i := range b {
- b[i] = largeToSmallTable[b[i]]
- }
- return string(b)
-}
-
-func newStructDecoder(structName, fieldName string, fieldMap map[string]*structFieldSet) *structDecoder {
- return &structDecoder{
- fieldMap: fieldMap,
- stringDecoder: newStringDecoder(structName, fieldName),
- structName: structName,
- fieldName: fieldName,
- keyDecoder: decodeKey,
- keyStreamDecoder: decodeKeyStream,
- }
-}
-
-const (
- allowOptimizeMaxKeyLen = 64
- allowOptimizeMaxFieldLen = 16
-)
-
-func (d *structDecoder) tryOptimize() {
- fieldUniqueNameMap := map[string]int{}
- fieldIdx := -1
- for k, v := range d.fieldMap {
- lower := strings.ToLower(k)
- idx, exists := fieldUniqueNameMap[lower]
- if exists {
- v.fieldIdx = idx
- } else {
- fieldIdx++
- v.fieldIdx = fieldIdx
- }
- fieldUniqueNameMap[lower] = fieldIdx
- }
- d.fieldUniqueNameNum = len(fieldUniqueNameMap)
-
- if d.isTriedOptimize {
- return
- }
- fieldMap := map[string]*structFieldSet{}
- conflicted := map[string]struct{}{}
- for k, v := range d.fieldMap {
- key := strings.ToLower(k)
- if key != k {
- if key != toASCIILower(k) {
- d.isTriedOptimize = true
- return
- }
- // already exists same key (e.g. Hello and HELLO has same lower case key
- if _, exists := conflicted[key]; exists {
- d.isTriedOptimize = true
- return
- }
- conflicted[key] = struct{}{}
- }
- if field, exists := fieldMap[key]; exists {
- if field != v {
- d.isTriedOptimize = true
- return
- }
- }
- fieldMap[key] = v
- }
-
- if len(fieldMap) > allowOptimizeMaxFieldLen {
- d.isTriedOptimize = true
- return
- }
-
- var maxKeyLen int
- sortedKeys := []string{}
- for key := range fieldMap {
- keyLen := len(key)
- if keyLen > allowOptimizeMaxKeyLen {
- d.isTriedOptimize = true
- return
- }
- if maxKeyLen < keyLen {
- maxKeyLen = keyLen
- }
- sortedKeys = append(sortedKeys, key)
- }
- sort.Strings(sortedKeys)
-
- // By allocating one extra capacity than `maxKeyLen`,
- // it is possible to avoid the process of comparing the index of the key with the length of the bitmap each time.
- bitmapLen := maxKeyLen + 1
- if len(sortedKeys) <= 8 {
- keyBitmap := make([][256]uint8, bitmapLen)
- for i, key := range sortedKeys {
- for j := 0; j < len(key); j++ {
- c := key[j]
- keyBitmap[j][c] |= (1 << uint(i))
- }
- d.sortedFieldSets = append(d.sortedFieldSets, fieldMap[key])
- }
- d.keyBitmapUint8 = keyBitmap
- d.keyDecoder = decodeKeyByBitmapUint8
- d.keyStreamDecoder = decodeKeyByBitmapUint8Stream
- } else {
- keyBitmap := make([][256]uint16, bitmapLen)
- for i, key := range sortedKeys {
- for j := 0; j < len(key); j++ {
- c := key[j]
- keyBitmap[j][c] |= (1 << uint(i))
- }
- d.sortedFieldSets = append(d.sortedFieldSets, fieldMap[key])
- }
- d.keyBitmapUint16 = keyBitmap
- d.keyDecoder = decodeKeyByBitmapUint16
- d.keyStreamDecoder = decodeKeyByBitmapUint16Stream
- }
-}
-
-// decode from '\uXXXX'
-func decodeKeyCharByUnicodeRune(buf []byte, cursor int64) ([]byte, int64, error) {
- const defaultOffset = 4
- const surrogateOffset = 6
-
- if cursor+defaultOffset >= int64(len(buf)) {
- return nil, 0, errors.ErrUnexpectedEndOfJSON("escaped string", cursor)
- }
-
- r := unicodeToRune(buf[cursor : cursor+defaultOffset])
- if utf16.IsSurrogate(r) {
- cursor += defaultOffset
- if cursor+surrogateOffset >= int64(len(buf)) || buf[cursor] != '\\' || buf[cursor+1] != 'u' {
- return []byte(string(unicode.ReplacementChar)), cursor + defaultOffset - 1, nil
- }
- cursor += 2
- r2 := unicodeToRune(buf[cursor : cursor+defaultOffset])
- if r := utf16.DecodeRune(r, r2); r != unicode.ReplacementChar {
- return []byte(string(r)), cursor + defaultOffset - 1, nil
- }
- }
- return []byte(string(r)), cursor + defaultOffset - 1, nil
-}
-
-func decodeKeyCharByEscapedChar(buf []byte, cursor int64) ([]byte, int64, error) {
- c := buf[cursor]
- cursor++
- switch c {
- case '"':
- return []byte{'"'}, cursor, nil
- case '\\':
- return []byte{'\\'}, cursor, nil
- case '/':
- return []byte{'/'}, cursor, nil
- case 'b':
- return []byte{'\b'}, cursor, nil
- case 'f':
- return []byte{'\f'}, cursor, nil
- case 'n':
- return []byte{'\n'}, cursor, nil
- case 'r':
- return []byte{'\r'}, cursor, nil
- case 't':
- return []byte{'\t'}, cursor, nil
- case 'u':
- return decodeKeyCharByUnicodeRune(buf, cursor)
- }
- return nil, cursor, nil
-}
-
-func decodeKeyByBitmapUint8(d *structDecoder, buf []byte, cursor int64) (int64, *structFieldSet, error) {
- var (
- curBit uint8 = math.MaxUint8
- )
- b := (*sliceHeader)(unsafe.Pointer(&buf)).data
- for {
- switch char(b, cursor) {
- case ' ', '\n', '\t', '\r':
- cursor++
- case '"':
- cursor++
- c := char(b, cursor)
- switch c {
- case '"':
- cursor++
- return cursor, nil, nil
- case nul:
- return 0, nil, errors.ErrUnexpectedEndOfJSON("string", cursor)
- }
- keyIdx := 0
- bitmap := d.keyBitmapUint8
- start := cursor
- for {
- c := char(b, cursor)
- switch c {
- case '"':
- fieldSetIndex := bits.TrailingZeros8(curBit)
- field := d.sortedFieldSets[fieldSetIndex]
- keyLen := cursor - start
- cursor++
- if keyLen < field.keyLen {
- // early match
- return cursor, nil, nil
- }
- return cursor, field, nil
- case nul:
- return 0, nil, errors.ErrUnexpectedEndOfJSON("string", cursor)
- case '\\':
- cursor++
- chars, nextCursor, err := decodeKeyCharByEscapedChar(buf, cursor)
- if err != nil {
- return 0, nil, err
- }
- for _, c := range chars {
- curBit &= bitmap[keyIdx][largeToSmallTable[c]]
- if curBit == 0 {
- return decodeKeyNotFound(b, cursor)
- }
- keyIdx++
- }
- cursor = nextCursor
- default:
- curBit &= bitmap[keyIdx][largeToSmallTable[c]]
- if curBit == 0 {
- return decodeKeyNotFound(b, cursor)
- }
- keyIdx++
- }
- cursor++
- }
- default:
- return cursor, nil, errors.ErrInvalidBeginningOfValue(char(b, cursor), cursor)
- }
- }
-}
-
-func decodeKeyByBitmapUint16(d *structDecoder, buf []byte, cursor int64) (int64, *structFieldSet, error) {
- var (
- curBit uint16 = math.MaxUint16
- )
- b := (*sliceHeader)(unsafe.Pointer(&buf)).data
- for {
- switch char(b, cursor) {
- case ' ', '\n', '\t', '\r':
- cursor++
- case '"':
- cursor++
- c := char(b, cursor)
- switch c {
- case '"':
- cursor++
- return cursor, nil, nil
- case nul:
- return 0, nil, errors.ErrUnexpectedEndOfJSON("string", cursor)
- }
- keyIdx := 0
- bitmap := d.keyBitmapUint16
- start := cursor
- for {
- c := char(b, cursor)
- switch c {
- case '"':
- fieldSetIndex := bits.TrailingZeros16(curBit)
- field := d.sortedFieldSets[fieldSetIndex]
- keyLen := cursor - start
- cursor++
- if keyLen < field.keyLen {
- // early match
- return cursor, nil, nil
- }
- return cursor, field, nil
- case nul:
- return 0, nil, errors.ErrUnexpectedEndOfJSON("string", cursor)
- case '\\':
- cursor++
- chars, nextCursor, err := decodeKeyCharByEscapedChar(buf, cursor)
- if err != nil {
- return 0, nil, err
- }
- for _, c := range chars {
- curBit &= bitmap[keyIdx][largeToSmallTable[c]]
- if curBit == 0 {
- return decodeKeyNotFound(b, cursor)
- }
- keyIdx++
- }
- cursor = nextCursor
- default:
- curBit &= bitmap[keyIdx][largeToSmallTable[c]]
- if curBit == 0 {
- return decodeKeyNotFound(b, cursor)
- }
- keyIdx++
- }
- cursor++
- }
- default:
- return cursor, nil, errors.ErrInvalidBeginningOfValue(char(b, cursor), cursor)
- }
- }
-}
-
-func decodeKeyNotFound(b unsafe.Pointer, cursor int64) (int64, *structFieldSet, error) {
- for {
- cursor++
- switch char(b, cursor) {
- case '"':
- cursor++
- return cursor, nil, nil
- case '\\':
- cursor++
- if char(b, cursor) == nul {
- return 0, nil, errors.ErrUnexpectedEndOfJSON("string", cursor)
- }
- case nul:
- return 0, nil, errors.ErrUnexpectedEndOfJSON("string", cursor)
- }
- }
-}
-
-func decodeKey(d *structDecoder, buf []byte, cursor int64) (int64, *structFieldSet, error) {
- key, c, err := d.stringDecoder.decodeByte(buf, cursor)
- if err != nil {
- return 0, nil, err
- }
- cursor = c
- k := *(*string)(unsafe.Pointer(&key))
- field, exists := d.fieldMap[k]
- if !exists {
- return cursor, nil, nil
- }
- return cursor, field, nil
-}
-
-func decodeKeyByBitmapUint8Stream(d *structDecoder, s *Stream) (*structFieldSet, string, error) {
- var (
- curBit uint8 = math.MaxUint8
- )
- _, cursor, p := s.stat()
- for {
- switch char(p, cursor) {
- case ' ', '\n', '\t', '\r':
- cursor++
- case nul:
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.stat()
- continue
- }
- return nil, "", errors.ErrInvalidBeginningOfValue(char(p, cursor), s.totalOffset())
- case '"':
- cursor++
- FIRST_CHAR:
- start := cursor
- switch char(p, cursor) {
- case '"':
- cursor++
- s.cursor = cursor
- return nil, "", nil
- case nul:
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.stat()
- goto FIRST_CHAR
- }
- return nil, "", errors.ErrUnexpectedEndOfJSON("string", s.totalOffset())
- }
- keyIdx := 0
- bitmap := d.keyBitmapUint8
- for {
- c := char(p, cursor)
- switch c {
- case '"':
- fieldSetIndex := bits.TrailingZeros8(curBit)
- field := d.sortedFieldSets[fieldSetIndex]
- keyLen := cursor - start
- cursor++
- s.cursor = cursor
- if keyLen < field.keyLen {
- // early match
- return nil, field.key, nil
- }
- return field, field.key, nil
- case nul:
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.stat()
- continue
- }
- return nil, "", errors.ErrUnexpectedEndOfJSON("string", s.totalOffset())
- case '\\':
- s.cursor = cursor + 1 // skip '\' char
- chars, err := decodeKeyCharByEscapeCharStream(s)
- if err != nil {
- return nil, "", err
- }
- cursor = s.cursor
- for _, c := range chars {
- curBit &= bitmap[keyIdx][largeToSmallTable[c]]
- if curBit == 0 {
- s.cursor = cursor
- return decodeKeyNotFoundStream(s, start)
- }
- keyIdx++
- }
- default:
- curBit &= bitmap[keyIdx][largeToSmallTable[c]]
- if curBit == 0 {
- s.cursor = cursor
- return decodeKeyNotFoundStream(s, start)
- }
- keyIdx++
- }
- cursor++
- }
- default:
- return nil, "", errors.ErrInvalidBeginningOfValue(char(p, cursor), s.totalOffset())
- }
- }
-}
-
-func decodeKeyByBitmapUint16Stream(d *structDecoder, s *Stream) (*structFieldSet, string, error) {
- var (
- curBit uint16 = math.MaxUint16
- )
- _, cursor, p := s.stat()
- for {
- switch char(p, cursor) {
- case ' ', '\n', '\t', '\r':
- cursor++
- case nul:
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.stat()
- continue
- }
- return nil, "", errors.ErrInvalidBeginningOfValue(char(p, cursor), s.totalOffset())
- case '"':
- cursor++
- FIRST_CHAR:
- start := cursor
- switch char(p, cursor) {
- case '"':
- cursor++
- s.cursor = cursor
- return nil, "", nil
- case nul:
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.stat()
- goto FIRST_CHAR
- }
- return nil, "", errors.ErrUnexpectedEndOfJSON("string", s.totalOffset())
- }
- keyIdx := 0
- bitmap := d.keyBitmapUint16
- for {
- c := char(p, cursor)
- switch c {
- case '"':
- fieldSetIndex := bits.TrailingZeros16(curBit)
- field := d.sortedFieldSets[fieldSetIndex]
- keyLen := cursor - start
- cursor++
- s.cursor = cursor
- if keyLen < field.keyLen {
- // early match
- return nil, field.key, nil
- }
- return field, field.key, nil
- case nul:
- s.cursor = cursor
- if s.read() {
- _, cursor, p = s.stat()
- continue
- }
- return nil, "", errors.ErrUnexpectedEndOfJSON("string", s.totalOffset())
- case '\\':
- s.cursor = cursor + 1 // skip '\' char
- chars, err := decodeKeyCharByEscapeCharStream(s)
- if err != nil {
- return nil, "", err
- }
- cursor = s.cursor
- for _, c := range chars {
- curBit &= bitmap[keyIdx][largeToSmallTable[c]]
- if curBit == 0 {
- s.cursor = cursor
- return decodeKeyNotFoundStream(s, start)
- }
- keyIdx++
- }
- default:
- curBit &= bitmap[keyIdx][largeToSmallTable[c]]
- if curBit == 0 {
- s.cursor = cursor
- return decodeKeyNotFoundStream(s, start)
- }
- keyIdx++
- }
- cursor++
- }
- default:
- return nil, "", errors.ErrInvalidBeginningOfValue(char(p, cursor), s.totalOffset())
- }
- }
-}
-
-// decode from '\uXXXX'
-func decodeKeyCharByUnicodeRuneStream(s *Stream) ([]byte, error) {
- const defaultOffset = 4
- const surrogateOffset = 6
-
- if s.cursor+defaultOffset >= s.length {
- if !s.read() {
- return nil, errors.ErrInvalidCharacter(s.char(), "escaped unicode char", s.totalOffset())
- }
- }
-
- r := unicodeToRune(s.buf[s.cursor : s.cursor+defaultOffset])
- if utf16.IsSurrogate(r) {
- s.cursor += defaultOffset
- if s.cursor+surrogateOffset >= s.length {
- s.read()
- }
- if s.cursor+surrogateOffset >= s.length || s.buf[s.cursor] != '\\' || s.buf[s.cursor+1] != 'u' {
- s.cursor += defaultOffset - 1
- return []byte(string(unicode.ReplacementChar)), nil
- }
- r2 := unicodeToRune(s.buf[s.cursor+defaultOffset+2 : s.cursor+surrogateOffset])
- if r := utf16.DecodeRune(r, r2); r != unicode.ReplacementChar {
- s.cursor += defaultOffset - 1
- return []byte(string(r)), nil
- }
- }
- s.cursor += defaultOffset - 1
- return []byte(string(r)), nil
-}
-
-func decodeKeyCharByEscapeCharStream(s *Stream) ([]byte, error) {
- c := s.buf[s.cursor]
- s.cursor++
-RETRY:
- switch c {
- case '"':
- return []byte{'"'}, nil
- case '\\':
- return []byte{'\\'}, nil
- case '/':
- return []byte{'/'}, nil
- case 'b':
- return []byte{'\b'}, nil
- case 'f':
- return []byte{'\f'}, nil
- case 'n':
- return []byte{'\n'}, nil
- case 'r':
- return []byte{'\r'}, nil
- case 't':
- return []byte{'\t'}, nil
- case 'u':
- return decodeKeyCharByUnicodeRuneStream(s)
- case nul:
- if !s.read() {
- return nil, errors.ErrInvalidCharacter(s.char(), "escaped char", s.totalOffset())
- }
- goto RETRY
- default:
- return nil, errors.ErrUnexpectedEndOfJSON("struct field", s.totalOffset())
- }
-}
-
-func decodeKeyNotFoundStream(s *Stream, start int64) (*structFieldSet, string, error) {
- buf, cursor, p := s.stat()
- for {
- cursor++
- switch char(p, cursor) {
- case '"':
- b := buf[start:cursor]
- key := *(*string)(unsafe.Pointer(&b))
- cursor++
- s.cursor = cursor
- return nil, key, nil
- case '\\':
- cursor++
- if char(p, cursor) == nul {
- s.cursor = cursor
- if !s.read() {
- return nil, "", errors.ErrUnexpectedEndOfJSON("string", s.totalOffset())
- }
- buf, cursor, p = s.statForRetry()
- }
- case nul:
- s.cursor = cursor
- if !s.read() {
- return nil, "", errors.ErrUnexpectedEndOfJSON("string", s.totalOffset())
- }
- buf, cursor, p = s.statForRetry()
- }
- }
-}
-
-func decodeKeyStream(d *structDecoder, s *Stream) (*structFieldSet, string, error) {
- key, err := d.stringDecoder.decodeStreamByte(s)
- if err != nil {
- return nil, "", err
- }
- k := *(*string)(unsafe.Pointer(&key))
- return d.fieldMap[k], k, nil
-}
-
-func (d *structDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- depth++
- if depth > maxDecodeNestingDepth {
- return errors.ErrExceededMaxDepth(s.char(), s.cursor)
- }
-
- c := s.skipWhiteSpace()
- switch c {
- case 'n':
- if err := nullBytes(s); err != nil {
- return err
- }
- return nil
- default:
- if s.char() != '{' {
- return errors.ErrInvalidBeginningOfValue(s.char(), s.totalOffset())
- }
- }
- s.cursor++
- if s.skipWhiteSpace() == '}' {
- s.cursor++
- return nil
- }
- var (
- seenFields map[int]struct{}
- seenFieldNum int
- )
- firstWin := (s.Option.Flags & FirstWinOption) != 0
- if firstWin {
- seenFields = make(map[int]struct{}, d.fieldUniqueNameNum)
- }
- for {
- s.reset()
- field, key, err := d.keyStreamDecoder(d, s)
- if err != nil {
- return err
- }
- if s.skipWhiteSpace() != ':' {
- return errors.ErrExpected("colon after object key", s.totalOffset())
- }
- s.cursor++
- if field != nil {
- if field.err != nil {
- return field.err
- }
- if firstWin {
- if _, exists := seenFields[field.fieldIdx]; exists {
- if err := s.skipValue(depth); err != nil {
- return err
- }
- } else {
- if err := field.dec.DecodeStream(s, depth, unsafe.Pointer(uintptr(p)+field.offset)); err != nil {
- return err
- }
- seenFieldNum++
- if d.fieldUniqueNameNum <= seenFieldNum {
- return s.skipObject(depth)
- }
- seenFields[field.fieldIdx] = struct{}{}
- }
- } else {
- if err := field.dec.DecodeStream(s, depth, unsafe.Pointer(uintptr(p)+field.offset)); err != nil {
- return err
- }
- }
- } else if s.DisallowUnknownFields {
- return fmt.Errorf("json: unknown field %q", key)
- } else {
- if err := s.skipValue(depth); err != nil {
- return err
- }
- }
- c := s.skipWhiteSpace()
- if c == '}' {
- s.cursor++
- return nil
- }
- if c != ',' {
- return errors.ErrExpected("comma after object element", s.totalOffset())
- }
- s.cursor++
- }
-}
-
-func (d *structDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- buf := ctx.Buf
- depth++
- if depth > maxDecodeNestingDepth {
- return 0, errors.ErrExceededMaxDepth(buf[cursor], cursor)
- }
- buflen := int64(len(buf))
- cursor = skipWhiteSpace(buf, cursor)
- b := (*sliceHeader)(unsafe.Pointer(&buf)).data
- switch char(b, cursor) {
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return 0, err
- }
- cursor += 4
- return cursor, nil
- case '{':
- default:
- return 0, errors.ErrInvalidBeginningOfValue(char(b, cursor), cursor)
- }
- cursor++
- cursor = skipWhiteSpace(buf, cursor)
- if buf[cursor] == '}' {
- cursor++
- return cursor, nil
- }
- var (
- seenFields map[int]struct{}
- seenFieldNum int
- )
- firstWin := (ctx.Option.Flags & FirstWinOption) != 0
- if firstWin {
- seenFields = make(map[int]struct{}, d.fieldUniqueNameNum)
- }
- for {
- c, field, err := d.keyDecoder(d, buf, cursor)
- if err != nil {
- return 0, err
- }
- cursor = skipWhiteSpace(buf, c)
- if char(b, cursor) != ':' {
- return 0, errors.ErrExpected("colon after object key", cursor)
- }
- cursor++
- if cursor >= buflen {
- return 0, errors.ErrExpected("object value after colon", cursor)
- }
- if field != nil {
- if field.err != nil {
- return 0, field.err
- }
- if firstWin {
- if _, exists := seenFields[field.fieldIdx]; exists {
- c, err := skipValue(buf, cursor, depth)
- if err != nil {
- return 0, err
- }
- cursor = c
- } else {
- c, err := field.dec.Decode(ctx, cursor, depth, unsafe.Pointer(uintptr(p)+field.offset))
- if err != nil {
- return 0, err
- }
- cursor = c
- seenFieldNum++
- if d.fieldUniqueNameNum <= seenFieldNum {
- return skipObject(buf, cursor, depth)
- }
- seenFields[field.fieldIdx] = struct{}{}
- }
- } else {
- c, err := field.dec.Decode(ctx, cursor, depth, unsafe.Pointer(uintptr(p)+field.offset))
- if err != nil {
- return 0, err
- }
- cursor = c
- }
- } else {
- c, err := skipValue(buf, cursor, depth)
- if err != nil {
- return 0, err
- }
- cursor = c
- }
- cursor = skipWhiteSpace(buf, cursor)
- if char(b, cursor) == '}' {
- cursor++
- return cursor, nil
- }
- if char(b, cursor) != ',' {
- return 0, errors.ErrExpected("comma after object element", cursor)
- }
- cursor++
- }
-}
-
-func (d *structDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- return nil, 0, fmt.Errorf("json: struct decoder does not support decode path")
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/type.go b/vendor/github.com/goccy/go-json/internal/decoder/type.go
deleted file mode 100644
index beaf3ab866b..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/type.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package decoder
-
-import (
- "context"
- "encoding"
- "encoding/json"
- "reflect"
- "unsafe"
-)
-
-type Decoder interface {
- Decode(*RuntimeContext, int64, int64, unsafe.Pointer) (int64, error)
- DecodePath(*RuntimeContext, int64, int64) ([][]byte, int64, error)
- DecodeStream(*Stream, int64, unsafe.Pointer) error
-}
-
-const (
- nul = '\000'
- maxDecodeNestingDepth = 10000
-)
-
-type unmarshalerContext interface {
- UnmarshalJSON(context.Context, []byte) error
-}
-
-var (
- unmarshalJSONType = reflect.TypeOf((*json.Unmarshaler)(nil)).Elem()
- unmarshalJSONContextType = reflect.TypeOf((*unmarshalerContext)(nil)).Elem()
- unmarshalTextType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem()
-)
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/uint.go b/vendor/github.com/goccy/go-json/internal/decoder/uint.go
deleted file mode 100644
index 4131731b8e4..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/uint.go
+++ /dev/null
@@ -1,194 +0,0 @@
-package decoder
-
-import (
- "fmt"
- "reflect"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type uintDecoder struct {
- typ *runtime.Type
- kind reflect.Kind
- op func(unsafe.Pointer, uint64)
- structName string
- fieldName string
-}
-
-func newUintDecoder(typ *runtime.Type, structName, fieldName string, op func(unsafe.Pointer, uint64)) *uintDecoder {
- return &uintDecoder{
- typ: typ,
- kind: typ.Kind(),
- op: op,
- structName: structName,
- fieldName: fieldName,
- }
-}
-
-func (d *uintDecoder) typeError(buf []byte, offset int64) *errors.UnmarshalTypeError {
- return &errors.UnmarshalTypeError{
- Value: fmt.Sprintf("number %s", string(buf)),
- Type: runtime.RType2Type(d.typ),
- Offset: offset,
- }
-}
-
-var (
- pow10u64 = [...]uint64{
- 1e00, 1e01, 1e02, 1e03, 1e04, 1e05, 1e06, 1e07, 1e08, 1e09,
- 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19,
- }
- pow10u64Len = len(pow10u64)
-)
-
-func (d *uintDecoder) parseUint(b []byte) (uint64, error) {
- maxDigit := len(b)
- if maxDigit > pow10u64Len {
- return 0, fmt.Errorf("invalid length of number")
- }
- sum := uint64(0)
- for i := 0; i < maxDigit; i++ {
- c := uint64(b[i]) - 48
- digitValue := pow10u64[maxDigit-i-1]
- sum += c * digitValue
- }
- return sum, nil
-}
-
-func (d *uintDecoder) decodeStreamByte(s *Stream) ([]byte, error) {
- for {
- switch s.char() {
- case ' ', '\n', '\t', '\r':
- s.cursor++
- continue
- case '0':
- s.cursor++
- return numZeroBuf, nil
- case '1', '2', '3', '4', '5', '6', '7', '8', '9':
- start := s.cursor
- for {
- s.cursor++
- if numTable[s.char()] {
- continue
- } else if s.char() == nul {
- if s.read() {
- s.cursor-- // for retry current character
- continue
- }
- }
- break
- }
- num := s.buf[start:s.cursor]
- return num, nil
- case 'n':
- if err := nullBytes(s); err != nil {
- return nil, err
- }
- return nil, nil
- case nul:
- if s.read() {
- continue
- }
- default:
- return nil, d.typeError([]byte{s.char()}, s.totalOffset())
- }
- break
- }
- return nil, errors.ErrUnexpectedEndOfJSON("number(unsigned integer)", s.totalOffset())
-}
-
-func (d *uintDecoder) decodeByte(buf []byte, cursor int64) ([]byte, int64, error) {
- for {
- switch buf[cursor] {
- case ' ', '\n', '\t', '\r':
- cursor++
- continue
- case '0':
- cursor++
- return numZeroBuf, cursor, nil
- case '1', '2', '3', '4', '5', '6', '7', '8', '9':
- start := cursor
- cursor++
- for numTable[buf[cursor]] {
- cursor++
- }
- num := buf[start:cursor]
- return num, cursor, nil
- case 'n':
- if err := validateNull(buf, cursor); err != nil {
- return nil, 0, err
- }
- cursor += 4
- return nil, cursor, nil
- default:
- return nil, 0, d.typeError([]byte{buf[cursor]}, cursor)
- }
- }
-}
-
-func (d *uintDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- bytes, err := d.decodeStreamByte(s)
- if err != nil {
- return err
- }
- if bytes == nil {
- return nil
- }
- u64, err := d.parseUint(bytes)
- if err != nil {
- return d.typeError(bytes, s.totalOffset())
- }
- switch d.kind {
- case reflect.Uint8:
- if (1 << 8) <= u64 {
- return d.typeError(bytes, s.totalOffset())
- }
- case reflect.Uint16:
- if (1 << 16) <= u64 {
- return d.typeError(bytes, s.totalOffset())
- }
- case reflect.Uint32:
- if (1 << 32) <= u64 {
- return d.typeError(bytes, s.totalOffset())
- }
- }
- d.op(p, u64)
- return nil
-}
-
-func (d *uintDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- bytes, c, err := d.decodeByte(ctx.Buf, cursor)
- if err != nil {
- return 0, err
- }
- if bytes == nil {
- return c, nil
- }
- cursor = c
- u64, err := d.parseUint(bytes)
- if err != nil {
- return 0, d.typeError(bytes, cursor)
- }
- switch d.kind {
- case reflect.Uint8:
- if (1 << 8) <= u64 {
- return 0, d.typeError(bytes, cursor)
- }
- case reflect.Uint16:
- if (1 << 16) <= u64 {
- return 0, d.typeError(bytes, cursor)
- }
- case reflect.Uint32:
- if (1 << 32) <= u64 {
- return 0, d.typeError(bytes, cursor)
- }
- }
- d.op(p, u64)
- return cursor, nil
-}
-
-func (d *uintDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- return nil, 0, fmt.Errorf("json: uint decoder does not support decode path")
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/unmarshal_json.go b/vendor/github.com/goccy/go-json/internal/decoder/unmarshal_json.go
deleted file mode 100644
index 4cd6dbd573f..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/unmarshal_json.go
+++ /dev/null
@@ -1,104 +0,0 @@
-package decoder
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type unmarshalJSONDecoder struct {
- typ *runtime.Type
- structName string
- fieldName string
-}
-
-func newUnmarshalJSONDecoder(typ *runtime.Type, structName, fieldName string) *unmarshalJSONDecoder {
- return &unmarshalJSONDecoder{
- typ: typ,
- structName: structName,
- fieldName: fieldName,
- }
-}
-
-func (d *unmarshalJSONDecoder) annotateError(cursor int64, err error) {
- switch e := err.(type) {
- case *errors.UnmarshalTypeError:
- e.Struct = d.structName
- e.Field = d.fieldName
- case *errors.SyntaxError:
- e.Offset = cursor
- }
-}
-
-func (d *unmarshalJSONDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- s.skipWhiteSpace()
- start := s.cursor
- if err := s.skipValue(depth); err != nil {
- return err
- }
- src := s.buf[start:s.cursor]
- dst := make([]byte, len(src))
- copy(dst, src)
-
- v := *(*interface{})(unsafe.Pointer(&emptyInterface{
- typ: d.typ,
- ptr: p,
- }))
- switch v := v.(type) {
- case unmarshalerContext:
- var ctx context.Context
- if (s.Option.Flags & ContextOption) != 0 {
- ctx = s.Option.Context
- } else {
- ctx = context.Background()
- }
- if err := v.UnmarshalJSON(ctx, dst); err != nil {
- d.annotateError(s.cursor, err)
- return err
- }
- case json.Unmarshaler:
- if err := v.UnmarshalJSON(dst); err != nil {
- d.annotateError(s.cursor, err)
- return err
- }
- }
- return nil
-}
-
-func (d *unmarshalJSONDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- buf := ctx.Buf
- cursor = skipWhiteSpace(buf, cursor)
- start := cursor
- end, err := skipValue(buf, cursor, depth)
- if err != nil {
- return 0, err
- }
- src := buf[start:end]
- dst := make([]byte, len(src))
- copy(dst, src)
-
- v := *(*interface{})(unsafe.Pointer(&emptyInterface{
- typ: d.typ,
- ptr: p,
- }))
- if (ctx.Option.Flags & ContextOption) != 0 {
- if err := v.(unmarshalerContext).UnmarshalJSON(ctx.Option.Context, dst); err != nil {
- d.annotateError(cursor, err)
- return 0, err
- }
- } else {
- if err := v.(json.Unmarshaler).UnmarshalJSON(dst); err != nil {
- d.annotateError(cursor, err)
- return 0, err
- }
- }
- return end, nil
-}
-
-func (d *unmarshalJSONDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- return nil, 0, fmt.Errorf("json: unmarshal json decoder does not support decode path")
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/unmarshal_text.go b/vendor/github.com/goccy/go-json/internal/decoder/unmarshal_text.go
deleted file mode 100644
index d711d0f85f0..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/unmarshal_text.go
+++ /dev/null
@@ -1,285 +0,0 @@
-package decoder
-
-import (
- "bytes"
- "encoding"
- "fmt"
- "unicode"
- "unicode/utf16"
- "unicode/utf8"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type unmarshalTextDecoder struct {
- typ *runtime.Type
- structName string
- fieldName string
-}
-
-func newUnmarshalTextDecoder(typ *runtime.Type, structName, fieldName string) *unmarshalTextDecoder {
- return &unmarshalTextDecoder{
- typ: typ,
- structName: structName,
- fieldName: fieldName,
- }
-}
-
-func (d *unmarshalTextDecoder) annotateError(cursor int64, err error) {
- switch e := err.(type) {
- case *errors.UnmarshalTypeError:
- e.Struct = d.structName
- e.Field = d.fieldName
- case *errors.SyntaxError:
- e.Offset = cursor
- }
-}
-
-var (
- nullbytes = []byte(`null`)
-)
-
-func (d *unmarshalTextDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- s.skipWhiteSpace()
- start := s.cursor
- if err := s.skipValue(depth); err != nil {
- return err
- }
- src := s.buf[start:s.cursor]
- if len(src) > 0 {
- switch src[0] {
- case '[':
- return &errors.UnmarshalTypeError{
- Value: "array",
- Type: runtime.RType2Type(d.typ),
- Offset: s.totalOffset(),
- }
- case '{':
- return &errors.UnmarshalTypeError{
- Value: "object",
- Type: runtime.RType2Type(d.typ),
- Offset: s.totalOffset(),
- }
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return &errors.UnmarshalTypeError{
- Value: "number",
- Type: runtime.RType2Type(d.typ),
- Offset: s.totalOffset(),
- }
- case 'n':
- if bytes.Equal(src, nullbytes) {
- *(*unsafe.Pointer)(p) = nil
- return nil
- }
- }
- }
- dst := make([]byte, len(src))
- copy(dst, src)
-
- if b, ok := unquoteBytes(dst); ok {
- dst = b
- }
- v := *(*interface{})(unsafe.Pointer(&emptyInterface{
- typ: d.typ,
- ptr: p,
- }))
- if err := v.(encoding.TextUnmarshaler).UnmarshalText(dst); err != nil {
- d.annotateError(s.cursor, err)
- return err
- }
- return nil
-}
-
-func (d *unmarshalTextDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- buf := ctx.Buf
- cursor = skipWhiteSpace(buf, cursor)
- start := cursor
- end, err := skipValue(buf, cursor, depth)
- if err != nil {
- return 0, err
- }
- src := buf[start:end]
- if len(src) > 0 {
- switch src[0] {
- case '[':
- return 0, &errors.UnmarshalTypeError{
- Value: "array",
- Type: runtime.RType2Type(d.typ),
- Offset: start,
- }
- case '{':
- return 0, &errors.UnmarshalTypeError{
- Value: "object",
- Type: runtime.RType2Type(d.typ),
- Offset: start,
- }
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return 0, &errors.UnmarshalTypeError{
- Value: "number",
- Type: runtime.RType2Type(d.typ),
- Offset: start,
- }
- case 'n':
- if bytes.Equal(src, nullbytes) {
- *(*unsafe.Pointer)(p) = nil
- return end, nil
- }
- }
- }
-
- if s, ok := unquoteBytes(src); ok {
- src = s
- }
- v := *(*interface{})(unsafe.Pointer(&emptyInterface{
- typ: d.typ,
- ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)),
- }))
- if err := v.(encoding.TextUnmarshaler).UnmarshalText(src); err != nil {
- d.annotateError(cursor, err)
- return 0, err
- }
- return end, nil
-}
-
-func (d *unmarshalTextDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- return nil, 0, fmt.Errorf("json: unmarshal text decoder does not support decode path")
-}
-
-func unquoteBytes(s []byte) (t []byte, ok bool) { //nolint: nonamedreturns
- length := len(s)
- if length < 2 || s[0] != '"' || s[length-1] != '"' {
- return
- }
- s = s[1 : length-1]
- length -= 2
-
- // Check for unusual characters. If there are none,
- // then no unquoting is needed, so return a slice of the
- // original bytes.
- r := 0
- for r < length {
- c := s[r]
- if c == '\\' || c == '"' || c < ' ' {
- break
- }
- if c < utf8.RuneSelf {
- r++
- continue
- }
- rr, size := utf8.DecodeRune(s[r:])
- if rr == utf8.RuneError && size == 1 {
- break
- }
- r += size
- }
- if r == length {
- return s, true
- }
-
- b := make([]byte, length+2*utf8.UTFMax)
- w := copy(b, s[0:r])
- for r < length {
- // Out of room? Can only happen if s is full of
- // malformed UTF-8 and we're replacing each
- // byte with RuneError.
- if w >= len(b)-2*utf8.UTFMax {
- nb := make([]byte, (len(b)+utf8.UTFMax)*2)
- copy(nb, b[0:w])
- b = nb
- }
- switch c := s[r]; {
- case c == '\\':
- r++
- if r >= length {
- return
- }
- switch s[r] {
- default:
- return
- case '"', '\\', '/', '\'':
- b[w] = s[r]
- r++
- w++
- case 'b':
- b[w] = '\b'
- r++
- w++
- case 'f':
- b[w] = '\f'
- r++
- w++
- case 'n':
- b[w] = '\n'
- r++
- w++
- case 'r':
- b[w] = '\r'
- r++
- w++
- case 't':
- b[w] = '\t'
- r++
- w++
- case 'u':
- r--
- rr := getu4(s[r:])
- if rr < 0 {
- return
- }
- r += 6
- if utf16.IsSurrogate(rr) {
- rr1 := getu4(s[r:])
- if dec := utf16.DecodeRune(rr, rr1); dec != unicode.ReplacementChar {
- // A valid pair; consume.
- r += 6
- w += utf8.EncodeRune(b[w:], dec)
- break
- }
- // Invalid surrogate; fall back to replacement rune.
- rr = unicode.ReplacementChar
- }
- w += utf8.EncodeRune(b[w:], rr)
- }
-
- // Quote, control characters are invalid.
- case c == '"', c < ' ':
- return
-
- // ASCII
- case c < utf8.RuneSelf:
- b[w] = c
- r++
- w++
-
- // Coerce to well-formed UTF-8.
- default:
- rr, size := utf8.DecodeRune(s[r:])
- r += size
- w += utf8.EncodeRune(b[w:], rr)
- }
- }
- return b[0:w], true
-}
-
-func getu4(s []byte) rune {
- if len(s) < 6 || s[0] != '\\' || s[1] != 'u' {
- return -1
- }
- var r rune
- for _, c := range s[2:6] {
- switch {
- case '0' <= c && c <= '9':
- c = c - '0'
- case 'a' <= c && c <= 'f':
- c = c - 'a' + 10
- case 'A' <= c && c <= 'F':
- c = c - 'A' + 10
- default:
- return -1
- }
- r = r*16 + rune(c)
- }
- return r
-}
diff --git a/vendor/github.com/goccy/go-json/internal/decoder/wrapped_string.go b/vendor/github.com/goccy/go-json/internal/decoder/wrapped_string.go
deleted file mode 100644
index 0c4e2e6eacf..00000000000
--- a/vendor/github.com/goccy/go-json/internal/decoder/wrapped_string.go
+++ /dev/null
@@ -1,73 +0,0 @@
-package decoder
-
-import (
- "fmt"
- "reflect"
- "unsafe"
-
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type wrappedStringDecoder struct {
- typ *runtime.Type
- dec Decoder
- stringDecoder *stringDecoder
- structName string
- fieldName string
- isPtrType bool
-}
-
-func newWrappedStringDecoder(typ *runtime.Type, dec Decoder, structName, fieldName string) *wrappedStringDecoder {
- return &wrappedStringDecoder{
- typ: typ,
- dec: dec,
- stringDecoder: newStringDecoder(structName, fieldName),
- structName: structName,
- fieldName: fieldName,
- isPtrType: typ.Kind() == reflect.Ptr,
- }
-}
-
-func (d *wrappedStringDecoder) DecodeStream(s *Stream, depth int64, p unsafe.Pointer) error {
- bytes, err := d.stringDecoder.decodeStreamByte(s)
- if err != nil {
- return err
- }
- if bytes == nil {
- if d.isPtrType {
- *(*unsafe.Pointer)(p) = nil
- }
- return nil
- }
- b := make([]byte, len(bytes)+1)
- copy(b, bytes)
- if _, err := d.dec.Decode(&RuntimeContext{Buf: b}, 0, depth, p); err != nil {
- return err
- }
- return nil
-}
-
-func (d *wrappedStringDecoder) Decode(ctx *RuntimeContext, cursor, depth int64, p unsafe.Pointer) (int64, error) {
- bytes, c, err := d.stringDecoder.decodeByte(ctx.Buf, cursor)
- if err != nil {
- return 0, err
- }
- if bytes == nil {
- if d.isPtrType {
- *(*unsafe.Pointer)(p) = nil
- }
- return c, nil
- }
- bytes = append(bytes, nul)
- oldBuf := ctx.Buf
- ctx.Buf = bytes
- if _, err := d.dec.Decode(ctx, 0, depth, p); err != nil {
- return 0, err
- }
- ctx.Buf = oldBuf
- return c, nil
-}
-
-func (d *wrappedStringDecoder) DecodePath(ctx *RuntimeContext, cursor, depth int64) ([][]byte, int64, error) {
- return nil, 0, fmt.Errorf("json: wrapped string decoder does not support decode path")
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/code.go b/vendor/github.com/goccy/go-json/internal/encoder/code.go
deleted file mode 100644
index 5b08faefc73..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/code.go
+++ /dev/null
@@ -1,1023 +0,0 @@
-package encoder
-
-import (
- "fmt"
- "reflect"
- "unsafe"
-
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type Code interface {
- Kind() CodeKind
- ToOpcode(*compileContext) Opcodes
- Filter(*FieldQuery) Code
-}
-
-type AnonymousCode interface {
- ToAnonymousOpcode(*compileContext) Opcodes
-}
-
-type Opcodes []*Opcode
-
-func (o Opcodes) First() *Opcode {
- if len(o) == 0 {
- return nil
- }
- return o[0]
-}
-
-func (o Opcodes) Last() *Opcode {
- if len(o) == 0 {
- return nil
- }
- return o[len(o)-1]
-}
-
-func (o Opcodes) Add(codes ...*Opcode) Opcodes {
- return append(o, codes...)
-}
-
-type CodeKind int
-
-const (
- CodeKindInterface CodeKind = iota
- CodeKindPtr
- CodeKindInt
- CodeKindUint
- CodeKindFloat
- CodeKindString
- CodeKindBool
- CodeKindStruct
- CodeKindMap
- CodeKindSlice
- CodeKindArray
- CodeKindBytes
- CodeKindMarshalJSON
- CodeKindMarshalText
- CodeKindRecursive
-)
-
-type IntCode struct {
- typ *runtime.Type
- bitSize uint8
- isString bool
- isPtr bool
-}
-
-func (c *IntCode) Kind() CodeKind {
- return CodeKindInt
-}
-
-func (c *IntCode) ToOpcode(ctx *compileContext) Opcodes {
- var code *Opcode
- switch {
- case c.isPtr:
- code = newOpCode(ctx, c.typ, OpIntPtr)
- case c.isString:
- code = newOpCode(ctx, c.typ, OpIntString)
- default:
- code = newOpCode(ctx, c.typ, OpInt)
- }
- code.NumBitSize = c.bitSize
- ctx.incIndex()
- return Opcodes{code}
-}
-
-func (c *IntCode) Filter(_ *FieldQuery) Code {
- return c
-}
-
-type UintCode struct {
- typ *runtime.Type
- bitSize uint8
- isString bool
- isPtr bool
-}
-
-func (c *UintCode) Kind() CodeKind {
- return CodeKindUint
-}
-
-func (c *UintCode) ToOpcode(ctx *compileContext) Opcodes {
- var code *Opcode
- switch {
- case c.isPtr:
- code = newOpCode(ctx, c.typ, OpUintPtr)
- case c.isString:
- code = newOpCode(ctx, c.typ, OpUintString)
- default:
- code = newOpCode(ctx, c.typ, OpUint)
- }
- code.NumBitSize = c.bitSize
- ctx.incIndex()
- return Opcodes{code}
-}
-
-func (c *UintCode) Filter(_ *FieldQuery) Code {
- return c
-}
-
-type FloatCode struct {
- typ *runtime.Type
- bitSize uint8
- isPtr bool
-}
-
-func (c *FloatCode) Kind() CodeKind {
- return CodeKindFloat
-}
-
-func (c *FloatCode) ToOpcode(ctx *compileContext) Opcodes {
- var code *Opcode
- switch {
- case c.isPtr:
- switch c.bitSize {
- case 32:
- code = newOpCode(ctx, c.typ, OpFloat32Ptr)
- default:
- code = newOpCode(ctx, c.typ, OpFloat64Ptr)
- }
- default:
- switch c.bitSize {
- case 32:
- code = newOpCode(ctx, c.typ, OpFloat32)
- default:
- code = newOpCode(ctx, c.typ, OpFloat64)
- }
- }
- ctx.incIndex()
- return Opcodes{code}
-}
-
-func (c *FloatCode) Filter(_ *FieldQuery) Code {
- return c
-}
-
-type StringCode struct {
- typ *runtime.Type
- isPtr bool
-}
-
-func (c *StringCode) Kind() CodeKind {
- return CodeKindString
-}
-
-func (c *StringCode) ToOpcode(ctx *compileContext) Opcodes {
- isJSONNumberType := c.typ == runtime.Type2RType(jsonNumberType)
- var code *Opcode
- if c.isPtr {
- if isJSONNumberType {
- code = newOpCode(ctx, c.typ, OpNumberPtr)
- } else {
- code = newOpCode(ctx, c.typ, OpStringPtr)
- }
- } else {
- if isJSONNumberType {
- code = newOpCode(ctx, c.typ, OpNumber)
- } else {
- code = newOpCode(ctx, c.typ, OpString)
- }
- }
- ctx.incIndex()
- return Opcodes{code}
-}
-
-func (c *StringCode) Filter(_ *FieldQuery) Code {
- return c
-}
-
-type BoolCode struct {
- typ *runtime.Type
- isPtr bool
-}
-
-func (c *BoolCode) Kind() CodeKind {
- return CodeKindBool
-}
-
-func (c *BoolCode) ToOpcode(ctx *compileContext) Opcodes {
- var code *Opcode
- switch {
- case c.isPtr:
- code = newOpCode(ctx, c.typ, OpBoolPtr)
- default:
- code = newOpCode(ctx, c.typ, OpBool)
- }
- ctx.incIndex()
- return Opcodes{code}
-}
-
-func (c *BoolCode) Filter(_ *FieldQuery) Code {
- return c
-}
-
-type BytesCode struct {
- typ *runtime.Type
- isPtr bool
-}
-
-func (c *BytesCode) Kind() CodeKind {
- return CodeKindBytes
-}
-
-func (c *BytesCode) ToOpcode(ctx *compileContext) Opcodes {
- var code *Opcode
- switch {
- case c.isPtr:
- code = newOpCode(ctx, c.typ, OpBytesPtr)
- default:
- code = newOpCode(ctx, c.typ, OpBytes)
- }
- ctx.incIndex()
- return Opcodes{code}
-}
-
-func (c *BytesCode) Filter(_ *FieldQuery) Code {
- return c
-}
-
-type SliceCode struct {
- typ *runtime.Type
- value Code
-}
-
-func (c *SliceCode) Kind() CodeKind {
- return CodeKindSlice
-}
-
-func (c *SliceCode) ToOpcode(ctx *compileContext) Opcodes {
- // header => opcode => elem => end
- // ^ |
- // |________|
- size := c.typ.Elem().Size()
- header := newSliceHeaderCode(ctx, c.typ)
- ctx.incIndex()
-
- ctx.incIndent()
- codes := c.value.ToOpcode(ctx)
- ctx.decIndent()
-
- codes.First().Flags |= IndirectFlags
- elemCode := newSliceElemCode(ctx, c.typ.Elem(), header, size)
- ctx.incIndex()
- end := newOpCode(ctx, c.typ, OpSliceEnd)
- ctx.incIndex()
- header.End = end
- header.Next = codes.First()
- codes.Last().Next = elemCode
- elemCode.Next = codes.First()
- elemCode.End = end
- return Opcodes{header}.Add(codes...).Add(elemCode).Add(end)
-}
-
-func (c *SliceCode) Filter(_ *FieldQuery) Code {
- return c
-}
-
-type ArrayCode struct {
- typ *runtime.Type
- value Code
-}
-
-func (c *ArrayCode) Kind() CodeKind {
- return CodeKindArray
-}
-
-func (c *ArrayCode) ToOpcode(ctx *compileContext) Opcodes {
- // header => opcode => elem => end
- // ^ |
- // |________|
- elem := c.typ.Elem()
- alen := c.typ.Len()
- size := elem.Size()
-
- header := newArrayHeaderCode(ctx, c.typ, alen)
- ctx.incIndex()
-
- ctx.incIndent()
- codes := c.value.ToOpcode(ctx)
- ctx.decIndent()
-
- codes.First().Flags |= IndirectFlags
-
- elemCode := newArrayElemCode(ctx, elem, header, alen, size)
- ctx.incIndex()
-
- end := newOpCode(ctx, c.typ, OpArrayEnd)
- ctx.incIndex()
-
- header.End = end
- header.Next = codes.First()
- codes.Last().Next = elemCode
- elemCode.Next = codes.First()
- elemCode.End = end
-
- return Opcodes{header}.Add(codes...).Add(elemCode).Add(end)
-}
-
-func (c *ArrayCode) Filter(_ *FieldQuery) Code {
- return c
-}
-
-type MapCode struct {
- typ *runtime.Type
- key Code
- value Code
-}
-
-func (c *MapCode) Kind() CodeKind {
- return CodeKindMap
-}
-
-func (c *MapCode) ToOpcode(ctx *compileContext) Opcodes {
- // header => code => value => code => key => code => value => code => end
- // ^ |
- // |_______________________|
- header := newMapHeaderCode(ctx, c.typ)
- ctx.incIndex()
-
- keyCodes := c.key.ToOpcode(ctx)
-
- value := newMapValueCode(ctx, c.typ.Elem(), header)
- ctx.incIndex()
-
- ctx.incIndent()
- valueCodes := c.value.ToOpcode(ctx)
- ctx.decIndent()
-
- valueCodes.First().Flags |= IndirectFlags
-
- key := newMapKeyCode(ctx, c.typ.Key(), header)
- ctx.incIndex()
-
- end := newMapEndCode(ctx, c.typ, header)
- ctx.incIndex()
-
- header.Next = keyCodes.First()
- keyCodes.Last().Next = value
- value.Next = valueCodes.First()
- valueCodes.Last().Next = key
- key.Next = keyCodes.First()
-
- header.End = end
- key.End = end
- value.End = end
- return Opcodes{header}.Add(keyCodes...).Add(value).Add(valueCodes...).Add(key).Add(end)
-}
-
-func (c *MapCode) Filter(_ *FieldQuery) Code {
- return c
-}
-
-type StructCode struct {
- typ *runtime.Type
- fields []*StructFieldCode
- isPtr bool
- disableIndirectConversion bool
- isIndirect bool
- isRecursive bool
-}
-
-func (c *StructCode) Kind() CodeKind {
- return CodeKindStruct
-}
-
-func (c *StructCode) lastFieldCode(field *StructFieldCode, firstField *Opcode) *Opcode {
- if isEmbeddedStruct(field) {
- return c.lastAnonymousFieldCode(firstField)
- }
- lastField := firstField
- for lastField.NextField != nil {
- lastField = lastField.NextField
- }
- return lastField
-}
-
-func (c *StructCode) lastAnonymousFieldCode(firstField *Opcode) *Opcode {
- // firstField is special StructHead operation for anonymous structure.
- // So, StructHead's next operation is truly struct head operation.
- for firstField.Op == OpStructHead || firstField.Op == OpStructField {
- firstField = firstField.Next
- }
- lastField := firstField
- for lastField.NextField != nil {
- lastField = lastField.NextField
- }
- return lastField
-}
-
-func (c *StructCode) ToOpcode(ctx *compileContext) Opcodes {
- // header => code => structField => code => end
- // ^ |
- // |__________|
- if c.isRecursive {
- recursive := newRecursiveCode(ctx, c.typ, &CompiledCode{})
- recursive.Type = c.typ
- ctx.incIndex()
- *ctx.recursiveCodes = append(*ctx.recursiveCodes, recursive)
- return Opcodes{recursive}
- }
- codes := Opcodes{}
- var prevField *Opcode
- ctx.incIndent()
- for idx, field := range c.fields {
- isFirstField := idx == 0
- isEndField := idx == len(c.fields)-1
- fieldCodes := field.ToOpcode(ctx, isFirstField, isEndField)
- for _, code := range fieldCodes {
- if c.isIndirect {
- code.Flags |= IndirectFlags
- }
- }
- firstField := fieldCodes.First()
- if len(codes) > 0 {
- codes.Last().Next = firstField
- firstField.Idx = codes.First().Idx
- }
- if prevField != nil {
- prevField.NextField = firstField
- }
- if isEndField {
- endField := fieldCodes.Last()
- if len(codes) > 0 {
- codes.First().End = endField
- } else {
- firstField.End = endField
- }
- codes = codes.Add(fieldCodes...)
- break
- }
- prevField = c.lastFieldCode(field, firstField)
- codes = codes.Add(fieldCodes...)
- }
- if len(codes) == 0 {
- head := &Opcode{
- Op: OpStructHead,
- Idx: opcodeOffset(ctx.ptrIndex),
- Type: c.typ,
- DisplayIdx: ctx.opcodeIndex,
- Indent: ctx.indent,
- }
- ctx.incOpcodeIndex()
- end := &Opcode{
- Op: OpStructEnd,
- Idx: opcodeOffset(ctx.ptrIndex),
- DisplayIdx: ctx.opcodeIndex,
- Indent: ctx.indent,
- }
- head.NextField = end
- head.Next = end
- head.End = end
- codes = codes.Add(head, end)
- ctx.incIndex()
- }
- ctx.decIndent()
- ctx.structTypeToCodes[uintptr(unsafe.Pointer(c.typ))] = codes
- return codes
-}
-
-func (c *StructCode) ToAnonymousOpcode(ctx *compileContext) Opcodes {
- // header => code => structField => code => end
- // ^ |
- // |__________|
- if c.isRecursive {
- recursive := newRecursiveCode(ctx, c.typ, &CompiledCode{})
- recursive.Type = c.typ
- ctx.incIndex()
- *ctx.recursiveCodes = append(*ctx.recursiveCodes, recursive)
- return Opcodes{recursive}
- }
- codes := Opcodes{}
- var prevField *Opcode
- for idx, field := range c.fields {
- isFirstField := idx == 0
- isEndField := idx == len(c.fields)-1
- fieldCodes := field.ToAnonymousOpcode(ctx, isFirstField, isEndField)
- for _, code := range fieldCodes {
- if c.isIndirect {
- code.Flags |= IndirectFlags
- }
- }
- firstField := fieldCodes.First()
- if len(codes) > 0 {
- codes.Last().Next = firstField
- firstField.Idx = codes.First().Idx
- }
- if prevField != nil {
- prevField.NextField = firstField
- }
- if isEndField {
- lastField := fieldCodes.Last()
- if len(codes) > 0 {
- codes.First().End = lastField
- } else {
- firstField.End = lastField
- }
- }
- prevField = firstField
- codes = codes.Add(fieldCodes...)
- }
- return codes
-}
-
-func (c *StructCode) removeFieldsByTags(tags runtime.StructTags) {
- fields := make([]*StructFieldCode, 0, len(c.fields))
- for _, field := range c.fields {
- if field.isAnonymous {
- structCode := field.getAnonymousStruct()
- if structCode != nil && !structCode.isRecursive {
- structCode.removeFieldsByTags(tags)
- if len(structCode.fields) > 0 {
- fields = append(fields, field)
- }
- continue
- }
- }
- if tags.ExistsKey(field.key) {
- continue
- }
- fields = append(fields, field)
- }
- c.fields = fields
-}
-
-func (c *StructCode) enableIndirect() {
- if c.isIndirect {
- return
- }
- c.isIndirect = true
- if len(c.fields) == 0 {
- return
- }
- structCode := c.fields[0].getStruct()
- if structCode == nil {
- return
- }
- structCode.enableIndirect()
-}
-
-func (c *StructCode) Filter(query *FieldQuery) Code {
- fieldMap := map[string]*FieldQuery{}
- for _, field := range query.Fields {
- fieldMap[field.Name] = field
- }
- fields := make([]*StructFieldCode, 0, len(c.fields))
- for _, field := range c.fields {
- query, exists := fieldMap[field.key]
- if !exists {
- continue
- }
- fieldCode := &StructFieldCode{
- typ: field.typ,
- key: field.key,
- tag: field.tag,
- value: field.value,
- offset: field.offset,
- isAnonymous: field.isAnonymous,
- isTaggedKey: field.isTaggedKey,
- isNilableType: field.isNilableType,
- isNilCheck: field.isNilCheck,
- isAddrForMarshaler: field.isAddrForMarshaler,
- isNextOpPtrType: field.isNextOpPtrType,
- }
- if len(query.Fields) > 0 {
- fieldCode.value = fieldCode.value.Filter(query)
- }
- fields = append(fields, fieldCode)
- }
- return &StructCode{
- typ: c.typ,
- fields: fields,
- isPtr: c.isPtr,
- disableIndirectConversion: c.disableIndirectConversion,
- isIndirect: c.isIndirect,
- isRecursive: c.isRecursive,
- }
-}
-
-type StructFieldCode struct {
- typ *runtime.Type
- key string
- tag *runtime.StructTag
- value Code
- offset uintptr
- isAnonymous bool
- isTaggedKey bool
- isNilableType bool
- isNilCheck bool
- isAddrForMarshaler bool
- isNextOpPtrType bool
- isMarshalerContext bool
-}
-
-func (c *StructFieldCode) getStruct() *StructCode {
- value := c.value
- ptr, ok := value.(*PtrCode)
- if ok {
- value = ptr.value
- }
- structCode, ok := value.(*StructCode)
- if ok {
- return structCode
- }
- return nil
-}
-
-func (c *StructFieldCode) getAnonymousStruct() *StructCode {
- if !c.isAnonymous {
- return nil
- }
- return c.getStruct()
-}
-
-func optimizeStructHeader(code *Opcode, tag *runtime.StructTag) OpType {
- headType := code.ToHeaderType(tag.IsString)
- if tag.IsOmitEmpty {
- headType = headType.HeadToOmitEmptyHead()
- }
- return headType
-}
-
-func optimizeStructField(code *Opcode, tag *runtime.StructTag) OpType {
- fieldType := code.ToFieldType(tag.IsString)
- if tag.IsOmitEmpty {
- fieldType = fieldType.FieldToOmitEmptyField()
- }
- return fieldType
-}
-
-func (c *StructFieldCode) headerOpcodes(ctx *compileContext, field *Opcode, valueCodes Opcodes) Opcodes {
- value := valueCodes.First()
- op := optimizeStructHeader(value, c.tag)
- field.Op = op
- if value.Flags&MarshalerContextFlags != 0 {
- field.Flags |= MarshalerContextFlags
- }
- field.NumBitSize = value.NumBitSize
- field.PtrNum = value.PtrNum
- field.FieldQuery = value.FieldQuery
- fieldCodes := Opcodes{field}
- if op.IsMultipleOpHead() {
- field.Next = value
- fieldCodes = fieldCodes.Add(valueCodes...)
- } else {
- ctx.decIndex()
- }
- return fieldCodes
-}
-
-func (c *StructFieldCode) fieldOpcodes(ctx *compileContext, field *Opcode, valueCodes Opcodes) Opcodes {
- value := valueCodes.First()
- op := optimizeStructField(value, c.tag)
- field.Op = op
- if value.Flags&MarshalerContextFlags != 0 {
- field.Flags |= MarshalerContextFlags
- }
- field.NumBitSize = value.NumBitSize
- field.PtrNum = value.PtrNum
- field.FieldQuery = value.FieldQuery
-
- fieldCodes := Opcodes{field}
- if op.IsMultipleOpField() {
- field.Next = value
- fieldCodes = fieldCodes.Add(valueCodes...)
- } else {
- ctx.decIndex()
- }
- return fieldCodes
-}
-
-func (c *StructFieldCode) addStructEndCode(ctx *compileContext, codes Opcodes) Opcodes {
- end := &Opcode{
- Op: OpStructEnd,
- Idx: opcodeOffset(ctx.ptrIndex),
- DisplayIdx: ctx.opcodeIndex,
- Indent: ctx.indent,
- }
- codes.Last().Next = end
- code := codes.First()
- for code.Op == OpStructField || code.Op == OpStructHead {
- code = code.Next
- }
- for code.NextField != nil {
- code = code.NextField
- }
- code.NextField = end
-
- codes = codes.Add(end)
- ctx.incOpcodeIndex()
- return codes
-}
-
-func (c *StructFieldCode) structKey(ctx *compileContext) string {
- if ctx.escapeKey {
- rctx := &RuntimeContext{Option: &Option{Flag: HTMLEscapeOption}}
- return fmt.Sprintf(`%s:`, string(AppendString(rctx, []byte{}, c.key)))
- }
- return fmt.Sprintf(`"%s":`, c.key)
-}
-
-func (c *StructFieldCode) flags() OpFlags {
- var flags OpFlags
- if c.isTaggedKey {
- flags |= IsTaggedKeyFlags
- }
- if c.isNilableType {
- flags |= IsNilableTypeFlags
- }
- if c.isNilCheck {
- flags |= NilCheckFlags
- }
- if c.isAddrForMarshaler {
- flags |= AddrForMarshalerFlags
- }
- if c.isNextOpPtrType {
- flags |= IsNextOpPtrTypeFlags
- }
- if c.isAnonymous {
- flags |= AnonymousKeyFlags
- }
- if c.isMarshalerContext {
- flags |= MarshalerContextFlags
- }
- return flags
-}
-
-func (c *StructFieldCode) toValueOpcodes(ctx *compileContext) Opcodes {
- if c.isAnonymous {
- anonymCode, ok := c.value.(AnonymousCode)
- if ok {
- return anonymCode.ToAnonymousOpcode(ctx)
- }
- }
- return c.value.ToOpcode(ctx)
-}
-
-func (c *StructFieldCode) ToOpcode(ctx *compileContext, isFirstField, isEndField bool) Opcodes {
- field := &Opcode{
- Idx: opcodeOffset(ctx.ptrIndex),
- Flags: c.flags(),
- Key: c.structKey(ctx),
- Offset: uint32(c.offset),
- Type: c.typ,
- DisplayIdx: ctx.opcodeIndex,
- Indent: ctx.indent,
- DisplayKey: c.key,
- }
- ctx.incIndex()
- valueCodes := c.toValueOpcodes(ctx)
- if isFirstField {
- codes := c.headerOpcodes(ctx, field, valueCodes)
- if isEndField {
- codes = c.addStructEndCode(ctx, codes)
- }
- return codes
- }
- codes := c.fieldOpcodes(ctx, field, valueCodes)
- if isEndField {
- if isEnableStructEndOptimization(c.value) {
- field.Op = field.Op.FieldToEnd()
- } else {
- codes = c.addStructEndCode(ctx, codes)
- }
- }
- return codes
-}
-
-func (c *StructFieldCode) ToAnonymousOpcode(ctx *compileContext, isFirstField, isEndField bool) Opcodes {
- field := &Opcode{
- Idx: opcodeOffset(ctx.ptrIndex),
- Flags: c.flags() | AnonymousHeadFlags,
- Key: c.structKey(ctx),
- Offset: uint32(c.offset),
- Type: c.typ,
- DisplayIdx: ctx.opcodeIndex,
- Indent: ctx.indent,
- DisplayKey: c.key,
- }
- ctx.incIndex()
- valueCodes := c.toValueOpcodes(ctx)
- if isFirstField {
- return c.headerOpcodes(ctx, field, valueCodes)
- }
- return c.fieldOpcodes(ctx, field, valueCodes)
-}
-
-func isEnableStructEndOptimization(value Code) bool {
- switch value.Kind() {
- case CodeKindInt,
- CodeKindUint,
- CodeKindFloat,
- CodeKindString,
- CodeKindBool,
- CodeKindBytes:
- return true
- case CodeKindPtr:
- return isEnableStructEndOptimization(value.(*PtrCode).value)
- default:
- return false
- }
-}
-
-type InterfaceCode struct {
- typ *runtime.Type
- fieldQuery *FieldQuery
- isPtr bool
-}
-
-func (c *InterfaceCode) Kind() CodeKind {
- return CodeKindInterface
-}
-
-func (c *InterfaceCode) ToOpcode(ctx *compileContext) Opcodes {
- var code *Opcode
- switch {
- case c.isPtr:
- code = newOpCode(ctx, c.typ, OpInterfacePtr)
- default:
- code = newOpCode(ctx, c.typ, OpInterface)
- }
- code.FieldQuery = c.fieldQuery
- if c.typ.NumMethod() > 0 {
- code.Flags |= NonEmptyInterfaceFlags
- }
- ctx.incIndex()
- return Opcodes{code}
-}
-
-func (c *InterfaceCode) Filter(query *FieldQuery) Code {
- return &InterfaceCode{
- typ: c.typ,
- fieldQuery: query,
- isPtr: c.isPtr,
- }
-}
-
-type MarshalJSONCode struct {
- typ *runtime.Type
- fieldQuery *FieldQuery
- isAddrForMarshaler bool
- isNilableType bool
- isMarshalerContext bool
-}
-
-func (c *MarshalJSONCode) Kind() CodeKind {
- return CodeKindMarshalJSON
-}
-
-func (c *MarshalJSONCode) ToOpcode(ctx *compileContext) Opcodes {
- code := newOpCode(ctx, c.typ, OpMarshalJSON)
- code.FieldQuery = c.fieldQuery
- if c.isAddrForMarshaler {
- code.Flags |= AddrForMarshalerFlags
- }
- if c.isMarshalerContext {
- code.Flags |= MarshalerContextFlags
- }
- if c.isNilableType {
- code.Flags |= IsNilableTypeFlags
- } else {
- code.Flags &= ^IsNilableTypeFlags
- }
- ctx.incIndex()
- return Opcodes{code}
-}
-
-func (c *MarshalJSONCode) Filter(query *FieldQuery) Code {
- return &MarshalJSONCode{
- typ: c.typ,
- fieldQuery: query,
- isAddrForMarshaler: c.isAddrForMarshaler,
- isNilableType: c.isNilableType,
- isMarshalerContext: c.isMarshalerContext,
- }
-}
-
-type MarshalTextCode struct {
- typ *runtime.Type
- fieldQuery *FieldQuery
- isAddrForMarshaler bool
- isNilableType bool
-}
-
-func (c *MarshalTextCode) Kind() CodeKind {
- return CodeKindMarshalText
-}
-
-func (c *MarshalTextCode) ToOpcode(ctx *compileContext) Opcodes {
- code := newOpCode(ctx, c.typ, OpMarshalText)
- code.FieldQuery = c.fieldQuery
- if c.isAddrForMarshaler {
- code.Flags |= AddrForMarshalerFlags
- }
- if c.isNilableType {
- code.Flags |= IsNilableTypeFlags
- } else {
- code.Flags &= ^IsNilableTypeFlags
- }
- ctx.incIndex()
- return Opcodes{code}
-}
-
-func (c *MarshalTextCode) Filter(query *FieldQuery) Code {
- return &MarshalTextCode{
- typ: c.typ,
- fieldQuery: query,
- isAddrForMarshaler: c.isAddrForMarshaler,
- isNilableType: c.isNilableType,
- }
-}
-
-type PtrCode struct {
- typ *runtime.Type
- value Code
- ptrNum uint8
-}
-
-func (c *PtrCode) Kind() CodeKind {
- return CodeKindPtr
-}
-
-func (c *PtrCode) ToOpcode(ctx *compileContext) Opcodes {
- codes := c.value.ToOpcode(ctx)
- codes.First().Op = convertPtrOp(codes.First())
- codes.First().PtrNum = c.ptrNum
- return codes
-}
-
-func (c *PtrCode) ToAnonymousOpcode(ctx *compileContext) Opcodes {
- var codes Opcodes
- anonymCode, ok := c.value.(AnonymousCode)
- if ok {
- codes = anonymCode.ToAnonymousOpcode(ctx)
- } else {
- codes = c.value.ToOpcode(ctx)
- }
- codes.First().Op = convertPtrOp(codes.First())
- codes.First().PtrNum = c.ptrNum
- return codes
-}
-
-func (c *PtrCode) Filter(query *FieldQuery) Code {
- return &PtrCode{
- typ: c.typ,
- value: c.value.Filter(query),
- ptrNum: c.ptrNum,
- }
-}
-
-func convertPtrOp(code *Opcode) OpType {
- ptrHeadOp := code.Op.HeadToPtrHead()
- if code.Op != ptrHeadOp {
- if code.PtrNum > 0 {
- // ptr field and ptr head
- code.PtrNum--
- }
- return ptrHeadOp
- }
- switch code.Op {
- case OpInt:
- return OpIntPtr
- case OpUint:
- return OpUintPtr
- case OpFloat32:
- return OpFloat32Ptr
- case OpFloat64:
- return OpFloat64Ptr
- case OpString:
- return OpStringPtr
- case OpBool:
- return OpBoolPtr
- case OpBytes:
- return OpBytesPtr
- case OpNumber:
- return OpNumberPtr
- case OpArray:
- return OpArrayPtr
- case OpSlice:
- return OpSlicePtr
- case OpMap:
- return OpMapPtr
- case OpMarshalJSON:
- return OpMarshalJSONPtr
- case OpMarshalText:
- return OpMarshalTextPtr
- case OpInterface:
- return OpInterfacePtr
- case OpRecursive:
- return OpRecursivePtr
- }
- return code.Op
-}
-
-func isEmbeddedStruct(field *StructFieldCode) bool {
- if !field.isAnonymous {
- return false
- }
- t := field.typ
- if t.Kind() == reflect.Ptr {
- t = t.Elem()
- }
- return t.Kind() == reflect.Struct
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/compact.go b/vendor/github.com/goccy/go-json/internal/encoder/compact.go
deleted file mode 100644
index e287a6c03f4..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/compact.go
+++ /dev/null
@@ -1,286 +0,0 @@
-package encoder
-
-import (
- "bytes"
- "fmt"
- "strconv"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
-)
-
-var (
- isWhiteSpace = [256]bool{
- ' ': true,
- '\n': true,
- '\t': true,
- '\r': true,
- }
- isHTMLEscapeChar = [256]bool{
- '<': true,
- '>': true,
- '&': true,
- }
- nul = byte('\000')
-)
-
-func Compact(buf *bytes.Buffer, src []byte, escape bool) error {
- if len(src) == 0 {
- return errors.ErrUnexpectedEndOfJSON("", 0)
- }
- buf.Grow(len(src))
- dst := buf.Bytes()
-
- ctx := TakeRuntimeContext()
- ctxBuf := ctx.Buf[:0]
- ctxBuf = append(append(ctxBuf, src...), nul)
- ctx.Buf = ctxBuf
-
- if err := compactAndWrite(buf, dst, ctxBuf, escape); err != nil {
- ReleaseRuntimeContext(ctx)
- return err
- }
- ReleaseRuntimeContext(ctx)
- return nil
-}
-
-func compactAndWrite(buf *bytes.Buffer, dst []byte, src []byte, escape bool) error {
- dst, err := compact(dst, src, escape)
- if err != nil {
- return err
- }
- if _, err := buf.Write(dst); err != nil {
- return err
- }
- return nil
-}
-
-func compact(dst, src []byte, escape bool) ([]byte, error) {
- buf, cursor, err := compactValue(dst, src, 0, escape)
- if err != nil {
- return nil, err
- }
- if err := validateEndBuf(src, cursor); err != nil {
- return nil, err
- }
- return buf, nil
-}
-
-func validateEndBuf(src []byte, cursor int64) error {
- for {
- switch src[cursor] {
- case ' ', '\t', '\n', '\r':
- cursor++
- continue
- case nul:
- return nil
- }
- return errors.ErrSyntax(
- fmt.Sprintf("invalid character '%c' after top-level value", src[cursor]),
- cursor+1,
- )
- }
-}
-
-func skipWhiteSpace(buf []byte, cursor int64) int64 {
-LOOP:
- if isWhiteSpace[buf[cursor]] {
- cursor++
- goto LOOP
- }
- return cursor
-}
-
-func compactValue(dst, src []byte, cursor int64, escape bool) ([]byte, int64, error) {
- for {
- switch src[cursor] {
- case ' ', '\t', '\n', '\r':
- cursor++
- continue
- case '{':
- return compactObject(dst, src, cursor, escape)
- case '}':
- return nil, 0, errors.ErrSyntax("unexpected character '}'", cursor)
- case '[':
- return compactArray(dst, src, cursor, escape)
- case ']':
- return nil, 0, errors.ErrSyntax("unexpected character ']'", cursor)
- case '"':
- return compactString(dst, src, cursor, escape)
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return compactNumber(dst, src, cursor)
- case 't':
- return compactTrue(dst, src, cursor)
- case 'f':
- return compactFalse(dst, src, cursor)
- case 'n':
- return compactNull(dst, src, cursor)
- default:
- return nil, 0, errors.ErrSyntax(fmt.Sprintf("unexpected character '%c'", src[cursor]), cursor)
- }
- }
-}
-
-func compactObject(dst, src []byte, cursor int64, escape bool) ([]byte, int64, error) {
- if src[cursor] == '{' {
- dst = append(dst, '{')
- } else {
- return nil, 0, errors.ErrExpected("expected { character for object value", cursor)
- }
- cursor = skipWhiteSpace(src, cursor+1)
- if src[cursor] == '}' {
- dst = append(dst, '}')
- return dst, cursor + 1, nil
- }
- var err error
- for {
- cursor = skipWhiteSpace(src, cursor)
- dst, cursor, err = compactString(dst, src, cursor, escape)
- if err != nil {
- return nil, 0, err
- }
- cursor = skipWhiteSpace(src, cursor)
- if src[cursor] != ':' {
- return nil, 0, errors.ErrExpected("colon after object key", cursor)
- }
- dst = append(dst, ':')
- dst, cursor, err = compactValue(dst, src, cursor+1, escape)
- if err != nil {
- return nil, 0, err
- }
- cursor = skipWhiteSpace(src, cursor)
- switch src[cursor] {
- case '}':
- dst = append(dst, '}')
- cursor++
- return dst, cursor, nil
- case ',':
- dst = append(dst, ',')
- default:
- return nil, 0, errors.ErrExpected("comma after object value", cursor)
- }
- cursor++
- }
-}
-
-func compactArray(dst, src []byte, cursor int64, escape bool) ([]byte, int64, error) {
- if src[cursor] == '[' {
- dst = append(dst, '[')
- } else {
- return nil, 0, errors.ErrExpected("expected [ character for array value", cursor)
- }
- cursor = skipWhiteSpace(src, cursor+1)
- if src[cursor] == ']' {
- dst = append(dst, ']')
- return dst, cursor + 1, nil
- }
- var err error
- for {
- dst, cursor, err = compactValue(dst, src, cursor, escape)
- if err != nil {
- return nil, 0, err
- }
- cursor = skipWhiteSpace(src, cursor)
- switch src[cursor] {
- case ']':
- dst = append(dst, ']')
- cursor++
- return dst, cursor, nil
- case ',':
- dst = append(dst, ',')
- default:
- return nil, 0, errors.ErrExpected("comma after array value", cursor)
- }
- cursor++
- }
-}
-
-func compactString(dst, src []byte, cursor int64, escape bool) ([]byte, int64, error) {
- if src[cursor] != '"' {
- return nil, 0, errors.ErrInvalidCharacter(src[cursor], "string", cursor)
- }
- start := cursor
- for {
- cursor++
- c := src[cursor]
- if escape {
- if isHTMLEscapeChar[c] {
- dst = append(dst, src[start:cursor]...)
- dst = append(dst, `\u00`...)
- dst = append(dst, hex[c>>4], hex[c&0xF])
- start = cursor + 1
- } else if c == 0xE2 && cursor+2 < int64(len(src)) && src[cursor+1] == 0x80 && src[cursor+2]&^1 == 0xA8 {
- dst = append(dst, src[start:cursor]...)
- dst = append(dst, `\u202`...)
- dst = append(dst, hex[src[cursor+2]&0xF])
- start = cursor + 3
- cursor += 2
- }
- }
- switch c {
- case '\\':
- cursor++
- if src[cursor] == nul {
- return nil, 0, errors.ErrUnexpectedEndOfJSON("string", int64(len(src)))
- }
- case '"':
- cursor++
- return append(dst, src[start:cursor]...), cursor, nil
- case nul:
- return nil, 0, errors.ErrUnexpectedEndOfJSON("string", int64(len(src)))
- }
- }
-}
-
-func compactNumber(dst, src []byte, cursor int64) ([]byte, int64, error) {
- start := cursor
- for {
- cursor++
- if floatTable[src[cursor]] {
- continue
- }
- break
- }
- num := src[start:cursor]
- if _, err := strconv.ParseFloat(*(*string)(unsafe.Pointer(&num)), 64); err != nil {
- return nil, 0, err
- }
- dst = append(dst, num...)
- return dst, cursor, nil
-}
-
-func compactTrue(dst, src []byte, cursor int64) ([]byte, int64, error) {
- if cursor+3 >= int64(len(src)) {
- return nil, 0, errors.ErrUnexpectedEndOfJSON("true", cursor)
- }
- if !bytes.Equal(src[cursor:cursor+4], []byte(`true`)) {
- return nil, 0, errors.ErrInvalidCharacter(src[cursor], "true", cursor)
- }
- dst = append(dst, "true"...)
- cursor += 4
- return dst, cursor, nil
-}
-
-func compactFalse(dst, src []byte, cursor int64) ([]byte, int64, error) {
- if cursor+4 >= int64(len(src)) {
- return nil, 0, errors.ErrUnexpectedEndOfJSON("false", cursor)
- }
- if !bytes.Equal(src[cursor:cursor+5], []byte(`false`)) {
- return nil, 0, errors.ErrInvalidCharacter(src[cursor], "false", cursor)
- }
- dst = append(dst, "false"...)
- cursor += 5
- return dst, cursor, nil
-}
-
-func compactNull(dst, src []byte, cursor int64) ([]byte, int64, error) {
- if cursor+3 >= int64(len(src)) {
- return nil, 0, errors.ErrUnexpectedEndOfJSON("null", cursor)
- }
- if !bytes.Equal(src[cursor:cursor+4], []byte(`null`)) {
- return nil, 0, errors.ErrInvalidCharacter(src[cursor], "null", cursor)
- }
- dst = append(dst, "null"...)
- cursor += 4
- return dst, cursor, nil
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/compiler.go b/vendor/github.com/goccy/go-json/internal/encoder/compiler.go
deleted file mode 100644
index b107636890a..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/compiler.go
+++ /dev/null
@@ -1,939 +0,0 @@
-package encoder
-
-import (
- "context"
- "encoding"
- "encoding/json"
- "reflect"
- "sync"
- "sync/atomic"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type marshalerContext interface {
- MarshalJSON(context.Context) ([]byte, error)
-}
-
-var (
- marshalJSONType = reflect.TypeOf((*json.Marshaler)(nil)).Elem()
- marshalJSONContextType = reflect.TypeOf((*marshalerContext)(nil)).Elem()
- marshalTextType = reflect.TypeOf((*encoding.TextMarshaler)(nil)).Elem()
- jsonNumberType = reflect.TypeOf(json.Number(""))
- cachedOpcodeSets []*OpcodeSet
- cachedOpcodeMap unsafe.Pointer // map[uintptr]*OpcodeSet
- typeAddr *runtime.TypeAddr
- initEncoderOnce sync.Once
-)
-
-func initEncoder() {
- initEncoderOnce.Do(func() {
- typeAddr = runtime.AnalyzeTypeAddr()
- if typeAddr == nil {
- typeAddr = &runtime.TypeAddr{}
- }
- cachedOpcodeSets = make([]*OpcodeSet, typeAddr.AddrRange>>typeAddr.AddrShift+1)
- })
-}
-
-func loadOpcodeMap() map[uintptr]*OpcodeSet {
- p := atomic.LoadPointer(&cachedOpcodeMap)
- return *(*map[uintptr]*OpcodeSet)(unsafe.Pointer(&p))
-}
-
-func storeOpcodeSet(typ uintptr, set *OpcodeSet, m map[uintptr]*OpcodeSet) {
- newOpcodeMap := make(map[uintptr]*OpcodeSet, len(m)+1)
- newOpcodeMap[typ] = set
-
- for k, v := range m {
- newOpcodeMap[k] = v
- }
-
- atomic.StorePointer(&cachedOpcodeMap, *(*unsafe.Pointer)(unsafe.Pointer(&newOpcodeMap)))
-}
-
-func compileToGetCodeSetSlowPath(typeptr uintptr) (*OpcodeSet, error) {
- opcodeMap := loadOpcodeMap()
- if codeSet, exists := opcodeMap[typeptr]; exists {
- return codeSet, nil
- }
- codeSet, err := newCompiler().compile(typeptr)
- if err != nil {
- return nil, err
- }
- storeOpcodeSet(typeptr, codeSet, opcodeMap)
- return codeSet, nil
-}
-
-func getFilteredCodeSetIfNeeded(ctx *RuntimeContext, codeSet *OpcodeSet) (*OpcodeSet, error) {
- if (ctx.Option.Flag & ContextOption) == 0 {
- return codeSet, nil
- }
- query := FieldQueryFromContext(ctx.Option.Context)
- if query == nil {
- return codeSet, nil
- }
- ctx.Option.Flag |= FieldQueryOption
- cacheCodeSet := codeSet.getQueryCache(query.Hash())
- if cacheCodeSet != nil {
- return cacheCodeSet, nil
- }
- queryCodeSet, err := newCompiler().codeToOpcodeSet(codeSet.Type, codeSet.Code.Filter(query))
- if err != nil {
- return nil, err
- }
- codeSet.setQueryCache(query.Hash(), queryCodeSet)
- return queryCodeSet, nil
-}
-
-type Compiler struct {
- structTypeToCode map[uintptr]*StructCode
-}
-
-func newCompiler() *Compiler {
- return &Compiler{
- structTypeToCode: map[uintptr]*StructCode{},
- }
-}
-
-func (c *Compiler) compile(typeptr uintptr) (*OpcodeSet, error) {
- // noescape trick for header.typ ( reflect.*rtype )
- typ := *(**runtime.Type)(unsafe.Pointer(&typeptr))
- code, err := c.typeToCode(typ)
- if err != nil {
- return nil, err
- }
- return c.codeToOpcodeSet(typ, code)
-}
-
-func (c *Compiler) codeToOpcodeSet(typ *runtime.Type, code Code) (*OpcodeSet, error) {
- noescapeKeyCode := c.codeToOpcode(&compileContext{
- structTypeToCodes: map[uintptr]Opcodes{},
- recursiveCodes: &Opcodes{},
- }, typ, code)
- if err := noescapeKeyCode.Validate(); err != nil {
- return nil, err
- }
- escapeKeyCode := c.codeToOpcode(&compileContext{
- structTypeToCodes: map[uintptr]Opcodes{},
- recursiveCodes: &Opcodes{},
- escapeKey: true,
- }, typ, code)
- noescapeKeyCode = copyOpcode(noescapeKeyCode)
- escapeKeyCode = copyOpcode(escapeKeyCode)
- setTotalLengthToInterfaceOp(noescapeKeyCode)
- setTotalLengthToInterfaceOp(escapeKeyCode)
- interfaceNoescapeKeyCode := copyToInterfaceOpcode(noescapeKeyCode)
- interfaceEscapeKeyCode := copyToInterfaceOpcode(escapeKeyCode)
- codeLength := noescapeKeyCode.TotalLength()
- return &OpcodeSet{
- Type: typ,
- NoescapeKeyCode: noescapeKeyCode,
- EscapeKeyCode: escapeKeyCode,
- InterfaceNoescapeKeyCode: interfaceNoescapeKeyCode,
- InterfaceEscapeKeyCode: interfaceEscapeKeyCode,
- CodeLength: codeLength,
- EndCode: ToEndCode(interfaceNoescapeKeyCode),
- Code: code,
- QueryCache: map[string]*OpcodeSet{},
- }, nil
-}
-
-func (c *Compiler) typeToCode(typ *runtime.Type) (Code, error) {
- switch {
- case c.implementsMarshalJSON(typ):
- return c.marshalJSONCode(typ)
- case c.implementsMarshalText(typ):
- return c.marshalTextCode(typ)
- }
-
- isPtr := false
- orgType := typ
- if typ.Kind() == reflect.Ptr {
- typ = typ.Elem()
- isPtr = true
- }
- switch {
- case c.implementsMarshalJSON(typ):
- return c.marshalJSONCode(orgType)
- case c.implementsMarshalText(typ):
- return c.marshalTextCode(orgType)
- }
- switch typ.Kind() {
- case reflect.Slice:
- elem := typ.Elem()
- if elem.Kind() == reflect.Uint8 {
- p := runtime.PtrTo(elem)
- if !c.implementsMarshalJSONType(p) && !p.Implements(marshalTextType) {
- return c.bytesCode(typ, isPtr)
- }
- }
- return c.sliceCode(typ)
- case reflect.Map:
- if isPtr {
- return c.ptrCode(runtime.PtrTo(typ))
- }
- return c.mapCode(typ)
- case reflect.Struct:
- return c.structCode(typ, isPtr)
- case reflect.Int:
- return c.intCode(typ, isPtr)
- case reflect.Int8:
- return c.int8Code(typ, isPtr)
- case reflect.Int16:
- return c.int16Code(typ, isPtr)
- case reflect.Int32:
- return c.int32Code(typ, isPtr)
- case reflect.Int64:
- return c.int64Code(typ, isPtr)
- case reflect.Uint, reflect.Uintptr:
- return c.uintCode(typ, isPtr)
- case reflect.Uint8:
- return c.uint8Code(typ, isPtr)
- case reflect.Uint16:
- return c.uint16Code(typ, isPtr)
- case reflect.Uint32:
- return c.uint32Code(typ, isPtr)
- case reflect.Uint64:
- return c.uint64Code(typ, isPtr)
- case reflect.Float32:
- return c.float32Code(typ, isPtr)
- case reflect.Float64:
- return c.float64Code(typ, isPtr)
- case reflect.String:
- return c.stringCode(typ, isPtr)
- case reflect.Bool:
- return c.boolCode(typ, isPtr)
- case reflect.Interface:
- return c.interfaceCode(typ, isPtr)
- default:
- if isPtr && typ.Implements(marshalTextType) {
- typ = orgType
- }
- return c.typeToCodeWithPtr(typ, isPtr)
- }
-}
-
-func (c *Compiler) typeToCodeWithPtr(typ *runtime.Type, isPtr bool) (Code, error) {
- switch {
- case c.implementsMarshalJSON(typ):
- return c.marshalJSONCode(typ)
- case c.implementsMarshalText(typ):
- return c.marshalTextCode(typ)
- }
- switch typ.Kind() {
- case reflect.Ptr:
- return c.ptrCode(typ)
- case reflect.Slice:
- elem := typ.Elem()
- if elem.Kind() == reflect.Uint8 {
- p := runtime.PtrTo(elem)
- if !c.implementsMarshalJSONType(p) && !p.Implements(marshalTextType) {
- return c.bytesCode(typ, false)
- }
- }
- return c.sliceCode(typ)
- case reflect.Array:
- return c.arrayCode(typ)
- case reflect.Map:
- return c.mapCode(typ)
- case reflect.Struct:
- return c.structCode(typ, isPtr)
- case reflect.Interface:
- return c.interfaceCode(typ, false)
- case reflect.Int:
- return c.intCode(typ, false)
- case reflect.Int8:
- return c.int8Code(typ, false)
- case reflect.Int16:
- return c.int16Code(typ, false)
- case reflect.Int32:
- return c.int32Code(typ, false)
- case reflect.Int64:
- return c.int64Code(typ, false)
- case reflect.Uint:
- return c.uintCode(typ, false)
- case reflect.Uint8:
- return c.uint8Code(typ, false)
- case reflect.Uint16:
- return c.uint16Code(typ, false)
- case reflect.Uint32:
- return c.uint32Code(typ, false)
- case reflect.Uint64:
- return c.uint64Code(typ, false)
- case reflect.Uintptr:
- return c.uintCode(typ, false)
- case reflect.Float32:
- return c.float32Code(typ, false)
- case reflect.Float64:
- return c.float64Code(typ, false)
- case reflect.String:
- return c.stringCode(typ, false)
- case reflect.Bool:
- return c.boolCode(typ, false)
- }
- return nil, &errors.UnsupportedTypeError{Type: runtime.RType2Type(typ)}
-}
-
-const intSize = 32 << (^uint(0) >> 63)
-
-//nolint:unparam
-func (c *Compiler) intCode(typ *runtime.Type, isPtr bool) (*IntCode, error) {
- return &IntCode{typ: typ, bitSize: intSize, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) int8Code(typ *runtime.Type, isPtr bool) (*IntCode, error) {
- return &IntCode{typ: typ, bitSize: 8, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) int16Code(typ *runtime.Type, isPtr bool) (*IntCode, error) {
- return &IntCode{typ: typ, bitSize: 16, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) int32Code(typ *runtime.Type, isPtr bool) (*IntCode, error) {
- return &IntCode{typ: typ, bitSize: 32, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) int64Code(typ *runtime.Type, isPtr bool) (*IntCode, error) {
- return &IntCode{typ: typ, bitSize: 64, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) uintCode(typ *runtime.Type, isPtr bool) (*UintCode, error) {
- return &UintCode{typ: typ, bitSize: intSize, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) uint8Code(typ *runtime.Type, isPtr bool) (*UintCode, error) {
- return &UintCode{typ: typ, bitSize: 8, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) uint16Code(typ *runtime.Type, isPtr bool) (*UintCode, error) {
- return &UintCode{typ: typ, bitSize: 16, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) uint32Code(typ *runtime.Type, isPtr bool) (*UintCode, error) {
- return &UintCode{typ: typ, bitSize: 32, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) uint64Code(typ *runtime.Type, isPtr bool) (*UintCode, error) {
- return &UintCode{typ: typ, bitSize: 64, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) float32Code(typ *runtime.Type, isPtr bool) (*FloatCode, error) {
- return &FloatCode{typ: typ, bitSize: 32, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) float64Code(typ *runtime.Type, isPtr bool) (*FloatCode, error) {
- return &FloatCode{typ: typ, bitSize: 64, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) stringCode(typ *runtime.Type, isPtr bool) (*StringCode, error) {
- return &StringCode{typ: typ, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) boolCode(typ *runtime.Type, isPtr bool) (*BoolCode, error) {
- return &BoolCode{typ: typ, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) intStringCode(typ *runtime.Type) (*IntCode, error) {
- return &IntCode{typ: typ, bitSize: intSize, isString: true}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) int8StringCode(typ *runtime.Type) (*IntCode, error) {
- return &IntCode{typ: typ, bitSize: 8, isString: true}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) int16StringCode(typ *runtime.Type) (*IntCode, error) {
- return &IntCode{typ: typ, bitSize: 16, isString: true}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) int32StringCode(typ *runtime.Type) (*IntCode, error) {
- return &IntCode{typ: typ, bitSize: 32, isString: true}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) int64StringCode(typ *runtime.Type) (*IntCode, error) {
- return &IntCode{typ: typ, bitSize: 64, isString: true}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) uintStringCode(typ *runtime.Type) (*UintCode, error) {
- return &UintCode{typ: typ, bitSize: intSize, isString: true}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) uint8StringCode(typ *runtime.Type) (*UintCode, error) {
- return &UintCode{typ: typ, bitSize: 8, isString: true}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) uint16StringCode(typ *runtime.Type) (*UintCode, error) {
- return &UintCode{typ: typ, bitSize: 16, isString: true}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) uint32StringCode(typ *runtime.Type) (*UintCode, error) {
- return &UintCode{typ: typ, bitSize: 32, isString: true}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) uint64StringCode(typ *runtime.Type) (*UintCode, error) {
- return &UintCode{typ: typ, bitSize: 64, isString: true}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) bytesCode(typ *runtime.Type, isPtr bool) (*BytesCode, error) {
- return &BytesCode{typ: typ, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) interfaceCode(typ *runtime.Type, isPtr bool) (*InterfaceCode, error) {
- return &InterfaceCode{typ: typ, isPtr: isPtr}, nil
-}
-
-//nolint:unparam
-func (c *Compiler) marshalJSONCode(typ *runtime.Type) (*MarshalJSONCode, error) {
- return &MarshalJSONCode{
- typ: typ,
- isAddrForMarshaler: c.isPtrMarshalJSONType(typ),
- isNilableType: c.isNilableType(typ),
- isMarshalerContext: typ.Implements(marshalJSONContextType) || runtime.PtrTo(typ).Implements(marshalJSONContextType),
- }, nil
-}
-
-//nolint:unparam
-func (c *Compiler) marshalTextCode(typ *runtime.Type) (*MarshalTextCode, error) {
- return &MarshalTextCode{
- typ: typ,
- isAddrForMarshaler: c.isPtrMarshalTextType(typ),
- isNilableType: c.isNilableType(typ),
- }, nil
-}
-
-func (c *Compiler) ptrCode(typ *runtime.Type) (*PtrCode, error) {
- code, err := c.typeToCodeWithPtr(typ.Elem(), true)
- if err != nil {
- return nil, err
- }
- ptr, ok := code.(*PtrCode)
- if ok {
- return &PtrCode{typ: typ, value: ptr.value, ptrNum: ptr.ptrNum + 1}, nil
- }
- return &PtrCode{typ: typ, value: code, ptrNum: 1}, nil
-}
-
-func (c *Compiler) sliceCode(typ *runtime.Type) (*SliceCode, error) {
- elem := typ.Elem()
- code, err := c.listElemCode(elem)
- if err != nil {
- return nil, err
- }
- if code.Kind() == CodeKindStruct {
- structCode := code.(*StructCode)
- structCode.enableIndirect()
- }
- return &SliceCode{typ: typ, value: code}, nil
-}
-
-func (c *Compiler) arrayCode(typ *runtime.Type) (*ArrayCode, error) {
- elem := typ.Elem()
- code, err := c.listElemCode(elem)
- if err != nil {
- return nil, err
- }
- if code.Kind() == CodeKindStruct {
- structCode := code.(*StructCode)
- structCode.enableIndirect()
- }
- return &ArrayCode{typ: typ, value: code}, nil
-}
-
-func (c *Compiler) mapCode(typ *runtime.Type) (*MapCode, error) {
- keyCode, err := c.mapKeyCode(typ.Key())
- if err != nil {
- return nil, err
- }
- valueCode, err := c.mapValueCode(typ.Elem())
- if err != nil {
- return nil, err
- }
- if valueCode.Kind() == CodeKindStruct {
- structCode := valueCode.(*StructCode)
- structCode.enableIndirect()
- }
- return &MapCode{typ: typ, key: keyCode, value: valueCode}, nil
-}
-
-func (c *Compiler) listElemCode(typ *runtime.Type) (Code, error) {
- switch {
- case c.implementsMarshalJSONType(typ) || c.implementsMarshalJSONType(runtime.PtrTo(typ)):
- return c.marshalJSONCode(typ)
- case !typ.Implements(marshalTextType) && runtime.PtrTo(typ).Implements(marshalTextType):
- return c.marshalTextCode(typ)
- case typ.Kind() == reflect.Map:
- return c.ptrCode(runtime.PtrTo(typ))
- default:
- // isPtr was originally used to indicate whether the type of top level is pointer.
- // However, since the slice/array element is a specification that can get the pointer address, explicitly set isPtr to true.
- // See here for related issues: https://github.com/goccy/go-json/issues/370
- code, err := c.typeToCodeWithPtr(typ, true)
- if err != nil {
- return nil, err
- }
- ptr, ok := code.(*PtrCode)
- if ok {
- if ptr.value.Kind() == CodeKindMap {
- ptr.ptrNum++
- }
- }
- return code, nil
- }
-}
-
-func (c *Compiler) mapKeyCode(typ *runtime.Type) (Code, error) {
- switch {
- case c.implementsMarshalText(typ):
- return c.marshalTextCode(typ)
- }
- switch typ.Kind() {
- case reflect.Ptr:
- return c.ptrCode(typ)
- case reflect.String:
- return c.stringCode(typ, false)
- case reflect.Int:
- return c.intStringCode(typ)
- case reflect.Int8:
- return c.int8StringCode(typ)
- case reflect.Int16:
- return c.int16StringCode(typ)
- case reflect.Int32:
- return c.int32StringCode(typ)
- case reflect.Int64:
- return c.int64StringCode(typ)
- case reflect.Uint:
- return c.uintStringCode(typ)
- case reflect.Uint8:
- return c.uint8StringCode(typ)
- case reflect.Uint16:
- return c.uint16StringCode(typ)
- case reflect.Uint32:
- return c.uint32StringCode(typ)
- case reflect.Uint64:
- return c.uint64StringCode(typ)
- case reflect.Uintptr:
- return c.uintStringCode(typ)
- }
- return nil, &errors.UnsupportedTypeError{Type: runtime.RType2Type(typ)}
-}
-
-func (c *Compiler) mapValueCode(typ *runtime.Type) (Code, error) {
- switch typ.Kind() {
- case reflect.Map:
- return c.ptrCode(runtime.PtrTo(typ))
- default:
- code, err := c.typeToCodeWithPtr(typ, false)
- if err != nil {
- return nil, err
- }
- ptr, ok := code.(*PtrCode)
- if ok {
- if ptr.value.Kind() == CodeKindMap {
- ptr.ptrNum++
- }
- }
- return code, nil
- }
-}
-
-func (c *Compiler) structCode(typ *runtime.Type, isPtr bool) (*StructCode, error) {
- typeptr := uintptr(unsafe.Pointer(typ))
- if code, exists := c.structTypeToCode[typeptr]; exists {
- derefCode := *code
- derefCode.isRecursive = true
- return &derefCode, nil
- }
- indirect := runtime.IfaceIndir(typ)
- code := &StructCode{typ: typ, isPtr: isPtr, isIndirect: indirect}
- c.structTypeToCode[typeptr] = code
-
- fieldNum := typ.NumField()
- tags := c.typeToStructTags(typ)
- fields := []*StructFieldCode{}
- for i, tag := range tags {
- isOnlyOneFirstField := i == 0 && fieldNum == 1
- field, err := c.structFieldCode(code, tag, isPtr, isOnlyOneFirstField)
- if err != nil {
- return nil, err
- }
- if field.isAnonymous {
- structCode := field.getAnonymousStruct()
- if structCode != nil {
- structCode.removeFieldsByTags(tags)
- if c.isAssignableIndirect(field, isPtr) {
- if indirect {
- structCode.isIndirect = true
- } else {
- structCode.isIndirect = false
- }
- }
- }
- } else {
- structCode := field.getStruct()
- if structCode != nil {
- if indirect {
- // if parent is indirect type, set child indirect property to true
- structCode.isIndirect = true
- } else {
- // if parent is not indirect type, set child indirect property to false.
- // but if parent's indirect is false and isPtr is true, then indirect must be true.
- // Do this only if indirectConversion is enabled at the end of compileStruct.
- structCode.isIndirect = false
- }
- }
- }
- fields = append(fields, field)
- }
- fieldMap := c.getFieldMap(fields)
- duplicatedFieldMap := c.getDuplicatedFieldMap(fieldMap)
- code.fields = c.filteredDuplicatedFields(fields, duplicatedFieldMap)
- if !code.disableIndirectConversion && !indirect && isPtr {
- code.enableIndirect()
- }
- delete(c.structTypeToCode, typeptr)
- return code, nil
-}
-
-func toElemType(t *runtime.Type) *runtime.Type {
- for t.Kind() == reflect.Ptr {
- t = t.Elem()
- }
- return t
-}
-
-func (c *Compiler) structFieldCode(structCode *StructCode, tag *runtime.StructTag, isPtr, isOnlyOneFirstField bool) (*StructFieldCode, error) {
- field := tag.Field
- fieldType := runtime.Type2RType(field.Type)
- isIndirectSpecialCase := isPtr && isOnlyOneFirstField
- fieldCode := &StructFieldCode{
- typ: fieldType,
- key: tag.Key,
- tag: tag,
- offset: field.Offset,
- isAnonymous: field.Anonymous && !tag.IsTaggedKey && toElemType(fieldType).Kind() == reflect.Struct,
- isTaggedKey: tag.IsTaggedKey,
- isNilableType: c.isNilableType(fieldType),
- isNilCheck: true,
- }
- switch {
- case c.isMovePointerPositionFromHeadToFirstMarshalJSONFieldCase(fieldType, isIndirectSpecialCase):
- code, err := c.marshalJSONCode(fieldType)
- if err != nil {
- return nil, err
- }
- fieldCode.value = code
- fieldCode.isAddrForMarshaler = true
- fieldCode.isNilCheck = false
- structCode.isIndirect = false
- structCode.disableIndirectConversion = true
- case c.isMovePointerPositionFromHeadToFirstMarshalTextFieldCase(fieldType, isIndirectSpecialCase):
- code, err := c.marshalTextCode(fieldType)
- if err != nil {
- return nil, err
- }
- fieldCode.value = code
- fieldCode.isAddrForMarshaler = true
- fieldCode.isNilCheck = false
- structCode.isIndirect = false
- structCode.disableIndirectConversion = true
- case isPtr && c.isPtrMarshalJSONType(fieldType):
- // *struct{ field T }
- // func (*T) MarshalJSON() ([]byte, error)
- code, err := c.marshalJSONCode(fieldType)
- if err != nil {
- return nil, err
- }
- fieldCode.value = code
- fieldCode.isAddrForMarshaler = true
- fieldCode.isNilCheck = false
- case isPtr && c.isPtrMarshalTextType(fieldType):
- // *struct{ field T }
- // func (*T) MarshalText() ([]byte, error)
- code, err := c.marshalTextCode(fieldType)
- if err != nil {
- return nil, err
- }
- fieldCode.value = code
- fieldCode.isAddrForMarshaler = true
- fieldCode.isNilCheck = false
- default:
- code, err := c.typeToCodeWithPtr(fieldType, isPtr)
- if err != nil {
- return nil, err
- }
- switch code.Kind() {
- case CodeKindPtr, CodeKindInterface:
- fieldCode.isNextOpPtrType = true
- }
- fieldCode.value = code
- }
- return fieldCode, nil
-}
-
-func (c *Compiler) isAssignableIndirect(fieldCode *StructFieldCode, isPtr bool) bool {
- if isPtr {
- return false
- }
- codeType := fieldCode.value.Kind()
- if codeType == CodeKindMarshalJSON {
- return false
- }
- if codeType == CodeKindMarshalText {
- return false
- }
- return true
-}
-
-func (c *Compiler) getFieldMap(fields []*StructFieldCode) map[string][]*StructFieldCode {
- fieldMap := map[string][]*StructFieldCode{}
- for _, field := range fields {
- if field.isAnonymous {
- for k, v := range c.getAnonymousFieldMap(field) {
- fieldMap[k] = append(fieldMap[k], v...)
- }
- continue
- }
- fieldMap[field.key] = append(fieldMap[field.key], field)
- }
- return fieldMap
-}
-
-func (c *Compiler) getAnonymousFieldMap(field *StructFieldCode) map[string][]*StructFieldCode {
- fieldMap := map[string][]*StructFieldCode{}
- structCode := field.getAnonymousStruct()
- if structCode == nil || structCode.isRecursive {
- fieldMap[field.key] = append(fieldMap[field.key], field)
- return fieldMap
- }
- for k, v := range c.getFieldMapFromAnonymousParent(structCode.fields) {
- fieldMap[k] = append(fieldMap[k], v...)
- }
- return fieldMap
-}
-
-func (c *Compiler) getFieldMapFromAnonymousParent(fields []*StructFieldCode) map[string][]*StructFieldCode {
- fieldMap := map[string][]*StructFieldCode{}
- for _, field := range fields {
- if field.isAnonymous {
- for k, v := range c.getAnonymousFieldMap(field) {
- // Do not handle tagged key when embedding more than once
- for _, vv := range v {
- vv.isTaggedKey = false
- }
- fieldMap[k] = append(fieldMap[k], v...)
- }
- continue
- }
- fieldMap[field.key] = append(fieldMap[field.key], field)
- }
- return fieldMap
-}
-
-func (c *Compiler) getDuplicatedFieldMap(fieldMap map[string][]*StructFieldCode) map[*StructFieldCode]struct{} {
- duplicatedFieldMap := map[*StructFieldCode]struct{}{}
- for _, fields := range fieldMap {
- if len(fields) == 1 {
- continue
- }
- if c.isTaggedKeyOnly(fields) {
- for _, field := range fields {
- if field.isTaggedKey {
- continue
- }
- duplicatedFieldMap[field] = struct{}{}
- }
- } else {
- for _, field := range fields {
- duplicatedFieldMap[field] = struct{}{}
- }
- }
- }
- return duplicatedFieldMap
-}
-
-func (c *Compiler) filteredDuplicatedFields(fields []*StructFieldCode, duplicatedFieldMap map[*StructFieldCode]struct{}) []*StructFieldCode {
- filteredFields := make([]*StructFieldCode, 0, len(fields))
- for _, field := range fields {
- if field.isAnonymous {
- structCode := field.getAnonymousStruct()
- if structCode != nil && !structCode.isRecursive {
- structCode.fields = c.filteredDuplicatedFields(structCode.fields, duplicatedFieldMap)
- if len(structCode.fields) > 0 {
- filteredFields = append(filteredFields, field)
- }
- continue
- }
- }
- if _, exists := duplicatedFieldMap[field]; exists {
- continue
- }
- filteredFields = append(filteredFields, field)
- }
- return filteredFields
-}
-
-func (c *Compiler) isTaggedKeyOnly(fields []*StructFieldCode) bool {
- var taggedKeyFieldCount int
- for _, field := range fields {
- if field.isTaggedKey {
- taggedKeyFieldCount++
- }
- }
- return taggedKeyFieldCount == 1
-}
-
-func (c *Compiler) typeToStructTags(typ *runtime.Type) runtime.StructTags {
- tags := runtime.StructTags{}
- fieldNum := typ.NumField()
- for i := 0; i < fieldNum; i++ {
- field := typ.Field(i)
- if runtime.IsIgnoredStructField(field) {
- continue
- }
- tags = append(tags, runtime.StructTagFromField(field))
- }
- return tags
-}
-
-// *struct{ field T } => struct { field *T }
-// func (*T) MarshalJSON() ([]byte, error)
-func (c *Compiler) isMovePointerPositionFromHeadToFirstMarshalJSONFieldCase(typ *runtime.Type, isIndirectSpecialCase bool) bool {
- return isIndirectSpecialCase && !c.isNilableType(typ) && c.isPtrMarshalJSONType(typ)
-}
-
-// *struct{ field T } => struct { field *T }
-// func (*T) MarshalText() ([]byte, error)
-func (c *Compiler) isMovePointerPositionFromHeadToFirstMarshalTextFieldCase(typ *runtime.Type, isIndirectSpecialCase bool) bool {
- return isIndirectSpecialCase && !c.isNilableType(typ) && c.isPtrMarshalTextType(typ)
-}
-
-func (c *Compiler) implementsMarshalJSON(typ *runtime.Type) bool {
- if !c.implementsMarshalJSONType(typ) {
- return false
- }
- if typ.Kind() != reflect.Ptr {
- return true
- }
- // type kind is reflect.Ptr
- if !c.implementsMarshalJSONType(typ.Elem()) {
- return true
- }
- // needs to dereference
- return false
-}
-
-func (c *Compiler) implementsMarshalText(typ *runtime.Type) bool {
- if !typ.Implements(marshalTextType) {
- return false
- }
- if typ.Kind() != reflect.Ptr {
- return true
- }
- // type kind is reflect.Ptr
- if !typ.Elem().Implements(marshalTextType) {
- return true
- }
- // needs to dereference
- return false
-}
-
-func (c *Compiler) isNilableType(typ *runtime.Type) bool {
- if !runtime.IfaceIndir(typ) {
- return true
- }
- switch typ.Kind() {
- case reflect.Ptr:
- return true
- case reflect.Map:
- return true
- case reflect.Func:
- return true
- default:
- return false
- }
-}
-
-func (c *Compiler) implementsMarshalJSONType(typ *runtime.Type) bool {
- return typ.Implements(marshalJSONType) || typ.Implements(marshalJSONContextType)
-}
-
-func (c *Compiler) isPtrMarshalJSONType(typ *runtime.Type) bool {
- return !c.implementsMarshalJSONType(typ) && c.implementsMarshalJSONType(runtime.PtrTo(typ))
-}
-
-func (c *Compiler) isPtrMarshalTextType(typ *runtime.Type) bool {
- return !typ.Implements(marshalTextType) && runtime.PtrTo(typ).Implements(marshalTextType)
-}
-
-func (c *Compiler) codeToOpcode(ctx *compileContext, typ *runtime.Type, code Code) *Opcode {
- codes := code.ToOpcode(ctx)
- codes.Last().Next = newEndOp(ctx, typ)
- c.linkRecursiveCode(ctx)
- return codes.First()
-}
-
-func (c *Compiler) linkRecursiveCode(ctx *compileContext) {
- recursiveCodes := map[uintptr]*CompiledCode{}
- for _, recursive := range *ctx.recursiveCodes {
- typeptr := uintptr(unsafe.Pointer(recursive.Type))
- codes := ctx.structTypeToCodes[typeptr]
- if recursiveCode, ok := recursiveCodes[typeptr]; ok {
- *recursive.Jmp = *recursiveCode
- continue
- }
-
- code := copyOpcode(codes.First())
- code.Op = code.Op.PtrHeadToHead()
- lastCode := newEndOp(&compileContext{}, recursive.Type)
- lastCode.Op = OpRecursiveEnd
-
- // OpRecursiveEnd must set before call TotalLength
- code.End.Next = lastCode
-
- totalLength := code.TotalLength()
-
- // Idx, ElemIdx, Length must set after call TotalLength
- lastCode.Idx = uint32((totalLength + 1) * uintptrSize)
- lastCode.ElemIdx = lastCode.Idx + uintptrSize
- lastCode.Length = lastCode.Idx + 2*uintptrSize
-
- // extend length to alloc slot for elemIdx + length
- curTotalLength := uintptr(recursive.TotalLength()) + 3
- nextTotalLength := uintptr(totalLength) + 3
-
- compiled := recursive.Jmp
- compiled.Code = code
- compiled.CurLen = curTotalLength
- compiled.NextLen = nextTotalLength
- compiled.Linked = true
-
- recursiveCodes[typeptr] = compiled
- }
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/compiler_norace.go b/vendor/github.com/goccy/go-json/internal/encoder/compiler_norace.go
deleted file mode 100644
index b6f45a49b0e..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/compiler_norace.go
+++ /dev/null
@@ -1,33 +0,0 @@
-//go:build !race
-// +build !race
-
-package encoder
-
-func CompileToGetCodeSet(ctx *RuntimeContext, typeptr uintptr) (*OpcodeSet, error) {
- initEncoder()
- if typeptr > typeAddr.MaxTypeAddr || typeptr < typeAddr.BaseTypeAddr {
- codeSet, err := compileToGetCodeSetSlowPath(typeptr)
- if err != nil {
- return nil, err
- }
- return getFilteredCodeSetIfNeeded(ctx, codeSet)
- }
- index := (typeptr - typeAddr.BaseTypeAddr) >> typeAddr.AddrShift
- if codeSet := cachedOpcodeSets[index]; codeSet != nil {
- filtered, err := getFilteredCodeSetIfNeeded(ctx, codeSet)
- if err != nil {
- return nil, err
- }
- return filtered, nil
- }
- codeSet, err := newCompiler().compile(typeptr)
- if err != nil {
- return nil, err
- }
- filtered, err := getFilteredCodeSetIfNeeded(ctx, codeSet)
- if err != nil {
- return nil, err
- }
- cachedOpcodeSets[index] = codeSet
- return filtered, nil
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/compiler_race.go b/vendor/github.com/goccy/go-json/internal/encoder/compiler_race.go
deleted file mode 100644
index 47b482f7fb6..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/compiler_race.go
+++ /dev/null
@@ -1,46 +0,0 @@
-//go:build race
-// +build race
-
-package encoder
-
-import (
- "sync"
-)
-
-var setsMu sync.RWMutex
-
-func CompileToGetCodeSet(ctx *RuntimeContext, typeptr uintptr) (*OpcodeSet, error) {
- initEncoder()
- if typeptr > typeAddr.MaxTypeAddr || typeptr < typeAddr.BaseTypeAddr {
- codeSet, err := compileToGetCodeSetSlowPath(typeptr)
- if err != nil {
- return nil, err
- }
- return getFilteredCodeSetIfNeeded(ctx, codeSet)
- }
- index := (typeptr - typeAddr.BaseTypeAddr) >> typeAddr.AddrShift
- setsMu.RLock()
- if codeSet := cachedOpcodeSets[index]; codeSet != nil {
- filtered, err := getFilteredCodeSetIfNeeded(ctx, codeSet)
- if err != nil {
- setsMu.RUnlock()
- return nil, err
- }
- setsMu.RUnlock()
- return filtered, nil
- }
- setsMu.RUnlock()
-
- codeSet, err := newCompiler().compile(typeptr)
- if err != nil {
- return nil, err
- }
- filtered, err := getFilteredCodeSetIfNeeded(ctx, codeSet)
- if err != nil {
- return nil, err
- }
- setsMu.Lock()
- cachedOpcodeSets[index] = codeSet
- setsMu.Unlock()
- return filtered, nil
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/context.go b/vendor/github.com/goccy/go-json/internal/encoder/context.go
deleted file mode 100644
index 3833d0c86db..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/context.go
+++ /dev/null
@@ -1,105 +0,0 @@
-package encoder
-
-import (
- "context"
- "sync"
- "unsafe"
-
- "github.com/goccy/go-json/internal/runtime"
-)
-
-type compileContext struct {
- opcodeIndex uint32
- ptrIndex int
- indent uint32
- escapeKey bool
- structTypeToCodes map[uintptr]Opcodes
- recursiveCodes *Opcodes
-}
-
-func (c *compileContext) incIndent() {
- c.indent++
-}
-
-func (c *compileContext) decIndent() {
- c.indent--
-}
-
-func (c *compileContext) incIndex() {
- c.incOpcodeIndex()
- c.incPtrIndex()
-}
-
-func (c *compileContext) decIndex() {
- c.decOpcodeIndex()
- c.decPtrIndex()
-}
-
-func (c *compileContext) incOpcodeIndex() {
- c.opcodeIndex++
-}
-
-func (c *compileContext) decOpcodeIndex() {
- c.opcodeIndex--
-}
-
-func (c *compileContext) incPtrIndex() {
- c.ptrIndex++
-}
-
-func (c *compileContext) decPtrIndex() {
- c.ptrIndex--
-}
-
-const (
- bufSize = 1024
-)
-
-var (
- runtimeContextPool = sync.Pool{
- New: func() interface{} {
- return &RuntimeContext{
- Buf: make([]byte, 0, bufSize),
- Ptrs: make([]uintptr, 128),
- KeepRefs: make([]unsafe.Pointer, 0, 8),
- Option: &Option{},
- }
- },
- }
-)
-
-type RuntimeContext struct {
- Context context.Context
- Buf []byte
- MarshalBuf []byte
- Ptrs []uintptr
- KeepRefs []unsafe.Pointer
- SeenPtr []uintptr
- BaseIndent uint32
- Prefix []byte
- IndentStr []byte
- Option *Option
-}
-
-func (c *RuntimeContext) Init(p uintptr, codelen int) {
- if len(c.Ptrs) < codelen {
- c.Ptrs = make([]uintptr, codelen)
- }
- c.Ptrs[0] = p
- c.KeepRefs = c.KeepRefs[:0]
- c.SeenPtr = c.SeenPtr[:0]
- c.BaseIndent = 0
-}
-
-func (c *RuntimeContext) Ptr() uintptr {
- header := (*runtime.SliceHeader)(unsafe.Pointer(&c.Ptrs))
- return uintptr(header.Data)
-}
-
-func TakeRuntimeContext() *RuntimeContext {
- return runtimeContextPool.Get().(*RuntimeContext)
-}
-
-func ReleaseRuntimeContext(ctx *RuntimeContext) {
- runtimeContextPool.Put(ctx)
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/decode_rune.go b/vendor/github.com/goccy/go-json/internal/encoder/decode_rune.go
deleted file mode 100644
index 35c959d4818..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/decode_rune.go
+++ /dev/null
@@ -1,126 +0,0 @@
-package encoder
-
-import "unicode/utf8"
-
-const (
- // The default lowest and highest continuation byte.
- locb = 128 //0b10000000
- hicb = 191 //0b10111111
-
- // These names of these constants are chosen to give nice alignment in the
- // table below. The first nibble is an index into acceptRanges or F for
- // special one-byte cases. The second nibble is the Rune length or the
- // Status for the special one-byte case.
- xx = 0xF1 // invalid: size 1
- as = 0xF0 // ASCII: size 1
- s1 = 0x02 // accept 0, size 2
- s2 = 0x13 // accept 1, size 3
- s3 = 0x03 // accept 0, size 3
- s4 = 0x23 // accept 2, size 3
- s5 = 0x34 // accept 3, size 4
- s6 = 0x04 // accept 0, size 4
- s7 = 0x44 // accept 4, size 4
-)
-
-// first is information about the first byte in a UTF-8 sequence.
-var first = [256]uint8{
- // 1 2 3 4 5 6 7 8 9 A B C D E F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x00-0x0F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x10-0x1F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x20-0x2F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x30-0x3F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x40-0x4F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x50-0x5F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x60-0x6F
- as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, as, // 0x70-0x7F
- // 1 2 3 4 5 6 7 8 9 A B C D E F
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0x80-0x8F
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0x90-0x9F
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0xA0-0xAF
- xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0xB0-0xBF
- xx, xx, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, // 0xC0-0xCF
- s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, s1, // 0xD0-0xDF
- s2, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s3, s4, s3, s3, // 0xE0-0xEF
- s5, s6, s6, s6, s7, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, // 0xF0-0xFF
-}
-
-const (
- lineSep = byte(168) //'\u2028'
- paragraphSep = byte(169) //'\u2029'
-)
-
-type decodeRuneState int
-
-const (
- validUTF8State decodeRuneState = iota
- runeErrorState
- lineSepState
- paragraphSepState
-)
-
-func decodeRuneInString(s string) (decodeRuneState, int) {
- n := len(s)
- s0 := s[0]
- x := first[s0]
- if x >= as {
- // The following code simulates an additional check for x == xx and
- // handling the ASCII and invalid cases accordingly. This mask-and-or
- // approach prevents an additional branch.
- mask := rune(x) << 31 >> 31 // Create 0x0000 or 0xFFFF.
- if rune(s[0])&^mask|utf8.RuneError&mask == utf8.RuneError {
- return runeErrorState, 1
- }
- return validUTF8State, 1
- }
- sz := int(x & 7)
- if n < sz {
- return runeErrorState, 1
- }
- s1 := s[1]
- switch x >> 4 {
- case 0:
- if s1 < locb || hicb < s1 {
- return runeErrorState, 1
- }
- case 1:
- if s1 < 0xA0 || hicb < s1 {
- return runeErrorState, 1
- }
- case 2:
- if s1 < locb || 0x9F < s1 {
- return runeErrorState, 1
- }
- case 3:
- if s1 < 0x90 || hicb < s1 {
- return runeErrorState, 1
- }
- case 4:
- if s1 < locb || 0x8F < s1 {
- return runeErrorState, 1
- }
- }
- if sz <= 2 {
- return validUTF8State, 2
- }
- s2 := s[2]
- if s2 < locb || hicb < s2 {
- return runeErrorState, 1
- }
- if sz <= 3 {
- // separator character prefixes: [2]byte{226, 128}
- if s0 == 226 && s1 == 128 {
- switch s2 {
- case lineSep:
- return lineSepState, 3
- case paragraphSep:
- return paragraphSepState, 3
- }
- }
- return validUTF8State, 3
- }
- s3 := s[3]
- if s3 < locb || hicb < s3 {
- return runeErrorState, 1
- }
- return validUTF8State, 4
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/encoder.go b/vendor/github.com/goccy/go-json/internal/encoder/encoder.go
deleted file mode 100644
index b436f5b21ff..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/encoder.go
+++ /dev/null
@@ -1,601 +0,0 @@
-package encoder
-
-import (
- "bytes"
- "encoding"
- "encoding/base64"
- "encoding/json"
- "fmt"
- "math"
- "reflect"
- "strconv"
- "strings"
- "sync"
- "unsafe"
-
- "github.com/goccy/go-json/internal/errors"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-func (t OpType) IsMultipleOpHead() bool {
- switch t {
- case OpStructHead:
- return true
- case OpStructHeadSlice:
- return true
- case OpStructHeadArray:
- return true
- case OpStructHeadMap:
- return true
- case OpStructHeadStruct:
- return true
- case OpStructHeadOmitEmpty:
- return true
- case OpStructHeadOmitEmptySlice:
- return true
- case OpStructHeadOmitEmptyArray:
- return true
- case OpStructHeadOmitEmptyMap:
- return true
- case OpStructHeadOmitEmptyStruct:
- return true
- case OpStructHeadSlicePtr:
- return true
- case OpStructHeadOmitEmptySlicePtr:
- return true
- case OpStructHeadArrayPtr:
- return true
- case OpStructHeadOmitEmptyArrayPtr:
- return true
- case OpStructHeadMapPtr:
- return true
- case OpStructHeadOmitEmptyMapPtr:
- return true
- }
- return false
-}
-
-func (t OpType) IsMultipleOpField() bool {
- switch t {
- case OpStructField:
- return true
- case OpStructFieldSlice:
- return true
- case OpStructFieldArray:
- return true
- case OpStructFieldMap:
- return true
- case OpStructFieldStruct:
- return true
- case OpStructFieldOmitEmpty:
- return true
- case OpStructFieldOmitEmptySlice:
- return true
- case OpStructFieldOmitEmptyArray:
- return true
- case OpStructFieldOmitEmptyMap:
- return true
- case OpStructFieldOmitEmptyStruct:
- return true
- case OpStructFieldSlicePtr:
- return true
- case OpStructFieldOmitEmptySlicePtr:
- return true
- case OpStructFieldArrayPtr:
- return true
- case OpStructFieldOmitEmptyArrayPtr:
- return true
- case OpStructFieldMapPtr:
- return true
- case OpStructFieldOmitEmptyMapPtr:
- return true
- }
- return false
-}
-
-type OpcodeSet struct {
- Type *runtime.Type
- NoescapeKeyCode *Opcode
- EscapeKeyCode *Opcode
- InterfaceNoescapeKeyCode *Opcode
- InterfaceEscapeKeyCode *Opcode
- CodeLength int
- EndCode *Opcode
- Code Code
- QueryCache map[string]*OpcodeSet
- cacheMu sync.RWMutex
-}
-
-func (s *OpcodeSet) getQueryCache(hash string) *OpcodeSet {
- s.cacheMu.RLock()
- codeSet := s.QueryCache[hash]
- s.cacheMu.RUnlock()
- return codeSet
-}
-
-func (s *OpcodeSet) setQueryCache(hash string, codeSet *OpcodeSet) {
- s.cacheMu.Lock()
- s.QueryCache[hash] = codeSet
- s.cacheMu.Unlock()
-}
-
-type CompiledCode struct {
- Code *Opcode
- Linked bool // whether recursive code already have linked
- CurLen uintptr
- NextLen uintptr
-}
-
-const StartDetectingCyclesAfter = 1000
-
-func Load(base uintptr, idx uintptr) uintptr {
- addr := base + idx
- return **(**uintptr)(unsafe.Pointer(&addr))
-}
-
-func Store(base uintptr, idx uintptr, p uintptr) {
- addr := base + idx
- **(**uintptr)(unsafe.Pointer(&addr)) = p
-}
-
-func LoadNPtr(base uintptr, idx uintptr, ptrNum int) uintptr {
- addr := base + idx
- p := **(**uintptr)(unsafe.Pointer(&addr))
- if p == 0 {
- return 0
- }
- return PtrToPtr(p)
- /*
- for i := 0; i < ptrNum; i++ {
- if p == 0 {
- return p
- }
- p = PtrToPtr(p)
- }
- return p
- */
-}
-
-func PtrToUint64(p uintptr) uint64 { return **(**uint64)(unsafe.Pointer(&p)) }
-func PtrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) }
-func PtrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) }
-func PtrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) }
-func PtrToBytes(p uintptr) []byte { return **(**[]byte)(unsafe.Pointer(&p)) }
-func PtrToNumber(p uintptr) json.Number { return **(**json.Number)(unsafe.Pointer(&p)) }
-func PtrToString(p uintptr) string { return **(**string)(unsafe.Pointer(&p)) }
-func PtrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader)(unsafe.Pointer(&p)) }
-func PtrToPtr(p uintptr) uintptr {
- return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p)))
-}
-func PtrToNPtr(p uintptr, ptrNum int) uintptr {
- for i := 0; i < ptrNum; i++ {
- if p == 0 {
- return 0
- }
- p = PtrToPtr(p)
- }
- return p
-}
-
-func PtrToUnsafePtr(p uintptr) unsafe.Pointer {
- return *(*unsafe.Pointer)(unsafe.Pointer(&p))
-}
-func PtrToInterface(code *Opcode, p uintptr) interface{} {
- return *(*interface{})(unsafe.Pointer(&emptyInterface{
- typ: code.Type,
- ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)),
- }))
-}
-
-func ErrUnsupportedValue(code *Opcode, ptr uintptr) *errors.UnsupportedValueError {
- v := *(*interface{})(unsafe.Pointer(&emptyInterface{
- typ: code.Type,
- ptr: *(*unsafe.Pointer)(unsafe.Pointer(&ptr)),
- }))
- return &errors.UnsupportedValueError{
- Value: reflect.ValueOf(v),
- Str: fmt.Sprintf("encountered a cycle via %s", code.Type),
- }
-}
-
-func ErrUnsupportedFloat(v float64) *errors.UnsupportedValueError {
- return &errors.UnsupportedValueError{
- Value: reflect.ValueOf(v),
- Str: strconv.FormatFloat(v, 'g', -1, 64),
- }
-}
-
-func ErrMarshalerWithCode(code *Opcode, err error) *errors.MarshalerError {
- return &errors.MarshalerError{
- Type: runtime.RType2Type(code.Type),
- Err: err,
- }
-}
-
-type emptyInterface struct {
- typ *runtime.Type
- ptr unsafe.Pointer
-}
-
-type MapItem struct {
- Key []byte
- Value []byte
-}
-
-type Mapslice struct {
- Items []MapItem
-}
-
-func (m *Mapslice) Len() int {
- return len(m.Items)
-}
-
-func (m *Mapslice) Less(i, j int) bool {
- return bytes.Compare(m.Items[i].Key, m.Items[j].Key) < 0
-}
-
-func (m *Mapslice) Swap(i, j int) {
- m.Items[i], m.Items[j] = m.Items[j], m.Items[i]
-}
-
-//nolint:structcheck,unused
-type mapIter struct {
- key unsafe.Pointer
- elem unsafe.Pointer
- t unsafe.Pointer
- h unsafe.Pointer
- buckets unsafe.Pointer
- bptr unsafe.Pointer
- overflow unsafe.Pointer
- oldoverflow unsafe.Pointer
- startBucket uintptr
- offset uint8
- wrapped bool
- B uint8
- i uint8
- bucket uintptr
- checkBucket uintptr
-}
-
-type MapContext struct {
- Start int
- First int
- Idx int
- Slice *Mapslice
- Buf []byte
- Len int
- Iter mapIter
-}
-
-var mapContextPool = sync.Pool{
- New: func() interface{} {
- return &MapContext{
- Slice: &Mapslice{},
- }
- },
-}
-
-func NewMapContext(mapLen int, unorderedMap bool) *MapContext {
- ctx := mapContextPool.Get().(*MapContext)
- if !unorderedMap {
- if len(ctx.Slice.Items) < mapLen {
- ctx.Slice.Items = make([]MapItem, mapLen)
- } else {
- ctx.Slice.Items = ctx.Slice.Items[:mapLen]
- }
- }
- ctx.Buf = ctx.Buf[:0]
- ctx.Iter = mapIter{}
- ctx.Idx = 0
- ctx.Len = mapLen
- return ctx
-}
-
-func ReleaseMapContext(c *MapContext) {
- mapContextPool.Put(c)
-}
-
-//go:linkname MapIterInit runtime.mapiterinit
-//go:noescape
-func MapIterInit(mapType *runtime.Type, m unsafe.Pointer, it *mapIter)
-
-//go:linkname MapIterKey reflect.mapiterkey
-//go:noescape
-func MapIterKey(it *mapIter) unsafe.Pointer
-
-//go:linkname MapIterNext reflect.mapiternext
-//go:noescape
-func MapIterNext(it *mapIter)
-
-//go:linkname MapLen reflect.maplen
-//go:noescape
-func MapLen(m unsafe.Pointer) int
-
-func AppendByteSlice(_ *RuntimeContext, b []byte, src []byte) []byte {
- if src == nil {
- return append(b, `null`...)
- }
- encodedLen := base64.StdEncoding.EncodedLen(len(src))
- b = append(b, '"')
- pos := len(b)
- remainLen := cap(b[pos:])
- var buf []byte
- if remainLen > encodedLen {
- buf = b[pos : pos+encodedLen]
- } else {
- buf = make([]byte, encodedLen)
- }
- base64.StdEncoding.Encode(buf, src)
- return append(append(b, buf...), '"')
-}
-
-func AppendFloat32(_ *RuntimeContext, b []byte, v float32) []byte {
- f64 := float64(v)
- abs := math.Abs(f64)
- fmt := byte('f')
- // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right.
- if abs != 0 {
- f32 := float32(abs)
- if f32 < 1e-6 || f32 >= 1e21 {
- fmt = 'e'
- }
- }
- return strconv.AppendFloat(b, f64, fmt, -1, 32)
-}
-
-func AppendFloat64(_ *RuntimeContext, b []byte, v float64) []byte {
- abs := math.Abs(v)
- fmt := byte('f')
- // Note: Must use float32 comparisons for underlying float32 value to get precise cutoffs right.
- if abs != 0 {
- if abs < 1e-6 || abs >= 1e21 {
- fmt = 'e'
- }
- }
- return strconv.AppendFloat(b, v, fmt, -1, 64)
-}
-
-func AppendBool(_ *RuntimeContext, b []byte, v bool) []byte {
- if v {
- return append(b, "true"...)
- }
- return append(b, "false"...)
-}
-
-var (
- floatTable = [256]bool{
- '0': true,
- '1': true,
- '2': true,
- '3': true,
- '4': true,
- '5': true,
- '6': true,
- '7': true,
- '8': true,
- '9': true,
- '.': true,
- 'e': true,
- 'E': true,
- '+': true,
- '-': true,
- }
-)
-
-func AppendNumber(_ *RuntimeContext, b []byte, n json.Number) ([]byte, error) {
- if len(n) == 0 {
- return append(b, '0'), nil
- }
- for i := 0; i < len(n); i++ {
- if !floatTable[n[i]] {
- return nil, fmt.Errorf("json: invalid number literal %q", n)
- }
- }
- b = append(b, n...)
- return b, nil
-}
-
-func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) {
- rv := reflect.ValueOf(v) // convert by dynamic interface type
- if (code.Flags & AddrForMarshalerFlags) != 0 {
- if rv.CanAddr() {
- rv = rv.Addr()
- } else {
- newV := reflect.New(rv.Type())
- newV.Elem().Set(rv)
- rv = newV
- }
- }
-
- if rv.Kind() == reflect.Ptr && rv.IsNil() {
- return AppendNull(ctx, b), nil
- }
-
- v = rv.Interface()
- var bb []byte
- if (code.Flags & MarshalerContextFlags) != 0 {
- marshaler, ok := v.(marshalerContext)
- if !ok {
- return AppendNull(ctx, b), nil
- }
- stdctx := ctx.Option.Context
- if ctx.Option.Flag&FieldQueryOption != 0 {
- stdctx = SetFieldQueryToContext(stdctx, code.FieldQuery)
- }
- b, err := marshaler.MarshalJSON(stdctx)
- if err != nil {
- return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err}
- }
- bb = b
- } else {
- marshaler, ok := v.(json.Marshaler)
- if !ok {
- return AppendNull(ctx, b), nil
- }
- b, err := marshaler.MarshalJSON()
- if err != nil {
- return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err}
- }
- bb = b
- }
- marshalBuf := ctx.MarshalBuf[:0]
- marshalBuf = append(append(marshalBuf, bb...), nul)
- compactedBuf, err := compact(b, marshalBuf, (ctx.Option.Flag&HTMLEscapeOption) != 0)
- if err != nil {
- return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err}
- }
- ctx.MarshalBuf = marshalBuf
- return compactedBuf, nil
-}
-
-func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) {
- rv := reflect.ValueOf(v) // convert by dynamic interface type
- if (code.Flags & AddrForMarshalerFlags) != 0 {
- if rv.CanAddr() {
- rv = rv.Addr()
- } else {
- newV := reflect.New(rv.Type())
- newV.Elem().Set(rv)
- rv = newV
- }
- }
- v = rv.Interface()
- var bb []byte
- if (code.Flags & MarshalerContextFlags) != 0 {
- marshaler, ok := v.(marshalerContext)
- if !ok {
- return AppendNull(ctx, b), nil
- }
- b, err := marshaler.MarshalJSON(ctx.Option.Context)
- if err != nil {
- return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err}
- }
- bb = b
- } else {
- marshaler, ok := v.(json.Marshaler)
- if !ok {
- return AppendNull(ctx, b), nil
- }
- b, err := marshaler.MarshalJSON()
- if err != nil {
- return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err}
- }
- bb = b
- }
- marshalBuf := ctx.MarshalBuf[:0]
- marshalBuf = append(append(marshalBuf, bb...), nul)
- indentedBuf, err := doIndent(
- b,
- marshalBuf,
- string(ctx.Prefix)+strings.Repeat(string(ctx.IndentStr), int(ctx.BaseIndent+code.Indent)),
- string(ctx.IndentStr),
- (ctx.Option.Flag&HTMLEscapeOption) != 0,
- )
- if err != nil {
- return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err}
- }
- ctx.MarshalBuf = marshalBuf
- return indentedBuf, nil
-}
-
-func AppendMarshalText(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) {
- rv := reflect.ValueOf(v) // convert by dynamic interface type
- if (code.Flags & AddrForMarshalerFlags) != 0 {
- if rv.CanAddr() {
- rv = rv.Addr()
- } else {
- newV := reflect.New(rv.Type())
- newV.Elem().Set(rv)
- rv = newV
- }
- }
- v = rv.Interface()
- marshaler, ok := v.(encoding.TextMarshaler)
- if !ok {
- return AppendNull(ctx, b), nil
- }
- bytes, err := marshaler.MarshalText()
- if err != nil {
- return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err}
- }
- return AppendString(ctx, b, *(*string)(unsafe.Pointer(&bytes))), nil
-}
-
-func AppendMarshalTextIndent(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) {
- rv := reflect.ValueOf(v) // convert by dynamic interface type
- if (code.Flags & AddrForMarshalerFlags) != 0 {
- if rv.CanAddr() {
- rv = rv.Addr()
- } else {
- newV := reflect.New(rv.Type())
- newV.Elem().Set(rv)
- rv = newV
- }
- }
- v = rv.Interface()
- marshaler, ok := v.(encoding.TextMarshaler)
- if !ok {
- return AppendNull(ctx, b), nil
- }
- bytes, err := marshaler.MarshalText()
- if err != nil {
- return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err}
- }
- return AppendString(ctx, b, *(*string)(unsafe.Pointer(&bytes))), nil
-}
-
-func AppendNull(_ *RuntimeContext, b []byte) []byte {
- return append(b, "null"...)
-}
-
-func AppendComma(_ *RuntimeContext, b []byte) []byte {
- return append(b, ',')
-}
-
-func AppendCommaIndent(_ *RuntimeContext, b []byte) []byte {
- return append(b, ',', '\n')
-}
-
-func AppendStructEnd(_ *RuntimeContext, b []byte) []byte {
- return append(b, '}', ',')
-}
-
-func AppendStructEndIndent(ctx *RuntimeContext, code *Opcode, b []byte) []byte {
- b = append(b, '\n')
- b = append(b, ctx.Prefix...)
- indentNum := ctx.BaseIndent + code.Indent - 1
- for i := uint32(0); i < indentNum; i++ {
- b = append(b, ctx.IndentStr...)
- }
- return append(b, '}', ',', '\n')
-}
-
-func AppendIndent(ctx *RuntimeContext, b []byte, indent uint32) []byte {
- b = append(b, ctx.Prefix...)
- indentNum := ctx.BaseIndent + indent
- for i := uint32(0); i < indentNum; i++ {
- b = append(b, ctx.IndentStr...)
- }
- return b
-}
-
-func IsNilForMarshaler(v interface{}) bool {
- rv := reflect.ValueOf(v)
- switch rv.Kind() {
- case reflect.Bool:
- return !rv.Bool()
- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
- return rv.Int() == 0
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
- return rv.Uint() == 0
- case reflect.Float32, reflect.Float64:
- return math.Float64bits(rv.Float()) == 0
- case reflect.Interface, reflect.Map, reflect.Ptr, reflect.Func:
- return rv.IsNil()
- case reflect.Slice:
- return rv.IsNil() || rv.Len() == 0
- case reflect.String:
- return rv.Len() == 0
- }
- return false
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/indent.go b/vendor/github.com/goccy/go-json/internal/encoder/indent.go
deleted file mode 100644
index dfe04b5e3c4..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/indent.go
+++ /dev/null
@@ -1,211 +0,0 @@
-package encoder
-
-import (
- "bytes"
- "fmt"
-
- "github.com/goccy/go-json/internal/errors"
-)
-
-func takeIndentSrcRuntimeContext(src []byte) (*RuntimeContext, []byte) {
- ctx := TakeRuntimeContext()
- buf := ctx.Buf[:0]
- buf = append(append(buf, src...), nul)
- ctx.Buf = buf
- return ctx, buf
-}
-
-func Indent(buf *bytes.Buffer, src []byte, prefix, indentStr string) error {
- if len(src) == 0 {
- return errors.ErrUnexpectedEndOfJSON("", 0)
- }
-
- srcCtx, srcBuf := takeIndentSrcRuntimeContext(src)
- dstCtx := TakeRuntimeContext()
- dst := dstCtx.Buf[:0]
-
- dst, err := indentAndWrite(buf, dst, srcBuf, prefix, indentStr)
- if err != nil {
- ReleaseRuntimeContext(srcCtx)
- ReleaseRuntimeContext(dstCtx)
- return err
- }
- dstCtx.Buf = dst
- ReleaseRuntimeContext(srcCtx)
- ReleaseRuntimeContext(dstCtx)
- return nil
-}
-
-func indentAndWrite(buf *bytes.Buffer, dst []byte, src []byte, prefix, indentStr string) ([]byte, error) {
- dst, err := doIndent(dst, src, prefix, indentStr, false)
- if err != nil {
- return nil, err
- }
- if _, err := buf.Write(dst); err != nil {
- return nil, err
- }
- return dst, nil
-}
-
-func doIndent(dst, src []byte, prefix, indentStr string, escape bool) ([]byte, error) {
- buf, cursor, err := indentValue(dst, src, 0, 0, []byte(prefix), []byte(indentStr), escape)
- if err != nil {
- return nil, err
- }
- if err := validateEndBuf(src, cursor); err != nil {
- return nil, err
- }
- return buf, nil
-}
-
-func indentValue(
- dst []byte,
- src []byte,
- indentNum int,
- cursor int64,
- prefix []byte,
- indentBytes []byte,
- escape bool) ([]byte, int64, error) {
- for {
- switch src[cursor] {
- case ' ', '\t', '\n', '\r':
- cursor++
- continue
- case '{':
- return indentObject(dst, src, indentNum, cursor, prefix, indentBytes, escape)
- case '}':
- return nil, 0, errors.ErrSyntax("unexpected character '}'", cursor)
- case '[':
- return indentArray(dst, src, indentNum, cursor, prefix, indentBytes, escape)
- case ']':
- return nil, 0, errors.ErrSyntax("unexpected character ']'", cursor)
- case '"':
- return compactString(dst, src, cursor, escape)
- case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
- return compactNumber(dst, src, cursor)
- case 't':
- return compactTrue(dst, src, cursor)
- case 'f':
- return compactFalse(dst, src, cursor)
- case 'n':
- return compactNull(dst, src, cursor)
- default:
- return nil, 0, errors.ErrSyntax(fmt.Sprintf("unexpected character '%c'", src[cursor]), cursor)
- }
- }
-}
-
-func indentObject(
- dst []byte,
- src []byte,
- indentNum int,
- cursor int64,
- prefix []byte,
- indentBytes []byte,
- escape bool) ([]byte, int64, error) {
- if src[cursor] == '{' {
- dst = append(dst, '{')
- } else {
- return nil, 0, errors.ErrExpected("expected { character for object value", cursor)
- }
- cursor = skipWhiteSpace(src, cursor+1)
- if src[cursor] == '}' {
- dst = append(dst, '}')
- return dst, cursor + 1, nil
- }
- indentNum++
- var err error
- for {
- dst = append(append(dst, '\n'), prefix...)
- for i := 0; i < indentNum; i++ {
- dst = append(dst, indentBytes...)
- }
- cursor = skipWhiteSpace(src, cursor)
- dst, cursor, err = compactString(dst, src, cursor, escape)
- if err != nil {
- return nil, 0, err
- }
- cursor = skipWhiteSpace(src, cursor)
- if src[cursor] != ':' {
- return nil, 0, errors.ErrSyntax(
- fmt.Sprintf("invalid character '%c' after object key", src[cursor]),
- cursor+1,
- )
- }
- dst = append(dst, ':', ' ')
- dst, cursor, err = indentValue(dst, src, indentNum, cursor+1, prefix, indentBytes, escape)
- if err != nil {
- return nil, 0, err
- }
- cursor = skipWhiteSpace(src, cursor)
- switch src[cursor] {
- case '}':
- dst = append(append(dst, '\n'), prefix...)
- for i := 0; i < indentNum-1; i++ {
- dst = append(dst, indentBytes...)
- }
- dst = append(dst, '}')
- cursor++
- return dst, cursor, nil
- case ',':
- dst = append(dst, ',')
- default:
- return nil, 0, errors.ErrSyntax(
- fmt.Sprintf("invalid character '%c' after object key:value pair", src[cursor]),
- cursor+1,
- )
- }
- cursor++
- }
-}
-
-func indentArray(
- dst []byte,
- src []byte,
- indentNum int,
- cursor int64,
- prefix []byte,
- indentBytes []byte,
- escape bool) ([]byte, int64, error) {
- if src[cursor] == '[' {
- dst = append(dst, '[')
- } else {
- return nil, 0, errors.ErrExpected("expected [ character for array value", cursor)
- }
- cursor = skipWhiteSpace(src, cursor+1)
- if src[cursor] == ']' {
- dst = append(dst, ']')
- return dst, cursor + 1, nil
- }
- indentNum++
- var err error
- for {
- dst = append(append(dst, '\n'), prefix...)
- for i := 0; i < indentNum; i++ {
- dst = append(dst, indentBytes...)
- }
- dst, cursor, err = indentValue(dst, src, indentNum, cursor, prefix, indentBytes, escape)
- if err != nil {
- return nil, 0, err
- }
- cursor = skipWhiteSpace(src, cursor)
- switch src[cursor] {
- case ']':
- dst = append(append(dst, '\n'), prefix...)
- for i := 0; i < indentNum-1; i++ {
- dst = append(dst, indentBytes...)
- }
- dst = append(dst, ']')
- cursor++
- return dst, cursor, nil
- case ',':
- dst = append(dst, ',')
- default:
- return nil, 0, errors.ErrSyntax(
- fmt.Sprintf("invalid character '%c' after array value", src[cursor]),
- cursor+1,
- )
- }
- cursor++
- }
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/int.go b/vendor/github.com/goccy/go-json/internal/encoder/int.go
deleted file mode 100644
index 8b5febeaa63..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/int.go
+++ /dev/null
@@ -1,176 +0,0 @@
-// This files's processing codes are inspired by https://github.com/segmentio/encoding.
-// The license notation is as follows.
-//
-// # MIT License
-//
-// Copyright (c) 2019 Segment.io, Inc.
-//
-// 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.
-package encoder
-
-import (
- "unsafe"
-)
-
-var endianness int
-
-func init() {
- var b [2]byte
- *(*uint16)(unsafe.Pointer(&b)) = uint16(0xABCD)
-
- switch b[0] {
- case 0xCD:
- endianness = 0 // LE
- case 0xAB:
- endianness = 1 // BE
- default:
- panic("could not determine endianness")
- }
-}
-
-// "00010203...96979899" cast to []uint16
-var intLELookup = [100]uint16{
- 0x3030, 0x3130, 0x3230, 0x3330, 0x3430, 0x3530, 0x3630, 0x3730, 0x3830, 0x3930,
- 0x3031, 0x3131, 0x3231, 0x3331, 0x3431, 0x3531, 0x3631, 0x3731, 0x3831, 0x3931,
- 0x3032, 0x3132, 0x3232, 0x3332, 0x3432, 0x3532, 0x3632, 0x3732, 0x3832, 0x3932,
- 0x3033, 0x3133, 0x3233, 0x3333, 0x3433, 0x3533, 0x3633, 0x3733, 0x3833, 0x3933,
- 0x3034, 0x3134, 0x3234, 0x3334, 0x3434, 0x3534, 0x3634, 0x3734, 0x3834, 0x3934,
- 0x3035, 0x3135, 0x3235, 0x3335, 0x3435, 0x3535, 0x3635, 0x3735, 0x3835, 0x3935,
- 0x3036, 0x3136, 0x3236, 0x3336, 0x3436, 0x3536, 0x3636, 0x3736, 0x3836, 0x3936,
- 0x3037, 0x3137, 0x3237, 0x3337, 0x3437, 0x3537, 0x3637, 0x3737, 0x3837, 0x3937,
- 0x3038, 0x3138, 0x3238, 0x3338, 0x3438, 0x3538, 0x3638, 0x3738, 0x3838, 0x3938,
- 0x3039, 0x3139, 0x3239, 0x3339, 0x3439, 0x3539, 0x3639, 0x3739, 0x3839, 0x3939,
-}
-
-var intBELookup = [100]uint16{
- 0x3030, 0x3031, 0x3032, 0x3033, 0x3034, 0x3035, 0x3036, 0x3037, 0x3038, 0x3039,
- 0x3130, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, 0x3138, 0x3139,
- 0x3230, 0x3231, 0x3232, 0x3233, 0x3234, 0x3235, 0x3236, 0x3237, 0x3238, 0x3239,
- 0x3330, 0x3331, 0x3332, 0x3333, 0x3334, 0x3335, 0x3336, 0x3337, 0x3338, 0x3339,
- 0x3430, 0x3431, 0x3432, 0x3433, 0x3434, 0x3435, 0x3436, 0x3437, 0x3438, 0x3439,
- 0x3530, 0x3531, 0x3532, 0x3533, 0x3534, 0x3535, 0x3536, 0x3537, 0x3538, 0x3539,
- 0x3630, 0x3631, 0x3632, 0x3633, 0x3634, 0x3635, 0x3636, 0x3637, 0x3638, 0x3639,
- 0x3730, 0x3731, 0x3732, 0x3733, 0x3734, 0x3735, 0x3736, 0x3737, 0x3738, 0x3739,
- 0x3830, 0x3831, 0x3832, 0x3833, 0x3834, 0x3835, 0x3836, 0x3837, 0x3838, 0x3839,
- 0x3930, 0x3931, 0x3932, 0x3933, 0x3934, 0x3935, 0x3936, 0x3937, 0x3938, 0x3939,
-}
-
-var intLookup = [2]*[100]uint16{&intLELookup, &intBELookup}
-
-func numMask(numBitSize uint8) uint64 {
- return 1<>(code.NumBitSize-1))&1 == 1
- if !negative {
- if n < 10 {
- return append(out, byte(n+'0'))
- } else if n < 100 {
- u := intLELookup[n]
- return append(out, byte(u), byte(u>>8))
- }
- } else {
- n = -n & mask
- }
-
- lookup := intLookup[endianness]
-
- var b [22]byte
- u := (*[11]uint16)(unsafe.Pointer(&b))
- i := 11
-
- for n >= 100 {
- j := n % 100
- n /= 100
- i--
- u[i] = lookup[j]
- }
-
- i--
- u[i] = lookup[n]
-
- i *= 2 // convert to byte index
- if n < 10 {
- i++ // remove leading zero
- }
- if negative {
- i--
- b[i] = '-'
- }
-
- return append(out, b[i:]...)
-}
-
-func AppendUint(_ *RuntimeContext, out []byte, p uintptr, code *Opcode) []byte {
- var u64 uint64
- switch code.NumBitSize {
- case 8:
- u64 = (uint64)(**(**uint8)(unsafe.Pointer(&p)))
- case 16:
- u64 = (uint64)(**(**uint16)(unsafe.Pointer(&p)))
- case 32:
- u64 = (uint64)(**(**uint32)(unsafe.Pointer(&p)))
- case 64:
- u64 = **(**uint64)(unsafe.Pointer(&p))
- }
- mask := numMask(code.NumBitSize)
- n := u64 & mask
- if n < 10 {
- return append(out, byte(n+'0'))
- } else if n < 100 {
- u := intLELookup[n]
- return append(out, byte(u), byte(u>>8))
- }
-
- lookup := intLookup[endianness]
-
- var b [22]byte
- u := (*[11]uint16)(unsafe.Pointer(&b))
- i := 11
-
- for n >= 100 {
- j := n % 100
- n /= 100
- i--
- u[i] = lookup[j]
- }
-
- i--
- u[i] = lookup[n]
-
- i *= 2 // convert to byte index
- if n < 10 {
- i++ // remove leading zero
- }
- return append(out, b[i:]...)
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/map112.go b/vendor/github.com/goccy/go-json/internal/encoder/map112.go
deleted file mode 100644
index e96ffadf7ab..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/map112.go
+++ /dev/null
@@ -1,9 +0,0 @@
-//go:build !go1.13
-// +build !go1.13
-
-package encoder
-
-import "unsafe"
-
-//go:linkname MapIterValue reflect.mapitervalue
-func MapIterValue(it *mapIter) unsafe.Pointer
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/map113.go b/vendor/github.com/goccy/go-json/internal/encoder/map113.go
deleted file mode 100644
index 9b69dcc360d..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/map113.go
+++ /dev/null
@@ -1,9 +0,0 @@
-//go:build go1.13
-// +build go1.13
-
-package encoder
-
-import "unsafe"
-
-//go:linkname MapIterValue reflect.mapiterelem
-func MapIterValue(it *mapIter) unsafe.Pointer
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/opcode.go b/vendor/github.com/goccy/go-json/internal/encoder/opcode.go
deleted file mode 100644
index df22f55423d..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/opcode.go
+++ /dev/null
@@ -1,752 +0,0 @@
-package encoder
-
-import (
- "bytes"
- "fmt"
- "sort"
- "strings"
- "unsafe"
-
- "github.com/goccy/go-json/internal/runtime"
-)
-
-const uintptrSize = 4 << (^uintptr(0) >> 63)
-
-type OpFlags uint16
-
-const (
- AnonymousHeadFlags OpFlags = 1 << 0
- AnonymousKeyFlags OpFlags = 1 << 1
- IndirectFlags OpFlags = 1 << 2
- IsTaggedKeyFlags OpFlags = 1 << 3
- NilCheckFlags OpFlags = 1 << 4
- AddrForMarshalerFlags OpFlags = 1 << 5
- IsNextOpPtrTypeFlags OpFlags = 1 << 6
- IsNilableTypeFlags OpFlags = 1 << 7
- MarshalerContextFlags OpFlags = 1 << 8
- NonEmptyInterfaceFlags OpFlags = 1 << 9
-)
-
-type Opcode struct {
- Op OpType // operation type
- Idx uint32 // offset to access ptr
- Next *Opcode // next opcode
- End *Opcode // array/slice/struct/map end
- NextField *Opcode // next struct field
- Key string // struct field key
- Offset uint32 // offset size from struct header
- PtrNum uint8 // pointer number: e.g. double pointer is 2.
- NumBitSize uint8
- Flags OpFlags
-
- Type *runtime.Type // go type
- Jmp *CompiledCode // for recursive call
- FieldQuery *FieldQuery // field query for Interface / MarshalJSON / MarshalText
- ElemIdx uint32 // offset to access array/slice elem
- Length uint32 // offset to access slice length or array length
- Indent uint32 // indent number
- Size uint32 // array/slice elem size
- DisplayIdx uint32 // opcode index
- DisplayKey string // key text to display
-}
-
-func (c *Opcode) Validate() error {
- var prevIdx uint32
- for code := c; !code.IsEnd(); {
- if prevIdx != 0 {
- if code.DisplayIdx != prevIdx+1 {
- return fmt.Errorf(
- "invalid index. previous display index is %d but next is %d. dump = %s",
- prevIdx, code.DisplayIdx, c.Dump(),
- )
- }
- }
- prevIdx = code.DisplayIdx
- code = code.IterNext()
- }
- return nil
-}
-
-func (c *Opcode) IterNext() *Opcode {
- if c == nil {
- return nil
- }
- switch c.Op.CodeType() {
- case CodeArrayElem, CodeSliceElem, CodeMapKey:
- return c.End
- default:
- return c.Next
- }
-}
-
-func (c *Opcode) IsEnd() bool {
- if c == nil {
- return true
- }
- return c.Op == OpEnd || c.Op == OpInterfaceEnd || c.Op == OpRecursiveEnd
-}
-
-func (c *Opcode) MaxIdx() uint32 {
- max := uint32(0)
- for _, value := range []uint32{
- c.Idx,
- c.ElemIdx,
- c.Length,
- c.Size,
- } {
- if max < value {
- max = value
- }
- }
- return max
-}
-
-func (c *Opcode) ToHeaderType(isString bool) OpType {
- switch c.Op {
- case OpInt:
- if isString {
- return OpStructHeadIntString
- }
- return OpStructHeadInt
- case OpIntPtr:
- if isString {
- return OpStructHeadIntPtrString
- }
- return OpStructHeadIntPtr
- case OpUint:
- if isString {
- return OpStructHeadUintString
- }
- return OpStructHeadUint
- case OpUintPtr:
- if isString {
- return OpStructHeadUintPtrString
- }
- return OpStructHeadUintPtr
- case OpFloat32:
- if isString {
- return OpStructHeadFloat32String
- }
- return OpStructHeadFloat32
- case OpFloat32Ptr:
- if isString {
- return OpStructHeadFloat32PtrString
- }
- return OpStructHeadFloat32Ptr
- case OpFloat64:
- if isString {
- return OpStructHeadFloat64String
- }
- return OpStructHeadFloat64
- case OpFloat64Ptr:
- if isString {
- return OpStructHeadFloat64PtrString
- }
- return OpStructHeadFloat64Ptr
- case OpString:
- if isString {
- return OpStructHeadStringString
- }
- return OpStructHeadString
- case OpStringPtr:
- if isString {
- return OpStructHeadStringPtrString
- }
- return OpStructHeadStringPtr
- case OpNumber:
- if isString {
- return OpStructHeadNumberString
- }
- return OpStructHeadNumber
- case OpNumberPtr:
- if isString {
- return OpStructHeadNumberPtrString
- }
- return OpStructHeadNumberPtr
- case OpBool:
- if isString {
- return OpStructHeadBoolString
- }
- return OpStructHeadBool
- case OpBoolPtr:
- if isString {
- return OpStructHeadBoolPtrString
- }
- return OpStructHeadBoolPtr
- case OpBytes:
- return OpStructHeadBytes
- case OpBytesPtr:
- return OpStructHeadBytesPtr
- case OpMap:
- return OpStructHeadMap
- case OpMapPtr:
- c.Op = OpMap
- return OpStructHeadMapPtr
- case OpArray:
- return OpStructHeadArray
- case OpArrayPtr:
- c.Op = OpArray
- return OpStructHeadArrayPtr
- case OpSlice:
- return OpStructHeadSlice
- case OpSlicePtr:
- c.Op = OpSlice
- return OpStructHeadSlicePtr
- case OpMarshalJSON:
- return OpStructHeadMarshalJSON
- case OpMarshalJSONPtr:
- return OpStructHeadMarshalJSONPtr
- case OpMarshalText:
- return OpStructHeadMarshalText
- case OpMarshalTextPtr:
- return OpStructHeadMarshalTextPtr
- }
- return OpStructHead
-}
-
-func (c *Opcode) ToFieldType(isString bool) OpType {
- switch c.Op {
- case OpInt:
- if isString {
- return OpStructFieldIntString
- }
- return OpStructFieldInt
- case OpIntPtr:
- if isString {
- return OpStructFieldIntPtrString
- }
- return OpStructFieldIntPtr
- case OpUint:
- if isString {
- return OpStructFieldUintString
- }
- return OpStructFieldUint
- case OpUintPtr:
- if isString {
- return OpStructFieldUintPtrString
- }
- return OpStructFieldUintPtr
- case OpFloat32:
- if isString {
- return OpStructFieldFloat32String
- }
- return OpStructFieldFloat32
- case OpFloat32Ptr:
- if isString {
- return OpStructFieldFloat32PtrString
- }
- return OpStructFieldFloat32Ptr
- case OpFloat64:
- if isString {
- return OpStructFieldFloat64String
- }
- return OpStructFieldFloat64
- case OpFloat64Ptr:
- if isString {
- return OpStructFieldFloat64PtrString
- }
- return OpStructFieldFloat64Ptr
- case OpString:
- if isString {
- return OpStructFieldStringString
- }
- return OpStructFieldString
- case OpStringPtr:
- if isString {
- return OpStructFieldStringPtrString
- }
- return OpStructFieldStringPtr
- case OpNumber:
- if isString {
- return OpStructFieldNumberString
- }
- return OpStructFieldNumber
- case OpNumberPtr:
- if isString {
- return OpStructFieldNumberPtrString
- }
- return OpStructFieldNumberPtr
- case OpBool:
- if isString {
- return OpStructFieldBoolString
- }
- return OpStructFieldBool
- case OpBoolPtr:
- if isString {
- return OpStructFieldBoolPtrString
- }
- return OpStructFieldBoolPtr
- case OpBytes:
- return OpStructFieldBytes
- case OpBytesPtr:
- return OpStructFieldBytesPtr
- case OpMap:
- return OpStructFieldMap
- case OpMapPtr:
- c.Op = OpMap
- return OpStructFieldMapPtr
- case OpArray:
- return OpStructFieldArray
- case OpArrayPtr:
- c.Op = OpArray
- return OpStructFieldArrayPtr
- case OpSlice:
- return OpStructFieldSlice
- case OpSlicePtr:
- c.Op = OpSlice
- return OpStructFieldSlicePtr
- case OpMarshalJSON:
- return OpStructFieldMarshalJSON
- case OpMarshalJSONPtr:
- return OpStructFieldMarshalJSONPtr
- case OpMarshalText:
- return OpStructFieldMarshalText
- case OpMarshalTextPtr:
- return OpStructFieldMarshalTextPtr
- }
- return OpStructField
-}
-
-func newOpCode(ctx *compileContext, typ *runtime.Type, op OpType) *Opcode {
- return newOpCodeWithNext(ctx, typ, op, newEndOp(ctx, typ))
-}
-
-func opcodeOffset(idx int) uint32 {
- return uint32(idx) * uintptrSize
-}
-
-func getCodeAddrByIdx(head *Opcode, idx uint32) *Opcode {
- addr := uintptr(unsafe.Pointer(head)) + uintptr(idx)*unsafe.Sizeof(Opcode{})
- return *(**Opcode)(unsafe.Pointer(&addr))
-}
-
-func copyOpcode(code *Opcode) *Opcode {
- codeNum := ToEndCode(code).DisplayIdx + 1
- codeSlice := make([]Opcode, codeNum)
- head := (*Opcode)((*runtime.SliceHeader)(unsafe.Pointer(&codeSlice)).Data)
- ptr := head
- c := code
- for {
- *ptr = Opcode{
- Op: c.Op,
- Key: c.Key,
- PtrNum: c.PtrNum,
- NumBitSize: c.NumBitSize,
- Flags: c.Flags,
- Idx: c.Idx,
- Offset: c.Offset,
- Type: c.Type,
- FieldQuery: c.FieldQuery,
- DisplayIdx: c.DisplayIdx,
- DisplayKey: c.DisplayKey,
- ElemIdx: c.ElemIdx,
- Length: c.Length,
- Size: c.Size,
- Indent: c.Indent,
- Jmp: c.Jmp,
- }
- if c.End != nil {
- ptr.End = getCodeAddrByIdx(head, c.End.DisplayIdx)
- }
- if c.NextField != nil {
- ptr.NextField = getCodeAddrByIdx(head, c.NextField.DisplayIdx)
- }
- if c.Next != nil {
- ptr.Next = getCodeAddrByIdx(head, c.Next.DisplayIdx)
- }
- if c.IsEnd() {
- break
- }
- ptr = getCodeAddrByIdx(head, c.DisplayIdx+1)
- c = c.IterNext()
- }
- return head
-}
-
-func setTotalLengthToInterfaceOp(code *Opcode) {
- for c := code; !c.IsEnd(); {
- if c.Op == OpInterface || c.Op == OpInterfacePtr {
- c.Length = uint32(code.TotalLength())
- }
- c = c.IterNext()
- }
-}
-
-func ToEndCode(code *Opcode) *Opcode {
- c := code
- for !c.IsEnd() {
- c = c.IterNext()
- }
- return c
-}
-
-func copyToInterfaceOpcode(code *Opcode) *Opcode {
- copied := copyOpcode(code)
- c := copied
- c = ToEndCode(c)
- c.Idx += uintptrSize
- c.ElemIdx = c.Idx + uintptrSize
- c.Length = c.Idx + 2*uintptrSize
- c.Op = OpInterfaceEnd
- return copied
-}
-
-func newOpCodeWithNext(ctx *compileContext, typ *runtime.Type, op OpType, next *Opcode) *Opcode {
- return &Opcode{
- Op: op,
- Idx: opcodeOffset(ctx.ptrIndex),
- Next: next,
- Type: typ,
- DisplayIdx: ctx.opcodeIndex,
- Indent: ctx.indent,
- }
-}
-
-func newEndOp(ctx *compileContext, typ *runtime.Type) *Opcode {
- return newOpCodeWithNext(ctx, typ, OpEnd, nil)
-}
-
-func (c *Opcode) TotalLength() int {
- var idx int
- code := c
- for !code.IsEnd() {
- maxIdx := int(code.MaxIdx() / uintptrSize)
- if idx < maxIdx {
- idx = maxIdx
- }
- if code.Op == OpRecursiveEnd {
- break
- }
- code = code.IterNext()
- }
- maxIdx := int(code.MaxIdx() / uintptrSize)
- if idx < maxIdx {
- idx = maxIdx
- }
- return idx + 1
-}
-
-func (c *Opcode) dumpHead(code *Opcode) string {
- var length uint32
- if code.Op.CodeType() == CodeArrayHead {
- length = code.Length
- } else {
- length = code.Length / uintptrSize
- }
- return fmt.Sprintf(
- `[%03d]%s%s ([idx:%d][elemIdx:%d][length:%d])`,
- code.DisplayIdx,
- strings.Repeat("-", int(code.Indent)),
- code.Op,
- code.Idx/uintptrSize,
- code.ElemIdx/uintptrSize,
- length,
- )
-}
-
-func (c *Opcode) dumpMapHead(code *Opcode) string {
- return fmt.Sprintf(
- `[%03d]%s%s ([idx:%d])`,
- code.DisplayIdx,
- strings.Repeat("-", int(code.Indent)),
- code.Op,
- code.Idx/uintptrSize,
- )
-}
-
-func (c *Opcode) dumpMapEnd(code *Opcode) string {
- return fmt.Sprintf(
- `[%03d]%s%s ([idx:%d])`,
- code.DisplayIdx,
- strings.Repeat("-", int(code.Indent)),
- code.Op,
- code.Idx/uintptrSize,
- )
-}
-
-func (c *Opcode) dumpElem(code *Opcode) string {
- var length uint32
- if code.Op.CodeType() == CodeArrayElem {
- length = code.Length
- } else {
- length = code.Length / uintptrSize
- }
- return fmt.Sprintf(
- `[%03d]%s%s ([idx:%d][elemIdx:%d][length:%d][size:%d])`,
- code.DisplayIdx,
- strings.Repeat("-", int(code.Indent)),
- code.Op,
- code.Idx/uintptrSize,
- code.ElemIdx/uintptrSize,
- length,
- code.Size,
- )
-}
-
-func (c *Opcode) dumpField(code *Opcode) string {
- return fmt.Sprintf(
- `[%03d]%s%s ([idx:%d][key:%s][offset:%d])`,
- code.DisplayIdx,
- strings.Repeat("-", int(code.Indent)),
- code.Op,
- code.Idx/uintptrSize,
- code.DisplayKey,
- code.Offset,
- )
-}
-
-func (c *Opcode) dumpKey(code *Opcode) string {
- return fmt.Sprintf(
- `[%03d]%s%s ([idx:%d])`,
- code.DisplayIdx,
- strings.Repeat("-", int(code.Indent)),
- code.Op,
- code.Idx/uintptrSize,
- )
-}
-
-func (c *Opcode) dumpValue(code *Opcode) string {
- return fmt.Sprintf(
- `[%03d]%s%s ([idx:%d])`,
- code.DisplayIdx,
- strings.Repeat("-", int(code.Indent)),
- code.Op,
- code.Idx/uintptrSize,
- )
-}
-
-func (c *Opcode) Dump() string {
- codes := []string{}
- for code := c; !code.IsEnd(); {
- switch code.Op.CodeType() {
- case CodeSliceHead:
- codes = append(codes, c.dumpHead(code))
- code = code.Next
- case CodeMapHead:
- codes = append(codes, c.dumpMapHead(code))
- code = code.Next
- case CodeArrayElem, CodeSliceElem:
- codes = append(codes, c.dumpElem(code))
- code = code.End
- case CodeMapKey:
- codes = append(codes, c.dumpKey(code))
- code = code.End
- case CodeMapValue:
- codes = append(codes, c.dumpValue(code))
- code = code.Next
- case CodeMapEnd:
- codes = append(codes, c.dumpMapEnd(code))
- code = code.Next
- case CodeStructField:
- codes = append(codes, c.dumpField(code))
- code = code.Next
- case CodeStructEnd:
- codes = append(codes, c.dumpField(code))
- code = code.Next
- default:
- codes = append(codes, fmt.Sprintf(
- "[%03d]%s%s ([idx:%d])",
- code.DisplayIdx,
- strings.Repeat("-", int(code.Indent)),
- code.Op,
- code.Idx/uintptrSize,
- ))
- code = code.Next
- }
- }
- return strings.Join(codes, "\n")
-}
-
-func (c *Opcode) DumpDOT() string {
- type edge struct {
- from, to *Opcode
- label string
- weight int
- }
- var edges []edge
-
- b := &bytes.Buffer{}
- fmt.Fprintf(b, "digraph \"%p\" {\n", c.Type)
- fmt.Fprintln(b, "mclimit=1.5;\nrankdir=TD;\nordering=out;\nnode[shape=box];")
- for code := c; !code.IsEnd(); {
- label := code.Op.String()
- fmt.Fprintf(b, "\"%p\" [label=%q];\n", code, label)
- if p := code.Next; p != nil {
- edges = append(edges, edge{
- from: code,
- to: p,
- label: "Next",
- weight: 10,
- })
- }
- if p := code.NextField; p != nil {
- edges = append(edges, edge{
- from: code,
- to: p,
- label: "NextField",
- weight: 2,
- })
- }
- if p := code.End; p != nil {
- edges = append(edges, edge{
- from: code,
- to: p,
- label: "End",
- weight: 1,
- })
- }
- if p := code.Jmp; p != nil {
- edges = append(edges, edge{
- from: code,
- to: p.Code,
- label: "Jmp",
- weight: 1,
- })
- }
-
- switch code.Op.CodeType() {
- case CodeSliceHead:
- code = code.Next
- case CodeMapHead:
- code = code.Next
- case CodeArrayElem, CodeSliceElem:
- code = code.End
- case CodeMapKey:
- code = code.End
- case CodeMapValue:
- code = code.Next
- case CodeMapEnd:
- code = code.Next
- case CodeStructField:
- code = code.Next
- case CodeStructEnd:
- code = code.Next
- default:
- code = code.Next
- }
- if code.IsEnd() {
- fmt.Fprintf(b, "\"%p\" [label=%q];\n", code, code.Op.String())
- }
- }
- sort.Slice(edges, func(i, j int) bool {
- return edges[i].to.DisplayIdx < edges[j].to.DisplayIdx
- })
- for _, e := range edges {
- fmt.Fprintf(b, "\"%p\" -> \"%p\" [label=%q][weight=%d];\n", e.from, e.to, e.label, e.weight)
- }
- fmt.Fprint(b, "}")
- return b.String()
-}
-
-func newSliceHeaderCode(ctx *compileContext, typ *runtime.Type) *Opcode {
- idx := opcodeOffset(ctx.ptrIndex)
- ctx.incPtrIndex()
- elemIdx := opcodeOffset(ctx.ptrIndex)
- ctx.incPtrIndex()
- length := opcodeOffset(ctx.ptrIndex)
- return &Opcode{
- Op: OpSlice,
- Type: typ,
- Idx: idx,
- DisplayIdx: ctx.opcodeIndex,
- ElemIdx: elemIdx,
- Length: length,
- Indent: ctx.indent,
- }
-}
-
-func newSliceElemCode(ctx *compileContext, typ *runtime.Type, head *Opcode, size uintptr) *Opcode {
- return &Opcode{
- Op: OpSliceElem,
- Type: typ,
- Idx: head.Idx,
- DisplayIdx: ctx.opcodeIndex,
- ElemIdx: head.ElemIdx,
- Length: head.Length,
- Indent: ctx.indent,
- Size: uint32(size),
- }
-}
-
-func newArrayHeaderCode(ctx *compileContext, typ *runtime.Type, alen int) *Opcode {
- idx := opcodeOffset(ctx.ptrIndex)
- ctx.incPtrIndex()
- elemIdx := opcodeOffset(ctx.ptrIndex)
- return &Opcode{
- Op: OpArray,
- Type: typ,
- Idx: idx,
- DisplayIdx: ctx.opcodeIndex,
- ElemIdx: elemIdx,
- Indent: ctx.indent,
- Length: uint32(alen),
- }
-}
-
-func newArrayElemCode(ctx *compileContext, typ *runtime.Type, head *Opcode, length int, size uintptr) *Opcode {
- return &Opcode{
- Op: OpArrayElem,
- Type: typ,
- Idx: head.Idx,
- DisplayIdx: ctx.opcodeIndex,
- ElemIdx: head.ElemIdx,
- Length: uint32(length),
- Indent: ctx.indent,
- Size: uint32(size),
- }
-}
-
-func newMapHeaderCode(ctx *compileContext, typ *runtime.Type) *Opcode {
- idx := opcodeOffset(ctx.ptrIndex)
- ctx.incPtrIndex()
- return &Opcode{
- Op: OpMap,
- Type: typ,
- Idx: idx,
- DisplayIdx: ctx.opcodeIndex,
- Indent: ctx.indent,
- }
-}
-
-func newMapKeyCode(ctx *compileContext, typ *runtime.Type, head *Opcode) *Opcode {
- return &Opcode{
- Op: OpMapKey,
- Type: typ,
- Idx: head.Idx,
- DisplayIdx: ctx.opcodeIndex,
- Indent: ctx.indent,
- }
-}
-
-func newMapValueCode(ctx *compileContext, typ *runtime.Type, head *Opcode) *Opcode {
- return &Opcode{
- Op: OpMapValue,
- Type: typ,
- Idx: head.Idx,
- DisplayIdx: ctx.opcodeIndex,
- Indent: ctx.indent,
- }
-}
-
-func newMapEndCode(ctx *compileContext, typ *runtime.Type, head *Opcode) *Opcode {
- return &Opcode{
- Op: OpMapEnd,
- Type: typ,
- Idx: head.Idx,
- DisplayIdx: ctx.opcodeIndex,
- Indent: ctx.indent,
- Next: newEndOp(ctx, typ),
- }
-}
-
-func newRecursiveCode(ctx *compileContext, typ *runtime.Type, jmp *CompiledCode) *Opcode {
- return &Opcode{
- Op: OpRecursive,
- Type: typ,
- Idx: opcodeOffset(ctx.ptrIndex),
- Next: newEndOp(ctx, typ),
- DisplayIdx: ctx.opcodeIndex,
- Indent: ctx.indent,
- Jmp: jmp,
- }
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/option.go b/vendor/github.com/goccy/go-json/internal/encoder/option.go
deleted file mode 100644
index 12c58e46c01..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/option.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package encoder
-
-import (
- "context"
- "io"
-)
-
-type OptionFlag uint8
-
-const (
- HTMLEscapeOption OptionFlag = 1 << iota
- IndentOption
- UnorderedMapOption
- DebugOption
- ColorizeOption
- ContextOption
- NormalizeUTF8Option
- FieldQueryOption
-)
-
-type Option struct {
- Flag OptionFlag
- ColorScheme *ColorScheme
- Context context.Context
- DebugOut io.Writer
- DebugDOTOut io.WriteCloser
-}
-
-type EncodeFormat struct {
- Header string
- Footer string
-}
-
-type EncodeFormatScheme struct {
- Int EncodeFormat
- Uint EncodeFormat
- Float EncodeFormat
- Bool EncodeFormat
- String EncodeFormat
- Binary EncodeFormat
- ObjectKey EncodeFormat
- Null EncodeFormat
-}
-
-type (
- ColorScheme = EncodeFormatScheme
- ColorFormat = EncodeFormat
-)
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/optype.go b/vendor/github.com/goccy/go-json/internal/encoder/optype.go
deleted file mode 100644
index 5c1241b47d0..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/optype.go
+++ /dev/null
@@ -1,932 +0,0 @@
-// Code generated by internal/cmd/generator. DO NOT EDIT!
-package encoder
-
-import (
- "strings"
-)
-
-type CodeType int
-
-const (
- CodeOp CodeType = 0
- CodeArrayHead CodeType = 1
- CodeArrayElem CodeType = 2
- CodeSliceHead CodeType = 3
- CodeSliceElem CodeType = 4
- CodeMapHead CodeType = 5
- CodeMapKey CodeType = 6
- CodeMapValue CodeType = 7
- CodeMapEnd CodeType = 8
- CodeRecursive CodeType = 9
- CodeStructField CodeType = 10
- CodeStructEnd CodeType = 11
-)
-
-var opTypeStrings = [400]string{
- "End",
- "Interface",
- "Ptr",
- "SliceElem",
- "SliceEnd",
- "ArrayElem",
- "ArrayEnd",
- "MapKey",
- "MapValue",
- "MapEnd",
- "Recursive",
- "RecursivePtr",
- "RecursiveEnd",
- "InterfaceEnd",
- "Int",
- "Uint",
- "Float32",
- "Float64",
- "Bool",
- "String",
- "Bytes",
- "Number",
- "Array",
- "Map",
- "Slice",
- "Struct",
- "MarshalJSON",
- "MarshalText",
- "IntString",
- "UintString",
- "Float32String",
- "Float64String",
- "BoolString",
- "StringString",
- "NumberString",
- "IntPtr",
- "UintPtr",
- "Float32Ptr",
- "Float64Ptr",
- "BoolPtr",
- "StringPtr",
- "BytesPtr",
- "NumberPtr",
- "ArrayPtr",
- "MapPtr",
- "SlicePtr",
- "MarshalJSONPtr",
- "MarshalTextPtr",
- "InterfacePtr",
- "IntPtrString",
- "UintPtrString",
- "Float32PtrString",
- "Float64PtrString",
- "BoolPtrString",
- "StringPtrString",
- "NumberPtrString",
- "StructHeadInt",
- "StructHeadOmitEmptyInt",
- "StructPtrHeadInt",
- "StructPtrHeadOmitEmptyInt",
- "StructHeadUint",
- "StructHeadOmitEmptyUint",
- "StructPtrHeadUint",
- "StructPtrHeadOmitEmptyUint",
- "StructHeadFloat32",
- "StructHeadOmitEmptyFloat32",
- "StructPtrHeadFloat32",
- "StructPtrHeadOmitEmptyFloat32",
- "StructHeadFloat64",
- "StructHeadOmitEmptyFloat64",
- "StructPtrHeadFloat64",
- "StructPtrHeadOmitEmptyFloat64",
- "StructHeadBool",
- "StructHeadOmitEmptyBool",
- "StructPtrHeadBool",
- "StructPtrHeadOmitEmptyBool",
- "StructHeadString",
- "StructHeadOmitEmptyString",
- "StructPtrHeadString",
- "StructPtrHeadOmitEmptyString",
- "StructHeadBytes",
- "StructHeadOmitEmptyBytes",
- "StructPtrHeadBytes",
- "StructPtrHeadOmitEmptyBytes",
- "StructHeadNumber",
- "StructHeadOmitEmptyNumber",
- "StructPtrHeadNumber",
- "StructPtrHeadOmitEmptyNumber",
- "StructHeadArray",
- "StructHeadOmitEmptyArray",
- "StructPtrHeadArray",
- "StructPtrHeadOmitEmptyArray",
- "StructHeadMap",
- "StructHeadOmitEmptyMap",
- "StructPtrHeadMap",
- "StructPtrHeadOmitEmptyMap",
- "StructHeadSlice",
- "StructHeadOmitEmptySlice",
- "StructPtrHeadSlice",
- "StructPtrHeadOmitEmptySlice",
- "StructHeadStruct",
- "StructHeadOmitEmptyStruct",
- "StructPtrHeadStruct",
- "StructPtrHeadOmitEmptyStruct",
- "StructHeadMarshalJSON",
- "StructHeadOmitEmptyMarshalJSON",
- "StructPtrHeadMarshalJSON",
- "StructPtrHeadOmitEmptyMarshalJSON",
- "StructHeadMarshalText",
- "StructHeadOmitEmptyMarshalText",
- "StructPtrHeadMarshalText",
- "StructPtrHeadOmitEmptyMarshalText",
- "StructHeadIntString",
- "StructHeadOmitEmptyIntString",
- "StructPtrHeadIntString",
- "StructPtrHeadOmitEmptyIntString",
- "StructHeadUintString",
- "StructHeadOmitEmptyUintString",
- "StructPtrHeadUintString",
- "StructPtrHeadOmitEmptyUintString",
- "StructHeadFloat32String",
- "StructHeadOmitEmptyFloat32String",
- "StructPtrHeadFloat32String",
- "StructPtrHeadOmitEmptyFloat32String",
- "StructHeadFloat64String",
- "StructHeadOmitEmptyFloat64String",
- "StructPtrHeadFloat64String",
- "StructPtrHeadOmitEmptyFloat64String",
- "StructHeadBoolString",
- "StructHeadOmitEmptyBoolString",
- "StructPtrHeadBoolString",
- "StructPtrHeadOmitEmptyBoolString",
- "StructHeadStringString",
- "StructHeadOmitEmptyStringString",
- "StructPtrHeadStringString",
- "StructPtrHeadOmitEmptyStringString",
- "StructHeadNumberString",
- "StructHeadOmitEmptyNumberString",
- "StructPtrHeadNumberString",
- "StructPtrHeadOmitEmptyNumberString",
- "StructHeadIntPtr",
- "StructHeadOmitEmptyIntPtr",
- "StructPtrHeadIntPtr",
- "StructPtrHeadOmitEmptyIntPtr",
- "StructHeadUintPtr",
- "StructHeadOmitEmptyUintPtr",
- "StructPtrHeadUintPtr",
- "StructPtrHeadOmitEmptyUintPtr",
- "StructHeadFloat32Ptr",
- "StructHeadOmitEmptyFloat32Ptr",
- "StructPtrHeadFloat32Ptr",
- "StructPtrHeadOmitEmptyFloat32Ptr",
- "StructHeadFloat64Ptr",
- "StructHeadOmitEmptyFloat64Ptr",
- "StructPtrHeadFloat64Ptr",
- "StructPtrHeadOmitEmptyFloat64Ptr",
- "StructHeadBoolPtr",
- "StructHeadOmitEmptyBoolPtr",
- "StructPtrHeadBoolPtr",
- "StructPtrHeadOmitEmptyBoolPtr",
- "StructHeadStringPtr",
- "StructHeadOmitEmptyStringPtr",
- "StructPtrHeadStringPtr",
- "StructPtrHeadOmitEmptyStringPtr",
- "StructHeadBytesPtr",
- "StructHeadOmitEmptyBytesPtr",
- "StructPtrHeadBytesPtr",
- "StructPtrHeadOmitEmptyBytesPtr",
- "StructHeadNumberPtr",
- "StructHeadOmitEmptyNumberPtr",
- "StructPtrHeadNumberPtr",
- "StructPtrHeadOmitEmptyNumberPtr",
- "StructHeadArrayPtr",
- "StructHeadOmitEmptyArrayPtr",
- "StructPtrHeadArrayPtr",
- "StructPtrHeadOmitEmptyArrayPtr",
- "StructHeadMapPtr",
- "StructHeadOmitEmptyMapPtr",
- "StructPtrHeadMapPtr",
- "StructPtrHeadOmitEmptyMapPtr",
- "StructHeadSlicePtr",
- "StructHeadOmitEmptySlicePtr",
- "StructPtrHeadSlicePtr",
- "StructPtrHeadOmitEmptySlicePtr",
- "StructHeadMarshalJSONPtr",
- "StructHeadOmitEmptyMarshalJSONPtr",
- "StructPtrHeadMarshalJSONPtr",
- "StructPtrHeadOmitEmptyMarshalJSONPtr",
- "StructHeadMarshalTextPtr",
- "StructHeadOmitEmptyMarshalTextPtr",
- "StructPtrHeadMarshalTextPtr",
- "StructPtrHeadOmitEmptyMarshalTextPtr",
- "StructHeadInterfacePtr",
- "StructHeadOmitEmptyInterfacePtr",
- "StructPtrHeadInterfacePtr",
- "StructPtrHeadOmitEmptyInterfacePtr",
- "StructHeadIntPtrString",
- "StructHeadOmitEmptyIntPtrString",
- "StructPtrHeadIntPtrString",
- "StructPtrHeadOmitEmptyIntPtrString",
- "StructHeadUintPtrString",
- "StructHeadOmitEmptyUintPtrString",
- "StructPtrHeadUintPtrString",
- "StructPtrHeadOmitEmptyUintPtrString",
- "StructHeadFloat32PtrString",
- "StructHeadOmitEmptyFloat32PtrString",
- "StructPtrHeadFloat32PtrString",
- "StructPtrHeadOmitEmptyFloat32PtrString",
- "StructHeadFloat64PtrString",
- "StructHeadOmitEmptyFloat64PtrString",
- "StructPtrHeadFloat64PtrString",
- "StructPtrHeadOmitEmptyFloat64PtrString",
- "StructHeadBoolPtrString",
- "StructHeadOmitEmptyBoolPtrString",
- "StructPtrHeadBoolPtrString",
- "StructPtrHeadOmitEmptyBoolPtrString",
- "StructHeadStringPtrString",
- "StructHeadOmitEmptyStringPtrString",
- "StructPtrHeadStringPtrString",
- "StructPtrHeadOmitEmptyStringPtrString",
- "StructHeadNumberPtrString",
- "StructHeadOmitEmptyNumberPtrString",
- "StructPtrHeadNumberPtrString",
- "StructPtrHeadOmitEmptyNumberPtrString",
- "StructHead",
- "StructHeadOmitEmpty",
- "StructPtrHead",
- "StructPtrHeadOmitEmpty",
- "StructFieldInt",
- "StructFieldOmitEmptyInt",
- "StructEndInt",
- "StructEndOmitEmptyInt",
- "StructFieldUint",
- "StructFieldOmitEmptyUint",
- "StructEndUint",
- "StructEndOmitEmptyUint",
- "StructFieldFloat32",
- "StructFieldOmitEmptyFloat32",
- "StructEndFloat32",
- "StructEndOmitEmptyFloat32",
- "StructFieldFloat64",
- "StructFieldOmitEmptyFloat64",
- "StructEndFloat64",
- "StructEndOmitEmptyFloat64",
- "StructFieldBool",
- "StructFieldOmitEmptyBool",
- "StructEndBool",
- "StructEndOmitEmptyBool",
- "StructFieldString",
- "StructFieldOmitEmptyString",
- "StructEndString",
- "StructEndOmitEmptyString",
- "StructFieldBytes",
- "StructFieldOmitEmptyBytes",
- "StructEndBytes",
- "StructEndOmitEmptyBytes",
- "StructFieldNumber",
- "StructFieldOmitEmptyNumber",
- "StructEndNumber",
- "StructEndOmitEmptyNumber",
- "StructFieldArray",
- "StructFieldOmitEmptyArray",
- "StructEndArray",
- "StructEndOmitEmptyArray",
- "StructFieldMap",
- "StructFieldOmitEmptyMap",
- "StructEndMap",
- "StructEndOmitEmptyMap",
- "StructFieldSlice",
- "StructFieldOmitEmptySlice",
- "StructEndSlice",
- "StructEndOmitEmptySlice",
- "StructFieldStruct",
- "StructFieldOmitEmptyStruct",
- "StructEndStruct",
- "StructEndOmitEmptyStruct",
- "StructFieldMarshalJSON",
- "StructFieldOmitEmptyMarshalJSON",
- "StructEndMarshalJSON",
- "StructEndOmitEmptyMarshalJSON",
- "StructFieldMarshalText",
- "StructFieldOmitEmptyMarshalText",
- "StructEndMarshalText",
- "StructEndOmitEmptyMarshalText",
- "StructFieldIntString",
- "StructFieldOmitEmptyIntString",
- "StructEndIntString",
- "StructEndOmitEmptyIntString",
- "StructFieldUintString",
- "StructFieldOmitEmptyUintString",
- "StructEndUintString",
- "StructEndOmitEmptyUintString",
- "StructFieldFloat32String",
- "StructFieldOmitEmptyFloat32String",
- "StructEndFloat32String",
- "StructEndOmitEmptyFloat32String",
- "StructFieldFloat64String",
- "StructFieldOmitEmptyFloat64String",
- "StructEndFloat64String",
- "StructEndOmitEmptyFloat64String",
- "StructFieldBoolString",
- "StructFieldOmitEmptyBoolString",
- "StructEndBoolString",
- "StructEndOmitEmptyBoolString",
- "StructFieldStringString",
- "StructFieldOmitEmptyStringString",
- "StructEndStringString",
- "StructEndOmitEmptyStringString",
- "StructFieldNumberString",
- "StructFieldOmitEmptyNumberString",
- "StructEndNumberString",
- "StructEndOmitEmptyNumberString",
- "StructFieldIntPtr",
- "StructFieldOmitEmptyIntPtr",
- "StructEndIntPtr",
- "StructEndOmitEmptyIntPtr",
- "StructFieldUintPtr",
- "StructFieldOmitEmptyUintPtr",
- "StructEndUintPtr",
- "StructEndOmitEmptyUintPtr",
- "StructFieldFloat32Ptr",
- "StructFieldOmitEmptyFloat32Ptr",
- "StructEndFloat32Ptr",
- "StructEndOmitEmptyFloat32Ptr",
- "StructFieldFloat64Ptr",
- "StructFieldOmitEmptyFloat64Ptr",
- "StructEndFloat64Ptr",
- "StructEndOmitEmptyFloat64Ptr",
- "StructFieldBoolPtr",
- "StructFieldOmitEmptyBoolPtr",
- "StructEndBoolPtr",
- "StructEndOmitEmptyBoolPtr",
- "StructFieldStringPtr",
- "StructFieldOmitEmptyStringPtr",
- "StructEndStringPtr",
- "StructEndOmitEmptyStringPtr",
- "StructFieldBytesPtr",
- "StructFieldOmitEmptyBytesPtr",
- "StructEndBytesPtr",
- "StructEndOmitEmptyBytesPtr",
- "StructFieldNumberPtr",
- "StructFieldOmitEmptyNumberPtr",
- "StructEndNumberPtr",
- "StructEndOmitEmptyNumberPtr",
- "StructFieldArrayPtr",
- "StructFieldOmitEmptyArrayPtr",
- "StructEndArrayPtr",
- "StructEndOmitEmptyArrayPtr",
- "StructFieldMapPtr",
- "StructFieldOmitEmptyMapPtr",
- "StructEndMapPtr",
- "StructEndOmitEmptyMapPtr",
- "StructFieldSlicePtr",
- "StructFieldOmitEmptySlicePtr",
- "StructEndSlicePtr",
- "StructEndOmitEmptySlicePtr",
- "StructFieldMarshalJSONPtr",
- "StructFieldOmitEmptyMarshalJSONPtr",
- "StructEndMarshalJSONPtr",
- "StructEndOmitEmptyMarshalJSONPtr",
- "StructFieldMarshalTextPtr",
- "StructFieldOmitEmptyMarshalTextPtr",
- "StructEndMarshalTextPtr",
- "StructEndOmitEmptyMarshalTextPtr",
- "StructFieldInterfacePtr",
- "StructFieldOmitEmptyInterfacePtr",
- "StructEndInterfacePtr",
- "StructEndOmitEmptyInterfacePtr",
- "StructFieldIntPtrString",
- "StructFieldOmitEmptyIntPtrString",
- "StructEndIntPtrString",
- "StructEndOmitEmptyIntPtrString",
- "StructFieldUintPtrString",
- "StructFieldOmitEmptyUintPtrString",
- "StructEndUintPtrString",
- "StructEndOmitEmptyUintPtrString",
- "StructFieldFloat32PtrString",
- "StructFieldOmitEmptyFloat32PtrString",
- "StructEndFloat32PtrString",
- "StructEndOmitEmptyFloat32PtrString",
- "StructFieldFloat64PtrString",
- "StructFieldOmitEmptyFloat64PtrString",
- "StructEndFloat64PtrString",
- "StructEndOmitEmptyFloat64PtrString",
- "StructFieldBoolPtrString",
- "StructFieldOmitEmptyBoolPtrString",
- "StructEndBoolPtrString",
- "StructEndOmitEmptyBoolPtrString",
- "StructFieldStringPtrString",
- "StructFieldOmitEmptyStringPtrString",
- "StructEndStringPtrString",
- "StructEndOmitEmptyStringPtrString",
- "StructFieldNumberPtrString",
- "StructFieldOmitEmptyNumberPtrString",
- "StructEndNumberPtrString",
- "StructEndOmitEmptyNumberPtrString",
- "StructField",
- "StructFieldOmitEmpty",
- "StructEnd",
- "StructEndOmitEmpty",
-}
-
-type OpType uint16
-
-const (
- OpEnd OpType = 0
- OpInterface OpType = 1
- OpPtr OpType = 2
- OpSliceElem OpType = 3
- OpSliceEnd OpType = 4
- OpArrayElem OpType = 5
- OpArrayEnd OpType = 6
- OpMapKey OpType = 7
- OpMapValue OpType = 8
- OpMapEnd OpType = 9
- OpRecursive OpType = 10
- OpRecursivePtr OpType = 11
- OpRecursiveEnd OpType = 12
- OpInterfaceEnd OpType = 13
- OpInt OpType = 14
- OpUint OpType = 15
- OpFloat32 OpType = 16
- OpFloat64 OpType = 17
- OpBool OpType = 18
- OpString OpType = 19
- OpBytes OpType = 20
- OpNumber OpType = 21
- OpArray OpType = 22
- OpMap OpType = 23
- OpSlice OpType = 24
- OpStruct OpType = 25
- OpMarshalJSON OpType = 26
- OpMarshalText OpType = 27
- OpIntString OpType = 28
- OpUintString OpType = 29
- OpFloat32String OpType = 30
- OpFloat64String OpType = 31
- OpBoolString OpType = 32
- OpStringString OpType = 33
- OpNumberString OpType = 34
- OpIntPtr OpType = 35
- OpUintPtr OpType = 36
- OpFloat32Ptr OpType = 37
- OpFloat64Ptr OpType = 38
- OpBoolPtr OpType = 39
- OpStringPtr OpType = 40
- OpBytesPtr OpType = 41
- OpNumberPtr OpType = 42
- OpArrayPtr OpType = 43
- OpMapPtr OpType = 44
- OpSlicePtr OpType = 45
- OpMarshalJSONPtr OpType = 46
- OpMarshalTextPtr OpType = 47
- OpInterfacePtr OpType = 48
- OpIntPtrString OpType = 49
- OpUintPtrString OpType = 50
- OpFloat32PtrString OpType = 51
- OpFloat64PtrString OpType = 52
- OpBoolPtrString OpType = 53
- OpStringPtrString OpType = 54
- OpNumberPtrString OpType = 55
- OpStructHeadInt OpType = 56
- OpStructHeadOmitEmptyInt OpType = 57
- OpStructPtrHeadInt OpType = 58
- OpStructPtrHeadOmitEmptyInt OpType = 59
- OpStructHeadUint OpType = 60
- OpStructHeadOmitEmptyUint OpType = 61
- OpStructPtrHeadUint OpType = 62
- OpStructPtrHeadOmitEmptyUint OpType = 63
- OpStructHeadFloat32 OpType = 64
- OpStructHeadOmitEmptyFloat32 OpType = 65
- OpStructPtrHeadFloat32 OpType = 66
- OpStructPtrHeadOmitEmptyFloat32 OpType = 67
- OpStructHeadFloat64 OpType = 68
- OpStructHeadOmitEmptyFloat64 OpType = 69
- OpStructPtrHeadFloat64 OpType = 70
- OpStructPtrHeadOmitEmptyFloat64 OpType = 71
- OpStructHeadBool OpType = 72
- OpStructHeadOmitEmptyBool OpType = 73
- OpStructPtrHeadBool OpType = 74
- OpStructPtrHeadOmitEmptyBool OpType = 75
- OpStructHeadString OpType = 76
- OpStructHeadOmitEmptyString OpType = 77
- OpStructPtrHeadString OpType = 78
- OpStructPtrHeadOmitEmptyString OpType = 79
- OpStructHeadBytes OpType = 80
- OpStructHeadOmitEmptyBytes OpType = 81
- OpStructPtrHeadBytes OpType = 82
- OpStructPtrHeadOmitEmptyBytes OpType = 83
- OpStructHeadNumber OpType = 84
- OpStructHeadOmitEmptyNumber OpType = 85
- OpStructPtrHeadNumber OpType = 86
- OpStructPtrHeadOmitEmptyNumber OpType = 87
- OpStructHeadArray OpType = 88
- OpStructHeadOmitEmptyArray OpType = 89
- OpStructPtrHeadArray OpType = 90
- OpStructPtrHeadOmitEmptyArray OpType = 91
- OpStructHeadMap OpType = 92
- OpStructHeadOmitEmptyMap OpType = 93
- OpStructPtrHeadMap OpType = 94
- OpStructPtrHeadOmitEmptyMap OpType = 95
- OpStructHeadSlice OpType = 96
- OpStructHeadOmitEmptySlice OpType = 97
- OpStructPtrHeadSlice OpType = 98
- OpStructPtrHeadOmitEmptySlice OpType = 99
- OpStructHeadStruct OpType = 100
- OpStructHeadOmitEmptyStruct OpType = 101
- OpStructPtrHeadStruct OpType = 102
- OpStructPtrHeadOmitEmptyStruct OpType = 103
- OpStructHeadMarshalJSON OpType = 104
- OpStructHeadOmitEmptyMarshalJSON OpType = 105
- OpStructPtrHeadMarshalJSON OpType = 106
- OpStructPtrHeadOmitEmptyMarshalJSON OpType = 107
- OpStructHeadMarshalText OpType = 108
- OpStructHeadOmitEmptyMarshalText OpType = 109
- OpStructPtrHeadMarshalText OpType = 110
- OpStructPtrHeadOmitEmptyMarshalText OpType = 111
- OpStructHeadIntString OpType = 112
- OpStructHeadOmitEmptyIntString OpType = 113
- OpStructPtrHeadIntString OpType = 114
- OpStructPtrHeadOmitEmptyIntString OpType = 115
- OpStructHeadUintString OpType = 116
- OpStructHeadOmitEmptyUintString OpType = 117
- OpStructPtrHeadUintString OpType = 118
- OpStructPtrHeadOmitEmptyUintString OpType = 119
- OpStructHeadFloat32String OpType = 120
- OpStructHeadOmitEmptyFloat32String OpType = 121
- OpStructPtrHeadFloat32String OpType = 122
- OpStructPtrHeadOmitEmptyFloat32String OpType = 123
- OpStructHeadFloat64String OpType = 124
- OpStructHeadOmitEmptyFloat64String OpType = 125
- OpStructPtrHeadFloat64String OpType = 126
- OpStructPtrHeadOmitEmptyFloat64String OpType = 127
- OpStructHeadBoolString OpType = 128
- OpStructHeadOmitEmptyBoolString OpType = 129
- OpStructPtrHeadBoolString OpType = 130
- OpStructPtrHeadOmitEmptyBoolString OpType = 131
- OpStructHeadStringString OpType = 132
- OpStructHeadOmitEmptyStringString OpType = 133
- OpStructPtrHeadStringString OpType = 134
- OpStructPtrHeadOmitEmptyStringString OpType = 135
- OpStructHeadNumberString OpType = 136
- OpStructHeadOmitEmptyNumberString OpType = 137
- OpStructPtrHeadNumberString OpType = 138
- OpStructPtrHeadOmitEmptyNumberString OpType = 139
- OpStructHeadIntPtr OpType = 140
- OpStructHeadOmitEmptyIntPtr OpType = 141
- OpStructPtrHeadIntPtr OpType = 142
- OpStructPtrHeadOmitEmptyIntPtr OpType = 143
- OpStructHeadUintPtr OpType = 144
- OpStructHeadOmitEmptyUintPtr OpType = 145
- OpStructPtrHeadUintPtr OpType = 146
- OpStructPtrHeadOmitEmptyUintPtr OpType = 147
- OpStructHeadFloat32Ptr OpType = 148
- OpStructHeadOmitEmptyFloat32Ptr OpType = 149
- OpStructPtrHeadFloat32Ptr OpType = 150
- OpStructPtrHeadOmitEmptyFloat32Ptr OpType = 151
- OpStructHeadFloat64Ptr OpType = 152
- OpStructHeadOmitEmptyFloat64Ptr OpType = 153
- OpStructPtrHeadFloat64Ptr OpType = 154
- OpStructPtrHeadOmitEmptyFloat64Ptr OpType = 155
- OpStructHeadBoolPtr OpType = 156
- OpStructHeadOmitEmptyBoolPtr OpType = 157
- OpStructPtrHeadBoolPtr OpType = 158
- OpStructPtrHeadOmitEmptyBoolPtr OpType = 159
- OpStructHeadStringPtr OpType = 160
- OpStructHeadOmitEmptyStringPtr OpType = 161
- OpStructPtrHeadStringPtr OpType = 162
- OpStructPtrHeadOmitEmptyStringPtr OpType = 163
- OpStructHeadBytesPtr OpType = 164
- OpStructHeadOmitEmptyBytesPtr OpType = 165
- OpStructPtrHeadBytesPtr OpType = 166
- OpStructPtrHeadOmitEmptyBytesPtr OpType = 167
- OpStructHeadNumberPtr OpType = 168
- OpStructHeadOmitEmptyNumberPtr OpType = 169
- OpStructPtrHeadNumberPtr OpType = 170
- OpStructPtrHeadOmitEmptyNumberPtr OpType = 171
- OpStructHeadArrayPtr OpType = 172
- OpStructHeadOmitEmptyArrayPtr OpType = 173
- OpStructPtrHeadArrayPtr OpType = 174
- OpStructPtrHeadOmitEmptyArrayPtr OpType = 175
- OpStructHeadMapPtr OpType = 176
- OpStructHeadOmitEmptyMapPtr OpType = 177
- OpStructPtrHeadMapPtr OpType = 178
- OpStructPtrHeadOmitEmptyMapPtr OpType = 179
- OpStructHeadSlicePtr OpType = 180
- OpStructHeadOmitEmptySlicePtr OpType = 181
- OpStructPtrHeadSlicePtr OpType = 182
- OpStructPtrHeadOmitEmptySlicePtr OpType = 183
- OpStructHeadMarshalJSONPtr OpType = 184
- OpStructHeadOmitEmptyMarshalJSONPtr OpType = 185
- OpStructPtrHeadMarshalJSONPtr OpType = 186
- OpStructPtrHeadOmitEmptyMarshalJSONPtr OpType = 187
- OpStructHeadMarshalTextPtr OpType = 188
- OpStructHeadOmitEmptyMarshalTextPtr OpType = 189
- OpStructPtrHeadMarshalTextPtr OpType = 190
- OpStructPtrHeadOmitEmptyMarshalTextPtr OpType = 191
- OpStructHeadInterfacePtr OpType = 192
- OpStructHeadOmitEmptyInterfacePtr OpType = 193
- OpStructPtrHeadInterfacePtr OpType = 194
- OpStructPtrHeadOmitEmptyInterfacePtr OpType = 195
- OpStructHeadIntPtrString OpType = 196
- OpStructHeadOmitEmptyIntPtrString OpType = 197
- OpStructPtrHeadIntPtrString OpType = 198
- OpStructPtrHeadOmitEmptyIntPtrString OpType = 199
- OpStructHeadUintPtrString OpType = 200
- OpStructHeadOmitEmptyUintPtrString OpType = 201
- OpStructPtrHeadUintPtrString OpType = 202
- OpStructPtrHeadOmitEmptyUintPtrString OpType = 203
- OpStructHeadFloat32PtrString OpType = 204
- OpStructHeadOmitEmptyFloat32PtrString OpType = 205
- OpStructPtrHeadFloat32PtrString OpType = 206
- OpStructPtrHeadOmitEmptyFloat32PtrString OpType = 207
- OpStructHeadFloat64PtrString OpType = 208
- OpStructHeadOmitEmptyFloat64PtrString OpType = 209
- OpStructPtrHeadFloat64PtrString OpType = 210
- OpStructPtrHeadOmitEmptyFloat64PtrString OpType = 211
- OpStructHeadBoolPtrString OpType = 212
- OpStructHeadOmitEmptyBoolPtrString OpType = 213
- OpStructPtrHeadBoolPtrString OpType = 214
- OpStructPtrHeadOmitEmptyBoolPtrString OpType = 215
- OpStructHeadStringPtrString OpType = 216
- OpStructHeadOmitEmptyStringPtrString OpType = 217
- OpStructPtrHeadStringPtrString OpType = 218
- OpStructPtrHeadOmitEmptyStringPtrString OpType = 219
- OpStructHeadNumberPtrString OpType = 220
- OpStructHeadOmitEmptyNumberPtrString OpType = 221
- OpStructPtrHeadNumberPtrString OpType = 222
- OpStructPtrHeadOmitEmptyNumberPtrString OpType = 223
- OpStructHead OpType = 224
- OpStructHeadOmitEmpty OpType = 225
- OpStructPtrHead OpType = 226
- OpStructPtrHeadOmitEmpty OpType = 227
- OpStructFieldInt OpType = 228
- OpStructFieldOmitEmptyInt OpType = 229
- OpStructEndInt OpType = 230
- OpStructEndOmitEmptyInt OpType = 231
- OpStructFieldUint OpType = 232
- OpStructFieldOmitEmptyUint OpType = 233
- OpStructEndUint OpType = 234
- OpStructEndOmitEmptyUint OpType = 235
- OpStructFieldFloat32 OpType = 236
- OpStructFieldOmitEmptyFloat32 OpType = 237
- OpStructEndFloat32 OpType = 238
- OpStructEndOmitEmptyFloat32 OpType = 239
- OpStructFieldFloat64 OpType = 240
- OpStructFieldOmitEmptyFloat64 OpType = 241
- OpStructEndFloat64 OpType = 242
- OpStructEndOmitEmptyFloat64 OpType = 243
- OpStructFieldBool OpType = 244
- OpStructFieldOmitEmptyBool OpType = 245
- OpStructEndBool OpType = 246
- OpStructEndOmitEmptyBool OpType = 247
- OpStructFieldString OpType = 248
- OpStructFieldOmitEmptyString OpType = 249
- OpStructEndString OpType = 250
- OpStructEndOmitEmptyString OpType = 251
- OpStructFieldBytes OpType = 252
- OpStructFieldOmitEmptyBytes OpType = 253
- OpStructEndBytes OpType = 254
- OpStructEndOmitEmptyBytes OpType = 255
- OpStructFieldNumber OpType = 256
- OpStructFieldOmitEmptyNumber OpType = 257
- OpStructEndNumber OpType = 258
- OpStructEndOmitEmptyNumber OpType = 259
- OpStructFieldArray OpType = 260
- OpStructFieldOmitEmptyArray OpType = 261
- OpStructEndArray OpType = 262
- OpStructEndOmitEmptyArray OpType = 263
- OpStructFieldMap OpType = 264
- OpStructFieldOmitEmptyMap OpType = 265
- OpStructEndMap OpType = 266
- OpStructEndOmitEmptyMap OpType = 267
- OpStructFieldSlice OpType = 268
- OpStructFieldOmitEmptySlice OpType = 269
- OpStructEndSlice OpType = 270
- OpStructEndOmitEmptySlice OpType = 271
- OpStructFieldStruct OpType = 272
- OpStructFieldOmitEmptyStruct OpType = 273
- OpStructEndStruct OpType = 274
- OpStructEndOmitEmptyStruct OpType = 275
- OpStructFieldMarshalJSON OpType = 276
- OpStructFieldOmitEmptyMarshalJSON OpType = 277
- OpStructEndMarshalJSON OpType = 278
- OpStructEndOmitEmptyMarshalJSON OpType = 279
- OpStructFieldMarshalText OpType = 280
- OpStructFieldOmitEmptyMarshalText OpType = 281
- OpStructEndMarshalText OpType = 282
- OpStructEndOmitEmptyMarshalText OpType = 283
- OpStructFieldIntString OpType = 284
- OpStructFieldOmitEmptyIntString OpType = 285
- OpStructEndIntString OpType = 286
- OpStructEndOmitEmptyIntString OpType = 287
- OpStructFieldUintString OpType = 288
- OpStructFieldOmitEmptyUintString OpType = 289
- OpStructEndUintString OpType = 290
- OpStructEndOmitEmptyUintString OpType = 291
- OpStructFieldFloat32String OpType = 292
- OpStructFieldOmitEmptyFloat32String OpType = 293
- OpStructEndFloat32String OpType = 294
- OpStructEndOmitEmptyFloat32String OpType = 295
- OpStructFieldFloat64String OpType = 296
- OpStructFieldOmitEmptyFloat64String OpType = 297
- OpStructEndFloat64String OpType = 298
- OpStructEndOmitEmptyFloat64String OpType = 299
- OpStructFieldBoolString OpType = 300
- OpStructFieldOmitEmptyBoolString OpType = 301
- OpStructEndBoolString OpType = 302
- OpStructEndOmitEmptyBoolString OpType = 303
- OpStructFieldStringString OpType = 304
- OpStructFieldOmitEmptyStringString OpType = 305
- OpStructEndStringString OpType = 306
- OpStructEndOmitEmptyStringString OpType = 307
- OpStructFieldNumberString OpType = 308
- OpStructFieldOmitEmptyNumberString OpType = 309
- OpStructEndNumberString OpType = 310
- OpStructEndOmitEmptyNumberString OpType = 311
- OpStructFieldIntPtr OpType = 312
- OpStructFieldOmitEmptyIntPtr OpType = 313
- OpStructEndIntPtr OpType = 314
- OpStructEndOmitEmptyIntPtr OpType = 315
- OpStructFieldUintPtr OpType = 316
- OpStructFieldOmitEmptyUintPtr OpType = 317
- OpStructEndUintPtr OpType = 318
- OpStructEndOmitEmptyUintPtr OpType = 319
- OpStructFieldFloat32Ptr OpType = 320
- OpStructFieldOmitEmptyFloat32Ptr OpType = 321
- OpStructEndFloat32Ptr OpType = 322
- OpStructEndOmitEmptyFloat32Ptr OpType = 323
- OpStructFieldFloat64Ptr OpType = 324
- OpStructFieldOmitEmptyFloat64Ptr OpType = 325
- OpStructEndFloat64Ptr OpType = 326
- OpStructEndOmitEmptyFloat64Ptr OpType = 327
- OpStructFieldBoolPtr OpType = 328
- OpStructFieldOmitEmptyBoolPtr OpType = 329
- OpStructEndBoolPtr OpType = 330
- OpStructEndOmitEmptyBoolPtr OpType = 331
- OpStructFieldStringPtr OpType = 332
- OpStructFieldOmitEmptyStringPtr OpType = 333
- OpStructEndStringPtr OpType = 334
- OpStructEndOmitEmptyStringPtr OpType = 335
- OpStructFieldBytesPtr OpType = 336
- OpStructFieldOmitEmptyBytesPtr OpType = 337
- OpStructEndBytesPtr OpType = 338
- OpStructEndOmitEmptyBytesPtr OpType = 339
- OpStructFieldNumberPtr OpType = 340
- OpStructFieldOmitEmptyNumberPtr OpType = 341
- OpStructEndNumberPtr OpType = 342
- OpStructEndOmitEmptyNumberPtr OpType = 343
- OpStructFieldArrayPtr OpType = 344
- OpStructFieldOmitEmptyArrayPtr OpType = 345
- OpStructEndArrayPtr OpType = 346
- OpStructEndOmitEmptyArrayPtr OpType = 347
- OpStructFieldMapPtr OpType = 348
- OpStructFieldOmitEmptyMapPtr OpType = 349
- OpStructEndMapPtr OpType = 350
- OpStructEndOmitEmptyMapPtr OpType = 351
- OpStructFieldSlicePtr OpType = 352
- OpStructFieldOmitEmptySlicePtr OpType = 353
- OpStructEndSlicePtr OpType = 354
- OpStructEndOmitEmptySlicePtr OpType = 355
- OpStructFieldMarshalJSONPtr OpType = 356
- OpStructFieldOmitEmptyMarshalJSONPtr OpType = 357
- OpStructEndMarshalJSONPtr OpType = 358
- OpStructEndOmitEmptyMarshalJSONPtr OpType = 359
- OpStructFieldMarshalTextPtr OpType = 360
- OpStructFieldOmitEmptyMarshalTextPtr OpType = 361
- OpStructEndMarshalTextPtr OpType = 362
- OpStructEndOmitEmptyMarshalTextPtr OpType = 363
- OpStructFieldInterfacePtr OpType = 364
- OpStructFieldOmitEmptyInterfacePtr OpType = 365
- OpStructEndInterfacePtr OpType = 366
- OpStructEndOmitEmptyInterfacePtr OpType = 367
- OpStructFieldIntPtrString OpType = 368
- OpStructFieldOmitEmptyIntPtrString OpType = 369
- OpStructEndIntPtrString OpType = 370
- OpStructEndOmitEmptyIntPtrString OpType = 371
- OpStructFieldUintPtrString OpType = 372
- OpStructFieldOmitEmptyUintPtrString OpType = 373
- OpStructEndUintPtrString OpType = 374
- OpStructEndOmitEmptyUintPtrString OpType = 375
- OpStructFieldFloat32PtrString OpType = 376
- OpStructFieldOmitEmptyFloat32PtrString OpType = 377
- OpStructEndFloat32PtrString OpType = 378
- OpStructEndOmitEmptyFloat32PtrString OpType = 379
- OpStructFieldFloat64PtrString OpType = 380
- OpStructFieldOmitEmptyFloat64PtrString OpType = 381
- OpStructEndFloat64PtrString OpType = 382
- OpStructEndOmitEmptyFloat64PtrString OpType = 383
- OpStructFieldBoolPtrString OpType = 384
- OpStructFieldOmitEmptyBoolPtrString OpType = 385
- OpStructEndBoolPtrString OpType = 386
- OpStructEndOmitEmptyBoolPtrString OpType = 387
- OpStructFieldStringPtrString OpType = 388
- OpStructFieldOmitEmptyStringPtrString OpType = 389
- OpStructEndStringPtrString OpType = 390
- OpStructEndOmitEmptyStringPtrString OpType = 391
- OpStructFieldNumberPtrString OpType = 392
- OpStructFieldOmitEmptyNumberPtrString OpType = 393
- OpStructEndNumberPtrString OpType = 394
- OpStructEndOmitEmptyNumberPtrString OpType = 395
- OpStructField OpType = 396
- OpStructFieldOmitEmpty OpType = 397
- OpStructEnd OpType = 398
- OpStructEndOmitEmpty OpType = 399
-)
-
-func (t OpType) String() string {
- if int(t) >= 400 {
- return ""
- }
- return opTypeStrings[int(t)]
-}
-
-func (t OpType) CodeType() CodeType {
- if strings.Contains(t.String(), "Struct") {
- if strings.Contains(t.String(), "End") {
- return CodeStructEnd
- }
- return CodeStructField
- }
- switch t {
- case OpArray, OpArrayPtr:
- return CodeArrayHead
- case OpArrayElem:
- return CodeArrayElem
- case OpSlice, OpSlicePtr:
- return CodeSliceHead
- case OpSliceElem:
- return CodeSliceElem
- case OpMap, OpMapPtr:
- return CodeMapHead
- case OpMapKey:
- return CodeMapKey
- case OpMapValue:
- return CodeMapValue
- case OpMapEnd:
- return CodeMapEnd
- }
-
- return CodeOp
-}
-
-func (t OpType) HeadToPtrHead() OpType {
- if strings.Index(t.String(), "PtrHead") > 0 {
- return t
- }
-
- idx := strings.Index(t.String(), "Head")
- if idx == -1 {
- return t
- }
- suffix := "PtrHead" + t.String()[idx+len("Head"):]
-
- const toPtrOffset = 2
- if strings.Contains(OpType(int(t)+toPtrOffset).String(), suffix) {
- return OpType(int(t) + toPtrOffset)
- }
- return t
-}
-
-func (t OpType) HeadToOmitEmptyHead() OpType {
- const toOmitEmptyOffset = 1
- if strings.Contains(OpType(int(t)+toOmitEmptyOffset).String(), "OmitEmpty") {
- return OpType(int(t) + toOmitEmptyOffset)
- }
-
- return t
-}
-
-func (t OpType) PtrHeadToHead() OpType {
- idx := strings.Index(t.String(), "PtrHead")
- if idx == -1 {
- return t
- }
- suffix := t.String()[idx+len("Ptr"):]
-
- const toPtrOffset = 2
- if strings.Contains(OpType(int(t)-toPtrOffset).String(), suffix) {
- return OpType(int(t) - toPtrOffset)
- }
- return t
-}
-
-func (t OpType) FieldToEnd() OpType {
- idx := strings.Index(t.String(), "Field")
- if idx == -1 {
- return t
- }
- suffix := t.String()[idx+len("Field"):]
- if suffix == "" || suffix == "OmitEmpty" {
- return t
- }
- const toEndOffset = 2
- if strings.Contains(OpType(int(t)+toEndOffset).String(), "End"+suffix) {
- return OpType(int(t) + toEndOffset)
- }
- return t
-}
-
-func (t OpType) FieldToOmitEmptyField() OpType {
- const toOmitEmptyOffset = 1
- if strings.Contains(OpType(int(t)+toOmitEmptyOffset).String(), "OmitEmpty") {
- return OpType(int(t) + toOmitEmptyOffset)
- }
- return t
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/query.go b/vendor/github.com/goccy/go-json/internal/encoder/query.go
deleted file mode 100644
index 1e1850cc153..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/query.go
+++ /dev/null
@@ -1,135 +0,0 @@
-package encoder
-
-import (
- "context"
- "fmt"
- "reflect"
-)
-
-var (
- Marshal func(interface{}) ([]byte, error)
- Unmarshal func([]byte, interface{}) error
-)
-
-type FieldQuery struct {
- Name string
- Fields []*FieldQuery
- hash string
-}
-
-func (q *FieldQuery) Hash() string {
- if q.hash != "" {
- return q.hash
- }
- b, _ := Marshal(q)
- q.hash = string(b)
- return q.hash
-}
-
-func (q *FieldQuery) MarshalJSON() ([]byte, error) {
- if q.Name != "" {
- if len(q.Fields) > 0 {
- return Marshal(map[string][]*FieldQuery{q.Name: q.Fields})
- }
- return Marshal(q.Name)
- }
- return Marshal(q.Fields)
-}
-
-func (q *FieldQuery) QueryString() (FieldQueryString, error) {
- b, err := Marshal(q)
- if err != nil {
- return "", err
- }
- return FieldQueryString(b), nil
-}
-
-type FieldQueryString string
-
-func (s FieldQueryString) Build() (*FieldQuery, error) {
- var query interface{}
- if err := Unmarshal([]byte(s), &query); err != nil {
- return nil, err
- }
- return s.build(reflect.ValueOf(query))
-}
-
-func (s FieldQueryString) build(v reflect.Value) (*FieldQuery, error) {
- switch v.Type().Kind() {
- case reflect.String:
- return s.buildString(v)
- case reflect.Map:
- return s.buildMap(v)
- case reflect.Slice:
- return s.buildSlice(v)
- case reflect.Interface:
- return s.build(reflect.ValueOf(v.Interface()))
- }
- return nil, fmt.Errorf("failed to build field query")
-}
-
-func (s FieldQueryString) buildString(v reflect.Value) (*FieldQuery, error) {
- b := []byte(v.String())
- switch b[0] {
- case '[', '{':
- var query interface{}
- if err := Unmarshal(b, &query); err != nil {
- return nil, err
- }
- if str, ok := query.(string); ok {
- return &FieldQuery{Name: str}, nil
- }
- return s.build(reflect.ValueOf(query))
- }
- return &FieldQuery{Name: string(b)}, nil
-}
-
-func (s FieldQueryString) buildSlice(v reflect.Value) (*FieldQuery, error) {
- fields := make([]*FieldQuery, 0, v.Len())
- for i := 0; i < v.Len(); i++ {
- def, err := s.build(v.Index(i))
- if err != nil {
- return nil, err
- }
- fields = append(fields, def)
- }
- return &FieldQuery{Fields: fields}, nil
-}
-
-func (s FieldQueryString) buildMap(v reflect.Value) (*FieldQuery, error) {
- keys := v.MapKeys()
- if len(keys) != 1 {
- return nil, fmt.Errorf("failed to build field query object")
- }
- key := keys[0]
- if key.Type().Kind() != reflect.String {
- return nil, fmt.Errorf("failed to build field query. invalid object key type")
- }
- name := key.String()
- def, err := s.build(v.MapIndex(key))
- if err != nil {
- return nil, err
- }
- return &FieldQuery{
- Name: name,
- Fields: def.Fields,
- }, nil
-}
-
-type queryKey struct{}
-
-func FieldQueryFromContext(ctx context.Context) *FieldQuery {
- query := ctx.Value(queryKey{})
- if query == nil {
- return nil
- }
- q, ok := query.(*FieldQuery)
- if !ok {
- return nil
- }
- return q
-}
-
-func SetFieldQueryToContext(ctx context.Context, query *FieldQuery) context.Context {
- return context.WithValue(ctx, queryKey{}, query)
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/string.go b/vendor/github.com/goccy/go-json/internal/encoder/string.go
deleted file mode 100644
index 4abb84165e9..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/string.go
+++ /dev/null
@@ -1,483 +0,0 @@
-// This files's string processing codes are inspired by https://github.com/segmentio/encoding.
-// The license notation is as follows.
-//
-// # MIT License
-//
-// Copyright (c) 2019 Segment.io, Inc.
-//
-// 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.
-package encoder
-
-import (
- "math/bits"
- "reflect"
- "unsafe"
-)
-
-const (
- lsb = 0x0101010101010101
- msb = 0x8080808080808080
-)
-
-var hex = "0123456789abcdef"
-
-//nolint:govet
-func stringToUint64Slice(s string) []uint64 {
- return *(*[]uint64)(unsafe.Pointer(&reflect.SliceHeader{
- Data: ((*reflect.StringHeader)(unsafe.Pointer(&s))).Data,
- Len: len(s) / 8,
- Cap: len(s) / 8,
- }))
-}
-
-func AppendString(ctx *RuntimeContext, buf []byte, s string) []byte {
- if ctx.Option.Flag&HTMLEscapeOption != 0 {
- if ctx.Option.Flag&NormalizeUTF8Option != 0 {
- return appendNormalizedHTMLString(buf, s)
- }
- return appendHTMLString(buf, s)
- }
- if ctx.Option.Flag&NormalizeUTF8Option != 0 {
- return appendNormalizedString(buf, s)
- }
- return appendString(buf, s)
-}
-
-func appendNormalizedHTMLString(buf []byte, s string) []byte {
- valLen := len(s)
- if valLen == 0 {
- return append(buf, `""`...)
- }
- buf = append(buf, '"')
- var (
- i, j int
- )
- if valLen >= 8 {
- chunks := stringToUint64Slice(s)
- for _, n := range chunks {
- // combine masks before checking for the MSB of each byte. We include
- // `n` in the mask to check whether any of the *input* byte MSBs were
- // set (i.e. the byte was outside the ASCII range).
- mask := n | (n - (lsb * 0x20)) |
- ((n ^ (lsb * '"')) - lsb) |
- ((n ^ (lsb * '\\')) - lsb) |
- ((n ^ (lsb * '<')) - lsb) |
- ((n ^ (lsb * '>')) - lsb) |
- ((n ^ (lsb * '&')) - lsb)
- if (mask & msb) != 0 {
- j = bits.TrailingZeros64(mask&msb) / 8
- goto ESCAPE_END
- }
- }
- for i := len(chunks) * 8; i < valLen; i++ {
- if needEscapeHTMLNormalizeUTF8[s[i]] {
- j = i
- goto ESCAPE_END
- }
- }
- // no found any escape characters.
- return append(append(buf, s...), '"')
- }
-ESCAPE_END:
- for j < valLen {
- c := s[j]
-
- if !needEscapeHTMLNormalizeUTF8[c] {
- // fast path: most of the time, printable ascii characters are used
- j++
- continue
- }
-
- switch c {
- case '\\', '"':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', c)
- i = j + 1
- j = j + 1
- continue
-
- case '\n':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', 'n')
- i = j + 1
- j = j + 1
- continue
-
- case '\r':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', 'r')
- i = j + 1
- j = j + 1
- continue
-
- case '\t':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', 't')
- i = j + 1
- j = j + 1
- continue
-
- case '<', '>', '&':
- buf = append(buf, s[i:j]...)
- buf = append(buf, `\u00`...)
- buf = append(buf, hex[c>>4], hex[c&0xF])
- i = j + 1
- j = j + 1
- continue
-
- case 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x0B, 0x0C, 0x0E, 0x0F, // 0x00-0x0F
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F: // 0x10-0x1F
- buf = append(buf, s[i:j]...)
- buf = append(buf, `\u00`...)
- buf = append(buf, hex[c>>4], hex[c&0xF])
- i = j + 1
- j = j + 1
- continue
- }
- state, size := decodeRuneInString(s[j:])
- switch state {
- case runeErrorState:
- buf = append(buf, s[i:j]...)
- buf = append(buf, `\ufffd`...)
- i = j + 1
- j = j + 1
- continue
- // U+2028 is LINE SEPARATOR.
- // U+2029 is PARAGRAPH SEPARATOR.
- // They are both technically valid characters in JSON strings,
- // but don't work in JSONP, which has to be evaluated as JavaScript,
- // and can lead to security holes there. It is valid JSON to
- // escape them, so we do so unconditionally.
- // See http://timelessrepo.com/json-isnt-a-javascript-subset for discussion.
- case lineSepState:
- buf = append(buf, s[i:j]...)
- buf = append(buf, `\u2028`...)
- i = j + 3
- j = j + 3
- continue
- case paragraphSepState:
- buf = append(buf, s[i:j]...)
- buf = append(buf, `\u2029`...)
- i = j + 3
- j = j + 3
- continue
- }
- j += size
- }
-
- return append(append(buf, s[i:]...), '"')
-}
-
-func appendHTMLString(buf []byte, s string) []byte {
- valLen := len(s)
- if valLen == 0 {
- return append(buf, `""`...)
- }
- buf = append(buf, '"')
- var (
- i, j int
- )
- if valLen >= 8 {
- chunks := stringToUint64Slice(s)
- for _, n := range chunks {
- // combine masks before checking for the MSB of each byte. We include
- // `n` in the mask to check whether any of the *input* byte MSBs were
- // set (i.e. the byte was outside the ASCII range).
- mask := n | (n - (lsb * 0x20)) |
- ((n ^ (lsb * '"')) - lsb) |
- ((n ^ (lsb * '\\')) - lsb) |
- ((n ^ (lsb * '<')) - lsb) |
- ((n ^ (lsb * '>')) - lsb) |
- ((n ^ (lsb * '&')) - lsb)
- if (mask & msb) != 0 {
- j = bits.TrailingZeros64(mask&msb) / 8
- goto ESCAPE_END
- }
- }
- for i := len(chunks) * 8; i < valLen; i++ {
- if needEscapeHTML[s[i]] {
- j = i
- goto ESCAPE_END
- }
- }
- // no found any escape characters.
- return append(append(buf, s...), '"')
- }
-ESCAPE_END:
- for j < valLen {
- c := s[j]
-
- if !needEscapeHTML[c] {
- // fast path: most of the time, printable ascii characters are used
- j++
- continue
- }
-
- switch c {
- case '\\', '"':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', c)
- i = j + 1
- j = j + 1
- continue
-
- case '\n':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', 'n')
- i = j + 1
- j = j + 1
- continue
-
- case '\r':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', 'r')
- i = j + 1
- j = j + 1
- continue
-
- case '\t':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', 't')
- i = j + 1
- j = j + 1
- continue
-
- case '<', '>', '&':
- buf = append(buf, s[i:j]...)
- buf = append(buf, `\u00`...)
- buf = append(buf, hex[c>>4], hex[c&0xF])
- i = j + 1
- j = j + 1
- continue
-
- case 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x0B, 0x0C, 0x0E, 0x0F, // 0x00-0x0F
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F: // 0x10-0x1F
- buf = append(buf, s[i:j]...)
- buf = append(buf, `\u00`...)
- buf = append(buf, hex[c>>4], hex[c&0xF])
- i = j + 1
- j = j + 1
- continue
- }
- j++
- }
-
- return append(append(buf, s[i:]...), '"')
-}
-
-func appendNormalizedString(buf []byte, s string) []byte {
- valLen := len(s)
- if valLen == 0 {
- return append(buf, `""`...)
- }
- buf = append(buf, '"')
- var (
- i, j int
- )
- if valLen >= 8 {
- chunks := stringToUint64Slice(s)
- for _, n := range chunks {
- // combine masks before checking for the MSB of each byte. We include
- // `n` in the mask to check whether any of the *input* byte MSBs were
- // set (i.e. the byte was outside the ASCII range).
- mask := n | (n - (lsb * 0x20)) |
- ((n ^ (lsb * '"')) - lsb) |
- ((n ^ (lsb * '\\')) - lsb)
- if (mask & msb) != 0 {
- j = bits.TrailingZeros64(mask&msb) / 8
- goto ESCAPE_END
- }
- }
- valLen := len(s)
- for i := len(chunks) * 8; i < valLen; i++ {
- if needEscapeNormalizeUTF8[s[i]] {
- j = i
- goto ESCAPE_END
- }
- }
- return append(append(buf, s...), '"')
- }
-ESCAPE_END:
- for j < valLen {
- c := s[j]
-
- if !needEscapeNormalizeUTF8[c] {
- // fast path: most of the time, printable ascii characters are used
- j++
- continue
- }
-
- switch c {
- case '\\', '"':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', c)
- i = j + 1
- j = j + 1
- continue
-
- case '\n':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', 'n')
- i = j + 1
- j = j + 1
- continue
-
- case '\r':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', 'r')
- i = j + 1
- j = j + 1
- continue
-
- case '\t':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', 't')
- i = j + 1
- j = j + 1
- continue
-
- case 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x0B, 0x0C, 0x0E, 0x0F, // 0x00-0x0F
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F: // 0x10-0x1F
- buf = append(buf, s[i:j]...)
- buf = append(buf, `\u00`...)
- buf = append(buf, hex[c>>4], hex[c&0xF])
- i = j + 1
- j = j + 1
- continue
- }
-
- state, size := decodeRuneInString(s[j:])
- switch state {
- case runeErrorState:
- buf = append(buf, s[i:j]...)
- buf = append(buf, `\ufffd`...)
- i = j + 1
- j = j + 1
- continue
- // U+2028 is LINE SEPARATOR.
- // U+2029 is PARAGRAPH SEPARATOR.
- // They are both technically valid characters in JSON strings,
- // but don't work in JSONP, which has to be evaluated as JavaScript,
- // and can lead to security holes there. It is valid JSON to
- // escape them, so we do so unconditionally.
- // See http://timelessrepo.com/json-isnt-a-javascript-subset for discussion.
- case lineSepState:
- buf = append(buf, s[i:j]...)
- buf = append(buf, `\u2028`...)
- i = j + 3
- j = j + 3
- continue
- case paragraphSepState:
- buf = append(buf, s[i:j]...)
- buf = append(buf, `\u2029`...)
- i = j + 3
- j = j + 3
- continue
- }
- j += size
- }
-
- return append(append(buf, s[i:]...), '"')
-}
-
-func appendString(buf []byte, s string) []byte {
- valLen := len(s)
- if valLen == 0 {
- return append(buf, `""`...)
- }
- buf = append(buf, '"')
- var (
- i, j int
- )
- if valLen >= 8 {
- chunks := stringToUint64Slice(s)
- for _, n := range chunks {
- // combine masks before checking for the MSB of each byte. We include
- // `n` in the mask to check whether any of the *input* byte MSBs were
- // set (i.e. the byte was outside the ASCII range).
- mask := n | (n - (lsb * 0x20)) |
- ((n ^ (lsb * '"')) - lsb) |
- ((n ^ (lsb * '\\')) - lsb)
- if (mask & msb) != 0 {
- j = bits.TrailingZeros64(mask&msb) / 8
- goto ESCAPE_END
- }
- }
- valLen := len(s)
- for i := len(chunks) * 8; i < valLen; i++ {
- if needEscape[s[i]] {
- j = i
- goto ESCAPE_END
- }
- }
- return append(append(buf, s...), '"')
- }
-ESCAPE_END:
- for j < valLen {
- c := s[j]
-
- if !needEscape[c] {
- // fast path: most of the time, printable ascii characters are used
- j++
- continue
- }
-
- switch c {
- case '\\', '"':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', c)
- i = j + 1
- j = j + 1
- continue
-
- case '\n':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', 'n')
- i = j + 1
- j = j + 1
- continue
-
- case '\r':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', 'r')
- i = j + 1
- j = j + 1
- continue
-
- case '\t':
- buf = append(buf, s[i:j]...)
- buf = append(buf, '\\', 't')
- i = j + 1
- j = j + 1
- continue
-
- case 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x0B, 0x0C, 0x0E, 0x0F, // 0x00-0x0F
- 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F: // 0x10-0x1F
- buf = append(buf, s[i:j]...)
- buf = append(buf, `\u00`...)
- buf = append(buf, hex[c>>4], hex[c&0xF])
- i = j + 1
- j = j + 1
- continue
- }
- j++
- }
-
- return append(append(buf, s[i:]...), '"')
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/string_table.go b/vendor/github.com/goccy/go-json/internal/encoder/string_table.go
deleted file mode 100644
index ebe42c92dfd..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/string_table.go
+++ /dev/null
@@ -1,415 +0,0 @@
-package encoder
-
-var needEscapeHTMLNormalizeUTF8 = [256]bool{
- '"': true,
- '&': true,
- '<': true,
- '>': true,
- '\\': true,
- 0x00: true,
- 0x01: true,
- 0x02: true,
- 0x03: true,
- 0x04: true,
- 0x05: true,
- 0x06: true,
- 0x07: true,
- 0x08: true,
- 0x09: true,
- 0x0a: true,
- 0x0b: true,
- 0x0c: true,
- 0x0d: true,
- 0x0e: true,
- 0x0f: true,
- 0x10: true,
- 0x11: true,
- 0x12: true,
- 0x13: true,
- 0x14: true,
- 0x15: true,
- 0x16: true,
- 0x17: true,
- 0x18: true,
- 0x19: true,
- 0x1a: true,
- 0x1b: true,
- 0x1c: true,
- 0x1d: true,
- 0x1e: true,
- 0x1f: true,
- /* 0x20 - 0x7f */
- 0x80: true,
- 0x81: true,
- 0x82: true,
- 0x83: true,
- 0x84: true,
- 0x85: true,
- 0x86: true,
- 0x87: true,
- 0x88: true,
- 0x89: true,
- 0x8a: true,
- 0x8b: true,
- 0x8c: true,
- 0x8d: true,
- 0x8e: true,
- 0x8f: true,
- 0x90: true,
- 0x91: true,
- 0x92: true,
- 0x93: true,
- 0x94: true,
- 0x95: true,
- 0x96: true,
- 0x97: true,
- 0x98: true,
- 0x99: true,
- 0x9a: true,
- 0x9b: true,
- 0x9c: true,
- 0x9d: true,
- 0x9e: true,
- 0x9f: true,
- 0xa0: true,
- 0xa1: true,
- 0xa2: true,
- 0xa3: true,
- 0xa4: true,
- 0xa5: true,
- 0xa6: true,
- 0xa7: true,
- 0xa8: true,
- 0xa9: true,
- 0xaa: true,
- 0xab: true,
- 0xac: true,
- 0xad: true,
- 0xae: true,
- 0xaf: true,
- 0xb0: true,
- 0xb1: true,
- 0xb2: true,
- 0xb3: true,
- 0xb4: true,
- 0xb5: true,
- 0xb6: true,
- 0xb7: true,
- 0xb8: true,
- 0xb9: true,
- 0xba: true,
- 0xbb: true,
- 0xbc: true,
- 0xbd: true,
- 0xbe: true,
- 0xbf: true,
- 0xc0: true,
- 0xc1: true,
- 0xc2: true,
- 0xc3: true,
- 0xc4: true,
- 0xc5: true,
- 0xc6: true,
- 0xc7: true,
- 0xc8: true,
- 0xc9: true,
- 0xca: true,
- 0xcb: true,
- 0xcc: true,
- 0xcd: true,
- 0xce: true,
- 0xcf: true,
- 0xd0: true,
- 0xd1: true,
- 0xd2: true,
- 0xd3: true,
- 0xd4: true,
- 0xd5: true,
- 0xd6: true,
- 0xd7: true,
- 0xd8: true,
- 0xd9: true,
- 0xda: true,
- 0xdb: true,
- 0xdc: true,
- 0xdd: true,
- 0xde: true,
- 0xdf: true,
- 0xe0: true,
- 0xe1: true,
- 0xe2: true,
- 0xe3: true,
- 0xe4: true,
- 0xe5: true,
- 0xe6: true,
- 0xe7: true,
- 0xe8: true,
- 0xe9: true,
- 0xea: true,
- 0xeb: true,
- 0xec: true,
- 0xed: true,
- 0xee: true,
- 0xef: true,
- 0xf0: true,
- 0xf1: true,
- 0xf2: true,
- 0xf3: true,
- 0xf4: true,
- 0xf5: true,
- 0xf6: true,
- 0xf7: true,
- 0xf8: true,
- 0xf9: true,
- 0xfa: true,
- 0xfb: true,
- 0xfc: true,
- 0xfd: true,
- 0xfe: true,
- 0xff: true,
-}
-
-var needEscapeNormalizeUTF8 = [256]bool{
- '"': true,
- '\\': true,
- 0x00: true,
- 0x01: true,
- 0x02: true,
- 0x03: true,
- 0x04: true,
- 0x05: true,
- 0x06: true,
- 0x07: true,
- 0x08: true,
- 0x09: true,
- 0x0a: true,
- 0x0b: true,
- 0x0c: true,
- 0x0d: true,
- 0x0e: true,
- 0x0f: true,
- 0x10: true,
- 0x11: true,
- 0x12: true,
- 0x13: true,
- 0x14: true,
- 0x15: true,
- 0x16: true,
- 0x17: true,
- 0x18: true,
- 0x19: true,
- 0x1a: true,
- 0x1b: true,
- 0x1c: true,
- 0x1d: true,
- 0x1e: true,
- 0x1f: true,
- /* 0x20 - 0x7f */
- 0x80: true,
- 0x81: true,
- 0x82: true,
- 0x83: true,
- 0x84: true,
- 0x85: true,
- 0x86: true,
- 0x87: true,
- 0x88: true,
- 0x89: true,
- 0x8a: true,
- 0x8b: true,
- 0x8c: true,
- 0x8d: true,
- 0x8e: true,
- 0x8f: true,
- 0x90: true,
- 0x91: true,
- 0x92: true,
- 0x93: true,
- 0x94: true,
- 0x95: true,
- 0x96: true,
- 0x97: true,
- 0x98: true,
- 0x99: true,
- 0x9a: true,
- 0x9b: true,
- 0x9c: true,
- 0x9d: true,
- 0x9e: true,
- 0x9f: true,
- 0xa0: true,
- 0xa1: true,
- 0xa2: true,
- 0xa3: true,
- 0xa4: true,
- 0xa5: true,
- 0xa6: true,
- 0xa7: true,
- 0xa8: true,
- 0xa9: true,
- 0xaa: true,
- 0xab: true,
- 0xac: true,
- 0xad: true,
- 0xae: true,
- 0xaf: true,
- 0xb0: true,
- 0xb1: true,
- 0xb2: true,
- 0xb3: true,
- 0xb4: true,
- 0xb5: true,
- 0xb6: true,
- 0xb7: true,
- 0xb8: true,
- 0xb9: true,
- 0xba: true,
- 0xbb: true,
- 0xbc: true,
- 0xbd: true,
- 0xbe: true,
- 0xbf: true,
- 0xc0: true,
- 0xc1: true,
- 0xc2: true,
- 0xc3: true,
- 0xc4: true,
- 0xc5: true,
- 0xc6: true,
- 0xc7: true,
- 0xc8: true,
- 0xc9: true,
- 0xca: true,
- 0xcb: true,
- 0xcc: true,
- 0xcd: true,
- 0xce: true,
- 0xcf: true,
- 0xd0: true,
- 0xd1: true,
- 0xd2: true,
- 0xd3: true,
- 0xd4: true,
- 0xd5: true,
- 0xd6: true,
- 0xd7: true,
- 0xd8: true,
- 0xd9: true,
- 0xda: true,
- 0xdb: true,
- 0xdc: true,
- 0xdd: true,
- 0xde: true,
- 0xdf: true,
- 0xe0: true,
- 0xe1: true,
- 0xe2: true,
- 0xe3: true,
- 0xe4: true,
- 0xe5: true,
- 0xe6: true,
- 0xe7: true,
- 0xe8: true,
- 0xe9: true,
- 0xea: true,
- 0xeb: true,
- 0xec: true,
- 0xed: true,
- 0xee: true,
- 0xef: true,
- 0xf0: true,
- 0xf1: true,
- 0xf2: true,
- 0xf3: true,
- 0xf4: true,
- 0xf5: true,
- 0xf6: true,
- 0xf7: true,
- 0xf8: true,
- 0xf9: true,
- 0xfa: true,
- 0xfb: true,
- 0xfc: true,
- 0xfd: true,
- 0xfe: true,
- 0xff: true,
-}
-
-var needEscapeHTML = [256]bool{
- '"': true,
- '&': true,
- '<': true,
- '>': true,
- '\\': true,
- 0x00: true,
- 0x01: true,
- 0x02: true,
- 0x03: true,
- 0x04: true,
- 0x05: true,
- 0x06: true,
- 0x07: true,
- 0x08: true,
- 0x09: true,
- 0x0a: true,
- 0x0b: true,
- 0x0c: true,
- 0x0d: true,
- 0x0e: true,
- 0x0f: true,
- 0x10: true,
- 0x11: true,
- 0x12: true,
- 0x13: true,
- 0x14: true,
- 0x15: true,
- 0x16: true,
- 0x17: true,
- 0x18: true,
- 0x19: true,
- 0x1a: true,
- 0x1b: true,
- 0x1c: true,
- 0x1d: true,
- 0x1e: true,
- 0x1f: true,
- /* 0x20 - 0xff */
-}
-
-var needEscape = [256]bool{
- '"': true,
- '\\': true,
- 0x00: true,
- 0x01: true,
- 0x02: true,
- 0x03: true,
- 0x04: true,
- 0x05: true,
- 0x06: true,
- 0x07: true,
- 0x08: true,
- 0x09: true,
- 0x0a: true,
- 0x0b: true,
- 0x0c: true,
- 0x0d: true,
- 0x0e: true,
- 0x0f: true,
- 0x10: true,
- 0x11: true,
- 0x12: true,
- 0x13: true,
- 0x14: true,
- 0x15: true,
- 0x16: true,
- 0x17: true,
- 0x18: true,
- 0x19: true,
- 0x1a: true,
- 0x1b: true,
- 0x1c: true,
- 0x1d: true,
- 0x1e: true,
- 0x1f: true,
- /* 0x20 - 0xff */
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm/debug_vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm/debug_vm.go
deleted file mode 100644
index 82b6dd47f86..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm/debug_vm.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package vm
-
-import (
- "fmt"
- "io"
-
- "github.com/goccy/go-json/internal/encoder"
-)
-
-func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) {
- defer func() {
- var code *encoder.Opcode
- if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 {
- code = codeSet.EscapeKeyCode
- } else {
- code = codeSet.NoescapeKeyCode
- }
- if wc := ctx.Option.DebugDOTOut; wc != nil {
- _, _ = io.WriteString(wc, code.DumpDOT())
- wc.Close()
- ctx.Option.DebugDOTOut = nil
- }
-
- if err := recover(); err != nil {
- w := ctx.Option.DebugOut
- fmt.Fprintln(w, "=============[DEBUG]===============")
- fmt.Fprintln(w, "* [TYPE]")
- fmt.Fprintln(w, codeSet.Type)
- fmt.Fprintf(w, "\n")
- fmt.Fprintln(w, "* [ALL OPCODE]")
- fmt.Fprintln(w, code.Dump())
- fmt.Fprintf(w, "\n")
- fmt.Fprintln(w, "* [CONTEXT]")
- fmt.Fprintf(w, "%+v\n", ctx)
- fmt.Fprintln(w, "===================================")
- panic(err)
- }
- }()
-
- return Run(ctx, b, codeSet)
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm/hack.go b/vendor/github.com/goccy/go-json/internal/encoder/vm/hack.go
deleted file mode 100644
index 65252b4a5cd..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm/hack.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package vm
-
-import (
- // HACK: compile order
- // `vm`, `vm_indent`, `vm_color`, `vm_color_indent` packages uses a lot of memory to compile,
- // so forcibly make dependencies and avoid compiling in concurrent.
- // dependency order: vm => vm_indent => vm_color => vm_color_indent
- _ "github.com/goccy/go-json/internal/encoder/vm_indent"
-)
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm/util.go b/vendor/github.com/goccy/go-json/internal/encoder/vm/util.go
deleted file mode 100644
index 86291d7bb37..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm/util.go
+++ /dev/null
@@ -1,207 +0,0 @@
-package vm
-
-import (
- "encoding/json"
- "fmt"
- "unsafe"
-
- "github.com/goccy/go-json/internal/encoder"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-const uintptrSize = 4 << (^uintptr(0) >> 63)
-
-var (
- appendInt = encoder.AppendInt
- appendUint = encoder.AppendUint
- appendFloat32 = encoder.AppendFloat32
- appendFloat64 = encoder.AppendFloat64
- appendString = encoder.AppendString
- appendByteSlice = encoder.AppendByteSlice
- appendNumber = encoder.AppendNumber
- errUnsupportedValue = encoder.ErrUnsupportedValue
- errUnsupportedFloat = encoder.ErrUnsupportedFloat
- mapiterinit = encoder.MapIterInit
- mapiterkey = encoder.MapIterKey
- mapitervalue = encoder.MapIterValue
- mapiternext = encoder.MapIterNext
- maplen = encoder.MapLen
-)
-
-type emptyInterface struct {
- typ *runtime.Type
- ptr unsafe.Pointer
-}
-
-type nonEmptyInterface struct {
- itab *struct {
- ityp *runtime.Type // static interface type
- typ *runtime.Type // dynamic concrete type
- // unused fields...
- }
- ptr unsafe.Pointer
-}
-
-func errUnimplementedOp(op encoder.OpType) error {
- return fmt.Errorf("encoder: opcode %s has not been implemented", op)
-}
-
-func load(base uintptr, idx uint32) uintptr {
- addr := base + uintptr(idx)
- return **(**uintptr)(unsafe.Pointer(&addr))
-}
-
-func store(base uintptr, idx uint32, p uintptr) {
- addr := base + uintptr(idx)
- **(**uintptr)(unsafe.Pointer(&addr)) = p
-}
-
-func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr {
- addr := base + uintptr(idx)
- p := **(**uintptr)(unsafe.Pointer(&addr))
- for i := uint8(0); i < ptrNum; i++ {
- if p == 0 {
- return 0
- }
- p = ptrToPtr(p)
- }
- return p
-}
-
-func ptrToUint64(p uintptr, bitSize uint8) uint64 {
- switch bitSize {
- case 8:
- return (uint64)(**(**uint8)(unsafe.Pointer(&p)))
- case 16:
- return (uint64)(**(**uint16)(unsafe.Pointer(&p)))
- case 32:
- return (uint64)(**(**uint32)(unsafe.Pointer(&p)))
- case 64:
- return **(**uint64)(unsafe.Pointer(&p))
- }
- return 0
-}
-func ptrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) }
-func ptrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) }
-func ptrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) }
-func ptrToBytes(p uintptr) []byte { return **(**[]byte)(unsafe.Pointer(&p)) }
-func ptrToNumber(p uintptr) json.Number { return **(**json.Number)(unsafe.Pointer(&p)) }
-func ptrToString(p uintptr) string { return **(**string)(unsafe.Pointer(&p)) }
-func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader)(unsafe.Pointer(&p)) }
-func ptrToPtr(p uintptr) uintptr {
- return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p)))
-}
-func ptrToNPtr(p uintptr, ptrNum uint8) uintptr {
- for i := uint8(0); i < ptrNum; i++ {
- if p == 0 {
- return 0
- }
- p = ptrToPtr(p)
- }
- return p
-}
-
-func ptrToUnsafePtr(p uintptr) unsafe.Pointer {
- return *(*unsafe.Pointer)(unsafe.Pointer(&p))
-}
-func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} {
- return *(*interface{})(unsafe.Pointer(&emptyInterface{
- typ: code.Type,
- ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)),
- }))
-}
-
-func appendBool(_ *encoder.RuntimeContext, b []byte, v bool) []byte {
- if v {
- return append(b, "true"...)
- }
- return append(b, "false"...)
-}
-
-func appendNull(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, "null"...)
-}
-
-func appendComma(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, ',')
-}
-
-func appendNullComma(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, "null,"...)
-}
-
-func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
- last := len(b) - 1
- b[last] = ':'
- return b
-}
-
-func appendMapKeyValue(_ *encoder.RuntimeContext, _ *encoder.Opcode, b, key, value []byte) []byte {
- b = append(b, key...)
- b[len(b)-1] = ':'
- return append(b, value...)
-}
-
-func appendMapEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte {
- b[len(b)-1] = '}'
- b = append(b, ',')
- return b
-}
-
-func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) {
- return encoder.AppendMarshalJSON(ctx, code, b, v)
-}
-
-func appendMarshalText(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) {
- return encoder.AppendMarshalText(ctx, code, b, v)
-}
-
-func appendArrayHead(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte {
- return append(b, '[')
-}
-
-func appendArrayEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte {
- last := len(b) - 1
- b[last] = ']'
- return append(b, ',')
-}
-
-func appendEmptyArray(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, '[', ']', ',')
-}
-
-func appendEmptyObject(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, '{', '}', ',')
-}
-
-func appendObjectEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte {
- last := len(b) - 1
- b[last] = '}'
- return append(b, ',')
-}
-
-func appendStructHead(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, '{')
-}
-
-func appendStructKey(_ *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- return append(b, code.Key...)
-}
-
-func appendStructEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte {
- return append(b, '}', ',')
-}
-
-func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- last := len(b) - 1
- if b[last] == ',' {
- b[last] = '}'
- return appendComma(ctx, b)
- }
- return appendStructEnd(ctx, code, b)
-}
-
-func restoreIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, _ uintptr) {}
-func storeIndent(_ uintptr, _ *encoder.Opcode, _ uintptr) {}
-func appendMapKeyIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { return b }
-func appendArrayElemIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { return b }
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm/vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm/vm.go
deleted file mode 100644
index 645d20f9fbe..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm/vm.go
+++ /dev/null
@@ -1,4859 +0,0 @@
-// Code generated by internal/cmd/generator. DO NOT EDIT!
-package vm
-
-import (
- "math"
- "reflect"
- "sort"
- "unsafe"
-
- "github.com/goccy/go-json/internal/encoder"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) {
- recursiveLevel := 0
- ptrOffset := uintptr(0)
- ctxptr := ctx.Ptr()
- var code *encoder.Opcode
- if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 {
- code = codeSet.EscapeKeyCode
- } else {
- code = codeSet.NoescapeKeyCode
- }
-
- for {
- switch code.Op {
- default:
- return nil, errUnimplementedOp(code.Op)
- case encoder.OpPtr:
- p := load(ctxptr, code.Idx)
- code = code.Next
- store(ctxptr, code.Idx, ptrToPtr(p))
- case encoder.OpIntPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpInt:
- b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpUintPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpUint:
- b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpIntString:
- b = append(b, '"')
- b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpUintString:
- b = append(b, '"')
- b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpFloat32Ptr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- b = appendComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpFloat32:
- b = appendFloat32(ctx, b, ptrToFloat32(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpFloat64Ptr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpFloat64:
- v := ptrToFloat64(load(ctxptr, code.Idx))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStringPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpString:
- b = appendString(ctx, b, ptrToString(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpBoolPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpBool:
- b = appendBool(ctx, b, ptrToBool(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpBytesPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpBytes:
- b = appendByteSlice(ctx, b, ptrToBytes(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpNumberPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpNumber:
- bb, err := appendNumber(ctx, b, ptrToNumber(load(ctxptr, code.Idx)))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpInterfacePtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpInterface:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- if recursiveLevel > encoder.StartDetectingCyclesAfter {
- for _, seen := range ctx.SeenPtr {
- if p == seen {
- return nil, errUnsupportedValue(code, p)
- }
- }
- }
- ctx.SeenPtr = append(ctx.SeenPtr, p)
- var (
- typ *runtime.Type
- ifacePtr unsafe.Pointer
- )
- up := ptrToUnsafePtr(p)
- if code.Flags&encoder.NonEmptyInterfaceFlags != 0 {
- iface := (*nonEmptyInterface)(up)
- ifacePtr = iface.ptr
- if iface.itab != nil {
- typ = iface.itab.typ
- }
- } else {
- iface := (*emptyInterface)(up)
- ifacePtr = iface.ptr
- typ = iface.typ
- }
- if ifacePtr == nil {
- isDirectedNil := typ != nil && typ.Kind() == reflect.Struct && !runtime.IfaceIndir(typ)
- if !isDirectedNil {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- }
- ctx.KeepRefs = append(ctx.KeepRefs, up)
- ifaceCodeSet, err := encoder.CompileToGetCodeSet(ctx, uintptr(unsafe.Pointer(typ)))
- if err != nil {
- return nil, err
- }
-
- totalLength := uintptr(code.Length) + 3
- nextTotalLength := uintptr(ifaceCodeSet.CodeLength) + 3
-
- var c *encoder.Opcode
- if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 {
- c = ifaceCodeSet.InterfaceEscapeKeyCode
- } else {
- c = ifaceCodeSet.InterfaceNoescapeKeyCode
- }
- curlen := uintptr(len(ctx.Ptrs))
- offsetNum := ptrOffset / uintptrSize
- oldOffset := ptrOffset
- ptrOffset += totalLength * uintptrSize
- oldBaseIndent := ctx.BaseIndent
- ctx.BaseIndent += code.Indent
-
- newLen := offsetNum + totalLength + nextTotalLength
- if curlen < newLen {
- ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...)
- }
- ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr
-
- end := ifaceCodeSet.EndCode
- store(ctxptr, c.Idx, uintptr(ifacePtr))
- store(ctxptr, end.Idx, oldOffset)
- store(ctxptr, end.ElemIdx, uintptr(unsafe.Pointer(code.Next)))
- storeIndent(ctxptr, end, uintptr(oldBaseIndent))
- code = c
- recursiveLevel++
- case encoder.OpInterfaceEnd:
- recursiveLevel--
-
- // restore ctxptr
- offset := load(ctxptr, code.Idx)
- restoreIndent(ctx, code, ctxptr)
- ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1]
-
- codePtr := load(ctxptr, code.ElemIdx)
- code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr))
- ctxptr = ctx.Ptr() + offset
- ptrOffset = offset
- case encoder.OpMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, ptrToPtr(p))
- fallthrough
- case encoder.OpMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p)
- }
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, ptrToPtr(p))
- fallthrough
- case encoder.OpMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = append(b, `""`...)
- b = appendComma(ctx, b)
- code = code.Next
- break
- }
- if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p)
- }
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpSlicePtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpSlice:
- p := load(ctxptr, code.Idx)
- slice := ptrToSlice(p)
- if p == 0 || slice.Data == nil {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.ElemIdx, 0)
- store(ctxptr, code.Length, uintptr(slice.Len))
- store(ctxptr, code.Idx, uintptr(slice.Data))
- if slice.Len > 0 {
- b = appendArrayHead(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, uintptr(slice.Data))
- } else {
- b = appendEmptyArray(ctx, b)
- code = code.End.Next
- }
- case encoder.OpSliceElem:
- idx := load(ctxptr, code.ElemIdx)
- length := load(ctxptr, code.Length)
- idx++
- if idx < length {
- b = appendArrayElemIndent(ctx, code, b)
- store(ctxptr, code.ElemIdx, idx)
- data := load(ctxptr, code.Idx)
- size := uintptr(code.Size)
- code = code.Next
- store(ctxptr, code.Idx, data+idx*size)
- } else {
- b = appendArrayEnd(ctx, code, b)
- code = code.End.Next
- }
- case encoder.OpArrayPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpArray:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- if code.Length > 0 {
- b = appendArrayHead(ctx, code, b)
- store(ctxptr, code.ElemIdx, 0)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- b = appendEmptyArray(ctx, b)
- code = code.End.Next
- }
- case encoder.OpArrayElem:
- idx := load(ctxptr, code.ElemIdx)
- idx++
- if idx < uintptr(code.Length) {
- b = appendArrayElemIndent(ctx, code, b)
- store(ctxptr, code.ElemIdx, idx)
- p := load(ctxptr, code.Idx)
- size := uintptr(code.Size)
- code = code.Next
- store(ctxptr, code.Idx, p+idx*size)
- } else {
- b = appendArrayEnd(ctx, code, b)
- code = code.End.Next
- }
- case encoder.OpMapPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpMap:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- uptr := ptrToUnsafePtr(p)
- mlen := maplen(uptr)
- if mlen <= 0 {
- b = appendEmptyObject(ctx, b)
- code = code.End.Next
- break
- }
- b = appendStructHead(ctx, b)
- unorderedMap := (ctx.Option.Flag & encoder.UnorderedMapOption) != 0
- mapCtx := encoder.NewMapContext(mlen, unorderedMap)
- mapiterinit(code.Type, uptr, &mapCtx.Iter)
- store(ctxptr, code.Idx, uintptr(unsafe.Pointer(mapCtx)))
- ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx))
- if unorderedMap {
- b = appendMapKeyIndent(ctx, code.Next, b)
- } else {
- mapCtx.Start = len(b)
- mapCtx.First = len(b)
- }
- key := mapiterkey(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(key))
- code = code.Next
- case encoder.OpMapKey:
- mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
- idx := mapCtx.Idx
- idx++
- if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 {
- if idx < mapCtx.Len {
- b = appendMapKeyIndent(ctx, code, b)
- mapCtx.Idx = int(idx)
- key := mapiterkey(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(key))
- code = code.Next
- } else {
- b = appendObjectEnd(ctx, code, b)
- encoder.ReleaseMapContext(mapCtx)
- code = code.End.Next
- }
- } else {
- mapCtx.Slice.Items[mapCtx.Idx].Value = b[mapCtx.Start:len(b)]
- if idx < mapCtx.Len {
- mapCtx.Idx = int(idx)
- mapCtx.Start = len(b)
- key := mapiterkey(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(key))
- code = code.Next
- } else {
- code = code.End
- }
- }
- case encoder.OpMapValue:
- mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
- if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 {
- b = appendColon(ctx, b)
- } else {
- mapCtx.Slice.Items[mapCtx.Idx].Key = b[mapCtx.Start:len(b)]
- mapCtx.Start = len(b)
- }
- value := mapitervalue(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(value))
- mapiternext(&mapCtx.Iter)
- code = code.Next
- case encoder.OpMapEnd:
- // this operation only used by sorted map.
- mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
- sort.Sort(mapCtx.Slice)
- buf := mapCtx.Buf
- for _, item := range mapCtx.Slice.Items {
- buf = appendMapKeyValue(ctx, code, buf, item.Key, item.Value)
- }
- buf = appendMapEnd(ctx, code, buf)
- b = b[:mapCtx.First]
- b = append(b, buf...)
- mapCtx.Buf = buf
- encoder.ReleaseMapContext(mapCtx)
- code = code.Next
- case encoder.OpRecursivePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpRecursive:
- ptr := load(ctxptr, code.Idx)
- if ptr != 0 {
- if recursiveLevel > encoder.StartDetectingCyclesAfter {
- for _, seen := range ctx.SeenPtr {
- if ptr == seen {
- return nil, errUnsupportedValue(code, ptr)
- }
- }
- }
- }
- ctx.SeenPtr = append(ctx.SeenPtr, ptr)
- c := code.Jmp.Code
- curlen := uintptr(len(ctx.Ptrs))
- offsetNum := ptrOffset / uintptrSize
- oldOffset := ptrOffset
- ptrOffset += code.Jmp.CurLen * uintptrSize
- oldBaseIndent := ctx.BaseIndent
- indentDiffFromTop := c.Indent - 1
- ctx.BaseIndent += code.Indent - indentDiffFromTop
-
- newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
- if curlen < newLen {
- ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...)
- }
- ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr
-
- store(ctxptr, c.Idx, ptr)
- store(ctxptr, c.End.Next.Idx, oldOffset)
- store(ctxptr, c.End.Next.ElemIdx, uintptr(unsafe.Pointer(code.Next)))
- storeIndent(ctxptr, c.End.Next, uintptr(oldBaseIndent))
- code = c
- recursiveLevel++
- case encoder.OpRecursiveEnd:
- recursiveLevel--
-
- // restore ctxptr
- restoreIndent(ctx, code, ctxptr)
- offset := load(ctxptr, code.Idx)
- ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1]
-
- codePtr := load(ctxptr, code.ElemIdx)
- code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr))
- ctxptr = ctx.Ptr() + offset
- ptrOffset = offset
- case encoder.OpStructPtrHead:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHead:
- p := load(ctxptr, code.Idx)
- if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if len(code.Key) > 0 {
- if (code.Flags&encoder.IsTaggedKeyFlags) != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 {
- b = appendStructKey(ctx, code, b)
- }
- }
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmpty:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmpty:
- p := load(ctxptr, code.Idx)
- if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadInt:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadInt:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyInt:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyInt:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadIntString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadIntString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyIntString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyIntString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- u64 := ptrToUint64(p, code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendInt(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadUint:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadUint:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUint:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyUint:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadUintString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadUintString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUintString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyUintString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendUint(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat32:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat32:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat32String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat32String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat64:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat64:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat64String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat64String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNull(ctx, b)
- b = appendComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToString(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadStringString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadStringString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p+uintptr(code.Offset)))))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyStringString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyStringString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToString(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, ptrToString(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadBool:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadBool:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBool:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyBool:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- } else {
- code = code.NextField
- }
- case encoder.OpStructPtrHeadBoolString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadBoolString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBoolString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyBoolString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- } else {
- code = code.NextField
- }
- case encoder.OpStructPtrHeadBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendBool(ctx, b, ptrToBool(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadBytes:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadBytes:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBytes:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyBytes:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToBytes(p + uintptr(code.Offset))
- if len(v) == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadNumber:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadNumber:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumber:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumber:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToNumber(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- }
- case encoder.OpStructPtrHeadNumberString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadNumberString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumberString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumberString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToNumber(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructPtrHeadNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadArray, encoder.OpStructHeadSlice:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmptyArray:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyArray:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmptySlice:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptySlice:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- slice := ptrToSlice(p)
- if slice.Len == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.NextField
- } else {
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadMap:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMap:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p + uintptr(code.Offset))
- }
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmptyMap:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMap:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p + uintptr(code.Offset))
- }
- if maplen(ptrToUnsafePtr(p)) == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.NextField
- break
- }
- p = ptrToPtr(p + uintptr(code.Offset))
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.NextField
- } else {
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadOmitEmptyMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p == 0 {
- code = code.NextField
- break
- }
- p = ptrToPtr(p + uintptr(code.Offset))
- if p == 0 {
- code = code.NextField
- } else {
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON {
- p = ptrToPtr(p)
- }
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON {
- p = ptrToPtr(p)
- }
- }
- iface := ptrToInterface(code, p)
- if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, iface)
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText {
- p = ptrToPtr(p)
- }
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText {
- p = ptrToPtr(p)
- }
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructField:
- if code.Flags&encoder.IsTaggedKeyFlags != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 {
- b = appendStructKey(ctx, code, b)
- }
- p := load(ctxptr, code.Idx) + uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmpty:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructFieldInt:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyInt:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldIntString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyIntString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldIntPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendInt(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldIntPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUint:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUint:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUintString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUintString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUintPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendUint(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUintPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32String:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldStringString:
- p := load(ctxptr, code.Idx)
- s := ptrToString(p + uintptr(code.Offset))
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, s)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyStringString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldStringPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, ptrToString(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldStringPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBool:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBool:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBoolString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBoolString:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBoolPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendBool(ctx, b, ptrToBool(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBoolPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBytes:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBytes:
- p := load(ctxptr, code.Idx)
- v := ptrToBytes(p + uintptr(code.Offset))
- if len(v) > 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBytesPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldNumber:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumber:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldNumberString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumberString:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldNumberPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldNumberPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldMarshalJSON:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalJSON:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- code = code.NextField
- break
- }
- iface := ptrToInterface(code, p)
- if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) {
- code = code.NextField
- break
- }
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, iface)
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructFieldMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldMarshalText:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalText:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- code = code.NextField
- break
- }
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructFieldMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldArray:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyArray:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldArrayPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyArrayPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- code = code.NextField
- }
- case encoder.OpStructFieldSlice:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptySlice:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- slice := ptrToSlice(p)
- if slice.Len == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructFieldSlicePtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptySlicePtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- code = code.NextField
- }
- case encoder.OpStructFieldMap:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyMap:
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructFieldMapPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- if p != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyMapPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- if p != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- code = code.NextField
- }
- case encoder.OpStructFieldStruct:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyStruct:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructEnd:
- b = appendStructEndSkipLast(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndInt:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyInt:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndIntString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyIntString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndIntPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendInt(ctx, b, p, code)
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p, code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndIntPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUint:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUint:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUintString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUintString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUintPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendUint(ctx, b, p, code)
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p, code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUintPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32String:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32Ptr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32PtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64Ptr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- break
- }
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64PtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndStringString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- s := ptrToString(p + uintptr(code.Offset))
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, s)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyStringString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndStringPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, ptrToString(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndStringPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBool:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBool:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBoolString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBoolString:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBoolPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendBool(ctx, b, ptrToBool(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBoolPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBytes:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBytes:
- p := load(ctxptr, code.Idx)
- v := ptrToBytes(p + uintptr(code.Offset))
- if len(v) > 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBytesPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumber:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = appendStructEnd(ctx, code, bb)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumber:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = appendStructEnd(ctx, code, bb)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumberString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumberString:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumberPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = appendStructEnd(ctx, code, bb)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumberPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpEnd:
- goto END
- }
- }
-END:
- return b, nil
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_color/debug_vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_color/debug_vm.go
deleted file mode 100644
index 925f61ed8e6..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm_color/debug_vm.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package vm_color
-
-import (
- "fmt"
-
- "github.com/goccy/go-json/internal/encoder"
-)
-
-func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) {
- var code *encoder.Opcode
- if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 {
- code = codeSet.EscapeKeyCode
- } else {
- code = codeSet.NoescapeKeyCode
- }
-
- defer func() {
- if err := recover(); err != nil {
- w := ctx.Option.DebugOut
- fmt.Fprintln(w, "=============[DEBUG]===============")
- fmt.Fprintln(w, "* [TYPE]")
- fmt.Fprintln(w, codeSet.Type)
- fmt.Fprintf(w, "\n")
- fmt.Fprintln(w, "* [ALL OPCODE]")
- fmt.Fprintln(w, code.Dump())
- fmt.Fprintf(w, "\n")
- fmt.Fprintln(w, "* [CONTEXT]")
- fmt.Fprintf(w, "%+v\n", ctx)
- fmt.Fprintln(w, "===================================")
- panic(err)
- }
- }()
-
- return Run(ctx, b, codeSet)
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_color/hack.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_color/hack.go
deleted file mode 100644
index 12ec56c5bbd..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm_color/hack.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package vm_color
-
-import (
- // HACK: compile order
- // `vm`, `vm_indent`, `vm_color`, `vm_color_indent` packages uses a lot of memory to compile,
- // so forcibly make dependencies and avoid compiling in concurrent.
- // dependency order: vm => vm_indent => vm_color => vm_color_indent
- _ "github.com/goccy/go-json/internal/encoder/vm_color_indent"
-)
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_color/util.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_color/util.go
deleted file mode 100644
index 33f29aee448..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm_color/util.go
+++ /dev/null
@@ -1,274 +0,0 @@
-package vm_color
-
-import (
- "encoding/json"
- "fmt"
- "unsafe"
-
- "github.com/goccy/go-json/internal/encoder"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-const uintptrSize = 4 << (^uintptr(0) >> 63)
-
-var (
- errUnsupportedValue = encoder.ErrUnsupportedValue
- errUnsupportedFloat = encoder.ErrUnsupportedFloat
- mapiterinit = encoder.MapIterInit
- mapiterkey = encoder.MapIterKey
- mapitervalue = encoder.MapIterValue
- mapiternext = encoder.MapIterNext
- maplen = encoder.MapLen
-)
-
-type emptyInterface struct {
- typ *runtime.Type
- ptr unsafe.Pointer
-}
-
-type nonEmptyInterface struct {
- itab *struct {
- ityp *runtime.Type // static interface type
- typ *runtime.Type // dynamic concrete type
- // unused fields...
- }
- ptr unsafe.Pointer
-}
-
-func errUnimplementedOp(op encoder.OpType) error {
- return fmt.Errorf("encoder: opcode %s has not been implemented", op)
-}
-
-func load(base uintptr, idx uint32) uintptr {
- addr := base + uintptr(idx)
- return **(**uintptr)(unsafe.Pointer(&addr))
-}
-
-func store(base uintptr, idx uint32, p uintptr) {
- addr := base + uintptr(idx)
- **(**uintptr)(unsafe.Pointer(&addr)) = p
-}
-
-func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr {
- addr := base + uintptr(idx)
- p := **(**uintptr)(unsafe.Pointer(&addr))
- for i := uint8(0); i < ptrNum; i++ {
- if p == 0 {
- return 0
- }
- p = ptrToPtr(p)
- }
- return p
-}
-
-func ptrToUint64(p uintptr, bitSize uint8) uint64 {
- switch bitSize {
- case 8:
- return (uint64)(**(**uint8)(unsafe.Pointer(&p)))
- case 16:
- return (uint64)(**(**uint16)(unsafe.Pointer(&p)))
- case 32:
- return (uint64)(**(**uint32)(unsafe.Pointer(&p)))
- case 64:
- return **(**uint64)(unsafe.Pointer(&p))
- }
- return 0
-}
-func ptrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) }
-func ptrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) }
-func ptrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) }
-func ptrToBytes(p uintptr) []byte { return **(**[]byte)(unsafe.Pointer(&p)) }
-func ptrToNumber(p uintptr) json.Number { return **(**json.Number)(unsafe.Pointer(&p)) }
-func ptrToString(p uintptr) string { return **(**string)(unsafe.Pointer(&p)) }
-func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader)(unsafe.Pointer(&p)) }
-func ptrToPtr(p uintptr) uintptr {
- return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p)))
-}
-func ptrToNPtr(p uintptr, ptrNum uint8) uintptr {
- for i := uint8(0); i < ptrNum; i++ {
- if p == 0 {
- return 0
- }
- p = ptrToPtr(p)
- }
- return p
-}
-
-func ptrToUnsafePtr(p uintptr) unsafe.Pointer {
- return *(*unsafe.Pointer)(unsafe.Pointer(&p))
-}
-func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} {
- return *(*interface{})(unsafe.Pointer(&emptyInterface{
- typ: code.Type,
- ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)),
- }))
-}
-
-func appendInt(ctx *encoder.RuntimeContext, b []byte, p uintptr, code *encoder.Opcode) []byte {
- format := ctx.Option.ColorScheme.Int
- b = append(b, format.Header...)
- b = encoder.AppendInt(ctx, b, p, code)
- return append(b, format.Footer...)
-}
-
-func appendUint(ctx *encoder.RuntimeContext, b []byte, p uintptr, code *encoder.Opcode) []byte {
- format := ctx.Option.ColorScheme.Uint
- b = append(b, format.Header...)
- b = encoder.AppendUint(ctx, b, p, code)
- return append(b, format.Footer...)
-}
-
-func appendFloat32(ctx *encoder.RuntimeContext, b []byte, v float32) []byte {
- format := ctx.Option.ColorScheme.Float
- b = append(b, format.Header...)
- b = encoder.AppendFloat32(ctx, b, v)
- return append(b, format.Footer...)
-}
-
-func appendFloat64(ctx *encoder.RuntimeContext, b []byte, v float64) []byte {
- format := ctx.Option.ColorScheme.Float
- b = append(b, format.Header...)
- b = encoder.AppendFloat64(ctx, b, v)
- return append(b, format.Footer...)
-}
-
-func appendString(ctx *encoder.RuntimeContext, b []byte, v string) []byte {
- format := ctx.Option.ColorScheme.String
- b = append(b, format.Header...)
- b = encoder.AppendString(ctx, b, v)
- return append(b, format.Footer...)
-}
-
-func appendByteSlice(ctx *encoder.RuntimeContext, b []byte, src []byte) []byte {
- format := ctx.Option.ColorScheme.Binary
- b = append(b, format.Header...)
- b = encoder.AppendByteSlice(ctx, b, src)
- return append(b, format.Footer...)
-}
-
-func appendNumber(ctx *encoder.RuntimeContext, b []byte, n json.Number) ([]byte, error) {
- format := ctx.Option.ColorScheme.Int
- b = append(b, format.Header...)
- bb, err := encoder.AppendNumber(ctx, b, n)
- if err != nil {
- return nil, err
- }
- return append(bb, format.Footer...), nil
-}
-
-func appendBool(ctx *encoder.RuntimeContext, b []byte, v bool) []byte {
- format := ctx.Option.ColorScheme.Bool
- b = append(b, format.Header...)
- if v {
- b = append(b, "true"...)
- } else {
- b = append(b, "false"...)
- }
- return append(b, format.Footer...)
-}
-
-func appendNull(ctx *encoder.RuntimeContext, b []byte) []byte {
- format := ctx.Option.ColorScheme.Null
- b = append(b, format.Header...)
- b = append(b, "null"...)
- return append(b, format.Footer...)
-}
-
-func appendComma(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, ',')
-}
-
-func appendNullComma(ctx *encoder.RuntimeContext, b []byte) []byte {
- format := ctx.Option.ColorScheme.Null
- b = append(b, format.Header...)
- b = append(b, "null"...)
- return append(append(b, format.Footer...), ',')
-}
-
-func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
- last := len(b) - 1
- b[last] = ':'
- return b
-}
-
-func appendMapKeyValue(_ *encoder.RuntimeContext, _ *encoder.Opcode, b, key, value []byte) []byte {
- b = append(b, key[:len(key)-1]...)
- b = append(b, ':')
- return append(b, value...)
-}
-
-func appendMapEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte {
- last := len(b) - 1
- b[last] = '}'
- b = append(b, ',')
- return b
-}
-
-func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) {
- return encoder.AppendMarshalJSON(ctx, code, b, v)
-}
-
-func appendMarshalText(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) {
- format := ctx.Option.ColorScheme.String
- b = append(b, format.Header...)
- bb, err := encoder.AppendMarshalText(ctx, code, b, v)
- if err != nil {
- return nil, err
- }
- return append(bb, format.Footer...), nil
-}
-
-func appendArrayHead(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte {
- return append(b, '[')
-}
-
-func appendArrayEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte {
- last := len(b) - 1
- b[last] = ']'
- return append(b, ',')
-}
-
-func appendEmptyArray(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, '[', ']', ',')
-}
-
-func appendEmptyObject(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, '{', '}', ',')
-}
-
-func appendObjectEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte {
- last := len(b) - 1
- b[last] = '}'
- return append(b, ',')
-}
-
-func appendStructHead(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, '{')
-}
-
-func appendStructKey(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- format := ctx.Option.ColorScheme.ObjectKey
- b = append(b, format.Header...)
- b = append(b, code.Key[:len(code.Key)-1]...)
- b = append(b, format.Footer...)
-
- return append(b, ':')
-}
-
-func appendStructEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte {
- return append(b, '}', ',')
-}
-
-func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- last := len(b) - 1
- if b[last] == ',' {
- b[last] = '}'
- return appendComma(ctx, b)
- }
- return appendStructEnd(ctx, code, b)
-}
-
-func restoreIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, _ uintptr) {}
-func storeIndent(_ uintptr, _ *encoder.Opcode, _ uintptr) {}
-func appendMapKeyIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { return b }
-func appendArrayElemIndent(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte { return b }
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_color/vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_color/vm.go
deleted file mode 100644
index a63e83e5505..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm_color/vm.go
+++ /dev/null
@@ -1,4859 +0,0 @@
-// Code generated by internal/cmd/generator. DO NOT EDIT!
-package vm_color
-
-import (
- "math"
- "reflect"
- "sort"
- "unsafe"
-
- "github.com/goccy/go-json/internal/encoder"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) {
- recursiveLevel := 0
- ptrOffset := uintptr(0)
- ctxptr := ctx.Ptr()
- var code *encoder.Opcode
- if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 {
- code = codeSet.EscapeKeyCode
- } else {
- code = codeSet.NoescapeKeyCode
- }
-
- for {
- switch code.Op {
- default:
- return nil, errUnimplementedOp(code.Op)
- case encoder.OpPtr:
- p := load(ctxptr, code.Idx)
- code = code.Next
- store(ctxptr, code.Idx, ptrToPtr(p))
- case encoder.OpIntPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpInt:
- b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpUintPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpUint:
- b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpIntString:
- b = append(b, '"')
- b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpUintString:
- b = append(b, '"')
- b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpFloat32Ptr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- b = appendComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpFloat32:
- b = appendFloat32(ctx, b, ptrToFloat32(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpFloat64Ptr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpFloat64:
- v := ptrToFloat64(load(ctxptr, code.Idx))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStringPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpString:
- b = appendString(ctx, b, ptrToString(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpBoolPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpBool:
- b = appendBool(ctx, b, ptrToBool(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpBytesPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpBytes:
- b = appendByteSlice(ctx, b, ptrToBytes(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpNumberPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpNumber:
- bb, err := appendNumber(ctx, b, ptrToNumber(load(ctxptr, code.Idx)))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpInterfacePtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpInterface:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- if recursiveLevel > encoder.StartDetectingCyclesAfter {
- for _, seen := range ctx.SeenPtr {
- if p == seen {
- return nil, errUnsupportedValue(code, p)
- }
- }
- }
- ctx.SeenPtr = append(ctx.SeenPtr, p)
- var (
- typ *runtime.Type
- ifacePtr unsafe.Pointer
- )
- up := ptrToUnsafePtr(p)
- if code.Flags&encoder.NonEmptyInterfaceFlags != 0 {
- iface := (*nonEmptyInterface)(up)
- ifacePtr = iface.ptr
- if iface.itab != nil {
- typ = iface.itab.typ
- }
- } else {
- iface := (*emptyInterface)(up)
- ifacePtr = iface.ptr
- typ = iface.typ
- }
- if ifacePtr == nil {
- isDirectedNil := typ != nil && typ.Kind() == reflect.Struct && !runtime.IfaceIndir(typ)
- if !isDirectedNil {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- }
- ctx.KeepRefs = append(ctx.KeepRefs, up)
- ifaceCodeSet, err := encoder.CompileToGetCodeSet(ctx, uintptr(unsafe.Pointer(typ)))
- if err != nil {
- return nil, err
- }
-
- totalLength := uintptr(code.Length) + 3
- nextTotalLength := uintptr(ifaceCodeSet.CodeLength) + 3
-
- var c *encoder.Opcode
- if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 {
- c = ifaceCodeSet.InterfaceEscapeKeyCode
- } else {
- c = ifaceCodeSet.InterfaceNoescapeKeyCode
- }
- curlen := uintptr(len(ctx.Ptrs))
- offsetNum := ptrOffset / uintptrSize
- oldOffset := ptrOffset
- ptrOffset += totalLength * uintptrSize
- oldBaseIndent := ctx.BaseIndent
- ctx.BaseIndent += code.Indent
-
- newLen := offsetNum + totalLength + nextTotalLength
- if curlen < newLen {
- ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...)
- }
- ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr
-
- end := ifaceCodeSet.EndCode
- store(ctxptr, c.Idx, uintptr(ifacePtr))
- store(ctxptr, end.Idx, oldOffset)
- store(ctxptr, end.ElemIdx, uintptr(unsafe.Pointer(code.Next)))
- storeIndent(ctxptr, end, uintptr(oldBaseIndent))
- code = c
- recursiveLevel++
- case encoder.OpInterfaceEnd:
- recursiveLevel--
-
- // restore ctxptr
- offset := load(ctxptr, code.Idx)
- restoreIndent(ctx, code, ctxptr)
- ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1]
-
- codePtr := load(ctxptr, code.ElemIdx)
- code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr))
- ctxptr = ctx.Ptr() + offset
- ptrOffset = offset
- case encoder.OpMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, ptrToPtr(p))
- fallthrough
- case encoder.OpMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p)
- }
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, ptrToPtr(p))
- fallthrough
- case encoder.OpMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = append(b, `""`...)
- b = appendComma(ctx, b)
- code = code.Next
- break
- }
- if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p)
- }
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpSlicePtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpSlice:
- p := load(ctxptr, code.Idx)
- slice := ptrToSlice(p)
- if p == 0 || slice.Data == nil {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.ElemIdx, 0)
- store(ctxptr, code.Length, uintptr(slice.Len))
- store(ctxptr, code.Idx, uintptr(slice.Data))
- if slice.Len > 0 {
- b = appendArrayHead(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, uintptr(slice.Data))
- } else {
- b = appendEmptyArray(ctx, b)
- code = code.End.Next
- }
- case encoder.OpSliceElem:
- idx := load(ctxptr, code.ElemIdx)
- length := load(ctxptr, code.Length)
- idx++
- if idx < length {
- b = appendArrayElemIndent(ctx, code, b)
- store(ctxptr, code.ElemIdx, idx)
- data := load(ctxptr, code.Idx)
- size := uintptr(code.Size)
- code = code.Next
- store(ctxptr, code.Idx, data+idx*size)
- } else {
- b = appendArrayEnd(ctx, code, b)
- code = code.End.Next
- }
- case encoder.OpArrayPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpArray:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- if code.Length > 0 {
- b = appendArrayHead(ctx, code, b)
- store(ctxptr, code.ElemIdx, 0)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- b = appendEmptyArray(ctx, b)
- code = code.End.Next
- }
- case encoder.OpArrayElem:
- idx := load(ctxptr, code.ElemIdx)
- idx++
- if idx < uintptr(code.Length) {
- b = appendArrayElemIndent(ctx, code, b)
- store(ctxptr, code.ElemIdx, idx)
- p := load(ctxptr, code.Idx)
- size := uintptr(code.Size)
- code = code.Next
- store(ctxptr, code.Idx, p+idx*size)
- } else {
- b = appendArrayEnd(ctx, code, b)
- code = code.End.Next
- }
- case encoder.OpMapPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpMap:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- uptr := ptrToUnsafePtr(p)
- mlen := maplen(uptr)
- if mlen <= 0 {
- b = appendEmptyObject(ctx, b)
- code = code.End.Next
- break
- }
- b = appendStructHead(ctx, b)
- unorderedMap := (ctx.Option.Flag & encoder.UnorderedMapOption) != 0
- mapCtx := encoder.NewMapContext(mlen, unorderedMap)
- mapiterinit(code.Type, uptr, &mapCtx.Iter)
- store(ctxptr, code.Idx, uintptr(unsafe.Pointer(mapCtx)))
- ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx))
- if unorderedMap {
- b = appendMapKeyIndent(ctx, code.Next, b)
- } else {
- mapCtx.Start = len(b)
- mapCtx.First = len(b)
- }
- key := mapiterkey(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(key))
- code = code.Next
- case encoder.OpMapKey:
- mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
- idx := mapCtx.Idx
- idx++
- if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 {
- if idx < mapCtx.Len {
- b = appendMapKeyIndent(ctx, code, b)
- mapCtx.Idx = int(idx)
- key := mapiterkey(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(key))
- code = code.Next
- } else {
- b = appendObjectEnd(ctx, code, b)
- encoder.ReleaseMapContext(mapCtx)
- code = code.End.Next
- }
- } else {
- mapCtx.Slice.Items[mapCtx.Idx].Value = b[mapCtx.Start:len(b)]
- if idx < mapCtx.Len {
- mapCtx.Idx = int(idx)
- mapCtx.Start = len(b)
- key := mapiterkey(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(key))
- code = code.Next
- } else {
- code = code.End
- }
- }
- case encoder.OpMapValue:
- mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
- if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 {
- b = appendColon(ctx, b)
- } else {
- mapCtx.Slice.Items[mapCtx.Idx].Key = b[mapCtx.Start:len(b)]
- mapCtx.Start = len(b)
- }
- value := mapitervalue(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(value))
- mapiternext(&mapCtx.Iter)
- code = code.Next
- case encoder.OpMapEnd:
- // this operation only used by sorted map.
- mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
- sort.Sort(mapCtx.Slice)
- buf := mapCtx.Buf
- for _, item := range mapCtx.Slice.Items {
- buf = appendMapKeyValue(ctx, code, buf, item.Key, item.Value)
- }
- buf = appendMapEnd(ctx, code, buf)
- b = b[:mapCtx.First]
- b = append(b, buf...)
- mapCtx.Buf = buf
- encoder.ReleaseMapContext(mapCtx)
- code = code.Next
- case encoder.OpRecursivePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpRecursive:
- ptr := load(ctxptr, code.Idx)
- if ptr != 0 {
- if recursiveLevel > encoder.StartDetectingCyclesAfter {
- for _, seen := range ctx.SeenPtr {
- if ptr == seen {
- return nil, errUnsupportedValue(code, ptr)
- }
- }
- }
- }
- ctx.SeenPtr = append(ctx.SeenPtr, ptr)
- c := code.Jmp.Code
- curlen := uintptr(len(ctx.Ptrs))
- offsetNum := ptrOffset / uintptrSize
- oldOffset := ptrOffset
- ptrOffset += code.Jmp.CurLen * uintptrSize
- oldBaseIndent := ctx.BaseIndent
- indentDiffFromTop := c.Indent - 1
- ctx.BaseIndent += code.Indent - indentDiffFromTop
-
- newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
- if curlen < newLen {
- ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...)
- }
- ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr
-
- store(ctxptr, c.Idx, ptr)
- store(ctxptr, c.End.Next.Idx, oldOffset)
- store(ctxptr, c.End.Next.ElemIdx, uintptr(unsafe.Pointer(code.Next)))
- storeIndent(ctxptr, c.End.Next, uintptr(oldBaseIndent))
- code = c
- recursiveLevel++
- case encoder.OpRecursiveEnd:
- recursiveLevel--
-
- // restore ctxptr
- restoreIndent(ctx, code, ctxptr)
- offset := load(ctxptr, code.Idx)
- ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1]
-
- codePtr := load(ctxptr, code.ElemIdx)
- code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr))
- ctxptr = ctx.Ptr() + offset
- ptrOffset = offset
- case encoder.OpStructPtrHead:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHead:
- p := load(ctxptr, code.Idx)
- if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if len(code.Key) > 0 {
- if (code.Flags&encoder.IsTaggedKeyFlags) != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 {
- b = appendStructKey(ctx, code, b)
- }
- }
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmpty:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmpty:
- p := load(ctxptr, code.Idx)
- if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadInt:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadInt:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyInt:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyInt:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadIntString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadIntString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyIntString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyIntString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- u64 := ptrToUint64(p, code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendInt(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadUint:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadUint:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUint:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyUint:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadUintString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadUintString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUintString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyUintString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendUint(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat32:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat32:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat32String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat32String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat64:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat64:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat64String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat64String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNull(ctx, b)
- b = appendComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToString(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadStringString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadStringString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p+uintptr(code.Offset)))))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyStringString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyStringString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToString(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, ptrToString(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadBool:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadBool:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBool:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyBool:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- } else {
- code = code.NextField
- }
- case encoder.OpStructPtrHeadBoolString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadBoolString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBoolString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyBoolString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- } else {
- code = code.NextField
- }
- case encoder.OpStructPtrHeadBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendBool(ctx, b, ptrToBool(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadBytes:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadBytes:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBytes:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyBytes:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToBytes(p + uintptr(code.Offset))
- if len(v) == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadNumber:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadNumber:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumber:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumber:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToNumber(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- }
- case encoder.OpStructPtrHeadNumberString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadNumberString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumberString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumberString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToNumber(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructPtrHeadNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadArray, encoder.OpStructHeadSlice:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmptyArray:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyArray:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmptySlice:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptySlice:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- slice := ptrToSlice(p)
- if slice.Len == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.NextField
- } else {
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadMap:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMap:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p + uintptr(code.Offset))
- }
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmptyMap:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMap:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p + uintptr(code.Offset))
- }
- if maplen(ptrToUnsafePtr(p)) == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.NextField
- break
- }
- p = ptrToPtr(p + uintptr(code.Offset))
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.NextField
- } else {
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadOmitEmptyMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p == 0 {
- code = code.NextField
- break
- }
- p = ptrToPtr(p + uintptr(code.Offset))
- if p == 0 {
- code = code.NextField
- } else {
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON {
- p = ptrToPtr(p)
- }
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON {
- p = ptrToPtr(p)
- }
- }
- iface := ptrToInterface(code, p)
- if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, iface)
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText {
- p = ptrToPtr(p)
- }
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText {
- p = ptrToPtr(p)
- }
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructField:
- if code.Flags&encoder.IsTaggedKeyFlags != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 {
- b = appendStructKey(ctx, code, b)
- }
- p := load(ctxptr, code.Idx) + uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmpty:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructFieldInt:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyInt:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldIntString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyIntString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldIntPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendInt(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldIntPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUint:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUint:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUintString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUintString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUintPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendUint(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUintPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32String:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldStringString:
- p := load(ctxptr, code.Idx)
- s := ptrToString(p + uintptr(code.Offset))
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, s)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyStringString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldStringPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, ptrToString(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldStringPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBool:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBool:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBoolString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBoolString:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBoolPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendBool(ctx, b, ptrToBool(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBoolPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBytes:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBytes:
- p := load(ctxptr, code.Idx)
- v := ptrToBytes(p + uintptr(code.Offset))
- if len(v) > 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBytesPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldNumber:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumber:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldNumberString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumberString:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldNumberPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldNumberPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldMarshalJSON:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalJSON:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- code = code.NextField
- break
- }
- iface := ptrToInterface(code, p)
- if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) {
- code = code.NextField
- break
- }
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, iface)
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructFieldMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldMarshalText:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalText:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- code = code.NextField
- break
- }
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructFieldMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldArray:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyArray:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldArrayPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyArrayPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- code = code.NextField
- }
- case encoder.OpStructFieldSlice:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptySlice:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- slice := ptrToSlice(p)
- if slice.Len == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructFieldSlicePtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptySlicePtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- code = code.NextField
- }
- case encoder.OpStructFieldMap:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyMap:
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructFieldMapPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- if p != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyMapPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- if p != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- code = code.NextField
- }
- case encoder.OpStructFieldStruct:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyStruct:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructEnd:
- b = appendStructEndSkipLast(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndInt:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyInt:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndIntString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyIntString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndIntPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendInt(ctx, b, p, code)
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p, code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndIntPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUint:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUint:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUintString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUintString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUintPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendUint(ctx, b, p, code)
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p, code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUintPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32String:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32Ptr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32PtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64Ptr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- break
- }
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64PtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndStringString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- s := ptrToString(p + uintptr(code.Offset))
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, s)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyStringString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndStringPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, ptrToString(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndStringPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBool:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBool:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBoolString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBoolString:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBoolPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendBool(ctx, b, ptrToBool(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBoolPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBytes:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBytes:
- p := load(ctxptr, code.Idx)
- v := ptrToBytes(p + uintptr(code.Offset))
- if len(v) > 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBytesPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumber:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = appendStructEnd(ctx, code, bb)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumber:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = appendStructEnd(ctx, code, bb)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumberString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumberString:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumberPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = appendStructEnd(ctx, code, bb)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumberPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpEnd:
- goto END
- }
- }
-END:
- return b, nil
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/debug_vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/debug_vm.go
deleted file mode 100644
index dd4cd489e06..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/debug_vm.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package vm_color_indent
-
-import (
- "fmt"
-
- "github.com/goccy/go-json/internal/encoder"
-)
-
-func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) {
- var code *encoder.Opcode
- if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 {
- code = codeSet.EscapeKeyCode
- } else {
- code = codeSet.NoescapeKeyCode
- }
-
- defer func() {
- if err := recover(); err != nil {
- w := ctx.Option.DebugOut
- fmt.Fprintln(w, "=============[DEBUG]===============")
- fmt.Fprintln(w, "* [TYPE]")
- fmt.Fprintln(w, codeSet.Type)
- fmt.Fprintf(w, "\n")
- fmt.Fprintln(w, "* [ALL OPCODE]")
- fmt.Fprintln(w, code.Dump())
- fmt.Fprintf(w, "\n")
- fmt.Fprintln(w, "* [CONTEXT]")
- fmt.Fprintf(w, "%+v\n", ctx)
- fmt.Fprintln(w, "===================================")
- panic(err)
- }
- }()
-
- return Run(ctx, b, codeSet)
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/util.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/util.go
deleted file mode 100644
index 2395abec975..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/util.go
+++ /dev/null
@@ -1,297 +0,0 @@
-package vm_color_indent
-
-import (
- "encoding/json"
- "fmt"
- "unsafe"
-
- "github.com/goccy/go-json/internal/encoder"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-const uintptrSize = 4 << (^uintptr(0) >> 63)
-
-var (
- appendIndent = encoder.AppendIndent
- appendStructEnd = encoder.AppendStructEndIndent
- errUnsupportedValue = encoder.ErrUnsupportedValue
- errUnsupportedFloat = encoder.ErrUnsupportedFloat
- mapiterinit = encoder.MapIterInit
- mapiterkey = encoder.MapIterKey
- mapitervalue = encoder.MapIterValue
- mapiternext = encoder.MapIterNext
- maplen = encoder.MapLen
-)
-
-type emptyInterface struct {
- typ *runtime.Type
- ptr unsafe.Pointer
-}
-
-type nonEmptyInterface struct {
- itab *struct {
- ityp *runtime.Type // static interface type
- typ *runtime.Type // dynamic concrete type
- // unused fields...
- }
- ptr unsafe.Pointer
-}
-
-func errUnimplementedOp(op encoder.OpType) error {
- return fmt.Errorf("encoder (indent): opcode %s has not been implemented", op)
-}
-
-func load(base uintptr, idx uint32) uintptr {
- addr := base + uintptr(idx)
- return **(**uintptr)(unsafe.Pointer(&addr))
-}
-
-func store(base uintptr, idx uint32, p uintptr) {
- addr := base + uintptr(idx)
- **(**uintptr)(unsafe.Pointer(&addr)) = p
-}
-
-func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr {
- addr := base + uintptr(idx)
- p := **(**uintptr)(unsafe.Pointer(&addr))
- for i := uint8(0); i < ptrNum; i++ {
- if p == 0 {
- return 0
- }
- p = ptrToPtr(p)
- }
- return p
-}
-
-func ptrToUint64(p uintptr, bitSize uint8) uint64 {
- switch bitSize {
- case 8:
- return (uint64)(**(**uint8)(unsafe.Pointer(&p)))
- case 16:
- return (uint64)(**(**uint16)(unsafe.Pointer(&p)))
- case 32:
- return (uint64)(**(**uint32)(unsafe.Pointer(&p)))
- case 64:
- return **(**uint64)(unsafe.Pointer(&p))
- }
- return 0
-}
-
-func ptrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) }
-func ptrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) }
-func ptrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) }
-func ptrToBytes(p uintptr) []byte { return **(**[]byte)(unsafe.Pointer(&p)) }
-func ptrToNumber(p uintptr) json.Number { return **(**json.Number)(unsafe.Pointer(&p)) }
-func ptrToString(p uintptr) string { return **(**string)(unsafe.Pointer(&p)) }
-func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader)(unsafe.Pointer(&p)) }
-func ptrToPtr(p uintptr) uintptr {
- return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p)))
-}
-func ptrToNPtr(p uintptr, ptrNum uint8) uintptr {
- for i := uint8(0); i < ptrNum; i++ {
- if p == 0 {
- return 0
- }
- p = ptrToPtr(p)
- }
- return p
-}
-
-func ptrToUnsafePtr(p uintptr) unsafe.Pointer {
- return *(*unsafe.Pointer)(unsafe.Pointer(&p))
-}
-func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} {
- return *(*interface{})(unsafe.Pointer(&emptyInterface{
- typ: code.Type,
- ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)),
- }))
-}
-
-func appendInt(ctx *encoder.RuntimeContext, b []byte, p uintptr, code *encoder.Opcode) []byte {
- format := ctx.Option.ColorScheme.Int
- b = append(b, format.Header...)
- b = encoder.AppendInt(ctx, b, p, code)
- return append(b, format.Footer...)
-}
-
-func appendUint(ctx *encoder.RuntimeContext, b []byte, p uintptr, code *encoder.Opcode) []byte {
- format := ctx.Option.ColorScheme.Uint
- b = append(b, format.Header...)
- b = encoder.AppendUint(ctx, b, p, code)
- return append(b, format.Footer...)
-}
-
-func appendFloat32(ctx *encoder.RuntimeContext, b []byte, v float32) []byte {
- format := ctx.Option.ColorScheme.Float
- b = append(b, format.Header...)
- b = encoder.AppendFloat32(ctx, b, v)
- return append(b, format.Footer...)
-}
-
-func appendFloat64(ctx *encoder.RuntimeContext, b []byte, v float64) []byte {
- format := ctx.Option.ColorScheme.Float
- b = append(b, format.Header...)
- b = encoder.AppendFloat64(ctx, b, v)
- return append(b, format.Footer...)
-}
-
-func appendString(ctx *encoder.RuntimeContext, b []byte, v string) []byte {
- format := ctx.Option.ColorScheme.String
- b = append(b, format.Header...)
- b = encoder.AppendString(ctx, b, v)
- return append(b, format.Footer...)
-}
-
-func appendByteSlice(ctx *encoder.RuntimeContext, b []byte, src []byte) []byte {
- format := ctx.Option.ColorScheme.Binary
- b = append(b, format.Header...)
- b = encoder.AppendByteSlice(ctx, b, src)
- return append(b, format.Footer...)
-}
-
-func appendNumber(ctx *encoder.RuntimeContext, b []byte, n json.Number) ([]byte, error) {
- format := ctx.Option.ColorScheme.Int
- b = append(b, format.Header...)
- bb, err := encoder.AppendNumber(ctx, b, n)
- if err != nil {
- return nil, err
- }
- return append(bb, format.Footer...), nil
-}
-
-func appendBool(ctx *encoder.RuntimeContext, b []byte, v bool) []byte {
- format := ctx.Option.ColorScheme.Bool
- b = append(b, format.Header...)
- if v {
- b = append(b, "true"...)
- } else {
- b = append(b, "false"...)
- }
- return append(b, format.Footer...)
-}
-
-func appendNull(ctx *encoder.RuntimeContext, b []byte) []byte {
- format := ctx.Option.ColorScheme.Null
- b = append(b, format.Header...)
- b = append(b, "null"...)
- return append(b, format.Footer...)
-}
-
-func appendComma(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, ',', '\n')
-}
-
-func appendNullComma(ctx *encoder.RuntimeContext, b []byte) []byte {
- format := ctx.Option.ColorScheme.Null
- b = append(b, format.Header...)
- b = append(b, "null"...)
- return append(append(b, format.Footer...), ',', '\n')
-}
-
-func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b[:len(b)-2], ':', ' ')
-}
-
-func appendMapKeyValue(ctx *encoder.RuntimeContext, code *encoder.Opcode, b, key, value []byte) []byte {
- b = appendIndent(ctx, b, code.Indent+1)
- b = append(b, key...)
- b[len(b)-2] = ':'
- b[len(b)-1] = ' '
- return append(b, value...)
-}
-
-func appendMapEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- b = b[:len(b)-2]
- b = append(b, '\n')
- b = appendIndent(ctx, b, code.Indent)
- return append(b, '}', ',', '\n')
-}
-
-func appendArrayHead(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- b = append(b, '[', '\n')
- return appendIndent(ctx, b, code.Indent+1)
-}
-
-func appendArrayEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- b = b[:len(b)-2]
- b = append(b, '\n')
- b = appendIndent(ctx, b, code.Indent)
- return append(b, ']', ',', '\n')
-}
-
-func appendEmptyArray(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, '[', ']', ',', '\n')
-}
-
-func appendEmptyObject(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, '{', '}', ',', '\n')
-}
-
-func appendObjectEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- last := len(b) - 1
- // replace comma to newline
- b[last-1] = '\n'
- b = appendIndent(ctx, b[:last], code.Indent)
- return append(b, '}', ',', '\n')
-}
-
-func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) {
- return encoder.AppendMarshalJSONIndent(ctx, code, b, v)
-}
-
-func appendMarshalText(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) {
- format := ctx.Option.ColorScheme.String
- b = append(b, format.Header...)
- bb, err := encoder.AppendMarshalTextIndent(ctx, code, b, v)
- if err != nil {
- return nil, err
- }
- return append(bb, format.Footer...), nil
-}
-
-func appendStructHead(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, '{', '\n')
-}
-
-func appendStructKey(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- b = appendIndent(ctx, b, code.Indent)
-
- format := ctx.Option.ColorScheme.ObjectKey
- b = append(b, format.Header...)
- b = append(b, code.Key[:len(code.Key)-1]...)
- b = append(b, format.Footer...)
-
- return append(b, ':', ' ')
-}
-
-func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- last := len(b) - 1
- if b[last-1] == '{' {
- b[last] = '}'
- } else {
- if b[last] == '\n' {
- // to remove ',' and '\n' characters
- b = b[:len(b)-2]
- }
- b = append(b, '\n')
- b = appendIndent(ctx, b, code.Indent-1)
- b = append(b, '}')
- }
- return appendComma(ctx, b)
-}
-
-func restoreIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, ctxptr uintptr) {
- ctx.BaseIndent = uint32(load(ctxptr, code.Length))
-}
-
-func storeIndent(ctxptr uintptr, code *encoder.Opcode, indent uintptr) {
- store(ctxptr, code.Length, indent)
-}
-
-func appendArrayElemIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- return appendIndent(ctx, b, code.Indent+1)
-}
-
-func appendMapKeyIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- return appendIndent(ctx, b, code.Indent)
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/vm.go
deleted file mode 100644
index 3b4e22e5d42..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm_color_indent/vm.go
+++ /dev/null
@@ -1,4859 +0,0 @@
-// Code generated by internal/cmd/generator. DO NOT EDIT!
-package vm_color_indent
-
-import (
- "math"
- "reflect"
- "sort"
- "unsafe"
-
- "github.com/goccy/go-json/internal/encoder"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) {
- recursiveLevel := 0
- ptrOffset := uintptr(0)
- ctxptr := ctx.Ptr()
- var code *encoder.Opcode
- if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 {
- code = codeSet.EscapeKeyCode
- } else {
- code = codeSet.NoescapeKeyCode
- }
-
- for {
- switch code.Op {
- default:
- return nil, errUnimplementedOp(code.Op)
- case encoder.OpPtr:
- p := load(ctxptr, code.Idx)
- code = code.Next
- store(ctxptr, code.Idx, ptrToPtr(p))
- case encoder.OpIntPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpInt:
- b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpUintPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpUint:
- b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpIntString:
- b = append(b, '"')
- b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpUintString:
- b = append(b, '"')
- b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpFloat32Ptr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- b = appendComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpFloat32:
- b = appendFloat32(ctx, b, ptrToFloat32(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpFloat64Ptr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpFloat64:
- v := ptrToFloat64(load(ctxptr, code.Idx))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStringPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpString:
- b = appendString(ctx, b, ptrToString(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpBoolPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpBool:
- b = appendBool(ctx, b, ptrToBool(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpBytesPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpBytes:
- b = appendByteSlice(ctx, b, ptrToBytes(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpNumberPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpNumber:
- bb, err := appendNumber(ctx, b, ptrToNumber(load(ctxptr, code.Idx)))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpInterfacePtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpInterface:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- if recursiveLevel > encoder.StartDetectingCyclesAfter {
- for _, seen := range ctx.SeenPtr {
- if p == seen {
- return nil, errUnsupportedValue(code, p)
- }
- }
- }
- ctx.SeenPtr = append(ctx.SeenPtr, p)
- var (
- typ *runtime.Type
- ifacePtr unsafe.Pointer
- )
- up := ptrToUnsafePtr(p)
- if code.Flags&encoder.NonEmptyInterfaceFlags != 0 {
- iface := (*nonEmptyInterface)(up)
- ifacePtr = iface.ptr
- if iface.itab != nil {
- typ = iface.itab.typ
- }
- } else {
- iface := (*emptyInterface)(up)
- ifacePtr = iface.ptr
- typ = iface.typ
- }
- if ifacePtr == nil {
- isDirectedNil := typ != nil && typ.Kind() == reflect.Struct && !runtime.IfaceIndir(typ)
- if !isDirectedNil {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- }
- ctx.KeepRefs = append(ctx.KeepRefs, up)
- ifaceCodeSet, err := encoder.CompileToGetCodeSet(ctx, uintptr(unsafe.Pointer(typ)))
- if err != nil {
- return nil, err
- }
-
- totalLength := uintptr(code.Length) + 3
- nextTotalLength := uintptr(ifaceCodeSet.CodeLength) + 3
-
- var c *encoder.Opcode
- if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 {
- c = ifaceCodeSet.InterfaceEscapeKeyCode
- } else {
- c = ifaceCodeSet.InterfaceNoescapeKeyCode
- }
- curlen := uintptr(len(ctx.Ptrs))
- offsetNum := ptrOffset / uintptrSize
- oldOffset := ptrOffset
- ptrOffset += totalLength * uintptrSize
- oldBaseIndent := ctx.BaseIndent
- ctx.BaseIndent += code.Indent
-
- newLen := offsetNum + totalLength + nextTotalLength
- if curlen < newLen {
- ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...)
- }
- ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr
-
- end := ifaceCodeSet.EndCode
- store(ctxptr, c.Idx, uintptr(ifacePtr))
- store(ctxptr, end.Idx, oldOffset)
- store(ctxptr, end.ElemIdx, uintptr(unsafe.Pointer(code.Next)))
- storeIndent(ctxptr, end, uintptr(oldBaseIndent))
- code = c
- recursiveLevel++
- case encoder.OpInterfaceEnd:
- recursiveLevel--
-
- // restore ctxptr
- offset := load(ctxptr, code.Idx)
- restoreIndent(ctx, code, ctxptr)
- ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1]
-
- codePtr := load(ctxptr, code.ElemIdx)
- code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr))
- ctxptr = ctx.Ptr() + offset
- ptrOffset = offset
- case encoder.OpMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, ptrToPtr(p))
- fallthrough
- case encoder.OpMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p)
- }
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, ptrToPtr(p))
- fallthrough
- case encoder.OpMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = append(b, `""`...)
- b = appendComma(ctx, b)
- code = code.Next
- break
- }
- if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p)
- }
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpSlicePtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpSlice:
- p := load(ctxptr, code.Idx)
- slice := ptrToSlice(p)
- if p == 0 || slice.Data == nil {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.ElemIdx, 0)
- store(ctxptr, code.Length, uintptr(slice.Len))
- store(ctxptr, code.Idx, uintptr(slice.Data))
- if slice.Len > 0 {
- b = appendArrayHead(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, uintptr(slice.Data))
- } else {
- b = appendEmptyArray(ctx, b)
- code = code.End.Next
- }
- case encoder.OpSliceElem:
- idx := load(ctxptr, code.ElemIdx)
- length := load(ctxptr, code.Length)
- idx++
- if idx < length {
- b = appendArrayElemIndent(ctx, code, b)
- store(ctxptr, code.ElemIdx, idx)
- data := load(ctxptr, code.Idx)
- size := uintptr(code.Size)
- code = code.Next
- store(ctxptr, code.Idx, data+idx*size)
- } else {
- b = appendArrayEnd(ctx, code, b)
- code = code.End.Next
- }
- case encoder.OpArrayPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpArray:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- if code.Length > 0 {
- b = appendArrayHead(ctx, code, b)
- store(ctxptr, code.ElemIdx, 0)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- b = appendEmptyArray(ctx, b)
- code = code.End.Next
- }
- case encoder.OpArrayElem:
- idx := load(ctxptr, code.ElemIdx)
- idx++
- if idx < uintptr(code.Length) {
- b = appendArrayElemIndent(ctx, code, b)
- store(ctxptr, code.ElemIdx, idx)
- p := load(ctxptr, code.Idx)
- size := uintptr(code.Size)
- code = code.Next
- store(ctxptr, code.Idx, p+idx*size)
- } else {
- b = appendArrayEnd(ctx, code, b)
- code = code.End.Next
- }
- case encoder.OpMapPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpMap:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- uptr := ptrToUnsafePtr(p)
- mlen := maplen(uptr)
- if mlen <= 0 {
- b = appendEmptyObject(ctx, b)
- code = code.End.Next
- break
- }
- b = appendStructHead(ctx, b)
- unorderedMap := (ctx.Option.Flag & encoder.UnorderedMapOption) != 0
- mapCtx := encoder.NewMapContext(mlen, unorderedMap)
- mapiterinit(code.Type, uptr, &mapCtx.Iter)
- store(ctxptr, code.Idx, uintptr(unsafe.Pointer(mapCtx)))
- ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx))
- if unorderedMap {
- b = appendMapKeyIndent(ctx, code.Next, b)
- } else {
- mapCtx.Start = len(b)
- mapCtx.First = len(b)
- }
- key := mapiterkey(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(key))
- code = code.Next
- case encoder.OpMapKey:
- mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
- idx := mapCtx.Idx
- idx++
- if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 {
- if idx < mapCtx.Len {
- b = appendMapKeyIndent(ctx, code, b)
- mapCtx.Idx = int(idx)
- key := mapiterkey(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(key))
- code = code.Next
- } else {
- b = appendObjectEnd(ctx, code, b)
- encoder.ReleaseMapContext(mapCtx)
- code = code.End.Next
- }
- } else {
- mapCtx.Slice.Items[mapCtx.Idx].Value = b[mapCtx.Start:len(b)]
- if idx < mapCtx.Len {
- mapCtx.Idx = int(idx)
- mapCtx.Start = len(b)
- key := mapiterkey(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(key))
- code = code.Next
- } else {
- code = code.End
- }
- }
- case encoder.OpMapValue:
- mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
- if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 {
- b = appendColon(ctx, b)
- } else {
- mapCtx.Slice.Items[mapCtx.Idx].Key = b[mapCtx.Start:len(b)]
- mapCtx.Start = len(b)
- }
- value := mapitervalue(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(value))
- mapiternext(&mapCtx.Iter)
- code = code.Next
- case encoder.OpMapEnd:
- // this operation only used by sorted map.
- mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
- sort.Sort(mapCtx.Slice)
- buf := mapCtx.Buf
- for _, item := range mapCtx.Slice.Items {
- buf = appendMapKeyValue(ctx, code, buf, item.Key, item.Value)
- }
- buf = appendMapEnd(ctx, code, buf)
- b = b[:mapCtx.First]
- b = append(b, buf...)
- mapCtx.Buf = buf
- encoder.ReleaseMapContext(mapCtx)
- code = code.Next
- case encoder.OpRecursivePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpRecursive:
- ptr := load(ctxptr, code.Idx)
- if ptr != 0 {
- if recursiveLevel > encoder.StartDetectingCyclesAfter {
- for _, seen := range ctx.SeenPtr {
- if ptr == seen {
- return nil, errUnsupportedValue(code, ptr)
- }
- }
- }
- }
- ctx.SeenPtr = append(ctx.SeenPtr, ptr)
- c := code.Jmp.Code
- curlen := uintptr(len(ctx.Ptrs))
- offsetNum := ptrOffset / uintptrSize
- oldOffset := ptrOffset
- ptrOffset += code.Jmp.CurLen * uintptrSize
- oldBaseIndent := ctx.BaseIndent
- indentDiffFromTop := c.Indent - 1
- ctx.BaseIndent += code.Indent - indentDiffFromTop
-
- newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
- if curlen < newLen {
- ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...)
- }
- ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr
-
- store(ctxptr, c.Idx, ptr)
- store(ctxptr, c.End.Next.Idx, oldOffset)
- store(ctxptr, c.End.Next.ElemIdx, uintptr(unsafe.Pointer(code.Next)))
- storeIndent(ctxptr, c.End.Next, uintptr(oldBaseIndent))
- code = c
- recursiveLevel++
- case encoder.OpRecursiveEnd:
- recursiveLevel--
-
- // restore ctxptr
- restoreIndent(ctx, code, ctxptr)
- offset := load(ctxptr, code.Idx)
- ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1]
-
- codePtr := load(ctxptr, code.ElemIdx)
- code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr))
- ctxptr = ctx.Ptr() + offset
- ptrOffset = offset
- case encoder.OpStructPtrHead:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHead:
- p := load(ctxptr, code.Idx)
- if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if len(code.Key) > 0 {
- if (code.Flags&encoder.IsTaggedKeyFlags) != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 {
- b = appendStructKey(ctx, code, b)
- }
- }
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmpty:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmpty:
- p := load(ctxptr, code.Idx)
- if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadInt:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadInt:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyInt:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyInt:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadIntString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadIntString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyIntString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyIntString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- u64 := ptrToUint64(p, code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendInt(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadUint:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadUint:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUint:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyUint:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadUintString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadUintString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUintString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyUintString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendUint(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat32:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat32:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat32String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat32String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat64:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat64:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat64String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat64String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNull(ctx, b)
- b = appendComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToString(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadStringString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadStringString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p+uintptr(code.Offset)))))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyStringString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyStringString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToString(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, ptrToString(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadBool:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadBool:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBool:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyBool:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- } else {
- code = code.NextField
- }
- case encoder.OpStructPtrHeadBoolString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadBoolString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBoolString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyBoolString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- } else {
- code = code.NextField
- }
- case encoder.OpStructPtrHeadBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendBool(ctx, b, ptrToBool(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadBytes:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadBytes:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBytes:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyBytes:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToBytes(p + uintptr(code.Offset))
- if len(v) == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadNumber:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadNumber:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumber:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumber:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToNumber(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- }
- case encoder.OpStructPtrHeadNumberString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadNumberString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumberString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumberString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToNumber(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructPtrHeadNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadArray, encoder.OpStructHeadSlice:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmptyArray:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyArray:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmptySlice:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptySlice:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- slice := ptrToSlice(p)
- if slice.Len == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.NextField
- } else {
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadMap:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMap:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p + uintptr(code.Offset))
- }
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmptyMap:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMap:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p + uintptr(code.Offset))
- }
- if maplen(ptrToUnsafePtr(p)) == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.NextField
- break
- }
- p = ptrToPtr(p + uintptr(code.Offset))
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.NextField
- } else {
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadOmitEmptyMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p == 0 {
- code = code.NextField
- break
- }
- p = ptrToPtr(p + uintptr(code.Offset))
- if p == 0 {
- code = code.NextField
- } else {
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON {
- p = ptrToPtr(p)
- }
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON {
- p = ptrToPtr(p)
- }
- }
- iface := ptrToInterface(code, p)
- if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, iface)
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText {
- p = ptrToPtr(p)
- }
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText {
- p = ptrToPtr(p)
- }
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructField:
- if code.Flags&encoder.IsTaggedKeyFlags != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 {
- b = appendStructKey(ctx, code, b)
- }
- p := load(ctxptr, code.Idx) + uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmpty:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructFieldInt:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyInt:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldIntString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyIntString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldIntPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendInt(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldIntPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUint:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUint:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUintString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUintString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUintPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendUint(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUintPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32String:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldStringString:
- p := load(ctxptr, code.Idx)
- s := ptrToString(p + uintptr(code.Offset))
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, s)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyStringString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldStringPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, ptrToString(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldStringPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBool:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBool:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBoolString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBoolString:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBoolPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendBool(ctx, b, ptrToBool(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBoolPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBytes:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBytes:
- p := load(ctxptr, code.Idx)
- v := ptrToBytes(p + uintptr(code.Offset))
- if len(v) > 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBytesPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldNumber:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumber:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldNumberString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumberString:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldNumberPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldNumberPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldMarshalJSON:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalJSON:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- code = code.NextField
- break
- }
- iface := ptrToInterface(code, p)
- if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) {
- code = code.NextField
- break
- }
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, iface)
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructFieldMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldMarshalText:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalText:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- code = code.NextField
- break
- }
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructFieldMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldArray:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyArray:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldArrayPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyArrayPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- code = code.NextField
- }
- case encoder.OpStructFieldSlice:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptySlice:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- slice := ptrToSlice(p)
- if slice.Len == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructFieldSlicePtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptySlicePtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- code = code.NextField
- }
- case encoder.OpStructFieldMap:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyMap:
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructFieldMapPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- if p != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyMapPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- if p != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- code = code.NextField
- }
- case encoder.OpStructFieldStruct:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyStruct:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructEnd:
- b = appendStructEndSkipLast(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndInt:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyInt:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndIntString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyIntString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndIntPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendInt(ctx, b, p, code)
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p, code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndIntPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUint:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUint:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUintString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUintString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUintPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendUint(ctx, b, p, code)
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p, code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUintPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32String:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32Ptr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32PtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64Ptr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- break
- }
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64PtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndStringString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- s := ptrToString(p + uintptr(code.Offset))
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, s)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyStringString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndStringPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, ptrToString(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndStringPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBool:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBool:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBoolString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBoolString:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBoolPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendBool(ctx, b, ptrToBool(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBoolPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBytes:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBytes:
- p := load(ctxptr, code.Idx)
- v := ptrToBytes(p + uintptr(code.Offset))
- if len(v) > 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBytesPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumber:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = appendStructEnd(ctx, code, bb)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumber:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = appendStructEnd(ctx, code, bb)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumberString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumberString:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumberPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = appendStructEnd(ctx, code, bb)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumberPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpEnd:
- goto END
- }
- }
-END:
- return b, nil
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/debug_vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/debug_vm.go
deleted file mode 100644
index 99395388c1e..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/debug_vm.go
+++ /dev/null
@@ -1,35 +0,0 @@
-package vm_indent
-
-import (
- "fmt"
-
- "github.com/goccy/go-json/internal/encoder"
-)
-
-func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) {
- var code *encoder.Opcode
- if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 {
- code = codeSet.EscapeKeyCode
- } else {
- code = codeSet.NoescapeKeyCode
- }
-
- defer func() {
- if err := recover(); err != nil {
- w := ctx.Option.DebugOut
- fmt.Fprintln(w, "=============[DEBUG]===============")
- fmt.Fprintln(w, "* [TYPE]")
- fmt.Fprintln(w, codeSet.Type)
- fmt.Fprintf(w, "\n")
- fmt.Fprintln(w, "* [ALL OPCODE]")
- fmt.Fprintln(w, code.Dump())
- fmt.Fprintf(w, "\n")
- fmt.Fprintln(w, "* [CONTEXT]")
- fmt.Fprintf(w, "%+v\n", ctx)
- fmt.Fprintln(w, "===================================")
- panic(err)
- }
- }()
-
- return Run(ctx, b, codeSet)
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/hack.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/hack.go
deleted file mode 100644
index 9e245bfe57d..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/hack.go
+++ /dev/null
@@ -1,9 +0,0 @@
-package vm_indent
-
-import (
- // HACK: compile order
- // `vm`, `vm_indent`, `vm_color`, `vm_color_indent` packages uses a lot of memory to compile,
- // so forcibly make dependencies and avoid compiling in concurrent.
- // dependency order: vm => vm_indent => vm_color => vm_color_indent
- _ "github.com/goccy/go-json/internal/encoder/vm_color"
-)
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/util.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/util.go
deleted file mode 100644
index 6cb745e3939..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/util.go
+++ /dev/null
@@ -1,230 +0,0 @@
-package vm_indent
-
-import (
- "encoding/json"
- "fmt"
- "unsafe"
-
- "github.com/goccy/go-json/internal/encoder"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-const uintptrSize = 4 << (^uintptr(0) >> 63)
-
-var (
- appendInt = encoder.AppendInt
- appendUint = encoder.AppendUint
- appendFloat32 = encoder.AppendFloat32
- appendFloat64 = encoder.AppendFloat64
- appendString = encoder.AppendString
- appendByteSlice = encoder.AppendByteSlice
- appendNumber = encoder.AppendNumber
- appendStructEnd = encoder.AppendStructEndIndent
- appendIndent = encoder.AppendIndent
- errUnsupportedValue = encoder.ErrUnsupportedValue
- errUnsupportedFloat = encoder.ErrUnsupportedFloat
- mapiterinit = encoder.MapIterInit
- mapiterkey = encoder.MapIterKey
- mapitervalue = encoder.MapIterValue
- mapiternext = encoder.MapIterNext
- maplen = encoder.MapLen
-)
-
-type emptyInterface struct {
- typ *runtime.Type
- ptr unsafe.Pointer
-}
-
-type nonEmptyInterface struct {
- itab *struct {
- ityp *runtime.Type // static interface type
- typ *runtime.Type // dynamic concrete type
- // unused fields...
- }
- ptr unsafe.Pointer
-}
-
-func errUnimplementedOp(op encoder.OpType) error {
- return fmt.Errorf("encoder (indent): opcode %s has not been implemented", op)
-}
-
-func load(base uintptr, idx uint32) uintptr {
- addr := base + uintptr(idx)
- return **(**uintptr)(unsafe.Pointer(&addr))
-}
-
-func store(base uintptr, idx uint32, p uintptr) {
- addr := base + uintptr(idx)
- **(**uintptr)(unsafe.Pointer(&addr)) = p
-}
-
-func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr {
- addr := base + uintptr(idx)
- p := **(**uintptr)(unsafe.Pointer(&addr))
- for i := uint8(0); i < ptrNum; i++ {
- if p == 0 {
- return 0
- }
- p = ptrToPtr(p)
- }
- return p
-}
-
-func ptrToUint64(p uintptr, bitSize uint8) uint64 {
- switch bitSize {
- case 8:
- return (uint64)(**(**uint8)(unsafe.Pointer(&p)))
- case 16:
- return (uint64)(**(**uint16)(unsafe.Pointer(&p)))
- case 32:
- return (uint64)(**(**uint32)(unsafe.Pointer(&p)))
- case 64:
- return **(**uint64)(unsafe.Pointer(&p))
- }
- return 0
-}
-func ptrToFloat32(p uintptr) float32 { return **(**float32)(unsafe.Pointer(&p)) }
-func ptrToFloat64(p uintptr) float64 { return **(**float64)(unsafe.Pointer(&p)) }
-func ptrToBool(p uintptr) bool { return **(**bool)(unsafe.Pointer(&p)) }
-func ptrToBytes(p uintptr) []byte { return **(**[]byte)(unsafe.Pointer(&p)) }
-func ptrToNumber(p uintptr) json.Number { return **(**json.Number)(unsafe.Pointer(&p)) }
-func ptrToString(p uintptr) string { return **(**string)(unsafe.Pointer(&p)) }
-func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader)(unsafe.Pointer(&p)) }
-func ptrToPtr(p uintptr) uintptr {
- return uintptr(**(**unsafe.Pointer)(unsafe.Pointer(&p)))
-}
-func ptrToNPtr(p uintptr, ptrNum uint8) uintptr {
- for i := uint8(0); i < ptrNum; i++ {
- if p == 0 {
- return 0
- }
- p = ptrToPtr(p)
- }
- return p
-}
-
-func ptrToUnsafePtr(p uintptr) unsafe.Pointer {
- return *(*unsafe.Pointer)(unsafe.Pointer(&p))
-}
-func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} {
- return *(*interface{})(unsafe.Pointer(&emptyInterface{
- typ: code.Type,
- ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)),
- }))
-}
-
-func appendBool(_ *encoder.RuntimeContext, b []byte, v bool) []byte {
- if v {
- return append(b, "true"...)
- }
- return append(b, "false"...)
-}
-
-func appendNull(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, "null"...)
-}
-
-func appendComma(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, ',', '\n')
-}
-
-func appendNullComma(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, "null,\n"...)
-}
-
-func appendColon(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b[:len(b)-2], ':', ' ')
-}
-
-func appendMapKeyValue(ctx *encoder.RuntimeContext, code *encoder.Opcode, b, key, value []byte) []byte {
- b = appendIndent(ctx, b, code.Indent+1)
- b = append(b, key...)
- b[len(b)-2] = ':'
- b[len(b)-1] = ' '
- return append(b, value...)
-}
-
-func appendMapEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- b = b[:len(b)-2]
- b = append(b, '\n')
- b = appendIndent(ctx, b, code.Indent)
- return append(b, '}', ',', '\n')
-}
-
-func appendArrayHead(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- b = append(b, '[', '\n')
- return appendIndent(ctx, b, code.Indent+1)
-}
-
-func appendArrayEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- b = b[:len(b)-2]
- b = append(b, '\n')
- b = appendIndent(ctx, b, code.Indent)
- return append(b, ']', ',', '\n')
-}
-
-func appendEmptyArray(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, '[', ']', ',', '\n')
-}
-
-func appendEmptyObject(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, '{', '}', ',', '\n')
-}
-
-func appendObjectEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- last := len(b) - 1
- // replace comma to newline
- b[last-1] = '\n'
- b = appendIndent(ctx, b[:last], code.Indent)
- return append(b, '}', ',', '\n')
-}
-
-func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) {
- return encoder.AppendMarshalJSONIndent(ctx, code, b, v)
-}
-
-func appendMarshalText(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) {
- return encoder.AppendMarshalTextIndent(ctx, code, b, v)
-}
-
-func appendStructHead(_ *encoder.RuntimeContext, b []byte) []byte {
- return append(b, '{', '\n')
-}
-
-func appendStructKey(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- b = appendIndent(ctx, b, code.Indent)
- b = append(b, code.Key...)
- return append(b, ' ')
-}
-
-func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- last := len(b) - 1
- if b[last-1] == '{' {
- b[last] = '}'
- } else {
- if b[last] == '\n' {
- // to remove ',' and '\n' characters
- b = b[:len(b)-2]
- }
- b = append(b, '\n')
- b = appendIndent(ctx, b, code.Indent-1)
- b = append(b, '}')
- }
- return appendComma(ctx, b)
-}
-
-func restoreIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, ctxptr uintptr) {
- ctx.BaseIndent = uint32(load(ctxptr, code.Length))
-}
-
-func storeIndent(ctxptr uintptr, code *encoder.Opcode, indent uintptr) {
- store(ctxptr, code.Length, indent)
-}
-
-func appendArrayElemIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- return appendIndent(ctx, b, code.Indent+1)
-}
-
-func appendMapKeyIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte {
- return appendIndent(ctx, b, code.Indent)
-}
diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/vm.go
deleted file mode 100644
index 836c5c8a85a..00000000000
--- a/vendor/github.com/goccy/go-json/internal/encoder/vm_indent/vm.go
+++ /dev/null
@@ -1,4859 +0,0 @@
-// Code generated by internal/cmd/generator. DO NOT EDIT!
-package vm_indent
-
-import (
- "math"
- "reflect"
- "sort"
- "unsafe"
-
- "github.com/goccy/go-json/internal/encoder"
- "github.com/goccy/go-json/internal/runtime"
-)
-
-func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) {
- recursiveLevel := 0
- ptrOffset := uintptr(0)
- ctxptr := ctx.Ptr()
- var code *encoder.Opcode
- if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 {
- code = codeSet.EscapeKeyCode
- } else {
- code = codeSet.NoescapeKeyCode
- }
-
- for {
- switch code.Op {
- default:
- return nil, errUnimplementedOp(code.Op)
- case encoder.OpPtr:
- p := load(ctxptr, code.Idx)
- code = code.Next
- store(ctxptr, code.Idx, ptrToPtr(p))
- case encoder.OpIntPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpInt:
- b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpUintPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpUint:
- b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpIntString:
- b = append(b, '"')
- b = appendInt(ctx, b, load(ctxptr, code.Idx), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpUintString:
- b = append(b, '"')
- b = appendUint(ctx, b, load(ctxptr, code.Idx), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpFloat32Ptr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- b = appendComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpFloat32:
- b = appendFloat32(ctx, b, ptrToFloat32(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpFloat64Ptr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpFloat64:
- v := ptrToFloat64(load(ctxptr, code.Idx))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStringPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpString:
- b = appendString(ctx, b, ptrToString(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpBoolPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpBool:
- b = appendBool(ctx, b, ptrToBool(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpBytesPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpBytes:
- b = appendByteSlice(ctx, b, ptrToBytes(load(ctxptr, code.Idx)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpNumberPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpNumber:
- bb, err := appendNumber(ctx, b, ptrToNumber(load(ctxptr, code.Idx)))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpInterfacePtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpInterface:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- if recursiveLevel > encoder.StartDetectingCyclesAfter {
- for _, seen := range ctx.SeenPtr {
- if p == seen {
- return nil, errUnsupportedValue(code, p)
- }
- }
- }
- ctx.SeenPtr = append(ctx.SeenPtr, p)
- var (
- typ *runtime.Type
- ifacePtr unsafe.Pointer
- )
- up := ptrToUnsafePtr(p)
- if code.Flags&encoder.NonEmptyInterfaceFlags != 0 {
- iface := (*nonEmptyInterface)(up)
- ifacePtr = iface.ptr
- if iface.itab != nil {
- typ = iface.itab.typ
- }
- } else {
- iface := (*emptyInterface)(up)
- ifacePtr = iface.ptr
- typ = iface.typ
- }
- if ifacePtr == nil {
- isDirectedNil := typ != nil && typ.Kind() == reflect.Struct && !runtime.IfaceIndir(typ)
- if !isDirectedNil {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- }
- ctx.KeepRefs = append(ctx.KeepRefs, up)
- ifaceCodeSet, err := encoder.CompileToGetCodeSet(ctx, uintptr(unsafe.Pointer(typ)))
- if err != nil {
- return nil, err
- }
-
- totalLength := uintptr(code.Length) + 3
- nextTotalLength := uintptr(ifaceCodeSet.CodeLength) + 3
-
- var c *encoder.Opcode
- if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 {
- c = ifaceCodeSet.InterfaceEscapeKeyCode
- } else {
- c = ifaceCodeSet.InterfaceNoescapeKeyCode
- }
- curlen := uintptr(len(ctx.Ptrs))
- offsetNum := ptrOffset / uintptrSize
- oldOffset := ptrOffset
- ptrOffset += totalLength * uintptrSize
- oldBaseIndent := ctx.BaseIndent
- ctx.BaseIndent += code.Indent
-
- newLen := offsetNum + totalLength + nextTotalLength
- if curlen < newLen {
- ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...)
- }
- ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr
-
- end := ifaceCodeSet.EndCode
- store(ctxptr, c.Idx, uintptr(ifacePtr))
- store(ctxptr, end.Idx, oldOffset)
- store(ctxptr, end.ElemIdx, uintptr(unsafe.Pointer(code.Next)))
- storeIndent(ctxptr, end, uintptr(oldBaseIndent))
- code = c
- recursiveLevel++
- case encoder.OpInterfaceEnd:
- recursiveLevel--
-
- // restore ctxptr
- offset := load(ctxptr, code.Idx)
- restoreIndent(ctx, code, ctxptr)
- ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1]
-
- codePtr := load(ctxptr, code.ElemIdx)
- code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr))
- ctxptr = ctx.Ptr() + offset
- ptrOffset = offset
- case encoder.OpMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, ptrToPtr(p))
- fallthrough
- case encoder.OpMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p)
- }
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, ptrToPtr(p))
- fallthrough
- case encoder.OpMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = append(b, `""`...)
- b = appendComma(ctx, b)
- code = code.Next
- break
- }
- if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p)
- }
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpSlicePtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpSlice:
- p := load(ctxptr, code.Idx)
- slice := ptrToSlice(p)
- if p == 0 || slice.Data == nil {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.ElemIdx, 0)
- store(ctxptr, code.Length, uintptr(slice.Len))
- store(ctxptr, code.Idx, uintptr(slice.Data))
- if slice.Len > 0 {
- b = appendArrayHead(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, uintptr(slice.Data))
- } else {
- b = appendEmptyArray(ctx, b)
- code = code.End.Next
- }
- case encoder.OpSliceElem:
- idx := load(ctxptr, code.ElemIdx)
- length := load(ctxptr, code.Length)
- idx++
- if idx < length {
- b = appendArrayElemIndent(ctx, code, b)
- store(ctxptr, code.ElemIdx, idx)
- data := load(ctxptr, code.Idx)
- size := uintptr(code.Size)
- code = code.Next
- store(ctxptr, code.Idx, data+idx*size)
- } else {
- b = appendArrayEnd(ctx, code, b)
- code = code.End.Next
- }
- case encoder.OpArrayPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpArray:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- if code.Length > 0 {
- b = appendArrayHead(ctx, code, b)
- store(ctxptr, code.ElemIdx, 0)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- b = appendEmptyArray(ctx, b)
- code = code.End.Next
- }
- case encoder.OpArrayElem:
- idx := load(ctxptr, code.ElemIdx)
- idx++
- if idx < uintptr(code.Length) {
- b = appendArrayElemIndent(ctx, code, b)
- store(ctxptr, code.ElemIdx, idx)
- p := load(ctxptr, code.Idx)
- size := uintptr(code.Size)
- code = code.Next
- store(ctxptr, code.Idx, p+idx*size)
- } else {
- b = appendArrayEnd(ctx, code, b)
- code = code.End.Next
- }
- case encoder.OpMapPtr:
- p := loadNPtr(ctxptr, code.Idx, code.PtrNum)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, p)
- fallthrough
- case encoder.OpMap:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.End.Next
- break
- }
- uptr := ptrToUnsafePtr(p)
- mlen := maplen(uptr)
- if mlen <= 0 {
- b = appendEmptyObject(ctx, b)
- code = code.End.Next
- break
- }
- b = appendStructHead(ctx, b)
- unorderedMap := (ctx.Option.Flag & encoder.UnorderedMapOption) != 0
- mapCtx := encoder.NewMapContext(mlen, unorderedMap)
- mapiterinit(code.Type, uptr, &mapCtx.Iter)
- store(ctxptr, code.Idx, uintptr(unsafe.Pointer(mapCtx)))
- ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx))
- if unorderedMap {
- b = appendMapKeyIndent(ctx, code.Next, b)
- } else {
- mapCtx.Start = len(b)
- mapCtx.First = len(b)
- }
- key := mapiterkey(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(key))
- code = code.Next
- case encoder.OpMapKey:
- mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
- idx := mapCtx.Idx
- idx++
- if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 {
- if idx < mapCtx.Len {
- b = appendMapKeyIndent(ctx, code, b)
- mapCtx.Idx = int(idx)
- key := mapiterkey(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(key))
- code = code.Next
- } else {
- b = appendObjectEnd(ctx, code, b)
- encoder.ReleaseMapContext(mapCtx)
- code = code.End.Next
- }
- } else {
- mapCtx.Slice.Items[mapCtx.Idx].Value = b[mapCtx.Start:len(b)]
- if idx < mapCtx.Len {
- mapCtx.Idx = int(idx)
- mapCtx.Start = len(b)
- key := mapiterkey(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(key))
- code = code.Next
- } else {
- code = code.End
- }
- }
- case encoder.OpMapValue:
- mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
- if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 {
- b = appendColon(ctx, b)
- } else {
- mapCtx.Slice.Items[mapCtx.Idx].Key = b[mapCtx.Start:len(b)]
- mapCtx.Start = len(b)
- }
- value := mapitervalue(&mapCtx.Iter)
- store(ctxptr, code.Next.Idx, uintptr(value))
- mapiternext(&mapCtx.Iter)
- code = code.Next
- case encoder.OpMapEnd:
- // this operation only used by sorted map.
- mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(load(ctxptr, code.Idx)))
- sort.Sort(mapCtx.Slice)
- buf := mapCtx.Buf
- for _, item := range mapCtx.Slice.Items {
- buf = appendMapKeyValue(ctx, code, buf, item.Key, item.Value)
- }
- buf = appendMapEnd(ctx, code, buf)
- b = b[:mapCtx.First]
- b = append(b, buf...)
- mapCtx.Buf = buf
- encoder.ReleaseMapContext(mapCtx)
- code = code.Next
- case encoder.OpRecursivePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- code = code.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpRecursive:
- ptr := load(ctxptr, code.Idx)
- if ptr != 0 {
- if recursiveLevel > encoder.StartDetectingCyclesAfter {
- for _, seen := range ctx.SeenPtr {
- if ptr == seen {
- return nil, errUnsupportedValue(code, ptr)
- }
- }
- }
- }
- ctx.SeenPtr = append(ctx.SeenPtr, ptr)
- c := code.Jmp.Code
- curlen := uintptr(len(ctx.Ptrs))
- offsetNum := ptrOffset / uintptrSize
- oldOffset := ptrOffset
- ptrOffset += code.Jmp.CurLen * uintptrSize
- oldBaseIndent := ctx.BaseIndent
- indentDiffFromTop := c.Indent - 1
- ctx.BaseIndent += code.Indent - indentDiffFromTop
-
- newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen
- if curlen < newLen {
- ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...)
- }
- ctxptr = ctx.Ptr() + ptrOffset // assign new ctxptr
-
- store(ctxptr, c.Idx, ptr)
- store(ctxptr, c.End.Next.Idx, oldOffset)
- store(ctxptr, c.End.Next.ElemIdx, uintptr(unsafe.Pointer(code.Next)))
- storeIndent(ctxptr, c.End.Next, uintptr(oldBaseIndent))
- code = c
- recursiveLevel++
- case encoder.OpRecursiveEnd:
- recursiveLevel--
-
- // restore ctxptr
- restoreIndent(ctx, code, ctxptr)
- offset := load(ctxptr, code.Idx)
- ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1]
-
- codePtr := load(ctxptr, code.ElemIdx)
- code = (*encoder.Opcode)(ptrToUnsafePtr(codePtr))
- ctxptr = ctx.Ptr() + offset
- ptrOffset = offset
- case encoder.OpStructPtrHead:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHead:
- p := load(ctxptr, code.Idx)
- if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if len(code.Key) > 0 {
- if (code.Flags&encoder.IsTaggedKeyFlags) != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 {
- b = appendStructKey(ctx, code, b)
- }
- }
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmpty:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmpty:
- p := load(ctxptr, code.Idx)
- if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadInt:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadInt:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyInt:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyInt:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadIntString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadIntString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyIntString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyIntString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- u64 := ptrToUint64(p, code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendInt(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadUint:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadUint:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUint:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyUint:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadUintString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadUintString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUintString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyUintString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendUint(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat32:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat32:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat32String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat32String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat64:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat64:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat64String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadFloat64String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64String:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64String:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v == 0 {
- code = code.NextField
- } else {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNull(ctx, b)
- b = appendComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToString(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadStringString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadStringString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p+uintptr(code.Offset)))))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyStringString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyStringString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToString(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, ptrToString(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadBool:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadBool:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBool:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyBool:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- } else {
- code = code.NextField
- }
- case encoder.OpStructPtrHeadBoolString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadBoolString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBoolString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyBoolString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- } else {
- code = code.NextField
- }
- case encoder.OpStructPtrHeadBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendBool(ctx, b, ptrToBool(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadBytes:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadBytes:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBytes:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyBytes:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToBytes(p + uintptr(code.Offset))
- if len(v) == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadNumber:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadNumber:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumber:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumber:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToNumber(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- }
- case encoder.OpStructPtrHeadNumberString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadNumberString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumberString:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumberString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- v := ptrToNumber(p + uintptr(code.Offset))
- if v == "" {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructPtrHeadNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadArray, encoder.OpStructHeadSlice:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmptyArray:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyArray:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmptySlice:
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptySlice:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- slice := ptrToSlice(p)
- if slice.Len == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.NextField
- } else {
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadMap:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMap:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p + uintptr(code.Offset))
- }
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructPtrHeadOmitEmptyMap:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMap:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- p = ptrToPtr(p + uintptr(code.Offset))
- }
- if maplen(ptrToUnsafePtr(p)) == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.NextField
- break
- }
- p = ptrToPtr(p + uintptr(code.Offset))
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.NextField
- } else {
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadOmitEmptyMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMapPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p == 0 {
- code = code.NextField
- break
- }
- p = ptrToPtr(p + uintptr(code.Offset))
- if p == 0 {
- code = code.NextField
- } else {
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructPtrHeadMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON {
- p = ptrToPtr(p)
- }
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalJSON:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON {
- p = ptrToPtr(p)
- }
- }
- iface := ptrToInterface(code, p)
- if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, iface)
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText {
- p = ptrToPtr(p)
- }
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- }
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalText:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText {
- p = ptrToPtr(p)
- }
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructPtrHeadMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- b = appendStructKey(ctx, code, b)
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum))
- fallthrough
- case encoder.OpStructHeadOmitEmptyMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 {
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendNullComma(ctx, b)
- }
- code = code.End.Next
- break
- }
- if (code.Flags & encoder.IndirectFlags) != 0 {
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- }
- if code.Flags&encoder.AnonymousHeadFlags == 0 {
- b = appendStructHead(ctx, b)
- }
- if p == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- b = appendComma(ctx, b)
- code = code.Next
- }
- case encoder.OpStructField:
- if code.Flags&encoder.IsTaggedKeyFlags != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 {
- b = appendStructKey(ctx, code, b)
- }
- p := load(ctxptr, code.Idx) + uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmpty:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructFieldInt:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyInt:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldIntString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyIntString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldIntPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendInt(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldIntPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUint:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUint:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUintString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUintString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUintPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendUint(ctx, b, p, code)
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p, code)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldUintPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32String:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat32PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNullComma(ctx, b)
- code = code.Next
- break
- }
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldFloat64PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldStringString:
- p := load(ctxptr, code.Idx)
- s := ptrToString(p + uintptr(code.Offset))
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, s)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyStringString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldStringPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, ptrToString(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldStringPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBool:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBool:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBoolString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBoolString:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, v)
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBoolPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendBool(ctx, b, ptrToBool(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBoolPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBytes:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBytes:
- p := load(ctxptr, code.Idx)
- v := ptrToBytes(p + uintptr(code.Offset))
- if len(v) > 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, v)
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldBytesPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldNumber:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumber:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldNumberString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumberString:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldNumberPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldNumberPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- b = appendStructKey(ctx, code, b)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendComma(ctx, b)
- }
- code = code.Next
- case encoder.OpStructFieldMarshalJSON:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalJSON:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- code = code.NextField
- break
- }
- iface := ptrToInterface(code, p)
- if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) {
- code = code.NextField
- break
- }
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, iface)
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructFieldMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalJSONPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldMarshalText:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalText:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if (code.Flags & encoder.IsNilableTypeFlags) != 0 {
- p = ptrToPtr(p)
- }
- if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 {
- code = code.NextField
- break
- }
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- code = code.Next
- case encoder.OpStructFieldMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendComma(ctx, b)
- code = code.Next
- case encoder.OpStructFieldOmitEmptyMarshalTextPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p))
- if err != nil {
- return nil, err
- }
- b = appendComma(ctx, bb)
- }
- code = code.Next
- case encoder.OpStructFieldArray:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyArray:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldArrayPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyArrayPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- code = code.NextField
- }
- case encoder.OpStructFieldSlice:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptySlice:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- slice := ptrToSlice(p)
- if slice.Len == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructFieldSlicePtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptySlicePtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- code = code.NextField
- }
- case encoder.OpStructFieldMap:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyMap:
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructFieldMapPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- if p != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyMapPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToPtr(p + uintptr(code.Offset))
- if p != 0 {
- p = ptrToNPtr(p, code.PtrNum)
- }
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- } else {
- code = code.NextField
- }
- case encoder.OpStructFieldStruct:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- code = code.Next
- store(ctxptr, code.Idx, p)
- case encoder.OpStructFieldOmitEmptyStruct:
- p := load(ctxptr, code.Idx)
- p += uintptr(code.Offset)
- if ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0 {
- code = code.NextField
- } else {
- b = appendStructKey(ctx, code, b)
- code = code.Next
- store(ctxptr, code.Idx, p)
- }
- case encoder.OpStructEnd:
- b = appendStructEndSkipLast(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndInt:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyInt:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndIntString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyIntString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndIntPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendInt(ctx, b, p, code)
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyIntPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendInt(ctx, b, p, code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndIntPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyIntPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendInt(ctx, b, p, code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUint:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUint:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUintString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUintString:
- p := load(ctxptr, code.Idx)
- u64 := ptrToUint64(p+uintptr(code.Offset), code.NumBitSize)
- v := u64 & ((1 << code.NumBitSize) - 1)
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p+uintptr(code.Offset), code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUintPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendUint(ctx, b, p, code)
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUintPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendUint(ctx, b, p, code)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndUintPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyUintPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendUint(ctx, b, p, code)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32String:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat32(p + uintptr(code.Offset))
- if v != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32Ptr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat32PtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat32PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat32(ctx, b, ptrToFloat32(p))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64String:
- p := load(ctxptr, code.Idx)
- v := ptrToFloat64(p + uintptr(code.Offset))
- if v != 0 {
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64Ptr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- break
- }
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64Ptr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndFloat64PtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyFloat64PtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- v := ptrToFloat64(p)
- if math.IsInf(v, 0) || math.IsNaN(v) {
- return nil, errUnsupportedFloat(v)
- }
- b = append(b, '"')
- b = appendFloat64(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndStringString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- s := ptrToString(p + uintptr(code.Offset))
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, s)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyStringString:
- p := load(ctxptr, code.Idx)
- v := ptrToString(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, v)))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndStringPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, ptrToString(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyStringPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, ptrToString(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndStringPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyStringPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p))))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBool:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBool:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBoolString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset)))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBoolString:
- p := load(ctxptr, code.Idx)
- v := ptrToBool(p + uintptr(code.Offset))
- if v {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, v)
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBoolPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendBool(ctx, b, ptrToBool(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBoolPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendBool(ctx, b, ptrToBool(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBoolPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBoolPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- b = appendBool(ctx, b, ptrToBool(p))
- b = append(b, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBytes:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset)))
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBytes:
- p := load(ctxptr, code.Idx)
- v := ptrToBytes(p + uintptr(code.Offset))
- if len(v) > 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, v)
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndBytesPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyBytesPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = appendByteSlice(ctx, b, ptrToBytes(p))
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumber:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = appendStructEnd(ctx, code, bb)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumber:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = appendStructEnd(ctx, code, bb)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumberString:
- p := load(ctxptr, code.Idx)
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset)))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumberString:
- p := load(ctxptr, code.Idx)
- v := ptrToNumber(p + uintptr(code.Offset))
- if v != "" {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, v)
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumberPtr:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = bb
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumberPtr:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = appendStructEnd(ctx, code, bb)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpStructEndNumberPtrString:
- b = appendStructKey(ctx, code, b)
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p == 0 {
- b = appendNull(ctx, b)
- } else {
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- }
- b = appendStructEnd(ctx, code, b)
- code = code.Next
- case encoder.OpStructEndOmitEmptyNumberPtrString:
- p := load(ctxptr, code.Idx)
- p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum)
- if p != 0 {
- b = appendStructKey(ctx, code, b)
- b = append(b, '"')
- bb, err := appendNumber(ctx, b, ptrToNumber(p))
- if err != nil {
- return nil, err
- }
- b = append(bb, '"')
- b = appendStructEnd(ctx, code, b)
- } else {
- b = appendStructEndSkipLast(ctx, code, b)
- }
- code = code.Next
- case encoder.OpEnd:
- goto END
- }
- }
-END:
- return b, nil
-}
diff --git a/vendor/github.com/goccy/go-json/internal/errors/error.go b/vendor/github.com/goccy/go-json/internal/errors/error.go
deleted file mode 100644
index 9207d0ff25e..00000000000
--- a/vendor/github.com/goccy/go-json/internal/errors/error.go
+++ /dev/null
@@ -1,183 +0,0 @@
-package errors
-
-import (
- "fmt"
- "reflect"
- "strconv"
-)
-
-type InvalidUTF8Error struct {
- S string // the whole string value that caused the error
-}
-
-func (e *InvalidUTF8Error) Error() string {
- return fmt.Sprintf("json: invalid UTF-8 in string: %s", strconv.Quote(e.S))
-}
-
-type InvalidUnmarshalError struct {
- Type reflect.Type
-}
-
-func (e *InvalidUnmarshalError) Error() string {
- if e.Type == nil {
- return "json: Unmarshal(nil)"
- }
-
- if e.Type.Kind() != reflect.Ptr {
- return fmt.Sprintf("json: Unmarshal(non-pointer %s)", e.Type)
- }
- return fmt.Sprintf("json: Unmarshal(nil %s)", e.Type)
-}
-
-// A MarshalerError represents an error from calling a MarshalJSON or MarshalText method.
-type MarshalerError struct {
- Type reflect.Type
- Err error
- sourceFunc string
-}
-
-func (e *MarshalerError) Error() string {
- srcFunc := e.sourceFunc
- if srcFunc == "" {
- srcFunc = "MarshalJSON"
- }
- return fmt.Sprintf("json: error calling %s for type %s: %s", srcFunc, e.Type, e.Err.Error())
-}
-
-// Unwrap returns the underlying error.
-func (e *MarshalerError) Unwrap() error { return e.Err }
-
-// A SyntaxError is a description of a JSON syntax error.
-type SyntaxError struct {
- msg string // description of error
- Offset int64 // error occurred after reading Offset bytes
-}
-
-func (e *SyntaxError) Error() string { return e.msg }
-
-// An UnmarshalFieldError describes a JSON object key that
-// led to an unexported (and therefore unwritable) struct field.
-//
-// Deprecated: No longer used; kept for compatibility.
-type UnmarshalFieldError struct {
- Key string
- Type reflect.Type
- Field reflect.StructField
-}
-
-func (e *UnmarshalFieldError) Error() string {
- return fmt.Sprintf("json: cannot unmarshal object key %s into unexported field %s of type %s",
- strconv.Quote(e.Key), e.Field.Name, e.Type.String(),
- )
-}
-
-// An UnmarshalTypeError describes a JSON value that was
-// not appropriate for a value of a specific Go type.
-type UnmarshalTypeError struct {
- Value string // description of JSON value - "bool", "array", "number -5"
- Type reflect.Type // type of Go value it could not be assigned to
- Offset int64 // error occurred after reading Offset bytes
- Struct string // name of the struct type containing the field
- Field string // the full path from root node to the field
-}
-
-func (e *UnmarshalTypeError) Error() string {
- if e.Struct != "" || e.Field != "" {
- return fmt.Sprintf("json: cannot unmarshal %s into Go struct field %s.%s of type %s",
- e.Value, e.Struct, e.Field, e.Type,
- )
- }
- return fmt.Sprintf("json: cannot unmarshal %s into Go value of type %s", e.Value, e.Type)
-}
-
-// An UnsupportedTypeError is returned by Marshal when attempting
-// to encode an unsupported value type.
-type UnsupportedTypeError struct {
- Type reflect.Type
-}
-
-func (e *UnsupportedTypeError) Error() string {
- return fmt.Sprintf("json: unsupported type: %s", e.Type)
-}
-
-type UnsupportedValueError struct {
- Value reflect.Value
- Str string
-}
-
-func (e *UnsupportedValueError) Error() string {
- return fmt.Sprintf("json: unsupported value: %s", e.Str)
-}
-
-func ErrSyntax(msg string, offset int64) *SyntaxError {
- return &SyntaxError{msg: msg, Offset: offset}
-}
-
-func ErrMarshaler(typ reflect.Type, err error, msg string) *MarshalerError {
- return &MarshalerError{
- Type: typ,
- Err: err,
- sourceFunc: msg,
- }
-}
-
-func ErrExceededMaxDepth(c byte, cursor int64) *SyntaxError {
- return &SyntaxError{
- msg: fmt.Sprintf(`invalid character "%c" exceeded max depth`, c),
- Offset: cursor,
- }
-}
-
-func ErrNotAtBeginningOfValue(cursor int64) *SyntaxError {
- return &SyntaxError{msg: "not at beginning of value", Offset: cursor}
-}
-
-func ErrUnexpectedEndOfJSON(msg string, cursor int64) *SyntaxError {
- return &SyntaxError{
- msg: fmt.Sprintf("json: %s unexpected end of JSON input", msg),
- Offset: cursor,
- }
-}
-
-func ErrExpected(msg string, cursor int64) *SyntaxError {
- return &SyntaxError{msg: fmt.Sprintf("expected %s", msg), Offset: cursor}
-}
-
-func ErrInvalidCharacter(c byte, context string, cursor int64) *SyntaxError {
- if c == 0 {
- return &SyntaxError{
- msg: fmt.Sprintf("json: invalid character as %s", context),
- Offset: cursor,
- }
- }
- return &SyntaxError{
- msg: fmt.Sprintf("json: invalid character %c as %s", c, context),
- Offset: cursor,
- }
-}
-
-func ErrInvalidBeginningOfValue(c byte, cursor int64) *SyntaxError {
- return &SyntaxError{
- msg: fmt.Sprintf("invalid character '%c' looking for beginning of value", c),
- Offset: cursor,
- }
-}
-
-type PathError struct {
- msg string
-}
-
-func (e *PathError) Error() string {
- return fmt.Sprintf("json: invalid path format: %s", e.msg)
-}
-
-func ErrInvalidPath(msg string, args ...interface{}) *PathError {
- if len(args) != 0 {
- return &PathError{msg: fmt.Sprintf(msg, args...)}
- }
- return &PathError{msg: msg}
-}
-
-func ErrEmptyPath() *PathError {
- return &PathError{msg: "path is empty"}
-}
diff --git a/vendor/github.com/goccy/go-json/internal/runtime/rtype.go b/vendor/github.com/goccy/go-json/internal/runtime/rtype.go
deleted file mode 100644
index 37cfe35a1fd..00000000000
--- a/vendor/github.com/goccy/go-json/internal/runtime/rtype.go
+++ /dev/null
@@ -1,262 +0,0 @@
-package runtime
-
-import (
- "reflect"
- "unsafe"
-)
-
-// Type representing reflect.rtype for noescape trick
-type Type struct{}
-
-//go:linkname rtype_Align reflect.(*rtype).Align
-//go:noescape
-func rtype_Align(*Type) int
-
-func (t *Type) Align() int {
- return rtype_Align(t)
-}
-
-//go:linkname rtype_FieldAlign reflect.(*rtype).FieldAlign
-//go:noescape
-func rtype_FieldAlign(*Type) int
-
-func (t *Type) FieldAlign() int {
- return rtype_FieldAlign(t)
-}
-
-//go:linkname rtype_Method reflect.(*rtype).Method
-//go:noescape
-func rtype_Method(*Type, int) reflect.Method
-
-func (t *Type) Method(a0 int) reflect.Method {
- return rtype_Method(t, a0)
-}
-
-//go:linkname rtype_MethodByName reflect.(*rtype).MethodByName
-//go:noescape
-func rtype_MethodByName(*Type, string) (reflect.Method, bool)
-
-func (t *Type) MethodByName(a0 string) (reflect.Method, bool) {
- return rtype_MethodByName(t, a0)
-}
-
-//go:linkname rtype_NumMethod reflect.(*rtype).NumMethod
-//go:noescape
-func rtype_NumMethod(*Type) int
-
-func (t *Type) NumMethod() int {
- return rtype_NumMethod(t)
-}
-
-//go:linkname rtype_Name reflect.(*rtype).Name
-//go:noescape
-func rtype_Name(*Type) string
-
-func (t *Type) Name() string {
- return rtype_Name(t)
-}
-
-//go:linkname rtype_PkgPath reflect.(*rtype).PkgPath
-//go:noescape
-func rtype_PkgPath(*Type) string
-
-func (t *Type) PkgPath() string {
- return rtype_PkgPath(t)
-}
-
-//go:linkname rtype_Size reflect.(*rtype).Size
-//go:noescape
-func rtype_Size(*Type) uintptr
-
-func (t *Type) Size() uintptr {
- return rtype_Size(t)
-}
-
-//go:linkname rtype_String reflect.(*rtype).String
-//go:noescape
-func rtype_String(*Type) string
-
-func (t *Type) String() string {
- return rtype_String(t)
-}
-
-//go:linkname rtype_Kind reflect.(*rtype).Kind
-//go:noescape
-func rtype_Kind(*Type) reflect.Kind
-
-func (t *Type) Kind() reflect.Kind {
- return rtype_Kind(t)
-}
-
-//go:linkname rtype_Implements reflect.(*rtype).Implements
-//go:noescape
-func rtype_Implements(*Type, reflect.Type) bool
-
-func (t *Type) Implements(u reflect.Type) bool {
- return rtype_Implements(t, u)
-}
-
-//go:linkname rtype_AssignableTo reflect.(*rtype).AssignableTo
-//go:noescape
-func rtype_AssignableTo(*Type, reflect.Type) bool
-
-func (t *Type) AssignableTo(u reflect.Type) bool {
- return rtype_AssignableTo(t, u)
-}
-
-//go:linkname rtype_ConvertibleTo reflect.(*rtype).ConvertibleTo
-//go:noescape
-func rtype_ConvertibleTo(*Type, reflect.Type) bool
-
-func (t *Type) ConvertibleTo(u reflect.Type) bool {
- return rtype_ConvertibleTo(t, u)
-}
-
-//go:linkname rtype_Comparable reflect.(*rtype).Comparable
-//go:noescape
-func rtype_Comparable(*Type) bool
-
-func (t *Type) Comparable() bool {
- return rtype_Comparable(t)
-}
-
-//go:linkname rtype_Bits reflect.(*rtype).Bits
-//go:noescape
-func rtype_Bits(*Type) int
-
-func (t *Type) Bits() int {
- return rtype_Bits(t)
-}
-
-//go:linkname rtype_ChanDir reflect.(*rtype).ChanDir
-//go:noescape
-func rtype_ChanDir(*Type) reflect.ChanDir
-
-func (t *Type) ChanDir() reflect.ChanDir {
- return rtype_ChanDir(t)
-}
-
-//go:linkname rtype_IsVariadic reflect.(*rtype).IsVariadic
-//go:noescape
-func rtype_IsVariadic(*Type) bool
-
-func (t *Type) IsVariadic() bool {
- return rtype_IsVariadic(t)
-}
-
-//go:linkname rtype_Elem reflect.(*rtype).Elem
-//go:noescape
-func rtype_Elem(*Type) reflect.Type
-
-func (t *Type) Elem() *Type {
- return Type2RType(rtype_Elem(t))
-}
-
-//go:linkname rtype_Field reflect.(*rtype).Field
-//go:noescape
-func rtype_Field(*Type, int) reflect.StructField
-
-func (t *Type) Field(i int) reflect.StructField {
- return rtype_Field(t, i)
-}
-
-//go:linkname rtype_FieldByIndex reflect.(*rtype).FieldByIndex
-//go:noescape
-func rtype_FieldByIndex(*Type, []int) reflect.StructField
-
-func (t *Type) FieldByIndex(index []int) reflect.StructField {
- return rtype_FieldByIndex(t, index)
-}
-
-//go:linkname rtype_FieldByName reflect.(*rtype).FieldByName
-//go:noescape
-func rtype_FieldByName(*Type, string) (reflect.StructField, bool)
-
-func (t *Type) FieldByName(name string) (reflect.StructField, bool) {
- return rtype_FieldByName(t, name)
-}
-
-//go:linkname rtype_FieldByNameFunc reflect.(*rtype).FieldByNameFunc
-//go:noescape
-func rtype_FieldByNameFunc(*Type, func(string) bool) (reflect.StructField, bool)
-
-func (t *Type) FieldByNameFunc(match func(string) bool) (reflect.StructField, bool) {
- return rtype_FieldByNameFunc(t, match)
-}
-
-//go:linkname rtype_In reflect.(*rtype).In
-//go:noescape
-func rtype_In(*Type, int) reflect.Type
-
-func (t *Type) In(i int) reflect.Type {
- return rtype_In(t, i)
-}
-
-//go:linkname rtype_Key reflect.(*rtype).Key
-//go:noescape
-func rtype_Key(*Type) reflect.Type
-
-func (t *Type) Key() *Type {
- return Type2RType(rtype_Key(t))
-}
-
-//go:linkname rtype_Len reflect.(*rtype).Len
-//go:noescape
-func rtype_Len(*Type) int
-
-func (t *Type) Len() int {
- return rtype_Len(t)
-}
-
-//go:linkname rtype_NumField reflect.(*rtype).NumField
-//go:noescape
-func rtype_NumField(*Type) int
-
-func (t *Type) NumField() int {
- return rtype_NumField(t)
-}
-
-//go:linkname rtype_NumIn reflect.(*rtype).NumIn
-//go:noescape
-func rtype_NumIn(*Type) int
-
-func (t *Type) NumIn() int {
- return rtype_NumIn(t)
-}
-
-//go:linkname rtype_NumOut reflect.(*rtype).NumOut
-//go:noescape
-func rtype_NumOut(*Type) int
-
-func (t *Type) NumOut() int {
- return rtype_NumOut(t)
-}
-
-//go:linkname rtype_Out reflect.(*rtype).Out
-//go:noescape
-func rtype_Out(*Type, int) reflect.Type
-
-//go:linkname PtrTo reflect.(*rtype).ptrTo
-//go:noescape
-func PtrTo(*Type) *Type
-
-func (t *Type) Out(i int) reflect.Type {
- return rtype_Out(t, i)
-}
-
-//go:linkname IfaceIndir reflect.ifaceIndir
-//go:noescape
-func IfaceIndir(*Type) bool
-
-//go:linkname RType2Type reflect.toType
-//go:noescape
-func RType2Type(t *Type) reflect.Type
-
-type emptyInterface struct {
- _ *Type
- ptr unsafe.Pointer
-}
-
-func Type2RType(t reflect.Type) *Type {
- return (*Type)(((*emptyInterface)(unsafe.Pointer(&t))).ptr)
-}
diff --git a/vendor/github.com/goccy/go-json/internal/runtime/struct_field.go b/vendor/github.com/goccy/go-json/internal/runtime/struct_field.go
deleted file mode 100644
index baab0c5978d..00000000000
--- a/vendor/github.com/goccy/go-json/internal/runtime/struct_field.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package runtime
-
-import (
- "reflect"
- "strings"
- "unicode"
-)
-
-func getTag(field reflect.StructField) string {
- return field.Tag.Get("json")
-}
-
-func IsIgnoredStructField(field reflect.StructField) bool {
- if field.PkgPath != "" {
- if field.Anonymous {
- t := field.Type
- if t.Kind() == reflect.Ptr {
- t = t.Elem()
- }
- if t.Kind() != reflect.Struct {
- return true
- }
- } else {
- // private field
- return true
- }
- }
- tag := getTag(field)
- return tag == "-"
-}
-
-type StructTag struct {
- Key string
- IsTaggedKey bool
- IsOmitEmpty bool
- IsString bool
- Field reflect.StructField
-}
-
-type StructTags []*StructTag
-
-func (t StructTags) ExistsKey(key string) bool {
- for _, tt := range t {
- if tt.Key == key {
- return true
- }
- }
- return false
-}
-
-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
-}
-
-func StructTagFromField(field reflect.StructField) *StructTag {
- keyName := field.Name
- tag := getTag(field)
- st := &StructTag{Field: field}
- opts := strings.Split(tag, ",")
- if len(opts) > 0 {
- if opts[0] != "" && isValidTag(opts[0]) {
- keyName = opts[0]
- st.IsTaggedKey = true
- }
- }
- st.Key = keyName
- if len(opts) > 1 {
- for _, opt := range opts[1:] {
- switch opt {
- case "omitempty":
- st.IsOmitEmpty = true
- case "string":
- st.IsString = true
- }
- }
- }
- return st
-}
diff --git a/vendor/github.com/goccy/go-json/internal/runtime/type.go b/vendor/github.com/goccy/go-json/internal/runtime/type.go
deleted file mode 100644
index 4b693cb0bbe..00000000000
--- a/vendor/github.com/goccy/go-json/internal/runtime/type.go
+++ /dev/null
@@ -1,98 +0,0 @@
-package runtime
-
-import (
- "reflect"
- "sync"
- "unsafe"
-)
-
-type SliceHeader struct {
- Data unsafe.Pointer
- Len int
- Cap int
-}
-
-const (
- maxAcceptableTypeAddrRange = 1024 * 1024 * 2 // 2 Mib
-)
-
-type TypeAddr struct {
- BaseTypeAddr uintptr
- MaxTypeAddr uintptr
- AddrRange uintptr
- AddrShift uintptr
-}
-
-var (
- typeAddr *TypeAddr
- once sync.Once
-)
-
-//go:linkname typelinks reflect.typelinks
-func typelinks() ([]unsafe.Pointer, [][]int32)
-
-//go:linkname rtypeOff reflect.rtypeOff
-func rtypeOff(unsafe.Pointer, int32) unsafe.Pointer
-
-func AnalyzeTypeAddr() *TypeAddr {
- once.Do(func() {
- sections, offsets := typelinks()
- if len(sections) != 1 {
- return
- }
- if len(offsets) != 1 {
- return
- }
- section := sections[0]
- offset := offsets[0]
- var (
- min uintptr = uintptr(^uint(0))
- max uintptr = 0
- isAligned64 = true
- isAligned32 = true
- )
- for i := 0; i < len(offset); i++ {
- typ := (*Type)(rtypeOff(section, offset[i]))
- addr := uintptr(unsafe.Pointer(typ))
- if min > addr {
- min = addr
- }
- if max < addr {
- max = addr
- }
- if typ.Kind() == reflect.Ptr {
- addr = uintptr(unsafe.Pointer(typ.Elem()))
- if min > addr {
- min = addr
- }
- if max < addr {
- max = addr
- }
- }
- isAligned64 = isAligned64 && (addr-min)&63 == 0
- isAligned32 = isAligned32 && (addr-min)&31 == 0
- }
- addrRange := max - min
- if addrRange == 0 {
- return
- }
- var addrShift uintptr
- if isAligned64 {
- addrShift = 6
- } else if isAligned32 {
- addrShift = 5
- }
- cacheSize := addrRange >> addrShift
- if cacheSize > maxAcceptableTypeAddrRange {
- return
- }
- typeAddr = &TypeAddr{
- BaseTypeAddr: min,
- MaxTypeAddr: max,
- AddrRange: addrRange,
- AddrShift: addrShift,
- }
- })
-
- return typeAddr
-}
diff --git a/vendor/github.com/goccy/go-json/json.go b/vendor/github.com/goccy/go-json/json.go
deleted file mode 100644
index fb18065a231..00000000000
--- a/vendor/github.com/goccy/go-json/json.go
+++ /dev/null
@@ -1,368 +0,0 @@
-package json
-
-import (
- "bytes"
- "context"
- "encoding/json"
-
- "github.com/goccy/go-json/internal/encoder"
-)
-
-// Marshaler is the interface implemented by types that
-// can marshal themselves into valid JSON.
-type Marshaler interface {
- MarshalJSON() ([]byte, error)
-}
-
-// MarshalerContext is the interface implemented by types that
-// can marshal themselves into valid JSON with context.Context.
-type MarshalerContext interface {
- MarshalJSON(context.Context) ([]byte, error)
-}
-
-// Unmarshaler is the interface implemented by types
-// that can unmarshal a JSON description of themselves.
-// The input can be assumed to be a valid encoding of
-// a JSON value. UnmarshalJSON must copy the JSON data
-// if it wishes to retain the data after returning.
-//
-// By convention, to approximate the behavior of Unmarshal itself,
-// Unmarshalers implement UnmarshalJSON([]byte("null")) as a no-op.
-type Unmarshaler interface {
- UnmarshalJSON([]byte) error
-}
-
-// UnmarshalerContext is the interface implemented by types
-// that can unmarshal with context.Context a JSON description of themselves.
-type UnmarshalerContext interface {
- UnmarshalJSON(context.Context, []byte) error
-}
-
-// Marshal returns the JSON encoding of v.
-//
-// Marshal traverses the value v recursively.
-// If an encountered value implements the Marshaler interface
-// and is not a nil pointer, Marshal calls its MarshalJSON method
-// to produce JSON. If no MarshalJSON method is present but the
-// value implements encoding.TextMarshaler instead, Marshal calls
-// its MarshalText method and encodes the result as a JSON string.
-// The nil pointer exception is not strictly necessary
-// but mimics a similar, necessary exception in the behavior of
-// UnmarshalJSON.
-//
-// Otherwise, Marshal uses the following type-dependent default encodings:
-//
-// Boolean values encode as JSON booleans.
-//
-// Floating point, integer, and Number values encode as JSON numbers.
-//
-// String values encode as JSON strings coerced to valid UTF-8,
-// replacing invalid bytes with the Unicode replacement rune.
-// The angle brackets "<" and ">" are escaped to "\u003c" and "\u003e"
-// to keep some browsers from misinterpreting JSON output as HTML.
-// Ampersand "&" is also escaped to "\u0026" for the same reason.
-// This escaping can be disabled using an Encoder that had SetEscapeHTML(false)
-// called on it.
-//
-// Array and slice values encode as JSON arrays, except that
-// []byte encodes as a base64-encoded string, and a nil slice
-// encodes as the null JSON value.
-//
-// Struct values encode as JSON objects.
-// 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.
-//
-// As a special case, if the field tag is "-", the field is always omitted.
-// Note that a field with name "-" can still be generated using the tag "-,".
-//
-// Examples of struct field tags and their meanings:
-//
-// // Field appears in JSON as key "myName".
-// Field int `json:"myName"`
-//
-// // Field appears in JSON as key "myName" and
-// // the field is omitted from the object if its value is empty,
-// // as defined above.
-// Field int `json:"myName,omitempty"`
-//
-// // Field appears in JSON as key "Field" (the default), but
-// // the field is skipped if empty.
-// // Note the leading comma.
-// Field int `json:",omitempty"`
-//
-// // Field is ignored by this package.
-// Field int `json:"-"`
-//
-// // Field appears in JSON as key "-".
-// Field int `json:"-,"`
-//
-// The "string" option signals that a field is stored as JSON inside a
-// JSON-encoded string. It applies only to fields of string, floating point,
-// integer, or boolean types. This extra level of encoding is sometimes used
-// when communicating with JavaScript programs:
-//
-// Int64String int64 `json:",string"`
-//
-// The key name will be used if it's a non-empty string consisting of
-// only Unicode letters, digits, and ASCII punctuation except quotation
-// marks, backslash, and comma.
-//
-// Anonymous struct fields are usually marshaled 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 JSON when
-// deciding which field to marshal or unmarshal. 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.
-//
-// Handling of anonymous struct fields is new in Go 1.1.
-// Prior to Go 1.1, anonymous struct fields were ignored. To force ignoring of
-// an anonymous struct field in both current and earlier versions, give the field
-// a JSON tag of "-".
-//
-// Map values encode as JSON objects. 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 JSON object keys by applying the following rules,
-// subject to the UTF-8 coercion described for string values above:
-// - string keys 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 JSON value.
-//
-// Interface values encode as the value contained in the interface.
-// A nil interface value encodes as the null JSON value.
-//
-// Channel, complex, and function values cannot be encoded in JSON.
-// Attempting to encode such a value causes Marshal to return
-// an UnsupportedTypeError.
-//
-// JSON cannot represent cyclic data structures and Marshal does not
-// handle them. Passing cyclic structures to Marshal will result in
-// an infinite recursion.
-func Marshal(v interface{}) ([]byte, error) {
- return MarshalWithOption(v)
-}
-
-// MarshalNoEscape returns the JSON encoding of v and doesn't escape v.
-func MarshalNoEscape(v interface{}) ([]byte, error) {
- return marshalNoEscape(v)
-}
-
-// MarshalContext returns the JSON encoding of v with context.Context and EncodeOption.
-func MarshalContext(ctx context.Context, v interface{}, optFuncs ...EncodeOptionFunc) ([]byte, error) {
- return marshalContext(ctx, v, optFuncs...)
-}
-
-// MarshalWithOption returns the JSON encoding of v with EncodeOption.
-func MarshalWithOption(v interface{}, optFuncs ...EncodeOptionFunc) ([]byte, error) {
- return marshal(v, optFuncs...)
-}
-
-// MarshalIndent is like Marshal but applies Indent to format the output.
-// Each JSON element in the output will begin on a new line beginning with prefix
-// followed by one or more copies of indent according to the indentation nesting.
-func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) {
- return MarshalIndentWithOption(v, prefix, indent)
-}
-
-// MarshalIndentWithOption is like Marshal but applies Indent to format the output with EncodeOption.
-func MarshalIndentWithOption(v interface{}, prefix, indent string, optFuncs ...EncodeOptionFunc) ([]byte, error) {
- return marshalIndent(v, prefix, indent, optFuncs...)
-}
-
-// Unmarshal parses the JSON-encoded data and stores the result
-// in the value pointed to by v. If v is nil or not a pointer,
-// Unmarshal returns an InvalidUnmarshalError.
-//
-// Unmarshal uses the inverse of the encodings that
-// Marshal uses, allocating maps, slices, and pointers as necessary,
-// with the following additional rules:
-//
-// To unmarshal JSON into a pointer, Unmarshal first handles the case of
-// the JSON being the JSON literal null. In that case, Unmarshal sets
-// the pointer to nil. Otherwise, Unmarshal unmarshals the JSON into
-// the value pointed at by the pointer. If the pointer is nil, Unmarshal
-// allocates a new value for it to point to.
-//
-// To unmarshal JSON into a value implementing the Unmarshaler interface,
-// Unmarshal calls that value's UnmarshalJSON method, including
-// when the input is a JSON null.
-// Otherwise, if the value implements encoding.TextUnmarshaler
-// and the input is a JSON quoted string, Unmarshal calls that value's
-// UnmarshalText method with the unquoted form of the string.
-//
-// To unmarshal JSON into a struct, Unmarshal matches incoming object
-// keys to the keys used by Marshal (either the struct field name or its tag),
-// preferring an exact match but also accepting a case-insensitive match. By
-// default, object keys which don't have a corresponding struct field are
-// ignored (see Decoder.DisallowUnknownFields for an alternative).
-//
-// To unmarshal JSON into an interface value,
-// Unmarshal stores one of these in the interface value:
-//
-// bool, for JSON booleans
-// float64, for JSON numbers
-// string, for JSON strings
-// []interface{}, for JSON arrays
-// map[string]interface{}, for JSON objects
-// nil for JSON null
-//
-// To unmarshal a JSON array into a slice, Unmarshal resets the slice length
-// to zero and then appends each element to the slice.
-// As a special case, to unmarshal an empty JSON array into a slice,
-// Unmarshal replaces the slice with a new empty slice.
-//
-// To unmarshal a JSON array into a Go array, Unmarshal decodes
-// JSON array elements into corresponding Go array elements.
-// If the Go array is smaller than the JSON array,
-// the additional JSON array elements are discarded.
-// If the JSON array is smaller than the Go array,
-// the additional Go array elements are set to zero values.
-//
-// To unmarshal a JSON object into a map, Unmarshal first establishes a map to
-// use. If the map is nil, Unmarshal allocates a new map. Otherwise Unmarshal
-// reuses the existing map, keeping existing entries. Unmarshal then stores
-// key-value pairs from the JSON object into the map. The map's key type must
-// either be any string type, an integer, implement json.Unmarshaler, or
-// implement encoding.TextUnmarshaler.
-//
-// If a JSON value is not appropriate for a given target type,
-// or if a JSON number overflows the target type, Unmarshal
-// skips that field and completes the unmarshaling as best it can.
-// If no more serious errors are encountered, Unmarshal returns
-// an UnmarshalTypeError describing the earliest such error. In any
-// case, it's not guaranteed that all the remaining fields following
-// the problematic one will be unmarshaled into the target object.
-//
-// The JSON null value unmarshals into an interface, map, pointer, or slice
-// by setting that Go value to nil. Because null is often used in JSON to mean
-// “not present,” unmarshaling a JSON null into any other Go type has no effect
-// on the value and produces no error.
-//
-// When unmarshaling quoted strings, invalid UTF-8 or
-// invalid UTF-16 surrogate pairs are not treated as an error.
-// Instead, they are replaced by the Unicode replacement
-// character U+FFFD.
-func Unmarshal(data []byte, v interface{}) error {
- return unmarshal(data, v)
-}
-
-// UnmarshalContext parses the JSON-encoded data and stores the result
-// in the value pointed to by v. If you implement the UnmarshalerContext interface,
-// call it with ctx as an argument.
-func UnmarshalContext(ctx context.Context, data []byte, v interface{}, optFuncs ...DecodeOptionFunc) error {
- return unmarshalContext(ctx, data, v)
-}
-
-func UnmarshalWithOption(data []byte, v interface{}, optFuncs ...DecodeOptionFunc) error {
- return unmarshal(data, v, optFuncs...)
-}
-
-func UnmarshalNoEscape(data []byte, v interface{}, optFuncs ...DecodeOptionFunc) error {
- return unmarshalNoEscape(data, v, optFuncs...)
-}
-
-// A Token holds a value of one of these types:
-//
-// Delim, for the four JSON delimiters [ ] { }
-// bool, for JSON booleans
-// float64, for JSON numbers
-// Number, for JSON numbers
-// string, for JSON string literals
-// nil, for JSON null
-type Token = json.Token
-
-// A Number represents a JSON number literal.
-type Number = json.Number
-
-// RawMessage is a raw encoded JSON value.
-// It implements Marshaler and Unmarshaler and can
-// be used to delay JSON decoding or precompute a JSON encoding.
-type RawMessage = json.RawMessage
-
-// A Delim is a JSON array or object delimiter, one of [ ] { or }.
-type Delim = json.Delim
-
-// Compact appends to dst the JSON-encoded src with
-// insignificant space characters elided.
-func Compact(dst *bytes.Buffer, src []byte) error {
- return encoder.Compact(dst, src, false)
-}
-
-// Indent appends to dst an indented form of the JSON-encoded src.
-// Each element in a JSON object or array begins on a new,
-// indented line beginning with prefix followed by one or more
-// copies of indent according to the indentation nesting.
-// The data appended to dst does not begin with the prefix nor
-// any indentation, to make it easier to embed inside other formatted JSON data.
-// Although leading space characters (space, tab, carriage return, newline)
-// at the beginning of src are dropped, trailing space characters
-// at the end of src are preserved and copied to dst.
-// For example, if src has no trailing spaces, neither will dst;
-// if src ends in a trailing newline, so will dst.
-func Indent(dst *bytes.Buffer, src []byte, prefix, indent string) error {
- return encoder.Indent(dst, src, prefix, indent)
-}
-
-// HTMLEscape appends to dst the JSON-encoded src with <, >, &, U+2028 and U+2029
-// characters inside string literals changed to \u003c, \u003e, \u0026, \u2028, \u2029
-// so that the JSON will be safe to embed inside HTML