CI/build: Update Go version, linters and fix minor issues (#1473)

* CI/build: Update Go version, linters and fix minor issues

* Bump golangci-lint to v1.56.1

* BinanceUS: Make uint usage consistent

* Throw blank identifiers into the trash
This commit is contained in:
Adrian Gallagher
2024-02-14 11:02:06 +11:00
committed by GitHub
parent 9ff502bac2
commit 08da42ddb7
79 changed files with 364 additions and 374 deletions

View File

@@ -2275,7 +2275,7 @@ func (g *Gateio) UpdatePositionMarginInDualMode(ctx context.Context, settle stri
params := url.Values{}
params.Set("change", strconv.FormatFloat(change, 'f', -1, 64))
if dualSide != "dual_long" && dualSide != "dual_short" {
return nil, fmt.Errorf("invalid 'dual_side' should be 'dual_short' or 'dual_long'")
return nil, errors.New("invalid 'dual_side' should be 'dual_short' or 'dual_long'")
}
params.Set("dual_side", dualSide)
var response []Position
@@ -3204,13 +3204,13 @@ func (g *Gateio) GetDeliveryPriceTriggeredOrder(ctx context.Context, settle stri
return nil, fmt.Errorf("%w, only time in force value 'gtc' and 'ioc' are supported", errInvalidTimeInForce)
}
if arg.Trigger.StrategyType != 0 && arg.Trigger.StrategyType != 1 {
return nil, fmt.Errorf("strategy type must be 0 or 1, 0: by price, and 1: by price gap")
return nil, errors.New("strategy type must be 0 or 1, 0: by price, and 1: by price gap")
}
if arg.Trigger.Rule != 1 && arg.Trigger.Rule != 2 {
return nil, fmt.Errorf("invalid trigger condition('rule') value, rule must be 1 or 2")
return nil, errors.New("invalid trigger condition('rule') value, rule must be 1 or 2")
}
if arg.Trigger.PriceType != 0 && arg.Trigger.PriceType != 1 && arg.Trigger.PriceType != 2 {
return nil, fmt.Errorf("price type must be 0 or 1 or 2")
return nil, errors.New("price type must be 0 or 1 or 2")
}
if arg.Trigger.Price <= 0 {
return nil, errors.New("invalid argument: trigger.price")
@@ -3482,7 +3482,7 @@ func (g *Gateio) GetUsersLiquidationHistoryForSpecifiedUnderlying(ctx context.Co
}
// PlaceOptionOrder creates an options order
func (g *Gateio) PlaceOptionOrder(ctx context.Context, arg OptionOrderParam) (*OptionOrderResponse, error) {
func (g *Gateio) PlaceOptionOrder(ctx context.Context, arg *OptionOrderParam) (*OptionOrderResponse, error) {
if arg.Contract == "" {
return nil, errInvalidOrMissingContractParam
}

View File

@@ -1858,7 +1858,7 @@ func TestGetUsersLiquidationHistoryForSpecifiedUnderlying(t *testing.T) {
func TestPlaceOptionOrder(t *testing.T) {
t.Parallel()
sharedtestvalues.SkipTestIfCredentialsUnset(t, g, canManipulateRealOrders)
_, err := g.PlaceOptionOrder(context.Background(), OptionOrderParam{
_, err := g.PlaceOptionOrder(context.Background(), &OptionOrderParam{
Contract: getPair(t, asset.Options).String(),
OrderSize: -1,
Iceberg: 0,

View File

@@ -1938,7 +1938,7 @@ type SettlementHistoryItem struct {
// SubAccountParams represents subaccount creation parameters
type SubAccountParams struct {
LoginName string `json:"login_name,"`
LoginName string `json:"login_name"`
Remark string `json:"remark,omitempty"`
Email string `json:"email,omitempty"` // The sub-account's password.
Password string `json:"password,omitempty"` // The sub-account's email address.

View File

@@ -1130,7 +1130,7 @@ func (g *Gateio) SubmitOrder(ctx context.Context, s *order.Submit) (*order.Submi
response.Price = newOrder.OrderPrice.Float64()
return response, nil
case asset.Options:
optionOrder, err := g.PlaceOptionOrder(ctx, OptionOrderParam{
optionOrder, err := g.PlaceOptionOrder(ctx, &OptionOrderParam{
Contract: s.Pair.String(),
OrderSize: s.Amount,
Price: types.Number(s.Price),