From e7df54ddcfe2a47515060c8f0088dd9d90cf872d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Phan=20Qu=E1=BB=91c=20B=E1=BA=A3o?= <52545745+phqb@users.noreply.github.com> Date: Fri, 14 Jun 2024 15:42:23 +0700 Subject: [PATCH] Revert "Msgpack encoding (#21)" (#24) This reverts commit f6a6ae840584bd6059d5147b5e819667b39de4f2. --- .github/workflows/go_generate.yaml | 16 - entities/pool.go | 14 +- entities/pool_gen.go | 516 ------------------------ entities/pool_test.go | 22 - entities/tickdataprovider.go | 5 - entities/tickdataprovider_gen.go | 193 --------- entities/tickdataprovider_msgpencode.go | 150 ------- entities/ticklistdataprovider.go | 7 - entities/ticklistdataprovider_gen.go | 121 ------ go.mod | 15 +- go.sum | 35 +- 11 files changed, 16 insertions(+), 1078 deletions(-) delete mode 100644 .github/workflows/go_generate.yaml delete mode 100644 entities/pool_gen.go delete mode 100644 entities/tickdataprovider_gen.go delete mode 100644 entities/tickdataprovider_msgpencode.go delete mode 100644 entities/ticklistdataprovider_gen.go diff --git a/.github/workflows/go_generate.yaml b/.github/workflows/go_generate.yaml deleted file mode 100644 index 30a9de7..0000000 --- a/.github/workflows/go_generate.yaml +++ /dev/null @@ -1,16 +0,0 @@ -on: [push, pull_request] -name: Check go generate -jobs: - go-generate-check: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Install Go - uses: actions/setup-go@v5 - with: - go-version-file: 'go.mod' - - name: Run go generate - run: go generate ./... - - name: Check working tree clean - run: if [ -z "$(git status --porcelain)" ]; then exit 0; else exit 1; fi \ No newline at end of file diff --git a/entities/pool.go b/entities/pool.go index 939837d..1e0ac99 100644 --- a/entities/pool.go +++ b/entities/pool.go @@ -1,9 +1,3 @@ -//go:generate go run github.com/tinylib/msgp -unexported -tests=false -v -//msgp:tuple Pool -//msgp:shim *big.Int as:[]byte using:msgpencode.EncodeInt/msgpencode.DecodeInt -//msgp:shim constants.FeeAmount as:uint64 using:uint64/constants.FeeAmount -//msgp:ignore StepComputations SwapResult GetOutputAmountResult GetInputAmountResult TickDataProvider - package entities import ( @@ -42,7 +36,7 @@ type Pool struct { SqrtRatioX96 *big.Int Liquidity *big.Int TickCurrent int - TickDataProvider *TickDataProviderWrapper + TickDataProvider TickDataProvider token0Price *entities.Price token1Price *entities.Price @@ -120,7 +114,7 @@ func NewPool(tokenA, tokenB *entities.Token, fee constants.FeeAmount, sqrtRatioX SqrtRatioX96: sqrtRatioX96, Liquidity: liquidity, TickCurrent: tickCurrent, - TickDataProvider: NewTickDataProviderWrapper(ticks), + TickDataProvider: ticks, // TODO: new tick data provider }, nil } @@ -199,7 +193,7 @@ func (p *Pool) GetOutputAmount(inputAmount *entities.CurrencyAmount, sqrtPriceLi swapResult.sqrtRatioX96, swapResult.liquidity, swapResult.currentTick, - p.TickDataProvider.Get(), + p.TickDataProvider, ) if err != nil { return nil, err @@ -242,7 +236,7 @@ func (p *Pool) GetInputAmount(outputAmount *entities.CurrencyAmount, sqrtPriceLi swapResult.sqrtRatioX96, swapResult.liquidity, swapResult.currentTick, - p.TickDataProvider.Get(), + p.TickDataProvider, ) if err != nil { return nil, err diff --git a/entities/pool_gen.go b/entities/pool_gen.go deleted file mode 100644 index 5a4a8da..0000000 --- a/entities/pool_gen.go +++ /dev/null @@ -1,516 +0,0 @@ -package entities - -// Code generated by github.com/tinylib/msgp DO NOT EDIT. - -import ( - "github.com/daoleno/uniswap-sdk-core/entities" - "github.com/daoleno/uniswap-sdk-core/msgpencode" - "github.com/daoleno/uniswapv3-sdk/constants" - "github.com/tinylib/msgp/msgp" -) - -// DecodeMsg implements msgp.Decodable -func (z *Pool) DecodeMsg(dc *msgp.Reader) (err error) { - var zb0001 uint32 - zb0001, err = dc.ReadArrayHeader() - if err != nil { - err = msgp.WrapError(err) - return - } - if zb0001 != 9 { - err = msgp.ArrayError{Wanted: 9, Got: zb0001} - return - } - if dc.IsNil() { - err = dc.ReadNil() - if err != nil { - err = msgp.WrapError(err, "Token0") - return - } - z.Token0 = nil - } else { - if z.Token0 == nil { - z.Token0 = new(entities.Token) - } - err = z.Token0.DecodeMsg(dc) - if err != nil { - err = msgp.WrapError(err, "Token0") - return - } - } - if dc.IsNil() { - err = dc.ReadNil() - if err != nil { - err = msgp.WrapError(err, "Token1") - return - } - z.Token1 = nil - } else { - if z.Token1 == nil { - z.Token1 = new(entities.Token) - } - err = z.Token1.DecodeMsg(dc) - if err != nil { - err = msgp.WrapError(err, "Token1") - return - } - } - { - var zb0002 uint64 - zb0002, err = dc.ReadUint64() - if err != nil { - err = msgp.WrapError(err, "Fee") - return - } - z.Fee = constants.FeeAmount(zb0002) - } - if dc.IsNil() { - err = dc.ReadNil() - if err != nil { - err = msgp.WrapError(err, "SqrtRatioX96") - return - } - z.SqrtRatioX96 = nil - } else { - { - var zb0003 []byte - zb0003, err = dc.ReadBytes(msgpencode.EncodeInt(z.SqrtRatioX96)) - if err != nil { - err = msgp.WrapError(err, "SqrtRatioX96") - return - } - z.SqrtRatioX96 = msgpencode.DecodeInt(zb0003) - } - } - if dc.IsNil() { - err = dc.ReadNil() - if err != nil { - err = msgp.WrapError(err, "Liquidity") - return - } - z.Liquidity = nil - } else { - { - var zb0004 []byte - zb0004, err = dc.ReadBytes(msgpencode.EncodeInt(z.Liquidity)) - if err != nil { - err = msgp.WrapError(err, "Liquidity") - return - } - z.Liquidity = msgpencode.DecodeInt(zb0004) - } - } - z.TickCurrent, err = dc.ReadInt() - if err != nil { - err = msgp.WrapError(err, "TickCurrent") - return - } - if dc.IsNil() { - err = dc.ReadNil() - if err != nil { - err = msgp.WrapError(err, "TickDataProvider") - return - } - z.TickDataProvider = nil - } else { - if z.TickDataProvider == nil { - z.TickDataProvider = new(TickDataProviderWrapper) - } - err = z.TickDataProvider.DecodeMsg(dc) - if err != nil { - err = msgp.WrapError(err, "TickDataProvider") - return - } - } - if dc.IsNil() { - err = dc.ReadNil() - if err != nil { - err = msgp.WrapError(err, "token0Price") - return - } - z.token0Price = nil - } else { - if z.token0Price == nil { - z.token0Price = new(entities.Price) - } - err = z.token0Price.DecodeMsg(dc) - if err != nil { - err = msgp.WrapError(err, "token0Price") - return - } - } - if dc.IsNil() { - err = dc.ReadNil() - if err != nil { - err = msgp.WrapError(err, "token1Price") - return - } - z.token1Price = nil - } else { - if z.token1Price == nil { - z.token1Price = new(entities.Price) - } - err = z.token1Price.DecodeMsg(dc) - if err != nil { - err = msgp.WrapError(err, "token1Price") - return - } - } - return -} - -// EncodeMsg implements msgp.Encodable -func (z *Pool) EncodeMsg(en *msgp.Writer) (err error) { - // array header, size 9 - err = en.Append(0x99) - if err != nil { - return - } - if z.Token0 == nil { - err = en.WriteNil() - if err != nil { - return - } - } else { - err = z.Token0.EncodeMsg(en) - if err != nil { - err = msgp.WrapError(err, "Token0") - return - } - } - if z.Token1 == nil { - err = en.WriteNil() - if err != nil { - return - } - } else { - err = z.Token1.EncodeMsg(en) - if err != nil { - err = msgp.WrapError(err, "Token1") - return - } - } - err = en.WriteUint64(uint64(z.Fee)) - if err != nil { - err = msgp.WrapError(err, "Fee") - return - } - if z.SqrtRatioX96 == nil { - err = en.WriteNil() - if err != nil { - return - } - } else { - err = en.WriteBytes(msgpencode.EncodeInt(z.SqrtRatioX96)) - if err != nil { - err = msgp.WrapError(err, "SqrtRatioX96") - return - } - } - if z.Liquidity == nil { - err = en.WriteNil() - if err != nil { - return - } - } else { - err = en.WriteBytes(msgpencode.EncodeInt(z.Liquidity)) - if err != nil { - err = msgp.WrapError(err, "Liquidity") - return - } - } - err = en.WriteInt(z.TickCurrent) - if err != nil { - err = msgp.WrapError(err, "TickCurrent") - return - } - if z.TickDataProvider == nil { - err = en.WriteNil() - if err != nil { - return - } - } else { - err = z.TickDataProvider.EncodeMsg(en) - if err != nil { - err = msgp.WrapError(err, "TickDataProvider") - return - } - } - if z.token0Price == nil { - err = en.WriteNil() - if err != nil { - return - } - } else { - err = z.token0Price.EncodeMsg(en) - if err != nil { - err = msgp.WrapError(err, "token0Price") - return - } - } - if z.token1Price == nil { - err = en.WriteNil() - if err != nil { - return - } - } else { - err = z.token1Price.EncodeMsg(en) - if err != nil { - err = msgp.WrapError(err, "token1Price") - return - } - } - return -} - -// MarshalMsg implements msgp.Marshaler -func (z *Pool) MarshalMsg(b []byte) (o []byte, err error) { - o = msgp.Require(b, z.Msgsize()) - // array header, size 9 - o = append(o, 0x99) - if z.Token0 == nil { - o = msgp.AppendNil(o) - } else { - o, err = z.Token0.MarshalMsg(o) - if err != nil { - err = msgp.WrapError(err, "Token0") - return - } - } - if z.Token1 == nil { - o = msgp.AppendNil(o) - } else { - o, err = z.Token1.MarshalMsg(o) - if err != nil { - err = msgp.WrapError(err, "Token1") - return - } - } - o = msgp.AppendUint64(o, uint64(z.Fee)) - if z.SqrtRatioX96 == nil { - o = msgp.AppendNil(o) - } else { - o = msgp.AppendBytes(o, msgpencode.EncodeInt(z.SqrtRatioX96)) - } - if z.Liquidity == nil { - o = msgp.AppendNil(o) - } else { - o = msgp.AppendBytes(o, msgpencode.EncodeInt(z.Liquidity)) - } - o = msgp.AppendInt(o, z.TickCurrent) - if z.TickDataProvider == nil { - o = msgp.AppendNil(o) - } else { - o, err = z.TickDataProvider.MarshalMsg(o) - if err != nil { - err = msgp.WrapError(err, "TickDataProvider") - return - } - } - if z.token0Price == nil { - o = msgp.AppendNil(o) - } else { - o, err = z.token0Price.MarshalMsg(o) - if err != nil { - err = msgp.WrapError(err, "token0Price") - return - } - } - if z.token1Price == nil { - o = msgp.AppendNil(o) - } else { - o, err = z.token1Price.MarshalMsg(o) - if err != nil { - err = msgp.WrapError(err, "token1Price") - return - } - } - return -} - -// UnmarshalMsg implements msgp.Unmarshaler -func (z *Pool) UnmarshalMsg(bts []byte) (o []byte, err error) { - var zb0001 uint32 - zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) - if err != nil { - err = msgp.WrapError(err) - return - } - if zb0001 != 9 { - err = msgp.ArrayError{Wanted: 9, Got: zb0001} - return - } - if msgp.IsNil(bts) { - bts, err = msgp.ReadNilBytes(bts) - if err != nil { - return - } - z.Token0 = nil - } else { - if z.Token0 == nil { - z.Token0 = new(entities.Token) - } - bts, err = z.Token0.UnmarshalMsg(bts) - if err != nil { - err = msgp.WrapError(err, "Token0") - return - } - } - if msgp.IsNil(bts) { - bts, err = msgp.ReadNilBytes(bts) - if err != nil { - return - } - z.Token1 = nil - } else { - if z.Token1 == nil { - z.Token1 = new(entities.Token) - } - bts, err = z.Token1.UnmarshalMsg(bts) - if err != nil { - err = msgp.WrapError(err, "Token1") - return - } - } - { - var zb0002 uint64 - zb0002, bts, err = msgp.ReadUint64Bytes(bts) - if err != nil { - err = msgp.WrapError(err, "Fee") - return - } - z.Fee = constants.FeeAmount(zb0002) - } - if msgp.IsNil(bts) { - bts, err = msgp.ReadNilBytes(bts) - if err != nil { - return - } - z.SqrtRatioX96 = nil - } else { - { - var zb0003 []byte - zb0003, bts, err = msgp.ReadBytesBytes(bts, msgpencode.EncodeInt(z.SqrtRatioX96)) - if err != nil { - err = msgp.WrapError(err, "SqrtRatioX96") - return - } - z.SqrtRatioX96 = msgpencode.DecodeInt(zb0003) - } - } - if msgp.IsNil(bts) { - bts, err = msgp.ReadNilBytes(bts) - if err != nil { - return - } - z.Liquidity = nil - } else { - { - var zb0004 []byte - zb0004, bts, err = msgp.ReadBytesBytes(bts, msgpencode.EncodeInt(z.Liquidity)) - if err != nil { - err = msgp.WrapError(err, "Liquidity") - return - } - z.Liquidity = msgpencode.DecodeInt(zb0004) - } - } - z.TickCurrent, bts, err = msgp.ReadIntBytes(bts) - if err != nil { - err = msgp.WrapError(err, "TickCurrent") - return - } - if msgp.IsNil(bts) { - bts, err = msgp.ReadNilBytes(bts) - if err != nil { - return - } - z.TickDataProvider = nil - } else { - if z.TickDataProvider == nil { - z.TickDataProvider = new(TickDataProviderWrapper) - } - bts, err = z.TickDataProvider.UnmarshalMsg(bts) - if err != nil { - err = msgp.WrapError(err, "TickDataProvider") - return - } - } - if msgp.IsNil(bts) { - bts, err = msgp.ReadNilBytes(bts) - if err != nil { - return - } - z.token0Price = nil - } else { - if z.token0Price == nil { - z.token0Price = new(entities.Price) - } - bts, err = z.token0Price.UnmarshalMsg(bts) - if err != nil { - err = msgp.WrapError(err, "token0Price") - return - } - } - if msgp.IsNil(bts) { - bts, err = msgp.ReadNilBytes(bts) - if err != nil { - return - } - z.token1Price = nil - } else { - if z.token1Price == nil { - z.token1Price = new(entities.Price) - } - bts, err = z.token1Price.UnmarshalMsg(bts) - if err != nil { - err = msgp.WrapError(err, "token1Price") - return - } - } - o = bts - return -} - -// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message -func (z *Pool) Msgsize() (s int) { - s = 1 - if z.Token0 == nil { - s += msgp.NilSize - } else { - s += z.Token0.Msgsize() - } - if z.Token1 == nil { - s += msgp.NilSize - } else { - s += z.Token1.Msgsize() - } - s += msgp.Uint64Size - if z.SqrtRatioX96 == nil { - s += msgp.NilSize - } else { - s += msgp.BytesPrefixSize + len(msgpencode.EncodeInt(z.SqrtRatioX96)) - } - if z.Liquidity == nil { - s += msgp.NilSize - } else { - s += msgp.BytesPrefixSize + len(msgpencode.EncodeInt(z.Liquidity)) - } - s += msgp.IntSize - if z.TickDataProvider == nil { - s += msgp.NilSize - } else { - s += z.TickDataProvider.Msgsize() - } - if z.token0Price == nil { - s += msgp.NilSize - } else { - s += z.token0Price.Msgsize() - } - if z.token1Price == nil { - s += msgp.NilSize - } else { - s += z.token1Price.Msgsize() - } - return -} diff --git a/entities/pool_test.go b/entities/pool_test.go index 4b03085..308eabf 100644 --- a/entities/pool_test.go +++ b/entities/pool_test.go @@ -1,7 +1,6 @@ package entities import ( - "bytes" "math/big" "testing" @@ -10,7 +9,6 @@ import ( "github.com/daoleno/uniswapv3-sdk/utils" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/assert" - "github.com/tinylib/msgp/msgp" ) var ( @@ -239,23 +237,3 @@ func TestGetInputAmount2(t *testing.T) { assert.Equal(t, getInputAmountResult.ReturnedAmount.Quotient(), big.NewInt(7074025631378098)) assert.Equal(t, getInputAmountResult.RemainingAmountOut.Quotient(), big.NewInt(-480436293)) } - -func TestPoolMsgpEndecode(t *testing.T) { - poolWithNilProvider := newTestPool() - poolWithNilProvider.TickDataProvider = nil - pools := []*Pool{ - newTestPool(), - poolWithNilProvider, - } - for _, pool := range pools { - encoded := new(bytes.Buffer) - err := msgp.Encode(encoded, pool) - assert.NoError(t, err) - - decoded := new(Pool) - err = msgp.Decode(encoded, decoded) - assert.NoError(t, err) - - assert.EqualValues(t, pool, decoded) - } -} diff --git a/entities/tickdataprovider.go b/entities/tickdataprovider.go index 85ef02f..6086e61 100644 --- a/entities/tickdataprovider.go +++ b/entities/tickdataprovider.go @@ -1,8 +1,3 @@ -//go:generate go run github.com/tinylib/msgp -unexported -tests=false -v -//msgp:tuple Tick -//msgp:shim *big.Int as:[]byte using:msgpencode.EncodeInt/msgpencode.DecodeInt -//msgp:ignore TickDataProvider - package entities import "math/big" diff --git a/entities/tickdataprovider_gen.go b/entities/tickdataprovider_gen.go deleted file mode 100644 index 2671de4..0000000 --- a/entities/tickdataprovider_gen.go +++ /dev/null @@ -1,193 +0,0 @@ -package entities - -// Code generated by github.com/tinylib/msgp DO NOT EDIT. - -import ( - "github.com/daoleno/uniswap-sdk-core/msgpencode" - "github.com/tinylib/msgp/msgp" -) - -// DecodeMsg implements msgp.Decodable -func (z *Tick) DecodeMsg(dc *msgp.Reader) (err error) { - var zb0001 uint32 - zb0001, err = dc.ReadArrayHeader() - if err != nil { - err = msgp.WrapError(err) - return - } - if zb0001 != 3 { - err = msgp.ArrayError{Wanted: 3, Got: zb0001} - return - } - z.Index, err = dc.ReadInt() - if err != nil { - err = msgp.WrapError(err, "Index") - return - } - if dc.IsNil() { - err = dc.ReadNil() - if err != nil { - err = msgp.WrapError(err, "LiquidityGross") - return - } - z.LiquidityGross = nil - } else { - { - var zb0002 []byte - zb0002, err = dc.ReadBytes(msgpencode.EncodeInt(z.LiquidityGross)) - if err != nil { - err = msgp.WrapError(err, "LiquidityGross") - return - } - z.LiquidityGross = msgpencode.DecodeInt(zb0002) - } - } - if dc.IsNil() { - err = dc.ReadNil() - if err != nil { - err = msgp.WrapError(err, "LiquidityNet") - return - } - z.LiquidityNet = nil - } else { - { - var zb0003 []byte - zb0003, err = dc.ReadBytes(msgpencode.EncodeInt(z.LiquidityNet)) - if err != nil { - err = msgp.WrapError(err, "LiquidityNet") - return - } - z.LiquidityNet = msgpencode.DecodeInt(zb0003) - } - } - return -} - -// EncodeMsg implements msgp.Encodable -func (z *Tick) EncodeMsg(en *msgp.Writer) (err error) { - // array header, size 3 - err = en.Append(0x93) - if err != nil { - return - } - err = en.WriteInt(z.Index) - if err != nil { - err = msgp.WrapError(err, "Index") - return - } - if z.LiquidityGross == nil { - err = en.WriteNil() - if err != nil { - return - } - } else { - err = en.WriteBytes(msgpencode.EncodeInt(z.LiquidityGross)) - if err != nil { - err = msgp.WrapError(err, "LiquidityGross") - return - } - } - if z.LiquidityNet == nil { - err = en.WriteNil() - if err != nil { - return - } - } else { - err = en.WriteBytes(msgpencode.EncodeInt(z.LiquidityNet)) - if err != nil { - err = msgp.WrapError(err, "LiquidityNet") - return - } - } - return -} - -// MarshalMsg implements msgp.Marshaler -func (z *Tick) MarshalMsg(b []byte) (o []byte, err error) { - o = msgp.Require(b, z.Msgsize()) - // array header, size 3 - o = append(o, 0x93) - o = msgp.AppendInt(o, z.Index) - if z.LiquidityGross == nil { - o = msgp.AppendNil(o) - } else { - o = msgp.AppendBytes(o, msgpencode.EncodeInt(z.LiquidityGross)) - } - if z.LiquidityNet == nil { - o = msgp.AppendNil(o) - } else { - o = msgp.AppendBytes(o, msgpencode.EncodeInt(z.LiquidityNet)) - } - return -} - -// UnmarshalMsg implements msgp.Unmarshaler -func (z *Tick) UnmarshalMsg(bts []byte) (o []byte, err error) { - var zb0001 uint32 - zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) - if err != nil { - err = msgp.WrapError(err) - return - } - if zb0001 != 3 { - err = msgp.ArrayError{Wanted: 3, Got: zb0001} - return - } - z.Index, bts, err = msgp.ReadIntBytes(bts) - if err != nil { - err = msgp.WrapError(err, "Index") - return - } - if msgp.IsNil(bts) { - bts, err = msgp.ReadNilBytes(bts) - if err != nil { - return - } - z.LiquidityGross = nil - } else { - { - var zb0002 []byte - zb0002, bts, err = msgp.ReadBytesBytes(bts, msgpencode.EncodeInt(z.LiquidityGross)) - if err != nil { - err = msgp.WrapError(err, "LiquidityGross") - return - } - z.LiquidityGross = msgpencode.DecodeInt(zb0002) - } - } - if msgp.IsNil(bts) { - bts, err = msgp.ReadNilBytes(bts) - if err != nil { - return - } - z.LiquidityNet = nil - } else { - { - var zb0003 []byte - zb0003, bts, err = msgp.ReadBytesBytes(bts, msgpencode.EncodeInt(z.LiquidityNet)) - if err != nil { - err = msgp.WrapError(err, "LiquidityNet") - return - } - z.LiquidityNet = msgpencode.DecodeInt(zb0003) - } - } - o = bts - return -} - -// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message -func (z *Tick) Msgsize() (s int) { - s = 1 + msgp.IntSize - if z.LiquidityGross == nil { - s += msgp.NilSize - } else { - s += msgp.BytesPrefixSize + len(msgpencode.EncodeInt(z.LiquidityGross)) - } - if z.LiquidityNet == nil { - s += msgp.NilSize - } else { - s += msgp.BytesPrefixSize + len(msgpencode.EncodeInt(z.LiquidityNet)) - } - return -} diff --git a/entities/tickdataprovider_msgpencode.go b/entities/tickdataprovider_msgpencode.go deleted file mode 100644 index 31157b3..0000000 --- a/entities/tickdataprovider_msgpencode.go +++ /dev/null @@ -1,150 +0,0 @@ -package entities - -import ( - "fmt" - "reflect" - - "github.com/tinylib/msgp/msgp" -) - -var ( - // Mapping from string representation of a TickDataProvider concrete type to the concrete type itself. - // The string representation is used as type discriminator when encoding/decoding TickDataProvider. - tickDataProviderImplMap = map[string]reflect.Type{} -) - -// RegisterTickDataProviderImpl registers the concrete types of an TickDataProvider. -// This function is not thread-safe and should be only call in init(). -func RegisterTickDataProviderImpl(provider TickDataProvider) { - if _, ok := provider.(msgp.Encodable); !ok { - panic("expected provider to implement msgp.Encodable") - } - if _, ok := provider.(msgp.Decodable); !ok { - panic("expected provider to implement msgp.Decodable") - } - if _, ok := provider.(msgp.Marshaler); !ok { - panic("expected provider to implement msgp.Marshaler") - } - if _, ok := provider.(msgp.Unmarshaler); !ok { - panic("expected provider to implement msgp.Unmarshaler") - } - if _, ok := provider.(msgp.Sizer); !ok { - panic("expected provider to implement msgp.Sizer") - } - typ := reflect.ValueOf(provider).Elem().Type() - tickDataProviderImplMap[typ.String()] = typ -} - -// TickDataProviderWrapper is a wrapper of TickDataProvider and is implemented msgp.Encodable, msgp.Decodable, msgp.Marshaler, msgp.Unmarshaler, and msgp.Sizer -type TickDataProviderWrapper struct { - TickDataProvider -} - -func NewTickDataProviderWrapper(provider TickDataProvider) *TickDataProviderWrapper { - if provider == nil { - return nil - } - return &TickDataProviderWrapper{provider} -} - -// Get the inner TickDataProvider, return nil if TickDataProviderWrapper is nil -func (p *TickDataProviderWrapper) Get() TickDataProvider { - if p == nil { - return nil - } - return p.TickDataProvider -} - -// EncodeMsg implements msgp.Encodable -func (p *TickDataProviderWrapper) EncodeMsg(en *msgp.Writer) (err error) { - typ := reflect.ValueOf(p.TickDataProvider).Elem().Type() - err = en.WriteString(typ.String()) - if err != nil { - return - } - - if _, ok := tickDataProviderImplMap[typ.String()]; !ok { - err = fmt.Errorf("unregistered type %s", typ.String()) - return - } - - err = p.TickDataProvider.(msgp.Encodable).EncodeMsg(en) - if err != nil { - err = msgp.WrapError(err, "TickDataProvider") - return - } - return -} - -// DecodeMsg implements msgp.Decodable -func (p *TickDataProviderWrapper) DecodeMsg(dc *msgp.Reader) (err error) { - var typStr string - typStr, err = dc.ReadString() - if err != nil { - return - } - - typ, ok := tickDataProviderImplMap[typStr] - if !ok { - err = fmt.Errorf("unregistered type %s", typStr) - return - } - - providerVal := reflect.New(typ) - err = providerVal.Interface().(msgp.Decodable).DecodeMsg(dc) - if err != nil { - err = msgp.WrapError(err, "TickDataProviderMsgp") - return - } - p.TickDataProvider = providerVal.Interface().(TickDataProvider) - return -} - -// MarshalMsg implements msgp.Marshaler -func (p *TickDataProviderWrapper) MarshalMsg(b []byte) (o []byte, err error) { - o = msgp.Require(b, p.Msgsize()) - typ := reflect.ValueOf(p.TickDataProvider).Elem().Type() - o = msgp.AppendString(o, typ.String()) - - if _, ok := tickDataProviderImplMap[typ.String()]; !ok { - err = fmt.Errorf("unregistered type %s", typ.String()) - return - } - - o, err = p.TickDataProvider.(msgp.Marshaler).MarshalMsg(o) - if err != nil { - err = msgp.WrapError(err, "TickDataProvider") - return - } - return -} - -// UnmarshalMsg implements msgp.Unmarshaler -func (p *TickDataProviderWrapper) UnmarshalMsg(bts []byte) (o []byte, err error) { - var typStr string - typStr, bts, err = msgp.ReadStringBytes(bts) - if err != nil { - return - } - - typ, ok := tickDataProviderImplMap[typStr] - if !ok { - err = fmt.Errorf("unregistered type %s", typStr) - return - } - - providerVal := reflect.New(typ) - bts, err = providerVal.Interface().(msgp.Unmarshaler).UnmarshalMsg(bts) - if err != nil { - err = msgp.WrapError(err, "TickDataProvider") - return - } - p.TickDataProvider = providerVal.Interface().(TickDataProvider) - return -} - -// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message -func (p *TickDataProviderWrapper) Msgsize() int { - typ := reflect.ValueOf(p.TickDataProvider).Elem().Type() - return msgp.StringPrefixSize + len(typ.String()) + p.TickDataProvider.(msgp.Sizer).Msgsize() -} diff --git a/entities/ticklistdataprovider.go b/entities/ticklistdataprovider.go index e236ca3..e6e6429 100644 --- a/entities/ticklistdataprovider.go +++ b/entities/ticklistdataprovider.go @@ -1,12 +1,5 @@ -//go:generate go run github.com/tinylib/msgp -unexported -tests=false -v -//msgp:tuple TickListDataProvider - package entities -func init() { - RegisterTickDataProviderImpl(&TickListDataProvider{}) -} - // A data provider for ticks that is backed by an in-memory array of ticks. type TickListDataProvider struct { ticks []Tick diff --git a/entities/ticklistdataprovider_gen.go b/entities/ticklistdataprovider_gen.go deleted file mode 100644 index b3464b9..0000000 --- a/entities/ticklistdataprovider_gen.go +++ /dev/null @@ -1,121 +0,0 @@ -package entities - -// Code generated by github.com/tinylib/msgp DO NOT EDIT. - -import ( - "github.com/tinylib/msgp/msgp" -) - -// DecodeMsg implements msgp.Decodable -func (z *TickListDataProvider) DecodeMsg(dc *msgp.Reader) (err error) { - var zb0001 uint32 - zb0001, err = dc.ReadArrayHeader() - if err != nil { - err = msgp.WrapError(err) - return - } - if zb0001 != 1 { - err = msgp.ArrayError{Wanted: 1, Got: zb0001} - return - } - var zb0002 uint32 - zb0002, err = dc.ReadArrayHeader() - if err != nil { - err = msgp.WrapError(err, "ticks") - return - } - if cap(z.ticks) >= int(zb0002) { - z.ticks = (z.ticks)[:zb0002] - } else { - z.ticks = make([]Tick, zb0002) - } - for za0001 := range z.ticks { - err = z.ticks[za0001].DecodeMsg(dc) - if err != nil { - err = msgp.WrapError(err, "ticks", za0001) - return - } - } - return -} - -// EncodeMsg implements msgp.Encodable -func (z *TickListDataProvider) EncodeMsg(en *msgp.Writer) (err error) { - // array header, size 1 - err = en.Append(0x91) - if err != nil { - return - } - err = en.WriteArrayHeader(uint32(len(z.ticks))) - if err != nil { - err = msgp.WrapError(err, "ticks") - return - } - for za0001 := range z.ticks { - err = z.ticks[za0001].EncodeMsg(en) - if err != nil { - err = msgp.WrapError(err, "ticks", za0001) - return - } - } - return -} - -// MarshalMsg implements msgp.Marshaler -func (z *TickListDataProvider) MarshalMsg(b []byte) (o []byte, err error) { - o = msgp.Require(b, z.Msgsize()) - // array header, size 1 - o = append(o, 0x91) - o = msgp.AppendArrayHeader(o, uint32(len(z.ticks))) - for za0001 := range z.ticks { - o, err = z.ticks[za0001].MarshalMsg(o) - if err != nil { - err = msgp.WrapError(err, "ticks", za0001) - return - } - } - return -} - -// UnmarshalMsg implements msgp.Unmarshaler -func (z *TickListDataProvider) UnmarshalMsg(bts []byte) (o []byte, err error) { - var zb0001 uint32 - zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts) - if err != nil { - err = msgp.WrapError(err) - return - } - if zb0001 != 1 { - err = msgp.ArrayError{Wanted: 1, Got: zb0001} - return - } - var zb0002 uint32 - zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts) - if err != nil { - err = msgp.WrapError(err, "ticks") - return - } - if cap(z.ticks) >= int(zb0002) { - z.ticks = (z.ticks)[:zb0002] - } else { - z.ticks = make([]Tick, zb0002) - } - for za0001 := range z.ticks { - bts, err = z.ticks[za0001].UnmarshalMsg(bts) - if err != nil { - err = msgp.WrapError(err, "ticks", za0001) - return - } - } - o = bts - return -} - -// Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message -func (z *TickListDataProvider) Msgsize() (s int) { - s = 1 + msgp.ArrayHeaderSize - for za0001 := range z.ticks { - s += z.ticks[za0001].Msgsize() - } - return -} diff --git a/go.mod b/go.mod index c47a7ee..dc5bacf 100644 --- a/go.mod +++ b/go.mod @@ -2,18 +2,14 @@ module github.com/KyberNetwork/uniswapv3-sdk go 1.18 -replace ( - github.com/daoleno/uniswap-sdk-core v0.1.5 => github.com/KyberNetwork/uniswap-sdk-core v0.1.9 - github.com/daoleno/uniswapv3-sdk v0.4.0 => github.com/KyberNetwork/uniswapv3-sdk v0.4.0 -) +replace github.com/daoleno/uniswapv3-sdk v0.4.0 => github.com/KyberNetwork/uniswapv3-sdk v0.4.0 require ( github.com/daoleno/uniswap-sdk-core v0.1.5 github.com/daoleno/uniswapv3-sdk v0.4.0 - github.com/ethereum/go-ethereum v1.10.21 + github.com/ethereum/go-ethereum v1.10.20 github.com/shopspring/decimal v1.3.1 github.com/stretchr/testify v1.8.0 - github.com/tinylib/msgp v1.1.9 ) require ( @@ -25,8 +21,6 @@ require ( github.com/go-stack/stack v1.8.1 // indirect github.com/google/uuid v1.3.0 // indirect github.com/gorilla/websocket v1.5.0 // indirect - github.com/kr/pretty v0.3.1 // indirect - github.com/philhofer/fwd v1.1.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rjeczalik/notify v0.9.2 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect @@ -34,10 +28,7 @@ require ( github.com/tklauser/numcpus v0.5.0 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d // indirect - golang.org/x/mod v0.13.0 // indirect - golang.org/x/sync v0.4.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/tools v0.14.0 // indirect + golang.org/x/sys v0.0.0-20220702020025-31831981b65f // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 4309209..fba3742 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,3 @@ -github.com/KyberNetwork/uniswap-sdk-core v0.1.9 h1:04GqfoYM1vTk55HGlIZfVJ3Wo1W8lsAelW6L+qkfv6c= -github.com/KyberNetwork/uniswap-sdk-core v0.1.9/go.mod h1:ih9PJ/qgEbc1VbWOWWPeiH02a+inIBm2+XNtZmONcyY= github.com/KyberNetwork/uniswapv3-sdk v0.4.0 h1:hbTeJBFgFqYqYTduGuEnb4JIvCtcmuvBTFuRARJIa1Y= github.com/KyberNetwork/uniswapv3-sdk v0.4.0/go.mod h1:K+cqy6zkitxxfShghmuoVwjGJWO16FTXAV+dvddXtgw= github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c3fqvvgKm5o= @@ -9,7 +7,8 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOF github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/daoleno/uniswap-sdk-core v0.1.5 h1:VlU6NXnJBJ75D3GmX01CGIEMoiizXlu9v+jSEj26lhM= +github.com/daoleno/uniswap-sdk-core v0.1.5/go.mod h1:OV1Kvws5JShxPz3qFpjpkuZB4gdebRpqm/AcYMZ7TZQ= 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= @@ -20,8 +19,8 @@ github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= github.com/edsrzf/mmap-go v1.0.0 h1:CEBF7HpRnUCSJgGUb5h1Gm7e3VkmVDrR8lvWVLtrOFw= -github.com/ethereum/go-ethereum v1.10.21 h1:5lqsEx92ZaZzRyOqBEXux4/UR06m296RGzN3ol3teJY= -github.com/ethereum/go-ethereum v1.10.21/go.mod h1:EYFyF19u3ezGLD4RqOkLq+ZCXzYbLoNDdZlMt7kyKFg= +github.com/ethereum/go-ethereum v1.10.20 h1:75IW830ClSS40yrQC1ZCMZCt5I+zU16oqId2SiQwdQ4= +github.com/ethereum/go-ethereum v1.10.20/go.mod h1:LWUN82TCHGpxB3En5HVmLLzPD7YSrEUFmFfN1nKkVN0= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= @@ -40,27 +39,18 @@ github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZ github.com/holiman/uint256 v1.2.0 h1:gpSYcPLWGv4sG43I2mVLiDZCNDh/EpGjSk8tmtxitHM= github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= -github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= -github.com/philhofer/fwd v1.1.2 h1:bnDivRJ1EWPjUIRXV5KfORO897HTbpFAQddBdE8t7Gw= -github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2tUTP0= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 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/tsdb v0.7.1 h1:YZcsG11NqnK4czYLrWd9mpEuAJIHVQLwdrleYfszMAA= github.com/rjeczalik/notify v0.9.2 h1:MiTWrPj55mNDHEiIX5YUSKefw/+lCQVoAFmD6oQm5w8= github.com/rjeczalik/notify v0.9.2/go.mod h1:aErll2f0sUX9PXZnVNyeiObbmTlk5jnMoCa4QEjJeqM= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= -github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI= @@ -73,9 +63,7 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= -github.com/tinylib/msgp v1.1.9 h1:SHf3yoO2sGA0veCJeCBYLHuttAVFHGm2RHgNodW7wQU= -github.com/tinylib/msgp v1.1.9/go.mod h1:BCXGB54lDD8qUEPmiG0cQQUANC4IUQyB2ItS2UDlO/k= +github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5fl+nylMaIr9PVV1w343YRDtsy+Rwu7XI= github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw= github.com/tklauser/go-sysconf v0.3.10/go.mod h1:C8XykCvCb+Gn0oNCWPIlcb0RuglQTYaQ2hGm7jmxEFk= github.com/tklauser/numcpus v0.4.0/go.mod h1:1+UI3pD8NW14VMwdgJNJ1ESk2UnwhAnz5hMwiKKqXCQ= @@ -88,22 +76,17 @@ github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPR github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= -golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sys v0.0.0-20180926160741-c2ed4eda69e7/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220702020025-31831981b65f h1:xdsejrW/0Wf2diT5CPp3XmKUNbr7Xvw8kYilQ+6qjRY= +golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba h1:O8mE0/t419eoIwhTFpKVkHiTs/Igowgfkj25AcZrtiE= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= +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-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU= gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=