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

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

* linters: Add intrange, copyloopvar, additional go vet linters to match gopls and fix issues
This commit is contained in:
Adrian Gallagher
2024-08-16 17:41:11 +10:00
committed by GitHub
parent facf291069
commit 225429bda6
111 changed files with 239 additions and 379 deletions

View File

@@ -98,12 +98,12 @@ func testWrappers(e exchange.IBotExchange) ([]string, error) {
contextParam := reflect.TypeOf((*context.Context)(nil)).Elem()
var funcs []string
for x := 0; x < iExchange.NumMethod(); x++ {
for x := range iExchange.NumMethod() {
name := iExchange.Method(x).Name
method := actualExchange.MethodByName(name)
inputs := make([]reflect.Value, method.Type().NumIn())
for y := 0; y < method.Type().NumIn(); y++ {
for y := range method.Type().NumIn() {
input := method.Type().In(y)
if input.Implements(contextParam) {

View File

@@ -175,7 +175,7 @@ func executeExchangeWrapperTests(ctx context.Context, t *testing.T, exch exchang
t.Helper()
iExchange := reflect.TypeOf(&exch).Elem()
actualExchange := reflect.ValueOf(exch)
for x := 0; x < iExchange.NumMethod(); x++ {
for x := range iExchange.NumMethod() {
methodName := iExchange.Method(x).Name
if _, ok := excludedMethodNames[methodName]; ok {
continue
@@ -183,7 +183,7 @@ func executeExchangeWrapperTests(ctx context.Context, t *testing.T, exch exchang
method := actualExchange.MethodByName(methodName)
var assetLen int
for y := 0; y < method.Type().NumIn(); y++ {
for y := range method.Type().NumIn() {
input := method.Type().In(y)
for _, t := range []reflect.Type{
assetParam, orderSubmitParam, orderModifyParam, orderCancelParam, orderCancelsParam, pairKeySliceParam, getOrdersRequestParam, latestRateRequest,
@@ -213,7 +213,7 @@ func executeExchangeWrapperTests(ctx context.Context, t *testing.T, exch exchang
Start: s,
End: e,
}
for z := 0; z < method.Type().NumIn(); z++ {
for z := range method.Type().NumIn() {
argGenerator.MethodInputType = method.Type().In(z)
generatedArg := generateMethodArg(ctx, t, argGenerator)
inputs[z] = *generatedArg

View File

@@ -638,7 +638,7 @@ func getOrderbookStream(c *cli.Context) error {
fmt.Println("\t\tBids\t\t\t\tAsks")
fmt.Println()
for i := int64(0); i < maxLen; i++ {
for i := range maxLen {
var bidAmount, bidPrice float64
if i <= bidLen {
bidAmount = resp.Bids[i].Amount

View File

@@ -39,7 +39,10 @@ func main() {
var input string
for {
log.Println("Please enter in your OTP secret:")
fmt.Scanln(&input)
if _, err = fmt.Scanln(&input); err != nil {
log.Printf("Failed to read input. Err: %s\n", err)
continue
}
if input != "" {
break
}