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:
Adrian Gallagher
2021-10-14 16:38:53 +11:00
committed by GitHub
parent 0a91af0f2e
commit f0d45aa1d2
194 changed files with 1506 additions and 1233 deletions

View File

@@ -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
}

View File

@@ -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)
}
}

View File

@@ -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