mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
Bump golangci-lint to v1.24.0, linter fixes and general code improvements (#478)
* Bump golangci-lint version, update Go version deps and generic code improvements * Fix wesbocket resp nil check and zip closures * Update pprof path
This commit is contained in:
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
dbConn *database.Db
|
||||
dbConn *database.Instance
|
||||
)
|
||||
|
||||
type databaseManager struct {
|
||||
|
||||
@@ -24,8 +24,9 @@ var (
|
||||
// should not be exported as it can have large impact if used improperly
|
||||
func (o *orderStore) get() map[string][]*order.Detail {
|
||||
o.m.RLock()
|
||||
defer o.m.RUnlock()
|
||||
return o.Orders
|
||||
orders := o.Orders
|
||||
o.m.RUnlock()
|
||||
return orders
|
||||
}
|
||||
|
||||
// GetByExchangeAndID returns a specific order by exchange and id
|
||||
|
||||
@@ -3,7 +3,7 @@ package engine
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
_ "net/http/pprof" // nolint: gosec
|
||||
"net/http/pprof"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -90,10 +90,10 @@ func newRouter(isREST bool) *mux.Router {
|
||||
runtime.SetMutexProfileFraction(Bot.Config.Profiler.MutexProfileFraction)
|
||||
}
|
||||
log.Debugf(log.RESTSys,
|
||||
"HTTP Go performance profiler (pprof) endpoint enabled: http://%s:%d/debug/pprof\n",
|
||||
"HTTP Go performance profiler (pprof) endpoint enabled: http://%s:%d/debug/pprof/\n",
|
||||
common.ExtractHost(listenAddr),
|
||||
common.ExtractPort(listenAddr))
|
||||
router.PathPrefix("/debug").Handler(http.DefaultServeMux)
|
||||
router.PathPrefix("/debug/pprof/").HandlerFunc(pprof.Index)
|
||||
}
|
||||
} else {
|
||||
routes = []Route{
|
||||
|
||||
@@ -412,7 +412,6 @@ func (e *ExchangeCurrencyPairSyncer) worker() {
|
||||
}
|
||||
printTickerSummary(result, c.Pair, c.AssetType, exchangeName, "REST", err)
|
||||
if err == nil {
|
||||
//nolint:gocritic Bot.CommsRelayer.StageTickerData(exchangeName, c.AssetType, result)
|
||||
if Bot.Config.RemoteControl.WebsocketRPC.Enabled {
|
||||
relayWebsocketEvent(result, "ticker_update", c.AssetType.String(), exchangeName)
|
||||
}
|
||||
@@ -452,7 +451,6 @@ func (e *ExchangeCurrencyPairSyncer) worker() {
|
||||
result, err := exchanges[x].UpdateOrderbook(c.Pair, c.AssetType)
|
||||
printOrderbookSummary(result, c.Pair, c.AssetType, exchangeName, "REST", err)
|
||||
if err == nil {
|
||||
//nolint:gocritic Bot.CommsRelayer.StageOrderbookData(exchangeName, c.AssetType, result)
|
||||
if Bot.Config.RemoteControl.WebsocketRPC.Enabled {
|
||||
relayWebsocketEvent(result, "orderbook_update", c.AssetType.String(), exchangeName)
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ func (c *WebsocketClient) write() {
|
||||
defer func() {
|
||||
c.Conn.Close()
|
||||
}()
|
||||
for { // nolint: gosimple
|
||||
for { // nolint // ws client write routine loop
|
||||
select {
|
||||
case message, ok := <-c.Send:
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user