commit f2e5bedea6fb93fbbf68ed8f7153c353cc57a9f0 parent e681aac5899b4a93d7c71e9a334a67c3f2b00e93 Author: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 10 Sep 2021 14:42:14 +0200 migrate go version to 1.17 (#203) * migrate go version to 1.17 * update contributing Diffstat:
304 files changed, 22172 insertions(+), 22909 deletions(-)
diff --git a/.drone.yml b/.drone.yml @@ -13,7 +13,7 @@ steps: # We use golangci-lint for linting. # See: https://golangci-lint.run/ - name: lint - image: golangci/golangci-lint:v1.41.1 + image: golangci/golangci-lint:v1.42.1 volumes: - name: go-build-cache path: /root/.cache/go-build @@ -27,17 +27,16 @@ steps: - pull_request - name: test - image: golang:1.16.4 + image: golang:1.17.1 volumes: - name: go-build-cache path: /root/.cache/go-build environment: GTS_DB_ADDRESS: postgres commands: - # `-count 1` => run all tests at least once # `-p 1` => run maximum one test at a time # `./...` => run all tests - - go test -count 1 -p 1 ./... + - go test -p 1 ./... when: event: include: @@ -86,6 +85,6 @@ trigger: --- kind: signature -hmac: 7fa6fa70be0a5c436ecb2f02f4b74bd1be5e90817e2d95a16898e3d29cbadf80 +hmac: 268d484fd9c5d14834a3e2a1e39cfe605c3898d601d2969dba5c2e11c1ea2f3b ... diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md @@ -4,7 +4,7 @@ Hey! Welcome to the CONTRIBUTING.md for GoToSocial :) Thanks for taking a look, This document will expand as the project expands, so for now this is basically a stub. -Contributions are welcome at this point, since the API is fairly stable now and the structure is at least vaguely coherent. +Contributions are welcome at this point, since the API is fairly stable now and the structure is somewhat coherent. Check the [issues](https://github.com/superseriousbusiness/gotosocial/issues) to see if there's anything you fancy jumping in on. @@ -20,11 +20,11 @@ In lieu of a fuller code of conduct, here are a few ground rules. 1. We *DO NOT ACCEPT* PRs from right-wingers, Nazis, transphobes, homophobes, racists, harassers, abusers, white-supremacists, misogynists, tech-bros of questionable ethics. If that's you, politely fuck off somewhere else. 2. Any PR that moves GoToSocial in the direction of surveillance capitalism or other bad fediverse behavior will be rejected. -3. Don't spam the chat too hard. +3. Don't spam the general chat too hard. ## Setting up your development environment -To get started, you first need to have Go installed. GTS was developed with Go 1.16.4, so you should take that too. See [here](https://golang.org/doc/install). +To get started, you first need to have Go installed. GtS is currently using Go 1.17, so you should take that too. See [here](https://golang.org/doc/install). Once you've got go installed, clone this repository into your Go path. Normally, this should be `~/go/src/github.com/superseriousbusiness/gotosocial`. @@ -48,21 +48,21 @@ In case this post disappears, here are the steps (slightly modified): > > Pull the original package from the canonical place with the standard go get command: -> +> > `go get github.com/superseriousbusiness/gotosocial` -> +> > Fork the repository on Github or set up whatever other remote git repo you will be using. In this case, I would go to Github and fork the repository. -> +> > Navigate to the top level of the repository on your computer. Note that this might not be the specific package you’re using: -> +> > `cd $GOPATH/src/github.com/superseriousbusiness/gotosocial` -> +> > Rename the current origin remote to upstream: -> +> > `git remote rename origin upstream` -> +> > Add your fork as origin: -> +> > `git remote add origin git@github.com/yourgithubname/gotosocial` > @@ -70,33 +70,13 @@ In case this post disappears, here are the steps (slightly modified): GoToSocial provides a [testrig](https://github.com/superseriousbusiness/gotosocial/tree/main/testrig) with a bunch of mock packages you can use in integration tests. -One thing that *isn't* mocked is the Database interface, because it's just easier to use a real Postgres database running on localhost. - -You can spin up a Postgres easily using Docker: - -```bash -docker run -d --user postgres --network host -e POSTGRES_PASSWORD=postgres postgres -``` - -If you want a nice interface for peeking at what's in the Postgres database during tests, use PGWeb: - -```bash -docker run -d --user postgres --network host sosedoff/pgweb -``` - -This will launch a pgweb at `http://localhost:8081`. +One thing that *isn't* mocked is the Database interface, because it's just easier to use an in-memory SQLite database than to mock everything out. ### Standalone Testrig You can also launch a testrig as a standalone server running at localhost, which you can connect to using something like [Pinafore](https://github.com/nolanlawson/pinafore). -To do this, first build the gotosocial binary with `go build ./cmd/gotosocial`. - -Then launch a clean Postgres container on localhost: - -```bash -docker run -d --user postgres --network host -e POSTGRES_PASSWORD=postgres postgres -``` +To do this, first build the gotosocial binary with `./build.sh`. Then, launch the testrig by invoking the binary as follows: @@ -118,19 +98,19 @@ At the login screen, enter the email address `zork@example.org` and password `pa Note the following constraints: -- The testrig data will be destroyed when the testrig is destroyed. It does this by dropping all tables in Postgres on shutdown. As such, you should **NEVER RUN THE TESTRIG AGAINST A DATABASE WITH REAL DATA IN IT** because it will be destroyed. Be especially careful if you're forwarding database ports from a remote instance to your local machine, because you can easily and irreversibly nuke that data if you run the testrig against it. +- Since the testrig uses an in-memory database, the database will be destroyed when the testrig is stopped. - If you stop the testrig and start it again, any tokens or applications you created during your tests will also be removed. As such, you need to log out and in again every time you stop/start the rig. - The testrig does not make any actual external http calls, so federation will (obviously) not work from a testrig. ## Running tests -Because the tests use a real Postgres under the hood, you can't run them in parallel, so you need to run tests with the following command: +Because the tests use a real SQLite database under the hood, you can't run them in parallel, so you need to run tests with the following command: ```bash -go test -count 1 -p 1 ./... +go test -p 1 ./... ``` -The `count` flag means that tests will be run at least once, and the `-p 1` flag means that only 1 test will be run at a time. +The `-p 1` flag means that only 1 test will be run at a time. ## Linting diff --git a/Dockerfile b/Dockerfile @@ -1,5 +1,5 @@ # STEP ONE: build the GoToSocial binary -FROM golang:1.16.4-alpine3.13 AS binary_builder +FROM golang:1.17.1-alpine3.13 AS binary_builder RUN apk update && apk upgrade --no-cache RUN apk add git diff --git a/go.mod b/go.mod @@ -1,68 +1,110 @@ module github.com/superseriousbusiness/gotosocial -go 1.16 +go 1.17 require ( github.com/ReneKroon/ttlcache v1.7.0 github.com/buckket/go-blurhash v1.1.0 github.com/coreos/go-oidc/v3 v3.0.0 - github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect - github.com/dsoprea/go-exif v0.0.0-20210625224831-a6301f85c82b // indirect - github.com/dsoprea/go-exif/v2 v2.0.0-20210625224831-a6301f85c82b // indirect - github.com/dsoprea/go-iptc v0.0.0-20200610044640-bc9ca208b413 // indirect - github.com/dsoprea/go-jpeg-image-structure v0.0.0-20210512043942-b434301c6836 // indirect - github.com/dsoprea/go-logging v0.0.0-20200710184922-b02d349568dd // indirect - github.com/dsoprea/go-photoshop-info-format v0.0.0-20200610045659-121dd752914d // indirect - github.com/dsoprea/go-png-image-structure v0.0.0-20210512210324-29b889a6093d // indirect - github.com/dsoprea/go-utility v0.0.0-20200717064901-2fccff4aa15e // indirect github.com/gin-contrib/cors v1.3.1 github.com/gin-contrib/sessions v0.0.3 - github.com/gin-gonic/gin v1.7.2-0.20210722225815-d4ca9a0fb121 + github.com/gin-gonic/gin v1.7.2-0.20210908033055-3a6f18f32f22 github.com/go-errors/errors v1.4.0 // indirect github.com/go-fed/activity v1.0.1-0.20210803212804-d866ba75dd0f github.com/go-fed/httpsig v1.1.0 - github.com/go-playground/validator/v10 v10.7.0 - github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect - github.com/golang/mock v1.6.0 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/go-playground/validator/v10 v10.9.0 github.com/google/uuid v1.3.0 - github.com/gorilla/sessions v1.2.1 // indirect github.com/gorilla/websocket v1.4.2 github.com/h2non/filetype v1.1.1 github.com/jackc/pgconn v1.10.0 github.com/jackc/pgx/v4 v4.13.0 - github.com/json-iterator/go v1.1.11 // indirect - github.com/leodido/go-urn v1.2.1 // indirect - github.com/mattn/go-isatty v0.0.14 // indirect github.com/microcosm-cc/bluemonday v1.0.15 github.com/mitchellh/mapstructure v1.4.1 - github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect - github.com/modern-go/reflect2 v1.0.1 // indirect github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 github.com/oklog/ulid v1.3.1 - github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b // indirect github.com/russross/blackfriday/v2 v2.1.0 github.com/sirupsen/logrus v1.8.1 github.com/stretchr/testify v1.7.0 github.com/superseriousbusiness/exifremove v0.0.0-20210330092427-6acd27eac203 github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB github.com/tdewolff/minify/v2 v2.9.21 - github.com/tidwall/buntdb v1.2.4 // indirect - github.com/uptrace/bun v1.0.4 - github.com/uptrace/bun/dialect/pgdialect v0.4.3 - github.com/uptrace/bun/dialect/sqlitedialect v0.4.3 + github.com/uptrace/bun v1.0.5 + github.com/uptrace/bun/dialect/pgdialect v1.0.5 + github.com/uptrace/bun/dialect/sqlitedialect v1.0.5 github.com/urfave/cli/v2 v2.3.0 github.com/wagslane/go-password-validator v0.3.0 - golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 - golang.org/x/mod v0.5.0 // indirect + golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f - golang.org/x/sys v0.0.0-20210908160347-a851e7ddeee0 // indirect - golang.org/x/text v0.3.6 - golang.org/x/tools v0.1.5 // indirect - google.golang.org/appengine v1.6.7 // indirect - gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect + golang.org/x/text v0.3.7 gopkg.in/yaml.v2 v2.4.0 - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect modernc.org/sqlite v1.13.0 mvdan.cc/xurls/v2 v2.3.0 ) + +require ( + github.com/PuerkitoBio/goquery v1.7.1 // indirect + github.com/andybalholm/cascadia v1.2.0 // indirect + github.com/aymerick/douceur v0.2.0 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.1 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/dsoprea/go-exif v0.0.0-20210625224831-a6301f85c82b // indirect + github.com/dsoprea/go-exif/v2 v2.0.0-20210625224831-a6301f85c82b // indirect + github.com/dsoprea/go-iptc v0.0.0-20200610044640-bc9ca208b413 // indirect + github.com/dsoprea/go-jpeg-image-structure v0.0.0-20210512043942-b434301c6836 // indirect + github.com/dsoprea/go-logging v0.0.0-20200710184922-b02d349568dd // indirect + github.com/dsoprea/go-photoshop-info-format v0.0.0-20200610045659-121dd752914d // indirect + github.com/dsoprea/go-png-image-structure v0.0.0-20210512210324-29b889a6093d // indirect + github.com/dsoprea/go-utility v0.0.0-20200717064901-2fccff4aa15e // indirect + github.com/gin-contrib/sse v0.1.0 // indirect + github.com/go-playground/locales v0.14.0 // indirect + github.com/go-playground/universal-translator v0.18.0 // indirect + github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b // indirect + github.com/goccy/go-json v0.7.8 // indirect + github.com/golang-jwt/jwt v3.2.2+incompatible // indirect + github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect + github.com/golang/protobuf v1.5.2 // indirect + github.com/gorilla/context v1.1.1 // indirect + github.com/gorilla/css v1.0.0 // indirect + github.com/gorilla/securecookie v1.1.1 // indirect + github.com/gorilla/sessions v1.2.1 // indirect + github.com/jackc/chunkreader/v2 v2.0.1 // indirect + github.com/jackc/pgio v1.0.0 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgproto3/v2 v2.1.1 // indirect + github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect + github.com/jackc/pgtype v1.8.1 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/json-iterator/go v1.1.11 // indirect + github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect + github.com/leodido/go-urn v1.2.1 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b // indirect + github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect + github.com/stretchr/objx v0.2.0 // indirect + github.com/tdewolff/parse/v2 v2.5.19 // indirect + github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect + github.com/ugorji/go/codec v1.2.6 // indirect + github.com/vmihailenco/msgpack/v5 v5.3.4 // indirect + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect + golang.org/x/mod v0.5.0 // indirect + golang.org/x/net v0.0.0-20210908191846-a5e095526f91 // indirect + golang.org/x/sys v0.0.0-20210909193231-528a39cd75f3 // indirect + golang.org/x/tools v0.1.5 // indirect + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + google.golang.org/appengine v1.6.7 // indirect + google.golang.org/protobuf v1.27.1 // indirect + gopkg.in/square/go-jose.v2 v2.6.0 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + lukechampine.com/uint128 v1.1.1 // indirect + modernc.org/cc/v3 v3.34.0 // indirect + modernc.org/ccgo/v3 v3.11.2 // indirect + modernc.org/libc v1.11.3 // indirect + modernc.org/mathutil v1.4.1 // indirect + modernc.org/memory v1.0.5 // indirect + modernc.org/opt v0.1.1 // indirect + modernc.org/strutil v1.1.1 // indirect + modernc.org/token v1.0.0 // indirect +) diff --git a/go.sum b/go.sum @@ -35,12 +35,16 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= +github.com/PuerkitoBio/goquery v1.7.1 h1:oE+T06D+1T7LNrn91B4aERsRIeCLJ/oPSa6xB9FPnz4= +github.com/PuerkitoBio/goquery v1.7.1/go.mod h1:XY0pP4kfraEmmV1O7Uf6XyjoslwsneBbgeDjLYuN8xY= github.com/ReneKroon/ttlcache v1.7.0 h1:8BkjFfrzVFXyrqnMtezAaJ6AHPSsVV10m6w28N/Fgkk= github.com/ReneKroon/ttlcache v1.7.0/go.mod h1:8BGGzdumrIjWxdRx8zpK6L3oGMWvIXdvB2GD1cfvd+I= github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/andybalholm/brotli v1.0.0 h1:7UCwP93aiSfvWpapti8g88vVVGp2qqtGyePsSuDafo4= github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= +github.com/andybalholm/cascadia v1.2.0 h1:vuRCkM5Ozh/BfmsaTm26kbjm0mIOM3yS5Ek/F5h18aE= +github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY= github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= @@ -62,39 +66,49 @@ github.com/coreos/go-oidc/v3 v3.0.0 h1:/mAA0XMgYJw2Uqm7WKGCsKnjitE/+A0FFbOmiRJm7 github.com/coreos/go-oidc/v3 v3.0.0/go.mod h1:rEJ/idjfUyfkBit1eI1fvyr+64/g9dcKpAm8MJMesvo= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.1 h1:r/myEWzV9lfsM1tFLgDyu0atFtJ1fXn261LKYj/3DxU= github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/dave/jennifer v1.3.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dsoprea/go-exif v0.0.0-20210131231135-d154f10435cc h1:AuzYp98IFVOi0NU/WcZyGDQ6vAh/zkCjxGD3kt8aLzA= github.com/dsoprea/go-exif v0.0.0-20210131231135-d154f10435cc/go.mod h1:lOaOt7+UEppOgyvRy749v3do836U/hw0YVJNjoyPaEs= github.com/dsoprea/go-exif v0.0.0-20210625224831-a6301f85c82b h1:hoVHc4m/v8Al8mbWyvKJWr4Z37yM4QUSVh/NY6A5Sbc= github.com/dsoprea/go-exif v0.0.0-20210625224831-a6301f85c82b/go.mod h1:lOaOt7+UEppOgyvRy749v3do836U/hw0YVJNjoyPaEs= github.com/dsoprea/go-exif/v2 v2.0.0-20200321225314-640175a69fe4/go.mod h1:Lm2lMM2zx8p4a34ZemkaUV95AnMl4ZvLbCUbwOvLC2E= +github.com/dsoprea/go-exif/v2 v2.0.0-20200604193436-ca8584a0e1c4 h1:Mg7pY7kxDQD2Bkvr1N+XW4BESSIQ7tTTR7Vv+Gi2CsM= github.com/dsoprea/go-exif/v2 v2.0.0-20200604193436-ca8584a0e1c4/go.mod h1:9EXlPeHfblFFnwu5UOqmP2eoZfJyAZ2Ri/Vki33ajO0= github.com/dsoprea/go-exif/v2 v2.0.0-20210625224831-a6301f85c82b h1:8lVRnnni9zebcpjkrEXrEyxFpRWG/oTpWc2Y3giKomE= github.com/dsoprea/go-exif/v2 v2.0.0-20210625224831-a6301f85c82b/go.mod h1:oKrjk2kb3rAR5NbtSTLUMvMSbc+k8ZosI3MaVH47noc= github.com/dsoprea/go-exif/v3 v3.0.0-20200717053412-08f1b6708903/go.mod h1:0nsO1ce0mh5czxGeLo4+OCZ/C6Eo6ZlMWsz7rH/Gxv8= github.com/dsoprea/go-exif/v3 v3.0.0-20210512043655-120bcdb2a55e/go.mod h1:cg5SNYKHMmzxsr9X6ZeLh/nfBRHHp5PngtEPcujONtk= +github.com/dsoprea/go-iptc v0.0.0-20200609062250-162ae6b44feb h1:gwjJjUr6FY7zAWVEueFPrcRHhd9+IK81TcItbqw2du4= github.com/dsoprea/go-iptc v0.0.0-20200609062250-162ae6b44feb/go.mod h1:kYIdx9N9NaOyD7U6D+YtExN7QhRm+5kq7//yOsRXQtM= github.com/dsoprea/go-iptc v0.0.0-20200610044640-bc9ca208b413 h1:YDRiMEm32T60Kpm35YzOK9ZHgjsS1Qrid+XskNcsdp8= github.com/dsoprea/go-iptc v0.0.0-20200610044640-bc9ca208b413/go.mod h1:kYIdx9N9NaOyD7U6D+YtExN7QhRm+5kq7//yOsRXQtM= +github.com/dsoprea/go-jpeg-image-structure v0.0.0-20210128210355-86b1014917f2 h1:ULCSN6v0WISNbALxomGPXh4dSjRKPW+7+seYoMz8UTc= github.com/dsoprea/go-jpeg-image-structure v0.0.0-20210128210355-86b1014917f2/go.mod h1:ZoOP3yUG0HD1T4IUjIFsz/2OAB2yB4YX6NSm4K+uJRg= github.com/dsoprea/go-jpeg-image-structure v0.0.0-20210512043942-b434301c6836 h1:OHRfKIVRz2XrhZ6A7fJKHLoKky1giN+VUgU2npF0BvE= github.com/dsoprea/go-jpeg-image-structure v0.0.0-20210512043942-b434301c6836/go.mod h1:6+tQXZ+I62x13UZ+hemLVoZIuq/usVzvau7bqwUo9P0= github.com/dsoprea/go-logging v0.0.0-20190624164917-c4f10aab7696/go.mod h1:Nm/x2ZUNRW6Fe5C3LxdY1PyZY5wmDv/s5dkPJ/VB3iA= +github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d h1:F/7L5wr/fP/SKeO5HuMlNEX9Ipyx2MbH2rV9G4zJRpk= github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d/go.mod h1:7I+3Pe2o/YSU88W0hWlm9S22W7XI1JFNJ86U0zPKMf8= github.com/dsoprea/go-logging v0.0.0-20200710184922-b02d349568dd h1:l+vLbuxptsC6VQyQsfD7NnEC8BZuFpz45PgY+pH8YTg= github.com/dsoprea/go-logging v0.0.0-20200710184922-b02d349568dd/go.mod h1:7I+3Pe2o/YSU88W0hWlm9S22W7XI1JFNJ86U0zPKMf8= +github.com/dsoprea/go-photoshop-info-format v0.0.0-20200609050348-3db9b63b202c h1:7j5aWACOzROpr+dvMtu8GnI97g9ShLWD72XIELMgn+c= github.com/dsoprea/go-photoshop-info-format v0.0.0-20200609050348-3db9b63b202c/go.mod h1:pqKB+ijp27cEcrHxhXVgUUMlSDRuGJJp1E+20Lj5H0E= github.com/dsoprea/go-photoshop-info-format v0.0.0-20200610045659-121dd752914d h1:dg6UMHa50VI01WuPWXPbNJpO8QSyvIF5T5n2IZiqX3A= github.com/dsoprea/go-photoshop-info-format v0.0.0-20200610045659-121dd752914d/go.mod h1:pqKB+ijp27cEcrHxhXVgUUMlSDRuGJJp1E+20Lj5H0E= +github.com/dsoprea/go-png-image-structure v0.0.0-20200807080309-a98d4e94ac82 h1:RdwKOEEe2ND/JmoKh6I/EQlR9idKJTDOMffPFK6vN2M= github.com/dsoprea/go-png-image-structure v0.0.0-20200807080309-a98d4e94ac82/go.mod h1:aDYQkL/5gfRNZkoxiLTSWU4Y8/gV/4MVsy/MU9uwTak= github.com/dsoprea/go-png-image-structure v0.0.0-20210512210324-29b889a6093d h1:8+qI8ant/vZkNSsbwSjIR6XJfWcDVTg/qx/3pRUUZNA= github.com/dsoprea/go-png-image-structure v0.0.0-20210512210324-29b889a6093d/go.mod h1:yTR3tKgyk20phAFg6IE9ulMA5NjEDD2wyx+okRFLVtw= +github.com/dsoprea/go-utility v0.0.0-20200512094054-1abbbc781176 h1:CfXezFYb2STGOd1+n1HshvE191zVx+QX3A1nML5xxME= github.com/dsoprea/go-utility v0.0.0-20200512094054-1abbbc781176/go.mod h1:95+K3z2L0mqsVYd6yveIv1lmtT3tcQQ3dVakPySffW8= github.com/dsoprea/go-utility v0.0.0-20200711062821-fab8125e9bdf/go.mod h1:95+K3z2L0mqsVYd6yveIv1lmtT3tcQQ3dVakPySffW8= github.com/dsoprea/go-utility v0.0.0-20200717064901-2fccff4aa15e h1:ojqYA1mU6LuRm8XzrVOvyfb000y59cbUcu6Wt8sFSAs= @@ -122,8 +136,13 @@ github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= github.com/gin-gonic/gin v1.7.2-0.20210722225815-d4ca9a0fb121 h1:g8dxLBXSWxnEVZ+YqpDw30A4+bfscDZrqqS+JSt7dsY= github.com/gin-gonic/gin v1.7.2-0.20210722225815-d4ca9a0fb121/go.mod h1:0rdnKJhj+oP5aTsm5iFhKbQaPXBz4q/pWndcoMneALE= +github.com/gin-gonic/gin v1.7.2-0.20210908033055-3a6f18f32f22 h1:kWkYy1sC7NJOQJ9d5byxqVYNtDxaHxNfBhxa1x+fncc= +github.com/gin-gonic/gin v1.7.2-0.20210908033055-3a6f18f32f22/go.mod h1:JkzyG2NNK3nIu6mIADW5aYvtWOsqhYbJhXueC0y9Iz8= +github.com/gin-gonic/gin v1.7.4 h1:QmUZXrvJ9qZ3GfWvQ+2wnW/1ePrTEJqPKMYEU3lD/DM= +github.com/gin-gonic/gin v1.7.4/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= +github.com/go-errors/errors v1.0.2 h1:xMxH9j2fNg/L4hLn/4y3M0IUsn0M6Wbu/Uh9QlOfBh4= github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= github.com/go-errors/errors v1.1.1/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= github.com/go-errors/errors v1.4.0 h1:2OA7MFw38+e9na72T1xgkomPb6GzZzzxvJ5U630FoRM= @@ -143,12 +162,19 @@ github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvSc github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= github.com/go-playground/validator/v10 v10.6.1/go.mod h1:xm76BBt941f7yWdGnI2DVPFFg1UK3YY04qifoXU3lOk= github.com/go-playground/validator/v10 v10.7.0 h1:gLi5ajTBBheLNt0ctewgq7eolXoDALQd5/y90Hh9ZgM= github.com/go-playground/validator/v10 v10.7.0/go.mod h1:xm76BBt941f7yWdGnI2DVPFFg1UK3YY04qifoXU3lOk= +github.com/go-playground/validator/v10 v10.9.0 h1:NgTtmN58D0m8+UuxtYmGztBJB7VnPgjj221I1QHci2A= +github.com/go-playground/validator/v10 v10.9.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos= github.com/go-session/session v3.1.2+incompatible/go.mod h1:8B3iivBQjrz/JtC68Np2T1yBBLxTan3mn/3OM0CyRt0= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.1 h1:UQhStjbkDClarlmv0am7OXXO4/GaPdCGiUiMTvi28sg= @@ -157,11 +183,16 @@ github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b h1:khEcpUM4yFcxg4 github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= github.com/goccy/go-json v0.5.1 h1:R9UYTOUvo7eIY9aeDMZ4L6OVtHaSr1k2No9W6MKjXrA= github.com/goccy/go-json v0.5.1/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/goccy/go-json v0.7.8 h1:CvMH7LotYymYuLGEohBM1lTZWX4g6jzWUUl2aLFuBoE= +github.com/goccy/go-json v0.7.8/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= +github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= +github.com/golang/geo v0.0.0-20200319012246-673a6f80352d h1:C/hKUcHT483btRbeGkrRjJz+Zbcj8audldIi9tRJDCc= github.com/golang/geo v0.0.0-20200319012246-673a6f80352d/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 h1:gtexQ/VGyN+VVFRXSFiguSNcXmS6rkKT+X7FdIrTtfo= github.com/golang/geo v0.0.0-20210211234256-740aa86cb551/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= @@ -175,9 +206,8 @@ github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFU github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= -github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -191,6 +221,7 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= @@ -234,6 +265,7 @@ github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/sessions v1.1.1/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= +github.com/gorilla/sessions v1.1.3 h1:uXoZdcdA5XdXF3QzuSlheVRUvjl+1rKY7zBXL68L9RU= github.com/gorilla/sessions v1.1.3/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI= github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= @@ -298,6 +330,7 @@ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJS github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ= github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -315,14 +348,19 @@ github.com/klauspost/compress v1.10.10 h1:a/y8CglcM7gLGYmlbP/stPE5sR3hbhFRUjCBfd github.com/klauspost/compress v1.10.10/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= +github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= @@ -338,6 +376,7 @@ github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= @@ -348,9 +387,11 @@ github.com/microcosm-cc/bluemonday v1.0.15 h1:J4uN+qPng9rvkBZBoBb8YGR+ijuklIMpSO github.com/microcosm-cc/bluemonday v1.0.15/go.mod h1:ZLvAzeakRwrGnzQEvstVzVt3ZpqOF2+sdFr0Om+ce30= github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -372,12 +413,14 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/quasoft/memstore v0.0.0-20180925164028-84a050167438 h1:jnz/4VenymvySjE+Ez511s0pqVzkUOmr1fwCVytNNWk= github.com/quasoft/memstore v0.0.0-20180925164028-84a050167438/go.mod h1:wTPjTepVu7uJBYgZ0SdWHQlIas582j6cn2jgk4DDdlg= github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b h1:aUNXCGgukb4gtY99imuIeoh8Vr0GSwAlYxPAhqZrpFc= github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b/go.mod h1:wTPjTepVu7uJBYgZ0SdWHQlIas582j6cn2jgk4DDdlg= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= @@ -404,6 +447,7 @@ github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9 github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= @@ -422,33 +466,24 @@ github.com/tdewolff/parse/v2 v2.5.19 h1:Kjaj3KQOx/4elIxlBSglus4E2oMfdROphvbq2b+O github.com/tdewolff/parse/v2 v2.5.19/go.mod h1:WzaJpRSbwq++EIQHYIRTpbYKNA3gn9it1Ik++q4zyho= github.com/tdewolff/test v1.0.6 h1:76mzYJQ83Op284kMT+63iCNCI7NEERsIN8dLM+RiKr4= github.com/tdewolff/test v1.0.6/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= +github.com/tidwall/btree v0.0.0-20191029221954-400434d76274 h1:G6Z6HvJuPjG6XfNGi/feOATzeJrfgTNJY+rGrHbA04E= github.com/tidwall/btree v0.0.0-20191029221954-400434d76274/go.mod h1:huei1BkDWJ3/sLXmO+bsCNELL+Bp2Kks9OLyQFkzvA8= -github.com/tidwall/btree v0.5.0 h1:IBfCtOj4uOMQcodv3wzYVo0zPqSJObm71mE039/dlXY= -github.com/tidwall/btree v0.5.0/go.mod h1:TzIRzen6yHbibdSfK6t8QimqbUnoxUSrZfeW7Uob0q4= +github.com/tidwall/buntdb v1.1.2 h1:noCrqQXL9EKMtcdwJcmuVKSEjqu1ua99RHHgbLTEHRo= github.com/tidwall/buntdb v1.1.2/go.mod h1:xAzi36Hir4FarpSHyfuZ6JzPJdjRZ8QlLZSntE2mqlI= -github.com/tidwall/buntdb v1.2.4 h1:G0Qz2pV+gdxyXGCa+ARZUAE4TEljz4OaGUl8/7xEMyM= -github.com/tidwall/buntdb v1.2.4/go.mod h1:RLySCmKeFqn8PW6jU4HQ6yLvA++kunwIwjkR9hv5hB8= github.com/tidwall/gjson v1.3.4/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= +github.com/tidwall/gjson v1.6.0 h1:9VEQWz6LLMUsUl6PueE49ir4Ka6CzLymOAZDxpFsTDc= github.com/tidwall/gjson v1.6.0/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= -github.com/tidwall/gjson v1.8.0 h1:Qt+orfosKn0rbNTZqHYDqBrmm3UDA4KRkv70fDzG+PQ= -github.com/tidwall/gjson v1.8.0/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= +github.com/tidwall/grect v0.0.0-20161006141115-ba9a043346eb h1:5NSYaAdrnblKByzd7XByQEJVT8+9v0W/tIY0Oo4OwrE= github.com/tidwall/grect v0.0.0-20161006141115-ba9a043346eb/go.mod h1:lKYYLFIr9OIgdgrtgkZ9zgRxRdvPYsExnYBsEAd8W5M= -github.com/tidwall/grect v0.1.2 h1:wKVeQVZhjaFCKTTlpkDe3Ex4ko3cMGW3MRKawRe8uQ4= -github.com/tidwall/grect v0.1.2/go.mod h1:v+n4ewstPGduVJebcp5Eh2WXBJBumNzyhK8GZt4gHNw= -github.com/tidwall/lotsa v1.0.2/go.mod h1:X6NiU+4yHA3fE3Puvpnn1XMDrFZrE9JO2/w+UMuqgR8= +github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc= github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= -github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE= -github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tidwall/pretty v1.0.1 h1:WE4RBSZ1x6McVVC8S/Md+Qse8YUv6HRObAx6ke00NY8= github.com/tidwall/pretty v1.0.1/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tidwall/pretty v1.1.0 h1:K3hMW5epkdAVwibsQEfR/7Zj0Qgt4DxtNumTq/VloO8= -github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tidwall/rtred v0.1.2 h1:exmoQtOLvDoO8ud++6LwVsAMTu0KPzLTUrMln8u1yu8= -github.com/tidwall/rtred v0.1.2/go.mod h1:hd69WNXQ5RP9vHd7dqekAz+RIdtfBogmglkZSRxCHFQ= +github.com/tidwall/rtree v0.0.0-20180113144539-6cd427091e0e h1:+NL1GDIUOKxVfbp2KoJQD9cTQ6dyP2co9q4yzmT9FZo= github.com/tidwall/rtree v0.0.0-20180113144539-6cd427091e0e/go.mod h1:/h+UnNGt0IhNNJLkGikcdcJqm66zGD/uJGMRxK/9+Ao= +github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563 h1:Otn9S136ELckZ3KKDyCkxapfufrqDqwmGjcHfAyXRrE= github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563/go.mod h1:mLqSmt7Dv/CNneF2wfcChfN1rvapyQr01LGKnKex0DQ= -github.com/tidwall/tinyqueue v0.1.1 h1:SpNEvEggbpyN5DIReaJ2/1ndroY8iyEGxPYxoSaymYE= -github.com/tidwall/tinyqueue v0.1.1/go.mod h1:O/QNHwrnjqr6IHItYrzoHAKYhBkLI67Q096fQP5zMYw= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= @@ -460,10 +495,16 @@ github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxW github.com/uptrace/bun v0.4.3/go.mod h1:aL6D9vPw8DXaTQTwGrEPtUderBYXx7ShUmPfnxnqscw= github.com/uptrace/bun v1.0.4 h1:XKkddp+F5rbjyZCfEXPHc9ZEG3RE8VktO4HCcg5nzCQ= github.com/uptrace/bun v1.0.4/go.mod h1:aL6D9vPw8DXaTQTwGrEPtUderBYXx7ShUmPfnxnqscw= +github.com/uptrace/bun v1.0.5 h1:bNhNhWt6XNwSWMEQUvYK7iJ3qHrMfeoKY3/w2jkqcBs= +github.com/uptrace/bun v1.0.5/go.mod h1:aL6D9vPw8DXaTQTwGrEPtUderBYXx7ShUmPfnxnqscw= github.com/uptrace/bun/dialect/pgdialect v0.4.3 h1:lM2IUKpU99110chKkupw3oTfXiOKpB0hTJIe6frqQDo= github.com/uptrace/bun/dialect/pgdialect v0.4.3/go.mod h1:BaNvWejl32oKUhwpFkw/eNcWldzIlVY4nfw/sNul0s8= +github.com/uptrace/bun/dialect/pgdialect v1.0.5 h1:mq694/aMvs7GwuTar9NIlCLQt/2u4xsF0QMP4I24yHA= +github.com/uptrace/bun/dialect/pgdialect v1.0.5/go.mod h1:MKWjO0PC20ris2oJ3dd6mI/762x24Cjwh8XmbqUhM8A= github.com/uptrace/bun/dialect/sqlitedialect v0.4.3 h1:h+vqLGCeY22PFrbCOpQqK5+/p1qWCXYIhIUm/D5Vw08= github.com/uptrace/bun/dialect/sqlitedialect v0.4.3/go.mod h1:W9zHzVl9lJwWHx038vHs7ddVJ6LbNebseLZ3UGAqeAk= +github.com/uptrace/bun/dialect/sqlitedialect v1.0.5 h1:6cIj31YVJr4vvA15C2v76soXL+7WtjFdV6WraApc3r0= +github.com/uptrace/bun/dialect/sqlitedialect v1.0.5/go.mod h1:NW2Gctc9ooQXGSD4kYSac2aiF49lo8YJ3ZAr93lH2p8= github.com/urfave/cli/v2 v2.3.0 h1:qph92Y649prgesehzOrQjdWyxFOp/QVM+6imKHad91M= github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= @@ -494,7 +535,6 @@ github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= @@ -526,6 +566,8 @@ golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWP golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI= golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -555,10 +597,11 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.5.0 h1:UG21uOlmZabA4fW5i7ZX6bjw1xELEGg/ZLgZq9auk/Q= golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= +golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -592,9 +635,10 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210908191846-a5e095526f91 h1:E8wdt+zBjoxD3MA65wEc3pl25BsTi7tbkpwc4ANThjc= +golang.org/x/net v0.0.0-20210908191846-a5e095526f91/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= 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= @@ -611,7 +655,6 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180525142821-c11f84a56e43/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -653,15 +696,16 @@ golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210902050250-f475640dd07b h1:S7hKs0Flbq0bbc9xgYt4stIEG1zNDFqyrPwAX2Wj/sE= golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210908160347-a851e7ddeee0 h1:6xxeVXiyYpF8WCTnKKCbjnEdsrwjZYY8TOuk7xP0chg= -golang.org/x/sys v0.0.0-20210908160347-a851e7ddeee0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210909193231-528a39cd75f3 h1:3Ad41xy2WCESpufXwgs7NpDSu+vjxqLt2UFqUV+20bI= +golang.org/x/sys v0.0.0-20210909193231-528a39cd75f3/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -673,6 +717,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= 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= @@ -722,8 +768,8 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78 h1:M8tBwCtWD/cZV9DZpFYRUgaymAYAr+aIUTWzDaM3uPs= golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5 h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -754,6 +800,7 @@ google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7 google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= @@ -811,10 +858,12 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ= +google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= @@ -823,6 +872,8 @@ gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWd gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= gopkg.in/square/go-jose.v2 v2.5.1 h1:7odma5RETjNHWJnR32wx8t+Io4djHE1PqxCFx3iiZ2w= gopkg.in/square/go-jose.v2 v2.5.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= +gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= +gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -833,6 +884,7 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/vendor/github.com/ReneKroon/ttlcache/go.mod b/vendor/github.com/ReneKroon/ttlcache/go.mod @@ -1,9 +0,0 @@ -module github.com/ReneKroon/ttlcache - -go 1.14 - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/stretchr/testify v1.3.0 - go.uber.org/goleak v0.10.0 -) diff --git a/vendor/github.com/ReneKroon/ttlcache/go.sum b/vendor/github.com/ReneKroon/ttlcache/go.sum @@ -1,11 +0,0 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -go.uber.org/goleak v0.10.0 h1:G3eWbSNIskeRqtsN/1uI5B+eP73y3JUuBsv9AZjehb4= -go.uber.org/goleak v0.10.0/go.mod h1:VCZuO8V8mFPlL0F5J5GK1rtHV3DrFcQ1R8ryq7FK0aI= diff --git a/vendor/github.com/buckket/go-blurhash/go.mod b/vendor/github.com/buckket/go-blurhash/go.mod @@ -1,3 +0,0 @@ -module github.com/buckket/go-blurhash - -go 1.14 diff --git a/vendor/github.com/dsoprea/go-exif/go.mod b/vendor/github.com/dsoprea/go-exif/go.mod @@ -1,11 +0,0 @@ -module github.com/dsoprea/go-exif - -go 1.13 - -require ( - github.com/dsoprea/go-logging v0.0.0-20190624164917-c4f10aab7696 - github.com/go-errors/errors v1.0.1 // indirect - github.com/golang/geo v0.0.0-20190916061304-5b978397cfec - golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 // indirect - gopkg.in/yaml.v2 v2.2.7 -) diff --git a/vendor/github.com/dsoprea/go-exif/go.sum b/vendor/github.com/dsoprea/go-exif/go.sum @@ -1,14 +0,0 @@ -github.com/dsoprea/go-logging v0.0.0-20190624164917-c4f10aab7696 h1:VGFnZAcLwPpt1sHlAxml+pGLZz9A2s+K/s1YNhPC91Y= -github.com/dsoprea/go-logging v0.0.0-20190624164917-c4f10aab7696/go.mod h1:Nm/x2ZUNRW6Fe5C3LxdY1PyZY5wmDv/s5dkPJ/VB3iA= -github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w= -github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= -github.com/golang/geo v0.0.0-20190916061304-5b978397cfec h1:lJwO/92dFXWeXOZdoGXgptLmNLwynMSHUmU6besqtiw= -github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 h1:efeOvDhwQ29Dj3SdAV/MJf8oukgn+8D8WgaCaRMchF8= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/dsoprea/go-exif/v2/go.mod b/vendor/github.com/dsoprea/go-exif/v2/go.mod @@ -1,15 +0,0 @@ -module github.com/dsoprea/go-exif/v2 - -go 1.13 - -// Development only -// replace github.com/dsoprea/go-logging => ../../go-logging - -require ( - github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d - github.com/dsoprea/go-utility v0.0.0-20200711062821-fab8125e9bdf // indirect - github.com/golang/geo v0.0.0-20200319012246-673a6f80352d - github.com/jessevdk/go-flags v1.4.0 - golang.org/x/net v0.0.0-20200513185701-a91f0712d120 // indirect - gopkg.in/yaml.v2 v2.3.0 -) diff --git a/vendor/github.com/dsoprea/go-exif/v2/go.sum b/vendor/github.com/dsoprea/go-exif/v2/go.sum @@ -1,37 +0,0 @@ -github.com/dsoprea/go-exif/v2 v2.0.0-20200321225314-640175a69fe4/go.mod h1:Lm2lMM2zx8p4a34ZemkaUV95AnMl4ZvLbCUbwOvLC2E= -github.com/dsoprea/go-logging v0.0.0-20190624164917-c4f10aab7696 h1:VGFnZAcLwPpt1sHlAxml+pGLZz9A2s+K/s1YNhPC91Y= -github.com/dsoprea/go-logging v0.0.0-20190624164917-c4f10aab7696/go.mod h1:Nm/x2ZUNRW6Fe5C3LxdY1PyZY5wmDv/s5dkPJ/VB3iA= -github.com/dsoprea/go-logging v0.0.0-20200502191043-ec333ec7635f h1:XM9MVftaUNA4CcjV97+4bSy7u9Ns04DEYbZkswUrRtc= -github.com/dsoprea/go-logging v0.0.0-20200502191043-ec333ec7635f/go.mod h1:7I+3Pe2o/YSU88W0hWlm9S22W7XI1JFNJ86U0zPKMf8= -github.com/dsoprea/go-logging v0.0.0-20200502201358-170ff607885f h1:FonKAuW3PmNtqk9tOR+Z7bnyQHytmnZBCmm5z1PQMss= -github.com/dsoprea/go-logging v0.0.0-20200502201358-170ff607885f/go.mod h1:7I+3Pe2o/YSU88W0hWlm9S22W7XI1JFNJ86U0zPKMf8= -github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d h1:F/7L5wr/fP/SKeO5HuMlNEX9Ipyx2MbH2rV9G4zJRpk= -github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d/go.mod h1:7I+3Pe2o/YSU88W0hWlm9S22W7XI1JFNJ86U0zPKMf8= -github.com/dsoprea/go-utility v0.0.0-20200711062821-fab8125e9bdf h1:/w4QxepU4AHh3AuO6/g8y/YIIHH5+aKP3Bj8sg5cqhU= -github.com/dsoprea/go-utility v0.0.0-20200711062821-fab8125e9bdf/go.mod h1:95+K3z2L0mqsVYd6yveIv1lmtT3tcQQ3dVakPySffW8= -github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w= -github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= -github.com/go-errors/errors v1.0.2 h1:xMxH9j2fNg/L4hLn/4y3M0IUsn0M6Wbu/Uh9QlOfBh4= -github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= -github.com/golang/geo v0.0.0-20190916061304-5b978397cfec h1:lJwO/92dFXWeXOZdoGXgptLmNLwynMSHUmU6besqtiw= -github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= -github.com/golang/geo v0.0.0-20200319012246-673a6f80352d h1:C/hKUcHT483btRbeGkrRjJz+Zbcj8audldIi9tRJDCc= -github.com/golang/geo v0.0.0-20200319012246-673a6f80352d/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= -github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 h1:efeOvDhwQ29Dj3SdAV/MJf8oukgn+8D8WgaCaRMchF8= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200320220750-118fecf932d8/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5 h1:WQ8q63x+f/zpC8Ac1s9wLElVoHhm32p6tudrU72n1QA= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120 h1:EZ3cVSzKOlJxAd8e8YAJ7no8nNypTxexh/YE/xW3ZEY= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/dsoprea/go-iptc/go.mod b/vendor/github.com/dsoprea/go-iptc/go.mod @@ -1,5 +0,0 @@ -module github.com/dsoprea/go-iptc - -go 1.13 - -require github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d diff --git a/vendor/github.com/dsoprea/go-iptc/go.sum b/vendor/github.com/dsoprea/go-iptc/go.sum @@ -1,10 +0,0 @@ -github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d h1:F/7L5wr/fP/SKeO5HuMlNEX9Ipyx2MbH2rV9G4zJRpk= -github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d/go.mod h1:7I+3Pe2o/YSU88W0hWlm9S22W7XI1JFNJ86U0zPKMf8= -github.com/go-errors/errors v1.0.2 h1:xMxH9j2fNg/L4hLn/4y3M0IUsn0M6Wbu/Uh9QlOfBh4= -github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5 h1:WQ8q63x+f/zpC8Ac1s9wLElVoHhm32p6tudrU72n1QA= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/vendor/github.com/dsoprea/go-jpeg-image-structure/go.mod b/vendor/github.com/dsoprea/go-jpeg-image-structure/go.mod @@ -1,22 +0,0 @@ -module github.com/dsoprea/go-jpeg-image-structure - -go 1.13 - -// Development only -// replace github.com/dsoprea/go-utility => ../go-utility -// replace github.com/dsoprea/go-logging => ../go-logging -// replace github.com/dsoprea/go-exif/v2 => ../go-exif/v2 -// replace github.com/dsoprea/go-photoshop-info-format => ../go-photoshop-info-format -// replace github.com/dsoprea/go-iptc => ../go-iptc - -require ( - github.com/dsoprea/go-exif/v2 v2.0.0-20200604193436-ca8584a0e1c4 - github.com/dsoprea/go-exif/v3 v3.0.0-20210512043655-120bcdb2a55e // indirect - github.com/dsoprea/go-iptc v0.0.0-20200609062250-162ae6b44feb - github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d - github.com/dsoprea/go-photoshop-info-format v0.0.0-20200609050348-3db9b63b202c - github.com/dsoprea/go-utility v0.0.0-20200711062821-fab8125e9bdf - github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b - github.com/jessevdk/go-flags v1.4.0 - golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 // indirect -) diff --git a/vendor/github.com/dsoprea/go-jpeg-image-structure/go.sum b/vendor/github.com/dsoprea/go-jpeg-image-structure/go.sum @@ -1,85 +0,0 @@ -github.com/dsoprea/go-exif v0.0.0-20200502203340-6aea10b45f4c h1:PoW4xOq3wUrX8ghNGiJFzem7mwd+mY/Xkgo0Z8AwcNY= -github.com/dsoprea/go-exif v0.0.0-20200516122116-a45cc7cfd55e h1:tTb1WdrhFs8VdnmxiADJEUpDJWKHFUFys0OUyLM9A6o= -github.com/dsoprea/go-exif/v2 v2.0.0-20200113231207-0bbb7a3584f7 h1:+koSu4BOaLu+dy50WEj+ltzEjMzK5evzPawKxgIQerw= -github.com/dsoprea/go-exif/v2 v2.0.0-20200113231207-0bbb7a3584f7/go.mod h1:Lm2lMM2zx8p4a34ZemkaUV95AnMl4ZvLbCUbwOvLC2E= -github.com/dsoprea/go-exif/v2 v2.0.0-20200321225314-640175a69fe4/go.mod h1:Lm2lMM2zx8p4a34ZemkaUV95AnMl4ZvLbCUbwOvLC2E= -github.com/dsoprea/go-exif/v2 v2.0.0-20200502203340-6aea10b45f4c h1:fQNBTLqL4u7yhl5AqW6dGG5RSxGuRhzXLnBVDR2uUuE= -github.com/dsoprea/go-exif/v2 v2.0.0-20200502203340-6aea10b45f4c/go.mod h1:YXOyDqCYjBuHHRw4JIGPgOgMit0IDvVSjjhsqOAFTYQ= -github.com/dsoprea/go-exif/v2 v2.0.0-20200516113213-42546383ce8f h1:WFrUfvt3uESgJ/NwPG/2Vjhp2uOE7X2wENldE+ch1yw= -github.com/dsoprea/go-exif/v2 v2.0.0-20200516113213-42546383ce8f/go.mod h1:YXOyDqCYjBuHHRw4JIGPgOgMit0IDvVSjjhsqOAFTYQ= -github.com/dsoprea/go-exif/v2 v2.0.0-20200516122116-a45cc7cfd55e h1:tPHXVRs63sg0ajoZjdmMa5aZuyjnSAt3Anwh2F4XsJM= -github.com/dsoprea/go-exif/v2 v2.0.0-20200516122116-a45cc7cfd55e/go.mod h1:YXOyDqCYjBuHHRw4JIGPgOgMit0IDvVSjjhsqOAFTYQ= -github.com/dsoprea/go-exif/v2 v2.0.0-20200516213102-7f6eb3d9f38c h1:92aud+9pN3bQjh/iw1+849uOBQfLuAcUC4LJwtfmRBo= -github.com/dsoprea/go-exif/v2 v2.0.0-20200516213102-7f6eb3d9f38c/go.mod h1:YXOyDqCYjBuHHRw4JIGPgOgMit0IDvVSjjhsqOAFTYQ= -github.com/dsoprea/go-exif/v2 v2.0.0-20200517080529-c9be4b30b064 h1:V7CH/kZImE6Lf27H4DS5PG7qzBkf774GIXUuM31vVNA= -github.com/dsoprea/go-exif/v2 v2.0.0-20200517080529-c9be4b30b064/go.mod h1:YXOyDqCYjBuHHRw4JIGPgOgMit0IDvVSjjhsqOAFTYQ= -github.com/dsoprea/go-exif/v2 v2.0.0-20200518001653-d0d0f14dea03 h1:r+aCxLEe6uGDC/NJCpA3WQJ+C7WJ0chzfHKgy173fug= -github.com/dsoprea/go-exif/v2 v2.0.0-20200518001653-d0d0f14dea03/go.mod h1:STKu28lNwOeoO0bieAKJ3zQYkUbZ2hivI6qjjGVW0sc= -github.com/dsoprea/go-exif/v2 v2.0.0-20200520183328-015129a9efd5 h1:iKMxnRjFqQQYKEpdsjFDMV2+VUAncTLT4ofcCiQpDvo= -github.com/dsoprea/go-exif/v2 v2.0.0-20200520183328-015129a9efd5/go.mod h1:9EXlPeHfblFFnwu5UOqmP2eoZfJyAZ2Ri/Vki33ajO0= -github.com/dsoprea/go-exif/v2 v2.0.0-20200527040709-fecb7e81f4be h1:iYHdwTUXN48h6wZd2QQHDyR4QsuWM08PX4wCJuzd7O0= -github.com/dsoprea/go-exif/v2 v2.0.0-20200527040709-fecb7e81f4be/go.mod h1:9EXlPeHfblFFnwu5UOqmP2eoZfJyAZ2Ri/Vki33ajO0= -github.com/dsoprea/go-exif/v2 v2.0.0-20200527042908-2a1e3f0fa19c h1:3uLJ1ub/I1sFM76IEzRi7RjqbhL1WfyPJeSko0tIYMI= -github.com/dsoprea/go-exif/v2 v2.0.0-20200527042908-2a1e3f0fa19c/go.mod h1:9EXlPeHfblFFnwu5UOqmP2eoZfJyAZ2Ri/Vki33ajO0= -github.com/dsoprea/go-exif/v2 v2.0.0-20200527165002-1a62daf3052a h1:Xk487H/DyhmIgYAnbJ5gvOrwI/eJ+FVXIO9Y22m44VI= -github.com/dsoprea/go-exif/v2 v2.0.0-20200527165002-1a62daf3052a/go.mod h1:9EXlPeHfblFFnwu5UOqmP2eoZfJyAZ2Ri/Vki33ajO0= -github.com/dsoprea/go-exif/v2 v2.0.0-20200604193436-ca8584a0e1c4 h1:Mg7pY7kxDQD2Bkvr1N+XW4BESSIQ7tTTR7Vv+Gi2CsM= -github.com/dsoprea/go-exif/v2 v2.0.0-20200604193436-ca8584a0e1c4/go.mod h1:9EXlPeHfblFFnwu5UOqmP2eoZfJyAZ2Ri/Vki33ajO0= -github.com/dsoprea/go-exif/v3 v3.0.0-20200717053412-08f1b6708903/go.mod h1:0nsO1ce0mh5czxGeLo4+OCZ/C6Eo6ZlMWsz7rH/Gxv8= -github.com/dsoprea/go-exif/v3 v3.0.0-20210512043655-120bcdb2a55e h1:E4XTSQZF/JtOQWcSaJBJho7t+RNWfdO92W/5skg10Jk= -github.com/dsoprea/go-exif/v3 v3.0.0-20210512043655-120bcdb2a55e/go.mod h1:cg5SNYKHMmzxsr9X6ZeLh/nfBRHHp5PngtEPcujONtk= -github.com/dsoprea/go-iptc v0.0.0-20200609062250-162ae6b44feb h1:gwjJjUr6FY7zAWVEueFPrcRHhd9+IK81TcItbqw2du4= -github.com/dsoprea/go-iptc v0.0.0-20200609062250-162ae6b44feb/go.mod h1:kYIdx9N9NaOyD7U6D+YtExN7QhRm+5kq7//yOsRXQtM= -github.com/dsoprea/go-logging v0.0.0-20190624164917-c4f10aab7696 h1:VGFnZAcLwPpt1sHlAxml+pGLZz9A2s+K/s1YNhPC91Y= -github.com/dsoprea/go-logging v0.0.0-20190624164917-c4f10aab7696/go.mod h1:Nm/x2ZUNRW6Fe5C3LxdY1PyZY5wmDv/s5dkPJ/VB3iA= -github.com/dsoprea/go-logging v0.0.0-20200502201358-170ff607885f h1:FonKAuW3PmNtqk9tOR+Z7bnyQHytmnZBCmm5z1PQMss= -github.com/dsoprea/go-logging v0.0.0-20200502201358-170ff607885f/go.mod h1:7I+3Pe2o/YSU88W0hWlm9S22W7XI1JFNJ86U0zPKMf8= -github.com/dsoprea/go-logging v0.0.0-20200517222403-5742ce3fc1be h1:k3sHKay8cXGnGHeF8x6U7KtX8Lc7qAiQCNDRGEIPdnU= -github.com/dsoprea/go-logging v0.0.0-20200517222403-5742ce3fc1be/go.mod h1:7I+3Pe2o/YSU88W0hWlm9S22W7XI1JFNJ86U0zPKMf8= -github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d h1:F/7L5wr/fP/SKeO5HuMlNEX9Ipyx2MbH2rV9G4zJRpk= -github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d/go.mod h1:7I+3Pe2o/YSU88W0hWlm9S22W7XI1JFNJ86U0zPKMf8= -github.com/dsoprea/go-photoshop-info-format v0.0.0-20200609050348-3db9b63b202c h1:7j5aWACOzROpr+dvMtu8GnI97g9ShLWD72XIELMgn+c= -github.com/dsoprea/go-photoshop-info-format v0.0.0-20200609050348-3db9b63b202c/go.mod h1:pqKB+ijp27cEcrHxhXVgUUMlSDRuGJJp1E+20Lj5H0E= -github.com/dsoprea/go-utility v0.0.0-20200322055224-4dc0f716e7d0 h1:zFSboMDWXX2UX7/k/mCHBjZhHlaFMx0HmtUE37HABsA= -github.com/dsoprea/go-utility v0.0.0-20200322055224-4dc0f716e7d0/go.mod h1:xv8CVgDmI/Shx/X+EUXyXELVnH5lSRUYRija52OHq7E= -github.com/dsoprea/go-utility v0.0.0-20200322154813-27f0b0d142d7 h1:DJhSHW0odJrW5wR9MU6ry5S+PsxuRXA165KFaiB+cZo= -github.com/dsoprea/go-utility v0.0.0-20200322154813-27f0b0d142d7/go.mod h1:xv8CVgDmI/Shx/X+EUXyXELVnH5lSRUYRija52OHq7E= -github.com/dsoprea/go-utility v0.0.0-20200512094054-1abbbc781176 h1:CfXezFYb2STGOd1+n1HshvE191zVx+QX3A1nML5xxME= -github.com/dsoprea/go-utility v0.0.0-20200512094054-1abbbc781176/go.mod h1:95+K3z2L0mqsVYd6yveIv1lmtT3tcQQ3dVakPySffW8= -github.com/dsoprea/go-utility v0.0.0-20200711062821-fab8125e9bdf h1:/w4QxepU4AHh3AuO6/g8y/YIIHH5+aKP3Bj8sg5cqhU= -github.com/dsoprea/go-utility v0.0.0-20200711062821-fab8125e9bdf/go.mod h1:95+K3z2L0mqsVYd6yveIv1lmtT3tcQQ3dVakPySffW8= -github.com/dsoprea/go-utility/v2 v2.0.0-20200717064901-2fccff4aa15e h1:IxIbA7VbCNrwumIYjDoMOdf4KOSkMC6NJE4s8oRbE7E= -github.com/dsoprea/go-utility/v2 v2.0.0-20200717064901-2fccff4aa15e/go.mod h1:uAzdkPTub5Y9yQwXe8W4m2XuP0tK4a9Q/dantD0+uaU= -github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w= -github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= -github.com/go-errors/errors v1.0.2 h1:xMxH9j2fNg/L4hLn/4y3M0IUsn0M6Wbu/Uh9QlOfBh4= -github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= -github.com/go-errors/errors v1.1.1 h1:ljK/pL5ltg3qoN+OtN6yCv9HWSfMwxSx90GJCZQxYNg= -github.com/go-errors/errors v1.1.1/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= -github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b h1:khEcpUM4yFcxg4/FHQWkvVRmgijNXRfzkIDHh23ggEo= -github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b/go.mod h1:aUCEOzzezBEjDBbFBoSiya/gduyIiWYRP6CnSFIV8AM= -github.com/golang/geo v0.0.0-20190916061304-5b978397cfec h1:lJwO/92dFXWeXOZdoGXgptLmNLwynMSHUmU6besqtiw= -github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= -github.com/golang/geo v0.0.0-20200319012246-673a6f80352d h1:C/hKUcHT483btRbeGkrRjJz+Zbcj8audldIi9tRJDCc= -github.com/golang/geo v0.0.0-20200319012246-673a6f80352d/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= -github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 h1:efeOvDhwQ29Dj3SdAV/MJf8oukgn+8D8WgaCaRMchF8= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200320220750-118fecf932d8/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5 h1:WQ8q63x+f/zpC8Ac1s9wLElVoHhm32p6tudrU72n1QA= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120 h1:EZ3cVSzKOlJxAd8e8YAJ7no8nNypTxexh/YE/xW3ZEY= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 h1:eDrdRpKgkcCqKZQwyZRyeFZgfqt37SL7Kv3tok06cKE= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/dsoprea/go-logging/go.mod b/vendor/github.com/dsoprea/go-logging/go.mod @@ -1,8 +0,0 @@ -module github.com/dsoprea/go-logging - -go 1.13 - -require ( - github.com/go-errors/errors v1.0.2 - golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5 -) diff --git a/vendor/github.com/dsoprea/go-logging/go.sum b/vendor/github.com/dsoprea/go-logging/go.sum @@ -1,8 +0,0 @@ -github.com/go-errors/errors v1.0.2 h1:xMxH9j2fNg/L4hLn/4y3M0IUsn0M6Wbu/Uh9QlOfBh4= -github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5 h1:WQ8q63x+f/zpC8Ac1s9wLElVoHhm32p6tudrU72n1QA= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/vendor/github.com/dsoprea/go-photoshop-info-format/go.mod b/vendor/github.com/dsoprea/go-photoshop-info-format/go.mod @@ -1,5 +0,0 @@ -module github.com/dsoprea/go-photoshop-info-format - -go 1.13 - -require github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d diff --git a/vendor/github.com/dsoprea/go-photoshop-info-format/go.sum b/vendor/github.com/dsoprea/go-photoshop-info-format/go.sum @@ -1,10 +0,0 @@ -github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d h1:F/7L5wr/fP/SKeO5HuMlNEX9Ipyx2MbH2rV9G4zJRpk= -github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d/go.mod h1:7I+3Pe2o/YSU88W0hWlm9S22W7XI1JFNJ86U0zPKMf8= -github.com/go-errors/errors v1.0.2 h1:xMxH9j2fNg/L4hLn/4y3M0IUsn0M6Wbu/Uh9QlOfBh4= -github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5 h1:WQ8q63x+f/zpC8Ac1s9wLElVoHhm32p6tudrU72n1QA= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/vendor/github.com/dsoprea/go-png-image-structure/go.mod b/vendor/github.com/dsoprea/go-png-image-structure/go.mod @@ -1,15 +0,0 @@ -module github.com/dsoprea/go-png-image-structure - -go 1.13 - -// Development only -// replace github.com/dsoprea/go-utility => ../go-utility -// replace github.com/dsoprea/go-exif/v2 => ../go-exif/v2 - -require ( - github.com/dsoprea/go-exif/v2 v2.0.0-20200604193436-ca8584a0e1c4 - github.com/dsoprea/go-exif/v3 v3.0.0-20210512043655-120bcdb2a55e // indirect - github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d - github.com/dsoprea/go-utility v0.0.0-20200711062821-fab8125e9bdf - golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 // indirect -) diff --git a/vendor/github.com/dsoprea/go-png-image-structure/go.sum b/vendor/github.com/dsoprea/go-png-image-structure/go.sum @@ -1,67 +0,0 @@ -github.com/dsoprea/go-exif v0.0.0-20200502203340-6aea10b45f4c h1:PoW4xOq3wUrX8ghNGiJFzem7mwd+mY/Xkgo0Z8AwcNY= -github.com/dsoprea/go-exif/v2 v2.0.0-20200113184400-90b66e3d1158 h1:DzXu3hw2xqwfd/R0QflKY/ixfrLDbMFk30D/CyJMTAM= -github.com/dsoprea/go-exif/v2 v2.0.0-20200113184400-90b66e3d1158/go.mod h1:Lm2lMM2zx8p4a34ZemkaUV95AnMl4ZvLbCUbwOvLC2E= -github.com/dsoprea/go-exif/v2 v2.0.0-20200113231207-0bbb7a3584f7 h1:+koSu4BOaLu+dy50WEj+ltzEjMzK5evzPawKxgIQerw= -github.com/dsoprea/go-exif/v2 v2.0.0-20200113231207-0bbb7a3584f7/go.mod h1:Lm2lMM2zx8p4a34ZemkaUV95AnMl4ZvLbCUbwOvLC2E= -github.com/dsoprea/go-exif/v2 v2.0.0-20200321225314-640175a69fe4 h1:bVaiYo8amn7Lu93sz6mTlYB3EtLG9aRcMnM1Eps8fmM= -github.com/dsoprea/go-exif/v2 v2.0.0-20200321225314-640175a69fe4/go.mod h1:Lm2lMM2zx8p4a34ZemkaUV95AnMl4ZvLbCUbwOvLC2E= -github.com/dsoprea/go-exif/v2 v2.0.0-20200502203340-6aea10b45f4c h1:fQNBTLqL4u7yhl5AqW6dGG5RSxGuRhzXLnBVDR2uUuE= -github.com/dsoprea/go-exif/v2 v2.0.0-20200502203340-6aea10b45f4c/go.mod h1:YXOyDqCYjBuHHRw4JIGPgOgMit0IDvVSjjhsqOAFTYQ= -github.com/dsoprea/go-exif/v2 v2.0.0-20200517080529-c9be4b30b064 h1:V7CH/kZImE6Lf27H4DS5PG7qzBkf774GIXUuM31vVNA= -github.com/dsoprea/go-exif/v2 v2.0.0-20200517080529-c9be4b30b064/go.mod h1:YXOyDqCYjBuHHRw4JIGPgOgMit0IDvVSjjhsqOAFTYQ= -github.com/dsoprea/go-exif/v2 v2.0.0-20200517234148-29b0ff22564b h1:Uvnq5XTzlscGvQl3IwysBUVdSb1VUmqIvHrOv4x4UCE= -github.com/dsoprea/go-exif/v2 v2.0.0-20200517234148-29b0ff22564b/go.mod h1:STKu28lNwOeoO0bieAKJ3zQYkUbZ2hivI6qjjGVW0sc= -github.com/dsoprea/go-exif/v2 v2.0.0-20200518001653-d0d0f14dea03 h1:r+aCxLEe6uGDC/NJCpA3WQJ+C7WJ0chzfHKgy173fug= -github.com/dsoprea/go-exif/v2 v2.0.0-20200518001653-d0d0f14dea03/go.mod h1:STKu28lNwOeoO0bieAKJ3zQYkUbZ2hivI6qjjGVW0sc= -github.com/dsoprea/go-exif/v2 v2.0.0-20200520183328-015129a9efd5 h1:iKMxnRjFqQQYKEpdsjFDMV2+VUAncTLT4ofcCiQpDvo= -github.com/dsoprea/go-exif/v2 v2.0.0-20200520183328-015129a9efd5/go.mod h1:9EXlPeHfblFFnwu5UOqmP2eoZfJyAZ2Ri/Vki33ajO0= -github.com/dsoprea/go-exif/v2 v2.0.0-20200604193436-ca8584a0e1c4 h1:Mg7pY7kxDQD2Bkvr1N+XW4BESSIQ7tTTR7Vv+Gi2CsM= -github.com/dsoprea/go-exif/v2 v2.0.0-20200604193436-ca8584a0e1c4/go.mod h1:9EXlPeHfblFFnwu5UOqmP2eoZfJyAZ2Ri/Vki33ajO0= -github.com/dsoprea/go-exif/v3 v3.0.0-20200717053412-08f1b6708903/go.mod h1:0nsO1ce0mh5czxGeLo4+OCZ/C6Eo6ZlMWsz7rH/Gxv8= -github.com/dsoprea/go-exif/v3 v3.0.0-20210512043655-120bcdb2a55e h1:E4XTSQZF/JtOQWcSaJBJho7t+RNWfdO92W/5skg10Jk= -github.com/dsoprea/go-exif/v3 v3.0.0-20210512043655-120bcdb2a55e/go.mod h1:cg5SNYKHMmzxsr9X6ZeLh/nfBRHHp5PngtEPcujONtk= -github.com/dsoprea/go-logging v0.0.0-20190624164917-c4f10aab7696 h1:VGFnZAcLwPpt1sHlAxml+pGLZz9A2s+K/s1YNhPC91Y= -github.com/dsoprea/go-logging v0.0.0-20190624164917-c4f10aab7696/go.mod h1:Nm/x2ZUNRW6Fe5C3LxdY1PyZY5wmDv/s5dkPJ/VB3iA= -github.com/dsoprea/go-logging v0.0.0-20200502201358-170ff607885f h1:FonKAuW3PmNtqk9tOR+Z7bnyQHytmnZBCmm5z1PQMss= -github.com/dsoprea/go-logging v0.0.0-20200502201358-170ff607885f/go.mod h1:7I+3Pe2o/YSU88W0hWlm9S22W7XI1JFNJ86U0zPKMf8= -github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d h1:F/7L5wr/fP/SKeO5HuMlNEX9Ipyx2MbH2rV9G4zJRpk= -github.com/dsoprea/go-logging v0.0.0-20200517223158-a10564966e9d/go.mod h1:7I+3Pe2o/YSU88W0hWlm9S22W7XI1JFNJ86U0zPKMf8= -github.com/dsoprea/go-utility v0.0.0-20200322055224-4dc0f716e7d0 h1:zFSboMDWXX2UX7/k/mCHBjZhHlaFMx0HmtUE37HABsA= -github.com/dsoprea/go-utility v0.0.0-20200322055224-4dc0f716e7d0/go.mod h1:xv8CVgDmI/Shx/X+EUXyXELVnH5lSRUYRija52OHq7E= -github.com/dsoprea/go-utility v0.0.0-20200322154813-27f0b0d142d7 h1:DJhSHW0odJrW5wR9MU6ry5S+PsxuRXA165KFaiB+cZo= -github.com/dsoprea/go-utility v0.0.0-20200322154813-27f0b0d142d7/go.mod h1:xv8CVgDmI/Shx/X+EUXyXELVnH5lSRUYRija52OHq7E= -github.com/dsoprea/go-utility v0.0.0-20200512094054-1abbbc781176 h1:CfXezFYb2STGOd1+n1HshvE191zVx+QX3A1nML5xxME= -github.com/dsoprea/go-utility v0.0.0-20200512094054-1abbbc781176/go.mod h1:95+K3z2L0mqsVYd6yveIv1lmtT3tcQQ3dVakPySffW8= -github.com/dsoprea/go-utility v0.0.0-20200711062821-fab8125e9bdf h1:/w4QxepU4AHh3AuO6/g8y/YIIHH5+aKP3Bj8sg5cqhU= -github.com/dsoprea/go-utility v0.0.0-20200711062821-fab8125e9bdf/go.mod h1:95+K3z2L0mqsVYd6yveIv1lmtT3tcQQ3dVakPySffW8= -github.com/dsoprea/go-utility/v2 v2.0.0-20200717064901-2fccff4aa15e h1:IxIbA7VbCNrwumIYjDoMOdf4KOSkMC6NJE4s8oRbE7E= -github.com/dsoprea/go-utility/v2 v2.0.0-20200717064901-2fccff4aa15e/go.mod h1:uAzdkPTub5Y9yQwXe8W4m2XuP0tK4a9Q/dantD0+uaU= -github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w= -github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= -github.com/go-errors/errors v1.0.2 h1:xMxH9j2fNg/L4hLn/4y3M0IUsn0M6Wbu/Uh9QlOfBh4= -github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= -github.com/go-errors/errors v1.1.1 h1:ljK/pL5ltg3qoN+OtN6yCv9HWSfMwxSx90GJCZQxYNg= -github.com/go-errors/errors v1.1.1/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= -github.com/golang/geo v0.0.0-20190916061304-5b978397cfec h1:lJwO/92dFXWeXOZdoGXgptLmNLwynMSHUmU6besqtiw= -github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= -github.com/golang/geo v0.0.0-20200319012246-673a6f80352d h1:C/hKUcHT483btRbeGkrRjJz+Zbcj8audldIi9tRJDCc= -github.com/golang/geo v0.0.0-20200319012246-673a6f80352d/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553 h1:efeOvDhwQ29Dj3SdAV/MJf8oukgn+8D8WgaCaRMchF8= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200320220750-118fecf932d8/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5 h1:WQ8q63x+f/zpC8Ac1s9wLElVoHhm32p6tudrU72n1QA= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120 h1:EZ3cVSzKOlJxAd8e8YAJ7no8nNypTxexh/YE/xW3ZEY= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 h1:eDrdRpKgkcCqKZQwyZRyeFZgfqt37SL7Kv3tok06cKE= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/gin-contrib/cors/go.mod b/vendor/github.com/gin-contrib/cors/go.mod @@ -1,10 +0,0 @@ -module github.com/gin-contrib/cors - -go 1.13 - -require ( - github.com/gin-gonic/gin v1.5.0 - github.com/kr/pretty v0.1.0 // indirect - github.com/stretchr/testify v1.4.0 - gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect -) diff --git a/vendor/github.com/gin-contrib/cors/go.sum b/vendor/github.com/gin-contrib/cors/go.sum @@ -1,52 +0,0 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.5.0 h1:fi+bqFAx/oLK54somfCtEZs9HeH1LHVoEPUgARpTqyc= -github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= -github.com/go-playground/locales v0.12.1 h1:2FITxuFt/xuCNP1Acdhv62OzaCiviiE4kotfhkmOqEc= -github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= -github.com/go-playground/universal-translator v0.16.0 h1:X++omBR/4cE2MNg91AoC3rmGrCjJ8eAeUP/K/EKx4DM= -github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/leodido/go-urn v1.1.0 h1:Sm1gr51B1kKyfD2BlRcLSiEkffoG96g6TPv6eRoEiB8= -github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= -github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v9 v9.29.1 h1:SvGtYmN60a5CVKTOzMSyfzWDeZRxRuGvRQyEAKbw1xc= -gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/gin-contrib/sessions/go.mod b/vendor/github.com/gin-contrib/sessions/go.mod @@ -1,17 +0,0 @@ -module github.com/gin-contrib/sessions - -go 1.12 - -require ( - github.com/boj/redistore v0.0.0-20180917114910-cd5dcc76aeff - github.com/bradfitz/gomemcache v0.0.0-20190329173943-551aad21a668 - github.com/bradleypeabody/gorilla-sessions-memcache v0.0.0-20181103040241-659414f458e1 - github.com/gin-gonic/gin v1.5.0 - github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 - github.com/gomodule/redigo v2.0.0+incompatible - github.com/gorilla/context v1.1.1 - github.com/gorilla/sessions v1.1.3 - github.com/kidstuff/mongostore v0.0.0-20181113001930-e650cd85ee4b - github.com/memcachier/mc v2.0.1+incompatible - github.com/quasoft/memstore v0.0.0-20180925164028-84a050167438 -) diff --git a/vendor/github.com/gin-contrib/sessions/go.sum b/vendor/github.com/gin-contrib/sessions/go.sum @@ -1,69 +0,0 @@ -github.com/boj/redistore v0.0.0-20180917114910-cd5dcc76aeff h1:RmdPFa+slIr4SCBg4st/l/vZWVe9QJKMXGO60Bxbe04= -github.com/boj/redistore v0.0.0-20180917114910-cd5dcc76aeff/go.mod h1:+RTT1BOk5P97fT2CiHkbFQwkK3mjsFAP6zCYV2aXtjw= -github.com/bradfitz/gomemcache v0.0.0-20190329173943-551aad21a668 h1:U/lr3Dgy4WK+hNk4tyD+nuGjpVLPEHuJSFXMw11/HPA= -github.com/bradfitz/gomemcache v0.0.0-20190329173943-551aad21a668/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= -github.com/bradleypeabody/gorilla-sessions-memcache v0.0.0-20181103040241-659414f458e1 h1:4QHxgr7hM4gVD8uOwrk8T1fjkKRLwaLjmTkU0ibhZKU= -github.com/bradleypeabody/gorilla-sessions-memcache v0.0.0-20181103040241-659414f458e1/go.mod h1:dkChI7Tbtx7H1Tj7TqGSZMOeGpMP5gLHtjroHd4agiI= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.5.0 h1:fi+bqFAx/oLK54somfCtEZs9HeH1LHVoEPUgARpTqyc= -github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmCsR2Do= -github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 h1:DujepqpGd1hyOd7aW59XpK7Qymp8iy83xq74fLr21is= -github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= -github.com/go-playground/locales v0.12.1 h1:2FITxuFt/xuCNP1Acdhv62OzaCiviiE4kotfhkmOqEc= -github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= -github.com/go-playground/universal-translator v0.16.0 h1:X++omBR/4cE2MNg91AoC3rmGrCjJ8eAeUP/K/EKx4DM= -github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0= -github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8= -github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= -github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= -github.com/gorilla/sessions v1.1.1/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= -github.com/gorilla/sessions v1.1.3 h1:uXoZdcdA5XdXF3QzuSlheVRUvjl+1rKY7zBXL68L9RU= -github.com/gorilla/sessions v1.1.3/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= -github.com/json-iterator/go v1.1.7 h1:KfgG9LzI+pYjr4xvmz/5H4FXjokeP+rlHLhv3iH62Fo= -github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/kidstuff/mongostore v0.0.0-20181113001930-e650cd85ee4b h1:TLCm7HR+P9HM2NXaAJaIiHerOUMedtFJeAfaYwZ8YhY= -github.com/kidstuff/mongostore v0.0.0-20181113001930-e650cd85ee4b/go.mod h1:g2nVr8KZVXJSS97Jo8pJ0jgq29P6H7dG0oplUA86MQw= -github.com/leodido/go-urn v1.1.0 h1:Sm1gr51B1kKyfD2BlRcLSiEkffoG96g6TPv6eRoEiB8= -github.com/leodido/go-urn v1.1.0/go.mod h1:+cyI34gQWZcE1eQU7NVgKkkzdXDQHr1dBMtdAPozLkw= -github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/memcachier/mc v2.0.1+incompatible h1:s8EDz0xrJLP8goitwZOoq1vA/sm0fPS4X3KAF0nyhWQ= -github.com/memcachier/mc v2.0.1+incompatible/go.mod h1:7bkvFE61leUBvXz+yxsOnGBQSZpBSPIMUQSmmSHvuXc= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/quasoft/memstore v0.0.0-20180925164028-84a050167438 h1:jnz/4VenymvySjE+Ez511s0pqVzkUOmr1fwCVytNNWk= -github.com/quasoft/memstore v0.0.0-20180925164028-84a050167438/go.mod h1:wTPjTepVu7uJBYgZ0SdWHQlIas582j6cn2jgk4DDdlg= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= -gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= -gopkg.in/go-playground/validator.v9 v9.29.1 h1:SvGtYmN60a5CVKTOzMSyfzWDeZRxRuGvRQyEAKbw1xc= -gopkg.in/go-playground/validator.v9 v9.29.1/go.mod h1:+c9/zcJMFNgbLvly1L1V+PpxWdVbfP1avr/N00E2vyQ= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/gin-contrib/sse/go.mod b/vendor/github.com/gin-contrib/sse/go.mod @@ -1,5 +0,0 @@ -module github.com/gin-contrib/sse - -go 1.12 - -require github.com/stretchr/testify v1.3.0 diff --git a/vendor/github.com/gin-contrib/sse/go.sum b/vendor/github.com/gin-contrib/sse/go.sum @@ -1,7 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/vendor/github.com/gin-gonic/gin/.golangci.yml b/vendor/github.com/gin-gonic/gin/.golangci.yml @@ -0,0 +1,22 @@ +run: + timeout: 5m +linters: + enable: + - gofmt + - misspell + - revive +issues: + exclude-rules: + - linters: + - structcheck + - unused + text: "`data` is unused" + - linters: + - staticcheck + text: "SA1019:" + - linters: + - revive + text: "var-naming:" + - linters: + - revive + text: "exported:" diff --git a/vendor/github.com/gin-gonic/gin/CHANGELOG.md b/vendor/github.com/gin-gonic/gin/CHANGELOG.md @@ -1,5 +1,11 @@ # Gin ChangeLog +## Gin v1.7.3 + +### BUGFIXES + +* fix level 1 router match [#2767](https://github.com/gin-gonic/gin/issues/2767), [#2796](https://github.com/gin-gonic/gin/issues/2796) + ## Gin v1.7.2 ### BUGFIXES diff --git a/vendor/github.com/gin-gonic/gin/README.md b/vendor/github.com/gin-gonic/gin/README.md @@ -256,14 +256,15 @@ func main() { // For each matched request Context will hold the route definition router.POST("/user/:name/*action", func(c *gin.Context) { - c.FullPath() == "/user/:name/*action" // true + b := c.FullPath() == "/user/:name/*action" // true + c.String(http.StatusOK, "%t", b) }) // This handler will add a new router for /user/groups. // Exact routes are resolved before param routes, regardless of the order they were defined. // Routes starting with /user/groups are never interpreted as /user/:name/... routes router.GET("/user/groups", func(c *gin.Context) { - c.String(http.StatusOK, "The available groups are [...]", name) + c.String(http.StatusOK, "The available groups are [...]") }) router.Run(":8080") diff --git a/vendor/github.com/gin-gonic/gin/binding/form_mapping.go b/vendor/github.com/gin-gonic/gin/binding/form_mapping.go @@ -26,7 +26,7 @@ var ( ErrConvertToMapString = errors.New("can not convert to map of strings") ) -func mapUri(ptr interface{}, m map[string][]string) error { +func mapURI(ptr interface{}, m map[string][]string) error { return mapFormByTag(ptr, m, "uri") } @@ -83,7 +83,7 @@ func mapping(value reflect.Value, field reflect.StructField, setter setter, tag return false, nil } - var vKind = value.Kind() + vKind := value.Kind() if vKind == reflect.Ptr { var isNew bool @@ -210,7 +210,7 @@ func setWithProperType(val string, value reflect.Value, field reflect.StructFiel case reflect.Int64: switch value.Interface().(type) { case time.Duration: - return setTimeDuration(val, value, field) + return setTimeDuration(val, value) } return setIntField(val, 64, value) case reflect.Uint: @@ -310,7 +310,6 @@ func setTimeField(val string, structField reflect.StructField, value reflect.Val t := time.Unix(tv/int64(d), tv%int64(d)) value.Set(reflect.ValueOf(t)) return nil - } if val == "" { @@ -360,7 +359,7 @@ func setSlice(vals []string, value reflect.Value, field reflect.StructField) err return nil } -func setTimeDuration(val string, value reflect.Value, field reflect.StructField) error { +func setTimeDuration(val string, value reflect.Value) error { d, err := time.ParseDuration(val) if err != nil { return err diff --git a/vendor/github.com/gin-gonic/gin/binding/protobuf.go b/vendor/github.com/gin-gonic/gin/binding/protobuf.go @@ -5,10 +5,11 @@ package binding import ( + "errors" "io/ioutil" "net/http" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" ) type protobufBinding struct{} @@ -26,7 +27,11 @@ func (b protobufBinding) Bind(req *http.Request, obj interface{}) error { } func (protobufBinding) BindBody(body []byte, obj interface{}) error { - if err := proto.Unmarshal(body, obj.(proto.Message)); err != nil { + msg, ok := obj.(proto.Message) + if !ok { + return errors.New("obj is not ProtoMessage") + } + if err := proto.Unmarshal(body, msg); err != nil { return err } // Here it's same to return validate(obj), but util now we can't add diff --git a/vendor/github.com/gin-gonic/gin/binding/uri.go b/vendor/github.com/gin-gonic/gin/binding/uri.go @@ -11,7 +11,7 @@ func (uriBinding) Name() string { } func (uriBinding) BindUri(m map[string][]string, obj interface{}) error { - if err := mapUri(obj, m); err != nil { + if err := mapURI(obj, m); err != nil { return err } return validate(obj) diff --git a/vendor/github.com/gin-gonic/gin/context.go b/vendor/github.com/gin-gonic/gin/context.go @@ -383,6 +383,15 @@ func (c *Context) Param(key string) string { return c.Params.ByName(key) } +// AddParam adds param to context and +// replaces path param key with given value for e2e testing purposes +// Example Route: "/user/:id" +// AddParam("id", 1) +// Result: "/user/1" +func (c *Context) AddParam(key, value string) { + c.Params = append(c.Params, Param{Key: key, Value: value}) +} + // Query returns the keyed url query value if it exists, // otherwise it returns an empty string `("")`. // It is shortcut for `c.Request.URL.Query().Get(key)` @@ -391,9 +400,9 @@ func (c *Context) Param(key string) string { // c.Query("name") == "Manu" // c.Query("value") == "" // c.Query("wtf") == "" -func (c *Context) Query(key string) string { - value, _ := c.GetQuery(key) - return value +func (c *Context) Query(key string) (value string) { + value, _ = c.GetQuery(key) + return } // DefaultQuery returns the keyed url query value if it exists, @@ -427,9 +436,9 @@ func (c *Context) GetQuery(key string) (string, bool) { // QueryArray returns a slice of strings for a given query key. // The length of the slice depends on the number of params with the given key. -func (c *Context) QueryArray(key string) []string { - values, _ := c.GetQueryArray(key) - return values +func (c *Context) QueryArray(key string) (values []string) { + values, _ = c.GetQueryArray(key) + return } func (c *Context) initQueryCache() { @@ -444,18 +453,16 @@ func (c *Context) initQueryCache() { // GetQueryArray returns a slice of strings for a given query key, plus // a boolean value whether at least one value exists for the given key. -func (c *Context) GetQueryArray(key string) ([]string, bool) { +func (c *Context) GetQueryArray(key string) (values []string, ok bool) { c.initQueryCache() - if values, ok := c.queryCache[key]; ok && len(values) > 0 { - return values, true - } - return []string{}, false + values, ok = c.queryCache[key] + return } // QueryMap returns a map for a given query key. -func (c *Context) QueryMap(key string) map[string]string { - dicts, _ := c.GetQueryMap(key) - return dicts +func (c *Context) QueryMap(key string) (dicts map[string]string) { + dicts, _ = c.GetQueryMap(key) + return } // GetQueryMap returns a map for a given query key, plus a boolean value @@ -467,9 +474,9 @@ func (c *Context) GetQueryMap(key string) (map[string]string, bool) { // PostForm returns the specified key from a POST urlencoded form or multipart form // when it exists, otherwise it returns an empty string `("")`. -func (c *Context) PostForm(key string) string { - value, _ := c.GetPostForm(key) - return value +func (c *Context) PostForm(key string) (value string) { + value, _ = c.GetPostForm(key) + return } // DefaultPostForm returns the specified key from a POST urlencoded form or multipart form @@ -498,9 +505,9 @@ func (c *Context) GetPostForm(key string) (string, bool) { // PostFormArray returns a slice of strings for a given form key. // The length of the slice depends on the number of params with the given key. -func (c *Context) PostFormArray(key string) []string { - values, _ := c.GetPostFormArray(key) - return values +func (c *Context) PostFormArray(key string) (values []string) { + values, _ = c.GetPostFormArray(key) + return } func (c *Context) initFormCache() { @@ -518,18 +525,16 @@ func (c *Context) initFormCache() { // GetPostFormArray returns a slice of strings for a given form key, plus // a boolean value whether at least one value exists for the given key. -func (c *Context) GetPostFormArray(key string) ([]string, bool) { +func (c *Context) GetPostFormArray(key string) (values []string, ok bool) { c.initFormCache() - if values := c.formCache[key]; len(values) > 0 { - return values, true - } - return []string{}, false + values, ok = c.formCache[key] + return } // PostFormMap returns a map for a given form key. -func (c *Context) PostFormMap(key string) map[string]string { - dicts, _ := c.GetPostFormMap(key) - return dicts +func (c *Context) PostFormMap(key string) (dicts map[string]string) { + dicts, _ = c.GetPostFormMap(key) + return } // GetPostFormMap returns a map for a given form key, plus a boolean value @@ -1161,22 +1166,28 @@ func (c *Context) SetAccepted(formats ...string) { /***** GOLANG.ORG/X/NET/CONTEXT *****/ /************************************/ -// Deadline always returns that there is no deadline (ok==false), -// maybe you want to use Request.Context().Deadline() instead. +// Deadline returns that there is no deadline (ok==false) when c.Request has no Context. func (c *Context) Deadline() (deadline time.Time, ok bool) { - return + if c.Request == nil || c.Request.Context() == nil { + return + } + return c.Request.Context().Deadline() } -// Done always returns nil (chan which will wait forever), -// if you want to abort your work when the connection was closed -// you should use Request.Context().Done() instead. +// Done returns nil (chan which will wait forever) when c.Request has no Context. func (c *Context) Done() <-chan struct{} { - return nil + if c.Request == nil || c.Request.Context() == nil { + return nil + } + return c.Request.Context().Done() } -// Err always returns nil, maybe you want to use Request.Context().Err() instead. +// Err returns nil when c.Request has no Context. func (c *Context) Err() error { - return nil + if c.Request == nil || c.Request.Context() == nil { + return nil + } + return c.Request.Context().Err() } // Value returns the value associated with this context for key, or nil diff --git a/vendor/github.com/gin-gonic/gin/go.mod b/vendor/github.com/gin-gonic/gin/go.mod @@ -1,15 +0,0 @@ -module github.com/gin-gonic/gin - -go 1.13 - -require ( - github.com/gin-contrib/sse v0.1.0 - github.com/go-playground/validator/v10 v10.6.1 - github.com/goccy/go-json v0.5.1 - github.com/golang/protobuf v1.3.3 - github.com/json-iterator/go v1.1.9 - github.com/mattn/go-isatty v0.0.12 - github.com/stretchr/testify v1.4.0 - github.com/ugorji/go/codec v1.2.6 - gopkg.in/yaml.v2 v2.2.8 -) diff --git a/vendor/github.com/gin-gonic/gin/go.sum b/vendor/github.com/gin-gonic/gin/go.sum @@ -1,55 +0,0 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/validator/v10 v10.6.1 h1:W6TRDXt4WcWp4c4nf/G+6BkGdhiIo0k417gfr+V6u4I= -github.com/go-playground/validator/v10 v10.6.1/go.mod h1:xm76BBt941f7yWdGnI2DVPFFg1UK3YY04qifoXU3lOk= -github.com/goccy/go-json v0.5.1 h1:R9UYTOUvo7eIY9aeDMZ4L6OVtHaSr1k2No9W6MKjXrA= -github.com/goccy/go-json v0.5.1/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= -github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/ugorji/go v1.2.6 h1:tGiWC9HENWE2tqYycIqFTNorMmFRVhNwCpDOpWqnk8E= -github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn0= -github.com/ugorji/go/codec v1.2.6 h1:7kbGefxLoDBuYXOms4yD7223OpNMMPNPZxXk5TvFcyQ= -github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/gin-gonic/gin/mode.go b/vendor/github.com/gin-gonic/gin/mode.go @@ -41,8 +41,10 @@ var DefaultWriter io.Writer = os.Stdout // DefaultErrorWriter is the default io.Writer used by Gin to debug errors var DefaultErrorWriter io.Writer = os.Stderr -var ginMode = debugCode -var modeName = DebugMode +var ( + ginMode = debugCode + modeName = DebugMode +) func init() { mode := os.Getenv(EnvGinMode) diff --git a/vendor/github.com/gin-gonic/gin/render/json.go b/vendor/github.com/gin-gonic/gin/render/json.go @@ -49,7 +49,7 @@ type PureJSON struct { var ( jsonContentType = []string{"application/json; charset=utf-8"} jsonpContentType = []string{"application/javascript; charset=utf-8"} - jsonAsciiContentType = []string{"application/json"} + jsonASCIIContentType = []string{"application/json"} ) // Render (JSON) writes data with custom ContentType. @@ -102,8 +102,7 @@ func (r SecureJSON) Render(w http.ResponseWriter) error { // if the jsonBytes is array values if bytes.HasPrefix(jsonBytes, bytesconv.StringToBytes("[")) && bytes.HasSuffix(jsonBytes, bytesconv.StringToBytes("]")) { - _, err = w.Write(bytesconv.StringToBytes(r.Prefix)) - if err != nil { + if _, err = w.Write(bytesconv.StringToBytes(r.Prefix)); err != nil { return err } } @@ -130,20 +129,19 @@ func (r JsonpJSON) Render(w http.ResponseWriter) (err error) { } callback := template.JSEscapeString(r.Callback) - _, err = w.Write(bytesconv.StringToBytes(callback)) - if err != nil { + if _, err = w.Write(bytesconv.StringToBytes(callback)); err != nil { return err } - _, err = w.Write(bytesconv.StringToBytes("(")) - if err != nil { + + if _, err = w.Write(bytesconv.StringToBytes("(")); err != nil { return err } - _, err = w.Write(ret) - if err != nil { + + if _, err = w.Write(ret); err != nil { return err } - _, err = w.Write(bytesconv.StringToBytes(");")) - if err != nil { + + if _, err = w.Write(bytesconv.StringToBytes(");")); err != nil { return err } @@ -178,7 +176,7 @@ func (r AsciiJSON) Render(w http.ResponseWriter) (err error) { // WriteContentType (AsciiJSON) writes JSON ContentType. func (r AsciiJSON) WriteContentType(w http.ResponseWriter) { - writeContentType(w, jsonAsciiContentType) + writeContentType(w, jsonASCIIContentType) } // Render (PureJSON) writes custom ContentType and encodes the given interface object. diff --git a/vendor/github.com/gin-gonic/gin/render/protobuf.go b/vendor/github.com/gin-gonic/gin/render/protobuf.go @@ -7,7 +7,7 @@ package render import ( "net/http" - "github.com/golang/protobuf/proto" + "google.golang.org/protobuf/proto" ) // ProtoBuf contains the given interface object. diff --git a/vendor/github.com/gin-gonic/gin/tree.go b/vendor/github.com/gin-gonic/gin/tree.go @@ -101,8 +101,7 @@ func countParams(path string) uint16 { type nodeType uint8 const ( - static nodeType = iota // default - root + root nodeType = iota + 1 param catchAll ) @@ -400,23 +399,10 @@ type nodeValue struct { // made if a handle exists with an extra (without the) trailing slash for the // given path. func (n *node) getValue(path string, params *Params, unescape bool) (value nodeValue) { - // path: /abc/123/def - // level 1 router:abc - // level 2 router:123 - // level 3 router:def var ( skippedPath string - latestNode = n // not found `level 2 router` use latestNode - - // match '/' count - // matchNum < 1: `level 2 router` not found,the current node needs to be equal to latestNode - // matchNum >= 1: `level (2 or 3 or 4 or ...) router`: Normal handling - matchNum int // each match will accumulate + latestNode = n // Caching the latest node ) - //if path == "/", no need to look for tree node - if len(path) == 1 { - matchNum = 1 - } walk: // Outer loop for walking the tree for { @@ -444,17 +430,13 @@ walk: // Outer loop for walking the tree } n = n.children[i] - - // match '/', If this condition is matched, the next route is found - if (len(n.fullPath) != 0 && n.wildChild) || path[len(path)-1] == '/' { - matchNum++ - } continue walk } } - - // level 2 router not found,the current node needs to be equal to latestNode - if matchNum < 1 { + // If the path at the end of the loop is not equal to '/' and the current node has no child nodes + // the current node needs to be equal to the latest matching node + matched := path != "/" && !n.wildChild + if matched { n = latestNode } @@ -472,6 +454,16 @@ walk: // Outer loop for walking the tree switch n.nType { case param: + // fix truncate the parameter + // tree_test.go line: 204 + if matched { + path = prefix + path + // The saved path is used after the prefix route is intercepted by matching + if n.indices == "/" { + path = skippedPath[1:] + } + } + // Find param end (either '/' or path end) end := 0 for end < len(path) && path[end] != '/' { @@ -503,18 +495,6 @@ walk: // Outer loop for walking the tree if len(n.children) > 0 { path = path[end:] n = n.children[0] - // next node,the latestNode needs to be equal to currentNode and handle next router - latestNode = n - // not found router in (level 1 router and handle next node),skippedPath cannot execute - // example: - // * /:cc/cc - // call /a/cc expectations:match/200 Actual:match/200 - // call /a/dd expectations:unmatch/404 Actual: panic - // call /addr/dd/aa expectations:unmatch/404 Actual: panic - // skippedPath: It can only be executed if the secondary route is not found - // matchNum: Go to the next level of routing tree node search,need add matchNum - skippedPath = "" - matchNum++ continue walk } @@ -567,8 +547,9 @@ walk: // Outer loop for walking the tree } if path == prefix { - // level 2 router not found and latestNode.wildChild is true - if matchNum < 1 && latestNode.wildChild { + // If the current path does not equal '/' and the node does not have a registered handle and the most recently matched node has a child node + // the current node needs to be equal to the latest matching node + if latestNode.wildChild && n.handlers == nil && path != "/" { n = latestNode.children[len(latestNode.children)-1] } // We should have reached the node containing the handle. @@ -600,10 +581,17 @@ walk: // Outer loop for walking the tree return } - // path != "/" && skippedPath != "" - if len(path) != 1 && len(skippedPath) > 0 && strings.HasSuffix(skippedPath, path) { + if path != "/" && len(skippedPath) > 0 && strings.HasSuffix(skippedPath, path) { path = skippedPath - n = latestNode + // Reduce the number of cycles + n, latestNode = latestNode, n + // skippedPath cannot execute + // example: + // * /:cc/cc + // call /a/cc expectations:match/200 Actual:match/200 + // call /a/dd expectations:unmatch/404 Actual: panic + // call /addr/dd/aa expectations:unmatch/404 Actual: panic + // skippedPath: It can only be executed if the secondary route is not found skippedPath = "" continue walk } diff --git a/vendor/github.com/gin-gonic/gin/version.go b/vendor/github.com/gin-gonic/gin/version.go @@ -5,4 +5,4 @@ package gin // Version is the current gin framework's version. -const Version = "v1.7.2" +const Version = "v1.7.3" diff --git a/vendor/github.com/go-errors/errors/go.mod b/vendor/github.com/go-errors/errors/go.mod @@ -1,6 +0,0 @@ -module github.com/go-errors/errors - -go 1.14 - -// Was not API-compatible with earlier or later releases. -retract v1.3.0 diff --git a/vendor/github.com/go-fed/httpsig/go.mod b/vendor/github.com/go-fed/httpsig/go.mod @@ -1,5 +0,0 @@ -module github.com/go-fed/httpsig - -require golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 - -go 1.13 diff --git a/vendor/github.com/go-fed/httpsig/go.sum b/vendor/github.com/go-fed/httpsig/go.sum @@ -1,8 +0,0 @@ -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/vendor/github.com/go-playground/locales/README.md b/vendor/github.com/go-playground/locales/README.md @@ -1,5 +1,5 @@ ## locales -<img align="right" src="https://raw.githubusercontent.com/go-playground/locales/master/logo.png">![Project status](https://img.shields.io/badge/version-0.13.0-green.svg) +<img align="right" src="https://raw.githubusercontent.com/go-playground/locales/master/logo.png">![Project status](https://img.shields.io/badge/version-0.14.0-green.svg) [![Build Status](https://travis-ci.org/go-playground/locales.svg?branch=master)](https://travis-ci.org/go-playground/locales) [![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/locales)](https://goreportcard.com/report/github.com/go-playground/locales) [![GoDoc](https://godoc.org/github.com/go-playground/locales?status.svg)](https://godoc.org/github.com/go-playground/locales) @@ -11,7 +11,7 @@ an i18n package; these were built for use with, but not exclusive to, [Universal Features -------- -- [x] Rules generated from the latest [CLDR](http://cldr.unicode.org/index/downloads) data, v31.0.1 +- [x] Rules generated from the latest [CLDR](http://cldr.unicode.org/index/downloads) data, v36.0.1 - [x] Contains Cardinal, Ordinal and Range Plural Rules - [x] Contains Month, Weekday and Timezone translations built in - [x] Contains Date & Time formatting functions diff --git a/vendor/github.com/go-playground/locales/currency/currency.go b/vendor/github.com/go-playground/locales/currency/currency.go @@ -176,6 +176,7 @@ const ( MNT MOP MRO + MRU MTL MTP MUR @@ -262,9 +263,11 @@ const ( UYI UYP UYU + UYW UZS VEB VEF + VES VND VNN VUV diff --git a/vendor/github.com/go-playground/locales/go.mod b/vendor/github.com/go-playground/locales/go.mod @@ -1,5 +0,0 @@ -module github.com/go-playground/locales - -go 1.13 - -require golang.org/x/text v0.3.2 diff --git a/vendor/github.com/go-playground/locales/go.sum b/vendor/github.com/go-playground/locales/go.sum @@ -1,3 +0,0 @@ -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/vendor/github.com/go-playground/universal-translator/Makefile b/vendor/github.com/go-playground/universal-translator/Makefile @@ -0,0 +1,18 @@ +GOCMD=GO111MODULE=on go + +linters-install: + @golangci-lint --version >/dev/null 2>&1 || { \ + echo "installing linting tools..."; \ + curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.41.1; \ + } + +lint: linters-install + golangci-lint run + +test: + $(GOCMD) test -cover -race ./... + +bench: + $(GOCMD) test -bench=. -benchmem ./... + +.PHONY: test lint linters-install +\ No newline at end of file diff --git a/vendor/github.com/go-playground/universal-translator/README.md b/vendor/github.com/go-playground/universal-translator/README.md @@ -1,5 +1,5 @@ ## universal-translator -<img align="right" src="https://raw.githubusercontent.com/go-playground/universal-translator/master/logo.png">![Project status](https://img.shields.io/badge/version-0.17.0-green.svg) +<img align="right" src="https://raw.githubusercontent.com/go-playground/universal-translator/master/logo.png">![Project status](https://img.shields.io/badge/version-0.18.0-green.svg) [![Build Status](https://travis-ci.org/go-playground/universal-translator.svg?branch=master)](https://travis-ci.org/go-playground/universal-translator) [![Coverage Status](https://coveralls.io/repos/github/go-playground/universal-translator/badge.svg)](https://coveralls.io/github/go-playground/universal-translator) [![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/universal-translator)](https://goreportcard.com/report/github.com/go-playground/universal-translator) @@ -18,7 +18,7 @@ use in your applications. Features -------- -- [x] Rules generated from the [CLDR](http://cldr.unicode.org/index/downloads) data, v30.0.3 +- [x] Rules generated from the [CLDR](http://cldr.unicode.org/index/downloads) data, v36.0.1 - [x] Contains Cardinal, Ordinal and Range Plural Rules - [x] Contains Month, Weekday and Timezone translations built in - [x] Contains Date & Time formatting functions @@ -51,7 +51,7 @@ Please see https://godoc.org/github.com/go-playground/universal-translator for u File formatting -------------- -All types, Plain substitution, Cardinal, Ordinal and Range translations can all be contained withing the same file(s); +All types, Plain substitution, Cardinal, Ordinal and Range translations can all be contained within the same file(s); they are only separated for easy viewing. ##### Examples: diff --git a/vendor/github.com/go-playground/universal-translator/go.mod b/vendor/github.com/go-playground/universal-translator/go.mod @@ -1,5 +0,0 @@ -module github.com/go-playground/universal-translator - -go 1.13 - -require github.com/go-playground/locales v0.13.0 diff --git a/vendor/github.com/go-playground/universal-translator/go.sum b/vendor/github.com/go-playground/universal-translator/go.sum @@ -1,4 +0,0 @@ -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/vendor/github.com/go-playground/universal-translator/import_export.go b/vendor/github.com/go-playground/universal-translator/import_export.go @@ -257,6 +257,8 @@ func (t *UniversalTranslator) ImportByReader(format ImportExportFormat, reader i func stringToPR(s string) locales.PluralRule { switch s { + case "Zero": + return locales.PluralRuleZero case "One": return locales.PluralRuleOne case "Two": diff --git a/vendor/github.com/go-playground/universal-translator/translator.go b/vendor/github.com/go-playground/universal-translator/translator.go @@ -159,13 +159,13 @@ func (t *translator) AddCardinal(key interface{}, text string, rule locales.Plur } } else { - tarr = make([]*transText, 7, 7) + tarr = make([]*transText, 7) t.cardinalTanslations[key] = tarr } trans := &transText{ text: text, - indexes: make([]int, 2, 2), + indexes: make([]int, 2), } tarr[rule] = trans @@ -211,13 +211,13 @@ func (t *translator) AddOrdinal(key interface{}, text string, rule locales.Plura } } else { - tarr = make([]*transText, 7, 7) + tarr = make([]*transText, 7) t.ordinalTanslations[key] = tarr } trans := &transText{ text: text, - indexes: make([]int, 2, 2), + indexes: make([]int, 2), } tarr[rule] = trans @@ -261,13 +261,13 @@ func (t *translator) AddRange(key interface{}, text string, rule locales.PluralR } } else { - tarr = make([]*transText, 7, 7) + tarr = make([]*transText, 7) t.rangeTanslations[key] = tarr } trans := &transText{ text: text, - indexes: make([]int, 4, 4), + indexes: make([]int, 4), } tarr[rule] = trans diff --git a/vendor/github.com/go-playground/validator/v10/Makefile b/vendor/github.com/go-playground/validator/v10/Makefile @@ -3,7 +3,7 @@ GOCMD=GO111MODULE=on go linters-install: @golangci-lint --version >/dev/null 2>&1 || { \ echo "installing linting tools..."; \ - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.39.0; \ + curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s v1.41.1; \ } lint: linters-install diff --git a/vendor/github.com/go-playground/validator/v10/README.md b/vendor/github.com/go-playground/validator/v10/README.md @@ -1,7 +1,7 @@ Package validator ================= <img align="right" src="https://raw.githubusercontent.com/go-playground/validator/v9/logo.png">[![Join the chat at https://gitter.im/go-playground/validator](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -![Project status](https://img.shields.io/badge/version-10.7.0-green.svg) +![Project status](https://img.shields.io/badge/version-10.9.0-green.svg) [![Build Status](https://travis-ci.org/go-playground/validator.svg?branch=master)](https://travis-ci.org/go-playground/validator) [![Coverage Status](https://coveralls.io/repos/go-playground/validator/badge.svg?branch=master&service=github)](https://coveralls.io/github/go-playground/validator?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/go-playground/validator)](https://goreportcard.com/report/github.com/go-playground/validator) @@ -27,11 +27,11 @@ Installation Use go get. - go get github.com/go-playground/validator + go get github.com/go-playground/validator/v10 Then import the validator package into your own code. - import "github.com/go-playground/validator" + import "github.com/go-playground/validator/v10" Error Return Value ------- @@ -100,7 +100,7 @@ Baked-in Validations | hostname_rfc1123 | Hostname RFC 1123 | | ip | Internet Protocol Address IP | | ip4_addr | Internet Protocol Address IPv4 | -| ip6_addr |Internet Protocol Address IPv6 | +| ip6_addr | Internet Protocol Address IPv6 | | ip_addr | Internet Protocol Address IP | | ipv4 | Internet Protocol Address IPv4 | | ipv6 | Internet Protocol Address IPv6 | @@ -126,15 +126,21 @@ Baked-in Validations | alphanumunicode | Alphanumeric Unicode | | alphaunicode | Alpha Unicode | | ascii | ASCII | +| boolean | Boolean | | contains | Contains | | containsany | Contains Any | | containsrune | Contains Rune | +| endsnotwith | Ends With | | endswith | Ends With | +| excludes | Excludes | +| excludesall | Excludes All | +| excludesrune | Excludes Rune | | lowercase | Lowercase | | multibyte | Multi-Byte Characters | | number | NOT DOCUMENTED IN doc.go | | numeric | Numeric | | printascii | Printable ASCII | +| startsnotwith | Starts Not With | | startswith | Starts With | | uppercase | Uppercase | @@ -143,6 +149,8 @@ Baked-in Validations | - | - | | base64 | Base64 String | | base64url | Base64URL String | +| bic | Business Identifier Code (ISO 9362) | +| bcp47_language_tag | Language tag (BCP 47) | | btc_addr | Bitcoin Address | | btc_addr_bech32 | Bitcoin Bech32 Address (segwit) | | datetime | Datetime | @@ -158,12 +166,21 @@ Baked-in Validations | isbn | International Standard Book Number | | isbn10 | International Standard Book Number 10 | | isbn13 | International Standard Book Number 13 | +| iso3166_1_alpha2 | Two-letter country code (ISO 3166-1 alpha-2) | +| iso3166_1_alpha3 | Three-letter country code (ISO 3166-1 alpha-3) | +| iso3166_1_alpha_numeric | Numeric country code (ISO 3166-1 numeric) | +| iso3166_2 | Country subdivision code (ISO 3166-2) | +| iso4217 | Currency code (ISO 4217) | | json | JSON | +| jwt | JSON Web Token (JWT) | | latitude | Latitude | | longitude | Longitude | +| postcode_iso3166_alpha2 | Postcode | +| postcode_iso3166_alpha2_field | Postcode | | rgb | RGB String | | rgba | RGBA String | | ssn | Social Security Number SSN | +| timezone | Timezone | | uuid | Universally Unique Identifier UUID | | uuid3 | Universally Unique Identifier UUID v3 | | uuid3_rfc4122 | Universally Unique Identifier UUID v3 RFC4122 | @@ -178,7 +195,7 @@ Baked-in Validations | - | - | | eq | Equals | | gt | Greater than| -| gte |Greater than or equal | +| gte | Greater than or equal | | lt | Less Than | | lte | Less Than or Equal | | ne | Not Equal | @@ -187,10 +204,6 @@ Baked-in Validations | Tag | Description | | - | - | | dir | Directory | -| endswith | Ends With | -| excludes | Excludes | -| excludesall | Excludes All | -| excludesrune | Excludes Rune | | file | File path | | isdefault | Is Default | | len | Length | @@ -210,6 +223,12 @@ Baked-in Validations | excluded_without_all | Excluded Without All | | unique | Unique | +#### Aliases: +| Tag | Description | +| - | - | +| iscolor | hexcolor\|rgb\|rgba\|hsl\|hsla | +| country_code | iso3166_1_alpha2\|iso3166_1_alpha3\|iso3166_1_alpha_numeric | + Benchmarks ------ ###### Run on MacBook Pro (15-inch, 2017) go version go1.10.2 darwin/amd64 diff --git a/vendor/github.com/go-playground/validator/v10/baked_in.go b/vendor/github.com/go-playground/validator/v10/baked_in.go @@ -56,7 +56,7 @@ var ( isdefault: {}, } - // BakedInAliasValidators is a default mapping of a single validation tag that + // bakedInAliases is a default mapping of a single validation tag that // defines a common or complex set of validation(s) to simplify // adding validation to structs. bakedInAliases = map[string]string{ @@ -64,7 +64,7 @@ var ( "country_code": "iso3166_1_alpha2|iso3166_1_alpha3|iso3166_1_alpha_numeric", } - // BakedInValidators is the default map of ValidationFunc + // bakedInValidators is the default map of ValidationFunc // you can add, remove or even replace items to suite your needs, // or even disregard and use your own map if so desired. bakedInValidators = map[string]Func{ @@ -107,6 +107,7 @@ var ( "alphanum": isAlphanum, "alphaunicode": isAlphaUnicode, "alphanumunicode": isAlphanumUnicode, + "boolean": isBoolean, "numeric": isNumeric, "number": isNumber, "hexadecimal": isHexadecimal, @@ -181,6 +182,7 @@ var ( "url_encoded": isURLEncoded, "dir": isDir, "json": isJSON, + "jwt": isJWT, "hostname_port": isHostnamePort, "lowercase": isLowercase, "uppercase": isUppercase, @@ -189,7 +191,9 @@ var ( "iso3166_1_alpha2": isIso3166Alpha2, "iso3166_1_alpha3": isIso3166Alpha3, "iso3166_1_alpha_numeric": isIso3166AlphaNumeric, - "iso3166_2": isIso31662, + "iso3166_2": isIso31662, + "iso4217": isIso4217, + "iso4217_numeric": isIso4217Numeric, "bcp47_language_tag": isBCP47LanguageTag, "postcode_iso3166_alpha2": isPostcodeByIso3166Alpha2, "postcode_iso3166_alpha2_field": isPostcodeByIso3166Alpha2Field, @@ -302,7 +306,7 @@ func isUnique(fl FieldLevel) bool { } } -// IsMAC is the validation function for validating if the field's value is a valid MAC address. +// isMAC is the validation function for validating if the field's value is a valid MAC address. func isMAC(fl FieldLevel) bool { _, err := net.ParseMAC(fl.Field().String()) @@ -310,7 +314,7 @@ func isMAC(fl FieldLevel) bool { return err == nil } -// IsCIDRv4 is the validation function for validating if the field's value is a valid v4 CIDR address. +// isCIDRv4 is the validation function for validating if the field's value is a valid v4 CIDR address. func isCIDRv4(fl FieldLevel) bool { ip, _, err := net.ParseCIDR(fl.Field().String()) @@ -318,7 +322,7 @@ func isCIDRv4(fl FieldLevel) bool { return err == nil && ip.To4() != nil } -// IsCIDRv6 is the validation function for validating if the field's value is a valid v6 CIDR address. +// isCIDRv6 is the validation function for validating if the field's value is a valid v6 CIDR address. func isCIDRv6(fl FieldLevel) bool { ip, _, err := net.ParseCIDR(fl.Field().String()) @@ -326,7 +330,7 @@ func isCIDRv6(fl FieldLevel) bool { return err == nil && ip.To4() == nil } -// IsCIDR is the validation function for validating if the field's value is a valid v4 or v6 CIDR address. +// isCIDR is the validation function for validating if the field's value is a valid v4 or v6 CIDR address. func isCIDR(fl FieldLevel) bool { _, _, err := net.ParseCIDR(fl.Field().String()) @@ -334,7 +338,7 @@ func isCIDR(fl FieldLevel) bool { return err == nil } -// IsIPv4 is the validation function for validating if a value is a valid v4 IP address. +// isIPv4 is the validation function for validating if a value is a valid v4 IP address. func isIPv4(fl FieldLevel) bool { ip := net.ParseIP(fl.Field().String()) @@ -342,7 +346,7 @@ func isIPv4(fl FieldLevel) bool { return ip != nil && ip.To4() != nil } -// IsIPv6 is the validation function for validating if the field's value is a valid v6 IP address. +// isIPv6 is the validation function for validating if the field's value is a valid v6 IP address. func isIPv6(fl FieldLevel) bool { ip := net.ParseIP(fl.Field().String()) @@ -350,7 +354,7 @@ func isIPv6(fl FieldLevel) bool { return ip != nil && ip.To4() == nil } -// IsIP is the validation function for validating if the field's value is a valid v4 or v6 IP address. +// isIP is the validation function for validating if the field's value is a valid v4 or v6 IP address. func isIP(fl FieldLevel) bool { ip := net.ParseIP(fl.Field().String()) @@ -358,7 +362,7 @@ func isIP(fl FieldLevel) bool { return ip != nil } -// IsSSN is the validation function for validating if the field's value is a valid SSN. +// isSSN is the validation function for validating if the field's value is a valid SSN. func isSSN(fl FieldLevel) bool { field := fl.Field() @@ -370,7 +374,7 @@ func isSSN(fl FieldLevel) bool { return sSNRegex.MatchString(field.String()) } -// IsLongitude is the validation function for validating if the field's value is a valid longitude coordinate. +// isLongitude is the validation function for validating if the field's value is a valid longitude coordinate. func isLongitude(fl FieldLevel) bool { field := fl.Field() @@ -393,7 +397,7 @@ func isLongitude(fl FieldLevel) bool { return longitudeRegex.MatchString(v) } -// IsLatitude is the validation function for validating if the field's value is a valid latitude coordinate. +// isLatitude is the validation function for validating if the field's value is a valid latitude coordinate. func isLatitude(fl FieldLevel) bool { field := fl.Field() @@ -416,7 +420,7 @@ func isLatitude(fl FieldLevel) bool { return latitudeRegex.MatchString(v) } -// IsDataURI is the validation function for validating if the field's value is a valid data URI. +// isDataURI is the validation function for validating if the field's value is a valid data URI. func isDataURI(fl FieldLevel) bool { uri := strings.SplitN(fl.Field().String(), ",", 2) @@ -432,7 +436,7 @@ func isDataURI(fl FieldLevel) bool { return base64Regex.MatchString(uri[1]) } -// HasMultiByteCharacter is the validation function for validating if the field's value has a multi byte character. +// hasMultiByteCharacter is the validation function for validating if the field's value has a multi byte character. func hasMultiByteCharacter(fl FieldLevel) bool { field := fl.Field() @@ -444,62 +448,62 @@ func hasMultiByteCharacter(fl FieldLevel) bool { return multibyteRegex.MatchString(field.String()) } -// IsPrintableASCII is the validation function for validating if the field's value is a valid printable ASCII character. +// isPrintableASCII is the validation function for validating if the field's value is a valid printable ASCII character. func isPrintableASCII(fl FieldLevel) bool { return printableASCIIRegex.MatchString(fl.Field().String()) } -// IsASCII is the validation function for validating if the field's value is a valid ASCII character. +// isASCII is the validation function for validating if the field's value is a valid ASCII character. func isASCII(fl FieldLevel) bool { return aSCIIRegex.MatchString(fl.Field().String()) } -// IsUUID5 is the validation function for validating if the field's value is a valid v5 UUID. +// isUUID5 is the validation function for validating if the field's value is a valid v5 UUID. func isUUID5(fl FieldLevel) bool { return uUID5Regex.MatchString(fl.Field().String()) } -// IsUUID4 is the validation function for validating if the field's value is a valid v4 UUID. +// isUUID4 is the validation function for validating if the field's value is a valid v4 UUID. func isUUID4(fl FieldLevel) bool { return uUID4Regex.MatchString(fl.Field().String()) } -// IsUUID3 is the validation function for validating if the field's value is a valid v3 UUID. +// isUUID3 is the validation function for validating if the field's value is a valid v3 UUID. func isUUID3(fl FieldLevel) bool { return uUID3Regex.MatchString(fl.Field().String()) } -// IsUUID is the validation function for validating if the field's value is a valid UUID of any version. +// isUUID is the validation function for validating if the field's value is a valid UUID of any version. func isUUID(fl FieldLevel) bool { return uUIDRegex.MatchString(fl.Field().String()) } -// IsUUID5RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v5 UUID. +// isUUID5RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v5 UUID. func isUUID5RFC4122(fl FieldLevel) bool { return uUID5RFC4122Regex.MatchString(fl.Field().String()) } -// IsUUID4RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v4 UUID. +// isUUID4RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v4 UUID. func isUUID4RFC4122(fl FieldLevel) bool { return uUID4RFC4122Regex.MatchString(fl.Field().String()) } -// IsUUID3RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v3 UUID. +// isUUID3RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v3 UUID. func isUUID3RFC4122(fl FieldLevel) bool { return uUID3RFC4122Regex.MatchString(fl.Field().String()) } -// IsUUIDRFC4122 is the validation function for validating if the field's value is a valid RFC4122 UUID of any version. +// isUUIDRFC4122 is the validation function for validating if the field's value is a valid RFC4122 UUID of any version. func isUUIDRFC4122(fl FieldLevel) bool { return uUIDRFC4122Regex.MatchString(fl.Field().String()) } -// IsISBN is the validation function for validating if the field's value is a valid v10 or v13 ISBN. +// isISBN is the validation function for validating if the field's value is a valid v10 or v13 ISBN. func isISBN(fl FieldLevel) bool { return isISBN10(fl) || isISBN13(fl) } -// IsISBN13 is the validation function for validating if the field's value is a valid v13 ISBN. +// isISBN13 is the validation function for validating if the field's value is a valid v13 ISBN. func isISBN13(fl FieldLevel) bool { s := strings.Replace(strings.Replace(fl.Field().String(), "-", "", 4), " ", "", 4) @@ -520,7 +524,7 @@ func isISBN13(fl FieldLevel) bool { return (int32(s[12]-'0'))-((10-(checksum%10))%10) == 0 } -// IsISBN10 is the validation function for validating if the field's value is a valid v10 ISBN. +// isISBN10 is the validation function for validating if the field's value is a valid v10 ISBN. func isISBN10(fl FieldLevel) bool { s := strings.Replace(strings.Replace(fl.Field().String(), "-", "", 3), " ", "", 3) @@ -545,7 +549,7 @@ func isISBN10(fl FieldLevel) bool { return checksum%11 == 0 } -// IsEthereumAddress is the validation function for validating if the field's value is a valid Ethereum address. +// isEthereumAddress is the validation function for validating if the field's value is a valid Ethereum address. func isEthereumAddress(fl FieldLevel) bool { address := fl.Field().String() @@ -576,7 +580,7 @@ func isEthereumAddress(fl FieldLevel) bool { return true } -// IsBitcoinAddress is the validation function for validating if the field's value is a valid btc address +// isBitcoinAddress is the validation function for validating if the field's value is a valid btc address func isBitcoinAddress(fl FieldLevel) bool { address := fl.Field().String() @@ -613,7 +617,7 @@ func isBitcoinAddress(fl FieldLevel) bool { return validchecksum == computedchecksum } -// IsBitcoinBech32Address is the validation function for validating if the field's value is a valid bech32 btc address +// isBitcoinBech32Address is the validation function for validating if the field's value is a valid bech32 btc address func isBitcoinBech32Address(fl FieldLevel) bool { address := fl.Field().String() @@ -693,22 +697,22 @@ func isBitcoinBech32Address(fl FieldLevel) bool { return true } -// ExcludesRune is the validation function for validating that the field's value does not contain the rune specified within the param. +// excludesRune is the validation function for validating that the field's value does not contain the rune specified within the param. func excludesRune(fl FieldLevel) bool { return !containsRune(fl) } -// ExcludesAll is the validation function for validating that the field's value does not contain any of the characters specified within the param. +// excludesAll is the validation function for validating that the field's value does not contain any of the characters specified within the param. func excludesAll(fl FieldLevel) bool { return !containsAny(fl) } -// Excludes is the validation function for validating that the field's value does not contain the text specified within the param. +// excludes is the validation function for validating that the field's value does not contain the text specified within the param. func excludes(fl FieldLevel) bool { return !contains(fl) } -// ContainsRune is the validation function for validating that the field's value contains the rune specified within the param. +// containsRune is the validation function for validating that the field's value contains the rune specified within the param. func containsRune(fl FieldLevel) bool { r, _ := utf8.DecodeRuneInString(fl.Param()) @@ -716,37 +720,37 @@ func containsRune(fl FieldLevel) bool { return strings.ContainsRune(fl.Field().String(), r) } -// ContainsAny is the validation function for validating that the field's value contains any of the characters specified within the param. +// containsAny is the validation function for validating that the field's value contains any of the characters specified within the param. func containsAny(fl FieldLevel) bool { return strings.ContainsAny(fl.Field().String(), fl.Param()) } -// Contains is the validation function for validating that the field's value contains the text specified within the param. +// contains is the validation function for validating that the field's value contains the text specified within the param. func contains(fl FieldLevel) bool { return strings.Contains(fl.Field().String(), fl.Param()) } -// StartsWith is the validation function for validating that the field's value starts with the text specified within the param. +// startsWith is the validation function for validating that the field's value starts with the text specified within the param. func startsWith(fl FieldLevel) bool { return strings.HasPrefix(fl.Field().String(), fl.Param()) } -// EndsWith is the validation function for validating that the field's value ends with the text specified within the param. +// endsWith is the validation function for validating that the field's value ends with the text specified within the param. func endsWith(fl FieldLevel) bool { return strings.HasSuffix(fl.Field().String(), fl.Param()) } -// StartsNotWith is the validation function for validating that the field's value does not start with the text specified within the param. +// startsNotWith is the validation function for validating that the field's value does not start with the text specified within the param. func startsNotWith(fl FieldLevel) bool { return !startsWith(fl) } -// EndsNotWith is the validation function for validating that the field's value does not end with the text specified within the param. +// endsNotWith is the validation function for validating that the field's value does not end with the text specified within the param. func endsNotWith(fl FieldLevel) bool { return !endsWith(fl) } -// FieldContains is the validation function for validating if the current field's value contains the field specified by the param's value. +// fieldContains is the validation function for validating if the current field's value contains the field specified by the param's value. func fieldContains(fl FieldLevel) bool { field := fl.Field() @@ -759,7 +763,7 @@ func fieldContains(fl FieldLevel) bool { return strings.Contains(field.String(), currentField.String()) } -// FieldExcludes is the validation function for validating if the current field's value excludes the field specified by the param's value. +// fieldExcludes is the validation function for validating if the current field's value excludes the field specified by the param's value. func fieldExcludes(fl FieldLevel) bool { field := fl.Field() @@ -771,7 +775,7 @@ func fieldExcludes(fl FieldLevel) bool { return !strings.Contains(field.String(), currentField.String()) } -// IsNeField is the validation function for validating if the current field's value is not equal to the field specified by the param's value. +// isNeField is the validation function for validating if the current field's value is not equal to the field specified by the param's value. func isNeField(fl FieldLevel) bool { field := fl.Field() @@ -823,12 +827,12 @@ func isNeField(fl FieldLevel) bool { return field.String() != currentField.String() } -// IsNe is the validation function for validating that the field's value does not equal the provided param value. +// isNe is the validation function for validating that the field's value does not equal the provided param value. func isNe(fl FieldLevel) bool { return !isEq(fl) } -// IsLteCrossStructField is the validation function for validating if the current field's value is less than or equal to the field, within a separate struct, specified by the param's value. +// isLteCrossStructField is the validation function for validating if the current field's value is less than or equal to the field, within a separate struct, specified by the param's value. func isLteCrossStructField(fl FieldLevel) bool { field := fl.Field() @@ -875,7 +879,7 @@ func isLteCrossStructField(fl FieldLevel) bool { return field.String() <= topField.String() } -// IsLtCrossStructField is the validation function for validating if the current field's value is less than the field, within a separate struct, specified by the param's value. +// isLtCrossStructField is the validation function for validating if the current field's value is less than the field, within a separate struct, specified by the param's value. // NOTE: This is exposed for use within your own custom functions and not intended to be called directly. func isLtCrossStructField(fl FieldLevel) bool { @@ -923,7 +927,7 @@ func isLtCrossStructField(fl FieldLevel) bool { return field.String() < topField.String() } -// IsGteCrossStructField is the validation function for validating if the current field's value is greater than or equal to the field, within a separate struct, specified by the param's value. +// isGteCrossStructField is the validation function for validating if the current field's value is greater than or equal to the field, within a separate struct, specified by the param's value. func isGteCrossStructField(fl FieldLevel) bool { field := fl.Field() @@ -970,7 +974,7 @@ func isGteCrossStructField(fl FieldLevel) bool { return field.String() >= topField.String() } -// IsGtCrossStructField is the validation function for validating if the current field's value is greater than the field, within a separate struct, specified by the param's value. +// isGtCrossStructField is the validation function for validating if the current field's value is greater than the field, within a separate struct, specified by the param's value. func isGtCrossStructField(fl FieldLevel) bool { field := fl.Field() @@ -1017,7 +1021,7 @@ func isGtCrossStructField(fl FieldLevel) bool { return field.String() > topField.String() } -// IsNeCrossStructField is the validation function for validating that the current field's value is not equal to the field, within a separate struct, specified by the param's value. +// isNeCrossStructField is the validation function for validating that the current field's value is not equal to the field, within a separate struct, specified by the param's value. func isNeCrossStructField(fl FieldLevel) bool { field := fl.Field() @@ -1067,7 +1071,7 @@ func isNeCrossStructField(fl FieldLevel) bool { return topField.String() != field.String() } -// IsEqCrossStructField is the validation function for validating that the current field's value is equal to the field, within a separate struct, specified by the param's value. +// isEqCrossStructField is the validation function for validating that the current field's value is equal to the field, within a separate struct, specified by the param's value. func isEqCrossStructField(fl FieldLevel) bool { field := fl.Field() @@ -1117,7 +1121,7 @@ func isEqCrossStructField(fl FieldLevel) bool { return topField.String() == field.String() } -// IsEqField is the validation function for validating if the current field's value is equal to the field specified by the param's value. +// isEqField is the validation function for validating if the current field's value is equal to the field specified by the param's value. func isEqField(fl FieldLevel) bool { field := fl.Field() @@ -1168,7 +1172,7 @@ func isEqField(fl FieldLevel) bool { return field.String() == currentField.String() } -// IsEq is the validation function for validating if the current field's value is equal to the param's value. +// isEq is the validation function for validating if the current field's value is equal to the param's value. func isEq(fl FieldLevel) bool { field := fl.Field() @@ -1249,17 +1253,17 @@ func isPostcodeByIso3166Alpha2Field(fl FieldLevel) bool { return reg.MatchString(field.String()) } -// IsBase64 is the validation function for validating if the current field's value is a valid base 64. +// isBase64 is the validation function for validating if the current field's value is a valid base 64. func isBase64(fl FieldLevel) bool { return base64Regex.MatchString(fl.Field().String()) } -// IsBase64URL is the validation function for validating if the current field's value is a valid base64 URL safe string. +// isBase64URL is the validation function for validating if the current field's value is a valid base64 URL safe string. func isBase64URL(fl FieldLevel) bool { return base64URLRegex.MatchString(fl.Field().String()) } -// IsURI is the validation function for validating if the current field's value is a valid URI. +// isURI is the validation function for validating if the current field's value is a valid URI. func isURI(fl FieldLevel) bool { field := fl.Field() @@ -1288,7 +1292,7 @@ func isURI(fl FieldLevel) bool { panic(fmt.Sprintf("Bad field type %T", field.Interface())) } -// IsURL is the validation function for validating if the current field's value is a valid URL. +// isURL is the validation function for validating if the current field's value is a valid URL. func isURL(fl FieldLevel) bool { field := fl.Field() @@ -1340,7 +1344,7 @@ func isUrnRFC2141(fl FieldLevel) bool { panic(fmt.Sprintf("Bad field type %T", field.Interface())) } -// IsFile is the validation function for validating if the current field's value is a valid file path. +// isFile is the validation function for validating if the current field's value is a valid file path. func isFile(fl FieldLevel) bool { field := fl.Field() @@ -1357,47 +1361,47 @@ func isFile(fl FieldLevel) bool { panic(fmt.Sprintf("Bad field type %T", field.Interface())) } -// IsE164 is the validation function for validating if the current field's value is a valid e.164 formatted phone number. +// isE164 is the validation function for validating if the current field's value is a valid e.164 formatted phone number. func isE164(fl FieldLevel) bool { return e164Regex.MatchString(fl.Field().String()) } -// IsEmail is the validation function for validating if the current field's value is a valid email address. +// isEmail is the validation function for validating if the current field's value is a valid email address. func isEmail(fl FieldLevel) bool { return emailRegex.MatchString(fl.Field().String()) } -// IsHSLA is the validation function for validating if the current field's value is a valid HSLA color. +// isHSLA is the validation function for validating if the current field's value is a valid HSLA color. func isHSLA(fl FieldLevel) bool { return hslaRegex.MatchString(fl.Field().String()) } -// IsHSL is the validation function for validating if the current field's value is a valid HSL color. +// isHSL is the validation function for validating if the current field's value is a valid HSL color. func isHSL(fl FieldLevel) bool { return hslRegex.MatchString(fl.Field().String()) } -// IsRGBA is the validation function for validating if the current field's value is a valid RGBA color. +// isRGBA is the validation function for validating if the current field's value is a valid RGBA color. func isRGBA(fl FieldLevel) bool { return rgbaRegex.MatchString(fl.Field().String()) } -// IsRGB is the validation function for validating if the current field's value is a valid RGB color. +// isRGB is the validation function for validating if the current field's value is a valid RGB color. func isRGB(fl FieldLevel) bool { return rgbRegex.MatchString(fl.Field().String()) } -// IsHEXColor is the validation function for validating if the current field's value is a valid HEX color. +// isHEXColor is the validation function for validating if the current field's value is a valid HEX color. func isHEXColor(fl FieldLevel) bool { return hexColorRegex.MatchString(fl.Field().String()) } -// IsHexadecimal is the validation function for validating if the current field's value is a valid hexadecimal. +// isHexadecimal is the validation function for validating if the current field's value is a valid hexadecimal. func isHexadecimal(fl FieldLevel) bool { return hexadecimalRegex.MatchString(fl.Field().String()) } -// IsNumber is the validation function for validating if the current field's value is a valid number. +// isNumber is the validation function for validating if the current field's value is a valid number. func isNumber(fl FieldLevel) bool { switch fl.Field().Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64: @@ -1407,7 +1411,7 @@ func isNumber(fl FieldLevel) bool { } } -// IsNumeric is the validation function for validating if the current field's value is a valid numeric value. +// isNumeric is the validation function for validating if the current field's value is a valid numeric value. func isNumeric(fl FieldLevel) bool { switch fl.Field().Kind() { case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr, reflect.Float32, reflect.Float64: @@ -1417,32 +1421,38 @@ func isNumeric(fl FieldLevel) bool { } } -// IsAlphanum is the validation function for validating if the current field's value is a valid alphanumeric value. +// isAlphanum is the validation function for validating if the current field's value is a valid alphanumeric value. func isAlphanum(fl FieldLevel) bool { return alphaNumericRegex.MatchString(fl.Field().String()) } -// IsAlpha is the validation function for validating if the current field's value is a valid alpha value. +// isAlpha is the validation function for validating if the current field's value is a valid alpha value. func isAlpha(fl FieldLevel) bool { return alphaRegex.MatchString(fl.Field().String()) } -// IsAlphanumUnicode is the validation function for validating if the current field's value is a valid alphanumeric unicode value. +// isAlphanumUnicode is the validation function for validating if the current field's value is a valid alphanumeric unicode value. func isAlphanumUnicode(fl FieldLevel) bool { return alphaUnicodeNumericRegex.MatchString(fl.Field().String()) } -// IsAlphaUnicode is the validation function for validating if the current field's value is a valid alpha unicode value. +// isAlphaUnicode is the validation function for validating if the current field's value is a valid alpha unicode value. func isAlphaUnicode(fl FieldLevel) bool { return alphaUnicodeRegex.MatchString(fl.Field().String()) } +// isBoolean is the validation function for validating if the current field's value can be safely converted to a boolean. +func isBoolean(fl FieldLevel) bool { + _, err := strconv.ParseBool(fl.Field().String()) + return err == nil +} + // isDefault is the opposite of required aka hasValue func isDefault(fl FieldLevel) bool { return !hasValue(fl) } -// HasValue is the validation function for validating if the current field's value is not the default static value. +// hasValue is the validation function for validating if the current field's value is not the default static value. func hasValue(fl FieldLevel) bool { field := fl.Field() switch field.Kind() { @@ -1540,7 +1550,7 @@ func requiredUnless(fl FieldLevel) bool { return hasValue(fl) } -// ExcludedWith is the validation function +// excludedWith is the validation function // The field under validation must not be present or is empty if any of the other specified fields are present. func excludedWith(fl FieldLevel) bool { params := parseOneOfParam2(fl.Param()) @@ -1552,7 +1562,7 @@ func excludedWith(fl FieldLevel) bool { return true } -// RequiredWith is the validation function +// requiredWith is the validation function // The field under validation must be present and not empty only if any of the other specified fields are present. func requiredWith(fl FieldLevel) bool { params := parseOneOfParam2(fl.Param()) @@ -1564,7 +1574,7 @@ func requiredWith(fl FieldLevel) bool { return true } -// ExcludedWithAll is the validation function +// excludedWithAll is the validation function // The field under validation must not be present or is empty if all of the other specified fields are present. func excludedWithAll(fl FieldLevel) bool { params := parseOneOfParam2(fl.Param()) @@ -1576,7 +1586,7 @@ func excludedWithAll(fl FieldLevel) bool { return !hasValue(fl) } -// RequiredWithAll is the validation function +// requiredWithAll is the validation function // The field under validation must be present and not empty only if all of the other specified fields are present. func requiredWithAll(fl FieldLevel) bool { params := parseOneOfParam2(fl.Param()) @@ -1588,7 +1598,7 @@ func requiredWithAll(fl FieldLevel) bool { return hasValue(fl) } -// ExcludedWithout is the validation function +// excludedWithout is the validation function // The field under validation must not be present or is empty when any of the other specified fields are not present. func excludedWithout(fl FieldLevel) bool { if requireCheckFieldKind(fl, strings.TrimSpace(fl.Param()), true) { @@ -1597,7 +1607,7 @@ func excludedWithout(fl FieldLevel) bool { return true } -// RequiredWithout is the validation function +// requiredWithout is the validation function // The field under validation must be present and not empty only when any of the other specified fields are not present. func requiredWithout(fl FieldLevel) bool { if requireCheckFieldKind(fl, strings.TrimSpace(fl.Param()), true) { @@ -1606,7 +1616,7 @@ func requiredWithout(fl FieldLevel) bool { return true } -// ExcludedWithoutAll is the validation function +// excludedWithoutAll is the validation function // The field under validation must not be present or is empty when all of the other specified fields are not present. func excludedWithoutAll(fl FieldLevel) bool { params := parseOneOfParam2(fl.Param()) @@ -1618,7 +1628,7 @@ func excludedWithoutAll(fl FieldLevel) bool { return !hasValue(fl) } -// RequiredWithoutAll is the validation function +// requiredWithoutAll is the validation function // The field under validation must be present and not empty only when all of the other specified fields are not present. func requiredWithoutAll(fl FieldLevel) bool { params := parseOneOfParam2(fl.Param()) @@ -1630,7 +1640,7 @@ func requiredWithoutAll(fl FieldLevel) bool { return hasValue(fl) } -// IsGteField is the validation function for validating if the current field's value is greater than or equal to the field specified by the param's value. +// isGteField is the validation function for validating if the current field's value is greater than or equal to the field specified by the param's value. func isGteField(fl FieldLevel) bool { field := fl.Field() @@ -1677,7 +1687,7 @@ func isGteField(fl FieldLevel) bool { return len(field.String()) >= len(currentField.String()) } -// IsGtField is the validation function for validating if the current field's value is greater than the field specified by the param's value. +// isGtField is the validation function for validating if the current field's value is greater than the field specified by the param's value. func isGtField(fl FieldLevel) bool { field := fl.Field() @@ -1724,7 +1734,7 @@ func isGtField(fl FieldLevel) bool { return len(field.String()) > len(currentField.String()) } -// IsGte is the validation function for validating if the current field's value is greater than or equal to the param's value. +// isGte is the validation function for validating if the current field's value is greater than or equal to the param's value. func isGte(fl FieldLevel) bool { field := fl.Field() @@ -1771,7 +1781,7 @@ func isGte(fl FieldLevel) bool { panic(fmt.Sprintf("Bad field type %T", field.Interface())) } -// IsGt is the validation function for validating if the current field's value is greater than the param's value. +// isGt is the validation function for validating if the current field's value is greater than the param's value. func isGt(fl FieldLevel) bool { field := fl.Field() @@ -1814,7 +1824,7 @@ func isGt(fl FieldLevel) bool { panic(fmt.Sprintf("Bad field type %T", field.Interface())) } -// HasLengthOf is the validation function for validating if the current field's value is equal to the param's value. +// hasLengthOf is the validation function for validating if the current field's value is equal to the param's value. func hasLengthOf(fl FieldLevel) bool { field := fl.Field() @@ -1851,12 +1861,12 @@ func hasLengthOf(fl FieldLevel) bool { panic(fmt.Sprintf("Bad field type %T", field.Interface())) } -// HasMinOf is the validation function for validating if the current field's value is greater than or equal to the param's value. +// hasMinOf is the validation function for validating if the current field's value is greater than or equal to the param's value. func hasMinOf(fl FieldLevel) bool { return isGte(fl) } -// IsLteField is the validation function for validating if the current field's value is less than or equal to the field specified by the param's value. +// isLteField is the validation function for validating if the current field's value is less than or equal to the field specified by the param's value. func isLteField(fl FieldLevel) bool { field := fl.Field() @@ -1903,7 +1913,7 @@ func isLteField(fl FieldLevel) bool { return len(field.String()) <= len(currentField.String()) } -// IsLtField is the validation function for validating if the current field's value is less than the field specified by the param's value. +// isLtField is the validation function for validating if the current field's value is less than the field specified by the param's value. func isLtField(fl FieldLevel) bool { field := fl.Field() @@ -1950,7 +1960,7 @@ func isLtField(fl FieldLevel) bool { return len(field.String()) < len(currentField.String()) } -// IsLte is the validation function for validating if the current field's value is less than or equal to the param's value. +// isLte is the validation function for validating if the current field's value is less than or equal to the param's value. func isLte(fl FieldLevel) bool { field := fl.Field() @@ -1997,7 +2007,7 @@ func isLte(fl FieldLevel) bool { panic(fmt.Sprintf("Bad field type %T", field.Interface())) } -// IsLt is the validation function for validating if the current field's value is less than the param's value. +// isLt is the validation function for validating if the current field's value is less than the param's value. func isLt(fl FieldLevel) bool { field := fl.Field() @@ -2041,12 +2051,12 @@ func isLt(fl FieldLevel) bool { panic(fmt.Sprintf("Bad field type %T", field.Interface())) } -// HasMaxOf is the validation function for validating if the current field's value is less than or equal to the param's value. +// hasMaxOf is the validation function for validating if the current field's value is less than or equal to the param's value. func hasMaxOf(fl FieldLevel) bool { return isLte(fl) } -// IsTCP4AddrResolvable is the validation function for validating if the field's value is a resolvable tcp4 address. +// isTCP4AddrResolvable is the validation function for validating if the field's value is a resolvable tcp4 address. func isTCP4AddrResolvable(fl FieldLevel) bool { if !isIP4Addr(fl) { @@ -2057,7 +2067,7 @@ func isTCP4AddrResolvable(fl FieldLevel) bool { return err == nil } -// IsTCP6AddrResolvable is the validation function for validating if the field's value is a resolvable tcp6 address. +// isTCP6AddrResolvable is the validation function for validating if the field's value is a resolvable tcp6 address. func isTCP6AddrResolvable(fl FieldLevel) bool { if !isIP6Addr(fl) { @@ -2069,7 +2079,7 @@ func isTCP6AddrResolvable(fl FieldLevel) bool { return err == nil } -// IsTCPAddrResolvable is the validation function for validating if the field's value is a resolvable tcp address. +// isTCPAddrResolvable is the validation function for validating if the field's value is a resolvable tcp address. func isTCPAddrResolvable(fl FieldLevel) bool { if !isIP4Addr(fl) && !isIP6Addr(fl) { @@ -2081,7 +2091,7 @@ func isTCPAddrResolvable(fl FieldLevel) bool { return err == nil } -// IsUDP4AddrResolvable is the validation function for validating if the field's value is a resolvable udp4 address. +// isUDP4AddrResolvable is the validation function for validating if the field's value is a resolvable udp4 address. func isUDP4AddrResolvable(fl FieldLevel) bool { if !isIP4Addr(fl) { @@ -2093,7 +2103,7 @@ func isUDP4AddrResolvable(fl FieldLevel) bool { return err == nil } -// IsUDP6AddrResolvable is the validation function for validating if the field's value is a resolvable udp6 address. +// isUDP6AddrResolvable is the validation function for validating if the field's value is a resolvable udp6 address. func isUDP6AddrResolvable(fl FieldLevel) bool { if !isIP6Addr(fl) { @@ -2105,7 +2115,7 @@ func isUDP6AddrResolvable(fl FieldLevel) bool { return err == nil } -// IsUDPAddrResolvable is the validation function for validating if the field's value is a resolvable udp address. +// isUDPAddrResolvable is the validation function for validating if the field's value is a resolvable udp address. func isUDPAddrResolvable(fl FieldLevel) bool { if !isIP4Addr(fl) && !isIP6Addr(fl) { @@ -2117,7 +2127,7 @@ func isUDPAddrResolvable(fl FieldLevel) bool { return err == nil } -// IsIP4AddrResolvable is the validation function for validating if the field's value is a resolvable ip4 address. +// isIP4AddrResolvable is the validation function for validating if the field's value is a resolvable ip4 address. func isIP4AddrResolvable(fl FieldLevel) bool { if !isIPv4(fl) { @@ -2129,7 +2139,7 @@ func isIP4AddrResolvable(fl FieldLevel) bool { return err == nil } -// IsIP6AddrResolvable is the validation function for validating if the field's value is a resolvable ip6 address. +// isIP6AddrResolvable is the validation function for validating if the field's value is a resolvable ip6 address. func isIP6AddrResolvable(fl FieldLevel) bool { if !isIPv6(fl) { @@ -2141,7 +2151,7 @@ func isIP6AddrResolvable(fl FieldLevel) bool { return err == nil } -// IsIPAddrResolvable is the validation function for validating if the field's value is a resolvable ip address. +// isIPAddrResolvable is the validation function for validating if the field's value is a resolvable ip address. func isIPAddrResolvable(fl FieldLevel) bool { if !isIP(fl) { @@ -2153,7 +2163,7 @@ func isIPAddrResolvable(fl FieldLevel) bool { return err == nil } -// IsUnixAddrResolvable is the validation function for validating if the field's value is a resolvable unix address. +// isUnixAddrResolvable is the validation function for validating if the field's value is a resolvable unix address. func isUnixAddrResolvable(fl FieldLevel) bool { _, err := net.ResolveUnixAddr("unix", fl.Field().String()) @@ -2207,7 +2217,7 @@ func isFQDN(fl FieldLevel) bool { return fqdnRegexRFC1123.MatchString(val) } -// IsDir is the validation function for validating if the current field's value is a valid directory. +// isDir is the validation function for validating if the current field's value is a valid directory. func isDir(fl FieldLevel) bool { field := fl.Field() @@ -2235,6 +2245,11 @@ func isJSON(fl FieldLevel) bool { panic(fmt.Sprintf("Bad field type %T", field.Interface())) } +// isJWT is the validation function for validating if the current field's value is a valid JWT string. +func isJWT(fl FieldLevel) bool { + return jWTRegex.MatchString(fl.Field().String()) +} + // isHostnamePort validates a <dns>:<port> combination for fields typically used for socket address. func isHostnamePort(fl FieldLevel) bool { val := fl.Field().String() @@ -2352,6 +2367,28 @@ func isIso31662(fl FieldLevel) bool { return iso3166_2[val] } +// isIso4217 is the validation function for validating if the current field's value is a valid iso4217 currency code. +func isIso4217(fl FieldLevel) bool { + val := fl.Field().String() + return iso4217[val] +} + +// isIso4217Numeric is the validation function for validating if the current field's value is a valid iso4217 numeric currency code. +func isIso4217Numeric(fl FieldLevel) bool { + field := fl.Field() + + var code int + switch field.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + code = int(field.Int()) + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + code = int(field.Uint()) + default: + panic(fmt.Sprintf("Bad field type %T", field.Interface())) + } + return iso4217_numeric[code] +} + // isBCP47LanguageTag is the validation function for validating if the current field's value is a valid BCP 47 language tag, as parsed by language.Parse func isBCP47LanguageTag(fl FieldLevel) bool { field := fl.Field() diff --git a/vendor/github.com/go-playground/validator/v10/currency_codes.go b/vendor/github.com/go-playground/validator/v10/currency_codes.go @@ -0,0 +1,79 @@ +package validator + +var iso4217 = map[string]bool{ + "AFN": true, "EUR": true, "ALL": true, "DZD": true, "USD": true, + "AOA": true, "XCD": true, "ARS": true, "AMD": true, "AWG": true, + "AUD": true, "AZN": true, "BSD": true, "BHD": true, "BDT": true, + "BBD": true, "BYN": true, "BZD": true, "XOF": true, "BMD": true, + "INR": true, "BTN": true, "BOB": true, "BOV": true, "BAM": true, + "BWP": true, "NOK": true, "BRL": true, "BND": true, "BGN": true, + "BIF": true, "CVE": true, "KHR": true, "XAF": true, "CAD": true, + "KYD": true, "CLP": true, "CLF": true, "CNY": true, "COP": true, + "COU": true, "KMF": true, "CDF": true, "NZD": true, "CRC": true, + "HRK": true, "CUP": true, "CUC": true, "ANG": true, "CZK": true, + "DKK": true, "DJF": true, "DOP": true, "EGP": true, "SVC": true, + "ERN": true, "SZL": true, "ETB": true, "FKP": true, "FJD": true, + "XPF": true, "GMD": true, "GEL": true, "GHS": true, "GIP": true, + "GTQ": true, "GBP": true, "GNF": true, "GYD": true, "HTG": true, + "HNL": true, "HKD": true, "HUF": true, "ISK": true, "IDR": true, + "XDR": true, "IRR": true, "IQD": true, "ILS": true, "JMD": true, + "JPY": true, "JOD": true, "KZT": true, "KES": true, "KPW": true, + "KRW": true, "KWD": true, "KGS": true, "LAK": true, "LBP": true, + "LSL": true, "ZAR": true, "LRD": true, "LYD": true, "CHF": true, + "MOP": true, "MKD": true, "MGA": true, "MWK": true, "MYR": true, + "MVR": true, "MRU": true, "MUR": true, "XUA": true, "MXN": true, + "MXV": true, "MDL": true, "MNT": true, "MAD": true, "MZN": true, + "MMK": true, "NAD": true, "NPR": true, "NIO": true, "NGN": true, + "OMR": true, "PKR": true, "PAB": true, "PGK": true, "PYG": true, + "PEN": true, "PHP": true, "PLN": true, "QAR": true, "RON": true, + "RUB": true, "RWF": true, "SHP": true, "WST": true, "STN": true, + "SAR": true, "RSD": true, "SCR": true, "SLL": true, "SGD": true, + "XSU": true, "SBD": true, "SOS": true, "SSP": true, "LKR": true, + "SDG": true, "SRD": true, "SEK": true, "CHE": true, "CHW": true, + "SYP": true, "TWD": true, "TJS": true, "TZS": true, "THB": true, + "TOP": true, "TTD": true, "TND": true, "TRY": true, "TMT": true, + "UGX": true, "UAH": true, "AED": true, "USN": true, "UYU": true, + "UYI": true, "UYW": true, "UZS": true, "VUV": true, "VES": true, + "VND": true, "YER": true, "ZMW": true, "ZWL": true, "XBA": true, + "XBB": true, "XBC": true, "XBD": true, "XTS": true, "XXX": true, + "XAU": true, "XPD": true, "XPT": true, "XAG": true, +} + +var iso4217_numeric = map[int]bool{ + 8: true, 12: true, 32: true, 36: true, 44: true, + 48: true, 50: true, 51: true, 52: true, 60: true, + 64: true, 68: true, 72: true, 84: true, 90: true, + 96: true, 104: true, 108: true, 116: true, 124: true, + 132: true, 136: true, 144: true, 152: true, 156: true, + 170: true, 174: true, 188: true, 191: true, 192: true, + 203: true, 208: true, 214: true, 222: true, 230: true, + 232: true, 238: true, 242: true, 262: true, 270: true, + 292: true, 320: true, 324: true, 328: true, 332: true, + 340: true, 344: true, 348: true, 352: true, 356: true, + 360: true, 364: true, 368: true, 376: true, 388: true, + 392: true, 398: true, 400: true, 404: true, 408: true, + 410: true, 414: true, 417: true, 418: true, 422: true, + 426: true, 430: true, 434: true, 446: true, 454: true, + 458: true, 462: true, 480: true, 484: true, 496: true, + 498: true, 504: true, 512: true, 516: true, 524: true, + 532: true, 533: true, 548: true, 554: true, 558: true, + 566: true, 578: true, 586: true, 590: true, 598: true, + 600: true, 604: true, 608: true, 634: true, 643: true, + 646: true, 654: true, 682: true, 690: true, 694: true, + 702: true, 704: true, 706: true, 710: true, 728: true, + 748: true, 752: true, 756: true, 760: true, 764: true, + 776: true, 780: true, 784: true, 788: true, 800: true, + 807: true, 818: true, 826: true, 834: true, 840: true, + 858: true, 860: true, 882: true, 886: true, 901: true, + 927: true, 928: true, 929: true, 930: true, 931: true, + 932: true, 933: true, 934: true, 936: true, 938: true, + 940: true, 941: true, 943: true, 944: true, 946: true, + 947: true, 948: true, 949: true, 950: true, 951: true, + 952: true, 953: true, 955: true, 956: true, 957: true, + 958: true, 959: true, 960: true, 961: true, 962: true, + 963: true, 964: true, 965: true, 967: true, 968: true, + 969: true, 970: true, 971: true, 972: true, 973: true, + 975: true, 976: true, 977: true, 978: true, 979: true, + 980: true, 981: true, 984: true, 985: true, 986: true, + 990: true, 994: true, 997: true, 999: true, +} diff --git a/vendor/github.com/go-playground/validator/v10/doc.go b/vendor/github.com/go-playground/validator/v10/doc.go @@ -7,6 +7,14 @@ and has the ability to dive into arrays and maps of any type. see more examples https://github.com/go-playground/validator/tree/master/_examples +Singleton + +Validator is designed to be thread-safe and used as a singleton instance. +It caches information about your struct and validations, +in essence only parsing your validation tags once per struct type. +Using multiple instances neglects the benefit of caching. +The not thread-safe functions are explicitly marked as such in the documentation. + Validation Functions Return Type error Doing things this way is actually the way the standard library does, see the @@ -726,6 +734,12 @@ This validates that a string value contains unicode alphanumeric characters only Usage: alphanumunicode +Boolean + +This validates that a string value can successfully be parsed into a boolean with strconv.ParseBool + + Usage: boolean + Number This validates that a string value contains number values only. @@ -811,6 +825,12 @@ This validates that a string value is valid JSON Usage: json +JWT String + +This validates that a string value is a valid JWT + + Usage: jwt + File path This validates that a string value contains a valid file path and that diff --git a/vendor/github.com/go-playground/validator/v10/go.mod b/vendor/github.com/go-playground/validator/v10/go.mod @@ -1,12 +0,0 @@ -module github.com/go-playground/validator/v10 - -go 1.13 - -require ( - github.com/go-playground/assert/v2 v2.0.1 - github.com/go-playground/locales v0.13.0 - github.com/go-playground/universal-translator v0.17.0 - github.com/leodido/go-urn v1.2.0 - golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 - golang.org/x/text v0.3.2 // indirect -) diff --git a/vendor/github.com/go-playground/validator/v10/go.sum b/vendor/github.com/go-playground/validator/v10/go.sum @@ -1,33 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e h1:FDhOuMEY4JVRztM/gsbk+IKUQ8kj74bxZrgw87eMMVc= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/go-playground/validator/v10/regexes.go b/vendor/github.com/go-playground/validator/v10/regexes.go @@ -48,6 +48,7 @@ const ( uRLEncodedRegexString = `^(?:[^%]|%[0-9A-Fa-f]{2})*$` hTMLEncodedRegexString = `&#[x]?([0-9a-fA-F]{2})|(>)|(<)|(")|(&)+[;]?` hTMLRegexString = `<[/]?([a-zA-Z]+).*?>` + jWTRegexString = "^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$" splitParamsRegexString = `'[^']*'|\S+` bicRegexString = `^[A-Za-z]{6}[A-Za-z0-9]{2}([A-Za-z0-9]{3})?$` ) @@ -98,6 +99,7 @@ var ( uRLEncodedRegex = regexp.MustCompile(uRLEncodedRegexString) hTMLEncodedRegex = regexp.MustCompile(hTMLEncodedRegexString) hTMLRegex = regexp.MustCompile(hTMLRegexString) + jWTRegex = regexp.MustCompile(jWTRegexString) splitParamsRegex = regexp.MustCompile(splitParamsRegexString) bicRegex = regexp.MustCompile(bicRegexString) ) diff --git a/vendor/github.com/go-playground/validator/v10/validator_instance.go b/vendor/github.com/go-playground/validator/v10/validator_instance.go @@ -89,6 +89,10 @@ type Validate struct { } // New returns a new instance of 'validate' with sane defaults. +// Validate is designed to be thread-safe and used as a singleton instance. +// It caches information about your struct and validations, +// in essence only parsing your validation tags once per struct type. +// Using multiple instances neglects the benefit of caching. func New() *Validate { tc := new(tagCache) @@ -207,11 +211,11 @@ func (v *Validate) RegisterValidationCtx(tag string, fn FuncCtx, callValidationE func (v *Validate) registerValidation(tag string, fn FuncCtx, bakedIn bool, nilCheckable bool) error { if len(tag) == 0 { - return errors.New("Function Key cannot be empty") + return errors.New("function Key cannot be empty") } if fn == nil { - return errors.New("Function cannot be empty") + return errors.New("function cannot be empty") } _, ok := restrictedTags[tag] diff --git a/vendor/github.com/goccy/go-json/.codecov.yml b/vendor/github.com/goccy/go-json/.codecov.yml @@ -28,4 +28,5 @@ comment: require_changes: no ignore: - - internal/encoder/vm_debug + - internal/encoder/vm_color + - internal/encoder/vm_color_indent diff --git a/vendor/github.com/goccy/go-json/CHANGELOG.md b/vendor/github.com/goccy/go-json/CHANGELOG.md @@ -1,3 +1,118 @@ +# 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 diff --git a/vendor/github.com/goccy/go-json/Makefile b/vendor/github.com/goccy/go-json/Makefile @@ -1,7 +1,7 @@ PKG := github.com/goccy/go-json BIN_DIR := $(CURDIR)/bin -PKGS := $(shell go list ./... | grep -v internal/cmd) +PKGS := $(shell go list ./... | grep -v internal/cmd|grep -v test) COVER_PKGS := $(foreach pkg,$(PKGS),$(subst $(PKG),.,$(pkg))) COMMA := , @@ -14,7 +14,7 @@ $(BIN_DIR): .PHONY: cover cover: - go test -coverpkg=$(COVERPKG_OPT) -coverprofile=cover.out . + go test -coverpkg=$(COVERPKG_OPT) -coverprofile=cover.out ./... .PHONY: cover-html cover-html: cover diff --git a/vendor/github.com/goccy/go-json/README.md b/vendor/github.com/goccy/go-json/README.md @@ -13,23 +13,26 @@ Fast JSON encoder/decoder compatible with encoding/json for Go ``` * version ( expected release date ) -* v0.5.0 - | - | refactor all sources for maintainability and improve performance - | - v -* v0.6.0 ( 2021/05 Mid ) +* v0.7.0 | | while maintaining compatibility with encoding/json, we will add convenient APIs | v -* v1.0.0 ( 2021/06 Mid ) +* v1.0.0 ``` -We are accepting requests for features that will be implemented between v0.6.0 and v.1.0.0. +We are accepting requests for features that will be implemented between v0.7.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). For example, I'm thinking of supporting `context.Context` of `json.Marshaler` and decoding using JSON Path. +# 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` + # Installation ``` @@ -53,13 +56,26 @@ Replace import statement from `encoding/json` to `github.com/goccy/go-json` | [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 | yes | +| [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, but it hasn't been supported for a long time. +- `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 @@ -176,7 +192,7 @@ 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 https://github.com/goccy/go-json/blob/master/rtype.go. +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 ) @@ -337,7 +353,7 @@ However, if there is too much type information, it will use a lot of memory, so 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/codec.go#L24-L76 ) +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 diff --git a/vendor/github.com/goccy/go-json/codec.go b/vendor/github.com/goccy/go-json/codec.go @@ -1,104 +0,0 @@ -package json - -import ( - "fmt" - "reflect" - "sync/atomic" - "unsafe" -) - -const ( - maxAcceptableTypeAddrRange = 1024 * 1024 * 2 // 2 Mib -) - -var ( - cachedDecoder []decoder - cachedDecoderMap unsafe.Pointer // map[uintptr]decoder - baseTypeAddr uintptr - maxTypeAddr uintptr - typeAddrShift uintptr -) - -//go:linkname typelinks reflect.typelinks -func typelinks() ([]unsafe.Pointer, [][]int32) - -//go:linkname rtypeOff reflect.rtypeOff -func rtypeOff(unsafe.Pointer, int32) unsafe.Pointer - -func setupCodec() error { - sections, offsets := typelinks() - if len(sections) != 1 { - return fmt.Errorf("failed to get sections") - } - if len(offsets) != 1 { - return fmt.Errorf("failed to get offsets") - } - 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 := (*rtype)(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 - } - } - - // check every address is aligned from the base address - isAligned64 = isAligned64 && (addr-min)&63 == 0 - isAligned32 = isAligned32 && (addr-min)&31 == 0 - } - addrRange := max - min - if addrRange == 0 { - return fmt.Errorf("failed to get address range of types") - } - if isAligned64 { - typeAddrShift = 6 - } else if isAligned32 { - typeAddrShift = 5 - } - cacheSize := addrRange >> typeAddrShift - if cacheSize > maxAcceptableTypeAddrRange { - return fmt.Errorf("too big address range %d", addrRange) - } - cachedDecoder = make([]decoder, cacheSize) - baseTypeAddr = min - maxTypeAddr = max - return nil -} - -func init() { - _ = setupCodec() -} - -func loadDecoderMap() map[uintptr]decoder { - p := atomic.LoadPointer(&cachedDecoderMap) - return *(*map[uintptr]decoder)(unsafe.Pointer(&p)) -} - -func storeDecoder(typ uintptr, dec decoder, m map[uintptr]decoder) { - 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))) -} diff --git a/vendor/github.com/goccy/go-json/color.go b/vendor/github.com/goccy/go-json/color.go @@ -0,0 +1,68 @@ +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 @@ -1,34 +1,31 @@ package json import ( - "encoding" + "context" "fmt" "io" "reflect" - "strconv" "unsafe" -) -type decoder interface { - decode([]byte, int64, int64, unsafe.Pointer) (int64, error) - decodeStream(*stream, int64, unsafe.Pointer) error -} + "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 *stream + s *decoder.Stream } -var ( - unmarshalJSONType = reflect.TypeOf((*Unmarshaler)(nil)).Elem() - unmarshalTextType = reflect.TypeOf((*encoding.TextUnmarshaler)(nil)).Elem() -) - const ( - nul = '\000' - maxDecodeNestingDepth = 10000 + nul = '\000' ) -func unmarshal(data []byte, v interface{}) error { +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) @@ -37,18 +34,26 @@ func unmarshal(data []byte, v interface{}) error { if err := validateType(header.typ, uintptr(header.ptr)); err != nil { return err } - dec, err := decodeCompileToGetDecoder(header.typ) + dec, err := decoder.CompileToGetDecoder(header.typ) if err != nil { return err } - cursor, err := dec.decode(src, 0, 0, header.ptr) + 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 unmarshalNoEscape(data []byte, v interface{}) error { +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) @@ -57,14 +62,53 @@ func unmarshalNoEscape(data []byte, v interface{}) error { if err := validateType(header.typ, uintptr(header.ptr)); err != nil { return err } - dec, err := decodeCompileToGetDecoder(header.typ) + dec, err := decoder.CompileToGetDecoder(header.typ) if err != nil { return err } - cursor, err := dec.decode(src, 0, 0, noescape(header.ptr)) + 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) +} + +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) } @@ -77,7 +121,7 @@ func validateEndBuf(src []byte, cursor int64) error { case nul: return nil } - return errSyntax( + return errors.ErrSyntax( fmt.Sprintf("invalid character '%c' after top-level value", src[cursor]), cursor+1, ) @@ -91,9 +135,9 @@ func noescape(p unsafe.Pointer) unsafe.Pointer { return unsafe.Pointer(x ^ 0) } -func validateType(typ *rtype, p uintptr) error { +func validateType(typ *runtime.Type, p uintptr) error { if typ == nil || typ.Kind() != reflect.Ptr || p == 0 { - return &InvalidUnmarshalError{Type: rtype2type(typ)} + return &InvalidUnmarshalError{Type: runtime.RType2Type(typ)} } return nil } @@ -103,7 +147,7 @@ func validateType(typ *rtype, p uintptr) error { // The decoder introduces its own buffering and may // read data from r beyond the JSON values requested. func NewDecoder(r io.Reader) *Decoder { - s := newStream(r) + s := decoder.NewStream(r) return &Decoder{ s: s, } @@ -112,28 +156,7 @@ func NewDecoder(r io.Reader) *Decoder { // 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() -} - -func (d *Decoder) prepareForDecode() error { - s := d.s - 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 + return d.s.Buffered() } // Decode reads the next JSON-encoded value from its @@ -142,120 +165,68 @@ func (d *Decoder) prepareForDecode() error { // 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 := *(**rtype)(unsafe.Pointer(&typeptr)) + copiedType := *(**runtime.Type)(unsafe.Pointer(&typeptr)) if err := validateType(copiedType, ptr); err != nil { return err } - dec, err := decodeCompileToGetDecoder(typ) + dec, err := decoder.CompileToGetDecoder(typ) if err != nil { return err } - if err := d.prepareForDecode(); err != nil { + if err := d.s.PrepareForDecode(); err != nil { return err } s := d.s - if err := dec.decodeStream(s, 0, header.ptr); err != nil { + for _, optFunc := range optFuncs { + optFunc(s.Option) + } + if err := dec.DecodeStream(s, 0, header.ptr); err != nil { return err } - s.reset() - s.bufSize = initBufSize + s.Reset() return nil } func (d *Decoder) More() bool { - s := d.s - 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 + return d.s.More() } func (d *Decoder) Token() (Token, error) { - s := d.s - for { - c := s.char() - switch c { - case ' ', '\n', '\r', '\t': - s.cursor++ - case '{', '[', ']', '}': - s.cursor++ - return Delim(c), nil - case ',', ':': - s.cursor++ - case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - bytes := floatBytes(s) - s := *(*string)(unsafe.Pointer(&bytes)) - f64, err := strconv.ParseFloat(s, 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, errInvalidCharacter(s.char(), "token", s.totalOffset()) - } - } -END: - return nil, io.EOF + 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 + d.s.DisallowUnknownFields = true } func (d *Decoder) InputOffset() int64 { - return d.s.totalOffset() + 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 + d.s.UseNumber = true } diff --git a/vendor/github.com/goccy/go-json/decode_anonymous_field.go b/vendor/github.com/goccy/go-json/decode_anonymous_field.go @@ -1,35 +0,0 @@ -package json - -import ( - "unsafe" -) - -type anonymousFieldDecoder struct { - structType *rtype - offset uintptr - dec decoder -} - -func newAnonymousFieldDecoder(structType *rtype, 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(buf []byte, 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(buf, cursor, depth, unsafe.Pointer(uintptr(p)+d.offset)) -} diff --git a/vendor/github.com/goccy/go-json/decode_array.go b/vendor/github.com/goccy/go-json/decode_array.go @@ -1,146 +0,0 @@ -package json - -import ( - "unsafe" -) - -type arrayDecoder struct { - elemType *rtype - size uintptr - valueDecoder decoder - alen int - structName string - fieldName string - zeroValue unsafe.Pointer -} - -func newArrayDecoder(dec decoder, elemType *rtype, alen int, structName, fieldName string) *arrayDecoder { - zeroValue := *(*unsafe.Pointer)(unsafe_New(elemType)) - 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 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 - for { - s.cursor++ - 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++ - s.skipWhiteSpace() - switch s.char() { - case ']': - for idx < d.alen { - *(*unsafe.Pointer)(unsafe.Pointer(uintptr(p) + uintptr(idx)*d.size)) = d.zeroValue - idx++ - } - s.cursor++ - return nil - case ',': - continue - case nul: - if s.read() { - continue - } - goto ERROR - default: - goto ERROR - } - } - case nul: - if s.read() { - continue - } - goto ERROR - default: - goto ERROR - } - s.cursor++ - } -ERROR: - return errUnexpectedEndOfJSON("array", s.totalOffset()) -} - -func (d *arrayDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { - depth++ - if depth > maxDecodeNestingDepth { - return 0, 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 - for { - cursor++ - if idx < d.alen { - c, err := d.valueDecoder.decode(buf, 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 ',': - continue - default: - return 0, errInvalidCharacter(buf[cursor], "array", cursor) - } - } - default: - return 0, errUnexpectedEndOfJSON("array", cursor) - } - } -} diff --git a/vendor/github.com/goccy/go-json/decode_bool.go b/vendor/github.com/goccy/go-json/decode_bool.go @@ -1,74 +0,0 @@ -package json - -import ( - "unsafe" -) - -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 { - s.skipWhiteSpace() - for { - switch s.char() { - 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() { - continue - } - goto ERROR - } - break - } -ERROR: - return errUnexpectedEndOfJSON("bool", s.totalOffset()) -} - -func (d *boolDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { - 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, errUnexpectedEndOfJSON("bool", cursor) -} diff --git a/vendor/github.com/goccy/go-json/decode_bytes.go b/vendor/github.com/goccy/go-json/decode_bytes.go @@ -1,172 +0,0 @@ -package json - -import ( - "encoding/base64" - "unsafe" -) - -type bytesDecoder struct { - typ *rtype - sliceDecoder decoder - structName string - fieldName string -} - -func byteUnmarshalerSliceDecoder(typ *rtype, structName string, fieldName string) decoder { - var unmarshalDecoder decoder - switch { - case rtype_ptrTo(typ).Implements(unmarshalJSONType): - unmarshalDecoder = newUnmarshalJSONDecoder(rtype_ptrTo(typ), structName, fieldName) - case rtype_ptrTo(typ).Implements(unmarshalTextType): - unmarshalDecoder = newUnmarshalTextDecoder(rtype_ptrTo(typ), structName, fieldName) - } - if unmarshalDecoder == nil { - return nil - } - return newSliceDecoder(unmarshalDecoder, typ, 1, structName, fieldName) -} - -func newBytesDecoder(typ *rtype, structName string, fieldName string) *bytesDecoder { - return &bytesDecoder{ - typ: typ, - sliceDecoder: byteUnmarshalerSliceDecoder(typ, 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) - if _, err := base64.StdEncoding.Decode(buf, bytes); err != nil { - return err - } - *(*[]byte)(p) = buf - s.reset() - return nil -} - -func (d *bytesDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { - bytes, c, err := d.decodeBinary(buf, 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 binaryBytes(s *stream) ([]byte, error) { - s.cursor++ - start := s.cursor - for { - switch s.char() { - case '"': - literal := s.buf[start:s.cursor] - s.cursor++ - return literal, nil - case nul: - if s.read() { - continue - } - goto ERROR - } - s.cursor++ - } -ERROR: - return nil, errUnexpectedEndOfJSON("[]byte", s.totalOffset()) -} - -func (d *bytesDecoder) decodeStreamBinary(s *stream, depth int64, p unsafe.Pointer) ([]byte, error) { - for { - switch s.char() { - case ' ', '\n', '\t', '\r': - s.cursor++ - continue - case '"': - return binaryBytes(s) - case 'n': - if err := nullBytes(s); err != nil { - return nil, err - } - return nil, nil - case '[': - if d.sliceDecoder == nil { - return nil, &UnmarshalTypeError{ - Type: rtype2type(d.typ), - Offset: s.totalOffset(), - } - } - if err := d.sliceDecoder.decodeStream(s, depth, p); err != nil { - return nil, err - } - return nil, nil - case nul: - if s.read() { - continue - } - } - break - } - return nil, errNotAtBeginningOfValue(s.totalOffset()) -} - -func (d *bytesDecoder) decodeBinary(buf []byte, cursor, depth int64, p unsafe.Pointer) ([]byte, int64, error) { - for { - switch buf[cursor] { - case ' ', '\n', '\t', '\r': - cursor++ - case '"': - cursor++ - start := cursor - for { - switch buf[cursor] { - case '"': - literal := buf[start:cursor] - cursor++ - return literal, cursor, nil - case nul: - return nil, 0, errUnexpectedEndOfJSON("[]byte", cursor) - } - cursor++ - } - case '[': - if d.sliceDecoder == nil { - return nil, 0, &UnmarshalTypeError{ - Type: rtype2type(d.typ), - Offset: cursor, - } - } - c, err := d.sliceDecoder.decode(buf, cursor, depth, p) - if err != nil { - return nil, 0, err - } - return nil, c, nil - case 'n': - if err := validateNull(buf, cursor); err != nil { - return nil, 0, err - } - cursor += 4 - return nil, cursor, nil - default: - return nil, 0, errNotAtBeginningOfValue(cursor) - } - } -} diff --git a/vendor/github.com/goccy/go-json/decode_compile.go b/vendor/github.com/goccy/go-json/decode_compile.go @@ -1,467 +0,0 @@ -package json - -import ( - "encoding/json" - "fmt" - "reflect" - "strings" - "unicode" - "unsafe" - - "github.com/goccy/go-json/internal/runtime" -) - -var ( - jsonNumberType = reflect.TypeOf(json.Number("")) -) - -func decodeCompileToGetDecoderSlowPath(typeptr uintptr, typ *rtype) (decoder, error) { - decoderMap := loadDecoderMap() - if dec, exists := decoderMap[typeptr]; exists { - return dec, nil - } - - dec, err := decodeCompileHead(typ, map[uintptr]decoder{}) - if err != nil { - return nil, err - } - storeDecoder(typeptr, dec, decoderMap) - return dec, nil -} - -func decodeCompileHead(typ *rtype, structTypeToDecoder map[uintptr]decoder) (decoder, error) { - switch { - case rtype_ptrTo(typ).Implements(unmarshalJSONType): - return newUnmarshalJSONDecoder(rtype_ptrTo(typ), "", ""), nil - case rtype_ptrTo(typ).Implements(unmarshalTextType): - return newUnmarshalTextDecoder(rtype_ptrTo(typ), "", ""), nil - } - return decodeCompile(typ.Elem(), "", "", structTypeToDecoder) -} - -func decodeCompile(typ *rtype, structName, fieldName string, structTypeToDecoder map[uintptr]decoder) (decoder, error) { - switch { - case rtype_ptrTo(typ).Implements(unmarshalJSONType): - return newUnmarshalJSONDecoder(rtype_ptrTo(typ), structName, fieldName), nil - case rtype_ptrTo(typ).Implements(unmarshalTextType): - return newUnmarshalTextDecoder(rtype_ptrTo(typ), structName, fieldName), nil - } - - switch typ.Kind() { - case reflect.Ptr: - return decodeCompilePtr(typ, structName, fieldName, structTypeToDecoder) - case reflect.Struct: - return decodeCompileStruct(typ, structName, fieldName, structTypeToDecoder) - case reflect.Slice: - elem := typ.Elem() - if elem.Kind() == reflect.Uint8 { - return decodeCompileBytes(elem, structName, fieldName) - } - return decodeCompileSlice(typ, structName, fieldName, structTypeToDecoder) - case reflect.Array: - return decodeCompileArray(typ, structName, fieldName, structTypeToDecoder) - case reflect.Map: - return decodeCompileMap(typ, structName, fieldName, structTypeToDecoder) - case reflect.Interface: - return decodeCompileInterface(typ, structName, fieldName) - case reflect.Uintptr: - return decodeCompileUint(typ, structName, fieldName) - case reflect.Int: - return decodeCompileInt(typ, structName, fieldName) - case reflect.Int8: - return decodeCompileInt8(typ, structName, fieldName) - case reflect.Int16: - return decodeCompileInt16(typ, structName, fieldName) - case reflect.Int32: - return decodeCompileInt32(typ, structName, fieldName) - case reflect.Int64: - return decodeCompileInt64(typ, structName, fieldName) - case reflect.Uint: - return decodeCompileUint(typ, structName, fieldName) - case reflect.Uint8: - return decodeCompileUint8(typ, structName, fieldName) - case reflect.Uint16: - return decodeCompileUint16(typ, structName, fieldName) - case reflect.Uint32: - return decodeCompileUint32(typ, structName, fieldName) - case reflect.Uint64: - return decodeCompileUint64(typ, structName, fieldName) - case reflect.String: - return decodeCompileString(typ, structName, fieldName) - case reflect.Bool: - return decodeCompileBool(structName, fieldName) - case reflect.Float32: - return decodeCompileFloat32(structName, fieldName) - case reflect.Float64: - return decodeCompileFloat64(structName, fieldName) - } - return nil, &UnmarshalTypeError{ - Value: "object", - Type: rtype2type(typ), - Offset: 0, - } -} - -func isStringTagSupportedType(typ *rtype) bool { - switch { - case rtype_ptrTo(typ).Implements(unmarshalJSONType): - return false - case rtype_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 decodeCompileMapKey(typ *rtype, structName, fieldName string, structTypeToDecoder map[uintptr]decoder) (decoder, error) { - if rtype_ptrTo(typ).Implements(unmarshalTextType) { - return newUnmarshalTextDecoder(rtype_ptrTo(typ), structName, fieldName), nil - } - dec, err := decodeCompile(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: - goto ERROR - } - } -ERROR: - return nil, &UnmarshalTypeError{ - Value: "object", - Type: rtype2type(typ), - Offset: 0, - } -} - -func decodeCompilePtr(typ *rtype, structName, fieldName string, structTypeToDecoder map[uintptr]decoder) (decoder, error) { - dec, err := decodeCompile(typ.Elem(), structName, fieldName, structTypeToDecoder) - if err != nil { - return nil, err - } - return newPtrDecoder(dec, typ.Elem(), structName, fieldName), nil -} - -func decodeCompileInt(typ *rtype, structName, fieldName string) (decoder, error) { - return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) { - *(*int)(p) = int(v) - }), nil -} - -func decodeCompileInt8(typ *rtype, structName, fieldName string) (decoder, error) { - return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) { - *(*int8)(p) = int8(v) - }), nil -} - -func decodeCompileInt16(typ *rtype, structName, fieldName string) (decoder, error) { - return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) { - *(*int16)(p) = int16(v) - }), nil -} - -func decodeCompileInt32(typ *rtype, structName, fieldName string) (decoder, error) { - return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) { - *(*int32)(p) = int32(v) - }), nil -} - -func decodeCompileInt64(typ *rtype, structName, fieldName string) (decoder, error) { - return newIntDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v int64) { - *(*int64)(p) = v - }), nil -} - -func decodeCompileUint(typ *rtype, structName, fieldName string) (decoder, error) { - return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) { - *(*uint)(p) = uint(v) - }), nil -} - -func decodeCompileUint8(typ *rtype, structName, fieldName string) (decoder, error) { - return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) { - *(*uint8)(p) = uint8(v) - }), nil -} - -func decodeCompileUint16(typ *rtype, structName, fieldName string) (decoder, error) { - return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) { - *(*uint16)(p) = uint16(v) - }), nil -} - -func decodeCompileUint32(typ *rtype, structName, fieldName string) (decoder, error) { - return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) { - *(*uint32)(p) = uint32(v) - }), nil -} - -func decodeCompileUint64(typ *rtype, structName, fieldName string) (decoder, error) { - return newUintDecoder(typ, structName, fieldName, func(p unsafe.Pointer, v uint64) { - *(*uint64)(p) = v - }), nil -} - -func decodeCompileFloat32(structName, fieldName string) (decoder, error) { - return newFloatDecoder(structName, fieldName, func(p unsafe.Pointer, v float64) { - *(*float32)(p) = float32(v) - }), nil -} - -func decodeCompileFloat64(structName, fieldName string) (decoder, error) { - return newFloatDecoder(structName, fieldName, func(p unsafe.Pointer, v float64) { - *(*float64)(p) = v - }), nil -} - -func decodeCompileString(typ *rtype, structName, fieldName string) (decoder, error) { - if typ == type2rtype(jsonNumberType) { - return newNumberDecoder(structName, fieldName, func(p unsafe.Pointer, v Number) { - *(*Number)(p) = v - }), nil - } - return newStringDecoder(structName, fieldName), nil -} - -func decodeCompileBool(structName, fieldName string) (decoder, error) { - return newBoolDecoder(structName, fieldName), nil -} - -func decodeCompileBytes(typ *rtype, structName, fieldName string) (decoder, error) { - return newBytesDecoder(typ, structName, fieldName), nil -} - -func decodeCompileSlice(typ *rtype, structName, fieldName string, structTypeToDecoder map[uintptr]decoder) (decoder, error) { - elem := typ.Elem() - decoder, err := decodeCompile(elem, structName, fieldName, structTypeToDecoder) - if err != nil { - return nil, err - } - return newSliceDecoder(decoder, elem, elem.Size(), structName, fieldName), nil -} - -func decodeCompileArray(typ *rtype, structName, fieldName string, structTypeToDecoder map[uintptr]decoder) (decoder, error) { - elem := typ.Elem() - decoder, err := decodeCompile(elem, structName, fieldName, structTypeToDecoder) - if err != nil { - return nil, err - } - return newArrayDecoder(decoder, elem, typ.Len(), structName, fieldName), nil -} - -func decodeCompileMap(typ *rtype, structName, fieldName string, structTypeToDecoder map[uintptr]decoder) (decoder, error) { - keyDec, err := decodeCompileMapKey(typ.Key(), structName, fieldName, structTypeToDecoder) - if err != nil { - return nil, err - } - valueDec, err := decodeCompile(typ.Elem(), structName, fieldName, structTypeToDecoder) - if err != nil { - return nil, err - } - return newMapDecoder(typ, typ.Key(), keyDec, typ.Elem(), valueDec, structName, fieldName), nil -} - -func decodeCompileInterface(typ *rtype, structName, fieldName string) (decoder, error) { - return newInterfaceDecoder(typ, structName, fieldName), nil -} - -func decodeRemoveConflictFields(fieldMap map[string]*structFieldSet, conflictedMap map[string]struct{}, dec *structDecoder, field reflect.StructField) { - for k, v := range dec.fieldMap { - if _, exists := conflictedMap[k]; exists { - // already conflicted key - continue - } - set, exists := fieldMap[k] - if !exists { - fieldSet := &structFieldSet{ - dec: v.dec, - offset: field.Offset + v.offset, - isTaggedKey: v.isTaggedKey, - key: k, - keyLen: int64(len(k)), - } - fieldMap[k] = fieldSet - lower := strings.ToLower(k) - if _, exists := fieldMap[lower]; !exists { - fieldMap[lower] = fieldSet - } - continue - } - if set.isTaggedKey { - if v.isTaggedKey { - // conflict tag key - delete(fieldMap, k) - delete(fieldMap, strings.ToLower(k)) - conflictedMap[k] = struct{}{} - conflictedMap[strings.ToLower(k)] = struct{}{} - } - } else { - if v.isTaggedKey { - fieldSet := &structFieldSet{ - dec: v.dec, - offset: field.Offset + v.offset, - isTaggedKey: v.isTaggedKey, - key: k, - keyLen: int64(len(k)), - } - fieldMap[k] = fieldSet - lower := strings.ToLower(k) - if _, exists := fieldMap[lower]; !exists { - fieldMap[lower] = fieldSet - } - } else { - // conflict tag key - delete(fieldMap, k) - delete(fieldMap, strings.ToLower(k)) - conflictedMap[k] = struct{}{} - conflictedMap[strings.ToLower(k)] = struct{}{} - } - } - } -} - -func decodeCompileStruct(typ *rtype, structName, fieldName string, structTypeToDecoder map[uintptr]decoder) (decoder, error) { - fieldNum := typ.NumField() - conflictedMap := map[string]struct{}{} - 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() - 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 := decodeCompile(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 type2rtype(field.Type) == typ { - // recursive definition - continue - } - decodeRemoveConflictFields(fieldMap, conflictedMap, stDec, field) - } 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 _, exists := conflictedMap[k]; exists { - // already conflicted key - continue - } - set, exists := fieldMap[k] - if !exists { - fieldSet := &structFieldSet{ - dec: newAnonymousFieldDecoder(pdec.typ, v.offset, v.dec), - offset: field.Offset, - isTaggedKey: v.isTaggedKey, - key: k, - keyLen: int64(len(k)), - err: fieldSetErr, - } - fieldMap[k] = fieldSet - lower := strings.ToLower(k) - if _, exists := fieldMap[lower]; !exists { - fieldMap[lower] = fieldSet - } - continue - } - if set.isTaggedKey { - if v.isTaggedKey { - // conflict tag key - delete(fieldMap, k) - delete(fieldMap, strings.ToLower(k)) - conflictedMap[k] = struct{}{} - conflictedMap[strings.ToLower(k)] = struct{}{} - } - } else { - if v.isTaggedKey { - fieldSet := &structFieldSet{ - dec: newAnonymousFieldDecoder(pdec.typ, v.offset, v.dec), - offset: field.Offset, - isTaggedKey: v.isTaggedKey, - key: k, - keyLen: int64(len(k)), - err: fieldSetErr, - } - fieldMap[k] = fieldSet - lower := strings.ToLower(k) - if _, exists := fieldMap[lower]; !exists { - fieldMap[lower] = fieldSet - } - } else { - // conflict tag key - delete(fieldMap, k) - delete(fieldMap, strings.ToLower(k)) - conflictedMap[k] = struct{}{} - conflictedMap[strings.ToLower(k)] = struct{}{} - } - } - } - } - } - } else { - if tag.IsString && isStringTagSupportedType(type2rtype(field.Type)) { - dec = newWrappedStringDecoder(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)), - } - fieldMap[key] = fieldSet - lower := strings.ToLower(key) - if _, exists := fieldMap[lower]; !exists { - fieldMap[lower] = fieldSet - } - } - } - delete(structTypeToDecoder, typeptr) - structDec.tryOptimize() - return structDec, nil -} diff --git a/vendor/github.com/goccy/go-json/decode_compile_norace.go b/vendor/github.com/goccy/go-json/decode_compile_norace.go @@ -1,24 +0,0 @@ -// +build !race - -package json - -import "unsafe" - -func decodeCompileToGetDecoder(typ *rtype) (decoder, error) { - typeptr := uintptr(unsafe.Pointer(typ)) - if typeptr > maxTypeAddr { - return decodeCompileToGetDecoderSlowPath(typeptr, typ) - } - - index := (typeptr - baseTypeAddr) >> typeAddrShift - if dec := cachedDecoder[index]; dec != nil { - return dec, nil - } - - dec, err := decodeCompileHead(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/decode_compile_race.go b/vendor/github.com/goccy/go-json/decode_compile_race.go @@ -1,34 +0,0 @@ -// +build race - -package json - -import ( - "sync" - "unsafe" -) - -var decMu sync.RWMutex - -func decodeCompileToGetDecoder(typ *rtype) (decoder, error) { - typeptr := uintptr(unsafe.Pointer(typ)) - if typeptr > maxTypeAddr { - return decodeCompileToGetDecoderSlowPath(typeptr, typ) - } - - index := (typeptr - baseTypeAddr) >> typeAddrShift - decMu.RLock() - if dec := cachedDecoder[index]; dec != nil { - decMu.RUnlock() - return dec, nil - } - decMu.RUnlock() - - dec, err := decodeCompileHead(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/decode_context.go b/vendor/github.com/goccy/go-json/decode_context.go @@ -1,228 +0,0 @@ -package json - -import ( - "unsafe" -) - -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, errExceededMaxDepth(buf[cursor], cursor) - } - case '}': - depth-- - braceCount-- - if braceCount == 0 { - return cursor + 1, nil - } - case '[': - depth++ - if depth > maxDecodeNestingDepth { - return 0, errExceededMaxDepth(buf[cursor], cursor) - } - case ']': - depth-- - case '"': - for { - cursor++ - switch buf[cursor] { - case '\\': - cursor++ - if buf[cursor] == nul { - return 0, errUnexpectedEndOfJSON("string of object", cursor) - } - case '"': - goto SWITCH_OUT - case nul: - return 0, errUnexpectedEndOfJSON("string of object", cursor) - } - } - case nul: - return 0, 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, errExceededMaxDepth(buf[cursor], cursor) - } - case ']': - bracketCount-- - depth-- - if bracketCount == 0 { - return cursor + 1, nil - } - case '{': - depth++ - if depth > maxDecodeNestingDepth { - return 0, errExceededMaxDepth(buf[cursor], cursor) - } - case '}': - depth-- - case '"': - for { - cursor++ - switch buf[cursor] { - case '\\': - cursor++ - if buf[cursor] == nul { - return 0, errUnexpectedEndOfJSON("string of object", cursor) - } - case '"': - goto SWITCH_OUT - case nul: - return 0, errUnexpectedEndOfJSON("string of object", cursor) - } - } - case nul: - return 0, 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, errUnexpectedEndOfJSON("string of object", cursor) - } - case '"': - return cursor + 1, nil - case nul: - return 0, 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, errUnexpectedEndOfJSON("null", cursor) - } - } -} - -func validateTrue(buf []byte, cursor int64) error { - if cursor+3 >= int64(len(buf)) { - return errUnexpectedEndOfJSON("true", cursor) - } - if buf[cursor+1] != 'r' { - return errInvalidCharacter(buf[cursor+1], "true", cursor) - } - if buf[cursor+2] != 'u' { - return errInvalidCharacter(buf[cursor+2], "true", cursor) - } - if buf[cursor+3] != 'e' { - return errInvalidCharacter(buf[cursor+3], "true", cursor) - } - return nil -} - -func validateFalse(buf []byte, cursor int64) error { - if cursor+4 >= int64(len(buf)) { - return errUnexpectedEndOfJSON("false", cursor) - } - if buf[cursor+1] != 'a' { - return errInvalidCharacter(buf[cursor+1], "false", cursor) - } - if buf[cursor+2] != 'l' { - return errInvalidCharacter(buf[cursor+2], "false", cursor) - } - if buf[cursor+3] != 's' { - return errInvalidCharacter(buf[cursor+3], "false", cursor) - } - if buf[cursor+4] != 'e' { - return errInvalidCharacter(buf[cursor+4], "false", cursor) - } - return nil -} - -func validateNull(buf []byte, cursor int64) error { - if cursor+3 >= int64(len(buf)) { - return errUnexpectedEndOfJSON("null", cursor) - } - if buf[cursor+1] != 'u' { - return errInvalidCharacter(buf[cursor+1], "null", cursor) - } - if buf[cursor+2] != 'l' { - return errInvalidCharacter(buf[cursor+2], "null", cursor) - } - if buf[cursor+3] != 'l' { - return errInvalidCharacter(buf[cursor+3], "null", cursor) - } - return nil -} diff --git a/vendor/github.com/goccy/go-json/decode_float.go b/vendor/github.com/goccy/go-json/decode_float.go @@ -1,155 +0,0 @@ -package json - -import ( - "strconv" - "unsafe" -) - -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, 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, 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 errSyntax(err.Error(), s.totalOffset()) - } - d.op(p, f64) - return nil -} - -func (d *floatDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { - 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, errUnexpectedEndOfJSON("float", cursor) - } - s := *(*string)(unsafe.Pointer(&bytes)) - f64, err := strconv.ParseFloat(s, 64) - if err != nil { - return 0, errSyntax(err.Error(), cursor) - } - d.op(p, f64) - return cursor, nil -} diff --git a/vendor/github.com/goccy/go-json/decode_int.go b/vendor/github.com/goccy/go-json/decode_int.go @@ -1,235 +0,0 @@ -package json - -import ( - "fmt" - "reflect" - "unsafe" -) - -type intDecoder struct { - typ *rtype - kind reflect.Kind - op func(unsafe.Pointer, int64) - structName string - fieldName string -} - -func newIntDecoder(typ *rtype, 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) *UnmarshalTypeError { - return &UnmarshalTypeError{ - Value: fmt.Sprintf("number %s", string(buf)), - Type: 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, - } -) - -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 []byte{'0'}, 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, 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 []byte{'0'}, 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(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { - bytes, c, err := d.decodeByte(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 -} diff --git a/vendor/github.com/goccy/go-json/decode_interface.go b/vendor/github.com/goccy/go-json/decode_interface.go @@ -1,410 +0,0 @@ -package json - -import ( - "bytes" - "encoding" - "reflect" - "unsafe" -) - -type interfaceDecoder struct { - typ *rtype - 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 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 *rtype, 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 Number) { - *(*interface{})(p) = v - }), - stringDecoder: stringDecoder, - } -} - -func (d *interfaceDecoder) numDecoder(s *stream) decoder { - if s.useNumber { - return d.numberDecoder - } - return d.floatDecoder -} - -var ( - emptyInterfaceType = type2rtype(reflect.TypeOf((*interface{})(nil)).Elem()) - interfaceMapType = type2rtype( - reflect.TypeOf((*map[string]interface{})(nil)).Elem(), - ) - stringType = type2rtype( - reflect.TypeOf(""), - ) -) - -func decodeStreamUnmarshaler(s *stream, depth int64, unmarshaler 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 decodeUnmarshaler(buf []byte, cursor, depth int64, unmarshaler 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 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 { - s.skipWhiteSpace() - for { - switch s.char() { - 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); 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 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() { - continue - } - } - break - } - return errNotAtBeginningOfValue(s.totalOffset()) -} - -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().(Unmarshaler); ok { - return decodeStreamUnmarshaler(s, depth, u) - } - if u, ok := rv.Interface().(encoding.TextUnmarshaler); ok { - return decodeStreamTextUnmarshaler(s, depth, u, p) - } - s.skipWhiteSpace() - if s.char() == '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) - } - s.skipWhiteSpace() - if s.char() == 'n' { - if err := nullBytes(s); err != nil { - return err - } - *(*interface{})(p) = nil - return nil - } - decoder, err := decodeCompileToGetDecoder(typ) - if err != nil { - return err - } - return decoder.decodeStream(s, depth, ifaceHeader.ptr) -} - -func (d *interfaceDecoder) errUnmarshalType(typ reflect.Type, offset int64) *UnmarshalTypeError { - return &UnmarshalTypeError{ - Value: typ.String(), - Type: typ, - Offset: offset, - Struct: d.structName, - Field: d.fieldName, - } -} - -func (d *interfaceDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, 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().(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(buf, cursor, depth, p) - } - if typ.Kind() == reflect.Ptr && typ.Elem() == d.typ || typ.Kind() != reflect.Ptr { - return d.decodeEmptyInterface(buf, 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 := decodeCompileToGetDecoder(typ) - if err != nil { - return 0, err - } - return decoder.decode(buf, cursor, depth, ifaceHeader.ptr) -} - -func (d *interfaceDecoder) decodeEmptyInterface(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { - cursor = skipWhiteSpace(buf, cursor) - switch buf[cursor] { - case '{': - var v map[string]interface{} - ptr := unsafe.Pointer(&v) - cursor, err := d.mapDecoder.decode(buf, 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(buf, 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(buf, cursor, depth, p) - case '"': - var v string - ptr := unsafe.Pointer(&v) - cursor, err := d.stringDecoder.decode(buf, 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, errNotAtBeginningOfValue(cursor) -} diff --git a/vendor/github.com/goccy/go-json/decode_map.go b/vendor/github.com/goccy/go-json/decode_map.go @@ -1,154 +0,0 @@ -package json - -import ( - "unsafe" -) - -type mapDecoder struct { - mapType *rtype - keyType *rtype - valueType *rtype - keyDecoder decoder - valueDecoder decoder - structName string - fieldName string -} - -func newMapDecoder(mapType *rtype, keyType *rtype, keyDec decoder, valueType *rtype, valueDec decoder, structName, fieldName string) *mapDecoder { - return &mapDecoder{ - mapType: mapType, - keyDecoder: keyDec, - keyType: keyType, - valueType: valueType, - valueDecoder: valueDec, - structName: structName, - fieldName: fieldName, - } -} - -//go:linkname makemap reflect.makemap -func makemap(*rtype, int) unsafe.Pointer - -//go:linkname mapassign reflect.mapassign -//go:noescape -func mapassign(t *rtype, m unsafe.Pointer, key, val unsafe.Pointer) - -func (d *mapDecoder) decodeStream(s *stream, depth int64, p unsafe.Pointer) error { - depth++ - if depth > maxDecodeNestingDepth { - return errExceededMaxDepth(s.char(), s.cursor) - } - - s.skipWhiteSpace() - switch s.char() { - case 'n': - if err := nullBytes(s); err != nil { - return err - } - **(**unsafe.Pointer)(unsafe.Pointer(&p)) = nil - return nil - case '{': - default: - return errExpected("{ character for map value", s.totalOffset()) - } - s.skipWhiteSpace() - mapValue := *(*unsafe.Pointer)(p) - if mapValue == nil { - mapValue = makemap(d.mapType, 0) - } - if s.buf[s.cursor+1] == '}' { - *(*unsafe.Pointer)(p) = mapValue - s.cursor += 2 - return nil - } - for { - s.cursor++ - k := unsafe_New(d.keyType) - if err := d.keyDecoder.decodeStream(s, depth, k); err != nil { - return err - } - s.skipWhiteSpace() - if !s.equalChar(':') { - return 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 - } - 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 errExpected("comma after object value", s.totalOffset()) - } - } -} - -func (d *mapDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { - depth++ - if depth > maxDecodeNestingDepth { - return 0, errExceededMaxDepth(buf[cursor], cursor) - } - - cursor = skipWhiteSpace(buf, cursor) - buflen := int64(len(buf)) - if buflen < 2 { - return 0, 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, 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(buf, cursor, depth, k) - if err != nil { - return 0, err - } - cursor = skipWhiteSpace(buf, keyCursor) - if buf[cursor] != ':' { - return 0, errExpected("colon after object key", cursor) - } - cursor++ - v := unsafe_New(d.valueType) - valueCursor, err := d.valueDecoder.decode(buf, cursor, depth, v) - if err != nil { - return 0, err - } - 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, errExpected("comma after object value", cursor) - } - cursor++ - } -} diff --git a/vendor/github.com/goccy/go-json/decode_number.go b/vendor/github.com/goccy/go-json/decode_number.go @@ -1,105 +0,0 @@ -package json - -import ( - "strconv" - "unsafe" -) - -type numberDecoder struct { - stringDecoder *stringDecoder - op func(unsafe.Pointer, Number) - structName string - fieldName string -} - -func newNumberDecoder(structName, fieldName string, op func(unsafe.Pointer, 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 errSyntax(err.Error(), s.totalOffset()) - } - d.op(p, Number(string(bytes))) - s.reset() - return nil -} - -func (d *numberDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { - bytes, c, err := d.decodeByte(buf, cursor) - if err != nil { - return 0, err - } - if _, err := strconv.ParseFloat(*(*string)(unsafe.Pointer(&bytes)), 64); err != nil { - return 0, errSyntax(err.Error(), c) - } - cursor = c - s := *(*string)(unsafe.Pointer(&bytes)) - d.op(p, Number(s)) - return cursor, nil -} - -func (d *numberDecoder) 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 '"': - return d.stringDecoder.decodeStreamByte(s) - case nul: - if s.read() { - continue - } - goto ERROR - default: - goto ERROR - } - } -ERROR: - return nil, 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, errUnexpectedEndOfJSON("json.Number", cursor) - } - } -} diff --git a/vendor/github.com/goccy/go-json/decode_ptr.go b/vendor/github.com/goccy/go-json/decode_ptr.go @@ -1,85 +0,0 @@ -package json - -import ( - "unsafe" -) - -type ptrDecoder struct { - dec decoder - typ *rtype - structName string - fieldName string -} - -func newPtrDecoder(dec decoder, typ *rtype, 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(*rtype) unsafe.Pointer - -func (d *ptrDecoder) decodeStream(s *stream, depth int64, p unsafe.Pointer) error { - s.skipWhiteSpace() - if s.char() == 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(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { - 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(buf, cursor, depth, newptr) - if err != nil { - return 0, err - } - cursor = c - return cursor, nil -} diff --git a/vendor/github.com/goccy/go-json/decode_slice.go b/vendor/github.com/goccy/go-json/decode_slice.go @@ -1,291 +0,0 @@ -package json - -import ( - "reflect" - "sync" - "unsafe" -) - -type sliceDecoder struct { - elemType *rtype - 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 *rtype, 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 *rtype, dst, src sliceHeader) int - -//go:linkname newArray reflect.unsafe_NewArray -func newArray(*rtype, int) unsafe.Pointer - -//go:linkname typedmemmove reflect.typedmemmove -func typedmemmove(t *rtype, dst, src unsafe.Pointer) - -func (d *sliceDecoder) errNumber(offset int64) *UnmarshalTypeError { - return &UnmarshalTypeError{ - Value: "number", - Type: reflect.SliceOf(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 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 - } - *(*unsafe.Pointer)(p) = nil - return nil - case '[': - s.cursor++ - s.skipWhiteSpace() - if s.char() == ']' { - 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 errUnexpectedEndOfJSON("slice", s.totalOffset()) -} - -func (d *sliceDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { - depth++ - if depth > maxDecodeNestingDepth { - return 0, 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 - *(*unsafe.Pointer)(p) = nil - 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(buf, 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, 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, errUnexpectedEndOfJSON("slice", cursor) - } - } -} diff --git a/vendor/github.com/goccy/go-json/decode_stream.go b/vendor/github.com/goccy/go-json/decode_stream.go @@ -1,438 +0,0 @@ -package json - -import ( - "bytes" - "io" - "unsafe" -) - -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 -} - -func newStream(r io.Reader) *stream { - return &stream{ - r: r, - bufSize: initBufSize, - buf: []byte{nul}, - } -} - -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) 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) 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.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++ - } - 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 = s.cursor + 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() { -LOOP: - switch s.char() { - case ' ', '\n', '\t', '\r': - s.cursor++ - goto LOOP - case nul: - if s.read() { - goto LOOP - } - } -} - -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 errExceededMaxDepth(s.char(), s.cursor) - } - case '}': - braceCount-- - depth-- - if braceCount == 0 { - s.cursor = cursor + 1 - return nil - } - case '[': - depth++ - if depth > maxDecodeNestingDepth { - return 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.statForRetry() - continue - } - return errUnexpectedEndOfJSON("string of object", cursor) - } - case '"': - goto SWITCH_OUT - case nul: - s.cursor = cursor - if s.read() { - _, cursor, p = s.statForRetry() - continue - } - return errUnexpectedEndOfJSON("string of object", cursor) - } - } - case nul: - s.cursor = cursor - if s.read() { - _, cursor, p = s.stat() - continue - } - return 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 errExceededMaxDepth(s.char(), s.cursor) - } - case ']': - bracketCount-- - depth-- - if bracketCount == 0 { - s.cursor = cursor + 1 - return nil - } - case '{': - depth++ - if depth > maxDecodeNestingDepth { - return 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.statForRetry() - continue - } - return errUnexpectedEndOfJSON("string of object", cursor) - } - case '"': - goto SWITCH_OUT - case nul: - s.cursor = cursor - if s.read() { - _, cursor, p = s.statForRetry() - continue - } - return errUnexpectedEndOfJSON("string of object", cursor) - } - } - case nul: - s.cursor = cursor - if s.read() { - _, cursor, p = s.stat() - continue - } - return 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 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.statForRetry() - continue - } - return 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 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() { - s.cursor-- // for retry current character - _, 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 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 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 errInvalidCharacter(s.char(), "bool(false)", s.totalOffset()) -} diff --git a/vendor/github.com/goccy/go-json/decode_string.go b/vendor/github.com/goccy/go-json/decode_string.go @@ -1,355 +0,0 @@ -package json - -import ( - "reflect" - "unicode" - "unicode/utf16" - "unicode/utf8" - "unsafe" -) - -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) *UnmarshalTypeError { - return &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(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { - bytes, c, err := d.decodeByte(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 -} - -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 decodeUnicodeRune(s *stream) (rune, int64, error) { - const defaultOffset = 5 - const surrogateOffset = 11 - - if s.cursor+defaultOffset >= s.length { - if !s.read() { - return rune(0), 0, errInvalidCharacter(s.char(), "escaped string", s.totalOffset()) - } - } - - r := unicodeToRune(s.buf[s.cursor+1 : s.cursor+defaultOffset]) - if utf16.IsSurrogate(r) { - if s.cursor+surrogateOffset >= s.length { - s.read() - } - if s.cursor+surrogateOffset >= s.length || s.buf[s.cursor+defaultOffset] != '\\' || s.buf[s.cursor+defaultOffset+1] != 'u' { - return unicode.ReplacementChar, defaultOffset, nil - } - r2 := unicodeToRune(s.buf[s.cursor+defaultOffset+2 : s.cursor+surrogateOffset]) - if r := utf16.DecodeRune(r, r2); r != unicode.ReplacementChar { - return r, surrogateOffset, nil - } - } - return r, defaultOffset, nil -} - -func decodeUnicode(s *stream) error { - const backSlashAndULen = 2 // length of \u - - r, offset, err := decodeUnicodeRune(s) - if err != nil { - return 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 nil -} - -func decodeEscapeString(s *stream) 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) - case nul: - if !s.read() { - return errInvalidCharacter(s.char(), "escaped string", s.totalOffset()) - } - goto RETRY - default: - return errUnexpectedEndOfJSON("string", s.totalOffset()) - } - s.buf = append(s.buf[:s.cursor-1], s.buf[s.cursor:]...) - s.length-- - s.cursor-- - return 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 - if err := decodeEscapeString(s); err != nil { - return nil, err - } - 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 - r, _ := utf8.DecodeRune(s.buf[cursor:]) - b := []byte(string(r)) - if r == utf8.RuneError { - s.buf = append(append(append([]byte{}, s.buf[:cursor]...), b...), s.buf[cursor+1:]...) - _, _, p = s.stat() - } - cursor += int64(len(b)) - s.length += int64(len(b)) - continue - } - cursor++ - } -ERROR: - return nil, 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, errNotAtBeginningOfValue(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 - for { - switch char(b, cursor) { - case '\\': - cursor++ - switch char(b, cursor) { - case '"': - buf[cursor] = '"' - buf = append(buf[:cursor-1], buf[cursor:]...) - case '\\': - buf[cursor] = '\\' - buf = append(buf[:cursor-1], buf[cursor:]...) - case '/': - buf[cursor] = '/' - buf = append(buf[:cursor-1], buf[cursor:]...) - case 'b': - buf[cursor] = '\b' - buf = append(buf[:cursor-1], buf[cursor:]...) - case 'f': - buf[cursor] = '\f' - buf = append(buf[:cursor-1], buf[cursor:]...) - case 'n': - buf[cursor] = '\n' - buf = append(buf[:cursor-1], buf[cursor:]...) - case 'r': - buf[cursor] = '\r' - buf = append(buf[:cursor-1], buf[cursor:]...) - case 't': - buf[cursor] = '\t' - buf = append(buf[:cursor-1], buf[cursor:]...) - case 'u': - buflen := int64(len(buf)) - if cursor+5 >= buflen { - return nil, 0, errUnexpectedEndOfJSON("escaped string", cursor) - } - code := unicodeToRune(buf[cursor+1 : cursor+5]) - unicode := []byte(string(code)) - buf = append(append(buf[:cursor-1], unicode...), buf[cursor+5:]...) - default: - return nil, 0, errUnexpectedEndOfJSON("escaped string", cursor) - } - continue - case '"': - literal := buf[start:cursor] - cursor++ - return literal, cursor, nil - case nul: - return nil, 0, 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, errNotAtBeginningOfValue(cursor) - } - } -} diff --git a/vendor/github.com/goccy/go-json/decode_struct.go b/vendor/github.com/goccy/go-json/decode_struct.go @@ -1,623 +0,0 @@ -package json - -import ( - "fmt" - "math" - "math/bits" - "sort" - "strings" - "unsafe" -) - -type structFieldSet struct { - dec decoder - offset uintptr - isTaggedKey bool - key string - keyLen int64 - err error -} - -type structDecoder struct { - fieldMap map[string]*structFieldSet - 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 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() { - 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 { - // 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 - } -} - -func decodeKeyByBitmapUint8(d *structDecoder, buf []byte, cursor int64) (int64, *structFieldSet, error) { - var ( - field *structFieldSet - 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, field, nil - case nul: - return 0, nil, 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, errUnexpectedEndOfJSON("string", cursor) - default: - curBit &= bitmap[keyIdx][largeToSmallTable[c]] - if curBit == 0 { - for { - cursor++ - switch char(b, cursor) { - case '"': - cursor++ - return cursor, field, nil - case '\\': - cursor++ - if char(b, cursor) == nul { - return 0, nil, errUnexpectedEndOfJSON("string", cursor) - } - case nul: - return 0, nil, errUnexpectedEndOfJSON("string", cursor) - } - } - } - keyIdx++ - } - cursor++ - } - default: - return cursor, nil, errNotAtBeginningOfValue(cursor) - } - } -} - -func decodeKeyByBitmapUint16(d *structDecoder, buf []byte, cursor int64) (int64, *structFieldSet, error) { - var ( - field *structFieldSet - 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, field, nil - case nul: - return 0, nil, 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, errUnexpectedEndOfJSON("string", cursor) - default: - curBit &= bitmap[keyIdx][largeToSmallTable[c]] - if curBit == 0 { - for { - cursor++ - switch char(b, cursor) { - case '"': - cursor++ - return cursor, field, nil - case '\\': - cursor++ - if char(b, cursor) == nul { - return 0, nil, errUnexpectedEndOfJSON("string", cursor) - } - case nul: - return 0, nil, errUnexpectedEndOfJSON("string", cursor) - } - } - } - keyIdx++ - } - cursor++ - } - default: - return cursor, nil, errNotAtBeginningOfValue(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 ( - field *structFieldSet - curBit uint8 = math.MaxUint8 - ) - buf, cursor, p := s.stat() - for { - switch char(p, cursor) { - case ' ', '\n', '\t', '\r': - cursor++ - case nul: - s.cursor = cursor - if s.read() { - buf, cursor, p = s.stat() - continue - } - return nil, "", errNotAtBeginningOfValue(s.totalOffset()) - case '"': - cursor++ - FIRST_CHAR: - start := cursor - switch char(p, cursor) { - case '"': - cursor++ - s.cursor = cursor - return field, "", nil - case nul: - s.cursor = cursor - if s.read() { - buf, cursor, p = s.stat() - goto FIRST_CHAR - } - return nil, "", 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() { - buf, cursor, p = s.stat() - continue - } - return nil, "", errUnexpectedEndOfJSON("string", s.totalOffset()) - default: - curBit &= bitmap[keyIdx][largeToSmallTable[c]] - if curBit == 0 { - for { - cursor++ - switch char(p, cursor) { - case '"': - b := buf[start:cursor] - key := *(*string)(unsafe.Pointer(&b)) - cursor++ - s.cursor = cursor - return field, key, nil - case '\\': - cursor++ - if char(p, cursor) == nul { - s.cursor = cursor - if !s.read() { - return nil, "", errUnexpectedEndOfJSON("string", s.totalOffset()) - } - buf, cursor, p = s.statForRetry() - } - case nul: - s.cursor = cursor - if !s.read() { - return nil, "", errUnexpectedEndOfJSON("string", s.totalOffset()) - } - buf, cursor, p = s.statForRetry() - } - } - } - keyIdx++ - } - cursor++ - } - default: - return nil, "", errNotAtBeginningOfValue(s.totalOffset()) - } - } -} - -func decodeKeyByBitmapUint16Stream(d *structDecoder, s *stream) (*structFieldSet, string, error) { - var ( - field *structFieldSet - curBit uint16 = math.MaxUint16 - ) - buf, cursor, p := s.stat() - for { - switch char(p, cursor) { - case ' ', '\n', '\t', '\r': - cursor++ - case nul: - s.cursor = cursor - if s.read() { - buf, cursor, p = s.stat() - continue - } - return nil, "", errNotAtBeginningOfValue(s.totalOffset()) - case '"': - cursor++ - FIRST_CHAR: - start := cursor - switch char(p, cursor) { - case '"': - cursor++ - s.cursor = cursor - return field, "", nil - case nul: - s.cursor = cursor - if s.read() { - buf, cursor, p = s.stat() - goto FIRST_CHAR - } - return nil, "", 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() { - buf, cursor, p = s.stat() - continue - } - return nil, "", errUnexpectedEndOfJSON("string", s.totalOffset()) - default: - curBit &= bitmap[keyIdx][largeToSmallTable[c]] - if curBit == 0 { - for { - cursor++ - switch char(p, cursor) { - case '"': - b := buf[start:cursor] - key := *(*string)(unsafe.Pointer(&b)) - cursor++ - s.cursor = cursor - return field, key, nil - case '\\': - cursor++ - if char(p, cursor) == nul { - s.cursor = cursor - if !s.read() { - return nil, "", errUnexpectedEndOfJSON("string", s.totalOffset()) - } - buf, cursor, p = s.statForRetry() - } - case nul: - s.cursor = cursor - if !s.read() { - return nil, "", errUnexpectedEndOfJSON("string", s.totalOffset()) - } - buf, cursor, p = s.statForRetry() - } - } - } - keyIdx++ - } - cursor++ - } - default: - return nil, "", errNotAtBeginningOfValue(s.totalOffset()) - } - } -} - -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 errExceededMaxDepth(s.char(), s.cursor) - } - - s.skipWhiteSpace() - switch s.char() { - case 'n': - if err := nullBytes(s); err != nil { - return err - } - return nil - case nul: - s.read() - default: - if s.char() != '{' { - return errNotAtBeginningOfValue(s.totalOffset()) - } - } - s.cursor++ - s.skipWhiteSpace() - if s.char() == '}' { - s.cursor++ - return nil - } - for { - s.reset() - field, key, err := d.keyStreamDecoder(d, s) - if err != nil { - return err - } - s.skipWhiteSpace() - if s.char() != ':' { - return errExpected("colon after object key", s.totalOffset()) - } - s.cursor++ - if s.char() == nul { - if !s.read() { - return errExpected("object value after colon", s.totalOffset()) - } - } - if field != nil { - if field.err != nil { - return field.err - } - 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 - } - } - s.skipWhiteSpace() - c := s.char() - if c == '}' { - s.cursor++ - return nil - } - if c != ',' { - return errExpected("comma after object element", s.totalOffset()) - } - s.cursor++ - } -} - -func (d *structDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { - depth++ - if depth > maxDecodeNestingDepth { - return 0, 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, errNotAtBeginningOfValue(cursor) - } - cursor++ - cursor = skipWhiteSpace(buf, cursor) - if buf[cursor] == '}' { - cursor++ - return cursor, nil - } - 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, errExpected("colon after object key", cursor) - } - cursor++ - if cursor >= buflen { - return 0, errExpected("object value after colon", cursor) - } - if field != nil { - if field.err != nil { - return 0, field.err - } - c, err := field.dec.decode(buf, 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, errExpected("comma after object element", cursor) - } - cursor++ - } -} diff --git a/vendor/github.com/goccy/go-json/decode_uint.go b/vendor/github.com/goccy/go-json/decode_uint.go @@ -1,187 +0,0 @@ -package json - -import ( - "fmt" - "reflect" - "unsafe" -) - -type uintDecoder struct { - typ *rtype - kind reflect.Kind - op func(unsafe.Pointer, uint64) - structName string - fieldName string -} - -func newUintDecoder(typ *rtype, 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) *UnmarshalTypeError { - return &UnmarshalTypeError{ - Value: fmt.Sprintf("number %s", string(buf)), - Type: 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 []byte{'0'}, 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, 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 []byte{'0'}, 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(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { - bytes, c, err := d.decodeByte(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 -} diff --git a/vendor/github.com/goccy/go-json/decode_unmarshal_json.go b/vendor/github.com/goccy/go-json/decode_unmarshal_json.go @@ -1,72 +0,0 @@ -package json - -import ( - "unsafe" -) - -type unmarshalJSONDecoder struct { - typ *rtype - structName string - fieldName string -} - -func newUnmarshalJSONDecoder(typ *rtype, 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 *UnmarshalTypeError: - e.Struct = d.structName - e.Field = d.fieldName - case *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, - })) - if err := v.(Unmarshaler).UnmarshalJSON(dst); err != nil { - d.annotateError(s.cursor, err) - return err - } - return nil -} - -func (d *unmarshalJSONDecoder) decode(buf []byte, cursor, depth int64, 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] - dst := make([]byte, len(src)) - copy(dst, src) - - v := *(*interface{})(unsafe.Pointer(&emptyInterface{ - typ: d.typ, - ptr: p, - })) - if err := v.(Unmarshaler).UnmarshalJSON(dst); err != nil { - d.annotateError(cursor, err) - return 0, err - } - return end, nil -} diff --git a/vendor/github.com/goccy/go-json/decode_unmarshal_text.go b/vendor/github.com/goccy/go-json/decode_unmarshal_text.go @@ -1,276 +0,0 @@ -package json - -import ( - "bytes" - "encoding" - "unicode" - "unicode/utf16" - "unicode/utf8" - "unsafe" -) - -type unmarshalTextDecoder struct { - typ *rtype - structName string - fieldName string -} - -func newUnmarshalTextDecoder(typ *rtype, 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 *UnmarshalTypeError: - e.Struct = d.structName - e.Field = d.fieldName - case *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 &UnmarshalTypeError{ - Value: "array", - Type: rtype2type(d.typ), - Offset: s.totalOffset(), - } - case '{': - return &UnmarshalTypeError{ - Value: "object", - Type: rtype2type(d.typ), - Offset: s.totalOffset(), - } - case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - return &UnmarshalTypeError{ - Value: "number", - Type: 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(buf []byte, cursor, depth int64, 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 len(src) > 0 { - switch src[0] { - case '[': - return 0, &UnmarshalTypeError{ - Value: "array", - Type: rtype2type(d.typ), - Offset: start, - } - case '{': - return 0, &UnmarshalTypeError{ - Value: "object", - Type: rtype2type(d.typ), - Offset: start, - } - case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - return 0, &UnmarshalTypeError{ - Value: "number", - Type: 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 unquoteBytes(s []byte) (t []byte, ok bool) { - 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/decode_wrapped_string.go b/vendor/github.com/goccy/go-json/decode_wrapped_string.go @@ -1,63 +0,0 @@ -package json - -import ( - "reflect" - "unsafe" -) - -type wrappedStringDecoder struct { - typ *rtype - dec decoder - stringDecoder *stringDecoder - structName string - fieldName string - isPtrType bool -} - -func newWrappedStringDecoder(typ *rtype, 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(b, 0, depth, p); err != nil { - return err - } - return nil -} - -func (d *wrappedStringDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer) (int64, error) { - bytes, c, err := d.stringDecoder.decodeByte(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) - if _, err := d.dec.decode(bytes, 0, depth, p); err != nil { - return 0, err - } - return c, nil -} diff --git a/vendor/github.com/goccy/go-json/encode.go b/vendor/github.com/goccy/go-json/encode.go @@ -1,13 +1,14 @@ package json import ( + "context" "io" "unsafe" "github.com/goccy/go-json/internal/encoder" "github.com/goccy/go-json/internal/encoder/vm" - "github.com/goccy/go-json/internal/encoder/vm_escaped" - "github.com/goccy/go-json/internal/encoder/vm_escaped_indent" + "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" ) @@ -20,15 +21,6 @@ type Encoder struct { indentStr string } -type EncodeOption int - -const ( - EncodeOptionHTMLEscape EncodeOption = 1 << iota - EncodeOptionIndent - EncodeOptionUnorderedMap - EncodeOptionDebug -) - // NewEncoder returns a new encoder that writes to w. func NewEncoder(w io.Writer) *Encoder { return &Encoder{w: w, enabledHTMLEscape: true} @@ -44,6 +36,7 @@ func (e *Encoder) Encode(v interface{}) error { // 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...) @@ -51,22 +44,34 @@ func (e *Encoder) EncodeWithOption(v interface{}, optFuncs ...EncodeOptionFunc) 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...) + + encoder.ReleaseRuntimeContext(rctx) + return err +} + func (e *Encoder) encodeWithOption(ctx *encoder.RuntimeContext, v interface{}, optFuncs ...EncodeOptionFunc) error { - var opt EncodeOption if e.enabledHTMLEscape { - opt |= EncodeOptionHTMLEscape + ctx.Option.Flag |= encoder.HTMLEscapeOption } for _, optFunc := range optFuncs { - opt = optFunc(opt) + optFunc(ctx.Option) } var ( buf []byte err error ) if e.enabledIndent { - buf, err = encodeIndent(ctx, v, e.prefix, e.indentStr, opt) + buf, err = encodeIndent(ctx, v, e.prefix, e.indentStr) } else { - buf, err = encode(ctx, v, opt) + buf, err = encode(ctx, v) } if err != nil { return err @@ -103,10 +108,43 @@ func (e *Encoder) SetIndent(prefix, indent string) { e.enabledIndent = true } -func marshal(v interface{}, opt EncodeOption) ([]byte, error) { +func marshalContext(ctx context.Context, v interface{}, optFuncs ...EncodeOptionFunc) ([]byte, error) { + rctx := encoder.TakeRuntimeContext() + rctx.Option.Flag = 0 + rctx.Option.Flag = encoder.HTMLEscapeOption | encoder.ContextOption + rctx.Option.Context = ctx + for _, optFunc := range optFuncs { + optFunc(rctx.Option) + } + + buf, err := encode(rctx, v) + 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() - buf, err := encode(ctx, v, opt|EncodeOptionHTMLEscape) + ctx.Option.Flag = 0 + ctx.Option.Flag |= encoder.HTMLEscapeOption + for _, optFunc := range optFuncs { + optFunc(ctx.Option) + } + + buf, err := encode(ctx, v) if err != nil { encoder.ReleaseRuntimeContext(ctx) return nil, err @@ -124,10 +162,13 @@ func marshal(v interface{}, opt EncodeOption) ([]byte, error) { return copied, nil } -func marshalNoEscape(v interface{}, opt EncodeOption) ([]byte, error) { +func marshalNoEscape(v interface{}) ([]byte, error) { ctx := encoder.TakeRuntimeContext() - buf, err := encodeNoEscape(ctx, v, opt|EncodeOptionHTMLEscape) + ctx.Option.Flag = 0 + ctx.Option.Flag |= encoder.HTMLEscapeOption + + buf, err := encodeNoEscape(ctx, v) if err != nil { encoder.ReleaseRuntimeContext(ctx) return nil, err @@ -145,10 +186,16 @@ func marshalNoEscape(v interface{}, opt EncodeOption) ([]byte, error) { return copied, nil } -func marshalIndent(v interface{}, prefix, indent string, opt EncodeOption) ([]byte, error) { +func marshalIndent(v interface{}, prefix, indent string, optFuncs ...EncodeOptionFunc) ([]byte, error) { ctx := encoder.TakeRuntimeContext() - buf, err := encodeIndent(ctx, v, prefix, indent, opt|EncodeOptionHTMLEscape) + ctx.Option.Flag = 0 + ctx.Option.Flag |= (encoder.HTMLEscapeOption | 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 @@ -162,11 +209,11 @@ func marshalIndent(v interface{}, prefix, indent string, opt EncodeOption) ([]by return copied, nil } -func encode(ctx *encoder.RuntimeContext, v interface{}, opt EncodeOption) ([]byte, error) { +func encode(ctx *encoder.RuntimeContext, v interface{}) ([]byte, error) { b := ctx.Buf[:0] if v == nil { - b = encoder.AppendNull(b) - b = encoder.AppendComma(b) + b = encoder.AppendNull(ctx, b) + b = encoder.AppendComma(ctx, b) return b, nil } header := (*emptyInterface)(unsafe.Pointer(&v)) @@ -182,7 +229,7 @@ func encode(ctx *encoder.RuntimeContext, v interface{}, opt EncodeOption) ([]byt ctx.Init(p, codeSet.CodeLength) ctx.KeepRefs = append(ctx.KeepRefs, header.ptr) - buf, err := encodeRunCode(ctx, b, codeSet, opt) + buf, err := encodeRunCode(ctx, b, codeSet) if err != nil { return nil, err } @@ -190,11 +237,11 @@ func encode(ctx *encoder.RuntimeContext, v interface{}, opt EncodeOption) ([]byt return buf, nil } -func encodeNoEscape(ctx *encoder.RuntimeContext, v interface{}, opt EncodeOption) ([]byte, error) { +func encodeNoEscape(ctx *encoder.RuntimeContext, v interface{}) ([]byte, error) { b := ctx.Buf[:0] if v == nil { - b = encoder.AppendNull(b) - b = encoder.AppendComma(b) + b = encoder.AppendNull(ctx, b) + b = encoder.AppendComma(ctx, b) return b, nil } header := (*emptyInterface)(unsafe.Pointer(&v)) @@ -208,7 +255,7 @@ func encodeNoEscape(ctx *encoder.RuntimeContext, v interface{}, opt EncodeOption p := uintptr(header.ptr) ctx.Init(p, codeSet.CodeLength) - buf, err := encodeRunCode(ctx, b, codeSet, opt) + buf, err := encodeRunCode(ctx, b, codeSet) if err != nil { return nil, err } @@ -217,11 +264,11 @@ func encodeNoEscape(ctx *encoder.RuntimeContext, v interface{}, opt EncodeOption return buf, nil } -func encodeIndent(ctx *encoder.RuntimeContext, v interface{}, prefix, indent string, opt EncodeOption) ([]byte, error) { +func encodeIndent(ctx *encoder.RuntimeContext, v interface{}, prefix, indent string) ([]byte, error) { b := ctx.Buf[:0] if v == nil { - b = encoder.AppendNull(b) - b = encoder.AppendCommaIndent(b) + b = encoder.AppendNull(ctx, b) + b = encoder.AppendCommaIndent(ctx, b) return b, nil } header := (*emptyInterface)(unsafe.Pointer(&v)) @@ -235,7 +282,7 @@ func encodeIndent(ctx *encoder.RuntimeContext, v interface{}, prefix, indent str p := uintptr(header.ptr) ctx.Init(p, codeSet.CodeLength) - buf, err := encodeRunIndentCode(ctx, b, codeSet, prefix, indent, opt) + buf, err := encodeRunIndentCode(ctx, b, codeSet, prefix, indent) ctx.KeepRefs = append(ctx.KeepRefs, header.ptr) @@ -247,38 +294,30 @@ func encodeIndent(ctx *encoder.RuntimeContext, v interface{}, prefix, indent str return buf, nil } -func encodeRunCode(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt EncodeOption) ([]byte, error) { - if (opt & EncodeOptionDebug) != 0 { - return encodeDebugRunCode(ctx, b, codeSet, opt) +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 (opt & EncodeOptionHTMLEscape) != 0 { - return vm_escaped.Run(ctx, b, codeSet, encoder.Option(opt)) + if (ctx.Option.Flag & encoder.ColorizeOption) != 0 { + return vm_color.Run(ctx, b, codeSet) } - return vm.Run(ctx, b, codeSet, encoder.Option(opt)) + return vm.Run(ctx, b, codeSet) } -func encodeDebugRunCode(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt EncodeOption) ([]byte, error) { - if (opt & EncodeOptionHTMLEscape) != 0 { - return vm_escaped.DebugRun(ctx, b, codeSet, encoder.Option(opt)) - } - return vm.DebugRun(ctx, b, codeSet, encoder.Option(opt)) -} - -func encodeRunIndentCode(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, prefix, indent string, opt EncodeOption) ([]byte, error) { +func encodeRunIndentCode(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, prefix, indent string) ([]byte, error) { ctx.Prefix = []byte(prefix) ctx.IndentStr = []byte(indent) - if (opt & EncodeOptionDebug) != 0 { - return encodeDebugRunIndentCode(ctx, b, codeSet, opt) - } - if (opt & EncodeOptionHTMLEscape) != 0 { - return vm_escaped_indent.Run(ctx, b, codeSet, encoder.Option(opt)) + 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) } - return vm_indent.Run(ctx, b, codeSet, encoder.Option(opt)) -} - -func encodeDebugRunIndentCode(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt EncodeOption) ([]byte, error) { - if (opt & EncodeOptionHTMLEscape) != 0 { - return vm_escaped_indent.DebugRun(ctx, b, codeSet, encoder.Option(opt)) + if (ctx.Option.Flag & encoder.ColorizeOption) != 0 { + return vm_color_indent.Run(ctx, b, codeSet) } - return vm_indent.DebugRun(ctx, b, codeSet, encoder.Option(opt)) + 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 @@ -37,13 +37,3 @@ type UnmarshalTypeError = errors.UnmarshalTypeError type UnsupportedTypeError = errors.UnsupportedTypeError type UnsupportedValueError = errors.UnsupportedValueError - -var ( - errExceededMaxDepth = errors.ErrExceededMaxDepth - errNotAtBeginningOfValue = errors.ErrNotAtBeginningOfValue - errUnexpectedEndOfJSON = errors.ErrUnexpectedEndOfJSON - errExpected = errors.ErrExpected - errInvalidCharacter = errors.ErrInvalidCharacter - errSyntax = errors.ErrSyntax - errMarshaler = errors.ErrMarshaler -) diff --git a/vendor/github.com/goccy/go-json/go.mod b/vendor/github.com/goccy/go-json/go.mod @@ -1,3 +0,0 @@ -module github.com/goccy/go-json - -go 1.12 diff --git a/vendor/github.com/goccy/go-json/go.sum b/vendor/github.com/goccy/go-json/go.sum 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 @@ -0,0 +1,37 @@ +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)) +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/array.go b/vendor/github.com/goccy/go-json/internal/decoder/array.go @@ -0,0 +1,169 @@ +package decoder + +import ( + "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 { + zeroValue := *(*unsafe.Pointer)(unsafe_New(elemType)) + 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) + } + } +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/bool.go b/vendor/github.com/goccy/go-json/internal/decoder/bool.go @@ -0,0 +1,78 @@ +package decoder + +import ( + "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) +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/bytes.go b/vendor/github.com/goccy/go-json/internal/decoder/bytes.go @@ -0,0 +1,114 @@ +package decoder + +import ( + "encoding/base64" + "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) + } + if unmarshalDecoder == nil { + return nil + } + 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) 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 @@ -0,0 +1,510 @@ +package decoder + +import ( + "encoding/json" + "fmt" + "reflect" + "strings" + "sync/atomic" + "unicode" + "unsafe" + + "github.com/goccy/go-json/internal/errors" + "github.com/goccy/go-json/internal/runtime" +) + +var ( + jsonNumberType = reflect.TypeOf(json.Number("")) + typeAddr *runtime.TypeAddr + cachedDecoderMap unsafe.Pointer // map[uintptr]decoder + cachedDecoder []Decoder +) + +func init() { + typeAddr = runtime.AnalyzeTypeAddr() + if typeAddr == nil { + typeAddr = &runtime.TypeAddr{} + } + cachedDecoder = make([]Decoder, typeAddr.AddrRange>>typeAddr.AddrShift) +} + +func loadDecoderMap() map[uintptr]Decoder { + p := atomic.LoadPointer(&cachedDecoderMap) + return *(*map[uintptr]Decoder)(unsafe.Pointer(&p)) +} + +func storeDecoder(typ uintptr, dec Decoder, m map[uintptr]Decoder) { + 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 nil, &errors.UnmarshalTypeError{ + Value: "object", + Type: runtime.RType2Type(typ), + Offset: 0, + Struct: structName, + Field: fieldName, + } +} + +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 + } + 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: + goto ERROR + } + } +ERROR: + return nil, &errors.UnmarshalTypeError{ + Value: "object", + Type: runtime.RType2Type(typ), + Offset: 0, + Struct: structName, + Field: fieldName, + } +} + +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 removeConflictFields(fieldMap map[string]*structFieldSet, conflictedMap map[string]struct{}, dec *structDecoder, field reflect.StructField) { + for k, v := range dec.fieldMap { + if _, exists := conflictedMap[k]; exists { + // already conflicted key + continue + } + set, exists := fieldMap[k] + if !exists { + fieldSet := &structFieldSet{ + dec: v.dec, + offset: field.Offset + v.offset, + isTaggedKey: v.isTaggedKey, + key: k, + keyLen: int64(len(k)), + } + fieldMap[k] = fieldSet + lower := strings.ToLower(k) + if _, exists := fieldMap[lower]; !exists { + fieldMap[lower] = fieldSet + } + continue + } + if set.isTaggedKey { + if v.isTaggedKey { + // conflict tag key + delete(fieldMap, k) + delete(fieldMap, strings.ToLower(k)) + conflictedMap[k] = struct{}{} + conflictedMap[strings.ToLower(k)] = struct{}{} + } + } else { + if v.isTaggedKey { + fieldSet := &structFieldSet{ + dec: v.dec, + offset: field.Offset + v.offset, + isTaggedKey: v.isTaggedKey, + key: k, + keyLen: int64(len(k)), + } + fieldMap[k] = fieldSet + lower := strings.ToLower(k) + if _, exists := fieldMap[lower]; !exists { + fieldMap[lower] = fieldSet + } + } else { + // conflict tag key + delete(fieldMap, k) + delete(fieldMap, strings.ToLower(k)) + conflictedMap[k] = struct{}{} + conflictedMap[strings.ToLower(k)] = struct{}{} + } + } + } +} + +func compileStruct(typ *runtime.Type, structName, fieldName string, structTypeToDecoder map[uintptr]Decoder) (Decoder, error) { + fieldNum := typ.NumField() + conflictedMap := map[string]struct{}{} + 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() + 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 + } + removeConflictFields(fieldMap, conflictedMap, stDec, field) + } 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 _, exists := conflictedMap[k]; exists { + // already conflicted key + continue + } + set, exists := fieldMap[k] + if !exists { + fieldSet := &structFieldSet{ + dec: newAnonymousFieldDecoder(pdec.typ, v.offset, v.dec), + offset: field.Offset, + isTaggedKey: v.isTaggedKey, + key: k, + keyLen: int64(len(k)), + err: fieldSetErr, + } + fieldMap[k] = fieldSet + lower := strings.ToLower(k) + if _, exists := fieldMap[lower]; !exists { + fieldMap[lower] = fieldSet + } + continue + } + if set.isTaggedKey { + if v.isTaggedKey { + // conflict tag key + delete(fieldMap, k) + delete(fieldMap, strings.ToLower(k)) + conflictedMap[k] = struct{}{} + conflictedMap[strings.ToLower(k)] = struct{}{} + } + } else { + if v.isTaggedKey { + fieldSet := &structFieldSet{ + dec: newAnonymousFieldDecoder(pdec.typ, v.offset, v.dec), + offset: field.Offset, + isTaggedKey: v.isTaggedKey, + key: k, + keyLen: int64(len(k)), + err: fieldSetErr, + } + fieldMap[k] = fieldSet + lower := strings.ToLower(k) + if _, exists := fieldMap[lower]; !exists { + fieldMap[lower] = fieldSet + } + } else { + // conflict tag key + delete(fieldMap, k) + delete(fieldMap, strings.ToLower(k)) + conflictedMap[k] = struct{}{} + conflictedMap[strings.ToLower(k)] = struct{}{} + } + } + } + } + } + } 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)), + } + fieldMap[key] = fieldSet + lower := strings.ToLower(key) + if _, exists := fieldMap[lower]; !exists { + fieldMap[lower] = fieldSet + } + } + } + delete(structTypeToDecoder, typeptr) + structDec.tryOptimize() + return structDec, nil +} + +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 @@ -0,0 +1,28 @@ +// +build !race + +package decoder + +import ( + "unsafe" + + "github.com/goccy/go-json/internal/runtime" +) + +func CompileToGetDecoder(typ *runtime.Type) (Decoder, error) { + 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 @@ -0,0 +1,36 @@ +// +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) { + 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 @@ -0,0 +1,254 @@ +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 @@ -0,0 +1,158 @@ +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 +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/func.go b/vendor/github.com/goccy/go-json/internal/decoder/func.go @@ -0,0 +1,141 @@ +package decoder + +import ( + "bytes" + "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) +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/int.go b/vendor/github.com/goccy/go-json/internal/decoder/int.go @@ -0,0 +1,242 @@ +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 +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/interface.go b/vendor/github.com/goccy/go-json/internal/decoder/interface.go @@ -0,0 +1,458 @@ +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()) + 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) +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/map.go b/vendor/github.com/goccy/go-json/internal/decoder/map.go @@ -0,0 +1,186 @@ +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) + } + if s.buf[s.cursor+1] == '}' { + *(*unsafe.Pointer)(p) = mapValue + s.cursor += 2 + return nil + } + for { + s.cursor++ + 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()) + } + } +} + +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++ + } +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/number.go b/vendor/github.com/goccy/go-json/internal/decoder/number.go @@ -0,0 +1,112 @@ +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) 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 @@ -0,0 +1,15 @@ +package decoder + +import "context" + +type OptionFlags uint8 + +const ( + FirstWinOption OptionFlags = 1 << iota + ContextOption +) + +type Option struct { + Flags OptionFlags + Context context.Context +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/ptr.go b/vendor/github.com/goccy/go-json/internal/decoder/ptr.go @@ -0,0 +1,87 @@ +package decoder + +import ( + "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 (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 { + return 0, err + } + cursor = c + return cursor, nil +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/slice.go b/vendor/github.com/goccy/go-json/internal/decoder/slice.go @@ -0,0 +1,301 @@ +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) + } + } +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/stream.go b/vendor/github.com/goccy/go-json/internal/decoder/stream.go @@ -0,0 +1,554 @@ +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 = initBufSize +} + +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) + s := *(*string)(unsafe.Pointer(&bytes)) + f64, err := strconv.ParseFloat(s, 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.statForRetry() + 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.statForRetry() + 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.statForRetry() + 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() { + s.cursor-- // for retry current character + _, 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 @@ -0,0 +1,371 @@ +package decoder + +import ( + "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 +} + +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 decodeUnicodeRune(s *Stream, p unsafe.Pointer) (rune, int64, unsafe.Pointer, error) { + const defaultOffset = 5 + const surrogateOffset = 11 + + if s.cursor+defaultOffset >= s.length { + if !s.read() { + return rune(0), 0, nil, errors.ErrInvalidCharacter(s.char(), "escaped string", s.totalOffset()) + } + p = s.bufptr() + } + + r := unicodeToRune(s.buf[s.cursor+1 : s.cursor+defaultOffset]) + if utf16.IsSurrogate(r) { + if s.cursor+surrogateOffset >= s.length { + s.read() + p = s.bufptr() + } + if s.cursor+surrogateOffset >= s.length || 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()) + } + 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 + for { + switch char(b, cursor) { + case '\\': + cursor++ + switch char(b, cursor) { + case '"': + buf[cursor] = '"' + buf = append(buf[:cursor-1], buf[cursor:]...) + case '\\': + buf[cursor] = '\\' + buf = append(buf[:cursor-1], buf[cursor:]...) + case '/': + buf[cursor] = '/' + buf = append(buf[:cursor-1], buf[cursor:]...) + case 'b': + buf[cursor] = '\b' + buf = append(buf[:cursor-1], buf[cursor:]...) + case 'f': + buf[cursor] = '\f' + buf = append(buf[:cursor-1], buf[cursor:]...) + case 'n': + buf[cursor] = '\n' + buf = append(buf[:cursor-1], buf[cursor:]...) + case 'r': + buf[cursor] = '\r' + buf = append(buf[:cursor-1], buf[cursor:]...) + case 't': + buf[cursor] = '\t' + buf = append(buf[:cursor-1], buf[cursor:]...) + case 'u': + buflen := int64(len(buf)) + if cursor+5 >= buflen { + return nil, 0, errors.ErrUnexpectedEndOfJSON("escaped string", cursor) + } + code := unicodeToRune(buf[cursor+1 : cursor+5]) + unicode := []byte(string(code)) + buf = append(append(buf[:cursor-1], unicode...), buf[cursor+5:]...) + default: + return nil, 0, errors.ErrUnexpectedEndOfJSON("escaped string", cursor) + } + continue + case '"': + literal := buf[start:cursor] + 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) + } + } +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/struct.go b/vendor/github.com/goccy/go-json/internal/decoder/struct.go @@ -0,0 +1,819 @@ +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 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 { + // 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) { + const defaultOffset = 4 + const surrogateOffset = 6 + + 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 + } + cursor += 2 + r2 := unicodeToRune(buf[cursor : cursor+defaultOffset]) + if r := utf16.DecodeRune(r, r2); r != unicode.ReplacementChar { + return []byte(string(r)), cursor + defaultOffset - 1 + } + } + return []byte(string(r)), cursor + defaultOffset - 1 +} + +func decodeKeyCharByEscapedChar(buf []byte, cursor int64) ([]byte, int64) { + c := buf[cursor] + cursor++ + switch c { + case '"': + return []byte{'"'}, cursor + case '\\': + return []byte{'\\'}, cursor + case '/': + return []byte{'/'}, cursor + case 'b': + return []byte{'\b'}, cursor + case 'f': + return []byte{'\f'}, cursor + case 'n': + return []byte{'\n'}, cursor + case 'r': + return []byte{'\r'}, cursor + case 't': + return []byte{'\t'}, cursor + case 'u': + return decodeKeyCharByUnicodeRune(buf, cursor) + } + return nil, cursor +} + +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 := decodeKeyCharByEscapedChar(buf, cursor) + 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 := decodeKeyCharByEscapedChar(buf, cursor) + 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++ + } +} diff --git a/vendor/github.com/goccy/go-json/internal/decoder/type.go b/vendor/github.com/goccy/go-json/internal/decoder/type.go @@ -0,0 +1,29 @@ +package decoder + +import ( + "context" + "encoding" + "encoding/json" + "reflect" + "unsafe" +) + +type Decoder interface { + Decode(*RuntimeContext, int64, int64, unsafe.Pointer) (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 @@ -0,0 +1,190 @@ +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 +} 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 @@ -0,0 +1,91 @@ +package decoder + +import ( + "encoding/json" + "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, + })) + if (s.Option.Flags & ContextOption) != 0 { + if err := v.(unmarshalerContext).UnmarshalJSON(s.Option.Context, dst); err != nil { + d.annotateError(s.cursor, err) + return err + } + } else { + if err := v.(json.Unmarshaler).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 +} 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 @@ -0,0 +1,280 @@ +package decoder + +import ( + "bytes" + "encoding" + "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 unquoteBytes(s []byte) (t []byte, ok bool) { + 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 @@ -0,0 +1,68 @@ +package decoder + +import ( + "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 +} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/compiler.go b/vendor/github.com/goccy/go-json/internal/encoder/compiler.go @@ -1,6 +1,7 @@ package encoder import ( + "context" "encoding" "encoding/json" "fmt" @@ -13,13 +14,18 @@ import ( "github.com/goccy/go-json/internal/runtime" ) +type marshalerContext interface { + MarshalJSON(context.Context) ([]byte, error) +} + var ( - marshalJSONType = reflect.TypeOf((*json.Marshaler)(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 + 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 ) func init() { @@ -55,19 +61,36 @@ func compileToGetCodeSetSlowPath(typeptr uintptr) (*OpcodeSet, error) { // noescape trick for header.typ ( reflect.*rtype ) copiedType := *(**runtime.Type)(unsafe.Pointer(&typeptr)) - code, err := compileHead(&compileContext{ + noescapeKeyCode, err := compileHead(&compileContext{ + typ: copiedType, + structTypeToCompiledCode: map[uintptr]*CompiledCode{}, + }) + if err != nil { + return nil, err + } + escapeKeyCode, err := compileHead(&compileContext{ typ: copiedType, structTypeToCompiledCode: map[uintptr]*CompiledCode{}, + escapeKey: true, }) if err != nil { return nil, err } - code = copyOpcode(code) - codeLength := code.TotalLength() + noescapeKeyCode = copyOpcode(noescapeKeyCode) + escapeKeyCode = copyOpcode(escapeKeyCode) + setTotalLengthToInterfaceOp(noescapeKeyCode) + setTotalLengthToInterfaceOp(escapeKeyCode) + interfaceNoescapeKeyCode := copyToInterfaceOpcode(noescapeKeyCode) + interfaceEscapeKeyCode := copyToInterfaceOpcode(escapeKeyCode) + codeLength := noescapeKeyCode.TotalLength() codeSet := &OpcodeSet{ - Type: copiedType, - Code: code, - CodeLength: codeLength, + Type: copiedType, + NoescapeKeyCode: noescapeKeyCode, + EscapeKeyCode: escapeKeyCode, + InterfaceNoescapeKeyCode: interfaceNoescapeKeyCode, + InterfaceEscapeKeyCode: interfaceEscapeKeyCode, + CodeLength: codeLength, + EndCode: ToEndCode(interfaceNoescapeKeyCode), } storeOpcodeSet(typeptr, codeSet, opcodeMap) return codeSet, nil @@ -100,7 +123,7 @@ func compileHead(ctx *compileContext) (*Opcode, error) { elem := typ.Elem() if elem.Kind() == reflect.Uint8 { p := runtime.PtrTo(elem) - if !p.Implements(marshalJSONType) && !p.Implements(marshalTextType) { + if !implementsMarshalJSONType(p) && !p.Implements(marshalTextType) { if isPtr { return compileBytesPtr(ctx) } @@ -246,6 +269,7 @@ func linkRecursiveCode(c *Opcode) { continue } code.Jmp.Code = copyOpcode(code.Jmp.Code) + c := code.Jmp.Code c.End.Next = newEndOp(&compileContext{}) c.Op = c.Op.PtrHeadToHead() @@ -258,8 +282,8 @@ func linkRecursiveCode(c *Opcode) { lastCode.Length = lastCode.Idx + 2*uintptrSize // extend length to alloc slot for elemIdx + length - totalLength := uintptr(code.TotalLength() + 2) - nextTotalLength := uintptr(c.TotalLength() + 2) + totalLength := uintptr(code.TotalLength() + 3) + nextTotalLength := uintptr(c.TotalLength() + 3) c.End.Next.Op = OpRecursiveEnd @@ -268,6 +292,7 @@ func linkRecursiveCode(c *Opcode) { code.Jmp.Linked = true linkRecursiveCode(code.Jmp.Code) + code = code.Next continue } @@ -328,14 +353,14 @@ func optimizeStructEnd(c *Opcode) { } func implementsMarshalJSON(typ *runtime.Type) bool { - if !typ.Implements(marshalJSONType) { + if !implementsMarshalJSONType(typ) { return false } if typ.Kind() != reflect.Ptr { return true } // type kind is reflect.Ptr - if !typ.Elem().Implements(marshalJSONType) { + if !implementsMarshalJSONType(typ.Elem()) { return true } // needs to dereference @@ -372,7 +397,7 @@ func compile(ctx *compileContext, isPtr bool) (*Opcode, error) { elem := typ.Elem() if elem.Kind() == reflect.Uint8 { p := runtime.PtrTo(elem) - if !p.Implements(marshalJSONType) && !p.Implements(marshalTextType) { + if !implementsMarshalJSONType(p) && !p.Implements(marshalTextType) { return compileBytes(ctx) } } @@ -474,8 +499,6 @@ func compileKey(ctx *compileContext) (*Opcode, error) { switch typ.Kind() { case reflect.Ptr: return compilePtr(ctx) - case reflect.Interface: - return compileInterface(ctx) case reflect.String: return compileString(ctx) case reflect.Int: @@ -517,10 +540,17 @@ func compilePtr(ctx *compileContext) (*Opcode, error) { func compileMarshalJSON(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpMarshalJSON) typ := ctx.typ - if !typ.Implements(marshalJSONType) && runtime.PtrTo(typ).Implements(marshalJSONType) { - code.AddrForMarshaler = true + if isPtrMarshalJSONType(typ) { + code.Flags |= AddrForMarshalerFlags + } + if typ.Implements(marshalJSONContextType) || runtime.PtrTo(typ).Implements(marshalJSONContextType) { + code.Flags |= MarshalerContextFlags + } + if isNilableType(typ) { + code.Flags |= IsNilableTypeFlags + } else { + code.Flags &= ^IsNilableTypeFlags } - code.IsNilableType = isNilableType(typ) ctx.incIndex() return code, nil } @@ -529,9 +559,13 @@ func compileMarshalText(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpMarshalText) typ := ctx.typ if !typ.Implements(marshalTextType) && runtime.PtrTo(typ).Implements(marshalTextType) { - code.AddrForMarshaler = true + code.Flags |= AddrForMarshalerFlags + } + if isNilableType(typ) { + code.Flags |= IsNilableTypeFlags + } else { + code.Flags &= ^IsNilableTypeFlags } - code.IsNilableType = isNilableType(typ) ctx.incIndex() return code, nil } @@ -540,7 +574,7 @@ const intSize = 32 << (^uint(0) >> 63) func compileInt(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpInt) - code.setMaskAndRshiftNum(intSize) + code.NumBitSize = intSize ctx.incIndex() return code, nil } @@ -556,7 +590,7 @@ func compileIntPtr(ctx *compileContext) (*Opcode, error) { func compileInt8(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpInt) - code.setMaskAndRshiftNum(8) + code.NumBitSize = 8 ctx.incIndex() return code, nil } @@ -572,7 +606,7 @@ func compileInt8Ptr(ctx *compileContext) (*Opcode, error) { func compileInt16(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpInt) - code.setMaskAndRshiftNum(16) + code.NumBitSize = 16 ctx.incIndex() return code, nil } @@ -588,7 +622,7 @@ func compileInt16Ptr(ctx *compileContext) (*Opcode, error) { func compileInt32(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpInt) - code.setMaskAndRshiftNum(32) + code.NumBitSize = 32 ctx.incIndex() return code, nil } @@ -604,7 +638,7 @@ func compileInt32Ptr(ctx *compileContext) (*Opcode, error) { func compileInt64(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpInt) - code.setMaskAndRshiftNum(64) + code.NumBitSize = 64 ctx.incIndex() return code, nil } @@ -620,7 +654,7 @@ func compileInt64Ptr(ctx *compileContext) (*Opcode, error) { func compileUint(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUint) - code.setMaskAndRshiftNum(intSize) + code.NumBitSize = intSize ctx.incIndex() return code, nil } @@ -636,7 +670,7 @@ func compileUintPtr(ctx *compileContext) (*Opcode, error) { func compileUint8(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUint) - code.setMaskAndRshiftNum(8) + code.NumBitSize = 8 ctx.incIndex() return code, nil } @@ -652,7 +686,7 @@ func compileUint8Ptr(ctx *compileContext) (*Opcode, error) { func compileUint16(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUint) - code.setMaskAndRshiftNum(16) + code.NumBitSize = 16 ctx.incIndex() return code, nil } @@ -668,7 +702,7 @@ func compileUint16Ptr(ctx *compileContext) (*Opcode, error) { func compileUint32(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUint) - code.setMaskAndRshiftNum(32) + code.NumBitSize = 32 ctx.incIndex() return code, nil } @@ -684,7 +718,7 @@ func compileUint32Ptr(ctx *compileContext) (*Opcode, error) { func compileUint64(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUint) - code.setMaskAndRshiftNum(64) + code.NumBitSize = 64 ctx.incIndex() return code, nil } @@ -700,70 +734,70 @@ func compileUint64Ptr(ctx *compileContext) (*Opcode, error) { func compileIntString(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpIntString) - code.setMaskAndRshiftNum(intSize) + code.NumBitSize = intSize ctx.incIndex() return code, nil } func compileInt8String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpIntString) - code.setMaskAndRshiftNum(8) + code.NumBitSize = 8 ctx.incIndex() return code, nil } func compileInt16String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpIntString) - code.setMaskAndRshiftNum(16) + code.NumBitSize = 16 ctx.incIndex() return code, nil } func compileInt32String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpIntString) - code.setMaskAndRshiftNum(32) + code.NumBitSize = 32 ctx.incIndex() return code, nil } func compileInt64String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpIntString) - code.setMaskAndRshiftNum(64) + code.NumBitSize = 64 ctx.incIndex() return code, nil } func compileUintString(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUintString) - code.setMaskAndRshiftNum(intSize) + code.NumBitSize = intSize ctx.incIndex() return code, nil } func compileUint8String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUintString) - code.setMaskAndRshiftNum(8) + code.NumBitSize = 8 ctx.incIndex() return code, nil } func compileUint16String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUintString) - code.setMaskAndRshiftNum(16) + code.NumBitSize = 16 ctx.incIndex() return code, nil } func compileUint32String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUintString) - code.setMaskAndRshiftNum(32) + code.NumBitSize = 32 ctx.incIndex() return code, nil } func compileUint64String(ctx *compileContext) (*Opcode, error) { code := newOpCode(ctx, OpUintString) - code.setMaskAndRshiftNum(64) + code.NumBitSize = 64 ctx.incIndex() return code, nil } @@ -879,7 +913,7 @@ func compileSlice(ctx *compileContext) (*Opcode, error) { if err != nil { return nil, err } - code.Indirect = true + code.Flags |= IndirectFlags // header => opcode => elem => end // ^ | @@ -891,7 +925,6 @@ func compileSlice(ctx *compileContext) (*Opcode, error) { end := newOpCode(ctx, OpSliceEnd) ctx.incIndex() - header.Elem = elemCode header.End = end header.Next = code code.BeforeLastCode().Next = (*Opcode)(unsafe.Pointer(elemCode)) @@ -903,7 +936,7 @@ func compileSlice(ctx *compileContext) (*Opcode, error) { func compileListElem(ctx *compileContext) (*Opcode, error) { typ := ctx.typ switch { - case !typ.Implements(marshalJSONType) && runtime.PtrTo(typ).Implements(marshalJSONType): + case isPtrMarshalJSONType(typ): return compileMarshalJSON(ctx) case !typ.Implements(marshalTextType) && runtime.PtrTo(typ).Implements(marshalTextType): return compileMarshalText(ctx) @@ -934,7 +967,7 @@ func compileArray(ctx *compileContext) (*Opcode, error) { if err != nil { return nil, err } - code.Indirect = true + code.Flags |= IndirectFlags // header => opcode => elem => end // ^ | // |________| @@ -945,7 +978,6 @@ func compileArray(ctx *compileContext) (*Opcode, error) { end := newOpCode(ctx, OpArrayEnd) ctx.incIndex() - header.Elem = elemCode header.End = end header.Next = code code.BeforeLastCode().Next = (*Opcode)(unsafe.Pointer(elemCode)) @@ -976,16 +1008,13 @@ func compileMap(ctx *compileContext) (*Opcode, error) { if err != nil { return nil, err } - valueCode.Indirect = true + valueCode.Flags |= IndirectFlags key := newMapKeyCode(ctx, header) ctx.incIndex() ctx = ctx.decIndent() - header.MapKey = key - header.MapValue = value - end := newMapEndCode(ctx, header) ctx.incIndex() @@ -1052,8 +1081,7 @@ func compiledCode(ctx *compileContext) *Opcode { func structHeader(ctx *compileContext, fieldCode *Opcode, valueCode *Opcode, tag *runtime.StructTag) *Opcode { op := optimizeStructHeader(valueCode, tag) fieldCode.Op = op - fieldCode.Mask = valueCode.Mask - fieldCode.RshiftNum = valueCode.RshiftNum + fieldCode.NumBitSize = valueCode.NumBitSize fieldCode.PtrNum = valueCode.PtrNum if op.IsMultipleOpHead() { return valueCode.BeforeLastCode() @@ -1065,9 +1093,8 @@ func structHeader(ctx *compileContext, fieldCode *Opcode, valueCode *Opcode, tag func structField(ctx *compileContext, fieldCode *Opcode, valueCode *Opcode, tag *runtime.StructTag) *Opcode { op := optimizeStructField(valueCode, tag) fieldCode.Op = op + fieldCode.NumBitSize = valueCode.NumBitSize fieldCode.PtrNum = valueCode.PtrNum - fieldCode.Mask = valueCode.Mask - fieldCode.RshiftNum = valueCode.RshiftNum if op.IsMultipleOpField() { return valueCode.BeforeLastCode() } @@ -1082,7 +1109,7 @@ func isNotExistsField(head *Opcode) bool { if head.Op != OpStructHead { return false } - if !head.AnonymousHead { + if (head.Flags & AnonymousHeadFlags) == 0 { return false } if head.Next == nil { @@ -1117,7 +1144,7 @@ func optimizeAnonymousFields(head *Opcode) { if isNotExistsField(code.Next) { code.Next = code.NextField diff := code.Next.DisplayIdx - code.DisplayIdx - for i := 0; i < diff; i++ { + for i := uint32(0); i < diff; i++ { code.Next.decOpcodeIndex() } linkPrevToNextField(code, removedFields) @@ -1147,20 +1174,20 @@ func anonymousStructFieldPairMap(tags runtime.StructTags, named string, valueCod isHeadOp := strings.Contains(f.Op.String(), "Head") if existsKey && f.Next != nil && strings.Contains(f.Next.Op.String(), "Recursive") { // through - } else if isHeadOp && !f.AnonymousHead { + } else if isHeadOp && (f.Flags&AnonymousHeadFlags) == 0 { if existsKey { // TODO: need to remove this head f.Op = OpStructHead - f.AnonymousKey = true - f.AnonymousHead = true + f.Flags |= AnonymousKeyFlags + f.Flags |= AnonymousHeadFlags } else if named == "" { - f.AnonymousHead = true + f.Flags |= AnonymousHeadFlags } } else if named == "" && f.Op == OpStructEnd { f.Op = OpStructAnonymousEnd } else if existsKey { diff := f.NextField.DisplayIdx - f.DisplayIdx - for i := 0; i < diff; i++ { + for i := uint32(0); i < diff; i++ { f.NextField.decOpcodeIndex() } linkPrevToNextField(f, removedFields) @@ -1179,7 +1206,7 @@ func anonymousStructFieldPairMap(tags runtime.StructTags, named string, valueCod anonymousFields[key] = append(anonymousFields[key], structFieldPair{ prevField: prevAnonymousField, curField: f, - isTaggedKey: f.IsTaggedKey, + isTaggedKey: (f.Flags & IsTaggedKeyFlags) != 0, }) if f.Next != nil && f.NextField != f.Next && f.Next.Op.CodeType() == CodeStructField { for k, v := range anonymousFieldPairRecursively(named, f.Next) { @@ -1200,12 +1227,12 @@ func anonymousFieldPairRecursively(named string, valueCode *Opcode) map[string][ f := valueCode var prevAnonymousField *Opcode for { - if f.DisplayKey != "" && f.AnonymousHead { + if f.DisplayKey != "" && (f.Flags&AnonymousHeadFlags) != 0 { key := fmt.Sprintf("%s.%s", named, f.DisplayKey) anonymousFields[key] = append(anonymousFields[key], structFieldPair{ prevField: prevAnonymousField, curField: f, - isTaggedKey: f.IsTaggedKey, + isTaggedKey: (f.Flags & IsTaggedKeyFlags) != 0, }) if f.Next != nil && f.NextField != f.Next && f.Next.Op.CodeType() == CodeStructField { for k, v := range anonymousFieldPairRecursively(named, f.Next) { @@ -1238,11 +1265,11 @@ func optimizeConflictAnonymousFields(anonymousFields map[string][]structFieldPai if fieldPair.prevField == nil { // head operation fieldPair.curField.Op = OpStructHead - fieldPair.curField.AnonymousHead = true - fieldPair.curField.AnonymousKey = true + fieldPair.curField.Flags |= AnonymousHeadFlags + fieldPair.curField.Flags |= AnonymousKeyFlags } else { diff := fieldPair.curField.NextField.DisplayIdx - fieldPair.curField.DisplayIdx - for i := 0; i < diff; i++ { + for i := uint32(0); i < diff; i++ { fieldPair.curField.NextField.decOpcodeIndex() } removedFields[fieldPair.curField] = struct{}{} @@ -1258,12 +1285,12 @@ func optimizeConflictAnonymousFields(anonymousFields map[string][]structFieldPai if fieldPair.prevField == nil { // head operation fieldPair.curField.Op = OpStructHead - fieldPair.curField.AnonymousHead = true - fieldPair.curField.AnonymousKey = true + fieldPair.curField.Flags |= AnonymousHeadFlags + fieldPair.curField.Flags |= AnonymousKeyFlags } else { diff := fieldPair.curField.NextField.DisplayIdx - fieldPair.curField.DisplayIdx removedFields[fieldPair.curField] = struct{}{} - for i := 0; i < diff; i++ { + for i := uint32(0); i < diff; i++ { fieldPair.curField.NextField.decOpcodeIndex() } linkPrevToNextField(fieldPair.curField, removedFields) @@ -1273,7 +1300,7 @@ func optimizeConflictAnonymousFields(anonymousFields map[string][]structFieldPai } } else { for _, fieldPair := range taggedPairs { - fieldPair.curField.IsTaggedKey = false + fieldPair.curField.Flags &= ^IsTaggedKeyFlags } } } @@ -1390,7 +1417,7 @@ func compileStruct(ctx *compileContext, isPtr bool) (*Opcode, error) { valueCode = code } - if field.Anonymous { + if field.Anonymous && !tag.IsTaggedKey { tagKey := "" if tag.IsTaggedKey { tagKey = tag.Key @@ -1398,50 +1425,76 @@ func compileStruct(ctx *compileContext, isPtr bool) (*Opcode, error) { for k, v := range anonymousStructFieldPairMap(tags, tagKey, valueCode) { anonymousFields[k] = append(anonymousFields[k], v...) } + valueCode.decIndent() // fix issue144 if !(isPtr && strings.Contains(valueCode.Op.String(), "Marshal")) { - valueCode.Indirect = indirect + if indirect { + valueCode.Flags |= IndirectFlags + } else { + valueCode.Flags &= ^IndirectFlags + } } } else { if indirect { // if parent is indirect type, set child indirect property to true - valueCode.Indirect = indirect + valueCode.Flags |= IndirectFlags } else { - // if parent is not indirect type and child have only one field, set child indirect property to false - if i == 0 && valueCode.NextField != nil && valueCode.NextField.Op == OpStructEnd { - valueCode.Indirect = indirect + // 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. + if i == 0 { + valueCode.Flags &= ^IndirectFlags } } } - key := fmt.Sprintf(`"%s":`, tag.Key) - escapedKey := fmt.Sprintf(`%s:`, string(AppendEscapedString([]byte{}, tag.Key))) + var flags OpFlags + if indirect { + flags |= IndirectFlags + } + if field.Anonymous { + flags |= AnonymousKeyFlags + } + if tag.IsTaggedKey { + flags |= IsTaggedKeyFlags + } + if nilcheck { + flags |= NilCheckFlags + } + if addrForMarshaler { + flags |= AddrForMarshalerFlags + } + if strings.Contains(valueCode.Op.String(), "Ptr") || valueCode.Op == OpInterface { + flags |= IsNextOpPtrTypeFlags + } + if isNilableType { + flags |= IsNilableTypeFlags + } + var key string + if ctx.escapeKey { + rctx := &RuntimeContext{Option: &Option{Flag: HTMLEscapeOption}} + key = fmt.Sprintf(`%s:`, string(AppendString(rctx, []byte{}, tag.Key))) + } else { + key = fmt.Sprintf(`"%s":`, tag.Key) + } fieldCode := &Opcode{ - Type: valueCode.Type, - DisplayIdx: fieldOpcodeIndex, - Idx: opcodeOffset(fieldPtrIndex), - Next: valueCode, - Indent: ctx.indent, - AnonymousKey: field.Anonymous, - Key: []byte(key), - EscapedKey: []byte(escapedKey), - IsTaggedKey: tag.IsTaggedKey, - DisplayKey: tag.Key, - Offset: field.Offset, - Indirect: indirect, - Nilcheck: nilcheck, - AddrForMarshaler: addrForMarshaler, - IsNextOpPtrType: strings.Contains(valueCode.Op.String(), "Ptr") || valueCode.Op == OpInterface, - IsNilableType: isNilableType, + Idx: opcodeOffset(fieldPtrIndex), + Next: valueCode, + Flags: flags, + Key: key, + Offset: uint32(field.Offset), + Type: valueCode.Type, + DisplayIdx: fieldOpcodeIndex, + Indent: ctx.indent, + DisplayKey: tag.Key, } if fieldIdx == 0 { - fieldCode.HeadIdx = fieldCode.Idx code = structHeader(ctx, fieldCode, valueCode, tag) head = fieldCode prevField = fieldCode } else { - fieldCode.HeadIdx = head.HeadIdx + fieldCode.Idx = head.Idx code.Next = fieldCode code = structField(ctx, fieldCode, valueCode, tag) prevField.NextField = fieldCode @@ -1455,7 +1508,6 @@ func compileStruct(ctx *compileContext, isPtr bool) (*Opcode, error) { Op: OpStructEnd, Type: nil, Indent: ctx.indent, - Next: newEndOp(ctx), } ctx = ctx.decIndent() @@ -1464,12 +1516,11 @@ func compileStruct(ctx *compileContext, isPtr bool) (*Opcode, error) { if head == nil { head = &Opcode{ Op: OpStructHead, + Idx: opcodeOffset(ctx.ptrIndex), + NextField: structEndCode, Type: typ, DisplayIdx: ctx.opcodeIndex, - Idx: opcodeOffset(ctx.ptrIndex), - HeadIdx: opcodeOffset(ctx.ptrIndex), Indent: ctx.indent, - NextField: structEndCode, } structEndCode.PrevField = head ctx.incIndex() @@ -1479,6 +1530,7 @@ func compileStruct(ctx *compileContext, isPtr bool) (*Opcode, error) { structEndCode.DisplayIdx = ctx.opcodeIndex structEndCode.Idx = opcodeOffset(ctx.ptrIndex) ctx.incIndex() + structEndCode.Next = newEndOp(ctx) if prevField != nil && prevField.NextField == nil { prevField.NextField = structEndCode @@ -1494,15 +1546,23 @@ func compileStruct(ctx *compileContext, isPtr bool) (*Opcode, error) { delete(ctx.structTypeToCompiledCode, typeptr) - if !disableIndirectConversion && !head.Indirect && isPtr { - head.Indirect = true + if !disableIndirectConversion && (head.Flags&IndirectFlags == 0) && isPtr { + headCode := head + for strings.Contains(headCode.Op.String(), "Head") { + headCode.Flags |= IndirectFlags + headCode = headCode.Next + } } return ret, nil } +func implementsMarshalJSONType(typ *runtime.Type) bool { + return typ.Implements(marshalJSONType) || typ.Implements(marshalJSONContextType) +} + func isPtrMarshalJSONType(typ *runtime.Type) bool { - return !typ.Implements(marshalJSONType) && runtime.PtrTo(typ).Implements(marshalJSONType) + return !implementsMarshalJSONType(typ) && implementsMarshalJSONType(runtime.PtrTo(typ)) } func isPtrMarshalTextType(typ *runtime.Type) bool { 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 @@ -20,19 +20,36 @@ func CompileToGetCodeSet(typeptr uintptr) (*OpcodeSet, error) { // noescape trick for header.typ ( reflect.*rtype ) copiedType := *(**runtime.Type)(unsafe.Pointer(&typeptr)) - code, err := compileHead(&compileContext{ + noescapeKeyCode, err := compileHead(&compileContext{ typ: copiedType, structTypeToCompiledCode: map[uintptr]*CompiledCode{}, }) if err != nil { return nil, err } - code = copyOpcode(code) - codeLength := code.TotalLength() + escapeKeyCode, err := compileHead(&compileContext{ + typ: copiedType, + structTypeToCompiledCode: map[uintptr]*CompiledCode{}, + escapeKey: true, + }) + if err != nil { + return nil, err + } + noescapeKeyCode = copyOpcode(noescapeKeyCode) + escapeKeyCode = copyOpcode(escapeKeyCode) + setTotalLengthToInterfaceOp(noescapeKeyCode) + setTotalLengthToInterfaceOp(escapeKeyCode) + interfaceNoescapeKeyCode := copyToInterfaceOpcode(noescapeKeyCode) + interfaceEscapeKeyCode := copyToInterfaceOpcode(escapeKeyCode) + codeLength := noescapeKeyCode.TotalLength() codeSet := &OpcodeSet{ - Type: copiedType, - Code: code, - CodeLength: codeLength, + Type: copiedType, + NoescapeKeyCode: noescapeKeyCode, + EscapeKeyCode: escapeKeyCode, + InterfaceNoescapeKeyCode: interfaceNoescapeKeyCode, + InterfaceEscapeKeyCode: interfaceEscapeKeyCode, + CodeLength: codeLength, + EndCode: ToEndCode(interfaceNoescapeKeyCode), } cachedOpcodeSets[index] = codeSet return codeSet, 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 @@ -26,19 +26,37 @@ func CompileToGetCodeSet(typeptr uintptr) (*OpcodeSet, error) { // noescape trick for header.typ ( reflect.*rtype ) copiedType := *(**runtime.Type)(unsafe.Pointer(&typeptr)) - code, err := compileHead(&compileContext{ + noescapeKeyCode, err := compileHead(&compileContext{ typ: copiedType, structTypeToCompiledCode: map[uintptr]*CompiledCode{}, }) if err != nil { return nil, err } - code = copyOpcode(code) - codeLength := code.TotalLength() + escapeKeyCode, err := compileHead(&compileContext{ + typ: copiedType, + structTypeToCompiledCode: map[uintptr]*CompiledCode{}, + escapeKey: true, + }) + if err != nil { + return nil, err + } + + noescapeKeyCode = copyOpcode(noescapeKeyCode) + escapeKeyCode = copyOpcode(escapeKeyCode) + setTotalLengthToInterfaceOp(noescapeKeyCode) + setTotalLengthToInterfaceOp(escapeKeyCode) + interfaceNoescapeKeyCode := copyToInterfaceOpcode(noescapeKeyCode) + interfaceEscapeKeyCode := copyToInterfaceOpcode(escapeKeyCode) + codeLength := noescapeKeyCode.TotalLength() codeSet := &OpcodeSet{ - Type: copiedType, - Code: code, - CodeLength: codeLength, + Type: copiedType, + NoescapeKeyCode: noescapeKeyCode, + EscapeKeyCode: escapeKeyCode, + InterfaceNoescapeKeyCode: interfaceNoescapeKeyCode, + InterfaceEscapeKeyCode: interfaceEscapeKeyCode, + CodeLength: codeLength, + EndCode: ToEndCode(interfaceNoescapeKeyCode), } setsMu.Lock() cachedOpcodeSets[index] = codeSet diff --git a/vendor/github.com/goccy/go-json/internal/encoder/context.go b/vendor/github.com/goccy/go-json/internal/encoder/context.go @@ -1,6 +1,7 @@ package encoder import ( + "context" "sync" "unsafe" @@ -9,9 +10,10 @@ import ( type compileContext struct { typ *runtime.Type - opcodeIndex int + opcodeIndex uint32 ptrIndex int - indent int + indent uint32 + escapeKey bool structTypeToCompiledCode map[uintptr]*CompiledCode parent *compileContext @@ -23,6 +25,7 @@ func (c *compileContext) context() *compileContext { opcodeIndex: c.opcodeIndex, ptrIndex: c.ptrIndex, indent: c.indent, + escapeKey: c.escapeKey, structTypeToCompiledCode: c.structTypeToCompiledCode, parent: c, } @@ -95,20 +98,23 @@ var ( 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 int + BaseIndent uint32 Prefix []byte IndentStr []byte + Option *Option } func (c *RuntimeContext) Init(p uintptr, codelen int) { diff --git a/vendor/github.com/goccy/go-json/internal/encoder/encoder.go b/vendor/github.com/goccy/go-json/internal/encoder/encoder.go @@ -17,14 +17,6 @@ import ( "github.com/goccy/go-json/internal/runtime" ) -type Option int - -const ( - HTMLEscapeOption Option = 1 << iota - IndentOption - UnorderedMapOption -) - func (t OpType) IsMultipleOpHead() bool { switch t { case OpStructHead: @@ -102,9 +94,13 @@ func (t OpType) IsMultipleOpField() bool { } type OpcodeSet struct { - Type *runtime.Type - Code *Opcode - CodeLength int + Type *runtime.Type + NoescapeKeyCode *Opcode + EscapeKeyCode *Opcode + InterfaceNoescapeKeyCode *Opcode + InterfaceEscapeKeyCode *Opcode + CodeLength int + EndCode *Opcode } type CompiledCode struct { @@ -276,7 +272,7 @@ func MapIterNext(it unsafe.Pointer) //go:noescape func MapLen(m unsafe.Pointer) int -func AppendByteSlice(b []byte, src []byte) []byte { +func AppendByteSlice(_ *RuntimeContext, b []byte, src []byte) []byte { if src == nil { return append(b, `null`...) } @@ -294,7 +290,7 @@ func AppendByteSlice(b []byte, src []byte) []byte { return append(append(b, buf...), '"') } -func AppendFloat32(b []byte, v float32) []byte { +func AppendFloat32(_ *RuntimeContext, b []byte, v float32) []byte { f64 := float64(v) abs := math.Abs(f64) fmt := byte('f') @@ -308,7 +304,7 @@ func AppendFloat32(b []byte, v float32) []byte { return strconv.AppendFloat(b, f64, fmt, -1, 32) } -func AppendFloat64(b []byte, v float64) []byte { +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. @@ -320,7 +316,7 @@ func AppendFloat64(b []byte, v float64) []byte { return strconv.AppendFloat(b, v, fmt, -1, 64) } -func AppendBool(b []byte, v bool) []byte { +func AppendBool(_ *RuntimeContext, b []byte, v bool) []byte { if v { return append(b, "true"...) } @@ -347,7 +343,7 @@ var ( } ) -func AppendNumber(b []byte, n json.Number) ([]byte, error) { +func AppendNumber(_ *RuntimeContext, b []byte, n json.Number) ([]byte, error) { if len(n) == 0 { return append(b, '0'), nil } @@ -360,9 +356,9 @@ func AppendNumber(b []byte, n json.Number) ([]byte, error) { return b, nil } -func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}, escape bool) ([]byte, error) { +func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) { rv := reflect.ValueOf(v) // convert by dynamic interface type - if code.AddrForMarshaler { + if (code.Flags & AddrForMarshalerFlags) != 0 { if rv.CanAddr() { rv = rv.Addr() } else { @@ -372,17 +368,31 @@ func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{ } } v = rv.Interface() - marshaler, ok := v.(json.Marshaler) - if !ok { - return AppendNull(b), nil - } - bb, err := marshaler.MarshalJSON() - if err != nil { - return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} + 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) - compactedBuf, err := compact(b, marshalBuf, escape) + compactedBuf, err := compact(b, marshalBuf, (ctx.Option.Flag&HTMLEscapeOption) != 0) if err != nil { return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} } @@ -390,9 +400,9 @@ func AppendMarshalJSON(ctx *RuntimeContext, code *Opcode, b []byte, v interface{ return compactedBuf, nil } -func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}, escape bool) ([]byte, error) { +func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) { rv := reflect.ValueOf(v) // convert by dynamic interface type - if code.AddrForMarshaler { + if (code.Flags & AddrForMarshalerFlags) != 0 { if rv.CanAddr() { rv = rv.Addr() } else { @@ -402,22 +412,36 @@ func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v inte } } v = rv.Interface() - marshaler, ok := v.(json.Marshaler) - if !ok { - return AppendNull(b), nil - } - bb, err := marshaler.MarshalJSON() - if err != nil { - return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} + 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), ctx.BaseIndent+code.Indent), + string(ctx.Prefix)+strings.Repeat(string(ctx.IndentStr), int(ctx.BaseIndent+code.Indent)), string(ctx.IndentStr), - escape, + (ctx.Option.Flag&HTMLEscapeOption) != 0, ) if err != nil { return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} @@ -426,9 +450,9 @@ func AppendMarshalJSONIndent(ctx *RuntimeContext, code *Opcode, b []byte, v inte return indentedBuf, nil } -func AppendMarshalText(code *Opcode, b []byte, v interface{}, escape bool) ([]byte, error) { +func AppendMarshalText(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) { rv := reflect.ValueOf(v) // convert by dynamic interface type - if code.AddrForMarshaler { + if (code.Flags & AddrForMarshalerFlags) != 0 { if rv.CanAddr() { rv = rv.Addr() } else { @@ -440,21 +464,18 @@ func AppendMarshalText(code *Opcode, b []byte, v interface{}, escape bool) ([]by v = rv.Interface() marshaler, ok := v.(encoding.TextMarshaler) if !ok { - return AppendNull(b), nil + return AppendNull(ctx, b), nil } bytes, err := marshaler.MarshalText() if err != nil { return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} } - if escape { - return AppendEscapedString(b, *(*string)(unsafe.Pointer(&bytes))), nil - } - return AppendString(b, *(*string)(unsafe.Pointer(&bytes))), nil + return AppendString(ctx, b, *(*string)(unsafe.Pointer(&bytes))), nil } -func AppendMarshalTextIndent(code *Opcode, b []byte, v interface{}, escape bool) ([]byte, error) { +func AppendMarshalTextIndent(ctx *RuntimeContext, code *Opcode, b []byte, v interface{}) ([]byte, error) { rv := reflect.ValueOf(v) // convert by dynamic interface type - if code.AddrForMarshaler { + if (code.Flags & AddrForMarshalerFlags) != 0 { if rv.CanAddr() { rv = rv.Addr() } else { @@ -466,31 +487,28 @@ func AppendMarshalTextIndent(code *Opcode, b []byte, v interface{}, escape bool) v = rv.Interface() marshaler, ok := v.(encoding.TextMarshaler) if !ok { - return AppendNull(b), nil + return AppendNull(ctx, b), nil } bytes, err := marshaler.MarshalText() if err != nil { return nil, &errors.MarshalerError{Type: reflect.TypeOf(v), Err: err} } - if escape { - return AppendEscapedString(b, *(*string)(unsafe.Pointer(&bytes))), nil - } - return AppendString(b, *(*string)(unsafe.Pointer(&bytes))), nil + return AppendString(ctx, b, *(*string)(unsafe.Pointer(&bytes))), nil } -func AppendNull(b []byte) []byte { +func AppendNull(_ *RuntimeContext, b []byte) []byte { return append(b, "null"...) } -func AppendComma(b []byte) []byte { +func AppendComma(_ *RuntimeContext, b []byte) []byte { return append(b, ',') } -func AppendCommaIndent(b []byte) []byte { +func AppendCommaIndent(_ *RuntimeContext, b []byte) []byte { return append(b, ',', '\n') } -func AppendStructEnd(b []byte) []byte { +func AppendStructEnd(_ *RuntimeContext, b []byte) []byte { return append(b, '}', ',') } @@ -498,16 +516,16 @@ 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 := 0; i < indentNum; i++ { + for i := uint32(0); i < indentNum; i++ { b = append(b, ctx.IndentStr...) } return append(b, '}', ',', '\n') } -func AppendIndent(ctx *RuntimeContext, b []byte, indent int) []byte { +func AppendIndent(ctx *RuntimeContext, b []byte, indent uint32) []byte { b = append(b, ctx.Prefix...) indentNum := ctx.BaseIndent + indent - for i := 0; i < indentNum; i++ { + for i := uint32(0); i < indentNum; i++ { b = append(b, ctx.IndentStr...) } return b diff --git a/vendor/github.com/goccy/go-json/internal/encoder/int.go b/vendor/github.com/goccy/go-json/internal/encoder/int.go @@ -49,9 +49,14 @@ var intBELookup = [100]uint16{ var intLookup = [2]*[100]uint16{&intLELookup, &intBELookup} -func AppendInt(out []byte, u64 uint64, code *Opcode) []byte { - n := u64 & code.Mask - negative := (u64>>code.RshiftNum)&1 == 1 +func numMask(numBitSize uint8) uint64 { + return 1<<numBitSize - 1 +} + +func AppendInt(_ *RuntimeContext, out []byte, u64 uint64, code *Opcode) []byte { + mask := numMask(code.NumBitSize) + n := u64 & mask + negative := (u64>>(code.NumBitSize-1))&1 == 1 if !negative { if n < 10 { return append(out, byte(n+'0')) @@ -60,7 +65,7 @@ func AppendInt(out []byte, u64 uint64, code *Opcode) []byte { return append(out, byte(u), byte(u>>8)) } } else { - n = -n & code.Mask + n = -n & mask } lookup := intLookup[endianness] @@ -91,8 +96,9 @@ func AppendInt(out []byte, u64 uint64, code *Opcode) []byte { return append(out, b[i:]...) } -func AppendUint(out []byte, u64 uint64, code *Opcode) []byte { - n := u64 & code.Mask +func AppendUint(_ *RuntimeContext, out []byte, u64 uint64, code *Opcode) []byte { + mask := numMask(code.NumBitSize) + n := u64 & mask if n < 10 { return append(out, byte(n+'0')) } else if n < 100 { diff --git a/vendor/github.com/goccy/go-json/internal/encoder/opcode.go b/vendor/github.com/goccy/go-json/internal/encoder/opcode.go @@ -2,7 +2,6 @@ package encoder import ( "fmt" - "math" "strings" "unsafe" @@ -11,61 +10,61 @@ import ( 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 - Type *runtime.Type // go type - DisplayIdx int // opcode index - Key []byte // struct field key - EscapedKey []byte // struct field key ( HTML escaped ) - PtrNum int // pointer number: e.g. double pointer is 2. - DisplayKey string // key text to display - IsTaggedKey bool // whether tagged key - AnonymousKey bool // whether anonymous key - AnonymousHead bool // whether anonymous head or not - Indirect bool // whether indirect or not - Nilcheck bool // whether needs to nilcheck or not - AddrForMarshaler bool // whether needs to addr for marshaler or not - IsNextOpPtrType bool // whether next operation is ptr type or not - IsNilableType bool // whether type is nilable or not - RshiftNum uint8 // use to take bit for judging whether negative integer or not - Mask uint64 // mask for number - Indent int // indent number - - Idx uintptr // offset to access ptr - HeadIdx uintptr // offset to access slice/struct head - ElemIdx uintptr // offset to access array/slice/map elem - Length uintptr // offset to access slice/map length or array length - MapIter uintptr // offset to access map iterator - MapPos uintptr // offset to access position list for sorted map - Offset uintptr // offset size from struct header - Size uintptr // array/slice elem size - - MapKey *Opcode // map key - MapValue *Opcode // map value - Elem *Opcode // array/slice elem - End *Opcode // array/slice/struct/map end - PrevField *Opcode // prev struct field - NextField *Opcode // next struct field - Next *Opcode // next opcode - Jmp *CompiledCode // for recursive call -} - -func rshitNum(bitSize uint8) uint8 { - return bitSize - 1 -} - -func (c *Opcode) setMaskAndRshiftNum(bitSize uint8) { - switch bitSize { - case 8: - c.Mask = math.MaxUint8 - case 16: - c.Mask = math.MaxUint16 - case 32: - c.Mask = math.MaxUint32 - case 64: - c.Mask = math.MaxUint64 + 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 + PrevField *Opcode // prev struct field + Jmp *CompiledCode // for recursive call + ElemIdx uint32 // offset to access array/slice/map elem + Length uint32 // offset to access slice/map length or array length + MapIter uint32 // offset to access map iterator + MapPos uint32 // offset to access position list for sorted map + Indent uint32 // indent number + Size uint32 // array/slice elem size + DisplayIdx uint32 // opcode index + DisplayKey string // key text to display +} + +func (c *Opcode) MaxIdx() uint32 { + max := uint32(0) + for _, value := range []uint32{ + c.Idx, + c.ElemIdx, + c.Length, + c.MapIter, + c.MapPos, + c.Size, + } { + if max < value { + max = value + } } - c.RshiftNum = rshitNum(bitSize) + return max } func (c *Opcode) ToHeaderType(isString bool) OpType { @@ -278,8 +277,8 @@ func newOpCode(ctx *compileContext, op OpType) *Opcode { return newOpCodeWithNext(ctx, op, newEndOp(ctx)) } -func opcodeOffset(idx int) uintptr { - return uintptr(idx) * uintptrSize +func opcodeOffset(idx int) uint32 { + return uint32(idx) * uintptrSize } func copyOpcode(code *Opcode) *Opcode { @@ -287,14 +286,53 @@ func copyOpcode(code *Opcode) *Opcode { return code.copy(codeMap) } +func setTotalLengthToInterfaceOp(code *Opcode) { + c := code + for c.Op != OpEnd && c.Op != OpInterfaceEnd { + if c.Op == OpInterface { + c.Length = uint32(code.TotalLength()) + } + switch c.Op.CodeType() { + case CodeArrayElem, CodeSliceElem, CodeMapKey: + c = c.End + default: + c = c.Next + } + } +} + +func ToEndCode(code *Opcode) *Opcode { + c := code + for c.Op != OpEnd && c.Op != OpInterfaceEnd { + switch c.Op.CodeType() { + case CodeArrayElem, CodeSliceElem, CodeMapKey: + c = c.End + default: + c = c.Next + } + } + 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, op OpType, next *Opcode) *Opcode { return &Opcode{ Op: op, + Idx: opcodeOffset(ctx.ptrIndex), + Next: next, Type: ctx.typ, DisplayIdx: ctx.opcodeIndex, Indent: ctx.indent, - Idx: opcodeOffset(ctx.ptrIndex), - Next: next, } } @@ -311,37 +349,24 @@ func (c *Opcode) copy(codeMap map[uintptr]*Opcode) *Opcode { return code } copied := &Opcode{ - Op: c.Op, - Type: c.Type, - DisplayIdx: c.DisplayIdx, - Key: c.Key, - EscapedKey: c.EscapedKey, - DisplayKey: c.DisplayKey, - PtrNum: c.PtrNum, - Mask: c.Mask, - RshiftNum: c.RshiftNum, - IsTaggedKey: c.IsTaggedKey, - AnonymousKey: c.AnonymousKey, - AnonymousHead: c.AnonymousHead, - Indirect: c.Indirect, - Nilcheck: c.Nilcheck, - AddrForMarshaler: c.AddrForMarshaler, - IsNextOpPtrType: c.IsNextOpPtrType, - IsNilableType: c.IsNilableType, - Indent: c.Indent, - Idx: c.Idx, - HeadIdx: c.HeadIdx, - ElemIdx: c.ElemIdx, - Length: c.Length, - MapIter: c.MapIter, - MapPos: c.MapPos, - Offset: c.Offset, - Size: c.Size, + Op: c.Op, + Key: c.Key, + PtrNum: c.PtrNum, + NumBitSize: c.NumBitSize, + Flags: c.Flags, + Idx: c.Idx, + Offset: c.Offset, + Type: c.Type, + DisplayIdx: c.DisplayIdx, + DisplayKey: c.DisplayKey, + ElemIdx: c.ElemIdx, + Length: c.Length, + MapIter: c.MapIter, + MapPos: c.MapPos, + Size: c.Size, + Indent: c.Indent, } codeMap[addr] = copied - copied.MapKey = c.MapKey.copy(codeMap) - copied.MapValue = c.MapValue.copy(codeMap) - copied.Elem = c.Elem.copy(codeMap) copied.End = c.End.copy(codeMap) copied.PrevField = c.PrevField.copy(codeMap) copied.NextField = c.NextField.copy(codeMap) @@ -369,8 +394,12 @@ func (c *Opcode) BeforeLastCode() *Opcode { func (c *Opcode) TotalLength() int { var idx int - for code := c; code.Op != OpEnd; { - idx = int(code.Idx / uintptrSize) + code := c + for code.Op != OpEnd && code.Op != OpInterfaceEnd { + maxIdx := int(code.MaxIdx() / uintptrSize) + if idx < maxIdx { + idx = maxIdx + } if code.Op == OpRecursiveEnd { break } @@ -381,15 +410,18 @@ func (c *Opcode) TotalLength() int { code = code.Next } } - return idx + 2 // opEnd + 1 + maxIdx := int(code.MaxIdx() / uintptrSize) + if idx < maxIdx { + idx = maxIdx + } + return idx + 1 } func (c *Opcode) decOpcodeIndex() { for code := c; code.Op != OpEnd; { code.DisplayIdx-- - code.Idx -= uintptrSize - if code.HeadIdx > 0 { - code.HeadIdx -= uintptrSize + if code.Idx > 0 { + code.Idx -= uintptrSize } if code.ElemIdx > 0 { code.ElemIdx -= uintptrSize @@ -422,19 +454,18 @@ func (c *Opcode) decIndent() { } func (c *Opcode) dumpHead(code *Opcode) string { - var length uintptr + var length uint32 if code.Op.CodeType() == CodeArrayHead { length = code.Length } else { length = code.Length / uintptrSize } return fmt.Sprintf( - `[%d]%s%s ([idx:%d][headIdx:%d][elemIdx:%d][length:%d])`, + `[%d]%s%s ([idx:%d][elemIdx:%d][length:%d])`, code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, - code.HeadIdx/uintptrSize, code.ElemIdx/uintptrSize, length, ) @@ -442,12 +473,11 @@ func (c *Opcode) dumpHead(code *Opcode) string { func (c *Opcode) dumpMapHead(code *Opcode) string { return fmt.Sprintf( - `[%d]%s%s ([idx:%d][headIdx:%d][elemIdx:%d][length:%d][mapIter:%d])`, + `[%d]%s%s ([idx:%d][elemIdx:%d][length:%d][mapIter:%d])`, code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, - code.HeadIdx/uintptrSize, code.ElemIdx/uintptrSize, code.Length/uintptrSize, code.MapIter/uintptrSize, @@ -458,7 +488,7 @@ func (c *Opcode) dumpMapEnd(code *Opcode) string { return fmt.Sprintf( `[%d]%s%s ([idx:%d][mapPos:%d][length:%d])`, code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, code.MapPos/uintptrSize, @@ -467,19 +497,18 @@ func (c *Opcode) dumpMapEnd(code *Opcode) string { } func (c *Opcode) dumpElem(code *Opcode) string { - var length uintptr + var length uint32 if code.Op.CodeType() == CodeArrayElem { length = code.Length } else { length = code.Length / uintptrSize } return fmt.Sprintf( - `[%d]%s%s ([idx:%d][headIdx:%d][elemIdx:%d][length:%d][size:%d])`, + `[%d]%s%s ([idx:%d][elemIdx:%d][length:%d][size:%d])`, code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, - code.HeadIdx/uintptrSize, code.ElemIdx/uintptrSize, length, code.Size, @@ -488,14 +517,13 @@ func (c *Opcode) dumpElem(code *Opcode) string { func (c *Opcode) dumpField(code *Opcode) string { return fmt.Sprintf( - `[%d]%s%s ([idx:%d][key:%s][offset:%d][headIdx:%d])`, + `[%d]%s%s ([idx:%d][key:%s][offset:%d])`, code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, code.DisplayKey, code.Offset, - code.HeadIdx/uintptrSize, ) } @@ -503,7 +531,7 @@ func (c *Opcode) dumpKey(code *Opcode) string { return fmt.Sprintf( `[%d]%s%s ([idx:%d][elemIdx:%d][length:%d][mapIter:%d])`, code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, code.ElemIdx/uintptrSize, @@ -516,7 +544,7 @@ func (c *Opcode) dumpValue(code *Opcode) string { return fmt.Sprintf( `[%d]%s%s ([idx:%d][mapIter:%d])`, code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, code.MapIter/uintptrSize, @@ -525,7 +553,7 @@ func (c *Opcode) dumpValue(code *Opcode) string { func (c *Opcode) Dump() string { codes := []string{} - for code := c; code.Op != OpEnd; { + for code := c; code.Op != OpEnd && code.Op != OpInterfaceEnd; { switch code.Op.CodeType() { case CodeSliceHead: codes = append(codes, c.dumpHead(code)) @@ -555,7 +583,7 @@ func (c *Opcode) Dump() string { codes = append(codes, fmt.Sprintf( "[%d]%s%s ([idx:%d])", code.DisplayIdx, - strings.Repeat("-", code.Indent), + strings.Repeat("-", int(code.Indent)), code.Op, code.Idx/uintptrSize, )) @@ -610,9 +638,8 @@ func newSliceHeaderCode(ctx *compileContext) *Opcode { length := opcodeOffset(ctx.ptrIndex) return &Opcode{ Op: OpSlice, - DisplayIdx: ctx.opcodeIndex, Idx: idx, - HeadIdx: idx, + DisplayIdx: ctx.opcodeIndex, ElemIdx: elemIdx, Length: length, Indent: ctx.indent, @@ -622,13 +649,12 @@ func newSliceHeaderCode(ctx *compileContext) *Opcode { func newSliceElemCode(ctx *compileContext, head *Opcode, size uintptr) *Opcode { return &Opcode{ Op: OpSliceElem, + Idx: head.Idx, DisplayIdx: ctx.opcodeIndex, - Idx: opcodeOffset(ctx.ptrIndex), - HeadIdx: head.Idx, ElemIdx: head.ElemIdx, Length: head.Length, Indent: ctx.indent, - Size: size, + Size: uint32(size), } } @@ -638,25 +664,23 @@ func newArrayHeaderCode(ctx *compileContext, alen int) *Opcode { elemIdx := opcodeOffset(ctx.ptrIndex) return &Opcode{ Op: OpArray, - DisplayIdx: ctx.opcodeIndex, Idx: idx, - HeadIdx: idx, + DisplayIdx: ctx.opcodeIndex, ElemIdx: elemIdx, Indent: ctx.indent, - Length: uintptr(alen), + Length: uint32(alen), } } func newArrayElemCode(ctx *compileContext, head *Opcode, length int, size uintptr) *Opcode { return &Opcode{ Op: OpArrayElem, + Idx: head.Idx, DisplayIdx: ctx.opcodeIndex, - Idx: opcodeOffset(ctx.ptrIndex), ElemIdx: head.ElemIdx, - HeadIdx: head.HeadIdx, - Length: uintptr(length), + Length: uint32(length), Indent: ctx.indent, - Size: size, + Size: uint32(size), } } @@ -670,9 +694,9 @@ func newMapHeaderCode(ctx *compileContext) *Opcode { mapIter := opcodeOffset(ctx.ptrIndex) return &Opcode{ Op: OpMap, + Idx: idx, Type: ctx.typ, DisplayIdx: ctx.opcodeIndex, - Idx: idx, ElemIdx: elemIdx, Length: length, MapIter: mapIter, @@ -683,8 +707,8 @@ func newMapHeaderCode(ctx *compileContext) *Opcode { func newMapKeyCode(ctx *compileContext, head *Opcode) *Opcode { return &Opcode{ Op: OpMapKey, - DisplayIdx: ctx.opcodeIndex, Idx: opcodeOffset(ctx.ptrIndex), + DisplayIdx: ctx.opcodeIndex, ElemIdx: head.ElemIdx, Length: head.Length, MapIter: head.MapIter, @@ -695,8 +719,8 @@ func newMapKeyCode(ctx *compileContext, head *Opcode) *Opcode { func newMapValueCode(ctx *compileContext, head *Opcode) *Opcode { return &Opcode{ Op: OpMapValue, - DisplayIdx: ctx.opcodeIndex, Idx: opcodeOffset(ctx.ptrIndex), + DisplayIdx: ctx.opcodeIndex, ElemIdx: head.ElemIdx, Length: head.Length, MapIter: head.MapIter, @@ -710,34 +734,39 @@ func newMapEndCode(ctx *compileContext, head *Opcode) *Opcode { idx := opcodeOffset(ctx.ptrIndex) return &Opcode{ Op: OpMapEnd, - DisplayIdx: ctx.opcodeIndex, Idx: idx, + Next: newEndOp(ctx), + DisplayIdx: ctx.opcodeIndex, Length: head.Length, MapPos: mapPos, Indent: ctx.indent, - Next: newEndOp(ctx), } } func newInterfaceCode(ctx *compileContext) *Opcode { + var flag OpFlags + if ctx.typ.NumMethod() > 0 { + flag |= NonEmptyInterfaceFlags + } return &Opcode{ Op: OpInterface, + Idx: opcodeOffset(ctx.ptrIndex), + Next: newEndOp(ctx), Type: ctx.typ, DisplayIdx: ctx.opcodeIndex, - Idx: opcodeOffset(ctx.ptrIndex), Indent: ctx.indent, - Next: newEndOp(ctx), + Flags: flag, } } func newRecursiveCode(ctx *compileContext, jmp *CompiledCode) *Opcode { return &Opcode{ Op: OpRecursive, + Idx: opcodeOffset(ctx.ptrIndex), + Next: newEndOp(ctx), Type: ctx.typ, DisplayIdx: ctx.opcodeIndex, - Idx: opcodeOffset(ctx.ptrIndex), Indent: ctx.indent, - Next: newEndOp(ctx), 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 @@ -0,0 +1,41 @@ +package encoder + +import "context" + +type OptionFlag uint8 + +const ( + HTMLEscapeOption OptionFlag = 1 << iota + IndentOption + UnorderedMapOption + DebugOption + ColorizeOption + ContextOption +) + +type Option struct { + Flag OptionFlag + ColorScheme *ColorScheme + Context context.Context +} + +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 @@ -22,7 +22,7 @@ const ( CodeStructEnd CodeType = 11 ) -var opTypeStrings = [400]string{ +var opTypeStrings = [401]string{ "End", "Interface", "Ptr", @@ -36,6 +36,7 @@ var opTypeStrings = [400]string{ "Recursive", "RecursivePtr", "RecursiveEnd", + "InterfaceEnd", "StructAnonymousEnd", "Int", "Uint", @@ -425,7 +426,7 @@ var opTypeStrings = [400]string{ "StructEndOmitEmpty", } -type OpType int +type OpType uint16 const ( OpEnd OpType = 0 @@ -441,397 +442,398 @@ const ( OpRecursive OpType = 10 OpRecursivePtr OpType = 11 OpRecursiveEnd OpType = 12 - OpStructAnonymousEnd 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 + OpInterfaceEnd OpType = 13 + OpStructAnonymousEnd OpType = 14 + OpInt OpType = 15 + OpUint OpType = 16 + OpFloat32 OpType = 17 + OpFloat64 OpType = 18 + OpBool OpType = 19 + OpString OpType = 20 + OpBytes OpType = 21 + OpNumber OpType = 22 + OpArray OpType = 23 + OpMap OpType = 24 + OpSlice OpType = 25 + OpStruct OpType = 26 + OpMarshalJSON OpType = 27 + OpMarshalText OpType = 28 + OpIntString OpType = 29 + OpUintString OpType = 30 + OpFloat32String OpType = 31 + OpFloat64String OpType = 32 + OpBoolString OpType = 33 + OpStringString OpType = 34 + OpNumberString OpType = 35 + OpIntPtr OpType = 36 + OpUintPtr OpType = 37 + OpFloat32Ptr OpType = 38 + OpFloat64Ptr OpType = 39 + OpBoolPtr OpType = 40 + OpStringPtr OpType = 41 + OpBytesPtr OpType = 42 + OpNumberPtr OpType = 43 + OpArrayPtr OpType = 44 + OpMapPtr OpType = 45 + OpSlicePtr OpType = 46 + OpMarshalJSONPtr OpType = 47 + OpMarshalTextPtr OpType = 48 + OpInterfacePtr OpType = 49 + OpIntPtrString OpType = 50 + OpUintPtrString OpType = 51 + OpFloat32PtrString OpType = 52 + OpFloat64PtrString OpType = 53 + OpBoolPtrString OpType = 54 + OpStringPtrString OpType = 55 + OpNumberPtrString OpType = 56 + OpStructHeadInt OpType = 57 + OpStructHeadOmitEmptyInt OpType = 58 + OpStructPtrHeadInt OpType = 59 + OpStructPtrHeadOmitEmptyInt OpType = 60 + OpStructHeadUint OpType = 61 + OpStructHeadOmitEmptyUint OpType = 62 + OpStructPtrHeadUint OpType = 63 + OpStructPtrHeadOmitEmptyUint OpType = 64 + OpStructHeadFloat32 OpType = 65 + OpStructHeadOmitEmptyFloat32 OpType = 66 + OpStructPtrHeadFloat32 OpType = 67 + OpStructPtrHeadOmitEmptyFloat32 OpType = 68 + OpStructHeadFloat64 OpType = 69 + OpStructHeadOmitEmptyFloat64 OpType = 70 + OpStructPtrHeadFloat64 OpType = 71 + OpStructPtrHeadOmitEmptyFloat64 OpType = 72 + OpStructHeadBool OpType = 73 + OpStructHeadOmitEmptyBool OpType = 74 + OpStructPtrHeadBool OpType = 75 + OpStructPtrHeadOmitEmptyBool OpType = 76 + OpStructHeadString OpType = 77 + OpStructHeadOmitEmptyString OpType = 78 + OpStructPtrHeadString OpType = 79 + OpStructPtrHeadOmitEmptyString OpType = 80 + OpStructHeadBytes OpType = 81 + OpStructHeadOmitEmptyBytes OpType = 82 + OpStructPtrHeadBytes OpType = 83 + OpStructPtrHeadOmitEmptyBytes OpType = 84 + OpStructHeadNumber OpType = 85 + OpStructHeadOmitEmptyNumber OpType = 86 + OpStructPtrHeadNumber OpType = 87 + OpStructPtrHeadOmitEmptyNumber OpType = 88 + OpStructHeadArray OpType = 89 + OpStructHeadOmitEmptyArray OpType = 90 + OpStructPtrHeadArray OpType = 91 + OpStructPtrHeadOmitEmptyArray OpType = 92 + OpStructHeadMap OpType = 93 + OpStructHeadOmitEmptyMap OpType = 94 + OpStructPtrHeadMap OpType = 95 + OpStructPtrHeadOmitEmptyMap OpType = 96 + OpStructHeadSlice OpType = 97 + OpStructHeadOmitEmptySlice OpType = 98 + OpStructPtrHeadSlice OpType = 99 + OpStructPtrHeadOmitEmptySlice OpType = 100 + OpStructHeadStruct OpType = 101 + OpStructHeadOmitEmptyStruct OpType = 102 + OpStructPtrHeadStruct OpType = 103 + OpStructPtrHeadOmitEmptyStruct OpType = 104 + OpStructHeadMarshalJSON OpType = 105 + OpStructHeadOmitEmptyMarshalJSON OpType = 106 + OpStructPtrHeadMarshalJSON OpType = 107 + OpStructPtrHeadOmitEmptyMarshalJSON OpType = 108 + OpStructHeadMarshalText OpType = 109 + OpStructHeadOmitEmptyMarshalText OpType = 110 + OpStructPtrHeadMarshalText OpType = 111 + OpStructPtrHeadOmitEmptyMarshalText OpType = 112 + OpStructHeadIntString OpType = 113 + OpStructHeadOmitEmptyIntString OpType = 114 + OpStructPtrHeadIntString OpType = 115 + OpStructPtrHeadOmitEmptyIntString OpType = 116 + OpStructHeadUintString OpType = 117 + OpStructHeadOmitEmptyUintString OpType = 118 + OpStructPtrHeadUintString OpType = 119 + OpStructPtrHeadOmitEmptyUintString OpType = 120 + OpStructHeadFloat32String OpType = 121 + OpStructHeadOmitEmptyFloat32String OpType = 122 + OpStructPtrHeadFloat32String OpType = 123 + OpStructPtrHeadOmitEmptyFloat32String OpType = 124 + OpStructHeadFloat64String OpType = 125 + OpStructHeadOmitEmptyFloat64String OpType = 126 + OpStructPtrHeadFloat64String OpType = 127 + OpStructPtrHeadOmitEmptyFloat64String OpType = 128 + OpStructHeadBoolString OpType = 129 + OpStructHeadOmitEmptyBoolString OpType = 130 + OpStructPtrHeadBoolString OpType = 131 + OpStructPtrHeadOmitEmptyBoolString OpType = 132 + OpStructHeadStringString OpType = 133 + OpStructHeadOmitEmptyStringString OpType = 134 + OpStructPtrHeadStringString OpType = 135 + OpStructPtrHeadOmitEmptyStringString OpType = 136 + OpStructHeadNumberString OpType = 137 + OpStructHeadOmitEmptyNumberString OpType = 138 + OpStructPtrHeadNumberString OpType = 139 + OpStructPtrHeadOmitEmptyNumberString OpType = 140 + OpStructHeadIntPtr OpType = 141 + OpStructHeadOmitEmptyIntPtr OpType = 142 + OpStructPtrHeadIntPtr OpType = 143 + OpStructPtrHeadOmitEmptyIntPtr OpType = 144 + OpStructHeadUintPtr OpType = 145 + OpStructHeadOmitEmptyUintPtr OpType = 146 + OpStructPtrHeadUintPtr OpType = 147 + OpStructPtrHeadOmitEmptyUintPtr OpType = 148 + OpStructHeadFloat32Ptr OpType = 149 + OpStructHeadOmitEmptyFloat32Ptr OpType = 150 + OpStructPtrHeadFloat32Ptr OpType = 151 + OpStructPtrHeadOmitEmptyFloat32Ptr OpType = 152 + OpStructHeadFloat64Ptr OpType = 153 + OpStructHeadOmitEmptyFloat64Ptr OpType = 154 + OpStructPtrHeadFloat64Ptr OpType = 155 + OpStructPtrHeadOmitEmptyFloat64Ptr OpType = 156 + OpStructHeadBoolPtr OpType = 157 + OpStructHeadOmitEmptyBoolPtr OpType = 158 + OpStructPtrHeadBoolPtr OpType = 159 + OpStructPtrHeadOmitEmptyBoolPtr OpType = 160 + OpStructHeadStringPtr OpType = 161 + OpStructHeadOmitEmptyStringPtr OpType = 162 + OpStructPtrHeadStringPtr OpType = 163 + OpStructPtrHeadOmitEmptyStringPtr OpType = 164 + OpStructHeadBytesPtr OpType = 165 + OpStructHeadOmitEmptyBytesPtr OpType = 166 + OpStructPtrHeadBytesPtr OpType = 167 + OpStructPtrHeadOmitEmptyBytesPtr OpType = 168 + OpStructHeadNumberPtr OpType = 169 + OpStructHeadOmitEmptyNumberPtr OpType = 170 + OpStructPtrHeadNumberPtr OpType = 171 + OpStructPtrHeadOmitEmptyNumberPtr OpType = 172 + OpStructHeadArrayPtr OpType = 173 + OpStructHeadOmitEmptyArrayPtr OpType = 174 + OpStructPtrHeadArrayPtr OpType = 175 + OpStructPtrHeadOmitEmptyArrayPtr OpType = 176 + OpStructHeadMapPtr OpType = 177 + OpStructHeadOmitEmptyMapPtr OpType = 178 + OpStructPtrHeadMapPtr OpType = 179 + OpStructPtrHeadOmitEmptyMapPtr OpType = 180 + OpStructHeadSlicePtr OpType = 181 + OpStructHeadOmitEmptySlicePtr OpType = 182 + OpStructPtrHeadSlicePtr OpType = 183 + OpStructPtrHeadOmitEmptySlicePtr OpType = 184 + OpStructHeadMarshalJSONPtr OpType = 185 + OpStructHeadOmitEmptyMarshalJSONPtr OpType = 186 + OpStructPtrHeadMarshalJSONPtr OpType = 187 + OpStructPtrHeadOmitEmptyMarshalJSONPtr OpType = 188 + OpStructHeadMarshalTextPtr OpType = 189 + OpStructHeadOmitEmptyMarshalTextPtr OpType = 190 + OpStructPtrHeadMarshalTextPtr OpType = 191 + OpStructPtrHeadOmitEmptyMarshalTextPtr OpType = 192 + OpStructHeadInterfacePtr OpType = 193 + OpStructHeadOmitEmptyInterfacePtr OpType = 194 + OpStructPtrHeadInterfacePtr OpType = 195 + OpStructPtrHeadOmitEmptyInterfacePtr OpType = 196 + OpStructHeadIntPtrString OpType = 197 + OpStructHeadOmitEmptyIntPtrString OpType = 198 + OpStructPtrHeadIntPtrString OpType = 199 + OpStructPtrHeadOmitEmptyIntPtrString OpType = 200 + OpStructHeadUintPtrString OpType = 201 + OpStructHeadOmitEmptyUintPtrString OpType = 202 + OpStructPtrHeadUintPtrString OpType = 203 + OpStructPtrHeadOmitEmptyUintPtrString OpType = 204 + OpStructHeadFloat32PtrString OpType = 205 + OpStructHeadOmitEmptyFloat32PtrString OpType = 206 + OpStructPtrHeadFloat32PtrString OpType = 207 + OpStructPtrHeadOmitEmptyFloat32PtrString OpType = 208 + OpStructHeadFloat64PtrString OpType = 209 + OpStructHeadOmitEmptyFloat64PtrString OpType = 210 + OpStructPtrHeadFloat64PtrString OpType = 211 + OpStructPtrHeadOmitEmptyFloat64PtrString OpType = 212 + OpStructHeadBoolPtrString OpType = 213 + OpStructHeadOmitEmptyBoolPtrString OpType = 214 + OpStructPtrHeadBoolPtrString OpType = 215 + OpStructPtrHeadOmitEmptyBoolPtrString OpType = 216 + OpStructHeadStringPtrString OpType = 217 + OpStructHeadOmitEmptyStringPtrString OpType = 218 + OpStructPtrHeadStringPtrString OpType = 219 + OpStructPtrHeadOmitEmptyStringPtrString OpType = 220 + OpStructHeadNumberPtrString OpType = 221 + OpStructHeadOmitEmptyNumberPtrString OpType = 222 + OpStructPtrHeadNumberPtrString OpType = 223 + OpStructPtrHeadOmitEmptyNumberPtrString OpType = 224 + OpStructHead OpType = 225 + OpStructHeadOmitEmpty OpType = 226 + OpStructPtrHead OpType = 227 + OpStructPtrHeadOmitEmpty OpType = 228 + OpStructFieldInt OpType = 229 + OpStructFieldOmitEmptyInt OpType = 230 + OpStructEndInt OpType = 231 + OpStructEndOmitEmptyInt OpType = 232 + OpStructFieldUint OpType = 233 + OpStructFieldOmitEmptyUint OpType = 234 + OpStructEndUint OpType = 235 + OpStructEndOmitEmptyUint OpType = 236 + OpStructFieldFloat32 OpType = 237 + OpStructFieldOmitEmptyFloat32 OpType = 238 + OpStructEndFloat32 OpType = 239 + OpStructEndOmitEmptyFloat32 OpType = 240 + OpStructFieldFloat64 OpType = 241 + OpStructFieldOmitEmptyFloat64 OpType = 242 + OpStructEndFloat64 OpType = 243 + OpStructEndOmitEmptyFloat64 OpType = 244 + OpStructFieldBool OpType = 245 + OpStructFieldOmitEmptyBool OpType = 246 + OpStructEndBool OpType = 247 + OpStructEndOmitEmptyBool OpType = 248 + OpStructFieldString OpType = 249 + OpStructFieldOmitEmptyString OpType = 250 + OpStructEndString OpType = 251 + OpStructEndOmitEmptyString OpType = 252 + OpStructFieldBytes OpType = 253 + OpStructFieldOmitEmptyBytes OpType = 254 + OpStructEndBytes OpType = 255 + OpStructEndOmitEmptyBytes OpType = 256 + OpStructFieldNumber OpType = 257 + OpStructFieldOmitEmptyNumber OpType = 258 + OpStructEndNumber OpType = 259 + OpStructEndOmitEmptyNumber OpType = 260 + OpStructFieldArray OpType = 261 + OpStructFieldOmitEmptyArray OpType = 262 + OpStructEndArray OpType = 263 + OpStructEndOmitEmptyArray OpType = 264 + OpStructFieldMap OpType = 265 + OpStructFieldOmitEmptyMap OpType = 266 + OpStructEndMap OpType = 267 + OpStructEndOmitEmptyMap OpType = 268 + OpStructFieldSlice OpType = 269 + OpStructFieldOmitEmptySlice OpType = 270 + OpStructEndSlice OpType = 271 + OpStructEndOmitEmptySlice OpType = 272 + OpStructFieldStruct OpType = 273 + OpStructFieldOmitEmptyStruct OpType = 274 + OpStructEndStruct OpType = 275 + OpStructEndOmitEmptyStruct OpType = 276 + OpStructFieldMarshalJSON OpType = 277 + OpStructFieldOmitEmptyMarshalJSON OpType = 278 + OpStructEndMarshalJSON OpType = 279 + OpStructEndOmitEmptyMarshalJSON OpType = 280 + OpStructFieldMarshalText OpType = 281 + OpStructFieldOmitEmptyMarshalText OpType = 282 + OpStructEndMarshalText OpType = 283 + OpStructEndOmitEmptyMarshalText OpType = 284 + OpStructFieldIntString OpType = 285 + OpStructFieldOmitEmptyIntString OpType = 286 + OpStructEndIntString OpType = 287 + OpStructEndOmitEmptyIntString OpType = 288 + OpStructFieldUintString OpType = 289 + OpStructFieldOmitEmptyUintString OpType = 290 + OpStructEndUintString OpType = 291 + OpStructEndOmitEmptyUintString OpType = 292 + OpStructFieldFloat32String OpType = 293 + OpStructFieldOmitEmptyFloat32String OpType = 294 + OpStructEndFloat32String OpType = 295 + OpStructEndOmitEmptyFloat32String OpType = 296 + OpStructFieldFloat64String OpType = 297 + OpStructFieldOmitEmptyFloat64String OpType = 298 + OpStructEndFloat64String OpType = 299 + OpStructEndOmitEmptyFloat64String OpType = 300 + OpStructFieldBoolString OpType = 301 + OpStructFieldOmitEmptyBoolString OpType = 302 + OpStructEndBoolString OpType = 303 + OpStructEndOmitEmptyBoolString OpType = 304 + OpStructFieldStringString OpType = 305 + OpStructFieldOmitEmptyStringString OpType = 306 + OpStructEndStringString OpType = 307 + OpStructEndOmitEmptyStringString OpType = 308 + OpStructFieldNumberString OpType = 309 + OpStructFieldOmitEmptyNumberString OpType = 310 + OpStructEndNumberString OpType = 311 + OpStructEndOmitEmptyNumberString OpType = 312 + OpStructFieldIntPtr OpType = 313 + OpStructFieldOmitEmptyIntPtr OpType = 314 + OpStructEndIntPtr OpType = 315 + OpStructEndOmitEmptyIntPtr OpType = 316 + OpStructFieldUintPtr OpType = 317 + OpStructFieldOmitEmptyUintPtr OpType = 318 + OpStructEndUintPtr OpType = 319 + OpStructEndOmitEmptyUintPtr OpType = 320 + OpStructFieldFloat32Ptr OpType = 321 + OpStructFieldOmitEmptyFloat32Ptr OpType = 322 + OpStructEndFloat32Ptr OpType = 323 + OpStructEndOmitEmptyFloat32Ptr OpType = 324 + OpStructFieldFloat64Ptr OpType = 325 + OpStructFieldOmitEmptyFloat64Ptr OpType = 326 + OpStructEndFloat64Ptr OpType = 327 + OpStructEndOmitEmptyFloat64Ptr OpType = 328 + OpStructFieldBoolPtr OpType = 329 + OpStructFieldOmitEmptyBoolPtr OpType = 330 + OpStructEndBoolPtr OpType = 331 + OpStructEndOmitEmptyBoolPtr OpType = 332 + OpStructFieldStringPtr OpType = 333 + OpStructFieldOmitEmptyStringPtr OpType = 334 + OpStructEndStringPtr OpType = 335 + OpStructEndOmitEmptyStringPtr OpType = 336 + OpStructFieldBytesPtr OpType = 337 + OpStructFieldOmitEmptyBytesPtr OpType = 338 + OpStructEndBytesPtr OpType = 339 + OpStructEndOmitEmptyBytesPtr OpType = 340 + OpStructFieldNumberPtr OpType = 341 + OpStructFieldOmitEmptyNumberPtr OpType = 342 + OpStructEndNumberPtr OpType = 343 + OpStructEndOmitEmptyNumberPtr OpType = 344 + OpStructFieldArrayPtr OpType = 345 + OpStructFieldOmitEmptyArrayPtr OpType = 346 + OpStructEndArrayPtr OpType = 347 + OpStructEndOmitEmptyArrayPtr OpType = 348 + OpStructFieldMapPtr OpType = 349 + OpStructFieldOmitEmptyMapPtr OpType = 350 + OpStructEndMapPtr OpType = 351 + OpStructEndOmitEmptyMapPtr OpType = 352 + OpStructFieldSlicePtr OpType = 353 + OpStructFieldOmitEmptySlicePtr OpType = 354 + OpStructEndSlicePtr OpType = 355 + OpStructEndOmitEmptySlicePtr OpType = 356 + OpStructFieldMarshalJSONPtr OpType = 357 + OpStructFieldOmitEmptyMarshalJSONPtr OpType = 358 + OpStructEndMarshalJSONPtr OpType = 359 + OpStructEndOmitEmptyMarshalJSONPtr OpType = 360 + OpStructFieldMarshalTextPtr OpType = 361 + OpStructFieldOmitEmptyMarshalTextPtr OpType = 362 + OpStructEndMarshalTextPtr OpType = 363 + OpStructEndOmitEmptyMarshalTextPtr OpType = 364 + OpStructFieldInterfacePtr OpType = 365 + OpStructFieldOmitEmptyInterfacePtr OpType = 366 + OpStructEndInterfacePtr OpType = 367 + OpStructEndOmitEmptyInterfacePtr OpType = 368 + OpStructFieldIntPtrString OpType = 369 + OpStructFieldOmitEmptyIntPtrString OpType = 370 + OpStructEndIntPtrString OpType = 371 + OpStructEndOmitEmptyIntPtrString OpType = 372 + OpStructFieldUintPtrString OpType = 373 + OpStructFieldOmitEmptyUintPtrString OpType = 374 + OpStructEndUintPtrString OpType = 375 + OpStructEndOmitEmptyUintPtrString OpType = 376 + OpStructFieldFloat32PtrString OpType = 377 + OpStructFieldOmitEmptyFloat32PtrString OpType = 378 + OpStructEndFloat32PtrString OpType = 379 + OpStructEndOmitEmptyFloat32PtrString OpType = 380 + OpStructFieldFloat64PtrString OpType = 381 + OpStructFieldOmitEmptyFloat64PtrString OpType = 382 + OpStructEndFloat64PtrString OpType = 383 + OpStructEndOmitEmptyFloat64PtrString OpType = 384 + OpStructFieldBoolPtrString OpType = 385 + OpStructFieldOmitEmptyBoolPtrString OpType = 386 + OpStructEndBoolPtrString OpType = 387 + OpStructEndOmitEmptyBoolPtrString OpType = 388 + OpStructFieldStringPtrString OpType = 389 + OpStructFieldOmitEmptyStringPtrString OpType = 390 + OpStructEndStringPtrString OpType = 391 + OpStructEndOmitEmptyStringPtrString OpType = 392 + OpStructFieldNumberPtrString OpType = 393 + OpStructFieldOmitEmptyNumberPtrString OpType = 394 + OpStructEndNumberPtrString OpType = 395 + OpStructEndOmitEmptyNumberPtrString OpType = 396 + OpStructField OpType = 397 + OpStructFieldOmitEmpty OpType = 398 + OpStructEnd OpType = 399 + OpStructEndOmitEmpty OpType = 400 ) func (t OpType) String() string { - if int(t) >= 400 { + if int(t) >= 401 { return "" } return opTypeStrings[int(t)] diff --git a/vendor/github.com/goccy/go-json/internal/encoder/string.go b/vendor/github.com/goccy/go-json/internal/encoder/string.go @@ -405,7 +405,10 @@ func stringToUint64Slice(s string) []uint64 { })) } -func AppendEscapedString(buf []byte, s string) []byte { +func AppendString(ctx *RuntimeContext, buf []byte, s string) []byte { + if ctx.Option.Flag&HTMLEscapeOption == 0 { + return appendString(buf, s) + } valLen := len(s) if valLen == 0 { return append(buf, `""`...) @@ -531,7 +534,7 @@ ESCAPE_END: return append(append(buf, s[i:]...), '"') } -func AppendString(buf []byte, s string) []byte { +func appendString(buf []byte, s string) []byte { valLen := len(s) if valLen == 0 { return append(buf, `""`...) 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 @@ -6,15 +6,22 @@ import ( "github.com/goccy/go-json/internal/encoder" ) -func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt encoder.Option) ([]byte, error) { +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 err := recover(); err != nil { fmt.Println("=============[DEBUG]===============") fmt.Println("* [TYPE]") fmt.Println(codeSet.Type) fmt.Printf("\n") fmt.Println("* [ALL OPCODE]") - fmt.Println(codeSet.Code.Dump()) + fmt.Println(code.Dump()) fmt.Printf("\n") fmt.Println("* [CONTEXT]") fmt.Printf("%+v\n", ctx) @@ -23,5 +30,5 @@ func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, } }() - return Run(ctx, b, codeSet, opt) + 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 @@ -2,8 +2,8 @@ package vm import ( // HACK: compile order - // `vm`, `vm_escaped`, `vm_indent`, `vm_escaped_indent` packages uses a lot of memory to compile, + // `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_escaped => vm_indent => vm_escaped_indent - _ "github.com/goccy/go-json/internal/encoder/vm_escaped" + // 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 @@ -33,24 +33,33 @@ type emptyInterface struct { 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 uintptr) uintptr { - addr := base + idx +func load(base uintptr, idx uint32) uintptr { + addr := base + uintptr(idx) return **(**uintptr)(unsafe.Pointer(&addr)) } -func store(base uintptr, idx uintptr, p uintptr) { - addr := base + idx +func store(base uintptr, idx uint32, p uintptr) { + addr := base + uintptr(idx) **(**uintptr)(unsafe.Pointer(&addr)) = p } -func loadNPtr(base uintptr, idx uintptr, ptrNum int) uintptr { - addr := base + idx +func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr { + addr := base + uintptr(idx) p := **(**uintptr)(unsafe.Pointer(&addr)) - for i := 0; i < ptrNum; i++ { + for i := uint8(0); i < ptrNum; i++ { if p == 0 { return 0 } @@ -70,8 +79,8 @@ func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader 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++ { +func ptrToNPtr(p uintptr, ptrNum uint8) uintptr { + for i := uint8(0); i < ptrNum; i++ { if p == 0 { return 0 } @@ -90,22 +99,22 @@ func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} { })) } -func appendBool(b []byte, v bool) []byte { +func appendBool(_ *encoder.RuntimeContext, b []byte, v bool) []byte { if v { return append(b, "true"...) } return append(b, "false"...) } -func appendNull(b []byte) []byte { +func appendNull(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, "null"...) } -func appendComma(b []byte) []byte { +func appendComma(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, ',') } -func appendColon(b []byte) []byte { +func appendColon(_ *encoder.RuntimeContext, b []byte) []byte { last := len(b) - 1 b[last] = ':' return b @@ -123,45 +132,12 @@ func appendMapEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []byte return b } -func appendInterface(ctx *encoder.RuntimeContext, codeSet *encoder.OpcodeSet, opt encoder.Option, _ *encoder.Opcode, b []byte, iface *emptyInterface, ptrOffset uintptr) ([]byte, error) { - ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(iface)) - ifaceCodeSet, err := encoder.CompileToGetCodeSet(uintptr(unsafe.Pointer(iface.typ))) - if err != nil { - return nil, err - } - - totalLength := uintptr(codeSet.CodeLength) - nextTotalLength := uintptr(ifaceCodeSet.CodeLength) - - curlen := uintptr(len(ctx.Ptrs)) - offsetNum := ptrOffset / uintptrSize - - newLen := offsetNum + totalLength + nextTotalLength - if curlen < newLen { - ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) - } - oldPtrs := ctx.Ptrs - - newPtrs := ctx.Ptrs[(ptrOffset+totalLength*uintptrSize)/uintptrSize:] - newPtrs[0] = uintptr(iface.ptr) - - ctx.Ptrs = newPtrs - - bb, err := Run(ctx, b, ifaceCodeSet, opt) - if err != nil { - return nil, err - } - - ctx.Ptrs = oldPtrs - return bb, nil -} - func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalJSON(ctx, code, b, v, false) + return encoder.AppendMarshalJSON(ctx, code, b, v) } -func appendMarshalText(code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalText(code, b, v, false) +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 { @@ -174,11 +150,11 @@ func appendArrayEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []by return append(b, ',') } -func appendEmptyArray(b []byte) []byte { +func appendEmptyArray(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, '[', ']', ',') } -func appendEmptyObject(b []byte) []byte { +func appendEmptyObject(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, '{', '}', ',') } @@ -188,7 +164,7 @@ func appendObjectEnd(_ *encoder.RuntimeContext, _ *encoder.Opcode, b []byte) []b return append(b, ',') } -func appendStructHead(b []byte) []byte { +func appendStructHead(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, '{') } @@ -204,7 +180,7 @@ func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, last := len(b) - 1 if b[last] == ',' { b[last] = '}' - return appendComma(b) + return appendComma(ctx, b) } return appendStructEnd(ctx, code, 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 @@ -7,13 +7,19 @@ import ( "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, opt encoder.Option) ([]byte, error) { +func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { recursiveLevel := 0 ptrOffset := uintptr(0) ctxptr := ctx.Ptr() - code := codeSet.Code + var code *encoder.Opcode + if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } for { switch code.Op { @@ -26,62 +32,62 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpIntPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpInt: - b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) + b = appendInt(ctx, b, ptrToUint64(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 = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpUint: - b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) + b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code) + b = appendComma(ctx, b) code = code.Next case encoder.OpIntString: b = append(b, '"') - b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) + b = appendInt(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpUintString: b = append(b, '"') - b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) + b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpFloat32Ptr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpFloat32: - b = appendFloat32(b, ptrToFloat32(load(ctxptr, code.Idx))) - b = appendComma(b) + 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 = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -92,73 +98,73 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + 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 = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpString: - b = appendString(b, ptrToString(load(ctxptr, code.Idx))) - b = appendComma(b) + 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 = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpBool: - b = appendBool(b, ptrToBool(load(ctxptr, code.Idx))) - b = appendComma(b) + 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 = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpBytes: - b = appendByteSlice(b, ptrToBytes(load(ctxptr, code.Idx))) - b = appendComma(b) + 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 = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpNumber: - bb, err := appendNumber(b, ptrToNumber(load(ctxptr, code.Idx))) + bb, err := appendNumber(ctx, b, ptrToNumber(load(ctxptr, code.Idx))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpInterfacePtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -167,38 +173,92 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpInterface: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } - for _, seen := range ctx.SeenPtr { - if p == seen { - return nil, errUnsupportedValue(code, p) + if recursiveLevel > encoder.StartDetectingCyclesAfter { + for _, seen := range ctx.SeenPtr { + if p == seen { + return nil, errUnsupportedValue(code, p) + } } } ctx.SeenPtr = append(ctx.SeenPtr, p) - iface := (*emptyInterface)(ptrToUnsafePtr(p)) - if iface.ptr == nil { - b = appendNull(b) - b = appendComma(b) + var ( + typ *runtime.Type + ifacePtr unsafe.Pointer + ) + up := ptrToUnsafePtr(p) + if code.Flags&encoder.NonEmptyInterfaceFlags != 0 { + iface := (*nonEmptyInterface)(up) + ifacePtr = iface.ptr + typ = iface.itab.typ + } else { + iface := (*emptyInterface)(up) + ifacePtr = iface.ptr + typ = iface.typ + } + if ifacePtr == nil { + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } - bb, err := appendInterface(ctx, codeSet, opt, code, b, iface, ptrOffset) + ctx.KeepRefs = append(ctx.KeepRefs, up) + ifaceCodeSet, err := encoder.CompileToGetCodeSet(uintptr(unsafe.Pointer(typ))) if err != nil { return nil, err } - ctxptr = ctx.Ptr() + + 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 + indentDiffFromTop := c.Indent - 1 + ctx.BaseIndent += code.Indent - indentDiffFromTop + + 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] - b = bb - code = code.Next + 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 = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -207,25 +267,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } - if code.IsNilableType && code.Indirect { + 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(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -235,24 +295,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt p := load(ctxptr, code.Idx) if p == 0 { b = append(b, `""`...) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next break } - if code.IsNilableType && code.Indirect { + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpSlicePtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -262,8 +322,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt p := load(ctxptr, code.Idx) slice := ptrToSlice(p) if p == 0 || slice.Data == nil { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -275,7 +335,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, uintptr(slice.Data)) } else { - b = appendEmptyArray(b) + b = appendEmptyArray(ctx, b) code = code.End.Next } case encoder.OpSliceElem: @@ -285,8 +345,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if idx < length { b = appendArrayElemIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) - data := load(ctxptr, code.HeadIdx) - size := code.Size + data := load(ctxptr, code.Idx) + size := uintptr(code.Size) code = code.Next store(ctxptr, code.Idx, data+idx*size) } else { @@ -296,8 +356,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpArrayPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -306,8 +366,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpArray: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -317,17 +377,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } else { - b = appendEmptyArray(b) + b = appendEmptyArray(ctx, b) code = code.End.Next } case encoder.OpArrayElem: idx := load(ctxptr, code.ElemIdx) idx++ - if idx < code.Length { + if idx < uintptr(code.Length) { b = appendArrayElemIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) - p := load(ctxptr, code.HeadIdx) - size := code.Size + p := load(ctxptr, code.Idx) + size := uintptr(code.Size) code = code.Next store(ctxptr, code.Idx, p+idx*size) } else { @@ -337,8 +397,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpMapPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -347,31 +407,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpMap: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } uptr := ptrToUnsafePtr(p) mlen := maplen(uptr) if mlen <= 0 { - b = appendEmptyObject(b) + b = appendEmptyObject(ctx, b) code = code.End.Next break } - b = appendStructHead(b) + b = appendStructHead(ctx, b) iter := mapiterinit(code.Type, uptr) ctx.KeepRefs = append(ctx.KeepRefs, iter) store(ctxptr, code.ElemIdx, 0) store(ctxptr, code.Length, uintptr(mlen)) store(ctxptr, code.MapIter, uintptr(iter)) - if (opt & encoder.UnorderedMapOption) == 0 { + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + b = appendMapKeyIndent(ctx, code.Next, b) + } else { mapCtx := encoder.NewMapContext(mlen) mapCtx.Pos = append(mapCtx.Pos, len(b)) ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx)) store(ctxptr, code.End.MapPos, uintptr(unsafe.Pointer(mapCtx))) - } else { - b = appendMapKeyIndent(ctx, code.Next, b) } key := mapiterkey(iter) store(ctxptr, code.Next.Idx, uintptr(key)) @@ -380,7 +440,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt idx := load(ctxptr, code.ElemIdx) length := load(ctxptr, code.Length) idx++ - if (opt & encoder.UnorderedMapOption) != 0 { + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { if idx < length { b = appendMapKeyIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) @@ -409,8 +469,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } case encoder.OpMapValue: - if (opt & encoder.UnorderedMapOption) != 0 { - b = appendColon(b) + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + b = appendColon(ctx, b) } else { ptr := load(ctxptr, code.End.MapPos) mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) @@ -479,7 +539,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt oldOffset := ptrOffset ptrOffset += code.Jmp.CurLen * uintptrSize oldBaseIndent := ctx.BaseIndent - ctx.BaseIndent += code.Indent - 1 + indentDiffFromTop := c.Indent - 1 + ctx.BaseIndent += code.Indent - indentDiffFromTop newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen if curlen < newLen { @@ -490,7 +551,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt 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, uintptr(oldBaseIndent)) + storeIndent(ctxptr, c.End.Next, uintptr(oldBaseIndent)) code = c recursiveLevel++ case encoder.OpRecursiveEnd: @@ -508,9 +569,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHead: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -519,29 +580,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHead: p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if !code.AnonymousKey && len(code.Key) > 0 { - b = appendStructKey(ctx, code, b) + if len(code.Key) > 0 { + if (code.Flags&encoder.IsTaggedKeyFlags) != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 { + b = appendStructKey(ctx, code, b) + } } - p += code.Offset + 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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -550,19 +613,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmpty: p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - p += code.Offset - if p == 0 || (ptrToPtr(p) == 0 && code.IsNextOpPtrType) { + p += uintptr(code.Offset) + if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -570,12 +633,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, p) } case encoder.OpStructPtrHeadInt: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -586,27 +649,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadInt: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) + b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyInt: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -617,33 +680,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyInt: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendComma(b) + b = appendInt(ctx, b, u64, code) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadIntString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -654,29 +717,29 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadIntString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -687,34 +750,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyIntString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, u64, code) + b = appendInt(ctx, b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadIntPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -723,34 +786,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadIntPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendInt(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -759,32 +822,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendInt(ctx, b, ptrToUint64(p), code) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -793,36 +856,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadIntPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -831,35 +894,35 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadUint: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -870,27 +933,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadUint: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) + b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUint: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -901,33 +964,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyUint: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendComma(b) + b = appendUint(ctx, b, u64, code) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadUintString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -938,29 +1001,29 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadUintString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -971,34 +1034,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyUintString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, u64, code) + b = appendUint(ctx, b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadUintPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1007,34 +1070,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadUintPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendUint(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1043,32 +1106,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendUint(ctx, b, ptrToUint64(p), code) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1077,36 +1140,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadUintPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1115,35 +1178,35 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat32: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1154,27 +1217,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat32: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1185,32 +1248,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat32: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToFloat32(p + code.Offset) + v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat32String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1221,29 +1284,29 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat32String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1254,33 +1317,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat32String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToFloat32(p + code.Offset) + v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1289,34 +1352,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat32Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1325,32 +1388,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1359,36 +1422,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat32PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1397,35 +1460,35 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat64: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1436,31 +1499,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat64: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1471,17 +1534,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat64: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1489,17 +1552,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt return nil, errUnsupportedFloat(v) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat64String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1510,33 +1573,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat64String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToFloat64(p + code.Offset) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1547,17 +1610,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat64String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1566,17 +1629,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1585,38 +1648,38 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat64Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { v := ptrToFloat64(p) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1625,19 +1688,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1645,16 +1708,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + 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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1663,40 +1726,40 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat64PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1705,19 +1768,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1726,18 +1789,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1748,27 +1811,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1779,32 +1842,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToString(p + code.Offset) + v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadStringString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1815,27 +1878,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadStringString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p+code.Offset)))) - b = appendComma(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.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1846,31 +1909,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyStringString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToString(p + code.Offset) + v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1879,34 +1942,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadStringPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1915,32 +1978,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1949,34 +2012,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadStringPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1985,33 +2048,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadBool: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2022,27 +2085,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBool: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBool: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2053,32 +2116,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBool: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToBool(p + code.Offset) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } else { code = code.NextField } case encoder.OpStructPtrHeadBoolString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2089,29 +2152,29 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBoolString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2122,23 +2185,23 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBoolString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToBool(p + code.Offset) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } else { code = code.NextField @@ -2146,9 +2209,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2157,34 +2220,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBoolPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2193,32 +2256,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2227,36 +2290,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBoolPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2265,35 +2328,35 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadBytes: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2304,27 +2367,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBytes: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytes: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2335,31 +2398,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBytes: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToBytes(p + code.Offset) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2368,34 +2431,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBytesPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2404,33 +2467,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadNumber: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2441,30 +2504,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadNumber: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumber: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2475,35 +2538,35 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyNumber: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToNumber(p + code.Offset) + v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next } case encoder.OpStructPtrHeadNumberString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2514,32 +2577,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadNumberString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2550,36 +2613,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyNumberString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToNumber(p + code.Offset) + v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2588,38 +2651,38 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadNumberPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2628,35 +2691,35 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2665,39 +2728,39 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadNumberPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2706,38 +2769,38 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2748,27 +2811,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - p += code.Offset + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptyArray: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2779,27 +2842,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyArray: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - p += code.Offset + p += uintptr(code.Offset) b = appendStructKey(ctx, code, b) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptySlice: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2810,17 +2873,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptySlice: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - p += code.Offset + p += uintptr(code.Offset) slice := ptrToSlice(p) if slice.Len == 0 { code = code.NextField @@ -2832,9 +2895,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2843,24 +2906,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField } else { code = code.Next @@ -2869,9 +2932,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2880,19 +2943,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { code = code.NextField @@ -2904,9 +2967,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMap: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2915,29 +2978,29 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMap: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) + 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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2946,19 +3009,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMap: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) } if maplen(ptrToUnsafePtr(p)) == 0 { code = code.NextField @@ -2970,9 +3033,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2981,31 +3044,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMapPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField break } - p = ptrToPtr(p + code.Offset) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField } else { - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p, code.PtrNum) } code = code.Next @@ -3014,9 +3077,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMapPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3025,26 +3088,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMapPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } if p == 0 { code = code.NextField break } - p = ptrToPtr(p + code.Offset) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { code = code.NextField } else { - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p, code.PtrNum) } b = appendStructKey(ctx, code, b) @@ -3054,38 +3117,38 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if code.Indirect { + 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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalJSON { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { - b = appendNull(b) + 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 { @@ -3093,42 +3156,42 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if code.Indirect { + 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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) } } iface := ptrToInterface(code, p) - if code.Nilcheck && encoder.IsNilForMarshaler(iface) { + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3137,15 +3200,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3154,23 +3217,23 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -3178,14 +3241,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3194,19 +3257,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } if p == 0 { code = code.NextField @@ -3217,103 +3280,103 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalText: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if code.Indirect { + 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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalText { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { - b = appendNull(b) + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if code.Indirect { + 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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3322,38 +3385,38 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMarshalTextPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3362,43 +3425,43 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } - if !code.AnonymousHead { - b = appendStructHead(b) + 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(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructField: - if !code.AnonymousKey { + if code.Flags&encoder.IsTaggedKeyFlags != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 { b = appendStructKey(ctx, code, b) } - p := load(ctxptr, code.HeadIdx) + code.Offset + p := load(ctxptr, code.Idx) + uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmpty: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { + 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) @@ -3406,298 +3469,298 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, p) } case encoder.OpStructFieldInt: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) + b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendComma(b) + b = appendInt(ctx, b, u64, code) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, u64, code) + b = appendInt(ctx, b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendInt(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendInt(ctx, b, ptrToUint64(p), code) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUint: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) + b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendComma(b) + b = appendUint(ctx, b, u64, code) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, u64, code) + b = appendUint(ctx, b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendUint(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendUint(ctx, b, ptrToUint64(p), code) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32String: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + 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(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -3705,42 +3768,42 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3748,307 +3811,307 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringString: - p := load(ctxptr, code.HeadIdx) - s := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + s := ptrToString(p + uintptr(code.Offset)) b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, s))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(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.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBytes: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldNumber: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldNumberString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldMarshalJSON: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { - b = appendNull(b) + 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 { @@ -4056,20 +4119,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSON: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField break } iface := ptrToInterface(code, p) - if code.Nilcheck && encoder.IsNilForMarshaler(iface) { + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { code = code.NextField break } @@ -4078,14 +4141,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -4093,103 +4156,103 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldMarshalText: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { - b = appendNull(b) + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalText: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField break } b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldArray: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + 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.HeadIdx) - p += code.Offset + 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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) code = code.Next @@ -4199,13 +4262,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldSlice: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptySlice: - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) slice := ptrToSlice(p) if slice.Len == 0 { code = code.NextField @@ -4216,13 +4279,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldSlicePtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) code = code.Next @@ -4232,13 +4295,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldMap: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + 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.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 { code = code.NextField } else { @@ -4248,16 +4311,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldMapPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + 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.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p != 0 { p = ptrToNPtr(p, code.PtrNum) } @@ -4270,14 +4333,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldStruct: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyStruct: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { + 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) @@ -4290,39 +4353,39 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEndSkipLast(ctx, code, b) code = code.Next case encoder.OpStructEndInt: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) + b = appendInt(ctx, b, u64, code) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) } code = code.Next case encoder.OpStructEndIntString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, u64, code) + b = appendInt(ctx, b, u64, code) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4331,21 +4394,21 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndIntPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendInt(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4353,24 +4416,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndIntPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) b = append(b, '"') } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4378,39 +4441,39 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndUint: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) + b = appendUint(ctx, b, u64, code) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) } code = code.Next case encoder.OpStructEndUintString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, u64, code) + b = appendUint(ctx, b, u64, code) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4419,21 +4482,21 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndUintPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendUint(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4441,24 +4504,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndUintPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) b = append(b, '"') } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4466,37 +4529,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat32: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) + 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.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + 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.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4505,21 +4568,21 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat32Ptr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4527,24 +4590,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat32PtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4552,51 +4615,51 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + 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(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + 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(b, v) + 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.HeadIdx) - v := ptrToFloat64(p + code.Offset) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4605,10 +4668,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat64Ptr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) b = appendStructEnd(ctx, code, b) code = code.Next break @@ -4617,19 +4680,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4637,24 +4700,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat64PtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -4662,7 +4725,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt return nil, errUnsupportedFloat(v) } b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4670,35 +4733,35 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, v) + 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.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - s := ptrToString(p + code.Offset) - b = appendString(b, string(appendString([]byte{}, s))) + 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.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4706,21 +4769,21 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndStringPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4728,58 +4791,58 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndStringPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + 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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + 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.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) + 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.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + 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.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4788,21 +4851,21 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBoolPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4810,24 +4873,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBoolPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4835,17 +4898,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBytes: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) + b = appendByteSlice(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4853,41 +4916,41 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBytesPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) + 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.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + 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.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } @@ -4897,10 +4960,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndNumberString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -4908,12 +4971,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } @@ -4925,12 +4988,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndNumberPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4939,11 +5002,11 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4954,13 +5017,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndNumberPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4969,12 +5032,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } 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 @@ -0,0 +1,34 @@ +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 { + fmt.Println("=============[DEBUG]===============") + fmt.Println("* [TYPE]") + fmt.Println(codeSet.Type) + fmt.Printf("\n") + fmt.Println("* [ALL OPCODE]") + fmt.Println(code.Dump()) + fmt.Printf("\n") + fmt.Println("* [CONTEXT]") + fmt.Printf("%+v\n", ctx) + fmt.Println("===================================") + 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 @@ -0,0 +1,9 @@ +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 @@ -0,0 +1,255 @@ +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) 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 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, v uint64, code *encoder.Opcode) []byte { + format := ctx.Option.ColorScheme.Int + b = append(b, format.Header...) + b = encoder.AppendInt(ctx, b, v, code) + return append(b, format.Footer...) +} + +func appendUint(ctx *encoder.RuntimeContext, b []byte, v uint64, code *encoder.Opcode) []byte { + format := ctx.Option.ColorScheme.Uint + b = append(b, format.Header...) + b = encoder.AppendUint(ctx, b, v, 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 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 @@ -0,0 +1,5056 @@ +// Code generated by internal/cmd/generator. DO NOT EDIT! +package vm_color + +import ( + "math" + "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 = appendNull(ctx, b) + b = appendComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpInt: + b = appendInt(ctx, b, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpUint: + b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpIntString: + b = append(b, '"') + b = appendInt(ctx, b, ptrToUint64(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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpInterface: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNull(ctx, b) + b = appendComma(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 + typ = iface.itab.typ + } else { + iface := (*emptyInterface)(up) + ifacePtr = iface.ptr + typ = iface.typ + } + if ifacePtr == nil { + b = appendNull(ctx, b) + b = appendComma(ctx, b) + code = code.Next + break + } + ctx.KeepRefs = append(ctx.KeepRefs, up) + ifaceCodeSet, err := encoder.CompileToGetCodeSet(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 + indentDiffFromTop := c.Indent - 1 + ctx.BaseIndent += code.Indent - indentDiffFromTop + + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, 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 := 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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) + iter := mapiterinit(code.Type, uptr) + ctx.KeepRefs = append(ctx.KeepRefs, iter) + store(ctxptr, code.ElemIdx, 0) + store(ctxptr, code.Length, uintptr(mlen)) + store(ctxptr, code.MapIter, uintptr(iter)) + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + b = appendMapKeyIndent(ctx, code.Next, b) + } else { + mapCtx := encoder.NewMapContext(mlen) + mapCtx.Pos = append(mapCtx.Pos, len(b)) + ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx)) + store(ctxptr, code.End.MapPos, uintptr(unsafe.Pointer(mapCtx))) + } + key := mapiterkey(iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + case encoder.OpMapKey: + idx := load(ctxptr, code.ElemIdx) + length := load(ctxptr, code.Length) + idx++ + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + if idx < length { + b = appendMapKeyIndent(ctx, code, b) + store(ctxptr, code.ElemIdx, idx) + ptr := load(ctxptr, code.MapIter) + iter := ptrToUnsafePtr(ptr) + key := mapiterkey(iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + } else { + b = appendObjectEnd(ctx, code, b) + code = code.End.Next + } + } else { + ptr := load(ctxptr, code.End.MapPos) + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) + mapCtx.Pos = append(mapCtx.Pos, len(b)) + if idx < length { + ptr := load(ctxptr, code.MapIter) + iter := ptrToUnsafePtr(ptr) + store(ctxptr, code.ElemIdx, idx) + key := mapiterkey(iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + } else { + code = code.End + } + } + case encoder.OpMapValue: + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + b = appendColon(ctx, b) + } else { + ptr := load(ctxptr, code.End.MapPos) + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) + mapCtx.Pos = append(mapCtx.Pos, len(b)) + } + ptr := load(ctxptr, code.MapIter) + iter := ptrToUnsafePtr(ptr) + value := mapitervalue(iter) + store(ctxptr, code.Next.Idx, uintptr(value)) + mapiternext(iter) + code = code.Next + case encoder.OpMapEnd: + // this operation only used by sorted map. + length := int(load(ctxptr, code.Length)) + ptr := load(ctxptr, code.MapPos) + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) + pos := mapCtx.Pos + for i := 0; i < length; i++ { + startKey := pos[i*2] + startValue := pos[i*2+1] + var endValue int + if i+1 < length { + endValue = pos[i*2+2] + } else { + endValue = len(b) + } + mapCtx.Slice.Items = append(mapCtx.Slice.Items, encoder.MapItem{ + Key: b[startKey:startValue], + Value: b[startValue:endValue], + }) + } + 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[:pos[0]] + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = appendInt(ctx, b, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, u64, 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 = appendNull(ctx, b) + b = appendComma(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 = 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 = append(b, '"') + b = appendInt(ctx, b, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p + uintptr(code.Offset)) + 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, u64, 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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = appendUint(ctx, b, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, u64, 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 = appendNull(ctx, b) + b = appendComma(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 = 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 = append(b, '"') + b = appendUint(ctx, b, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p + uintptr(code.Offset)) + 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, u64, 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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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, 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + if p == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) + code = code.NextField + break + } + p = ptrToPtr(p + uintptr(code.Offset)) + if p == 0 { + b = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) + } + } + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) + } + } + 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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) + } + } + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) + } + } + 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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, u64, 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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, u64, 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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, u64, 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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, u64, 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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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.OpStructAnonymousEnd: + code = code.Next + 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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, u64, 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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, u64, 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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, u64, 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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, u64, 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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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 @@ -0,0 +1,34 @@ +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 { + fmt.Println("=============[DEBUG]===============") + fmt.Println("* [TYPE]") + fmt.Println(codeSet.Type) + fmt.Printf("\n") + fmt.Println("* [ALL OPCODE]") + fmt.Println(code.Dump()) + fmt.Printf("\n") + fmt.Println("* [CONTEXT]") + fmt.Printf("%+v\n", ctx) + fmt.Println("===================================") + 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 @@ -0,0 +1,276 @@ +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) 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 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, v uint64, code *encoder.Opcode) []byte { + format := ctx.Option.ColorScheme.Int + b = append(b, format.Header...) + b = encoder.AppendInt(ctx, b, v, code) + return append(b, format.Footer...) +} + +func appendUint(ctx *encoder.RuntimeContext, b []byte, v uint64, code *encoder.Opcode) []byte { + format := ctx.Option.ColorScheme.Uint + b = append(b, format.Header...) + b = encoder.AppendUint(ctx, b, v, 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 appendColon(_ *encoder.RuntimeContext, b []byte) []byte { + return append(b, ':', ' ') +} + +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 + b[last] = '\n' + b = appendIndent(ctx, b, code.Indent-1) + 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 @@ -0,0 +1,5056 @@ +// Code generated by internal/cmd/generator. DO NOT EDIT! +package vm_color_indent + +import ( + "math" + "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 = appendNull(ctx, b) + b = appendComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpInt: + b = appendInt(ctx, b, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpUint: + b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code) + b = appendComma(ctx, b) + code = code.Next + case encoder.OpIntString: + b = append(b, '"') + b = appendInt(ctx, b, ptrToUint64(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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + code = code.Next + break + } + store(ctxptr, code.Idx, p) + fallthrough + case encoder.OpInterface: + p := load(ctxptr, code.Idx) + if p == 0 { + b = appendNull(ctx, b) + b = appendComma(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 + typ = iface.itab.typ + } else { + iface := (*emptyInterface)(up) + ifacePtr = iface.ptr + typ = iface.typ + } + if ifacePtr == nil { + b = appendNull(ctx, b) + b = appendComma(ctx, b) + code = code.Next + break + } + ctx.KeepRefs = append(ctx.KeepRefs, up) + ifaceCodeSet, err := encoder.CompileToGetCodeSet(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 + indentDiffFromTop := c.Indent - 1 + ctx.BaseIndent += code.Indent - indentDiffFromTop + + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, 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 := 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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) + iter := mapiterinit(code.Type, uptr) + ctx.KeepRefs = append(ctx.KeepRefs, iter) + store(ctxptr, code.ElemIdx, 0) + store(ctxptr, code.Length, uintptr(mlen)) + store(ctxptr, code.MapIter, uintptr(iter)) + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + b = appendMapKeyIndent(ctx, code.Next, b) + } else { + mapCtx := encoder.NewMapContext(mlen) + mapCtx.Pos = append(mapCtx.Pos, len(b)) + ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx)) + store(ctxptr, code.End.MapPos, uintptr(unsafe.Pointer(mapCtx))) + } + key := mapiterkey(iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + case encoder.OpMapKey: + idx := load(ctxptr, code.ElemIdx) + length := load(ctxptr, code.Length) + idx++ + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + if idx < length { + b = appendMapKeyIndent(ctx, code, b) + store(ctxptr, code.ElemIdx, idx) + ptr := load(ctxptr, code.MapIter) + iter := ptrToUnsafePtr(ptr) + key := mapiterkey(iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + } else { + b = appendObjectEnd(ctx, code, b) + code = code.End.Next + } + } else { + ptr := load(ctxptr, code.End.MapPos) + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) + mapCtx.Pos = append(mapCtx.Pos, len(b)) + if idx < length { + ptr := load(ctxptr, code.MapIter) + iter := ptrToUnsafePtr(ptr) + store(ctxptr, code.ElemIdx, idx) + key := mapiterkey(iter) + store(ctxptr, code.Next.Idx, uintptr(key)) + code = code.Next + } else { + code = code.End + } + } + case encoder.OpMapValue: + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + b = appendColon(ctx, b) + } else { + ptr := load(ctxptr, code.End.MapPos) + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) + mapCtx.Pos = append(mapCtx.Pos, len(b)) + } + ptr := load(ctxptr, code.MapIter) + iter := ptrToUnsafePtr(ptr) + value := mapitervalue(iter) + store(ctxptr, code.Next.Idx, uintptr(value)) + mapiternext(iter) + code = code.Next + case encoder.OpMapEnd: + // this operation only used by sorted map. + length := int(load(ctxptr, code.Length)) + ptr := load(ctxptr, code.MapPos) + mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) + pos := mapCtx.Pos + for i := 0; i < length; i++ { + startKey := pos[i*2] + startValue := pos[i*2+1] + var endValue int + if i+1 < length { + endValue = pos[i*2+2] + } else { + endValue = len(b) + } + mapCtx.Slice.Items = append(mapCtx.Slice.Items, encoder.MapItem{ + Key: b[startKey:startValue], + Value: b[startValue:endValue], + }) + } + 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[:pos[0]] + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = appendInt(ctx, b, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, u64, 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 = appendNull(ctx, b) + b = appendComma(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 = 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 = append(b, '"') + b = appendInt(ctx, b, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p + uintptr(code.Offset)) + 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, u64, 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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = appendUint(ctx, b, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v == 0 { + code = code.NextField + } else { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, u64, 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 = appendNull(ctx, b) + b = appendComma(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 = 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 = append(b, '"') + b = appendUint(ctx, b, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + u64 := ptrToUint64(p + uintptr(code.Offset)) + 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, u64, 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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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, 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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 = 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) + } + if p == 0 { + b = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + if p == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) + code = code.NextField + break + } + p = ptrToPtr(p + uintptr(code.Offset)) + if p == 0 { + b = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) + } + } + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) + } + } + 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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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 = 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) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) + } + } + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(ctx, b) + } + code = code.End.Next + break + } + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) + } + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) + } + } + 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 = appendNull(ctx, b) + b = appendComma(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 = 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) + 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 = appendNull(ctx, b) + b = appendComma(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 = appendNull(ctx, b) + b = appendComma(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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, u64, 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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, u64, 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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, u64, 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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, u64, 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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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 = appendNull(ctx, b) + b = appendComma(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.OpStructAnonymousEnd: + code = code.Next + 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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendInt(ctx, b, u64, 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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendInt(ctx, b, u64, 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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = appendUint(ctx, b, u64, 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, ptrToUint64(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)) + v := u64 & ((1 << code.NumBitSize) - 1) + if v != 0 { + b = appendStructKey(ctx, code, b) + b = append(b, '"') + b = appendUint(ctx, b, u64, 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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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, ptrToUint64(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_escaped/debug_vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_escaped/debug_vm.go @@ -1,27 +0,0 @@ -package vm_escaped - -import ( - "fmt" - - "github.com/goccy/go-json/internal/encoder" -) - -func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt encoder.Option) ([]byte, error) { - defer func() { - if err := recover(); err != nil { - fmt.Println("=============[DEBUG]===============") - fmt.Println("* [TYPE]") - fmt.Println(codeSet.Type) - fmt.Printf("\n") - fmt.Println("* [ALL OPCODE]") - fmt.Println(codeSet.Code.Dump()) - fmt.Printf("\n") - fmt.Println("* [CONTEXT]") - fmt.Printf("%+v\n", ctx) - fmt.Println("===================================") - panic(err) - } - }() - - return Run(ctx, b, codeSet, opt) -} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_escaped/hack.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_escaped/hack.go @@ -1,9 +0,0 @@ -package vm_escaped - -import ( - // HACK: compile order - // `vm`, `vm_escaped`, `vm_indent`, `vm_escaped_indent` packages uses a lot of memory to compile, - // so forcibly make dependencies and avoid compiling in concurrent. - // dependency order: vm => vm_escaped => vm_indent => vm_escaped_indent - _ "github.com/goccy/go-json/internal/encoder/vm_indent" -) diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_escaped/util.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_escaped/util.go @@ -1,215 +0,0 @@ -package vm_escaped - -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.AppendEscapedString - 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 -} - -func errUnimplementedOp(op encoder.OpType) error { - return fmt.Errorf("encoder (escaped): opcode %s has not been implemented", op) -} - -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)) - for i := 0; i < ptrNum; i++ { - if p == 0 { - return 0 - } - 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 *encoder.Opcode, p uintptr) interface{} { - return *(*interface{})(unsafe.Pointer(&emptyInterface{ - typ: code.Type, - ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)), - })) -} - -func appendBool(b []byte, v bool) []byte { - if v { - return append(b, "true"...) - } - return append(b, "false"...) -} - -func appendNull(b []byte) []byte { - return append(b, "null"...) -} - -func appendComma(b []byte) []byte { - return append(b, ',') -} - -func appendColon(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 appendInterface(ctx *encoder.RuntimeContext, codeSet *encoder.OpcodeSet, opt encoder.Option, _ *encoder.Opcode, b []byte, iface *emptyInterface, ptrOffset uintptr) ([]byte, error) { - ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(iface)) - ifaceCodeSet, err := encoder.CompileToGetCodeSet(uintptr(unsafe.Pointer(iface.typ))) - if err != nil { - return nil, err - } - - totalLength := uintptr(codeSet.CodeLength) - nextTotalLength := uintptr(ifaceCodeSet.CodeLength) - - curlen := uintptr(len(ctx.Ptrs)) - offsetNum := ptrOffset / uintptrSize - - newLen := offsetNum + totalLength + nextTotalLength - if curlen < newLen { - ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) - } - oldPtrs := ctx.Ptrs - - newPtrs := ctx.Ptrs[(ptrOffset+totalLength*uintptrSize)/uintptrSize:] - newPtrs[0] = uintptr(iface.ptr) - - ctx.Ptrs = newPtrs - - bb, err := Run(ctx, b, ifaceCodeSet, opt) - if err != nil { - return nil, err - } - - ctx.Ptrs = oldPtrs - return bb, nil -} - -func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalJSON(ctx, code, b, v, true) -} - -func appendMarshalText(code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalText(code, b, v, true) -} - -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(b []byte) []byte { - return append(b, '[', ']', ',') -} - -func appendEmptyObject(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(b []byte) []byte { - return append(b, '{') -} - -func appendStructKey(_ *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { - return append(b, code.EscapedKey...) -} - -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(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_escaped/vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_escaped/vm.go @@ -1,4993 +0,0 @@ -// Code generated by internal/cmd/generator. DO NOT EDIT! -package vm_escaped - -import ( - "math" - "sort" - "unsafe" - - "github.com/goccy/go-json/internal/encoder" -) - -func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt encoder.Option) ([]byte, error) { - recursiveLevel := 0 - ptrOffset := uintptr(0) - ctxptr := ctx.Ptr() - code := codeSet.Code - - 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 = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpInt: - b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) - code = code.Next - case encoder.OpUintPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpUint: - b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) - code = code.Next - case encoder.OpIntString: - b = append(b, '"') - b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpUintString: - b = append(b, '"') - b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpFloat32Ptr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpFloat32: - b = appendFloat32(b, ptrToFloat32(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpFloat64Ptr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(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(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStringPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpString: - b = appendString(b, ptrToString(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpBoolPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpBool: - b = appendBool(b, ptrToBool(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpBytesPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpBytes: - b = appendByteSlice(b, ptrToBytes(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpNumberPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpNumber: - bb, err := appendNumber(b, ptrToNumber(load(ctxptr, code.Idx))) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpInterfacePtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpInterface: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - for _, seen := range ctx.SeenPtr { - if p == seen { - return nil, errUnsupportedValue(code, p) - } - } - ctx.SeenPtr = append(ctx.SeenPtr, p) - iface := (*emptyInterface)(ptrToUnsafePtr(p)) - if iface.ptr == nil { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - bb, err := appendInterface(ctx, codeSet, opt, code, b, iface, ptrOffset) - if err != nil { - return nil, err - } - ctxptr = ctx.Ptr() - ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1] - - b = bb - code = code.Next - case encoder.OpMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, ptrToPtr(p)) - fallthrough - case encoder.OpMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - if code.IsNilableType && code.Indirect { - p = ptrToPtr(p) - } - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(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(b) - code = code.Next - break - } - if code.IsNilableType && code.Indirect { - p = ptrToPtr(p) - } - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpSlicePtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(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 = appendNull(b) - b = appendComma(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(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.HeadIdx) - size := 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 = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpArray: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(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(b) - code = code.End.Next - } - case encoder.OpArrayElem: - idx := load(ctxptr, code.ElemIdx) - idx++ - if idx < code.Length { - b = appendArrayElemIndent(ctx, code, b) - store(ctxptr, code.ElemIdx, idx) - p := load(ctxptr, code.HeadIdx) - size := 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 = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpMap: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - uptr := ptrToUnsafePtr(p) - mlen := maplen(uptr) - if mlen <= 0 { - b = appendEmptyObject(b) - code = code.End.Next - break - } - b = appendStructHead(b) - iter := mapiterinit(code.Type, uptr) - ctx.KeepRefs = append(ctx.KeepRefs, iter) - store(ctxptr, code.ElemIdx, 0) - store(ctxptr, code.Length, uintptr(mlen)) - store(ctxptr, code.MapIter, uintptr(iter)) - if (opt & encoder.UnorderedMapOption) == 0 { - mapCtx := encoder.NewMapContext(mlen) - mapCtx.Pos = append(mapCtx.Pos, len(b)) - ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx)) - store(ctxptr, code.End.MapPos, uintptr(unsafe.Pointer(mapCtx))) - } else { - b = appendMapKeyIndent(ctx, code.Next, b) - } - key := mapiterkey(iter) - store(ctxptr, code.Next.Idx, uintptr(key)) - code = code.Next - case encoder.OpMapKey: - idx := load(ctxptr, code.ElemIdx) - length := load(ctxptr, code.Length) - idx++ - if (opt & encoder.UnorderedMapOption) != 0 { - if idx < length { - b = appendMapKeyIndent(ctx, code, b) - store(ctxptr, code.ElemIdx, idx) - ptr := load(ctxptr, code.MapIter) - iter := ptrToUnsafePtr(ptr) - key := mapiterkey(iter) - store(ctxptr, code.Next.Idx, uintptr(key)) - code = code.Next - } else { - b = appendObjectEnd(ctx, code, b) - code = code.End.Next - } - } else { - ptr := load(ctxptr, code.End.MapPos) - mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) - mapCtx.Pos = append(mapCtx.Pos, len(b)) - if idx < length { - ptr := load(ctxptr, code.MapIter) - iter := ptrToUnsafePtr(ptr) - store(ctxptr, code.ElemIdx, idx) - key := mapiterkey(iter) - store(ctxptr, code.Next.Idx, uintptr(key)) - code = code.Next - } else { - code = code.End - } - } - case encoder.OpMapValue: - if (opt & encoder.UnorderedMapOption) != 0 { - b = appendColon(b) - } else { - ptr := load(ctxptr, code.End.MapPos) - mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) - mapCtx.Pos = append(mapCtx.Pos, len(b)) - } - ptr := load(ctxptr, code.MapIter) - iter := ptrToUnsafePtr(ptr) - value := mapitervalue(iter) - store(ctxptr, code.Next.Idx, uintptr(value)) - mapiternext(iter) - code = code.Next - case encoder.OpMapEnd: - // this operation only used by sorted map. - length := int(load(ctxptr, code.Length)) - ptr := load(ctxptr, code.MapPos) - mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) - pos := mapCtx.Pos - for i := 0; i < length; i++ { - startKey := pos[i*2] - startValue := pos[i*2+1] - var endValue int - if i+1 < length { - endValue = pos[i*2+2] - } else { - endValue = len(b) - } - mapCtx.Slice.Items = append(mapCtx.Slice.Items, encoder.MapItem{ - Key: b[startKey:startValue], - Value: b[startValue:endValue], - }) - } - 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[:pos[0]] - 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 - ctx.BaseIndent += code.Indent - 1 - - 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, 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.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if !code.AnonymousKey && len(code.Key) > 0 { - b = appendStructKey(ctx, code, b) - } - p += code.Offset - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmpty: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - p += code.Offset - if p == 0 || (ptrToPtr(p) == 0 && code.IsNextOpPtrType) { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadInt: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyInt: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadIntString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyIntString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, u64, code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadIntPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendInt(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyIntPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadIntPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyIntPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadUint: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUint: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadUintString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUintString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, u64, code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadUintPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendUint(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUintPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadUintPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUintPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat32: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToFloat32(p + code.Offset) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat32String: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32String: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToFloat32(p + code.Offset) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat32Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendFloat32(b, ptrToFloat32(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat32PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat64: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - v := ptrToFloat64(p + code.Offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToFloat64(p + 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(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat64String: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToFloat64(p + code.Offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64String: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToFloat64(p + 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(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat64Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+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(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat64PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+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(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToString(p + code.Offset) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadStringString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p+code.Offset)))) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyStringString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToString(p + code.Offset) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadStringPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, ptrToString(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyStringPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadStringPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyStringPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadBool: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBool: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToBool(p + code.Offset) - if v { - b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) - code = code.Next - } else { - code = code.NextField - } - case encoder.OpStructPtrHeadBoolString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBoolString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToBool(p + code.Offset) - if v { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } else { - code = code.NextField - } - case encoder.OpStructPtrHeadBoolPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendBool(b, ptrToBool(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBoolPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadBoolPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadBytes: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBytes: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToBytes(p + code.Offset) - if len(v) == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadNumber: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumber: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToNumber(p + code.Offset) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - } - case encoder.OpStructPtrHeadNumberString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumberString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToNumber(p + code.Offset) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadNumberPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumberPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructPtrHeadNumberPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - p += code.Offset - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmptyArray: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - p += code.Offset - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmptySlice: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - p += 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.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+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.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) - } - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmptyMap: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if p != 0 && code.Indirect { - p = ptrToPtr(p + 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.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.NextField - break - } - p = ptrToPtr(p + code.Offset) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.NextField - } else { - if code.Indirect { - 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.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if p == 0 { - code = code.NextField - break - } - p = ptrToPtr(p + code.Offset) - if p == 0 { - code = code.NextField - } else { - if code.Indirect { - 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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalJSON { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { - p = ptrToPtr(p + code.Offset) - } - } - iface := ptrToInterface(code, p) - if code.Nilcheck && 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(b) - code = code.Next - } - case encoder.OpStructPtrHeadMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if !code.AnonymousHead { - b = appendStructHead(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(b) - code = code.Next - } - case encoder.OpStructPtrHeadMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalText { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if p == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - b = appendComma(b) - code = code.Next - } - case encoder.OpStructField: - if !code.AnonymousKey { - b = appendStructKey(ctx, code, b) - } - p := load(ctxptr, code.HeadIdx) + code.Offset - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmpty: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructFieldInt: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldIntString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, u64, code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendInt(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUint: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUintString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, u64, code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendUint(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32String: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendFloat32(b, ptrToFloat32(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p + code.Offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) - if v != 0 { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + 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(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+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(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+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(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldStringString: - p := load(ctxptr, code.HeadIdx) - s := ptrToString(p + code.Offset) - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, s))) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, ptrToString(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBool: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) - if v { - b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBoolString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) - if v { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendBool(b, ptrToBool(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBytes: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) - if len(v) > 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldNumber: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructFieldNumberString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructFieldNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldMarshalJSON: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { - p = ptrToPtr(p) - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalJSON: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { - p = ptrToPtr(p) - } - if p == 0 && code.Nilcheck { - code = code.NextField - break - } - iface := ptrToInterface(code, p) - if code.Nilcheck && 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(bb) - code = code.Next - case encoder.OpStructFieldMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+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(bb) - } - code = code.Next - case encoder.OpStructFieldMarshalText: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { - p = ptrToPtr(p) - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalText: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { - p = ptrToPtr(p) - } - if p == 0 && code.Nilcheck { - code = code.NextField - break - } - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpStructFieldMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructFieldArray: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyArray: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldArrayPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyArrayPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+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.HeadIdx) - p += code.Offset - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptySlice: - p := load(ctxptr, code.HeadIdx) - p += 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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptySlicePtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+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.HeadIdx) - p = ptrToPtr(p + code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyMap: - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + 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.HeadIdx) - p = ptrToPtr(p + 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.HeadIdx) - p = ptrToPtr(p + 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.HeadIdx) - p += code.Offset - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyStruct: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructAnonymousEnd: - code = code.Next - case encoder.OpStructEnd: - b = appendStructEndSkipLast(ctx, code, b) - code = code.Next - case encoder.OpStructEndInt: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndIntString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, u64, 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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendInt(b, ptrToUint64(p), code) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(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.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndUintString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, u64, 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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendUint(b, ptrToUint64(p), code) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(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.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat32String: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendFloat32(b, ptrToFloat32(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(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.HeadIdx) - v := ptrToFloat64(p + code.Offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) - if v != 0 { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + 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(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(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(b, v) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+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(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+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(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.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndStringString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - s := ptrToString(p + code.Offset) - b = appendString(b, string(appendString([]byte{}, s))) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, ptrToString(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBool: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) - if v { - b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBoolString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) - if v { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendBool(b, ptrToBool(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendBool(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(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.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) - if len(v) > 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndNumber: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) - if err != nil { - return nil, err - } - b = appendStructEnd(ctx, code, bb) - code = code.Next - case encoder.OpStructEndOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(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.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+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.HeadIdx) - v := ptrToNumber(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendNumber(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - bb, err := appendNumber(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(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_escaped_indent/debug_vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_escaped_indent/debug_vm.go @@ -1,27 +0,0 @@ -package vm_escaped_indent - -import ( - "fmt" - - "github.com/goccy/go-json/internal/encoder" -) - -func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt encoder.Option) ([]byte, error) { - defer func() { - if err := recover(); err != nil { - fmt.Println("=============[DEBUG]===============") - fmt.Println("* [TYPE]") - fmt.Println(codeSet.Type) - fmt.Printf("\n") - fmt.Println("* [ALL OPCODE]") - fmt.Println(codeSet.Code.Dump()) - fmt.Printf("\n") - fmt.Println("* [CONTEXT]") - fmt.Printf("%+v\n", ctx) - fmt.Println("===================================") - panic(err) - } - }() - - return Run(ctx, b, codeSet, opt) -} diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_escaped_indent/hack.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_escaped_indent/hack.go @@ -1,6 +0,0 @@ -package vm_escaped_indent - -// HACK: compile order -// `vm`, `vm_escaped`, `vm_indent`, `vm_escaped_indent` packages uses a lot of memory to compile, -// so forcibly make dependencies and avoid compiling in concurrent. -// dependency order: vm => vm_escaped => vm_indent => vm_escaped_indent diff --git a/vendor/github.com/goccy/go-json/internal/encoder/vm_escaped_indent/util.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_escaped_indent/util.go @@ -1,241 +0,0 @@ -package vm_escaped_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 -} - -func errUnimplementedOp(op encoder.OpType) error { - return fmt.Errorf("encoder (indent+escaped): opcode %s has not been implemented", op) -} - -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)) - for i := 0; i < ptrNum; i++ { - if p == 0 { - return 0 - } - 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 *encoder.Opcode, p uintptr) interface{} { - return *(*interface{})(unsafe.Pointer(&emptyInterface{ - typ: code.Type, - ptr: *(*unsafe.Pointer)(unsafe.Pointer(&p)), - })) -} - -func appendBool(b []byte, v bool) []byte { - if v { - return append(b, "true"...) - } - return append(b, "false"...) -} - -func appendNull(b []byte) []byte { - return append(b, "null"...) -} - -func appendComma(b []byte) []byte { - return append(b, ',', '\n') -} - -func appendColon(b []byte) []byte { - return append(b, ':', ' ') -} - -func appendInterface(ctx *encoder.RuntimeContext, codeSet *encoder.OpcodeSet, opt encoder.Option, code *encoder.Opcode, b []byte, iface *emptyInterface, ptrOffset uintptr) ([]byte, error) { - ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(iface)) - ifaceCodeSet, err := encoder.CompileToGetCodeSet(uintptr(unsafe.Pointer(iface.typ))) - if err != nil { - return nil, err - } - - totalLength := uintptr(codeSet.CodeLength) - nextTotalLength := uintptr(ifaceCodeSet.CodeLength) - - curlen := uintptr(len(ctx.Ptrs)) - offsetNum := ptrOffset / uintptrSize - - newLen := offsetNum + totalLength + nextTotalLength - if curlen < newLen { - ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) - } - oldPtrs := ctx.Ptrs - - newPtrs := ctx.Ptrs[(ptrOffset+totalLength*uintptrSize)/uintptrSize:] - newPtrs[0] = uintptr(iface.ptr) - - ctx.Ptrs = newPtrs - - oldBaseIndent := ctx.BaseIndent - ctx.BaseIndent = code.Indent - bb, err := Run(ctx, b, ifaceCodeSet, opt) - if err != nil { - return nil, err - } - ctx.BaseIndent = oldBaseIndent - - ctx.Ptrs = oldPtrs - - return bb, nil -} - -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(b []byte) []byte { - return append(b, '[', ']', ',', '\n') -} - -func appendEmptyObject(b []byte) []byte { - return append(b, '{', '}', ',', '\n') -} - -func appendObjectEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { - last := len(b) - 1 - b[last] = '\n' - b = appendIndent(ctx, b, code.Indent-1) - 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, true) -} - -func appendMarshalText(code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalTextIndent(code, b, v, true) -} - -func appendStructHead(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.EscapedKey...) - 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(b) -} - -func restoreIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, ctxptr uintptr) { - ctx.BaseIndent = int(load(ctxptr, code.Length)) -} - -func storeIndent(ctxptr uintptr, code *encoder.Opcode, indent uintptr) { - store(ctxptr, code.End.Next.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_escaped_indent/vm.go b/vendor/github.com/goccy/go-json/internal/encoder/vm_escaped_indent/vm.go @@ -1,4993 +0,0 @@ -// Code generated by internal/cmd/generator. DO NOT EDIT! -package vm_escaped_indent - -import ( - "math" - "sort" - "unsafe" - - "github.com/goccy/go-json/internal/encoder" -) - -func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt encoder.Option) ([]byte, error) { - recursiveLevel := 0 - ptrOffset := uintptr(0) - ctxptr := ctx.Ptr() - code := codeSet.Code - - 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 = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpInt: - b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) - code = code.Next - case encoder.OpUintPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpUint: - b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) - code = code.Next - case encoder.OpIntString: - b = append(b, '"') - b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpUintString: - b = append(b, '"') - b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpFloat32Ptr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpFloat32: - b = appendFloat32(b, ptrToFloat32(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpFloat64Ptr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(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(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStringPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpString: - b = appendString(b, ptrToString(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpBoolPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpBool: - b = appendBool(b, ptrToBool(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpBytesPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpBytes: - b = appendByteSlice(b, ptrToBytes(load(ctxptr, code.Idx))) - b = appendComma(b) - code = code.Next - case encoder.OpNumberPtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpNumber: - bb, err := appendNumber(b, ptrToNumber(load(ctxptr, code.Idx))) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpInterfacePtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpInterface: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - for _, seen := range ctx.SeenPtr { - if p == seen { - return nil, errUnsupportedValue(code, p) - } - } - ctx.SeenPtr = append(ctx.SeenPtr, p) - iface := (*emptyInterface)(ptrToUnsafePtr(p)) - if iface.ptr == nil { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - bb, err := appendInterface(ctx, codeSet, opt, code, b, iface, ptrOffset) - if err != nil { - return nil, err - } - ctxptr = ctx.Ptr() - ctx.SeenPtr = ctx.SeenPtr[:len(ctx.SeenPtr)-1] - - b = bb - code = code.Next - case encoder.OpMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - store(ctxptr, code.Idx, ptrToPtr(p)) - fallthrough - case encoder.OpMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - if code.IsNilableType && code.Indirect { - p = ptrToPtr(p) - } - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(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(b) - code = code.Next - break - } - if code.IsNilableType && code.Indirect { - p = ptrToPtr(p) - } - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpSlicePtr: - p := loadNPtr(ctxptr, code.Idx, code.PtrNum) - if p == 0 { - b = appendNull(b) - b = appendComma(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 = appendNull(b) - b = appendComma(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(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.HeadIdx) - size := 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 = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpArray: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(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(b) - code = code.End.Next - } - case encoder.OpArrayElem: - idx := load(ctxptr, code.ElemIdx) - idx++ - if idx < code.Length { - b = appendArrayElemIndent(ctx, code, b) - store(ctxptr, code.ElemIdx, idx) - p := load(ctxptr, code.HeadIdx) - size := 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 = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - store(ctxptr, code.Idx, p) - fallthrough - case encoder.OpMap: - p := load(ctxptr, code.Idx) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.End.Next - break - } - uptr := ptrToUnsafePtr(p) - mlen := maplen(uptr) - if mlen <= 0 { - b = appendEmptyObject(b) - code = code.End.Next - break - } - b = appendStructHead(b) - iter := mapiterinit(code.Type, uptr) - ctx.KeepRefs = append(ctx.KeepRefs, iter) - store(ctxptr, code.ElemIdx, 0) - store(ctxptr, code.Length, uintptr(mlen)) - store(ctxptr, code.MapIter, uintptr(iter)) - if (opt & encoder.UnorderedMapOption) == 0 { - mapCtx := encoder.NewMapContext(mlen) - mapCtx.Pos = append(mapCtx.Pos, len(b)) - ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx)) - store(ctxptr, code.End.MapPos, uintptr(unsafe.Pointer(mapCtx))) - } else { - b = appendMapKeyIndent(ctx, code.Next, b) - } - key := mapiterkey(iter) - store(ctxptr, code.Next.Idx, uintptr(key)) - code = code.Next - case encoder.OpMapKey: - idx := load(ctxptr, code.ElemIdx) - length := load(ctxptr, code.Length) - idx++ - if (opt & encoder.UnorderedMapOption) != 0 { - if idx < length { - b = appendMapKeyIndent(ctx, code, b) - store(ctxptr, code.ElemIdx, idx) - ptr := load(ctxptr, code.MapIter) - iter := ptrToUnsafePtr(ptr) - key := mapiterkey(iter) - store(ctxptr, code.Next.Idx, uintptr(key)) - code = code.Next - } else { - b = appendObjectEnd(ctx, code, b) - code = code.End.Next - } - } else { - ptr := load(ctxptr, code.End.MapPos) - mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) - mapCtx.Pos = append(mapCtx.Pos, len(b)) - if idx < length { - ptr := load(ctxptr, code.MapIter) - iter := ptrToUnsafePtr(ptr) - store(ctxptr, code.ElemIdx, idx) - key := mapiterkey(iter) - store(ctxptr, code.Next.Idx, uintptr(key)) - code = code.Next - } else { - code = code.End - } - } - case encoder.OpMapValue: - if (opt & encoder.UnorderedMapOption) != 0 { - b = appendColon(b) - } else { - ptr := load(ctxptr, code.End.MapPos) - mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) - mapCtx.Pos = append(mapCtx.Pos, len(b)) - } - ptr := load(ctxptr, code.MapIter) - iter := ptrToUnsafePtr(ptr) - value := mapitervalue(iter) - store(ctxptr, code.Next.Idx, uintptr(value)) - mapiternext(iter) - code = code.Next - case encoder.OpMapEnd: - // this operation only used by sorted map. - length := int(load(ctxptr, code.Length)) - ptr := load(ctxptr, code.MapPos) - mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) - pos := mapCtx.Pos - for i := 0; i < length; i++ { - startKey := pos[i*2] - startValue := pos[i*2+1] - var endValue int - if i+1 < length { - endValue = pos[i*2+2] - } else { - endValue = len(b) - } - mapCtx.Slice.Items = append(mapCtx.Slice.Items, encoder.MapItem{ - Key: b[startKey:startValue], - Value: b[startValue:endValue], - }) - } - 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[:pos[0]] - 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 - ctx.BaseIndent += code.Indent - 1 - - 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, 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.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if !code.AnonymousKey && len(code.Key) > 0 { - b = appendStructKey(ctx, code, b) - } - p += code.Offset - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmpty: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - p += code.Offset - if p == 0 || (ptrToPtr(p) == 0 && code.IsNextOpPtrType) { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructPtrHeadInt: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyInt: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadIntString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyIntString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, u64, code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadIntPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendInt(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyIntPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadIntPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyIntPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadUint: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUint: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadUintString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUintString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, u64, code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadUintPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendUint(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUintPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadUintPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyUintPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat32: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToFloat32(p + code.Offset) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat32String: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32String: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToFloat32(p + code.Offset) - if v == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat32Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendFloat32(b, ptrToFloat32(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat32PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat64: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - v := ptrToFloat64(p + code.Offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToFloat64(p + 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(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat64String: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToFloat64(p + code.Offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64String: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToFloat64(p + 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(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadFloat64Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+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(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadFloat64PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+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(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToString(p + code.Offset) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadStringString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p+code.Offset)))) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyStringString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToString(p + code.Offset) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadStringPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, ptrToString(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyStringPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadStringPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyStringPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadBool: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBool: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToBool(p + code.Offset) - if v { - b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) - code = code.Next - } else { - code = code.NextField - } - case encoder.OpStructPtrHeadBoolString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBoolString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToBool(p + code.Offset) - if v { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - } else { - code = code.NextField - } - case encoder.OpStructPtrHeadBoolPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendBool(b, ptrToBool(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBoolPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadBoolPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadBytes: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBytes: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToBytes(p + code.Offset) - if len(v) == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyBytesPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadNumber: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumber: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToNumber(p + code.Offset) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - } - case encoder.OpStructPtrHeadNumberString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumberString: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - v := ptrToNumber(p + code.Offset) - if v == "" { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadNumberPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumberPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructPtrHeadNumberPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - p += code.Offset - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmptyArray: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - p += code.Offset - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmptySlice: - if code.Indirect { - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - p += 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.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.Indirect { - p = ptrToNPtr(p+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.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) - } - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructPtrHeadOmitEmptyMap: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if p != 0 && code.Indirect { - p = ptrToPtr(p + 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.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.NextField - break - } - p = ptrToPtr(p + code.Offset) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.NextField - } else { - if code.Indirect { - 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.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if p == 0 { - code = code.NextField - break - } - p = ptrToPtr(p + code.Offset) - if p == 0 { - code = code.NextField - } else { - if code.Indirect { - 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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalJSON { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyMarshalJSON: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { - p = ptrToPtr(p + code.Offset) - } - } - iface := ptrToInterface(code, p) - if code.Nilcheck && 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(b) - code = code.Next - } - case encoder.OpStructPtrHeadMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if !code.AnonymousHead { - b = appendStructHead(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(b) - code = code.Next - } - case encoder.OpStructPtrHeadMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalText { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - store(ctxptr, code.Idx, ptrToNPtr(p, code.PtrNum)) - } - fallthrough - case encoder.OpStructHeadOmitEmptyMarshalText: - p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { - p = ptrToPtr(p + code.Offset) - } - } - if p == 0 && code.Nilcheck { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - b = appendComma(b) - code = code.Next - } - case encoder.OpStructPtrHeadMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.Idx) - if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) - } - code = code.End.Next - break - } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) - } - if !code.AnonymousHead { - b = appendStructHead(b) - } - if p == 0 { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - b = appendComma(b) - code = code.Next - } - case encoder.OpStructField: - if !code.AnonymousKey { - b = appendStructKey(ctx, code, b) - } - p := load(ctxptr, code.HeadIdx) + code.Offset - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmpty: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructFieldInt: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldIntString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, u64, code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendInt(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUint: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUintString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, u64, code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendUint(b, ptrToUint64(p), code) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32String: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendFloat32(b, ptrToFloat32(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p + code.Offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) - if v != 0 { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + 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(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - b = appendComma(b) - code = code.Next - break - } - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+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(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+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(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldStringString: - p := load(ctxptr, code.HeadIdx) - s := ptrToString(p + code.Offset) - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, s))) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, ptrToString(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBool: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) - if v { - b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBoolString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) - b = append(b, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) - if v { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, v) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendBool(b, ptrToBool(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBytes: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) - if len(v) > 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldNumber: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructFieldNumberString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, v) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructFieldNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - b = appendStructKey(ctx, code, b) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) - if err != nil { - return nil, err - } - b = append(bb, '"') - b = appendComma(b) - } - code = code.Next - case encoder.OpStructFieldMarshalJSON: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { - p = ptrToPtr(p) - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalJSON: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { - p = ptrToPtr(p) - } - if p == 0 && code.Nilcheck { - code = code.NextField - break - } - iface := ptrToInterface(code, p) - if code.Nilcheck && 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(bb) - code = code.Next - case encoder.OpStructFieldMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+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(bb) - } - code = code.Next - case encoder.OpStructFieldMarshalText: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { - p = ptrToPtr(p) - } - if p == 0 && code.Nilcheck { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalText: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { - p = ptrToPtr(p) - } - if p == 0 && code.Nilcheck { - code = code.NextField - break - } - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - code = code.Next - case encoder.OpStructFieldMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = bb - } - b = appendComma(b) - code = code.Next - case encoder.OpStructFieldOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) - if err != nil { - return nil, err - } - b = appendComma(bb) - } - code = code.Next - case encoder.OpStructFieldArray: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyArray: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldArrayPtr: - b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyArrayPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+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.HeadIdx) - p += code.Offset - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptySlice: - p := load(ctxptr, code.HeadIdx) - p += 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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptySlicePtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+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.HeadIdx) - p = ptrToPtr(p + code.Offset) - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyMap: - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + 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.HeadIdx) - p = ptrToPtr(p + 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.HeadIdx) - p = ptrToPtr(p + 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.HeadIdx) - p += code.Offset - code = code.Next - store(ctxptr, code.Idx, p) - case encoder.OpStructFieldOmitEmptyStruct: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { - code = code.NextField - } else { - b = appendStructKey(ctx, code, b) - code = code.Next - store(ctxptr, code.Idx, p) - } - case encoder.OpStructAnonymousEnd: - code = code.Next - case encoder.OpStructEnd: - b = appendStructEndSkipLast(ctx, code, b) - code = code.Next - case encoder.OpStructEndInt: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndIntString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, u64, 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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendInt(b, ptrToUint64(p), code) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendInt(b, ptrToUint64(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.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndUintString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, u64, 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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendUint(b, ptrToUint64(p), code) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendUint(b, ptrToUint64(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.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat32String: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) - if v != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendFloat32(b, ptrToFloat32(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendFloat32(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat32(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.HeadIdx) - v := ptrToFloat64(p + code.Offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) - if v != 0 { - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendFloat64(b, v) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + 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(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(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(b, v) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+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(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - v := ptrToFloat64(p) - if math.IsInf(v, 0) || math.IsNaN(v) { - return nil, errUnsupportedFloat(v) - } - b = appendFloat64(b, v) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+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(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.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndStringString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - s := ptrToString(p + code.Offset) - b = appendString(b, string(appendString([]byte{}, s))) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, ptrToString(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBool: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) - if v { - b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndBoolString: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) - b = append(b, '"') - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) - if v { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendBool(b, ptrToBool(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendBool(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - b = appendBool(b, ptrToBool(p)) - b = append(b, '"') - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - b = appendBool(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.HeadIdx) - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) - if len(v) > 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = appendByteSlice(b, ptrToBytes(p)) - } - b = appendStructEnd(ctx, code, b) - code = code.Next - case encoder.OpStructEndOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendStructEnd(ctx, code, b) - } else { - b = appendStructEndSkipLast(ctx, code, b) - } - code = code.Next - case encoder.OpStructEndNumber: - p := load(ctxptr, code.HeadIdx) - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) - if err != nil { - return nil, err - } - b = appendStructEnd(ctx, code, bb) - code = code.Next - case encoder.OpStructEndOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(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.HeadIdx) - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+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.HeadIdx) - v := ptrToNumber(p + code.Offset) - if v != "" { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - bb, err := appendNumber(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - bb, err := appendNumber(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p == 0 { - b = appendNull(b) - } else { - b = append(b, '"') - bb, err := appendNumber(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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) - if p != 0 { - b = appendStructKey(ctx, code, b) - b = append(b, '"') - bb, err := appendNumber(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 @@ -6,7 +6,14 @@ import ( "github.com/goccy/go-json/internal/encoder" ) -func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt encoder.Option) ([]byte, error) { +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 { fmt.Println("=============[DEBUG]===============") @@ -14,7 +21,7 @@ func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, fmt.Println(codeSet.Type) fmt.Printf("\n") fmt.Println("* [ALL OPCODE]") - fmt.Println(codeSet.Code.Dump()) + fmt.Println(code.Dump()) fmt.Printf("\n") fmt.Println("* [CONTEXT]") fmt.Printf("%+v\n", ctx) @@ -23,5 +30,5 @@ func DebugRun(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, } }() - return Run(ctx, b, codeSet, opt) + 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 @@ -2,8 +2,8 @@ package vm_indent import ( // HACK: compile order - // `vm`, `vm_escaped`, `vm_indent`, `vm_escaped_indent` packages uses a lot of memory to compile, + // `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_escaped => vm_indent => vm_escaped_indent - _ "github.com/goccy/go-json/internal/encoder/vm_escaped_indent" + // 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 @@ -35,24 +35,33 @@ type emptyInterface struct { 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 uintptr) uintptr { - addr := base + idx +func load(base uintptr, idx uint32) uintptr { + addr := base + uintptr(idx) return **(**uintptr)(unsafe.Pointer(&addr)) } -func store(base uintptr, idx uintptr, p uintptr) { - addr := base + idx +func store(base uintptr, idx uint32, p uintptr) { + addr := base + uintptr(idx) **(**uintptr)(unsafe.Pointer(&addr)) = p } -func loadNPtr(base uintptr, idx uintptr, ptrNum int) uintptr { - addr := base + idx +func loadNPtr(base uintptr, idx uint32, ptrNum uint8) uintptr { + addr := base + uintptr(idx) p := **(**uintptr)(unsafe.Pointer(&addr)) - for i := 0; i < ptrNum; i++ { + for i := uint8(0); i < ptrNum; i++ { if p == 0 { return 0 } @@ -72,8 +81,8 @@ func ptrToSlice(p uintptr) *runtime.SliceHeader { return *(**runtime.SliceHeader 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++ { +func ptrToNPtr(p uintptr, ptrNum uint8) uintptr { + for i := uint8(0); i < ptrNum; i++ { if p == 0 { return 0 } @@ -92,62 +101,25 @@ func ptrToInterface(code *encoder.Opcode, p uintptr) interface{} { })) } -func appendBool(b []byte, v bool) []byte { +func appendBool(_ *encoder.RuntimeContext, b []byte, v bool) []byte { if v { return append(b, "true"...) } return append(b, "false"...) } -func appendNull(b []byte) []byte { +func appendNull(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, "null"...) } -func appendComma(b []byte) []byte { +func appendComma(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, ',', '\n') } -func appendColon(b []byte) []byte { +func appendColon(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, ':', ' ') } -func appendInterface(ctx *encoder.RuntimeContext, codeSet *encoder.OpcodeSet, opt encoder.Option, code *encoder.Opcode, b []byte, iface *emptyInterface, ptrOffset uintptr) ([]byte, error) { - ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(iface)) - ifaceCodeSet, err := encoder.CompileToGetCodeSet(uintptr(unsafe.Pointer(iface.typ))) - if err != nil { - return nil, err - } - - totalLength := uintptr(codeSet.CodeLength) - nextTotalLength := uintptr(ifaceCodeSet.CodeLength) - - curlen := uintptr(len(ctx.Ptrs)) - offsetNum := ptrOffset / uintptrSize - - newLen := offsetNum + totalLength + nextTotalLength - if curlen < newLen { - ctx.Ptrs = append(ctx.Ptrs, make([]uintptr, newLen-curlen)...) - } - oldPtrs := ctx.Ptrs - - newPtrs := ctx.Ptrs[(ptrOffset+totalLength*uintptrSize)/uintptrSize:] - newPtrs[0] = uintptr(iface.ptr) - - ctx.Ptrs = newPtrs - - oldBaseIndent := ctx.BaseIndent - ctx.BaseIndent = code.Indent - bb, err := Run(ctx, b, ifaceCodeSet, opt) - if err != nil { - return nil, err - } - ctx.BaseIndent = oldBaseIndent - - ctx.Ptrs = oldPtrs - - return bb, nil -} - func appendMapKeyValue(ctx *encoder.RuntimeContext, code *encoder.Opcode, b, key, value []byte) []byte { b = appendIndent(ctx, b, code.Indent+1) b = append(b, key...) @@ -175,11 +147,11 @@ func appendArrayEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) return append(b, ']', ',', '\n') } -func appendEmptyArray(b []byte) []byte { +func appendEmptyArray(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, '[', ']', ',', '\n') } -func appendEmptyObject(b []byte) []byte { +func appendEmptyObject(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, '{', '}', ',', '\n') } @@ -191,14 +163,14 @@ func appendObjectEnd(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte } func appendMarshalJSON(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalJSONIndent(ctx, code, b, v, false) + return encoder.AppendMarshalJSONIndent(ctx, code, b, v) } -func appendMarshalText(code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { - return encoder.AppendMarshalTextIndent(code, b, v, false) +func appendMarshalText(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte, v interface{}) ([]byte, error) { + return encoder.AppendMarshalTextIndent(ctx, code, b, v) } -func appendStructHead(b []byte) []byte { +func appendStructHead(_ *encoder.RuntimeContext, b []byte) []byte { return append(b, '{', '\n') } @@ -221,15 +193,15 @@ func appendStructEndSkipLast(ctx *encoder.RuntimeContext, code *encoder.Opcode, b = appendIndent(ctx, b, code.Indent-1) b = append(b, '}') } - return appendComma(b) + return appendComma(ctx, b) } func restoreIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, ctxptr uintptr) { - ctx.BaseIndent = int(load(ctxptr, code.Length)) + ctx.BaseIndent = uint32(load(ctxptr, code.Length)) } func storeIndent(ctxptr uintptr, code *encoder.Opcode, indent uintptr) { - store(ctxptr, code.End.Next.Length, indent) + store(ctxptr, code.Length, indent) } func appendArrayElemIndent(ctx *encoder.RuntimeContext, code *encoder.Opcode, b []byte) []byte { 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 @@ -7,13 +7,19 @@ import ( "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, opt encoder.Option) ([]byte, error) { +func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet) ([]byte, error) { recursiveLevel := 0 ptrOffset := uintptr(0) ctxptr := ctx.Ptr() - code := codeSet.Code + var code *encoder.Opcode + if (ctx.Option.Flag & encoder.HTMLEscapeOption) != 0 { + code = codeSet.EscapeKeyCode + } else { + code = codeSet.NoescapeKeyCode + } for { switch code.Op { @@ -26,62 +32,62 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpIntPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpInt: - b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) + b = appendInt(ctx, b, ptrToUint64(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 = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpUint: - b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) - b = appendComma(b) + b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code) + b = appendComma(ctx, b) code = code.Next case encoder.OpIntString: b = append(b, '"') - b = appendInt(b, ptrToUint64(load(ctxptr, code.Idx)), code) + b = appendInt(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpUintString: b = append(b, '"') - b = appendUint(b, ptrToUint64(load(ctxptr, code.Idx)), code) + b = appendUint(ctx, b, ptrToUint64(load(ctxptr, code.Idx)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpFloat32Ptr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpFloat32: - b = appendFloat32(b, ptrToFloat32(load(ctxptr, code.Idx))) - b = appendComma(b) + 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 = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -92,73 +98,73 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + 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 = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpString: - b = appendString(b, ptrToString(load(ctxptr, code.Idx))) - b = appendComma(b) + 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 = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpBool: - b = appendBool(b, ptrToBool(load(ctxptr, code.Idx))) - b = appendComma(b) + 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 = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpBytes: - b = appendByteSlice(b, ptrToBytes(load(ctxptr, code.Idx))) - b = appendComma(b) + 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 = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } store(ctxptr, code.Idx, p) fallthrough case encoder.OpNumber: - bb, err := appendNumber(b, ptrToNumber(load(ctxptr, code.Idx))) + bb, err := appendNumber(ctx, b, ptrToNumber(load(ctxptr, code.Idx))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpInterfacePtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -167,38 +173,92 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpInterface: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } - for _, seen := range ctx.SeenPtr { - if p == seen { - return nil, errUnsupportedValue(code, p) + if recursiveLevel > encoder.StartDetectingCyclesAfter { + for _, seen := range ctx.SeenPtr { + if p == seen { + return nil, errUnsupportedValue(code, p) + } } } ctx.SeenPtr = append(ctx.SeenPtr, p) - iface := (*emptyInterface)(ptrToUnsafePtr(p)) - if iface.ptr == nil { - b = appendNull(b) - b = appendComma(b) + var ( + typ *runtime.Type + ifacePtr unsafe.Pointer + ) + up := ptrToUnsafePtr(p) + if code.Flags&encoder.NonEmptyInterfaceFlags != 0 { + iface := (*nonEmptyInterface)(up) + ifacePtr = iface.ptr + typ = iface.itab.typ + } else { + iface := (*emptyInterface)(up) + ifacePtr = iface.ptr + typ = iface.typ + } + if ifacePtr == nil { + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } - bb, err := appendInterface(ctx, codeSet, opt, code, b, iface, ptrOffset) + ctx.KeepRefs = append(ctx.KeepRefs, up) + ifaceCodeSet, err := encoder.CompileToGetCodeSet(uintptr(unsafe.Pointer(typ))) if err != nil { return nil, err } - ctxptr = ctx.Ptr() + + 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 + indentDiffFromTop := c.Indent - 1 + ctx.BaseIndent += code.Indent - indentDiffFromTop + + 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] - b = bb - code = code.Next + 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 = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -207,25 +267,25 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } - if code.IsNilableType && code.Indirect { + 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(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -235,24 +295,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt p := load(ctxptr, code.Idx) if p == 0 { b = append(b, `""`...) - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next break } - if code.IsNilableType && code.Indirect { + if (code.Flags&encoder.IsNilableTypeFlags) != 0 && (code.Flags&encoder.IndirectFlags) != 0 { p = ptrToPtr(p) } - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpSlicePtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -262,8 +322,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt p := load(ctxptr, code.Idx) slice := ptrToSlice(p) if p == 0 || slice.Data == nil { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -275,7 +335,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, uintptr(slice.Data)) } else { - b = appendEmptyArray(b) + b = appendEmptyArray(ctx, b) code = code.End.Next } case encoder.OpSliceElem: @@ -285,8 +345,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if idx < length { b = appendArrayElemIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) - data := load(ctxptr, code.HeadIdx) - size := code.Size + data := load(ctxptr, code.Idx) + size := uintptr(code.Size) code = code.Next store(ctxptr, code.Idx, data+idx*size) } else { @@ -296,8 +356,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpArrayPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -306,8 +366,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpArray: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -317,17 +377,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next store(ctxptr, code.Idx, p) } else { - b = appendEmptyArray(b) + b = appendEmptyArray(ctx, b) code = code.End.Next } case encoder.OpArrayElem: idx := load(ctxptr, code.ElemIdx) idx++ - if idx < code.Length { + if idx < uintptr(code.Length) { b = appendArrayElemIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) - p := load(ctxptr, code.HeadIdx) - size := code.Size + p := load(ctxptr, code.Idx) + size := uintptr(code.Size) code = code.Next store(ctxptr, code.Idx, p+idx*size) } else { @@ -337,8 +397,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpMapPtr: p := loadNPtr(ctxptr, code.Idx, code.PtrNum) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } @@ -347,31 +407,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpMap: p := load(ctxptr, code.Idx) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.End.Next break } uptr := ptrToUnsafePtr(p) mlen := maplen(uptr) if mlen <= 0 { - b = appendEmptyObject(b) + b = appendEmptyObject(ctx, b) code = code.End.Next break } - b = appendStructHead(b) + b = appendStructHead(ctx, b) iter := mapiterinit(code.Type, uptr) ctx.KeepRefs = append(ctx.KeepRefs, iter) store(ctxptr, code.ElemIdx, 0) store(ctxptr, code.Length, uintptr(mlen)) store(ctxptr, code.MapIter, uintptr(iter)) - if (opt & encoder.UnorderedMapOption) == 0 { + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + b = appendMapKeyIndent(ctx, code.Next, b) + } else { mapCtx := encoder.NewMapContext(mlen) mapCtx.Pos = append(mapCtx.Pos, len(b)) ctx.KeepRefs = append(ctx.KeepRefs, unsafe.Pointer(mapCtx)) store(ctxptr, code.End.MapPos, uintptr(unsafe.Pointer(mapCtx))) - } else { - b = appendMapKeyIndent(ctx, code.Next, b) } key := mapiterkey(iter) store(ctxptr, code.Next.Idx, uintptr(key)) @@ -380,7 +440,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt idx := load(ctxptr, code.ElemIdx) length := load(ctxptr, code.Length) idx++ - if (opt & encoder.UnorderedMapOption) != 0 { + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { if idx < length { b = appendMapKeyIndent(ctx, code, b) store(ctxptr, code.ElemIdx, idx) @@ -409,8 +469,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } } case encoder.OpMapValue: - if (opt & encoder.UnorderedMapOption) != 0 { - b = appendColon(b) + if (ctx.Option.Flag & encoder.UnorderedMapOption) != 0 { + b = appendColon(ctx, b) } else { ptr := load(ctxptr, code.End.MapPos) mapCtx := (*encoder.MapContext)(ptrToUnsafePtr(ptr)) @@ -479,7 +539,8 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt oldOffset := ptrOffset ptrOffset += code.Jmp.CurLen * uintptrSize oldBaseIndent := ctx.BaseIndent - ctx.BaseIndent += code.Indent - 1 + indentDiffFromTop := c.Indent - 1 + ctx.BaseIndent += code.Indent - indentDiffFromTop newLen := offsetNum + code.Jmp.CurLen + code.Jmp.NextLen if curlen < newLen { @@ -490,7 +551,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt 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, uintptr(oldBaseIndent)) + storeIndent(ctxptr, c.End.Next, uintptr(oldBaseIndent)) code = c recursiveLevel++ case encoder.OpRecursiveEnd: @@ -508,9 +569,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHead: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -519,29 +580,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHead: p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if !code.AnonymousKey && len(code.Key) > 0 { - b = appendStructKey(ctx, code, b) + if len(code.Key) > 0 { + if (code.Flags&encoder.IsTaggedKeyFlags) != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 { + b = appendStructKey(ctx, code, b) + } } - p += code.Offset + 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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -550,19 +613,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmpty: p := load(ctxptr, code.Idx) - if p == 0 && (code.Indirect || code.Next.Op == encoder.OpStructEnd) { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && ((code.Flags&encoder.IndirectFlags) != 0 || code.Next.Op == encoder.OpStructEnd) { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - p += code.Offset - if p == 0 || (ptrToPtr(p) == 0 && code.IsNextOpPtrType) { + p += uintptr(code.Offset) + if p == 0 || (ptrToPtr(p) == 0 && (code.Flags&encoder.IsNextOpPtrTypeFlags) != 0) { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -570,12 +633,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, p) } case encoder.OpStructPtrHeadInt: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -586,27 +649,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadInt: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) + b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyInt: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -617,33 +680,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyInt: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendComma(b) + b = appendInt(ctx, b, u64, code) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadIntString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -654,29 +717,29 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadIntString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -687,34 +750,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyIntString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, u64, code) + b = appendInt(ctx, b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadIntPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -723,34 +786,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadIntPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendInt(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -759,32 +822,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyIntPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendInt(ctx, b, ptrToUint64(p), code) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -793,36 +856,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadIntPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -831,35 +894,35 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyIntPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadUint: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -870,27 +933,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadUint: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) + b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUint: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -901,33 +964,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyUint: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendComma(b) + b = appendUint(ctx, b, u64, code) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadUintString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -938,29 +1001,29 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadUintString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -971,34 +1034,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyUintString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, u64, code) + b = appendUint(ctx, b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadUintPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1007,34 +1070,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadUintPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendUint(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1043,32 +1106,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyUintPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendUint(ctx, b, ptrToUint64(p), code) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1077,36 +1140,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadUintPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1115,35 +1178,35 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyUintPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat32: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1154,27 +1217,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat32: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1185,32 +1248,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat32: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToFloat32(p + code.Offset) + v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat32String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1221,29 +1284,29 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat32String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1254,33 +1317,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat32String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToFloat32(p + code.Offset) + v := ptrToFloat32(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1289,34 +1352,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat32Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1325,32 +1388,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat32Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1359,36 +1422,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat32PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1397,35 +1460,35 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat32PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadFloat64: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1436,31 +1499,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat64: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1471,17 +1534,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat64: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1489,17 +1552,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt return nil, errUnsupportedFloat(v) } b = appendStructKey(ctx, code, b) - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat64String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1510,33 +1573,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadFloat64String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToFloat64(p + code.Offset) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64String: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1547,17 +1610,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyFloat64String: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if v == 0 { code = code.NextField } else { @@ -1566,17 +1629,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1585,38 +1648,38 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat64Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { v := ptrToFloat64(p) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1625,19 +1688,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat64Ptr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1645,16 +1708,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + 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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1663,40 +1726,40 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadFloat64PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1705,19 +1768,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyFloat64PtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) @@ -1726,18 +1789,18 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1748,27 +1811,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1779,32 +1842,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToString(p + code.Offset) + v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadStringString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1815,27 +1878,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadStringString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p+code.Offset)))) - b = appendComma(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.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1846,31 +1909,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyStringString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToString(p + code.Offset) + v := ptrToString(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1879,34 +1942,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadStringPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1915,32 +1978,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyStringPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1949,34 +2012,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadStringPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -1985,33 +2048,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyStringPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadBool: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2022,27 +2085,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBool: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBool: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2053,32 +2116,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBool: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToBool(p + code.Offset) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) code = code.Next } else { code = code.NextField } case encoder.OpStructPtrHeadBoolString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2089,29 +2152,29 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBoolString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2122,23 +2185,23 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBoolString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToBool(p + code.Offset) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } else { code = code.NextField @@ -2146,9 +2209,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2157,34 +2220,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBoolPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2193,32 +2256,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBoolPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2227,36 +2290,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBoolPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2265,35 +2328,35 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBoolPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadBytes: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2304,27 +2367,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadBytes: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytes: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2335,31 +2398,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyBytes: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToBytes(p + code.Offset) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) == 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2368,34 +2431,34 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadBytesPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2404,33 +2467,33 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyBytesPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadNumber: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2441,30 +2504,30 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadNumber: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumber: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2475,35 +2538,35 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyNumber: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToNumber(p + code.Offset) + v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next } case encoder.OpStructPtrHeadNumberString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2514,32 +2577,32 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadNumberString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberString: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2550,36 +2613,36 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyNumberString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - v := ptrToNumber(p + code.Offset) + v := ptrToNumber(p + uintptr(code.Offset)) if v == "" { code = code.NextField } else { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2588,38 +2651,38 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadNumberPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2628,35 +2691,35 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyNumberPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructPtrHeadNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2665,39 +2728,39 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadNumberPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2706,38 +2769,38 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyNumberPtrString: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructPtrHeadArray, encoder.OpStructPtrHeadSlice: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2748,27 +2811,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadArray, encoder.OpStructHeadSlice: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - p += code.Offset + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptyArray: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2779,27 +2842,27 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptyArray: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - p += code.Offset + p += uintptr(code.Offset) b = appendStructKey(ctx, code, b) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructPtrHeadOmitEmptySlice: - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2810,17 +2873,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructHeadOmitEmptySlice: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - p += code.Offset + p += uintptr(code.Offset) slice := ptrToSlice(p) if slice.Len == 0 { code = code.NextField @@ -2832,9 +2895,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadArrayPtr, encoder.OpStructPtrHeadSlicePtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2843,24 +2906,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadArrayPtr, encoder.OpStructHeadSlicePtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField } else { code = code.Next @@ -2869,9 +2932,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyArrayPtr, encoder.OpStructPtrHeadOmitEmptySlicePtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2880,19 +2943,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyArrayPtr, encoder.OpStructHeadOmitEmptySlicePtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { code = code.NextField @@ -2904,9 +2967,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMap: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2915,29 +2978,29 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMap: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) + 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.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2946,19 +3009,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMap: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if p != 0 && code.Indirect { - p = ptrToPtr(p + code.Offset) + if p != 0 && (code.Flags&encoder.IndirectFlags) != 0 { + p = ptrToPtr(p + uintptr(code.Offset)) } if maplen(ptrToUnsafePtr(p)) == 0 { code = code.NextField @@ -2970,9 +3033,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMapPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -2981,31 +3044,31 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMapPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField break } - p = ptrToPtr(p + code.Offset) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.NextField } else { - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p, code.PtrNum) } code = code.Next @@ -3014,9 +3077,9 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadOmitEmptyMapPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3025,26 +3088,26 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMapPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } if p == 0 { code = code.NextField break } - p = ptrToPtr(p + code.Offset) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 { code = code.NextField } else { - if code.Indirect { + if (code.Flags & encoder.IndirectFlags) != 0 { p = ptrToNPtr(p, code.PtrNum) } b = appendStructKey(ctx, code, b) @@ -3054,38 +3117,38 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt case encoder.OpStructPtrHeadMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if code.Indirect { + 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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalJSON { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { - b = appendNull(b) + 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 { @@ -3093,42 +3156,42 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSON: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if code.Indirect { + 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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalJSON { + p = ptrToPtr(p + uintptr(code.Offset)) } } iface := ptrToInterface(code, p) - if code.Nilcheck && encoder.IsNilForMarshaler(iface) { + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { code = code.NextField } else { b = appendStructKey(ctx, code, b) @@ -3137,15 +3200,15 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3154,23 +3217,23 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMarshalJSONPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -3178,14 +3241,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3194,19 +3257,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMarshalJSONPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } if p == 0 { code = code.NextField @@ -3217,103 +3280,103 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalText: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if code.Indirect { + 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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadMarshalText { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { - b = appendNull(b) + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalText: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if code.Indirect { + 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.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } - if code.IsNilableType { - if code.Indirect || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { - p = ptrToPtr(p + code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { + if (code.Flags&encoder.IndirectFlags) != 0 || code.Op == encoder.OpStructPtrHeadOmitEmptyMarshalText { + p = ptrToPtr(p + uintptr(code.Offset)) } } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField } else { b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructPtrHeadMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3322,38 +3385,38 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadMarshalTextPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if !code.AnonymousHead { - b = appendStructHead(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendStructHead(ctx, b) } b = appendStructKey(ctx, code, b) - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructPtrHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) if p == 0 { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break @@ -3362,43 +3425,43 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt fallthrough case encoder.OpStructHeadOmitEmptyMarshalTextPtr: p := load(ctxptr, code.Idx) - if p == 0 && code.Indirect { - if !code.AnonymousHead { - b = appendNull(b) - b = appendComma(b) + if p == 0 && (code.Flags&encoder.IndirectFlags) != 0 { + if code.Flags&encoder.AnonymousHeadFlags == 0 { + b = appendNull(ctx, b) + b = appendComma(ctx, b) } code = code.End.Next break } - if code.Indirect { - p = ptrToNPtr(p+code.Offset, code.PtrNum) + if (code.Flags & encoder.IndirectFlags) != 0 { + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) } - if !code.AnonymousHead { - b = appendStructHead(b) + 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(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next } case encoder.OpStructField: - if !code.AnonymousKey { + if code.Flags&encoder.IsTaggedKeyFlags != 0 || code.Flags&encoder.AnonymousKeyFlags == 0 { b = appendStructKey(ctx, code, b) } - p := load(ctxptr, code.HeadIdx) + code.Offset + p := load(ctxptr, code.Idx) + uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmpty: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { + 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) @@ -3406,298 +3469,298 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt store(ctxptr, code.Idx, p) } case encoder.OpStructFieldInt: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) + b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) - b = appendComma(b) + b = appendInt(ctx, b, u64, code) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, u64, code) + b = appendInt(ctx, b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendInt(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendInt(ctx, b, ptrToUint64(p), code) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUint: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) - b = appendComma(b) + b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) - b = appendComma(b) + b = appendUint(ctx, b, u64, code) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, u64, code) + b = appendUint(ctx, b, u64, code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendUint(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) - b = appendComma(b) + b = appendUint(ctx, b, ptrToUint64(p), code) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) - b = appendComma(b) + b = appendFloat32(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32String: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) - b = appendComma(b) + b = appendFloat32(ctx, b, ptrToFloat32(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - v := ptrToFloat64(p + code.Offset) + v := ptrToFloat64(p + uintptr(code.Offset)) if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + 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(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) - b = appendComma(b) + b = appendNull(ctx, b) + b = appendComma(ctx, b) code = code.Next break } @@ -3705,42 +3768,42 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, v) - b = appendComma(b) + b = appendFloat64(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') @@ -3748,307 +3811,307 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, v) - b = appendComma(b) + b = appendString(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringString: - p := load(ctxptr, code.HeadIdx) - s := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + s := ptrToString(p + uintptr(code.Offset)) b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, s))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, s))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) - b = appendComma(b) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) - b = appendComma(b) + b = appendString(ctx, b, ptrToString(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, ptrToString(p)))) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyStringPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) - b = appendComma(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.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) - b = appendComma(b) + b = appendBool(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolString: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) - b = appendComma(b) + b = appendBool(ctx, b, ptrToBool(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBytes: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) - b = appendComma(b) + b = appendByteSlice(ctx, b, v) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) - b = appendComma(b) + b = appendByteSlice(ctx, b, ptrToBytes(p)) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldNumber: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldOmitEmptyNumber: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldNumberString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) b = appendStructKey(ctx, code, b) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } b = append(bb, '"') - b = appendComma(b) + b = appendComma(ctx, b) } code = code.Next case encoder.OpStructFieldMarshalJSON: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { - b = appendNull(b) + 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 { @@ -4056,20 +4119,20 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSON: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField break } iface := ptrToInterface(code, p) - if code.Nilcheck && encoder.IsNilForMarshaler(iface) { + if (code.Flags&encoder.NilCheckFlags) != 0 && encoder.IsNilForMarshaler(iface) { code = code.NextField break } @@ -4078,14 +4141,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { bb, err := appendMarshalJSON(ctx, code, b, ptrToInterface(code, p)) if err != nil { @@ -4093,103 +4156,103 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalJSONPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldMarshalText: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p += code.Offset - if code.IsNilableType { + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { - b = appendNull(b) + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalText: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if code.IsNilableType { + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) + if (code.Flags & encoder.IsNilableTypeFlags) != 0 { p = ptrToPtr(p) } - if p == 0 && code.Nilcheck { + if p == 0 && (code.Flags&encoder.NilCheckFlags) != 0 { code = code.NextField break } b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) code = code.Next case encoder.OpStructFieldMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } b = bb } - b = appendComma(b) + b = appendComma(ctx, b) code = code.Next case encoder.OpStructFieldOmitEmptyMarshalTextPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendMarshalText(code, b, ptrToInterface(code, p)) + bb, err := appendMarshalText(ctx, code, b, ptrToInterface(code, p)) if err != nil { return nil, err } - b = appendComma(bb) + b = appendComma(ctx, bb) } code = code.Next case encoder.OpStructFieldArray: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + 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.HeadIdx) - p += code.Offset + 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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) code = code.Next @@ -4199,13 +4262,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldSlice: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptySlice: - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) slice := ptrToSlice(p) if slice.Len == 0 { code = code.NextField @@ -4216,13 +4279,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldSlicePtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) code = code.Next @@ -4232,13 +4295,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldMap: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + 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.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p == 0 || maplen(ptrToUnsafePtr(p)) == 0 { code = code.NextField } else { @@ -4248,16 +4311,16 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldMapPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToPtr(p + code.Offset) + 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.HeadIdx) - p = ptrToPtr(p + code.Offset) + p := load(ctxptr, code.Idx) + p = ptrToPtr(p + uintptr(code.Offset)) if p != 0 { p = ptrToNPtr(p, code.PtrNum) } @@ -4270,14 +4333,14 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } case encoder.OpStructFieldStruct: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p += code.Offset + p := load(ctxptr, code.Idx) + p += uintptr(code.Offset) code = code.Next store(ctxptr, code.Idx, p) case encoder.OpStructFieldOmitEmptyStruct: - p := load(ctxptr, code.HeadIdx) - p += code.Offset - if ptrToPtr(p) == 0 && code.IsNextOpPtrType { + 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) @@ -4290,39 +4353,39 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEndSkipLast(ctx, code, b) code = code.Next case encoder.OpStructEndInt: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyInt: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendInt(b, u64, code) + b = appendInt(ctx, b, u64, code) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) } code = code.Next case encoder.OpStructEndIntString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, ptrToUint64(p+code.Offset), code) + b = appendInt(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendInt(b, u64, code) + b = appendInt(ctx, b, u64, code) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4331,21 +4394,21 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndIntPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendInt(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendInt(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4353,24 +4416,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndIntPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendInt(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) b = append(b, '"') } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyIntPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToUint64(p), code) + b = appendInt(ctx, b, ptrToUint64(p), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4378,39 +4441,39 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndUint: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUint: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendUint(b, u64, code) + b = appendUint(ctx, b, u64, code) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) } code = code.Next case encoder.OpStructEndUintString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, ptrToUint64(p+code.Offset), code) + b = appendUint(ctx, b, ptrToUint64(p+uintptr(code.Offset)), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintString: - p := load(ctxptr, code.HeadIdx) - u64 := ptrToUint64(p + code.Offset) - v := u64 & code.Mask + p := load(ctxptr, code.Idx) + u64 := ptrToUint64(p + uintptr(code.Offset)) + v := u64 & ((1 << code.NumBitSize) - 1) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendUint(b, u64, code) + b = appendUint(ctx, b, u64, code) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4419,21 +4482,21 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndUintPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendUint(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendUint(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4441,24 +4504,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndUintPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendUint(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) b = append(b, '"') } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyUintPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToUint64(p), code) + b = appendUint(ctx, b, ptrToUint64(p), code) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4466,37 +4529,37 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat32: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + b = appendFloat32(ctx, b, ptrToFloat32(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, v) + 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.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p+code.Offset)) + 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.HeadIdx) - v := ptrToFloat32(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToFloat32(p + uintptr(code.Offset)) if v != 0 { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendFloat32(b, v) + b = appendFloat32(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4505,21 +4568,21 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat32Ptr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4527,24 +4590,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat32PtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendFloat32(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat32PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToFloat32(p)) + b = appendFloat32(ctx, b, ptrToFloat32(p)) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4552,51 +4615,51 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + 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(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + 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(b, v) + 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.HeadIdx) - v := ptrToFloat64(p + code.Offset) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64String: - p := load(ctxptr, code.HeadIdx) - v := ptrToFloat64(p + code.Offset) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4605,10 +4668,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat64Ptr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) b = appendStructEnd(ctx, code, b) code = code.Next break @@ -4617,19 +4680,19 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt if math.IsInf(v, 0) || math.IsNaN(v) { return nil, errUnsupportedFloat(v) } - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64Ptr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, v) + b = appendFloat64(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4637,24 +4700,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndFloat64PtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + 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(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyFloat64PtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) v := ptrToFloat64(p) @@ -4662,7 +4725,7 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt return nil, errUnsupportedFloat(v) } b = append(b, '"') - b = appendFloat64(b, v) + b = appendFloat64(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4670,35 +4733,35 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p+code.Offset)) + b = appendString(ctx, b, ptrToString(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyString: - p := load(ctxptr, code.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, v) + 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.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - s := ptrToString(p + code.Offset) - b = appendString(b, string(appendString([]byte{}, s))) + 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.HeadIdx) - v := ptrToString(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToString(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, v))) + b = appendString(ctx, b, string(appendString(ctx, []byte{}, v))) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4706,21 +4769,21 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndStringPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyStringPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, ptrToString(p)) + b = appendString(ctx, b, ptrToString(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4728,58 +4791,58 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndStringPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + 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.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendString(b, string(appendString([]byte{}, ptrToString(p)))) + 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.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p+code.Offset)) + b = appendBool(ctx, b, ptrToBool(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBool: - p := load(ctxptr, code.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) - b = appendBool(b, v) + 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.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, ptrToBool(p+code.Offset)) + 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.HeadIdx) - v := ptrToBool(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBool(p + uintptr(code.Offset)) if v { b = appendStructKey(ctx, code, b) b = append(b, '"') - b = appendBool(b, v) + b = appendBool(ctx, b, v) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4788,21 +4851,21 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBoolPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4810,24 +4873,24 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBoolPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - b = appendBool(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBoolPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToBool(p)) + b = appendBool(ctx, b, ptrToBool(p)) b = append(b, '"') b = appendStructEnd(ctx, code, b) } else { @@ -4835,17 +4898,17 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndBytes: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p+code.Offset)) + b = appendByteSlice(ctx, b, ptrToBytes(p+uintptr(code.Offset))) b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytes: - p := load(ctxptr, code.HeadIdx) - v := ptrToBytes(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToBytes(p + uintptr(code.Offset)) if len(v) > 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, v) + b = appendByteSlice(ctx, b, v) b = appendStructEnd(ctx, code, b) } else { b = appendStructEndSkipLast(ctx, code, b) @@ -4853,41 +4916,41 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndBytesPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - b = appendByteSlice(b, ptrToBytes(p)) + b = appendByteSlice(ctx, b, ptrToBytes(p)) } b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyBytesPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - b = appendByteSlice(b, ptrToBytes(p)) + 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.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + 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.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } @@ -4897,10 +4960,10 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt } code = code.Next case encoder.OpStructEndNumberString: - p := load(ctxptr, code.HeadIdx) + p := load(ctxptr, code.Idx) b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p+code.Offset)) + bb, err := appendNumber(ctx, b, ptrToNumber(p+uintptr(code.Offset))) if err != nil { return nil, err } @@ -4908,12 +4971,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberString: - p := load(ctxptr, code.HeadIdx) - v := ptrToNumber(p + code.Offset) + p := load(ctxptr, code.Idx) + v := ptrToNumber(p + uintptr(code.Offset)) if v != "" { b = appendStructKey(ctx, code, b) b = append(b, '"') - bb, err := appendNumber(b, v) + bb, err := appendNumber(ctx, b, v) if err != nil { return nil, err } @@ -4925,12 +4988,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndNumberPtr: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4939,11 +5002,11 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberPtr: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p != 0 { b = appendStructKey(ctx, code, b) - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4954,13 +5017,13 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt code = code.Next case encoder.OpStructEndNumberPtrString: b = appendStructKey(ctx, code, b) - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + p := load(ctxptr, code.Idx) + p = ptrToNPtr(p+uintptr(code.Offset), code.PtrNum) if p == 0 { - b = appendNull(b) + b = appendNull(ctx, b) } else { b = append(b, '"') - bb, err := appendNumber(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } @@ -4969,12 +5032,12 @@ func Run(ctx *encoder.RuntimeContext, b []byte, codeSet *encoder.OpcodeSet, opt b = appendStructEnd(ctx, code, b) code = code.Next case encoder.OpStructEndOmitEmptyNumberPtrString: - p := load(ctxptr, code.HeadIdx) - p = ptrToNPtr(p+code.Offset, code.PtrNum) + 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(b, ptrToNumber(p)) + bb, err := appendNumber(ctx, b, ptrToNumber(p)) if err != nil { return nil, err } diff --git a/vendor/github.com/goccy/go-json/internal/errors/error.go b/vendor/github.com/goccy/go-json/internal/errors/error.go @@ -155,3 +155,10 @@ func ErrInvalidCharacter(c byte, context string, cursor int64) *SyntaxError { 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, + } +} diff --git a/vendor/github.com/goccy/go-json/json.go b/vendor/github.com/goccy/go-json/json.go @@ -2,6 +2,7 @@ package json import ( "bytes" + "context" "encoding/json" "github.com/goccy/go-json/internal/encoder" @@ -13,6 +14,12 @@ 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 @@ -25,6 +32,12 @@ 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. @@ -158,18 +171,19 @@ func Marshal(v interface{}) ([]byte, error) { return MarshalWithOption(v) } -// MarshalNoEscape +// MarshalNoEscape returns the JSON encoding of v and doesn't escape v. func MarshalNoEscape(v interface{}) ([]byte, error) { - return marshalNoEscape(v, EncodeOptionHTMLEscape) + 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) { - opt := EncodeOptionHTMLEscape - for _, optFunc := range optFuncs { - opt = optFunc(opt) - } - return marshal(v, opt) + return marshal(v, optFuncs...) } // MarshalIndent is like Marshal but applies Indent to format the output. @@ -181,11 +195,7 @@ func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) { // MarshalIndentWithOption is like Marshal but applies Indent to format the output with EncodeOption. func MarshalIndentWithOption(v interface{}, prefix, indent string, optFuncs ...EncodeOptionFunc) ([]byte, error) { - opt := EncodeOptionHTMLEscape | EncodeOptionIndent - for _, optFunc := range optFuncs { - opt = optFunc(opt) - } - return marshalIndent(v, prefix, indent, opt) + return marshalIndent(v, prefix, indent, optFuncs...) } // Unmarshal parses the JSON-encoded data and stores the result @@ -266,8 +276,19 @@ func Unmarshal(data []byte, v interface{}) error { return unmarshal(data, v) } -func UnmarshalNoEscape(data []byte, v interface{}) error { - return unmarshalNoEscape(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: @@ -326,7 +347,7 @@ func HTMLEscape(dst *bytes.Buffer, src []byte) { if err := dec.Decode(&v); err != nil { return } - buf, _ := marshal(v, EncodeOptionHTMLEscape) + buf, _ := marshal(v) dst.Write(buf) } diff --git a/vendor/github.com/goccy/go-json/option.go b/vendor/github.com/goccy/go-json/option.go @@ -1,15 +1,46 @@ package json -type EncodeOptionFunc func(EncodeOption) EncodeOption +import ( + "github.com/goccy/go-json/internal/decoder" + "github.com/goccy/go-json/internal/encoder" +) -func UnorderedMap() func(EncodeOption) EncodeOption { - return func(opt EncodeOption) EncodeOption { - return opt | EncodeOptionUnorderedMap +type EncodeOption = encoder.Option +type EncodeOptionFunc func(*EncodeOption) + +// UnorderedMap doesn't sort when encoding map type. +func UnorderedMap() EncodeOptionFunc { + return func(opt *EncodeOption) { + opt.Flag |= encoder.UnorderedMapOption + } +} + +// Debug outputs debug information when panic occurs during encoding. +func Debug() EncodeOptionFunc { + return func(opt *EncodeOption) { + opt.Flag |= encoder.DebugOption } } -func Debug() func(EncodeOption) EncodeOption { - return func(opt EncodeOption) EncodeOption { - return opt | EncodeOptionDebug +// Colorize add an identifier for coloring to the string of the encoded result. +func Colorize(scheme *ColorScheme) EncodeOptionFunc { + return func(opt *EncodeOption) { + opt.Flag |= encoder.ColorizeOption + opt.ColorScheme = scheme + } +} + +type DecodeOption = decoder.Option +type DecodeOptionFunc func(*DecodeOption) + +// DecodeFieldPriorityFirstWin +// 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. +// This option allow you to change this behavior. +// this 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. +func DecodeFieldPriorityFirstWin() DecodeOptionFunc { + return func(opt *DecodeOption) { + opt.Flags |= decoder.FirstWinOption } } diff --git a/vendor/github.com/goccy/go-json/rtype.go b/vendor/github.com/goccy/go-json/rtype.go @@ -1,27 +0,0 @@ -package json - -import ( - "reflect" - "unsafe" - - "github.com/goccy/go-json/internal/runtime" -) - -type rtype = runtime.Type - -type emptyInterface struct { - typ *rtype - ptr unsafe.Pointer -} - -func rtype_ptrTo(t *rtype) *rtype { - return runtime.PtrTo(t) -} - -func rtype2type(t *rtype) reflect.Type { - return runtime.RType2Type(t) -} - -func type2rtype(t reflect.Type) *rtype { - return runtime.Type2RType(t) -} diff --git a/vendor/github.com/golang-jwt/jwt/.travis.yml b/vendor/github.com/golang-jwt/jwt/.travis.yml @@ -1,11 +0,0 @@ -language: go - -script: - - go vet ./... - - go test -v ./... - -go: - - 1.7 - - 1.8 - - 1.9 - - 1.10 diff --git a/vendor/github.com/golang-jwt/jwt/README.md b/vendor/github.com/golang-jwt/jwt/README.md @@ -9,10 +9,17 @@ A [go](http://www.golang.org) (or 'golang' for search engine friendliness) imple Future releases will be using the `github.com/golang-jwt/jwt` import path and continue the existing versioning scheme of `v3.x.x+incompatible`. Backwards-compatible patches and fixes will be done on the `v3` release branch, where as new build-breaking features will be developed in a `v4` release, possibly including a SIV-style import path. -**SECURITY NOTICE:** Some older versions of Go have a security issue in the crypto/elliptic. Recommendation is to upgrade to at least 1.8.3. See issue [dgrijalva/jwt-go#216](https://github.com/dgrijalva/jwt-go/issues/216) for more detail. +**SECURITY NOTICE:** Some older versions of Go have a security issue in the crypto/elliptic. Recommendation is to upgrade to at least 1.15 See issue [dgrijalva/jwt-go#216](https://github.com/dgrijalva/jwt-go/issues/216) for more detail. **SECURITY NOTICE:** It's important that you [validate the `alg` presented is what you expect](https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/). This library attempts to make it easy to do the right thing by requiring key types match the expected alg, but you should take the extra step to verify it in your usage. See the examples provided. +### Supported Go versions + +Our support of Go versions is aligned with Go's [version release policy](https://golang.org/doc/devel/release#policy). +So we will support a major version of Go until there are two newer major releases. +We no longer support building jwt-go with unsupported Go versions, as these contain security vulnerabilities +which will not be fixed. + ## What the heck is a JWT? JWT.io has [a great introduction](https://jwt.io/introduction) to JSON Web Tokens. diff --git a/vendor/github.com/golang-jwt/jwt/VERSION_HISTORY.md b/vendor/github.com/golang-jwt/jwt/VERSION_HISTORY.md @@ -1,5 +1,12 @@ ## `jwt-go` Version History +#### 3.2.2 + +* Starting from this release, we are adopting the policy to support the most 2 recent versions of Go currently available. By the time of this release, this is Go 1.15 and 1.16 ([#28](https://github.com/golang-jwt/jwt/pull/28)). +* Fixed a potential issue that could occur when the verification of `exp`, `iat` or `nbf` was not required and contained invalid contents, i.e. non-numeric/date. Thanks for @thaJeztah for making us aware of that and @giorgos-f3 for originally reporting it to the formtech fork ([#40](https://github.com/golang-jwt/jwt/pull/40)). +* Added support for EdDSA / ED25519 ([#36](https://github.com/golang-jwt/jwt/pull/36)). +* Optimized allocations ([#33](https://github.com/golang-jwt/jwt/pull/33)). + #### 3.2.1 * **Import Path Change**: See MIGRATION_GUIDE.md for tips on updating your code diff --git a/vendor/github.com/golang-jwt/jwt/ecdsa.go b/vendor/github.com/golang-jwt/jwt/ecdsa.go @@ -128,18 +128,12 @@ func (m *SigningMethodECDSA) Sign(signingString string, key interface{}) (string keyBytes += 1 } - // We serialize the outpus (r and s) into big-endian byte arrays and pad - // them with zeros on the left to make sure the sizes work out. Both arrays - // must be keyBytes long, and the output must be 2*keyBytes long. - rBytes := r.Bytes() - rBytesPadded := make([]byte, keyBytes) - copy(rBytesPadded[keyBytes-len(rBytes):], rBytes) - - sBytes := s.Bytes() - sBytesPadded := make([]byte, keyBytes) - copy(sBytesPadded[keyBytes-len(sBytes):], sBytes) - - out := append(rBytesPadded, sBytesPadded...) + // We serialize the outputs (r and s) into big-endian byte arrays + // padded with zeros on the left to make sure the sizes work out. + // Output must be 2*keyBytes long. + out := make([]byte, 2*keyBytes) + r.FillBytes(out[0:keyBytes]) // r is assigned to the first half of output. + s.FillBytes(out[keyBytes:]) // s is assigned to the second half of output. return EncodeSegment(out), nil } else { diff --git a/vendor/github.com/golang-jwt/jwt/ed25519.go b/vendor/github.com/golang-jwt/jwt/ed25519.go @@ -0,0 +1,81 @@ +package jwt + +import ( + "errors" + + "crypto/ed25519" +) + +var ( + ErrEd25519Verification = errors.New("ed25519: verification error") +) + +// Implements the EdDSA family +// Expects ed25519.PrivateKey for signing and ed25519.PublicKey for verification +type SigningMethodEd25519 struct{} + +// Specific instance for EdDSA +var ( + SigningMethodEdDSA *SigningMethodEd25519 +) + +func init() { + SigningMethodEdDSA = &SigningMethodEd25519{} + RegisterSigningMethod(SigningMethodEdDSA.Alg(), func() SigningMethod { + return SigningMethodEdDSA + }) +} + +func (m *SigningMethodEd25519) Alg() string { + return "EdDSA" +} + +// Implements the Verify method from SigningMethod +// For this verify method, key must be an ed25519.PublicKey +func (m *SigningMethodEd25519) Verify(signingString, signature string, key interface{}) error { + var err error + var ed25519Key ed25519.PublicKey + var ok bool + + if ed25519Key, ok = key.(ed25519.PublicKey); !ok { + return ErrInvalidKeyType + } + + if len(ed25519Key) != ed25519.PublicKeySize { + return ErrInvalidKey + } + + // Decode the signature + var sig []byte + if sig, err = DecodeSegment(signature); err != nil { + return err + } + + // Verify the signature + if !ed25519.Verify(ed25519Key, []byte(signingString), sig) { + return ErrEd25519Verification + } + + return nil +} + +// Implements the Sign method from SigningMethod +// For this signing method, key must be an ed25519.PrivateKey +func (m *SigningMethodEd25519) Sign(signingString string, key interface{}) (string, error) { + var ed25519Key ed25519.PrivateKey + var ok bool + + if ed25519Key, ok = key.(ed25519.PrivateKey); !ok { + return "", ErrInvalidKeyType + } + + // ed25519.Sign panics if private key not equal to ed25519.PrivateKeySize + // this allows to avoid recover usage + if len(ed25519Key) != ed25519.PrivateKeySize { + return "", ErrInvalidKey + } + + // Sign the string and return the encoded result + sig := ed25519.Sign(ed25519Key, []byte(signingString)) + return EncodeSegment(sig), nil +} diff --git a/vendor/github.com/golang-jwt/jwt/ed25519_utils.go b/vendor/github.com/golang-jwt/jwt/ed25519_utils.go @@ -0,0 +1,64 @@ +package jwt + +import ( + "crypto" + "crypto/ed25519" + "crypto/x509" + "encoding/pem" + "errors" +) + +var ( + ErrNotEdPrivateKey = errors.New("Key is not a valid Ed25519 private key") + ErrNotEdPublicKey = errors.New("Key is not a valid Ed25519 public key") +) + +// Parse PEM-encoded Edwards curve private key +func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey interface{} + if parsedKey, err = x509.ParsePKCS8PrivateKey(block.Bytes); err != nil { + return nil, err + } + + var pkey ed25519.PrivateKey + var ok bool + if pkey, ok = parsedKey.(ed25519.PrivateKey); !ok { + return nil, ErrNotEdPrivateKey + } + + return pkey, nil +} + +// Parse PEM-encoded Edwards curve public key +func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) { + var err error + + // Parse PEM block + var block *pem.Block + if block, _ = pem.Decode(key); block == nil { + return nil, ErrKeyMustBePEMEncoded + } + + // Parse the key + var parsedKey interface{} + if parsedKey, err = x509.ParsePKIXPublicKey(block.Bytes); err != nil { + return nil, err + } + + var pkey ed25519.PublicKey + var ok bool + if pkey, ok = parsedKey.(ed25519.PublicKey); !ok { + return nil, ErrNotEdPublicKey + } + + return pkey, nil +} diff --git a/vendor/github.com/golang-jwt/jwt/map_claims.go b/vendor/github.com/golang-jwt/jwt/map_claims.go @@ -34,27 +34,35 @@ func (m MapClaims) VerifyAudience(cmp string, req bool) bool { // Compares the exp claim against cmp. // If required is false, this method will return true if the value matches or is unset func (m MapClaims) VerifyExpiresAt(cmp int64, req bool) bool { - switch exp := m["exp"].(type) { + exp, ok := m["exp"] + if !ok { + return !req + } + switch expType := exp.(type) { case float64: - return verifyExp(int64(exp), cmp, req) + return verifyExp(int64(expType), cmp, req) case json.Number: - v, _ := exp.Int64() + v, _ := expType.Int64() return verifyExp(v, cmp, req) } - return !req + return false } // Compares the iat claim against cmp. // If required is false, this method will return true if the value matches or is unset func (m MapClaims) VerifyIssuedAt(cmp int64, req bool) bool { - switch iat := m["iat"].(type) { + iat, ok := m["iat"] + if !ok { + return !req + } + switch iatType := iat.(type) { case float64: - return verifyIat(int64(iat), cmp, req) + return verifyIat(int64(iatType), cmp, req) case json.Number: - v, _ := iat.Int64() + v, _ := iatType.Int64() return verifyIat(v, cmp, req) } - return !req + return false } // Compares the iss claim against cmp. @@ -67,14 +75,18 @@ func (m MapClaims) VerifyIssuer(cmp string, req bool) bool { // Compares the nbf claim against cmp. // If required is false, this method will return true if the value matches or is unset func (m MapClaims) VerifyNotBefore(cmp int64, req bool) bool { - switch nbf := m["nbf"].(type) { + nbf, ok := m["nbf"] + if !ok { + return !req + } + switch nbfType := nbf.(type) { case float64: - return verifyNbf(int64(nbf), cmp, req) + return verifyNbf(int64(nbfType), cmp, req) case json.Number: - v, _ := nbf.Int64() + v, _ := nbfType.Int64() return verifyNbf(v, cmp, req) } - return !req + return false } // Validates time based claims "exp, iat, nbf". diff --git a/vendor/github.com/golang-jwt/jwt/token.go b/vendor/github.com/golang-jwt/jwt/token.go @@ -95,14 +95,10 @@ func ParseWithClaims(tokenString string, claims Claims, keyFunc Keyfunc) (*Token // Encode JWT specific base64url encoding with padding stripped func EncodeSegment(seg []byte) string { - return strings.TrimRight(base64.URLEncoding.EncodeToString(seg), "=") + return base64.RawURLEncoding.EncodeToString(seg) } // Decode JWT specific base64url encoding with padding stripped func DecodeSegment(seg string) ([]byte, error) { - if l := len(seg) % 4; l > 0 { - seg += strings.Repeat("=", 4-l) - } - - return base64.URLEncoding.DecodeString(seg) + return base64.RawURLEncoding.DecodeString(seg) } diff --git a/vendor/github.com/google/uuid/go.mod b/vendor/github.com/google/uuid/go.mod @@ -1 +0,0 @@ -module github.com/google/uuid diff --git a/vendor/github.com/gorilla/sessions/go.mod b/vendor/github.com/gorilla/sessions/go.mod @@ -1,3 +0,0 @@ -module github.com/gorilla/sessions - -require github.com/gorilla/securecookie v1.1.1 diff --git a/vendor/github.com/gorilla/sessions/go.sum b/vendor/github.com/gorilla/sessions/go.sum @@ -1,2 +0,0 @@ -github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= -github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= diff --git a/vendor/github.com/gorilla/websocket/go.mod b/vendor/github.com/gorilla/websocket/go.mod @@ -1,3 +0,0 @@ -module github.com/gorilla/websocket - -go 1.12 diff --git a/vendor/github.com/gorilla/websocket/go.sum b/vendor/github.com/gorilla/websocket/go.sum diff --git a/vendor/github.com/h2non/filetype/go.mod b/vendor/github.com/h2non/filetype/go.mod @@ -1,3 +0,0 @@ -module github.com/h2non/filetype - -go 1.13 diff --git a/vendor/github.com/jackc/chunkreader/v2/go.mod b/vendor/github.com/jackc/chunkreader/v2/go.mod @@ -1,3 +0,0 @@ -module github.com/jackc/chunkreader/v2 - -go 1.12 diff --git a/vendor/github.com/jackc/pgconn/go.mod b/vendor/github.com/jackc/pgconn/go.mod @@ -1,15 +0,0 @@ -module github.com/jackc/pgconn - -go 1.12 - -require ( - github.com/jackc/chunkreader/v2 v2.0.1 - github.com/jackc/pgio v1.0.0 - github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 - github.com/jackc/pgpassfile v1.0.0 - github.com/jackc/pgproto3/v2 v2.1.1 - github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b - github.com/stretchr/testify v1.7.0 - golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 - golang.org/x/text v0.3.6 -) diff --git a/vendor/github.com/jackc/pgconn/go.sum b/vendor/github.com/jackc/pgconn/go.sum @@ -1,130 +0,0 @@ -github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= -github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= -github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= -github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= -github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= -github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= -github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= -github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= -github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= -github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= -github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= -github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= -github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= -github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= -github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc= -github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= -github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= -github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A= -github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= -github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= -github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= -github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= -github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= -github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.1.1 h1:7PQ/4gLoqnl87ZxL7xjO0DR5gYuviDCZxQJsUlFW1eI= -github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= -github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= -github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= -github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= -github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= -github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= -github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= -github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= -github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= -github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= -github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/vendor/github.com/jackc/pgio/go.mod b/vendor/github.com/jackc/pgio/go.mod @@ -1,3 +0,0 @@ -module github.com/jackc/pgio - -go 1.12 diff --git a/vendor/github.com/jackc/pgpassfile/go.mod b/vendor/github.com/jackc/pgpassfile/go.mod @@ -1,5 +0,0 @@ -module github.com/jackc/pgpassfile - -go 1.12 - -require github.com/stretchr/testify v1.3.0 diff --git a/vendor/github.com/jackc/pgpassfile/go.sum b/vendor/github.com/jackc/pgpassfile/go.sum @@ -1,7 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/vendor/github.com/jackc/pgproto3/v2/go.mod b/vendor/github.com/jackc/pgproto3/v2/go.mod @@ -1,9 +0,0 @@ -module github.com/jackc/pgproto3/v2 - -go 1.12 - -require ( - github.com/jackc/chunkreader/v2 v2.0.0 - github.com/jackc/pgio v1.0.0 - github.com/stretchr/testify v1.4.0 -) diff --git a/vendor/github.com/jackc/pgproto3/v2/go.sum b/vendor/github.com/jackc/pgproto3/v2/go.sum @@ -1,14 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/jackc/chunkreader/v2 v2.0.0 h1:DUwgMQuuPnS0rhMXenUtZpqZqrR/30NWY+qQvTpSvEs= -github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= -github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= -github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/jackc/pgservicefile/go.mod b/vendor/github.com/jackc/pgservicefile/go.mod @@ -1,5 +0,0 @@ -module github.com/jackc/pgservicefile - -go 1.14 - -require github.com/stretchr/testify v1.5.1 diff --git a/vendor/github.com/jackc/pgservicefile/go.sum b/vendor/github.com/jackc/pgservicefile/go.sum @@ -1,10 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/jackc/pgtype/go.mod b/vendor/github.com/jackc/pgtype/go.mod @@ -1,13 +0,0 @@ -module github.com/jackc/pgtype - -go 1.13 - -require ( - github.com/gofrs/uuid v4.0.0+incompatible - github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530 - github.com/jackc/pgio v1.0.0 - github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c - github.com/lib/pq v1.10.2 - github.com/shopspring/decimal v1.2.0 - github.com/stretchr/testify v1.7.0 -) diff --git a/vendor/github.com/jackc/pgtype/go.sum b/vendor/github.com/jackc/pgtype/go.sum @@ -1,175 +0,0 @@ -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= -github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= -github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= -github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= -github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= -github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= -github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= -github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= -github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= -github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= -github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= -github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= -github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= -github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530 h1:dUJ578zuPEsXjtzOfEF0q9zDAfljJ9oFnTHcQaNkccw= -github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= -github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= -github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= -github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= -github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= -github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc= -github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= -github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= -github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A= -github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= -github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= -github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= -github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= -github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= -github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.1.1 h1:7PQ/4gLoqnl87ZxL7xjO0DR5gYuviDCZxQJsUlFW1eI= -github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= -github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= -github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= -github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= -github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= -github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= -github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= -github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= -github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= -github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c h1:Dznn52SgVIVst9UyOT9brctYUgxs+CvVfPaC3jKrA50= -github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= -github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= -github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= -github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= -github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= -github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= -github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/vendor/github.com/jackc/pgx/v4/go.mod b/vendor/github.com/jackc/pgx/v4/go.mod @@ -1,21 +0,0 @@ -module github.com/jackc/pgx/v4 - -go 1.13 - -require ( - github.com/Masterminds/semver/v3 v3.1.1 - github.com/cockroachdb/apd v1.1.0 - github.com/go-kit/log v0.1.0 - github.com/gofrs/uuid v4.0.0+incompatible - github.com/jackc/pgconn v1.10.0 - github.com/jackc/pgio v1.0.0 - github.com/jackc/pgproto3/v2 v2.1.1 - github.com/jackc/pgtype v1.8.1 - github.com/jackc/puddle v1.1.3 - github.com/rs/zerolog v1.15.0 - github.com/shopspring/decimal v1.2.0 - github.com/sirupsen/logrus v1.4.2 - github.com/stretchr/testify v1.7.0 - go.uber.org/zap v1.13.0 - gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec -) diff --git a/vendor/github.com/jackc/pgx/v4/go.sum b/vendor/github.com/jackc/pgx/v4/go.sum @@ -1,196 +0,0 @@ -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc= -github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs= -github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= -github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/go-kit/log v0.1.0 h1:DGJh0Sm43HbOeYDNnVZFl8BvcYVvjD5bqYJvp0REbwQ= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gofrs/uuid v4.0.0+incompatible h1:1SD/1F5pU8p29ybwgQSwpQk+mwdRrXCYuPhW6m+TnJw= -github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0= -github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= -github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= -github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8= -github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk= -github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA= -github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE= -github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s= -github.com/jackc/pgconn v1.8.0/go.mod h1:1C2Pb36bGIP9QHGBYCjnyhqu7Rv3sGshaQUvmfGIB/o= -github.com/jackc/pgconn v1.9.0/go.mod h1:YctiPyvzfU11JFxoXokUOOKQXQmDMoJL9vJzHH8/2JY= -github.com/jackc/pgconn v1.9.1-0.20210724152538-d89c8390a530/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= -github.com/jackc/pgconn v1.10.0 h1:4EYhlDVEMsJ30nNj0mmgwIUXoq7e9sMJrVC2ED6QlCU= -github.com/jackc/pgconn v1.10.0/go.mod h1:4z2w8XhRbP1hYxkpTuBjTS3ne3J48K83+u0zoyvg2pI= -github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE= -github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8= -github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE= -github.com/jackc/pgmock v0.0.0-20201204152224-4fe30f7445fd/go.mod h1:hrBW0Enj2AZTNpt/7Y5rr2xe/9Mn757Wtb2xeBzPv2c= -github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65 h1:DadwsjnMwFjfWc9y5Wi/+Zz7xoE5ALHsRQlOctkOiHc= -github.com/jackc/pgmock v0.0.0-20210724152146-4ad1a8207f65/go.mod h1:5R2h2EEX+qri8jOWMbJCtaPWkrrNc7OHwsp2TCqp7ak= -github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= -github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= -github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A= -github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78= -github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA= -github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg= -github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= -github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM= -github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgproto3/v2 v2.1.1 h1:7PQ/4gLoqnl87ZxL7xjO0DR5gYuviDCZxQJsUlFW1eI= -github.com/jackc/pgproto3/v2 v2.1.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA= -github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg= -github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E= -github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg= -github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc= -github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw= -github.com/jackc/pgtype v1.8.1-0.20210724151600-32e20a603178/go.mod h1:C516IlIV9NKqfsMCXTdChteoXmwgUceqaLfjg2e3NlM= -github.com/jackc/pgtype v1.8.1 h1:9k0IXtdJXHJbyAWQgbWr1lU+MEhPXZz6RIXxfR5oxXs= -github.com/jackc/pgtype v1.8.1/go.mod h1:LUMuVrfsFfdKGLw+AFFVv6KtHOFMwRgDDzBt76IqCA4= -github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y= -github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM= -github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc= -github.com/jackc/pgx/v4 v4.12.1-0.20210724153913-640aa07df17c/go.mod h1:1QD0+tgSXP7iUjYm9C1NxKhny7lq6ee99u/z+IHFcgs= -github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/jackc/puddle v1.1.3 h1:JnPg/5Q9xVJGfjsO5CPUOjnJps1JaRUm8I9FXVCFK94= -github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= -github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.10.2 h1:AqzbZs4ZoCBp+GtejcpCpcxM3zlSMx29dXbUSeVtJb8= -github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= -github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= -github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= -github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU= -github.com/rs/zerolog v1.15.0 h1:uPRuwkWF4J6fGsJ2R0Gn2jB1EQiav9k3S6CSdygQJXY= -github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc= -github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= -github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= -github.com/shopspring/decimal v1.2.0 h1:abSATXmQEYyShuxI4/vyW3tV1MrKAJzCZ/0zLUXYbsQ= -github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= -go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= -go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A= -go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= -go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -go.uber.org/zap v1.13.0 h1:nR6NoDBgAf67s68NhaXbsojM+2gxp3S1hWkHDl27pVU= -go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 h1:/UOmuWzQfxxo9UtlXMwuQU8CMgg1eZXqTRwkSQJWKOI= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114 h1:DnSr2mCsxyCE6ZgIkmcWUQY2R5cH/6wL7eIxEmQOMSE= -golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec h1:RlWgLqCMMIYYEVcAR5MDsuHlVkaIPDAF+5Dehzg8L5A= -gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/vendor/github.com/jinzhu/inflection/go.mod b/vendor/github.com/jinzhu/inflection/go.mod @@ -1 +0,0 @@ -module github.com/jinzhu/inflection diff --git a/vendor/github.com/json-iterator/go/go.mod b/vendor/github.com/json-iterator/go/go.mod @@ -1,11 +0,0 @@ -module github.com/json-iterator/go - -go 1.12 - -require ( - github.com/davecgh/go-spew v1.1.1 - github.com/google/gofuzz v1.0.0 - github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 - github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 - github.com/stretchr/testify v1.3.0 -) diff --git a/vendor/github.com/json-iterator/go/go.sum b/vendor/github.com/json-iterator/go/go.sum @@ -1,15 +0,0 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/vendor/github.com/leodido/go-urn/go.mod b/vendor/github.com/leodido/go-urn/go.mod @@ -1,5 +0,0 @@ -module github.com/leodido/go-urn - -go 1.13 - -require github.com/stretchr/testify v1.6.1 diff --git a/vendor/github.com/leodido/go-urn/go.sum b/vendor/github.com/leodido/go-urn/go.sum @@ -1,11 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/vendor/github.com/mattn/go-isatty/go.mod b/vendor/github.com/mattn/go-isatty/go.mod @@ -1,5 +0,0 @@ -module github.com/mattn/go-isatty - -go 1.12 - -require golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c diff --git a/vendor/github.com/mattn/go-isatty/go.sum b/vendor/github.com/mattn/go-isatty/go.sum @@ -1,2 +0,0 @@ -golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/vendor/github.com/microcosm-cc/bluemonday/go.mod b/vendor/github.com/microcosm-cc/bluemonday/go.mod @@ -1,10 +0,0 @@ -module github.com/microcosm-cc/bluemonday - -go 1.16 - -require ( - github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d - github.com/aymerick/douceur v0.2.0 - github.com/gorilla/css v1.0.0 // indirect - golang.org/x/net v0.0.0-20210614182718-04defd469f4e -) diff --git a/vendor/github.com/microcosm-cc/bluemonday/go.sum b/vendor/github.com/microcosm-cc/bluemonday/go.sum @@ -1,18 +0,0 @@ -github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl3/e6D5CLfI0j/7hiIEtvGVFPCZ7Ei2oq8iQ= -github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= -github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= -github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4= -github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY= -github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c= -golang.org/x/net v0.0.0-20210421230115-4e50805a0758 h1:aEpZnXcAmXkd6AvLb2OPt+EN1Zu/8Ne3pCqPjja5PXY= -golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q= -golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/vendor/github.com/mitchellh/mapstructure/go.mod b/vendor/github.com/mitchellh/mapstructure/go.mod @@ -1,3 +0,0 @@ -module github.com/mitchellh/mapstructure - -go 1.14 diff --git a/vendor/github.com/remyoudompheng/bigfft/go.mod b/vendor/github.com/remyoudompheng/bigfft/go.mod @@ -1,3 +0,0 @@ -module github.com/remyoudompheng/bigfft - -go 1.12 diff --git a/vendor/github.com/russross/blackfriday/v2/go.mod b/vendor/github.com/russross/blackfriday/v2/go.mod @@ -1 +0,0 @@ -module github.com/russross/blackfriday/v2 diff --git a/vendor/github.com/sirupsen/logrus/go.mod b/vendor/github.com/sirupsen/logrus/go.mod @@ -1,10 +0,0 @@ -module github.com/sirupsen/logrus - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/testify v1.2.2 - golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 -) - -go 1.13 diff --git a/vendor/github.com/sirupsen/logrus/go.sum b/vendor/github.com/sirupsen/logrus/go.sum @@ -1,8 +0,0 @@ -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= diff --git a/vendor/github.com/superseriousbusiness/oauth2/v4/go.mod b/vendor/github.com/superseriousbusiness/oauth2/v4/go.mod @@ -1,35 +0,0 @@ -module github.com/superseriousbusiness/oauth2/v4 - -go 1.13 - -require ( - github.com/ajg/form v1.5.1 // indirect - github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect - github.com/fatih/structs v1.1.0 // indirect - github.com/gavv/httpexpect v2.0.0+incompatible - github.com/go-session/session v3.1.2+incompatible - github.com/golang-jwt/jwt v3.2.1+incompatible - github.com/google/go-querystring v1.0.0 // indirect - github.com/google/uuid v1.1.1 - github.com/gorilla/websocket v1.4.2 // indirect - github.com/imkira/go-interpol v1.1.0 // indirect - github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect - github.com/klauspost/compress v1.10.10 // indirect - github.com/mattn/go-colorable v0.1.7 // indirect - github.com/moul/http2curl v1.0.0 // indirect - github.com/onsi/ginkgo v1.13.0 // indirect - github.com/sergi/go-diff v1.1.0 // indirect - github.com/smartystreets/goconvey v1.6.4 - github.com/stretchr/testify v1.6.1 // indirect - github.com/tidwall/buntdb v1.1.2 - github.com/tidwall/gjson v1.6.0 // indirect - github.com/tidwall/pretty v1.0.1 // indirect - github.com/valyala/fasthttp v1.14.0 // indirect - github.com/xeipuuv/gojsonschema v1.2.0 // indirect - github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect - github.com/yudai/gojsondiff v1.0.0 // indirect - github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect - github.com/yudai/pp v2.0.1+incompatible // indirect - golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f - gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect -) diff --git a/vendor/github.com/superseriousbusiness/oauth2/v4/go.sum b/vendor/github.com/superseriousbusiness/oauth2/v4/go.sum @@ -1,486 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= -github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= -github.com/andybalholm/brotli v1.0.0 h1:7UCwP93aiSfvWpapti8g88vVVGp2qqtGyePsSuDafo4= -github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 h1:DddqAaWDpywytcG8w/qoQ5sAN8X12d3Z3koB0C3Rxsc= -github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= -github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= -github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/gavv/httpexpect v2.0.0+incompatible h1:1X9kcRshkSKEjNJJxX9Y9mQ5BRfbxU5kORdjhlA1yX8= -github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-session/session v3.1.2+incompatible h1:yStchEObKg4nk2F7JGE7KoFIrA/1Y078peagMWcrncg= -github.com/go-session/session v3.1.2+incompatible/go.mod h1:8B3iivBQjrz/JtC68Np2T1yBBLxTan3mn/3OM0CyRt0= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= -github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= -github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/imkira/go-interpol v1.1.0 h1:KIiKr0VSG2CUW1hl1jpiyuzuJeKUUpC8iM1AIE7N1Vk= -github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= -github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM= -github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.10.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.10.10 h1:a/y8CglcM7gLGYmlbP/stPE5sR3hbhFRUjCBfd/0B3I= -github.com/klauspost/compress v1.10.10/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw= -github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs= -github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.13.0 h1:M76yO2HkZASFjXL0HSoZJ1AYEmQxNJmY41Jx1zNUq1Y= -github.com/onsi/ginkgo v1.13.0/go.mod h1:+REjRxOmWfHCjfv9TTWB1jD1Frx4XydAD3zm1lskyM0= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw= -github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= -github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= -github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= -github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/tidwall/btree v0.0.0-20191029221954-400434d76274 h1:G6Z6HvJuPjG6XfNGi/feOATzeJrfgTNJY+rGrHbA04E= -github.com/tidwall/btree v0.0.0-20191029221954-400434d76274/go.mod h1:huei1BkDWJ3/sLXmO+bsCNELL+Bp2Kks9OLyQFkzvA8= -github.com/tidwall/buntdb v1.1.2 h1:noCrqQXL9EKMtcdwJcmuVKSEjqu1ua99RHHgbLTEHRo= -github.com/tidwall/buntdb v1.1.2/go.mod h1:xAzi36Hir4FarpSHyfuZ6JzPJdjRZ8QlLZSntE2mqlI= -github.com/tidwall/gjson v1.3.4/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= -github.com/tidwall/gjson v1.6.0 h1:9VEQWz6LLMUsUl6PueE49ir4Ka6CzLymOAZDxpFsTDc= -github.com/tidwall/gjson v1.6.0/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= -github.com/tidwall/grect v0.0.0-20161006141115-ba9a043346eb h1:5NSYaAdrnblKByzd7XByQEJVT8+9v0W/tIY0Oo4OwrE= -github.com/tidwall/grect v0.0.0-20161006141115-ba9a043346eb/go.mod h1:lKYYLFIr9OIgdgrtgkZ9zgRxRdvPYsExnYBsEAd8W5M= -github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc= -github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= -github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tidwall/pretty v1.0.1 h1:WE4RBSZ1x6McVVC8S/Md+Qse8YUv6HRObAx6ke00NY8= -github.com/tidwall/pretty v1.0.1/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= -github.com/tidwall/rtree v0.0.0-20180113144539-6cd427091e0e h1:+NL1GDIUOKxVfbp2KoJQD9cTQ6dyP2co9q4yzmT9FZo= -github.com/tidwall/rtree v0.0.0-20180113144539-6cd427091e0e/go.mod h1:/h+UnNGt0IhNNJLkGikcdcJqm66zGD/uJGMRxK/9+Ao= -github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563 h1:Otn9S136ELckZ3KKDyCkxapfufrqDqwmGjcHfAyXRrE= -github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563/go.mod h1:mLqSmt7Dv/CNneF2wfcChfN1rvapyQr01LGKnKex0DQ= -github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasthttp v1.14.0 h1:67bfuW9azCMwW/Jlq/C+VeihNpAuJMWkYPBig1gdi3A= -github.com/valyala/fasthttp v1.14.0/go.mod h1:ol1PCaL0dX20wC0htZ7sYCsvCYmrouYra0zHzaclZhE= -github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c= -github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0= -github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= -github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= -github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= -github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 h1:6fRhSjgLCkTD3JnJxvaJ4Sj+TYblw757bqYgZaOq5ZY= -github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0/go.mod h1:/LWChgwKmvncFJFHJ7Gvn9wZArjbV5/FppcK2fKk/tI= -github.com/yudai/gojsondiff v1.0.0 h1:27cbfqXLVEJ1o8I6v3y9lg8Ydm53EKqHXAOMxEGlCOA= -github.com/yudai/gojsondiff v1.0.0/go.mod h1:AY32+k2cwILAkW1fbgxQ5mUmMiZFgLIV+FBNExI05xg= -github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 h1:BHyfKlQyqbsFN5p3IfnEUduWvb9is428/nNb5L3U01M= -github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82/go.mod h1:lgjkn3NuSvDfVJdfcVVdX+jpBxNmX4rDAzaS45IcYoM= -github.com/yudai/pp v2.0.1+incompatible h1:Q4//iY4pNF6yPLZIigmvcl7k/bPgrcTPIFIcmawg5bI= -github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZkTdatxwunjIkc= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -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= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f h1:Qmd2pbz05z7z6lm0DrgQVVPuBm92jqujBKMHMOlOQEw= -golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642 h1:B6caxRw+hozq68X2MY7jEpZh/cr4/aHLv9xU8Kkadrw= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -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= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -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/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ= -gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/vendor/github.com/tdewolff/minify/v2/go.mod b/vendor/github.com/tdewolff/minify/v2/go.mod @@ -1,14 +0,0 @@ -module github.com/tdewolff/minify/v2 - -go 1.13 - -require ( - github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 // indirect - github.com/dustin/go-humanize v1.0.0 - github.com/fsnotify/fsnotify v1.4.9 - github.com/matryer/try v0.0.0-20161228173917-9ac251b645a2 - github.com/spf13/pflag v1.0.5 - github.com/tdewolff/parse/v2 v2.5.19 - github.com/tdewolff/test v1.0.6 - golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect -) diff --git a/vendor/github.com/tdewolff/minify/v2/go.sum b/vendor/github.com/tdewolff/minify/v2/go.sum @@ -1,17 +0,0 @@ -github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927 h1:SKI1/fuSdodxmNNyVBR8d7X/HuLnRpvvFO0AgyQk764= -github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/matryer/try v0.0.0-20161228173917-9ac251b645a2 h1:JAEbJn3j/FrhdWA9jW8B5ajsLIjeuEHLi8xE4fk997o= -github.com/matryer/try v0.0.0-20161228173917-9ac251b645a2/go.mod h1:0KeJpeMD6o+O4hW7qJOT7vyQPKrWmj26uf5wMc/IiIs= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= -github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/tdewolff/parse/v2 v2.5.19 h1:Kjaj3KQOx/4elIxlBSglus4E2oMfdROphvbq2b+OBZ0= -github.com/tdewolff/parse/v2 v2.5.19/go.mod h1:WzaJpRSbwq++EIQHYIRTpbYKNA3gn9it1Ik++q4zyho= -github.com/tdewolff/test v1.0.6 h1:76mzYJQ83Op284kMT+63iCNCI7NEERsIN8dLM+RiKr4= -github.com/tdewolff/test v1.0.6/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= -golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/vendor/github.com/tdewolff/parse/v2/go.mod b/vendor/github.com/tdewolff/parse/v2/go.mod @@ -1,5 +0,0 @@ -module github.com/tdewolff/parse/v2 - -go 1.13 - -require github.com/tdewolff/test v1.0.6 diff --git a/vendor/github.com/tdewolff/parse/v2/go.sum b/vendor/github.com/tdewolff/parse/v2/go.sum @@ -1,2 +0,0 @@ -github.com/tdewolff/test v1.0.6 h1:76mzYJQ83Op284kMT+63iCNCI7NEERsIN8dLM+RiKr4= -github.com/tdewolff/test v1.0.6/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= diff --git a/vendor/github.com/ugorji/go/codec/go.mod b/vendor/github.com/ugorji/go/codec/go.mod @@ -1,5 +0,0 @@ -module github.com/ugorji/go/codec - -go 1.11 - -require github.com/ugorji/go v1.2.6 diff --git a/vendor/github.com/uptrace/bun/CHANGELOG.md b/vendor/github.com/uptrace/bun/CHANGELOG.md @@ -1,6 +1,12 @@ # Changelog -## v1.0.4 - Sep 06 2021 +## v1.0.5 - Sep 09 2021 + +- chore: tweak bundebug colors +- fix: check if table is present when appending columns +- fix: copy []byte when scanning + +## v1.0.4 - Sep 08 2021 - Added support for MariaDB. - Restored default `SET` for `ON CONFLICT DO UPDATE` queries. diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/append.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/append.go @@ -94,12 +94,12 @@ func arrayAppendDriverValue(fmter schema.Formatter, b []byte, v reflect.Value) [ func arrayAppender(typ reflect.Type) schema.AppenderFunc { kind := typ.Kind() - if kind == reflect.Ptr { - typ = typ.Elem() - kind = typ.Kind() - } switch kind { + case reflect.Ptr: + if fn := arrayAppender(typ.Elem()); fn != nil { + return schema.PtrAppender(fn) + } case reflect.Slice, reflect.Array: // ok: default: diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/array_scan.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/array_scan.go @@ -12,12 +12,12 @@ import ( func arrayScanner(typ reflect.Type) schema.ScannerFunc { kind := typ.Kind() - if kind == reflect.Ptr { - typ = typ.Elem() - kind = typ.Kind() - } switch kind { + case reflect.Ptr: + if fn := arrayScanner(typ.Elem()); fn != nil { + return schema.PtrScanner(fn) + } case reflect.Slice, reflect.Array: // ok: default: diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/dialect.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/dialect.go @@ -24,7 +24,8 @@ type Dialect struct { func New() *Dialect { d := new(Dialect) d.tables = schema.NewTables(d) - d.features = feature.Returning | + d.features = feature.CTE | + feature.Returning | feature.DefaultPlaceholder | feature.DoubleColonCast | feature.InsertTableAlias | @@ -70,8 +71,8 @@ func (d *Dialect) onField(field *schema.Field) { } if field.Tag.HasOption("array") { - field.Append = arrayAppender(field.IndirectType) - field.Scan = arrayScanner(field.IndirectType) + field.Append = arrayAppender(field.StructField.Type) + field.Scan = arrayScanner(field.StructField.Type) } } diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/go.mod b/vendor/github.com/uptrace/bun/dialect/pgdialect/go.mod @@ -1,7 +0,0 @@ -module github.com/uptrace/bun/dialect/pgdialect - -go 1.16 - -replace github.com/uptrace/bun => ../.. - -require github.com/uptrace/bun v0.4.3 diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/go.sum b/vendor/github.com/uptrace/bun/dialect/pgdialect/go.sum @@ -1,22 +0,0 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= -github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= -github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= -github.com/vmihailenco/msgpack/v5 v5.3.4 h1:qMKAwOV+meBw2Y8k9cVwAy7qErtYCwBzZ2ellBfvnqc= -github.com/vmihailenco/msgpack/v5 v5.3.4/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= -github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= -github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/scan.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/scan.go @@ -1,28 +1,11 @@ package pgdialect import ( - "fmt" "reflect" "github.com/uptrace/bun/schema" ) func scanner(typ reflect.Type) schema.ScannerFunc { - if typ.Kind() == reflect.Interface { - return scanInterface - } return schema.Scanner(typ) } - -func scanInterface(dest reflect.Value, src interface{}) error { - if dest.IsNil() { - dest.Set(reflect.ValueOf(src)) - return nil - } - - dest = dest.Elem() - if fn := scanner(dest.Type()); fn != nil { - return fn(dest, src) - } - return fmt.Errorf("bun: can't scan %#v into %s", src, dest.Type()) -} diff --git a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/dialect.go b/vendor/github.com/uptrace/bun/dialect/sqlitedialect/dialect.go @@ -22,7 +22,10 @@ type Dialect struct { func New() *Dialect { d := new(Dialect) d.tables = schema.NewTables(d) - d.features = feature.Returning | feature.InsertTableAlias | feature.DeleteTableAlias + d.features = feature.CTE | + feature.Returning | + feature.InsertTableAlias | + feature.DeleteTableAlias return d } diff --git a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/go.mod b/vendor/github.com/uptrace/bun/dialect/sqlitedialect/go.mod @@ -1,7 +0,0 @@ -module github.com/uptrace/bun/dialect/sqlitedialect - -go 1.16 - -replace github.com/uptrace/bun => ../.. - -require github.com/uptrace/bun v0.4.3 diff --git a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/go.sum b/vendor/github.com/uptrace/bun/dialect/sqlitedialect/go.sum @@ -1,22 +0,0 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= -github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= -github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= -github.com/vmihailenco/msgpack/v5 v5.3.4 h1:qMKAwOV+meBw2Y8k9cVwAy7qErtYCwBzZ2ellBfvnqc= -github.com/vmihailenco/msgpack/v5 v5.3.4/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= -github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= -github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/vendor/github.com/uptrace/bun/dialect/sqlitedialect/scan.go b/vendor/github.com/uptrace/bun/dialect/sqlitedialect/scan.go @@ -1,28 +1,11 @@ package sqlitedialect import ( - "fmt" "reflect" "github.com/uptrace/bun/schema" ) func scanner(typ reflect.Type) schema.ScannerFunc { - if typ.Kind() == reflect.Interface { - return scanInterface - } return schema.Scanner(typ) } - -func scanInterface(dest reflect.Value, src interface{}) error { - if dest.IsNil() { - dest.Set(reflect.ValueOf(src)) - return nil - } - - dest = dest.Elem() - if fn := scanner(dest.Type()); fn != nil { - return fn(dest, src) - } - return fmt.Errorf("bun: can't scan %#v into %s", src, dest.Type()) -} diff --git a/vendor/github.com/uptrace/bun/go.mod b/vendor/github.com/uptrace/bun/go.mod @@ -1,12 +0,0 @@ -module github.com/uptrace/bun - -go 1.16 - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/jinzhu/inflection v1.0.0 - github.com/stretchr/testify v1.7.0 - github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc - github.com/vmihailenco/msgpack/v5 v5.3.4 - golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect -) diff --git a/vendor/github.com/uptrace/bun/go.sum b/vendor/github.com/uptrace/bun/go.sum @@ -1,23 +0,0 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= -github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc h1:9lRDQMhESg+zvGYmW5DyG0UqvY96Bu5QYsTLvCHdrgo= -github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc/go.mod h1:bciPuU6GHm1iF1pBvUfxfsH0Wmnc2VbpgvbI9ZWuIRs= -github.com/vmihailenco/msgpack/v5 v5.3.4 h1:qMKAwOV+meBw2Y8k9cVwAy7qErtYCwBzZ2ellBfvnqc= -github.com/vmihailenco/msgpack/v5 v5.3.4/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= -github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= -github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 h1:RqytpXGR1iVNX7psjB3ff8y7sNFinVFvkx1c8SjBkio= -golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -\ No newline at end of file diff --git a/vendor/github.com/uptrace/bun/hook.go b/vendor/github.com/uptrace/bun/hook.go @@ -4,6 +4,7 @@ import ( "context" "database/sql" "reflect" + "strings" "sync/atomic" "time" @@ -13,7 +14,7 @@ import ( type QueryEvent struct { DB *DB - QueryAppender schema.QueryAppender + QueryAppender schema.Query Query string QueryArgs []interface{} @@ -24,6 +25,23 @@ type QueryEvent struct { Stash map[interface{}]interface{} } +func (e *QueryEvent) Operation() string { + if e.QueryAppender != nil { + return e.QueryAppender.Operation() + } + return queryOperation(e.Query) +} + +func queryOperation(query string) string { + if idx := strings.IndexByte(query, ' '); idx > 0 { + query = query[:idx] + } + if len(query) > 16 { + query = query[:16] + } + return query +} + type QueryHook interface { BeforeQuery(context.Context, *QueryEvent) context.Context AfterQuery(context.Context, *QueryEvent) @@ -31,7 +49,7 @@ type QueryHook interface { func (db *DB) beforeQuery( ctx context.Context, - queryApp schema.QueryAppender, + queryApp schema.Query, query string, queryArgs []interface{}, ) (context.Context, *QueryEvent) { diff --git a/vendor/github.com/uptrace/bun/query_base.go b/vendor/github.com/uptrace/bun/query_base.go @@ -427,7 +427,7 @@ func (q *baseQuery) _getFields(omitPK bool) ([]*schema.Field, error) { func (q *baseQuery) scan( ctx context.Context, - queryApp schema.QueryAppender, + queryApp schema.Query, query string, model model, hasDest bool, @@ -459,7 +459,7 @@ func (q *baseQuery) scan( func (q *baseQuery) exec( ctx context.Context, - queryApp schema.QueryAppender, + queryApp schema.Query, query string, ) (sql.Result, error) { ctx, event := q.db.beforeQuery(ctx, queryApp, query, nil) diff --git a/vendor/github.com/uptrace/bun/query_column_add.go b/vendor/github.com/uptrace/bun/query_column_add.go @@ -61,6 +61,10 @@ func (q *AddColumnQuery) ColumnExpr(query string, args ...interface{}) *AddColum //------------------------------------------------------------------------------ +func (q *AddColumnQuery) Operation() string { + return "ADD COLUMN" +} + func (q *AddColumnQuery) AppendQuery(fmter schema.Formatter, b []byte) (_ []byte, err error) { if q.err != nil { return nil, q.err diff --git a/vendor/github.com/uptrace/bun/query_column_drop.go b/vendor/github.com/uptrace/bun/query_column_drop.go @@ -68,6 +68,10 @@ func (q *DropColumnQuery) ColumnExpr(query string, args ...interface{}) *DropCol //------------------------------------------------------------------------------ +func (q *DropColumnQuery) Operation() string { + return "DROP COLUMN" +} + func (q *DropColumnQuery) AppendQuery(fmter schema.Formatter, b []byte) (_ []byte, err error) { if q.err != nil { return nil, q.err diff --git a/vendor/github.com/uptrace/bun/query_delete.go b/vendor/github.com/uptrace/bun/query_delete.go @@ -129,6 +129,10 @@ func (q *DeleteQuery) hasReturning() bool { //------------------------------------------------------------------------------ +func (q *DeleteQuery) Operation() string { + return "DELETE" +} + func (q *DeleteQuery) AppendQuery(fmter schema.Formatter, b []byte) (_ []byte, err error) { if q.err != nil { return nil, q.err diff --git a/vendor/github.com/uptrace/bun/query_index_create.go b/vendor/github.com/uptrace/bun/query_index_create.go @@ -142,6 +142,10 @@ func (q *CreateIndexQuery) WhereOr(query string, args ...interface{}) *CreateInd //------------------------------------------------------------------------------ +func (q *CreateIndexQuery) Operation() string { + return "CREATE INDEX" +} + func (q *CreateIndexQuery) AppendQuery(fmter schema.Formatter, b []byte) (_ []byte, err error) { if q.err != nil { return nil, q.err diff --git a/vendor/github.com/uptrace/bun/query_index_drop.go b/vendor/github.com/uptrace/bun/query_index_drop.go @@ -62,6 +62,10 @@ func (q *DropIndexQuery) Index(query string, args ...interface{}) *DropIndexQuer //------------------------------------------------------------------------------ +func (q *DropIndexQuery) Operation() string { + return "DROP INDEX" +} + func (q *DropIndexQuery) AppendQuery(fmter schema.Formatter, b []byte) (_ []byte, err error) { if q.err != nil { return nil, q.err diff --git a/vendor/github.com/uptrace/bun/query_insert.go b/vendor/github.com/uptrace/bun/query_insert.go @@ -142,6 +142,10 @@ func (q *InsertQuery) Replace() *InsertQuery { //------------------------------------------------------------------------------ +func (q *InsertQuery) Operation() string { + return "INSERT" +} + func (q *InsertQuery) AppendQuery(fmter schema.Formatter, b []byte) (_ []byte, err error) { if q.err != nil { return nil, q.err diff --git a/vendor/github.com/uptrace/bun/query_select.go b/vendor/github.com/uptrace/bun/query_select.go @@ -359,6 +359,10 @@ func (q *SelectQuery) selectJoins(ctx context.Context, joins []relationJoin) err //------------------------------------------------------------------------------ +func (q *SelectQuery) Operation() string { + return "SELECT" +} + func (q *SelectQuery) AppendQuery(fmter schema.Formatter, b []byte) (_ []byte, err error) { return q.appendQuery(fmter, b, false) } @@ -523,7 +527,7 @@ func (q *SelectQuery) appendColumns(fmter schema.Formatter, b []byte) (_ []byte, b = append(b, ", "...) } - if col.Args == nil { + if col.Args == nil && q.table != nil { if field, ok := q.table.FieldMap[col.Query]; ok { b = append(b, q.table.SQLAlias...) b = append(b, '.') diff --git a/vendor/github.com/uptrace/bun/query_table_create.go b/vendor/github.com/uptrace/bun/query_table_create.go @@ -85,6 +85,10 @@ func (q *CreateTableQuery) ForeignKey(query string, args ...interface{}) *Create return q } +func (q *CreateTableQuery) Operation() string { + return "CREATE TABLE" +} + func (q *CreateTableQuery) AppendQuery(fmter schema.Formatter, b []byte) (_ []byte, err error) { if q.err != nil { return nil, q.err diff --git a/vendor/github.com/uptrace/bun/query_table_drop.go b/vendor/github.com/uptrace/bun/query_table_drop.go @@ -68,6 +68,10 @@ func (q *DropTableQuery) Restrict() *DropTableQuery { //------------------------------------------------------------------------------ +func (q *DropTableQuery) Operation() string { + return "DROP TABLE" +} + func (q *DropTableQuery) AppendQuery(fmter schema.Formatter, b []byte) (_ []byte, err error) { if q.err != nil { return nil, q.err diff --git a/vendor/github.com/uptrace/bun/query_table_truncate.go b/vendor/github.com/uptrace/bun/query_table_truncate.go @@ -64,6 +64,10 @@ func (q *TruncateTableQuery) Restrict() *TruncateTableQuery { //------------------------------------------------------------------------------ +func (q *TruncateTableQuery) Operation() string { + return "TRUNCATE TABLE" +} + func (q *TruncateTableQuery) AppendQuery( fmter schema.Formatter, b []byte, ) (_ []byte, err error) { diff --git a/vendor/github.com/uptrace/bun/query_update.go b/vendor/github.com/uptrace/bun/query_update.go @@ -160,6 +160,10 @@ func (q *UpdateQuery) hasReturning() bool { //------------------------------------------------------------------------------ +func (q *UpdateQuery) Operation() string { + return "SELECT" +} + func (q *UpdateQuery) AppendQuery(fmter schema.Formatter, b []byte) (_ []byte, err error) { if q.err != nil { return nil, q.err diff --git a/vendor/github.com/uptrace/bun/query_values.go b/vendor/github.com/uptrace/bun/query_values.go @@ -94,6 +94,10 @@ func (q *ValuesQuery) AppendColumns(fmter schema.Formatter, b []byte) (_ []byte, return nil, fmt.Errorf("bun: Values does not support %T", q.model) } +func (q *ValuesQuery) Operation() string { + return "SELECT" +} + func (q *ValuesQuery) AppendQuery(fmter schema.Formatter, b []byte) (_ []byte, err error) { if q.err != nil { return nil, q.err diff --git a/vendor/github.com/uptrace/bun/schema/scan.go b/vendor/github.com/uptrace/bun/schema/scan.go @@ -77,6 +77,17 @@ func Scanner(typ reflect.Type) ScannerFunc { } } + switch typ { + case timeType: + return scanTime + case ipType: + return scanIP + case ipNetType: + return scanIPNet + case jsonRawMessageType: + return scanBytes + } + if typ.Implements(scannerType) { return scanScanner } @@ -88,17 +99,8 @@ func Scanner(typ reflect.Type) ScannerFunc { } } - switch typ { - case timeType: - return scanTime - case ipType: - return scanIP - case ipNetType: - return scanIPNet - case bytesType: + if typ.Kind() == reflect.Slice && typ.Elem().Kind() == reflect.Uint8 { return scanBytes - case jsonRawMessageType: - return scanJSONRawMessage } return scanners[kind] @@ -218,7 +220,10 @@ func scanBytes(dest reflect.Value, src interface{}) error { dest.SetBytes([]byte(src)) return nil case []byte: - dest.SetBytes(src) + clone := make([]byte, len(src)) + copy(clone, src) + + dest.SetBytes(clone) return nil } return fmt.Errorf("bun: can't scan %#v into %s", src, dest.Type()) @@ -345,21 +350,6 @@ func scanIPNet(dest reflect.Value, src interface{}) error { return nil } -func scanJSONRawMessage(dest reflect.Value, src interface{}) error { - if src == nil { - dest.SetBytes(nil) - return nil - } - - b, err := toBytes(src) - if err != nil { - return err - } - - dest.SetBytes(b) - return nil -} - func addrScanner(fn ScannerFunc) ScannerFunc { return func(dest reflect.Value, src interface{}) error { if !dest.CanAddr() { diff --git a/vendor/github.com/uptrace/bun/schema/sqlfmt.go b/vendor/github.com/uptrace/bun/schema/sqlfmt.go @@ -4,6 +4,11 @@ type QueryAppender interface { AppendQuery(fmter Formatter, b []byte) ([]byte, error) } +type Query interface { + QueryAppender + Operation() string +} + type ColumnsAppender interface { AppendColumns(fmter Formatter, b []byte) ([]byte, error) } diff --git a/vendor/github.com/uptrace/bun/version.go b/vendor/github.com/uptrace/bun/version.go @@ -2,5 +2,5 @@ package bun // Version is the current release version. func Version() string { - return "1.0.4" + return "1.0.5" } diff --git a/vendor/github.com/urfave/cli/v2/go.mod b/vendor/github.com/urfave/cli/v2/go.mod @@ -1,9 +0,0 @@ -module github.com/urfave/cli/v2 - -go 1.11 - -require ( - github.com/BurntSushi/toml v0.3.1 - github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d - gopkg.in/yaml.v2 v2.2.3 -) diff --git a/vendor/github.com/urfave/cli/v2/go.sum b/vendor/github.com/urfave/cli/v2/go.sum @@ -1,14 +0,0 @@ -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.3 h1:fvjTMHxHEw/mxHbtzPi3JCcKXQRAnQTBRo6YCJSVHKI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/vendor/github.com/vmihailenco/msgpack/v5/go.mod b/vendor/github.com/vmihailenco/msgpack/v5/go.mod @@ -1,8 +0,0 @@ -module github.com/vmihailenco/msgpack/v5 - -go 1.11 - -require ( - github.com/stretchr/testify v1.6.1 - github.com/vmihailenco/tagparser/v2 v2.0.0 -) diff --git a/vendor/github.com/vmihailenco/msgpack/v5/go.sum b/vendor/github.com/vmihailenco/msgpack/v5/go.sum @@ -1,13 +0,0 @@ -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= -github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/vendor/github.com/vmihailenco/tagparser/v2/go.mod b/vendor/github.com/vmihailenco/tagparser/v2/go.mod @@ -1,3 +0,0 @@ -module github.com/vmihailenco/tagparser/v2 - -go 1.15 diff --git a/vendor/github.com/wagslane/go-password-validator/go.mod b/vendor/github.com/wagslane/go-password-validator/go.mod @@ -1,3 +0,0 @@ -module github.com/wagslane/go-password-validator - -go 1.16 diff --git a/vendor/golang.org/x/crypto/acme/http.go b/vendor/golang.org/x/crypto/acme/http.go @@ -10,6 +10,7 @@ import ( "crypto" "crypto/rand" "encoding/json" + "errors" "fmt" "io/ioutil" "math/big" @@ -215,6 +216,9 @@ func (c *Client) post(ctx context.Context, key crypto.Signer, url string, body i func (c *Client) postNoRetry(ctx context.Context, key crypto.Signer, url string, body interface{}) (*http.Response, *http.Request, error) { kid := noKeyID if key == nil { + if c.Key == nil { + return nil, nil, errors.New("acme: Client.Key must be populated to make POST requests") + } key = c.Key kid = c.accountKID(ctx) } diff --git a/vendor/golang.org/x/oauth2/go.mod b/vendor/golang.org/x/oauth2/go.mod @@ -1,9 +0,0 @@ -module golang.org/x/oauth2 - -go 1.11 - -require ( - cloud.google.com/go v0.65.0 - golang.org/x/net v0.0.0-20200822124328-c89045814202 - google.golang.org/appengine v1.6.6 -) diff --git a/vendor/golang.org/x/oauth2/go.sum b/vendor/golang.org/x/oauth2/go.sum @@ -1,361 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0 h1:Dg9iHVQfrhq82rUNu9ZxUDrJLaxFUe/HlCVaLyRruq8= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -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= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -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= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -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/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go @@ -2288,6 +2288,9 @@ type RemoteIovec struct { //sys ProcessVMReadv(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_READV //sys ProcessVMWritev(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags uint) (n int, err error) = SYS_PROCESS_VM_WRITEV +//sys PidfdOpen(pid int, flags int) (fd int, err error) = SYS_PIDFD_OPEN +//sys PidfdGetfd(pidfd int, targetfd int, flags int) (fd int, err error) = SYS_PIDFD_GETFD + /* * Unimplemented */ diff --git a/vendor/golang.org/x/sys/unix/zsyscall_linux.go b/vendor/golang.org/x/sys/unix/zsyscall_linux.go @@ -1945,6 +1945,28 @@ func ProcessVMWritev(pid int, localIov []Iovec, remoteIov []RemoteIovec, flags u // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func PidfdOpen(pid int, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_PIDFD_OPEN, uintptr(pid), uintptr(flags), 0) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func PidfdGetfd(pidfd int, targetfd int, flags int) (fd int, err error) { + r0, _, e1 := Syscall(SYS_PIDFD_GETFD, uintptr(pidfd), uintptr(targetfd), uintptr(flags)) + fd = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func pipe2(p *[2]_C_int, flags int) (err error) { _, _, e1 := RawSyscall(SYS_PIPE2, uintptr(unsafe.Pointer(p)), uintptr(flags), 0) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_386.go @@ -31,6 +31,8 @@ type Timeval struct { Usec int32 } +type Time_t int32 + type Rusage struct { Utime Timeval Stime Timeval diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_amd64.go @@ -31,6 +31,8 @@ type Timeval struct { Usec int64 } +type Time_t int64 + type Rusage struct { Utime Timeval Stime Timeval diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm.go @@ -33,6 +33,8 @@ type Timeval struct { _ [4]byte } +type Time_t int32 + type Rusage struct { Utime Timeval Stime Timeval diff --git a/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_freebsd_arm64.go @@ -31,6 +31,8 @@ type Timeval struct { Usec int64 } +type Time_t int64 + type Rusage struct { Utime Timeval Stime Timeval diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_386.go b/vendor/golang.org/x/sys/unix/ztypes_linux_386.go @@ -635,3 +635,7 @@ const ( PPS_GETCAP = 0x800470a3 PPS_FETCH = 0xc00470a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go @@ -653,3 +653,7 @@ const ( PPS_GETCAP = 0x800870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go @@ -630,3 +630,7 @@ const ( PPS_GETCAP = 0x800470a3 PPS_FETCH = 0xc00470a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go @@ -632,3 +632,7 @@ const ( PPS_GETCAP = 0x800870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go @@ -636,3 +636,7 @@ const ( PPS_GETCAP = 0x400470a3 PPS_FETCH = 0xc00470a4 ) + +const ( + PIDFD_NONBLOCK = 0x80 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go @@ -635,3 +635,7 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x80 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go @@ -635,3 +635,7 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x80 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go b/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go @@ -636,3 +636,7 @@ const ( PPS_GETCAP = 0x400470a3 PPS_FETCH = 0xc00470a4 ) + +const ( + PIDFD_NONBLOCK = 0x80 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go @@ -642,3 +642,7 @@ const ( PPS_GETCAP = 0x400470a3 PPS_FETCH = 0xc00470a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go @@ -642,3 +642,7 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go b/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go @@ -642,3 +642,7 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go @@ -660,3 +660,7 @@ const ( PPS_GETCAP = 0x800870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go b/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go @@ -656,3 +656,7 @@ const ( PPS_GETCAP = 0x800870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x800 +) diff --git a/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go b/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go @@ -637,3 +637,7 @@ const ( PPS_GETCAP = 0x400870a3 PPS_FETCH = 0xc00870a4 ) + +const ( + PIDFD_NONBLOCK = 0x4000 +) diff --git a/vendor/golang.org/x/text/internal/language/language.go b/vendor/golang.org/x/text/internal/language/language.go @@ -251,6 +251,13 @@ func (t Tag) Parent() Tag { // ParseExtension parses s as an extension and returns it on success. func ParseExtension(s string) (ext string, err error) { + defer func() { + if recover() != nil { + ext = "" + err = ErrSyntax + } + }() + scan := makeScannerString(s) var end int if n := len(scan.token); n != 1 { @@ -461,7 +468,14 @@ func (t Tag) findTypeForKey(key string) (start, sep, end int, hasExt bool) { // ParseBase parses a 2- or 3-letter ISO 639 code. // It returns a ValueError if s is a well-formed but unknown language identifier // or another error if another error occurred. -func ParseBase(s string) (Language, error) { +func ParseBase(s string) (l Language, err error) { + defer func() { + if recover() != nil { + l = 0 + err = ErrSyntax + } + }() + if n := len(s); n < 2 || 3 < n { return 0, ErrSyntax } @@ -472,7 +486,14 @@ func ParseBase(s string) (Language, error) { // ParseScript parses a 4-letter ISO 15924 code. // It returns a ValueError if s is a well-formed but unknown script identifier // or another error if another error occurred. -func ParseScript(s string) (Script, error) { +func ParseScript(s string) (scr Script, err error) { + defer func() { + if recover() != nil { + scr = 0 + err = ErrSyntax + } + }() + if len(s) != 4 { return 0, ErrSyntax } @@ -489,7 +510,14 @@ func EncodeM49(r int) (Region, error) { // ParseRegion parses a 2- or 3-letter ISO 3166-1 or a UN M.49 code. // It returns a ValueError if s is a well-formed but unknown region identifier // or another error if another error occurred. -func ParseRegion(s string) (Region, error) { +func ParseRegion(s string) (r Region, err error) { + defer func() { + if recover() != nil { + r = 0 + err = ErrSyntax + } + }() + if n := len(s); n < 2 || 3 < n { return 0, ErrSyntax } @@ -578,7 +606,14 @@ type Variant struct { // ParseVariant parses and returns a Variant. An error is returned if s is not // a valid variant. -func ParseVariant(s string) (Variant, error) { +func ParseVariant(s string) (v Variant, err error) { + defer func() { + if recover() != nil { + v = Variant{} + err = ErrSyntax + } + }() + s = strings.ToLower(s) if id, ok := variantIndex[s]; ok { return Variant{id, s}, nil diff --git a/vendor/golang.org/x/text/internal/language/parse.go b/vendor/golang.org/x/text/internal/language/parse.go @@ -232,6 +232,13 @@ func Parse(s string) (t Tag, err error) { if s == "" { return Und, ErrSyntax } + defer func() { + if recover() != nil { + t = Und + err = ErrSyntax + return + } + }() if len(s) <= maxAltTaglen { b := [maxAltTaglen]byte{} for i, c := range s { diff --git a/vendor/golang.org/x/text/language/parse.go b/vendor/golang.org/x/text/language/parse.go @@ -43,6 +43,13 @@ func Parse(s string) (t Tag, err error) { // https://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers. // The resulting tag is canonicalized using the canonicalization type c. func (c CanonType) Parse(s string) (t Tag, err error) { + defer func() { + if recover() != nil { + t = Tag{} + err = language.ErrSyntax + } + }() + tt, err := language.Parse(s) if err != nil { return makeTag(tt), err @@ -79,6 +86,13 @@ func Compose(part ...interface{}) (t Tag, err error) { // tag is returned after canonicalizing using CanonType c. If one or more errors // are encountered, one of the errors is returned. func (c CanonType) Compose(part ...interface{}) (t Tag, err error) { + defer func() { + if recover() != nil { + t = Tag{} + err = language.ErrSyntax + } + }() + var b language.Builder if err = update(&b, part...); err != nil { return und, err @@ -142,6 +156,14 @@ var errInvalidWeight = errors.New("ParseAcceptLanguage: invalid weight") // Tags with a weight of zero will be dropped. An error will be returned if the // input could not be parsed. func ParseAcceptLanguage(s string) (tag []Tag, q []float32, err error) { + defer func() { + if recover() != nil { + tag = nil + q = nil + err = language.ErrSyntax + } + }() + var entry string for s != "" { if entry, s = split(s, ','); entry == "" { diff --git a/vendor/golang.org/x/xerrors/go.mod b/vendor/golang.org/x/xerrors/go.mod @@ -1,3 +0,0 @@ -module golang.org/x/xerrors - -go 1.11 diff --git a/vendor/google.golang.org/protobuf/encoding/prototext/decode.go b/vendor/google.golang.org/protobuf/encoding/prototext/decode.go @@ -744,9 +744,6 @@ func (d decoder) skipValue() error { // Skip items. This will not validate whether skipped values are // of the same type or not, same behavior as C++ // TextFormat::Parser::AllowUnknownField(true) version 3.8.0. - if err := d.skipValue(); err != nil { - return err - } } } } diff --git a/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go b/vendor/google.golang.org/protobuf/internal/encoding/text/encode.go @@ -263,3 +263,8 @@ func (e *Encoder) Snapshot() encoderState { func (e *Encoder) Reset(es encoderState) { e.encoderState = es } + +// AppendString appends the escaped form of the input string to b. +func AppendString(b []byte, s string) []byte { + return appendString(b, s, false) +} diff --git a/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go b/vendor/google.golang.org/protobuf/internal/impl/legacy_message.go @@ -440,6 +440,13 @@ func legacyMerge(in piface.MergeInput) piface.MergeOutput { if !ok { return piface.MergeOutput{} } + if !in.Source.IsValid() { + // Legacy Marshal methods may not function on nil messages. + // Check for a typed nil source only after we confirm that + // legacy Marshal/Unmarshal methods are present, for + // consistency. + return piface.MergeOutput{Flags: piface.MergeComplete} + } b, err := marshaler.Marshal() if err != nil { return piface.MergeOutput{} diff --git a/vendor/google.golang.org/protobuf/internal/version/version.go b/vendor/google.golang.org/protobuf/internal/version/version.go @@ -52,8 +52,8 @@ import ( // 10. Send out the CL for review and submit it. const ( Major = 1 - Minor = 26 - Patch = 0 + Minor = 27 + Patch = 1 PreRelease = "" ) diff --git a/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go b/vendor/google.golang.org/protobuf/reflect/protoregistry/registry.go @@ -94,7 +94,8 @@ type Files struct { // Note that enum values are in the top-level since that are in the same // scope as the parent enum. descsByName map[protoreflect.FullName]interface{} - filesByPath map[string]protoreflect.FileDescriptor + filesByPath map[string][]protoreflect.FileDescriptor + numFiles int } type packageDescriptor struct { @@ -117,17 +118,16 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error { r.descsByName = map[protoreflect.FullName]interface{}{ "": &packageDescriptor{}, } - r.filesByPath = make(map[string]protoreflect.FileDescriptor) + r.filesByPath = make(map[string][]protoreflect.FileDescriptor) } path := file.Path() - if prev := r.filesByPath[path]; prev != nil { + if prev := r.filesByPath[path]; len(prev) > 0 { r.checkGenProtoConflict(path) err := errors.New("file %q is already registered", file.Path()) - err = amendErrorWithCaller(err, prev, file) - if r == GlobalFiles && ignoreConflict(file, err) { - err = nil + err = amendErrorWithCaller(err, prev[0], file) + if !(r == GlobalFiles && ignoreConflict(file, err)) { + return err } - return err } for name := file.Package(); name != ""; name = name.Parent() { @@ -168,7 +168,8 @@ func (r *Files) RegisterFile(file protoreflect.FileDescriptor) error { rangeTopLevelDescriptors(file, func(d protoreflect.Descriptor) { r.descsByName[d.FullName()] = d }) - r.filesByPath[path] = file + r.filesByPath[path] = append(r.filesByPath[path], file) + r.numFiles++ return nil } @@ -308,6 +309,7 @@ func (s *nameSuffix) Pop() (name protoreflect.Name) { // FindFileByPath looks up a file by the path. // // This returns (nil, NotFound) if not found. +// This returns an error if multiple files have the same path. func (r *Files) FindFileByPath(path string) (protoreflect.FileDescriptor, error) { if r == nil { return nil, NotFound @@ -316,13 +318,19 @@ func (r *Files) FindFileByPath(path string) (protoreflect.FileDescriptor, error) globalMutex.RLock() defer globalMutex.RUnlock() } - if fd, ok := r.filesByPath[path]; ok { - return fd, nil + fds := r.filesByPath[path] + switch len(fds) { + case 0: + return nil, NotFound + case 1: + return fds[0], nil + default: + return nil, errors.New("multiple files named %q", path) } - return nil, NotFound } -// NumFiles reports the number of registered files. +// NumFiles reports the number of registered files, +// including duplicate files with the same name. func (r *Files) NumFiles() int { if r == nil { return 0 @@ -331,10 +339,11 @@ func (r *Files) NumFiles() int { globalMutex.RLock() defer globalMutex.RUnlock() } - return len(r.filesByPath) + return r.numFiles } // RangeFiles iterates over all registered files while f returns true. +// If multiple files have the same name, RangeFiles iterates over all of them. // The iteration order is undefined. func (r *Files) RangeFiles(f func(protoreflect.FileDescriptor) bool) { if r == nil { @@ -344,9 +353,11 @@ func (r *Files) RangeFiles(f func(protoreflect.FileDescriptor) bool) { globalMutex.RLock() defer globalMutex.RUnlock() } - for _, file := range r.filesByPath { - if !f(file) { - return + for _, files := range r.filesByPath { + for _, file := range files { + if !f(file) { + return + } } } } diff --git a/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go b/vendor/google.golang.org/protobuf/types/descriptorpb/descriptor.pb.go @@ -43,7 +43,6 @@ package descriptorpb import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoiface "google.golang.org/protobuf/runtime/protoiface" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" sync "sync" @@ -829,15 +828,6 @@ func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{3} } -var extRange_ExtensionRangeOptions = []protoiface.ExtensionRangeV1{ - {Start: 1000, End: 536870911}, -} - -// Deprecated: Use ExtensionRangeOptions.ProtoReflect.Descriptor.ExtensionRanges instead. -func (*ExtensionRangeOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 { - return extRange_ExtensionRangeOptions -} - func (x *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption { if x != nil { return x.UninterpretedOption @@ -1520,15 +1510,6 @@ func (*FileOptions) Descriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{10} } -var extRange_FileOptions = []protoiface.ExtensionRangeV1{ - {Start: 1000, End: 536870911}, -} - -// Deprecated: Use FileOptions.ProtoReflect.Descriptor.ExtensionRanges instead. -func (*FileOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 { - return extRange_FileOptions -} - func (x *FileOptions) GetJavaPackage() string { if x != nil && x.JavaPackage != nil { return *x.JavaPackage @@ -1776,15 +1757,6 @@ func (*MessageOptions) Descriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{11} } -var extRange_MessageOptions = []protoiface.ExtensionRangeV1{ - {Start: 1000, End: 536870911}, -} - -// Deprecated: Use MessageOptions.ProtoReflect.Descriptor.ExtensionRanges instead. -func (*MessageOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 { - return extRange_MessageOptions -} - func (x *MessageOptions) GetMessageSetWireFormat() bool { if x != nil && x.MessageSetWireFormat != nil { return *x.MessageSetWireFormat @@ -1930,15 +1902,6 @@ func (*FieldOptions) Descriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{12} } -var extRange_FieldOptions = []protoiface.ExtensionRangeV1{ - {Start: 1000, End: 536870911}, -} - -// Deprecated: Use FieldOptions.ProtoReflect.Descriptor.ExtensionRanges instead. -func (*FieldOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 { - return extRange_FieldOptions -} - func (x *FieldOptions) GetCtype() FieldOptions_CType { if x != nil && x.Ctype != nil { return *x.Ctype @@ -2030,15 +1993,6 @@ func (*OneofOptions) Descriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{13} } -var extRange_OneofOptions = []protoiface.ExtensionRangeV1{ - {Start: 1000, End: 536870911}, -} - -// Deprecated: Use OneofOptions.ProtoReflect.Descriptor.ExtensionRanges instead. -func (*OneofOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 { - return extRange_OneofOptions -} - func (x *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { if x != nil { return x.UninterpretedOption @@ -2101,15 +2055,6 @@ func (*EnumOptions) Descriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{14} } -var extRange_EnumOptions = []protoiface.ExtensionRangeV1{ - {Start: 1000, End: 536870911}, -} - -// Deprecated: Use EnumOptions.ProtoReflect.Descriptor.ExtensionRanges instead. -func (*EnumOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 { - return extRange_EnumOptions -} - func (x *EnumOptions) GetAllowAlias() bool { if x != nil && x.AllowAlias != nil { return *x.AllowAlias @@ -2183,15 +2128,6 @@ func (*EnumValueOptions) Descriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{15} } -var extRange_EnumValueOptions = []protoiface.ExtensionRangeV1{ - {Start: 1000, End: 536870911}, -} - -// Deprecated: Use EnumValueOptions.ProtoReflect.Descriptor.ExtensionRanges instead. -func (*EnumValueOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 { - return extRange_EnumValueOptions -} - func (x *EnumValueOptions) GetDeprecated() bool { if x != nil && x.Deprecated != nil { return *x.Deprecated @@ -2258,15 +2194,6 @@ func (*ServiceOptions) Descriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{16} } -var extRange_ServiceOptions = []protoiface.ExtensionRangeV1{ - {Start: 1000, End: 536870911}, -} - -// Deprecated: Use ServiceOptions.ProtoReflect.Descriptor.ExtensionRanges instead. -func (*ServiceOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 { - return extRange_ServiceOptions -} - func (x *ServiceOptions) GetDeprecated() bool { if x != nil && x.Deprecated != nil { return *x.Deprecated @@ -2335,15 +2262,6 @@ func (*MethodOptions) Descriptor() ([]byte, []int) { return file_google_protobuf_descriptor_proto_rawDescGZIP(), []int{17} } -var extRange_MethodOptions = []protoiface.ExtensionRangeV1{ - {Start: 1000, End: 536870911}, -} - -// Deprecated: Use MethodOptions.ProtoReflect.Descriptor.ExtensionRanges instead. -func (*MethodOptions) ExtensionRangeArray() []protoiface.ExtensionRangeV1 { - return extRange_MethodOptions -} - func (x *MethodOptions) GetDeprecated() bool { if x != nil && x.Deprecated != nil { return *x.Deprecated diff --git a/vendor/gopkg.in/square/go-jose.v2/.travis.yml b/vendor/gopkg.in/square/go-jose.v2/.travis.yml @@ -8,8 +8,8 @@ matrix: - go: tip go: -- '1.11.x' -- '1.12.x' +- '1.14.x' +- '1.15.x' - tip go_import_path: gopkg.in/square/go-jose.v2 diff --git a/vendor/gopkg.in/square/go-jose.v2/cipher/cbc_hmac.go b/vendor/gopkg.in/square/go-jose.v2/cipher/cbc_hmac.go @@ -150,7 +150,7 @@ func (ctx *cbcAEAD) computeAuthTag(aad, nonce, ciphertext []byte) []byte { return hmac.Sum(nil)[:ctx.authtagBytes] } -// resize ensures the the given slice has a capacity of at least n bytes. +// resize ensures that the given slice has a capacity of at least n bytes. // If the capacity of the slice is less than n, a new slice is allocated // and the existing data will be copied. func resize(in []byte, n uint64) (head, tail []byte) { diff --git a/vendor/gopkg.in/square/go-jose.v2/crypter.go b/vendor/gopkg.in/square/go-jose.v2/crypter.go @@ -216,6 +216,7 @@ func NewMultiEncrypter(enc ContentEncryption, rcpts []Recipient, opts *Encrypter if opts != nil { encrypter.compressionAlg = opts.Compression + encrypter.extraHeaders = opts.ExtraHeaders } for _, recipient := range rcpts { diff --git a/vendor/gopkg.in/square/go-jose.v2/json/decode.go b/vendor/gopkg.in/square/go-jose.v2/json/decode.go @@ -13,6 +13,7 @@ import ( "encoding/base64" "errors" "fmt" + "math" "reflect" "runtime" "strconv" @@ -245,6 +246,18 @@ func isValidNumber(s string) bool { return s == "" } +type NumberUnmarshalType int + +const ( + // unmarshal a JSON number into an interface{} as a float64 + UnmarshalFloat NumberUnmarshalType = iota + // unmarshal a JSON number into an interface{} as a `json.Number` + UnmarshalJSONNumber + // unmarshal a JSON number into an interface{} as a int64 + // if value is an integer otherwise float64 + UnmarshalIntOrFloat +) + // decodeState represents the state while decoding a JSON value. type decodeState struct { data []byte @@ -252,7 +265,7 @@ type decodeState struct { scan scanner nextscan scanner // for calls to nextValue savedError error - useNumber bool + numberType NumberUnmarshalType } // errPhase is used for errors that should not happen unless @@ -723,17 +736,38 @@ func (d *decodeState) literal(v reflect.Value) { d.literalStore(d.data[start:d.off], v, false) } -// convertNumber converts the number literal s to a float64 or a Number -// depending on the setting of d.useNumber. +// convertNumber converts the number literal s to a float64, int64 or a Number +// depending on d.numberDecodeType. func (d *decodeState) convertNumber(s string) (interface{}, error) { - if d.useNumber { + switch d.numberType { + + case UnmarshalJSONNumber: return Number(s), nil + case UnmarshalIntOrFloat: + v, err := strconv.ParseInt(s, 10, 64) + if err == nil { + return v, nil + } + + // tries to parse integer number in scientific notation + f, err := strconv.ParseFloat(s, 64) + if err != nil { + return nil, &UnmarshalTypeError{"number " + s, reflect.TypeOf(0.0), int64(d.off)} + } + + // if it has no decimal value use int64 + if fi, fd := math.Modf(f); fd == 0.0 { + return int64(fi), nil + } + return f, nil + default: + f, err := strconv.ParseFloat(s, 64) + if err != nil { + return nil, &UnmarshalTypeError{"number " + s, reflect.TypeOf(0.0), int64(d.off)} + } + return f, nil } - f, err := strconv.ParseFloat(s, 64) - if err != nil { - return nil, &UnmarshalTypeError{"number " + s, reflect.TypeOf(0.0), int64(d.off)} - } - return f, nil + } var numberType = reflect.TypeOf(Number("")) diff --git a/vendor/gopkg.in/square/go-jose.v2/json/stream.go b/vendor/gopkg.in/square/go-jose.v2/json/stream.go @@ -31,9 +31,14 @@ func NewDecoder(r io.Reader) *Decoder { return &Decoder{r: r} } +// Deprecated: Use `SetNumberType` instead // UseNumber causes the Decoder to unmarshal a number into an interface{} as a // Number instead of as a float64. -func (dec *Decoder) UseNumber() { dec.d.useNumber = true } +func (dec *Decoder) UseNumber() { dec.d.numberType = UnmarshalJSONNumber } + +// SetNumberType causes the Decoder to unmarshal a number into an interface{} as a +// Number, float64 or int64 depending on `t` enum value. +func (dec *Decoder) SetNumberType(t NumberUnmarshalType) { dec.d.numberType = t } // Decode reads the next JSON-encoded value from its // input and stores it in the value pointed to by v. diff --git a/vendor/gopkg.in/square/go-jose.v2/jwk.go b/vendor/gopkg.in/square/go-jose.v2/jwk.go @@ -238,7 +238,7 @@ func (k *JSONWebKey) UnmarshalJSON(data []byte) (err error) { if certPub != nil && keyPub != nil { if !reflect.DeepEqual(certPub, keyPub) { - return errors.New("square/go-jose: invalid JWK, public keys in key and x5c fields to not match") + return errors.New("square/go-jose: invalid JWK, public keys in key and x5c fields do not match") } } @@ -332,7 +332,7 @@ func (s *JSONWebKeySet) Key(kid string) []JSONWebKey { const rsaThumbprintTemplate = `{"e":"%s","kty":"RSA","n":"%s"}` const ecThumbprintTemplate = `{"crv":"%s","kty":"EC","x":"%s","y":"%s"}` -const edThumbprintTemplate = `{"crv":"%s","kty":"OKP",x":"%s"}` +const edThumbprintTemplate = `{"crv":"%s","kty":"OKP","x":"%s"}` func ecThumbprintInput(curve elliptic.Curve, x, y *big.Int) (string, error) { coordLength := curveSize(curve) @@ -406,7 +406,7 @@ func (k *JSONWebKey) IsPublic() bool { } } -// Public creates JSONWebKey with corresponding publik key if JWK represents asymmetric private key. +// Public creates JSONWebKey with corresponding public key if JWK represents asymmetric private key. func (k *JSONWebKey) Public() JSONWebKey { if k.IsPublic() { return *k diff --git a/vendor/gopkg.in/square/go-jose.v2/opaque.go b/vendor/gopkg.in/square/go-jose.v2/opaque.go @@ -17,7 +17,7 @@ package jose // OpaqueSigner is an interface that supports signing payloads with opaque -// private key(s). Private key operations preformed by implementors may, for +// private key(s). Private key operations performed by implementers may, for // example, occur in a hardware module. An OpaqueSigner may rotate signing keys // transparently to the user of this interface. type OpaqueSigner interface { diff --git a/vendor/gopkg.in/square/go-jose.v2/shared.go b/vendor/gopkg.in/square/go-jose.v2/shared.go @@ -183,7 +183,7 @@ type Header struct { // Unverified certificate chain parsed from x5c header. certificates []*x509.Certificate - // Any headers not recognised above get unmarshaled + // Any headers not recognised above get unmarshalled // from JSON in a generic manner and placed in this map. ExtraHeaders map[HeaderKey]interface{} } @@ -295,12 +295,12 @@ func (parsed rawHeader) getAPV() (*byteBuffer, error) { return parsed.getByteBuffer(headerAPV) } -// getIV extracts parsed "iv" frpom the raw JSON. +// getIV extracts parsed "iv" from the raw JSON. func (parsed rawHeader) getIV() (*byteBuffer, error) { return parsed.getByteBuffer(headerIV) } -// getTag extracts parsed "tag" frpom the raw JSON. +// getTag extracts parsed "tag" from the raw JSON. func (parsed rawHeader) getTag() (*byteBuffer, error) { return parsed.getByteBuffer(headerTag) } diff --git a/vendor/gopkg.in/yaml.v2/go.mod b/vendor/gopkg.in/yaml.v2/go.mod @@ -1,5 +0,0 @@ -module gopkg.in/yaml.v2 - -go 1.15 - -require gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 diff --git a/vendor/gopkg.in/yaml.v3/go.mod b/vendor/gopkg.in/yaml.v3/go.mod @@ -1,5 +0,0 @@ -module "gopkg.in/yaml.v3" - -require ( - "gopkg.in/check.v1" v0.0.0-20161208181325-20d25e280405 -) diff --git a/vendor/lukechampine.com/uint128/go.mod b/vendor/lukechampine.com/uint128/go.mod @@ -1,3 +0,0 @@ -module lukechampine.com/uint128 - -go 1.12 diff --git a/vendor/modernc.org/cc/v3/go.mod b/vendor/modernc.org/cc/v3/go.mod @@ -1,12 +0,0 @@ -module modernc.org/cc/v3 - -go 1.15 - -require ( - github.com/dustin/go-humanize v1.0.0 - github.com/google/go-cmp v0.5.3 - lukechampine.com/uint128 v1.1.1 - modernc.org/mathutil v1.4.0 - modernc.org/strutil v1.1.1 - modernc.org/token v1.0.0 -) diff --git a/vendor/modernc.org/cc/v3/go.sum b/vendor/modernc.org/cc/v3/go.sum @@ -1,17 +0,0 @@ -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -lukechampine.com/uint128 v1.1.1 h1:pnxCASz787iMf+02ssImqk6OLt+Z5QHMoZyUXR4z6JU= -lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.4.0 h1:GCjoRaBew8ECCKINQA2nYjzvufFW9YiEuuB+rQ9bn2E= -modernc.org/mathutil v1.4.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/strutil v1.1.1 h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs= -modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= -modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk= -modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= diff --git a/vendor/modernc.org/libc/go.mod b/vendor/modernc.org/libc/go.mod @@ -1,12 +0,0 @@ -module modernc.org/libc - -go 1.15 - -require ( - github.com/mattn/go-isatty v0.0.12 - golang.org/x/sys v0.0.0-20210902050250-f475640dd07b - modernc.org/cc/v3 v3.34.0 // indirect - modernc.org/ccgo/v3 v3.11.1 // indirect - modernc.org/mathutil v1.4.1 - modernc.org/memory v1.0.5 -) diff --git a/vendor/modernc.org/libc/go.sum b/vendor/modernc.org/libc/go.sum @@ -1,67 +0,0 @@ -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210902050250-f475640dd07b h1:S7hKs0Flbq0bbc9xgYt4stIEG1zNDFqyrPwAX2Wj/sE= -golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78 h1:M8tBwCtWD/cZV9DZpFYRUgaymAYAr+aIUTWzDaM3uPs= -golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -lukechampine.com/uint128 v1.1.1 h1:pnxCASz787iMf+02ssImqk6OLt+Z5QHMoZyUXR4z6JU= -lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -modernc.org/cc/v3 v3.33.6/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.33.9/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.33.11/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.34.0 h1:dFhZc/HKR3qp92sYQxKRRaDMz+sr1bwcFD+m7LSCrAs= -modernc.org/cc/v3 v3.34.0/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/ccgo/v3 v3.9.5/go.mod h1:umuo2EP2oDSBnD3ckjaVUXMrmeAw8C8OSICVa0iFf60= -modernc.org/ccgo/v3 v3.10.0/go.mod h1:c0yBmkRFi7uW4J7fwx/JiijwOjeAeR2NoSaRVFPmjMw= -modernc.org/ccgo/v3 v3.11.0/go.mod h1:dGNposbDp9TOZ/1KBxghxtUp/bzErD0/0QW4hhSaBMI= -modernc.org/ccgo/v3 v3.11.1 h1:ofHyxpKFARlebn+Vt2K9hpWEtbV9xRcOQVa1/vHfLws= -modernc.org/ccgo/v3 v3.11.1/go.mod h1:lWHxfsn13L3f7hgGsGlU28D9eUOf6y3ZYHKoPaKU0ag= -modernc.org/libc v1.9.8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w= -modernc.org/libc v1.9.11/go.mod h1:NyF3tsA5ArIjJ83XB0JlqhjTabTCHm9aX4XMPHyQn0Q= -modernc.org/libc v1.11.0/go.mod h1:2lOfPmj7cz+g1MrPNmX65QCzVxgNq2C5o0jdLY2gAYg= -modernc.org/libc v1.11.2/go.mod h1:ioIyrl3ETkugDO3SGZ+6EOKvlP3zSOycUETe4XM4n8M= -modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.4.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.4.1 h1:ij3fYGe8zBF4Vu+g0oT7mB06r8sqGWKuJu1yXeR4by8= -modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc= -modernc.org/memory v1.0.5 h1:XRch8trV7GgvTec2i7jc33YlUI0RKVDBvZ5eZ5m8y14= -modernc.org/memory v1.0.5/go.mod h1:B7OYswTRnfGg+4tDH1t1OeUNnsy2viGTdME4tzd+IjM= -modernc.org/opt v0.1.1 h1:/0RX92k9vwVeDXj+Xn23DKp2VJubL7k8qNffND6qn3A= -modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/strutil v1.1.1 h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs= -modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= -modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk= -modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= diff --git a/vendor/modernc.org/mathutil/go.mod b/vendor/modernc.org/mathutil/go.mod @@ -1,5 +0,0 @@ -module modernc.org/mathutil - -go 1.13 - -require github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 diff --git a/vendor/modernc.org/mathutil/go.sum b/vendor/modernc.org/mathutil/go.sum @@ -1,2 +0,0 @@ -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= diff --git a/vendor/modernc.org/memory/go.mod b/vendor/modernc.org/memory/go.mod @@ -1,7 +0,0 @@ -module modernc.org/memory - -// +heroku goVersion go1.14 - -go 1.15 - -require modernc.org/mathutil v1.4.1 diff --git a/vendor/modernc.org/memory/go.sum b/vendor/modernc.org/memory/go.sum @@ -1,4 +0,0 @@ -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -modernc.org/mathutil v1.4.1 h1:ij3fYGe8zBF4Vu+g0oT7mB06r8sqGWKuJu1yXeR4by8= -modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= diff --git a/vendor/modernc.org/opt/go.mod b/vendor/modernc.org/opt/go.mod @@ -1,3 +0,0 @@ -module modernc.org/opt - -go 1.13 diff --git a/vendor/modernc.org/sqlite/go.mod b/vendor/modernc.org/sqlite/go.mod @@ -1,13 +0,0 @@ -module modernc.org/sqlite - -go 1.15 - -require ( - github.com/mattn/go-sqlite3 v1.14.8 - golang.org/x/sys v0.0.0-20210902050250-f475640dd07b - modernc.org/ccgo/v3 v3.11.2 - modernc.org/libc v1.11.3 - modernc.org/mathutil v1.4.1 - modernc.org/tcl v1.5.9 - modernc.org/z v1.1.2 -) diff --git a/vendor/modernc.org/sqlite/go.sum b/vendor/modernc.org/sqlite/go.sum @@ -1,80 +0,0 @@ -github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= -github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= -github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-sqlite3 v1.14.8 h1:gDp86IdQsN/xWjIEmr9MF6o9mpksUgh0fu+9ByFxzIU= -github.com/mattn/go-sqlite3 v1.14.8/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210902050250-f475640dd07b h1:S7hKs0Flbq0bbc9xgYt4stIEG1zNDFqyrPwAX2Wj/sE= -golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78 h1:M8tBwCtWD/cZV9DZpFYRUgaymAYAr+aIUTWzDaM3uPs= -golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -lukechampine.com/uint128 v1.1.1 h1:pnxCASz787iMf+02ssImqk6OLt+Z5QHMoZyUXR4z6JU= -lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= -modernc.org/cc/v3 v3.33.6/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.33.9/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.33.11/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/cc/v3 v3.34.0 h1:dFhZc/HKR3qp92sYQxKRRaDMz+sr1bwcFD+m7LSCrAs= -modernc.org/cc/v3 v3.34.0/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g= -modernc.org/ccgo/v3 v3.9.5/go.mod h1:umuo2EP2oDSBnD3ckjaVUXMrmeAw8C8OSICVa0iFf60= -modernc.org/ccgo/v3 v3.10.0/go.mod h1:c0yBmkRFi7uW4J7fwx/JiijwOjeAeR2NoSaRVFPmjMw= -modernc.org/ccgo/v3 v3.11.0/go.mod h1:dGNposbDp9TOZ/1KBxghxtUp/bzErD0/0QW4hhSaBMI= -modernc.org/ccgo/v3 v3.11.1/go.mod h1:lWHxfsn13L3f7hgGsGlU28D9eUOf6y3ZYHKoPaKU0ag= -modernc.org/ccgo/v3 v3.11.2 h1:gqa8PQ2v7SjrhHCgxUO5dzoAJWSLAveJqZTNkPCN0kc= -modernc.org/ccgo/v3 v3.11.2/go.mod h1:6kii3AptTDI+nUrM9RFBoIEUEisSWCbdczD9ZwQH2FE= -modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM= -modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM= -modernc.org/libc v1.9.8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w= -modernc.org/libc v1.9.11/go.mod h1:NyF3tsA5ArIjJ83XB0JlqhjTabTCHm9aX4XMPHyQn0Q= -modernc.org/libc v1.11.0/go.mod h1:2lOfPmj7cz+g1MrPNmX65QCzVxgNq2C5o0jdLY2gAYg= -modernc.org/libc v1.11.2/go.mod h1:ioIyrl3ETkugDO3SGZ+6EOKvlP3zSOycUETe4XM4n8M= -modernc.org/libc v1.11.3 h1:q//spBhqp23lC/if8/o8hlyET57P8mCZqrqftzT2WmY= -modernc.org/libc v1.11.3/go.mod h1:k3HDCP95A6U111Q5TmG3nAyUcp3kR5YFZTeDS9v8vSU= -modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.4.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/mathutil v1.4.1 h1:ij3fYGe8zBF4Vu+g0oT7mB06r8sqGWKuJu1yXeR4by8= -modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= -modernc.org/memory v1.0.4/go.mod h1:nV2OApxradM3/OVbs2/0OsP6nPfakXpi50C7dcoHXlc= -modernc.org/memory v1.0.5 h1:XRch8trV7GgvTec2i7jc33YlUI0RKVDBvZ5eZ5m8y14= -modernc.org/memory v1.0.5/go.mod h1:B7OYswTRnfGg+4tDH1t1OeUNnsy2viGTdME4tzd+IjM= -modernc.org/opt v0.1.1 h1:/0RX92k9vwVeDXj+Xn23DKp2VJubL7k8qNffND6qn3A= -modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0= -modernc.org/strutil v1.1.1 h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs= -modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw= -modernc.org/tcl v1.5.9 h1:DZMfR+RDJRhcrmMEMTJgVIX+Wf5qhfVX0llI0rsc20w= -modernc.org/tcl v1.5.9/go.mod h1:bcwjvBJ2u0exY6K35eAmxXBBij5kXb1dHlAWmfhqThE= -modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk= -modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= -modernc.org/z v1.1.2 h1:IjjzDsIFbl0wuF2KfwvdyUAJVwxD4iwZ6akLNiDoClM= -modernc.org/z v1.1.2/go.mod h1:sj9T1AGBG0dm6SCVzldPOHWrif6XBpooJtbttMn1+Js= diff --git a/vendor/modernc.org/strutil/go.mod b/vendor/modernc.org/strutil/go.mod @@ -1,5 +0,0 @@ -module modernc.org/strutil - -go 1.15 - -require modernc.org/mathutil v1.2.2 diff --git a/vendor/modernc.org/strutil/go.sum b/vendor/modernc.org/strutil/go.sum @@ -1,4 +0,0 @@ -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= -github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= -modernc.org/mathutil v1.2.2 h1:+yFk8hBprV+4c0U9GjFtL+dV3N8hOJ8JCituQcMShFY= -modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= diff --git a/vendor/modules.txt b/vendor/modules.txt @@ -1,68 +1,75 @@ +# github.com/PuerkitoBio/goquery v1.7.1 +## explicit; go 1.13 # github.com/ReneKroon/ttlcache v1.7.0 -## explicit +## explicit; go 1.14 github.com/ReneKroon/ttlcache +# github.com/andybalholm/cascadia v1.2.0 +## explicit; go 1.13 # github.com/aymerick/douceur v0.2.0 +## explicit github.com/aymerick/douceur/css github.com/aymerick/douceur/parser # github.com/buckket/go-blurhash v1.1.0 -## explicit +## explicit; go 1.14 github.com/buckket/go-blurhash github.com/buckket/go-blurhash/base83 # github.com/coreos/go-oidc/v3 v3.0.0 -## explicit +## explicit; go 1.14 github.com/coreos/go-oidc/v3/oidc # github.com/cpuguy83/go-md2man/v2 v2.0.1 -## explicit +## explicit; go 1.11 github.com/cpuguy83/go-md2man/v2/md2man # github.com/davecgh/go-spew v1.1.1 +## explicit github.com/davecgh/go-spew/spew # github.com/dsoprea/go-exif v0.0.0-20210625224831-a6301f85c82b -## explicit +## explicit; go 1.13 github.com/dsoprea/go-exif # github.com/dsoprea/go-exif/v2 v2.0.0-20210625224831-a6301f85c82b -## explicit +## explicit; go 1.13 github.com/dsoprea/go-exif/v2 github.com/dsoprea/go-exif/v2/common github.com/dsoprea/go-exif/v2/undefined # github.com/dsoprea/go-iptc v0.0.0-20200610044640-bc9ca208b413 -## explicit +## explicit; go 1.13 github.com/dsoprea/go-iptc # github.com/dsoprea/go-jpeg-image-structure v0.0.0-20210512043942-b434301c6836 -## explicit +## explicit; go 1.13 github.com/dsoprea/go-jpeg-image-structure # github.com/dsoprea/go-logging v0.0.0-20200710184922-b02d349568dd -## explicit +## explicit; go 1.13 github.com/dsoprea/go-logging # github.com/dsoprea/go-photoshop-info-format v0.0.0-20200610045659-121dd752914d -## explicit +## explicit; go 1.13 github.com/dsoprea/go-photoshop-info-format # github.com/dsoprea/go-png-image-structure v0.0.0-20210512210324-29b889a6093d -## explicit +## explicit; go 1.13 github.com/dsoprea/go-png-image-structure # github.com/dsoprea/go-utility v0.0.0-20200717064901-2fccff4aa15e -## explicit +## explicit; go 1.12 github.com/dsoprea/go-utility/image # github.com/gin-contrib/cors v1.3.1 -## explicit +## explicit; go 1.13 github.com/gin-contrib/cors # github.com/gin-contrib/sessions v0.0.3 -## explicit +## explicit; go 1.12 github.com/gin-contrib/sessions github.com/gin-contrib/sessions/memstore # github.com/gin-contrib/sse v0.1.0 +## explicit; go 1.12 github.com/gin-contrib/sse -# github.com/gin-gonic/gin v1.7.2-0.20210722225815-d4ca9a0fb121 -## explicit +# github.com/gin-gonic/gin v1.7.2-0.20210908033055-3a6f18f32f22 +## explicit; go 1.13 github.com/gin-gonic/gin github.com/gin-gonic/gin/binding github.com/gin-gonic/gin/internal/bytesconv github.com/gin-gonic/gin/internal/json github.com/gin-gonic/gin/render # github.com/go-errors/errors v1.4.0 -## explicit +## explicit; go 1.14 github.com/go-errors/errors # github.com/go-fed/activity v1.0.1-0.20210803212804-d866ba75dd0f -## explicit +## explicit; go 1.12 github.com/go-fed/activity/pub github.com/go-fed/activity/streams github.com/go-fed/activity/streams/impl/activitystreams/property_accuracy @@ -243,103 +250,118 @@ github.com/go-fed/activity/streams/values/rfc5988 github.com/go-fed/activity/streams/values/string github.com/go-fed/activity/streams/vocab # github.com/go-fed/httpsig v1.1.0 -## explicit +## explicit; go 1.13 github.com/go-fed/httpsig -# github.com/go-playground/locales v0.13.0 +# github.com/go-playground/locales v0.14.0 +## explicit; go 1.13 github.com/go-playground/locales github.com/go-playground/locales/currency -# github.com/go-playground/universal-translator v0.17.0 +# github.com/go-playground/universal-translator v0.18.0 +## explicit; go 1.13 github.com/go-playground/universal-translator -# github.com/go-playground/validator/v10 v10.7.0 -## explicit +# github.com/go-playground/validator/v10 v10.9.0 +## explicit; go 1.13 github.com/go-playground/validator/v10 # github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b +## explicit github.com/go-xmlfmt/xmlfmt -# github.com/goccy/go-json v0.5.1 +# github.com/goccy/go-json v0.7.8 +## explicit; go 1.12 github.com/goccy/go-json +github.com/goccy/go-json/internal/decoder github.com/goccy/go-json/internal/encoder github.com/goccy/go-json/internal/encoder/vm -github.com/goccy/go-json/internal/encoder/vm_escaped -github.com/goccy/go-json/internal/encoder/vm_escaped_indent +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 github.com/goccy/go-json/internal/errors github.com/goccy/go-json/internal/runtime -# github.com/golang-jwt/jwt v3.2.1+incompatible +# github.com/golang-jwt/jwt v3.2.2+incompatible +## explicit github.com/golang-jwt/jwt # github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 -## explicit +## explicit; go 1.12 github.com/golang/geo/r1 github.com/golang/geo/r2 github.com/golang/geo/r3 github.com/golang/geo/s1 github.com/golang/geo/s2 -# github.com/golang/mock v1.6.0 -## explicit # github.com/golang/protobuf v1.5.2 -## explicit +## explicit; go 1.9 github.com/golang/protobuf/proto # github.com/google/uuid v1.3.0 ## explicit github.com/google/uuid # github.com/gorilla/context v1.1.1 +## explicit github.com/gorilla/context # github.com/gorilla/css v1.0.0 +## explicit github.com/gorilla/css/scanner # github.com/gorilla/securecookie v1.1.1 +## explicit github.com/gorilla/securecookie # github.com/gorilla/sessions v1.2.1 ## explicit github.com/gorilla/sessions # github.com/gorilla/websocket v1.4.2 -## explicit +## explicit; go 1.12 github.com/gorilla/websocket # github.com/h2non/filetype v1.1.1 -## explicit +## explicit; go 1.13 github.com/h2non/filetype github.com/h2non/filetype/matchers github.com/h2non/filetype/matchers/isobmff github.com/h2non/filetype/types # github.com/jackc/chunkreader/v2 v2.0.1 +## explicit; go 1.12 github.com/jackc/chunkreader/v2 # github.com/jackc/pgconn v1.10.0 -## explicit +## explicit; go 1.12 github.com/jackc/pgconn github.com/jackc/pgconn/internal/ctxwatch github.com/jackc/pgconn/stmtcache # github.com/jackc/pgio v1.0.0 +## explicit; go 1.12 github.com/jackc/pgio # github.com/jackc/pgpassfile v1.0.0 +## explicit; go 1.12 github.com/jackc/pgpassfile # github.com/jackc/pgproto3/v2 v2.1.1 +## explicit; go 1.12 github.com/jackc/pgproto3/v2 # github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b +## explicit; go 1.14 github.com/jackc/pgservicefile # github.com/jackc/pgtype v1.8.1 +## explicit; go 1.13 github.com/jackc/pgtype # github.com/jackc/pgx/v4 v4.13.0 -## explicit +## explicit; go 1.13 github.com/jackc/pgx/v4 github.com/jackc/pgx/v4/internal/sanitize github.com/jackc/pgx/v4/stdlib # github.com/jinzhu/inflection v1.0.0 +## explicit github.com/jinzhu/inflection # github.com/json-iterator/go v1.1.11 -## explicit +## explicit; go 1.12 github.com/json-iterator/go # github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 +## explicit github.com/kballard/go-shellquote # github.com/leodido/go-urn v1.2.1 -## explicit +## explicit; go 1.13 github.com/leodido/go-urn # github.com/mattn/go-isatty v0.0.14 -## explicit +## explicit; go 1.12 github.com/mattn/go-isatty # github.com/microcosm-cc/bluemonday v1.0.15 -## explicit +## explicit; go 1.16 github.com/microcosm-cc/bluemonday github.com/microcosm-cc/bluemonday/css # github.com/mitchellh/mapstructure v1.4.1 -## explicit +## explicit; go 1.14 github.com/mitchellh/mapstructure # github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd ## explicit @@ -354,28 +376,32 @@ github.com/nfnt/resize ## explicit github.com/oklog/ulid # github.com/pmezard/go-difflib v1.0.0 +## explicit github.com/pmezard/go-difflib/difflib # github.com/quasoft/memstore v0.0.0-20191010062613-2bce066d2b0b ## explicit github.com/quasoft/memstore # github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 +## explicit; go 1.12 github.com/remyoudompheng/bigfft # github.com/russross/blackfriday/v2 v2.1.0 ## explicit github.com/russross/blackfriday/v2 # github.com/sirupsen/logrus v1.8.1 -## explicit +## explicit; go 1.13 github.com/sirupsen/logrus +# github.com/stretchr/objx v0.2.0 +## explicit; go 1.12 # github.com/stretchr/testify v1.7.0 -## explicit +## explicit; go 1.13 github.com/stretchr/testify/assert github.com/stretchr/testify/require github.com/stretchr/testify/suite # github.com/superseriousbusiness/exifremove v0.0.0-20210330092427-6acd27eac203 -## explicit +## explicit; go 1.16 github.com/superseriousbusiness/exifremove/pkg/exifremove # github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB -## explicit +## explicit; go 1.13 github.com/superseriousbusiness/oauth2/v4 github.com/superseriousbusiness/oauth2/v4/errors github.com/superseriousbusiness/oauth2/v4/generates @@ -383,22 +409,23 @@ github.com/superseriousbusiness/oauth2/v4/manage github.com/superseriousbusiness/oauth2/v4/models github.com/superseriousbusiness/oauth2/v4/server # github.com/tdewolff/minify/v2 v2.9.21 -## explicit +## explicit; go 1.13 github.com/tdewolff/minify/v2 github.com/tdewolff/minify/v2/html # github.com/tdewolff/parse/v2 v2.5.19 +## explicit; go 1.13 github.com/tdewolff/parse/v2 github.com/tdewolff/parse/v2/buffer github.com/tdewolff/parse/v2/html github.com/tdewolff/parse/v2/strconv -# github.com/tidwall/buntdb v1.2.4 -## explicit # github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc +## explicit github.com/tmthrgd/go-hex # github.com/ugorji/go/codec v1.2.6 +## explicit; go 1.11 github.com/ugorji/go/codec -# github.com/uptrace/bun v1.0.4 -## explicit +# github.com/uptrace/bun v1.0.5 +## explicit; go 1.16 github.com/uptrace/bun github.com/uptrace/bun/dialect github.com/uptrace/bun/dialect/feature @@ -409,27 +436,29 @@ github.com/uptrace/bun/internal/parser github.com/uptrace/bun/internal/tagparser github.com/uptrace/bun/migrate github.com/uptrace/bun/schema -# github.com/uptrace/bun/dialect/pgdialect v0.4.3 -## explicit +# github.com/uptrace/bun/dialect/pgdialect v1.0.5 +## explicit; go 1.16 github.com/uptrace/bun/dialect/pgdialect -# github.com/uptrace/bun/dialect/sqlitedialect v0.4.3 -## explicit +# github.com/uptrace/bun/dialect/sqlitedialect v1.0.5 +## explicit; go 1.16 github.com/uptrace/bun/dialect/sqlitedialect # github.com/urfave/cli/v2 v2.3.0 -## explicit +## explicit; go 1.11 github.com/urfave/cli/v2 # github.com/vmihailenco/msgpack/v5 v5.3.4 +## explicit; go 1.11 github.com/vmihailenco/msgpack/v5 github.com/vmihailenco/msgpack/v5/msgpcode # github.com/vmihailenco/tagparser/v2 v2.0.0 +## explicit; go 1.15 github.com/vmihailenco/tagparser/v2 github.com/vmihailenco/tagparser/v2/internal github.com/vmihailenco/tagparser/v2/internal/parser # github.com/wagslane/go-password-validator v0.3.0 -## explicit +## explicit; go 1.16 github.com/wagslane/go-password-validator -# golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 -## explicit +# golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 +## explicit; go 1.17 golang.org/x/crypto/acme golang.org/x/crypto/acme/autocert golang.org/x/crypto/bcrypt @@ -449,27 +478,28 @@ golang.org/x/crypto/sha3 golang.org/x/crypto/ssh golang.org/x/crypto/ssh/internal/bcrypt_pbkdf # golang.org/x/mod v0.5.0 -## explicit +## explicit; go 1.17 golang.org/x/mod/semver -# golang.org/x/net v0.0.0-20210614182718-04defd469f4e +# golang.org/x/net v0.0.0-20210908191846-a5e095526f91 +## explicit; go 1.17 golang.org/x/net/context golang.org/x/net/context/ctxhttp golang.org/x/net/html golang.org/x/net/html/atom golang.org/x/net/idna # golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f -## explicit +## explicit; go 1.11 golang.org/x/oauth2 golang.org/x/oauth2/internal -# golang.org/x/sys v0.0.0-20210908160347-a851e7ddeee0 -## explicit +# golang.org/x/sys v0.0.0-20210909193231-528a39cd75f3 +## explicit; go 1.17 golang.org/x/sys/cpu golang.org/x/sys/execabs golang.org/x/sys/internal/unsafeheader golang.org/x/sys/unix golang.org/x/sys/windows -# golang.org/x/text v0.3.6 -## explicit +# golang.org/x/text v0.3.7 +## explicit; go 1.17 golang.org/x/text/cases golang.org/x/text/internal golang.org/x/text/internal/language @@ -484,7 +514,7 @@ golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm golang.org/x/text/width # golang.org/x/tools v0.1.5 -## explicit +## explicit; go 1.17 golang.org/x/tools/go/gcexportdata golang.org/x/tools/go/internal/gcimporter golang.org/x/tools/go/internal/packagesdriver @@ -497,10 +527,11 @@ golang.org/x/tools/internal/gocommand golang.org/x/tools/internal/packagesinternal golang.org/x/tools/internal/typesinternal # golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 +## explicit; go 1.11 golang.org/x/xerrors golang.org/x/xerrors/internal # google.golang.org/appengine v1.6.7 -## explicit +## explicit; go 1.11 google.golang.org/appengine/internal google.golang.org/appengine/internal/base google.golang.org/appengine/internal/datastore @@ -508,7 +539,8 @@ google.golang.org/appengine/internal/log google.golang.org/appengine/internal/remote_api google.golang.org/appengine/internal/urlfetch google.golang.org/appengine/urlfetch -# google.golang.org/protobuf v1.26.0 +# google.golang.org/protobuf v1.27.1 +## explicit; go 1.9 google.golang.org/protobuf/encoding/prototext google.golang.org/protobuf/encoding/protowire google.golang.org/protobuf/internal/descfmt @@ -536,25 +568,28 @@ google.golang.org/protobuf/reflect/protoregistry google.golang.org/protobuf/runtime/protoiface google.golang.org/protobuf/runtime/protoimpl google.golang.org/protobuf/types/descriptorpb -# gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c +# gopkg.in/square/go-jose.v2 v2.6.0 ## explicit -# gopkg.in/square/go-jose.v2 v2.5.1 gopkg.in/square/go-jose.v2 gopkg.in/square/go-jose.v2/cipher gopkg.in/square/go-jose.v2/json # gopkg.in/yaml.v2 v2.4.0 -## explicit +## explicit; go 1.15 gopkg.in/yaml.v2 # gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b ## explicit gopkg.in/yaml.v3 # lukechampine.com/uint128 v1.1.1 +## explicit; go 1.12 lukechampine.com/uint128 # modernc.org/cc/v3 v3.34.0 +## explicit; go 1.15 modernc.org/cc/v3 # modernc.org/ccgo/v3 v3.11.2 +## explicit; go 1.15 modernc.org/ccgo/v3/lib # modernc.org/libc v1.11.3 +## explicit; go 1.15 modernc.org/libc modernc.org/libc/errno modernc.org/libc/fcntl @@ -579,19 +614,24 @@ modernc.org/libc/unistd modernc.org/libc/utime modernc.org/libc/uuid/uuid # modernc.org/mathutil v1.4.1 +## explicit; go 1.13 modernc.org/mathutil # modernc.org/memory v1.0.5 +## explicit; go 1.15 modernc.org/memory # modernc.org/opt v0.1.1 +## explicit; go 1.13 modernc.org/opt # modernc.org/sqlite v1.13.0 -## explicit +## explicit; go 1.15 modernc.org/sqlite modernc.org/sqlite/lib # modernc.org/strutil v1.1.1 +## explicit; go 1.15 modernc.org/strutil # modernc.org/token v1.0.0 +## explicit modernc.org/token # mvdan.cc/xurls/v2 v2.3.0 -## explicit +## explicit; go 1.15 mvdan.cc/xurls/v2 diff --git a/vendor/mvdan.cc/xurls/v2/go.mod b/vendor/mvdan.cc/xurls/v2/go.mod @@ -1,5 +0,0 @@ -module mvdan.cc/xurls/v2 - -go 1.15 - -require github.com/rogpeppe/go-internal v1.8.0 diff --git a/vendor/mvdan.cc/xurls/v2/go.sum b/vendor/mvdan.cc/xurls/v2/go.sum @@ -1,13 +0,0 @@ -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= -github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= -github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=