mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-06-07 23:16:53 +00:00
golangci-lint/CI: Bump versions and introduce new linters (#798)
* golangci-lint/CI: Bump versions
Fix remaining linter issues
* Specifically set AppVeyor version
* Fix the infamous typos 👀
* Add go env cmd to AppVeyor
* Add go version cmd to AppVeyor
* Specify AppVeyor image, adjust linters
* Update go get to go install due to deprecation
* Bump golangci-lint timeout time for AppVeyor
* Change NW contract to NQ
* Address nitters
* GetRandomPair -> Pair{}
* Address nits
* Address time nitterinos plus additional tweaks
* More time inception upgrades!
* Bending time and space
This commit is contained in:
@@ -438,8 +438,7 @@ func (i *instrumentMap) Seed(curr string, id int64) {
|
||||
}
|
||||
|
||||
// check to see if the instrument already exists
|
||||
_, ok := i.Instruments[curr]
|
||||
if ok {
|
||||
if _, ok := i.Instruments[curr]; ok {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ func TestMain(m *testing.M) {
|
||||
}
|
||||
|
||||
func setupWSTestAuth(t *testing.T) {
|
||||
t.Helper()
|
||||
if wsSetupRan {
|
||||
return
|
||||
}
|
||||
@@ -430,8 +431,7 @@ func TestGetDepositAddress(t *testing.T) {
|
||||
// TestWsAuthGetAccountBalance dials websocket, retrieves account balance
|
||||
func TestWsAuthGetAccountBalance(t *testing.T) {
|
||||
setupWSTestAuth(t)
|
||||
_, err := c.wsGetAccountBalance()
|
||||
if err != nil {
|
||||
if _, err := c.wsGetAccountBalance(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
@@ -449,8 +449,7 @@ func TestWsAuthSubmitOrder(t *testing.T) {
|
||||
Price: 1,
|
||||
Side: order.Buy,
|
||||
}
|
||||
_, err := c.wsSubmitOrder(&ord)
|
||||
if err != nil {
|
||||
if _, err := c.wsSubmitOrder(&ord); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -630,18 +630,31 @@ func (c *COINUT) SubmitOrder(ctx context.Context, o *order.Submit) (order.Submit
|
||||
if err != nil {
|
||||
return submitOrderResponse, err
|
||||
}
|
||||
responseMap := APIResponse.(map[string]interface{})
|
||||
switch responseMap["reply"].(string) {
|
||||
responseMap, ok := APIResponse.(map[string]interface{})
|
||||
if !ok {
|
||||
return submitOrderResponse, errors.New("unable to type assert responseMap")
|
||||
}
|
||||
orderType, ok := responseMap["reply"].(string)
|
||||
if !ok {
|
||||
return submitOrderResponse, errors.New("unable to type assert orderType")
|
||||
}
|
||||
switch orderType {
|
||||
case "order_rejected":
|
||||
return submitOrderResponse, fmt.Errorf("clientOrderID: %v was rejected: %v", o.ClientID, responseMap["reasons"])
|
||||
case "order_filled":
|
||||
orderID := responseMap["order_id"].(float64)
|
||||
orderID, ok := responseMap["order_id"].(float64)
|
||||
if !ok {
|
||||
return submitOrderResponse, errors.New("unable to type assert orderID")
|
||||
}
|
||||
submitOrderResponse.OrderID = strconv.FormatFloat(orderID, 'f', -1, 64)
|
||||
submitOrderResponse.IsOrderPlaced = true
|
||||
submitOrderResponse.FullyMatched = true
|
||||
return submitOrderResponse, nil
|
||||
case "order_accepted":
|
||||
orderID := responseMap["order_id"].(float64)
|
||||
orderID, ok := responseMap["order_id"].(float64)
|
||||
if !ok {
|
||||
return submitOrderResponse, errors.New("unable to type assert orderID")
|
||||
}
|
||||
submitOrderResponse.OrderID = strconv.FormatFloat(orderID, 'f', -1, 64)
|
||||
submitOrderResponse.IsOrderPlaced = true
|
||||
return submitOrderResponse, nil
|
||||
|
||||
Reference in New Issue
Block a user