Skip to content

Commit

Permalink
Merge branch 'master' into engine
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasher- committed Nov 11, 2019
2 parents 26bc33c + e9b3e3d commit da81ea6
Show file tree
Hide file tree
Showing 53 changed files with 93 additions and 165 deletions.
4 changes: 2 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ environment:
PSQL_DBNAME: gct_dev_ci
PSQL_SSLMODE: disable

stack: go 1.12.3
stack: go 1.13.x

services:
- postgresql96
Expand All @@ -48,7 +48,7 @@ before_test:

test_script:
# test back-end
- go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.18.0
- go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.20.1
- '%GOPATH%\bin\golangci-lint.exe run --verbose'
- ps: >-
if($env:APPVEYOR_SCHEDULED_BUILD -eq 'true') {
Expand Down
48 changes: 25 additions & 23 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
run:
deadline: 1m0s
timeout: 1m0s
issues-exit-code: 1
tests: true
skip-dirs:
Expand All @@ -11,41 +11,46 @@ linters:
disable-all: true
enable:
# defaults
- govet
# - deadcode
# - errcheck
- staticcheck
# - unused
- gosimple
- structcheck
# - varcheck
- govet
- ineffassign
# - deadcode
- staticcheck
- structcheck
- typecheck
# - unused
# - varcheck

# disabled by default linters
# - bodyclose
- golint
- stylecheck
- gosec
# - interfacer
- unconvert
- depguard
- dogsled
# - dupl
# - funlen
# - gochecknoglobals
# - gochecknoinits
# - gocognit
- goconst
- gocritic
# - gocyclo
# - godox
- gofmt
- goimports
- golint
- gosec
# - interfacer
# - lll
# - maligned
- depguard
- misspell
# - lll
- unparam
- nakedret
# - prealloc
- scopelint
- gocritic
# - gochecknoinits
# - gochecknoglobals
# - funlen
- stylecheck
- unconvert
- unparam
- whitespace
# - wsl

linters-settings:
govet:
Expand Down Expand Up @@ -76,7 +81,4 @@ issues:
exclude-rules:
- text: "weak cryptographic primitive"
linters:
- gosec

service:
golangci-lint-version: 1.16.x
- gosec
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
LDFLAGS = -ldflags "-w -s"
GCTPKG = github.com/thrasher-corp/gocryptotrader
LINTPKG = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.18.0
LINTPKG = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.20.1
LINTBIN = $(GOPATH)/bin/golangci-lint
GCTLISTENPORT=9050
GCTPROFILERLISTENPORT=8085
Expand Down
2 changes: 0 additions & 2 deletions cmd/exchange_wrapper_issues/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ func testWrappers(e exchange.IBotExchange, base *exchange.Base, config *Config)
if err != nil {
msg = err.Error()
responseContainer.ErrorCount++

}
responseContainer.EndpointResponses = append(responseContainer.EndpointResponses, EndpointResponse{
SentParams: jsonifyInterface([]interface{}{p, assetTypes[i]}),
Expand All @@ -362,7 +361,6 @@ func testWrappers(e exchange.IBotExchange, base *exchange.Base, config *Config)
if err != nil {
msg = err.Error()
responseContainer.ErrorCount++

}
responseContainer.EndpointResponses = append(responseContainer.EndpointResponses, EndpointResponse{
SentParams: jsonifyInterface([]interface{}{p, assetTypes[i]}),
Expand Down
1 change: 0 additions & 1 deletion cmd/huobi_auth/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ func main() {
if err != nil {
log.Fatal(err)
}

} else {
var pubKeyData []byte
pubKeyData, err = ioutil.ReadFile("publickey.pem")
Expand Down
2 changes: 0 additions & 2 deletions common/crypto/crypto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ func TestGetMD5(t *testing.T) {
t.Errorf("Expected '%s'. Actual '%s'",
expectedOutput, []byte(actualStr))
}

}

func TestGetSHA512(t *testing.T) {
Expand Down Expand Up @@ -166,7 +165,6 @@ func TestGetHMAC(t *testing.T) {
expectedmd5, md5,
)
}

}

func TestSha1Tohex(t *testing.T) {
Expand Down
6 changes: 0 additions & 6 deletions communications/slack/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,34 +219,28 @@ func (s *Slack) WebsocketReader() {
}

switch data.Type {

case "error":
err = s.handleErrorResponse(data)
if err != nil {
continue
}

case "hello":
s.handleHelloResponse()

case "reconnect_url":
err = s.handleReconnectResponse(resp)
if err != nil {
continue
}

case "presence_change":
err = s.handlePresenceChange(resp)
if err != nil {
continue
}

case "message":
err = s.handleMessageResponse(resp, data)
if err != nil {
continue
}

case "pong":
if s.Verbose {
log.Debugln(log.CommunicationMgr, "Slack: Pong received from server")
Expand Down
2 changes: 0 additions & 2 deletions communications/slack/slack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ func TestGetUsernameByID(t *testing.T) {
if username != "cranktakular" {
t.Error("slack GetUsernameByID() error")
}

}

func TestGetIDByName(t *testing.T) {
Expand Down Expand Up @@ -178,7 +177,6 @@ func TestGetGroupIDByName(t *testing.T) {
t.Errorf("slack GetGroupIDByName() Expected '11223344' Actual '%s' Error: %s",
id, err)
}

}

func TestGetChannelIDByName(t *testing.T) {
Expand Down
3 changes: 0 additions & 3 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func (c *Config) GetClientBankAccounts(exchangeName, targetCurrency string) (Ban
c.BankAccounts[x].SupportedExchanges == "ALL") &&
strings.Contains(c.BankAccounts[x].SupportedCurrencies, targetCurrency) {
return c.BankAccounts[x], nil

}
}
return BankAccount{}, fmt.Errorf("client banking details not found for %s and currency %s",
Expand Down Expand Up @@ -255,7 +254,6 @@ func (c *Config) CheckCommunicationsConfig() {
},
}
}

} else {
if c.Communications.SMSGlobalConfig.From == "" {
c.Communications.SMSGlobalConfig.From = c.Name
Expand Down Expand Up @@ -1581,7 +1579,6 @@ func (c *Config) CheckRemoteControlConfig() {
// Then flush the old webserver settings
c.Webserver = nil
}

}

// CheckConfig checks all config settings
Expand Down
1 change: 0 additions & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ func TestCheckClientBankAccounts(t *testing.T) {
if !cfg.BankAccounts[0].Enabled {
t.Error("unexpected result")
}

}

func TestPurgeExchangeCredentials(t *testing.T) {
Expand Down
12 changes: 6 additions & 6 deletions currency/code_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ var (
HBZ = NewCode("HBZ")
USDT_ETH = NewCode("USDT_ETH") // nolint: golint,stylecheck
QTUM_ETH = NewCode("QTUM_ETH") // nolint: golint
BTM_ETH = NewCode("BTM_ETH") // nolint: golint
BTM_ETH = NewCode("BTM_ETH") // nolint: golint,stylecheck
FIL = NewCode("FIL")
STX = NewCode("STX")
BOT = NewCode("BOT")
Expand All @@ -371,7 +371,7 @@ var (
GOD = NewCode("GOD")
SMT = NewCode("SMT")
BTF = NewCode("BTF")
NAS_ETH = NewCode("NAS_ETH") // nolint: golint
NAS_ETH = NewCode("NAS_ETH") // nolint: golint,stylecheck
TSL = NewCode("TSL")
BIFI = NewCode("BIFI")
BNTY = NewCode("BNTY")
Expand All @@ -397,7 +397,7 @@ var (
MOBI = NewCode("MOBI")
LEDU = NewCode("LEDU")
DBC = NewCode("DBC")
MKR_OLD = NewCode("MKR_OLD") // nolint: golint
MKR_OLD = NewCode("MKR_OLD") // nolint: golint,stylecheck
DPY = NewCode("DPY")
BCDN = NewCode("BCDN")
EOSDAC = NewCode("EOSDAC") // nolint: golint
Expand All @@ -406,7 +406,7 @@ var (
PPS = NewCode("PPS")
BOE = NewCode("BOE")
MEDX = NewCode("MEDX")
SMT_ETH = NewCode("SMT_ETH") // nolint: golint
SMT_ETH = NewCode("SMT_ETH") // nolint: golint,stylecheck
CS = NewCode("CS")
MAN = NewCode("MAN")
REM = NewCode("REM")
Expand All @@ -426,7 +426,7 @@ var (
SWTH = NewCode("SWTH")
NKN = NewCode("NKN")
SOUL = NewCode("SOUL")
GALA_NEO = NewCode("GALA_NEO") // nolint: golint
GALA_NEO = NewCode("GALA_NEO") // nolint: golint,stylecheck
LRN = NewCode("LRN")
GSE = NewCode("GSE")
RATING = NewCode("RATING")
Expand Down Expand Up @@ -1651,5 +1651,5 @@ var (
YER = NewCode("YER")
ZWD = NewCode("ZWD")
XETH = NewCode("XETH")
FX_BTC = NewCode("FX_BTC") // nolint: golint
FX_BTC = NewCode("FX_BTC") // nolint: golint,stylecheck
)
1 change: 0 additions & 1 deletion currency/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ func TestDelete(t *testing.T) {
if p.Get(asset.Spot) != nil {
t.Error("Delete should have deleted AssetTypeSpot")
}

}

func TestGetPairs(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion currency/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ func (s *Storage) WriteCurrencyDataToFile(path string, mainUpdate bool) error {

// LoadFileCurrencyData loads currencies into the currency codes
func (s *Storage) LoadFileCurrencyData(f *File) error {

for i := range f.Contracts {
err := s.currencyCodes.LoadItem(&f.Contracts[i])
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion currency/symbol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ func TestGetSymbolByCurrencyName(t *testing.T) {
if err == nil {
t.Errorf("TestGetSymbolByCurrencyNam returned nil on non-existent currency")
}

}
1 change: 0 additions & 1 deletion engine/exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ func SetupExchanges() {
continue
}
return

}
if !exch.Enabled && !Bot.Settings.EnableAllExchanges {
log.Debugf(log.ExchangeSys, "%s: Exchange support: Disabled\n", exch.Name)
Expand Down
11 changes: 0 additions & 11 deletions engine/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,11 +519,9 @@ func SeedExchangeAccountInfo(data []exchange.AccountInfo) {

for _, exchangeData := range data {
exchangeName := exchangeData.Exchange

var currencies []exchange.AccountCurrencyInfo
for _, account := range exchangeData.Accounts {
for _, info := range account.Currencies {

var update bool
for i := range currencies {
if info.CurrencyName == currencies[i].CurrencyName {
Expand Down Expand Up @@ -566,19 +564,16 @@ func SeedExchangeAccountInfo(data []exchange.AccountInfo) {
CoinType: currencyName,
Balance: total,
Description: portfolio.PortfolioAddressExchange})

} else {
if total <= 0 {
log.Debugf(log.PortfolioMgr, "Portfolio: Removing %s %s entry.\n",
exchangeName,
currencyName)

port.RemoveExchangeAddress(exchangeName, currencyName)
} else {
balance, ok := port.GetAddressBalance(exchangeName,
portfolio.PortfolioAddressExchange,
currencyName)

if !ok {
continue
}
Expand All @@ -588,7 +583,6 @@ func SeedExchangeAccountInfo(data []exchange.AccountInfo) {
exchangeName,
currencyName,
total)

port.UpdateExchangeAddressBalance(exchangeName,
currencyName,
total)
Expand Down Expand Up @@ -635,7 +629,6 @@ func GetCryptocurrenciesByExchange(exchangeName string, enabledExchangesOnly, en
cryptocurrencies = append(cryptocurrencies, pairs[y].Quote.String())
}
}

}
return cryptocurrencies, nil
}
Expand All @@ -651,7 +644,6 @@ func GetCryptocurrencyDepositAddressesByExchange(exchName string) (map[string]st
if !ok {
return nil, ErrExchangeNotFound
}

return r, nil
}

Expand All @@ -666,14 +658,12 @@ func GetExchangeCryptocurrencyDepositAddress(exchName, accountID string, item cu
if exch == nil {
return "", ErrExchangeNotFound
}

return exch.GetDepositAddress(item, accountID)
}

// GetExchangeCryptocurrencyDepositAddresses obtains an exchanges deposit cryptocurrency list
func GetExchangeCryptocurrencyDepositAddresses() map[string]map[string]string {
result := make(map[string]map[string]string)

for x := range Bot.Exchanges {
if !Bot.Exchanges[x].IsEnabled() {
continue
Expand Down Expand Up @@ -704,7 +694,6 @@ func GetExchangeCryptocurrencyDepositAddresses() map[string]map[string]string {
}
result[exchName] = cryptoAddr
}

return result
}

Expand Down
Loading

0 comments on commit da81ea6

Please sign in to comment.