Skip to content

Commit

Permalink
Bump golangci-lint and AppVeyor versions now that 1.13.x is supported (
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasher- authored Nov 11, 2019
1 parent 0501455 commit e9b3e3d
Show file tree
Hide file tree
Showing 55 changed files with 60 additions and 125 deletions.
4 changes: 2 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ environment:
NODEJS_VER: 10.15.3
APPVEYOR_SAVE_CACHE_ON_ERROR: true

stack: go 1.12.3
stack: go 1.13.x

install:
- set Path=C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin;%Path%
Expand All @@ -28,7 +28,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
3 changes: 0 additions & 3 deletions common/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ func TestGetMD5(t *testing.T) {
t.Errorf("Test failed. Expected '%s'. Actual '%s'",
expectedOutput, []byte(actualStr))
}

}

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

}

func TestSha1Tohex(t *testing.T) {
Expand Down Expand Up @@ -838,7 +836,6 @@ func TestGetOSPathSlash(t *testing.T) {
if output != "/" && output != "\\" {
t.Errorf("Test failed. Common GetOSPathSlash. Returned '%s'", output)
}

}

func TestUnixMillis(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 @@ -209,34 +209,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.Debugf("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 @@ -140,7 +140,6 @@ func TestGetUsernameByID(t *testing.T) {
if username != "cranktakular" {
t.Error("test failed - slack GetUsernameByID() error")
}

}

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

}

func TestGetChannelIDByName(t *testing.T) {
Expand Down
2 changes: 0 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ func (c *Config) GetClientBankAccounts(exchangeName, targetCurrency string) (Ban
c.BankAccounts[x].SupportedExchanges == "ALL") &&
common.StringContains(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 @@ -496,7 +495,6 @@ func (c *Config) CheckCommunicationsConfig() {
},
}
}

} else {
if c.SMS != nil {
// flush old SMS config
Expand Down
20 changes: 10 additions & 10 deletions currency/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,9 +803,9 @@ var (
STQ = NewCode("STQ")
INK = NewCode("INK")
HBZ = NewCode("HBZ")
USDT_ETH = NewCode("USDT_ETH") // nolint: golint
QTUM_ETH = NewCode("QTUM_ETH") // nolint: golint
BTM_ETH = NewCode("BTM_ETH") // nolint: golint
USDT_ETH = NewCode("USDT_ETH") // nolint: stylecheck, golint
QTUM_ETH = NewCode("QTUM_ETH") // nolint: stylecheck
BTM_ETH = NewCode("BTM_ETH") // nolint: stylecheck, golint
FIL = NewCode("FIL")
STX = NewCode("STX")
BOT = NewCode("BOT")
Expand All @@ -818,7 +818,7 @@ var (
GOD = NewCode("GOD")
SMT = NewCode("SMT")
BTF = NewCode("BTF")
NAS_ETH = NewCode("NAS_ETH") // nolint: golint
NAS_ETH = NewCode("NAS_ETH") // nolint: stylecheck, golint
TSL = NewCode("TSL")
BIFI = NewCode("BIFI")
BNTY = NewCode("BNTY")
Expand All @@ -844,21 +844,21 @@ var (
MOBI = NewCode("MOBI")
LEDU = NewCode("LEDU")
DBC = NewCode("DBC")
MKR_OLD = NewCode("MKR_OLD") // nolint: golint
MKR_OLD = NewCode("MKR_OLD") // nolint: stylecheck, golint
DPY = NewCode("DPY")
BCDN = NewCode("BCDN")
EOSDAC = NewCode("EOSDAC") // nolint: golint
EOSDAC = NewCode("EOSDAC") // nolint: stylecheck
TIPS = NewCode("TIPS")
XMC = NewCode("XMC")
PPS = NewCode("PPS")
BOE = NewCode("BOE")
MEDX = NewCode("MEDX")
SMT_ETH = NewCode("SMT_ETH") // nolint: golint
SMT_ETH = NewCode("SMT_ETH") // nolint: stylecheck, golint
CS = NewCode("CS")
MAN = NewCode("MAN")
REM = NewCode("REM")
LYM = NewCode("LYM")
INSTAR = NewCode("INSTAR") // nolint: golint
INSTAR = NewCode("INSTAR") // nolint: stylecheck
BFT = NewCode("BFT")
IHT = NewCode("IHT")
SENC = NewCode("SENC")
Expand All @@ -873,7 +873,7 @@ var (
SWTH = NewCode("SWTH")
NKN = NewCode("NKN")
SOUL = NewCode("SOUL")
GALA_NEO = NewCode("GALA_NEO") // nolint: golint
GALA_NEO = NewCode("GALA_NEO") // nolint: stylecheck, golint
LRN = NewCode("LRN")
GSE = NewCode("GSE")
RATING = NewCode("RATING")
Expand Down Expand Up @@ -2098,5 +2098,5 @@ var (
YER = NewCode("YER")
ZWD = NewCode("ZWD")
XETH = NewCode("XETH")
FX_BTC = NewCode("FX_BTC") // nolint: golint
FX_BTC = NewCode("FX_BTC") // nolint: stylecheck, golint
)
1 change: 0 additions & 1 deletion currency/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,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("Test failed. TestGetSymbolByCurrencyNam returned nil on non-existent currency")
}

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

}
if !exch.Enabled {
log.Debugf("%s: Exchange support: Disabled", exch.Name)
Expand Down
1 change: 0 additions & 1 deletion exchanges/anx/anx.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ func (a *ANX) GetDataToken() (string, error) {
// NewOrder sends a new order request to the exchange.
func (a *ANX) NewOrder(orderType string, buy bool, tradedCurrency string, tradedCurrencyAmount float64, settlementCurrency string, settlementCurrencyAmount, limitPriceSettlement float64,
replace bool, replaceUUID string, replaceIfActive bool) (string, error) {

req := make(map[string]interface{})
var order Order
order.OrderType = orderType
Expand Down
1 change: 0 additions & 1 deletion exchanges/binance/binance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ func TestGetFee(t *testing.T) {
t.Errorf("Test Failed - GetFee() error. Expected: %f, Received: %f", float64(0), resp)
t.Error(err)
}

}

// CryptocurrencyWithdrawalFee Basic
Expand Down
1 change: 0 additions & 1 deletion exchanges/bitfinex/bitfinex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ func TestGetSymbols(t *testing.T) {
"rrtusd",
}
if len(expectedCurrencies) <= len(symbols) {

for _, explicitSymbol := range expectedCurrencies {
if common.StringDataCompare(expectedCurrencies, explicitSymbol) {
break
Expand Down
1 change: 0 additions & 1 deletion exchanges/bitfinex/bitfinex_websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ func (b *Bitfinex) WsDataHandler() {
if status == "OK" {
b.Websocket.DataHandler <- eventData
b.WsAddSubscriptionChannel(0, "account", "N/A")

} else if status == "fail" {
b.Websocket.DataHandler <- fmt.Errorf("bitfinex.go error - Websocket unable to AUTH. Error code: %s",
eventData["code"].(string))
Expand Down
1 change: 0 additions & 1 deletion exchanges/bitmex/bitmex_websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ func (b *Bitmex) wsHandleIncomingData() {

b.Websocket.DataHandler <- fmt.Errorf("%s websocket error: Unable to subscribe %s",
b.Name, decodedResp.Subscribe)

} else if _, ok := quickCapture["table"]; ok {
var decodedResp WebsocketMainResponse
err := common.JSONDecode(resp.Raw, &decodedResp)
Expand Down
1 change: 0 additions & 1 deletion exchanges/bitmex/bitmex_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func (b *Bitmex) Run() {
marketInfo, err := b.GetActiveInstruments(&GenericRequestParams{})
if err != nil {
log.Errorf("%s Failed to get available symbols.\n", b.GetName())

} else {
var exchangeProducts []string
for i := range marketInfo {
Expand Down
2 changes: 0 additions & 2 deletions exchanges/bitstamp/bitstamp_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func (b *Bitstamp) UpdateTicker(p currency.Pair, assetType string) (ticker.Price
tick, err := b.GetTicker(p.String(), false)
if err != nil {
return tickerPrice, err

}
tickerPrice.Pair = p
tickerPrice.Ask = tick.Ask
Expand Down Expand Up @@ -100,7 +99,6 @@ func (b *Bitstamp) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error
feeBuilder.FeeType = exchange.OfflineTradeFee
}
return b.GetFee(feeBuilder)

}

// GetOrderbookEx returns the orderbook for a currency pair
Expand Down
1 change: 0 additions & 1 deletion exchanges/bittrex/bittrex.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,5 +575,4 @@ func (b *Bittrex) GetWithdrawalFee(c currency.Code) (float64, error) {
// calculateTradingFee returns the fee for trading any currency on Bittrex
func calculateTradingFee(price, amount float64) float64 {
return 0.0025 * price * amount

}
1 change: 0 additions & 1 deletion exchanges/bittrex/bittrex_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ func (b *Bittrex) GetFeeByType(feeBuilder *exchange.FeeBuilder) (float64, error)
feeBuilder.FeeType = exchange.OfflineTradeFee
}
return b.GetFee(feeBuilder)

}

// GetActiveOrders retrieves any orders that are active/open
Expand Down
1 change: 0 additions & 1 deletion exchanges/btse/btse.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ func (b *BTSE) GetTrades(symbol string) ([]Trade, error) {
var t []Trade
endpoint := fmt.Sprintf("%s/%s", btseTrades, symbol)
return t, b.SendHTTPRequest(http.MethodGet, endpoint, &t)

}

// GetTicker returns the ticker for a specified symbol
Expand Down
1 change: 0 additions & 1 deletion exchanges/btse/btse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ func TestGetFills(t *testing.T) {
if err != nil {
t.Error(err)
}

}

func TestCreateOrder(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion exchanges/btse/btse_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ func (b *BTSE) UpdateTicker(p currency.Pair, assetType string) (ticker.Price, er
s, err := b.GetMarketStatistics(exchange.FormatExchangeCurrency(b.Name, p).String())
if err != nil {
return tickerPrice, err

}

tickerPrice.Pair = p
Expand Down
Loading

0 comments on commit e9b3e3d

Please sign in to comment.