Skip to content

Commit

Permalink
Bump golangci-lint to v1.18.0 (thrasher-corp#354)
Browse files Browse the repository at this point in the history
* Bump golangci-lint to v0.18.0

* Bump AppVeyor golangci-lint to v1.18

For science

* Bump golangci deadline

* Fix notifications typo

* Fix grammar

* Update DisableNTPCheck test string comparison
  • Loading branch information
thrasher- authored Sep 13, 2019
1 parent 3bcaa5d commit b1ed894
Show file tree
Hide file tree
Showing 16 changed files with 99 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ before_test:

test_script:
# test back-end
- go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.16.0
- go get github.com/golangci/golangci-lint/cmd/golangci-lint@v1.18.0
- '%GOPATH%\bin\golangci-lint.exe run --verbose'
- ps: >-
if($env:APPVEYOR_SCHEDULED_BUILD -eq 'true') {
Expand Down
11 changes: 6 additions & 5 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
run:
deadline: 30s
deadline: 1m0s
issues-exit-code: 1
tests: true
skip-dirs:
- vendor
- web
- web/
- testdata

linters:
Expand All @@ -21,14 +21,13 @@ linters:
- ineffassign
# - deadcode
- typecheck
- goimports
- govet

# disabled by default linters
# - bodyclose
- golint
- stylecheck
- gosec
# - interfacer
# - interfacer
- unconvert
# - dupl
- goconst
Expand All @@ -46,6 +45,7 @@ linters:
- gocritic
# - gochecknoinits
# - gochecknoglobals
# - funlen

linters-settings:
govet:
Expand All @@ -67,6 +67,7 @@ linters-settings:
- wrapperFunc
- importShadow
- methodExprCall
- evalOrder

issues:
max-issues-per-linter: 0
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ matrix:
dist: xenial
name: 'GoCryptoTrader [back-end] [linux]'
go:
- 1.12.x
- 1.13.x
env:
- GO111MODULE=on
install: true
Expand All @@ -35,7 +35,7 @@ matrix:
os: osx
name: 'GoCryptoTrader [back-end] [darwin]'
go:
- 1.12.x
- 1.13.x
env:
- GO111MODULE=on
install: true
Expand Down
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.16.0
LINTPKG = github.com/golangci/golangci-lint/cmd/golangci-lint@v1.18.0
LINTBIN = $(GOPATH)/bin/golangci-lint
GCTLISTENPORT=9050
GCTPROFILERLISTENPORT=8085
Expand Down
21 changes: 12 additions & 9 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const (
// Constants here hold some messages
const (
ErrExchangeNameEmpty = "exchange #%d name is empty"
ErrExchangeAvailablePairsEmpty = "exchange %s avaiable pairs is empty"
ErrExchangeAvailablePairsEmpty = "exchange %s available pairs is empty"
ErrExchangeEnabledPairsEmpty = "exchange %s enabled pairs is empty"
ErrExchangeBaseCurrenciesEmpty = "exchange %s base currencies is empty"
ErrExchangeNotFound = "exchange %s not found"
Expand Down Expand Up @@ -1190,33 +1190,36 @@ func (c *Config) DisableNTPCheck(input io.Reader) (string, error) {
defer m.Unlock()

reader := bufio.NewReader(input)
log.Warn("Your system time is out of sync this may cause issues with trading")
log.Warn("Your system time is out of sync, this may cause issues with trading")
log.Warn("How would you like to show future notifications? (a)lert / (w)arn / (d)isable \n")

var answered = false
for ok := true; ok; ok = (!answered) {
var resp string
answered := false
for !answered {
answer, err := reader.ReadString('\n')
if err != nil {
return "", err
return resp, err
}

answer = strings.TrimRight(answer, "\r\n")
switch answer {
case "a":
c.NTPClient.Level = 0
resp = "Time sync has been set to alert"
answered = true
return "Time sync has been set to alert", nil
case "w":
c.NTPClient.Level = 1
resp = "Time sync has been set to warn only"
answered = true
return "Time sync has been set to warn only", nil
case "d":
c.NTPClient.Level = -1
resp = "Future notifications for out of time sync has been disabled"
answered = true
return "Future notications for out time sync have been disabled", nil
default:
log.Warn("Invalid option selected, please try again (a)lert / (w)arn / (d)isable")
}
}
return "", errors.New("something went wrong NTPCheck should never make it this far")
return resp, nil
}

// CheckConnectionMonitorConfig checks and if zero value assigns default values
Expand Down
4 changes: 2 additions & 2 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1030,8 +1030,8 @@ func TestDisableNTPCheck(t *testing.T) {
}

disable, _ := c.DisableNTPCheck(strings.NewReader("d\n"))
if disable != "Future notications for out time sync have been disabled" {
t.Errorf("failed expected %v got %v", "Future notications for out time sync have been disabled", disable)
if disable != "Future notifications for out of time sync has been disabled" {
t.Errorf("failed expected %v got %v", "Future notifications for out of time sync has been disabled", disable)
}

_, err = c.DisableNTPCheck(strings.NewReader(" "))
Expand Down
2 changes: 1 addition & 1 deletion currency/code.go
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ var (
BAT = NewCode("BAT")
ETP = NewCode("ETP")
HOT = NewCode("HOT")
STRAT = NewCode("STRAT")
STRAT = NewCode("STRAT") // nolint: misspell
GNT = NewCode("GNT")
REP = NewCode("REP")
SNT = NewCode("SNT")
Expand Down
Loading

0 comments on commit b1ed894

Please sign in to comment.