From a387a5bcaabc67713bc71e762259f4d095cd60ea Mon Sep 17 00:00:00 2001 From: ddxyq <657023321@qq.com> Date: Wed, 26 Jun 2024 21:48:04 +0800 Subject: [PATCH] fix current existly typos (#582) --- .github/workflows/check.yml | 8 ++++++++ README.md | 4 ++-- typos.toml | 27 +++++++++++++++++++++++++++ v2/client.go | 6 +++--- v2/delivery/account_service.go | 2 +- v2/delivery/account_service_test.go | 2 +- v2/delivery/client.go | 2 +- v2/dust_log_service.go | 4 ++-- v2/futures/client.go | 2 +- v2/futures/websocket_service.go | 8 ++++---- v2/futures/websocket_service_test.go | 4 ++-- v2/liquidity_pool_service.go | 4 ++-- v2/options/client.go | 2 +- v2/options/order_service.go | 4 ++-- v2/websocket_service.go | 4 ++-- 15 files changed, 59 insertions(+), 24 deletions(-) create mode 100644 typos.toml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index a42774ee..d5837d7e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -10,6 +10,14 @@ on: workflow_dispatch: jobs: + TyposCheck: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: crate-ci/typos@v1.22.7 + with: + config: ./typos.toml + UnitTest: runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index 08907fab..cd4d6049 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,10 @@ Name | Description | Status [margin-api.md](https://binance-docs.github.io/apidocs/spot/en) | Details on the Margin API (/sapi) | Implemented [futures-api.md](https://binance-docs.github.io/apidocs/futures/en/#general-info) | Details on the Futures API (/fapi) | Implemented [delivery-api.md](https://binance-docs.github.io/apidocs/delivery/en/#general-info) | Details on the Coin-M Futures API (/dapi) | Implemented -[options-api.md](https://binance-docs.github.io/apidocs/voptions/en/#general-info) | Detains on the Options API(/eapi) | Implemented +[options-api.md](https://binance-docs.github.io/apidocs/voptions/en/#general-info) | Details on the Options API(/eapi) | Implemented -If you find an unimplemented interface, please submit an issue. +If you find an unimplemented interface, please submit an issue. It's great if you can open a PR to fix it. ### Installation diff --git a/typos.toml b/typos.toml new file mode 100644 index 00000000..48f82676 --- /dev/null +++ b/typos.toml @@ -0,0 +1,27 @@ +[files] +ignore-files = true +ignore-hidden = false +extend-exclude = [ + ".git/", + "v2/go.mod", + "v2/go.sum", + "v2/go.work.sum", +] + + +[default] +extend-ignore-re=[ + "ios_54d9b18d8e7a4caf9d149573e16480ba", + "Pn", + "SIZ9", + "alo", + "ot", + "[Cc]ummulative", + "OTU", + "[Tt]ransfered", +] +check-filename = true + + + + diff --git a/v2/client.go b/v2/client.go index bca6ff5d..694b992a 100644 --- a/v2/client.go +++ b/v2/client.go @@ -479,7 +479,7 @@ func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption) } defer func() { cerr := res.Body.Close() - // Only overwrite the retured error if the original error was nil and an + // Only overwrite the returned error if the original error was nil and an // error occurred while closing the body. if err == nil && cerr != nil { err = cerr @@ -1008,7 +1008,7 @@ func (c *Client) NewGetAllLiquidityPoolService() *GetAllLiquidityPoolService { return &GetAllLiquidityPoolService{c: c} } -// NewGetLiquidityPoolDetailService init the get liquidity pool detial service +// NewGetLiquidityPoolDetailService init the get liquidity pool detail service func (c *Client) NewGetLiquidityPoolDetailService() *GetLiquidityPoolDetailService { return &GetLiquidityPoolDetailService{c: c} } @@ -1043,7 +1043,7 @@ func (c *Client) NewClaimRewardService() *ClaimRewardService { return &ClaimRewardService{c: c} } -// NewRemoveLiquidityService init the service to remvoe liquidity +// NewRemoveLiquidityService init the service to remove liquidity func (c *Client) NewRemoveLiquidityService() *RemoveLiquidityService { return &RemoveLiquidityService{c: c, assets: []string{}} } diff --git a/v2/delivery/account_service.go b/v2/delivery/account_service.go index ee6fe57d..7766fb38 100644 --- a/v2/delivery/account_service.go +++ b/v2/delivery/account_service.go @@ -93,7 +93,7 @@ type AccountAsset struct { AvailableBalance string `json:"availableBalance"` } -// AccountPosition define accoutn position +// AccountPosition define account position type AccountPosition struct { Symbol string `json:"symbol"` PositionAmt string `json:"positionAmt"` diff --git a/v2/delivery/account_service_test.go b/v2/delivery/account_service_test.go index 4e60aadd..c1110648 100644 --- a/v2/delivery/account_service_test.go +++ b/v2/delivery/account_service_test.go @@ -228,7 +228,7 @@ func (s *accountServiceTestSuite) assertAccountEqual(e, a *Account) { r.Equal(e.Assets[i].MarginBalance, a.Assets[i].MarginBalance, "MarginBalance") r.Equal(e.Assets[i].MaxWithdrawAmount, a.Assets[i].MaxWithdrawAmount, "MaxWithdrawAmount") r.Equal(e.Assets[i].OpenOrderInitialMargin, a.Assets[i].OpenOrderInitialMargin, "OpenOrderInitialMargin") - r.Equal(e.Assets[i].PositionInitialMargin, e.Assets[i].PositionInitialMargin, "PossitionInitialMargin") + r.Equal(e.Assets[i].PositionInitialMargin, e.Assets[i].PositionInitialMargin, "PositionInitialMargin") r.Equal(e.Assets[i].UnrealizedProfit, a.Assets[i].UnrealizedProfit, "UnrealizedProfit") r.Equal(e.Assets[i].WalletBalance, a.Assets[i].WalletBalance, "WalletBalance") } diff --git a/v2/delivery/client.go b/v2/delivery/client.go index 883571ba..bef831a4 100644 --- a/v2/delivery/client.go +++ b/v2/delivery/client.go @@ -331,7 +331,7 @@ func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption) } defer func() { cerr := res.Body.Close() - // Only overwrite the retured error if the original error was nil and an + // Only overwrite the returned error if the original error was nil and an // error occurred while closing the body. if err == nil && cerr != nil { err = cerr diff --git a/v2/dust_log_service.go b/v2/dust_log_service.go index d84a9f64..8051b472 100644 --- a/v2/dust_log_service.go +++ b/v2/dust_log_service.go @@ -70,13 +70,13 @@ type DustResult struct { // UserAssetDribblet represents one dust log row type UserAssetDribblet struct { OperateTime int64 `json:"operateTime"` - TotalTransferedAmount string `json:"totalTransferedAmount"` //Total transfered BNB amount for this exchange. + TotalTransferedAmount string `json:"totalTransferedAmount"` //Total transferred BNB amount for this exchange. TotalServiceChargeAmount string `json:"totalServiceChargeAmount"` //Total service charge amount for this exchange. TransID int64 `json:"transId"` UserAssetDribbletDetails []UserAssetDribbletDetail `json:"userAssetDribbletDetails"` //Details of this exchange. } -// DustLog represents one dust log informations +// DustLog represents one dust log information type UserAssetDribbletDetail struct { TransID int `json:"transId"` ServiceChargeAmount string `json:"serviceChargeAmount"` diff --git a/v2/futures/client.go b/v2/futures/client.go index 14a707a3..dfac8358 100644 --- a/v2/futures/client.go +++ b/v2/futures/client.go @@ -346,7 +346,7 @@ func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption) } defer func() { cerr := res.Body.Close() - // Only overwrite the retured error if the original error was nil and an + // Only overwrite the returned error if the original error was nil and an // error occurred while closing the body. if err == nil && cerr != nil { err = cerr diff --git a/v2/futures/websocket_service.go b/v2/futures/websocket_service.go index 2b88a44e..bb276fda 100644 --- a/v2/futures/websocket_service.go +++ b/v2/futures/websocket_service.go @@ -381,8 +381,8 @@ type WsContinuousKline struct { ActiveBuyQuoteVolume string `json:"Q"` } -// WsContinuousKlineSubcribeArgs used with WsContinuousKlineServe or WsCombinedContinuousKlineServe -type WsContinuousKlineSubcribeArgs struct { +// WsContinuousKlineSubscribeArgs used with WsContinuousKlineServe or WsCombinedContinuousKlineServe +type WsContinuousKlineSubscribeArgs struct { Pair string ContractType string Interval string @@ -392,7 +392,7 @@ type WsContinuousKlineSubcribeArgs struct { type WsContinuousKlineHandler func(event *WsContinuousKlineEvent) // WsContinuousKlineServe serve websocket continuous kline handler with a pair and contractType and interval like 15m, 30s -func WsContinuousKlineServe(subscribeArgs *WsContinuousKlineSubcribeArgs, handler WsContinuousKlineHandler, +func WsContinuousKlineServe(subscribeArgs *WsContinuousKlineSubscribeArgs, handler WsContinuousKlineHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error) { endpoint := fmt.Sprintf("%s/%s_%s@continuousKline_%s", getWsEndpoint(), strings.ToLower(subscribeArgs.Pair), strings.ToLower(subscribeArgs.ContractType), subscribeArgs.Interval) @@ -410,7 +410,7 @@ func WsContinuousKlineServe(subscribeArgs *WsContinuousKlineSubcribeArgs, handle } // WsCombinedContinuousKlineServe is similar to WsContinuousKlineServe, but it handles multiple pairs of different contractType with its interval -func WsCombinedContinuousKlineServe(subscribeArgsList []*WsContinuousKlineSubcribeArgs, +func WsCombinedContinuousKlineServe(subscribeArgsList []*WsContinuousKlineSubscribeArgs, handler WsContinuousKlineHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error) { endpoint := getCombinedEndpoint() for _, val := range subscribeArgsList { diff --git a/v2/futures/websocket_service_test.go b/v2/futures/websocket_service_test.go index cb77b7bc..23364c1e 100644 --- a/v2/futures/websocket_service_test.go +++ b/v2/futures/websocket_service_test.go @@ -575,7 +575,7 @@ func (s *websocketServiceTestSuite) TestContinuousKlineServe() { s.mockWsServe(data, errors.New(fakeErrMsg)) defer s.assertWsServe() - doneC, stopC, err := WsContinuousKlineServe(&WsContinuousKlineSubcribeArgs{ + doneC, stopC, err := WsContinuousKlineServe(&WsContinuousKlineSubscribeArgs{ Pair: "BTCUSDT", ContractType: "PERPETUAL", Interval: "1m", @@ -668,7 +668,7 @@ func (s *websocketServiceTestSuite) TestWsCombinedContinuousKlineServe() { s.mockWsServe(data, errors.New(fakeErrMsg)) defer s.assertWsServe() - input := []*WsContinuousKlineSubcribeArgs{ + input := []*WsContinuousKlineSubscribeArgs{ { Pair: "ETHBTC", ContractType: "PERPETUAL", diff --git a/v2/liquidity_pool_service.go b/v2/liquidity_pool_service.go index 1ee6de78..7109c743 100644 --- a/v2/liquidity_pool_service.go +++ b/v2/liquidity_pool_service.go @@ -294,13 +294,13 @@ func (s *GetUserSwapRecordsService) SwapId(swapId int64) *GetUserSwapRecordsServ return s } -// StartTime set start time when swaping +// StartTime set start time when swapping func (s *GetUserSwapRecordsService) StartTime(startTime int64) *GetUserSwapRecordsService { s.startTime = &startTime return s } -// EndTime set end time when swaping +// EndTime set end time when swapping func (s *GetUserSwapRecordsService) EndTime(endTime int64) *GetUserSwapRecordsService { s.endTime = &endTime return s diff --git a/v2/options/client.go b/v2/options/client.go index cee420ec..fe2ebda5 100644 --- a/v2/options/client.go +++ b/v2/options/client.go @@ -349,7 +349,7 @@ func (c *Client) callAPI(ctx context.Context, r *request, opts ...RequestOption) } defer func() { cerr := res.Body.Close() - // Only overwrite the retured error if the original error was nil and an + // Only overwrite the returned error if the original error was nil and an // error occurred while closing the body. if err == nil && cerr != nil { err = cerr diff --git a/v2/options/order_service.go b/v2/options/order_service.go index 5ed1e642..0ef1786f 100644 --- a/v2/options/order_service.go +++ b/v2/options/order_service.go @@ -179,7 +179,7 @@ type Order struct { CreateTime int64 `json:"createTime"` UpdateTime int64 `json:"updateTime"` Status OrderStatusType `json:"status"` - Reason *string `json:"reason"` // setted while query histroy orders. + Reason *string `json:"reason"` // set while query history orders. AvgPrice string `json:"avgPrice"` Source string `json:"source"` ClientOrderId string `json:"clientOrderId"` @@ -188,7 +188,7 @@ type Order struct { OptionSide OptionSideType `json:"optionSide"` QuoteAsset string `json:"quoteAsset"` Mmp bool `json:"mmp"` - LastTrade *LastTrade `json:"lastTrade"` // order is immediately filled while calling create order, it will be setted. + LastTrade *LastTrade `json:"lastTrade"` // order is immediately filled while calling create order, it will be set. RateLimitOrder10s string `json:"rateLimitOrder10s,omitempty"` RateLimitOrder1m string `json:"rateLimitOrder1m,omitempty"` diff --git a/v2/websocket_service.go b/v2/websocket_service.go index a98552f8..ed31481e 100644 --- a/v2/websocket_service.go +++ b/v2/websocket_service.go @@ -422,7 +422,7 @@ type WsAggTradeEvent struct { LastBreakdownTradeID int64 `json:"l"` TradeTime int64 `json:"T"` IsBuyerMaker bool `json:"m"` - Placeholder bool `json:"M"` // add this field to avoid case insensitive unmarshaling + Placeholder bool `json:"M"` // add this field to avoid case insensitive unmarshalling } // WsTradeHandler handle websocket trade event @@ -476,7 +476,7 @@ type WsTradeEvent struct { SellerOrderID int64 `json:"a"` TradeTime int64 `json:"T"` IsBuyerMaker bool `json:"m"` - Placeholder bool `json:"M"` // add this field to avoid case insensitive unmarshaling + Placeholder bool `json:"M"` // add this field to avoid case insensitive unmarshalling } type WsCombinedTradeEvent struct {