CI/build: Update Go version, linters and fix minor issues (#1473)

* CI/build: Update Go version, linters and fix minor issues

* Bump golangci-lint to v1.56.1

* BinanceUS: Make uint usage consistent

* Throw blank identifiers into the trash
This commit is contained in:
Adrian Gallagher
2024-02-14 11:02:06 +11:00
committed by GitHub
parent 9ff502bac2
commit 08da42ddb7
79 changed files with 364 additions and 374 deletions

View File

@@ -664,7 +664,7 @@ func TestErrors(t *testing.T) {
e5 := errors.New("add vodka")
// Nil tests
assert.Nil(t, AppendError(nil, nil), "Append nil to nil should nil")
assert.NoError(t, AppendError(nil, nil), "Append nil to nil should nil")
assert.Same(t, AppendError(e1, nil), e1, "Append nil to e1 should e1")
assert.Same(t, AppendError(nil, e2), e2, "Append e2 to nil should e2")
@@ -676,7 +676,7 @@ func TestErrors(t *testing.T) {
err = ExcludeError(err, e2)
assert.ErrorIs(t, err, e1, "Should still be bored")
assert.False(t, errors.Is(err, e2), "Should not be an e2")
assert.NotErrorIs(t, err, e2, "Should not be an e2")
me, ok := err.(*multiError)
if assert.True(t, ok, "Should be a multiError") {
assert.Len(t, me.errs, 2, "Should only have 2 errors")
@@ -690,19 +690,19 @@ func TestErrors(t *testing.T) {
err = fmt.Errorf("%w: %w", e3, fmt.Errorf("%w: %w", e4, e5))
assert.ErrorIs(t, ExcludeError(err, e4), e3, "Excluding e4 should retain e3")
assert.ErrorIs(t, ExcludeError(err, e4), e5, "Excluding e4 should retain the vanilla co-wrapped e5")
assert.False(t, errors.Is(ExcludeError(err, e4), e4), "e4 should be excluded")
assert.NotErrorIs(t, ExcludeError(err, e4), e4, "e4 should be excluded")
assert.ErrorIs(t, ExcludeError(err, e5), e3, "Excluding e5 should retain e3")
assert.ErrorIs(t, ExcludeError(err, e5), e4, "Excluding e5 should retain the vanilla co-wrapped e4")
assert.False(t, errors.Is(ExcludeError(err, e5), e5), "e5 should be excluded")
assert.NotErrorIs(t, ExcludeError(err, e5), e5, "e5 should be excluded")
// Hybrid tests
err = AppendError(fmt.Errorf("%w: %w", e4, e5), e3)
assert.ErrorIs(t, ExcludeError(err, e4), e3, "Excluding e4 should retain e3")
assert.ErrorIs(t, ExcludeError(err, e4), e5, "Excluding e4 should retain the vanilla co-wrapped e5")
assert.False(t, errors.Is(ExcludeError(err, e4), e4), "e4 should be excluded")
assert.NotErrorIs(t, ExcludeError(err, e4), e4, "e4 should be excluded")
assert.ErrorIs(t, ExcludeError(err, e5), e3, "Excluding e5 should retain e3")
assert.ErrorIs(t, ExcludeError(err, e5), e4, "Excluding e5 should retain the vanilla co-wrapped e4")
assert.False(t, errors.Is(ExcludeError(err, e5), e5), "e4 should be excluded")
assert.NotErrorIs(t, ExcludeError(err, e5), e5, "e4 should be excluded")
}
func TestParseStartEndDate(t *testing.T) {

View File

@@ -94,8 +94,7 @@ func IntToHumanFriendlyString(number int64, thousandsSep string) string {
number = -number
neg = true
}
str := fmt.Sprintf("%v", number)
return numberToHumanFriendlyString(str, 0, "", thousandsSep, neg)
return numberToHumanFriendlyString(strconv.FormatInt(number, 10), 0, "", thousandsSep, neg)
}
// FloatToHumanFriendlyString converts a float to a comma separated string at the thousand point

View File

@@ -1,7 +1,7 @@
package file
import (
"fmt"
"errors"
"os"
"path/filepath"
"runtime"
@@ -70,7 +70,7 @@ func TestMove(t *testing.T) {
}
if !strings.Contains(string(contents), "GoCryptoTrader") {
return fmt.Errorf("unable to find previously written data")
return errors.New("unable to find previously written data")
}
return os.Remove(out)