Skip to content

Commit

Permalink
fix: adapt to linter (#152)
Browse files Browse the repository at this point in the history
* chore: use revive

* adapt to linter

* disable if-return
  • Loading branch information
hirokisan authored Dec 16, 2023
1 parent cd1d3fe commit 785d449
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 20 deletions.
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
run:
skip-dirs:
- sandbox
linters-settings:
revive:
rules:
- name: if-return
severity: warning
disabled: true
linters:
enable:
- errcheck
- staticcheck
- govet
- unused
- gosimple
- revive
14 changes: 7 additions & 7 deletions spot_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,12 +466,12 @@ type SpotGetOrderResponse struct {

// SpotGetOrderResult :
type SpotGetOrderResult struct {
AccountId string `json:"accountId"`
ExchangeId string `json:"exchangeId"`
AccountID string `json:"accountId"`
ExchangeID string `json:"exchangeId"`
Symbol string `json:"symbol"`
SymbolName string `json:"symbolName"`
OrderLinkId string `json:"orderLinkId"`
OrderId string `json:"orderId"`
OrderLinkID string `json:"orderLinkId"`
OrderID string `json:"orderId"`
Price string `json:"price"`
OrigQty string `json:"origQty"`
ExecutedQty string `json:"executedQty"`
Expand Down Expand Up @@ -518,11 +518,11 @@ type SpotDeleteOrderResponse struct {

// SpotDeleteOrderResult :
type SpotDeleteOrderResult struct {
OrderId string `json:"orderId"`
OrderLinkId string `json:"orderLinkId"`
OrderID string `json:"orderId"`
OrderLinkID string `json:"orderLinkId"`
Symbol string `json:"symbol"`
Status string `json:"status"`
AccountId string `json:"accountId"`
AccountID string `json:"accountId"`
TransactTime string `json:"transactTime"`
Price string `json:"price"`
OrigQty string `json:"origQty"`
Expand Down
6 changes: 3 additions & 3 deletions v5_asset_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ type V5GetWithdrawalRecordsRows []V5GetWithdrawalRecordsRow

// V5GetWithdrawalRecordsRow :
type V5GetWithdrawalRecordsRow struct {
WithdrawId string `json:"withdrawId"`
WithdrawID string `json:"withdrawId"`
TxID string `json:"txId"`
WithdrawType WithdrawTypeV5 `json:"withdrawType"`
Coin Coin `json:"coin"`
Expand Down Expand Up @@ -361,7 +361,7 @@ func (s *V5AssetService) GetCoinInfo(param V5GetCoinInfoParam) (*V5GetCoinInfoRe
// V5GetAllCoinsBalanceParam :
type V5GetAllCoinsBalanceParam struct {
AccountType AccountType `url:"accountType"`
MemberId string `url:"memberId,omitempty"`
MemberID string `url:"memberId,omitempty"`
WithBonus string `url:"withBonus,omitempty"`
Coins []Coin
}
Expand All @@ -374,7 +374,7 @@ type V5GetAllCoinsBalanceResponse struct {

// V5GetAllCoinsBalanceResult :
type V5GetAllCoinsBalanceResult struct {
MemberId string `json:"memberId"`
MemberID string `json:"memberId"`
AccountType AccountType `json:"accountType"`
Balance []*V5GetAllCoinsBalanceBalance `json:"balance"`
}
Expand Down
8 changes: 4 additions & 4 deletions v5_execution_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ type V5GetExecutionParam struct {
Category CategoryV5 `url:"category"`

Symbol *SymbolV5 `url:"symbol,omitempty"`
OrderId *string `url:"orderId,omitempty"`
OrderLinkId *string `url:"orderLinkId,omitempty"`
OrderID *string `url:"orderId,omitempty"`
OrderLinkID *string `url:"orderLinkId,omitempty"`
BaseCoin *Coin `url:"baseCoin,omitempty"`
StartTime *int `url:"startTime,omitempty"`
EndTime *int `url:"endTime,omitempty"`
Expand All @@ -44,7 +44,7 @@ type V5GetExecutionListResult struct {
type V5GetExecutionListItem struct {
Symbol SymbolV5 `json:"symbol"`
OrderID string `json:"orderId"`
OrderLinkId string `json:"orderLinkId"`
OrderLinkID string `json:"orderLinkId"`
Side Side `json:"side"`
OrderPrice string `json:"orderPrice"`
OrderQty string `json:"orderQty"`
Expand All @@ -65,7 +65,7 @@ type V5GetExecutionListItem struct {
MarkPrice string `json:"markPrice"`
IndexPrice string `json:"indexPrice"`
UnderlyingPrice string `json:"underlyingPrice"`
BlockTradeId string `json:"blockTradeId"`
BlockTradeID string `json:"blockTradeId"`
ClosedSize string `json:"closedSize"`
}

Expand Down
12 changes: 6 additions & 6 deletions v5_order_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,19 +160,19 @@ func TestV5Order_AmendOrder(t *testing.T) {

func TestV5Order_CancelOrder(t *testing.T) {
t.Run("success", func(t *testing.T) {
orderId := "1358868270414852352"
orderID := "1358868270414852352"
param := V5CancelOrderParam{
Category: CategoryV5Spot,
Symbol: SymbolV5BTCUSDT,
OrderID: &orderId,
OrderID: &orderID,
}

path := "/v5/order/cancel"
method := http.MethodPost
status := http.StatusOK
respBody := map[string]interface{}{
"result": map[string]interface{}{
"orderId": orderId,
"orderId": orderID,
"orderLinkId": "1676725721103693",
},
}
Expand All @@ -195,19 +195,19 @@ func TestV5Order_CancelOrder(t *testing.T) {
testhelper.Compare(t, respBody["result"], resp.Result)
})
t.Run("authentication required", func(t *testing.T) {
orderId := "1358868270414852352"
orderID := "1358868270414852352"
param := V5CancelOrderParam{
Category: CategoryV5Spot,
Symbol: SymbolV5BTCUSDT,
OrderID: &orderId,
OrderID: &orderID,
}

path := "/v5/order/cancel"
method := http.MethodPost
status := http.StatusOK
respBody := map[string]interface{}{
"result": map[string]interface{}{
"orderId": orderId,
"orderId": orderID,
"orderLinkId": "1676725721103693",
},
}
Expand Down

0 comments on commit 785d449

Please sign in to comment.