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

@@ -141,21 +141,21 @@ func (s *GRPCServer) StartRPCRESTProxy() error {
func (s *GRPCServer) authenticateClient(ctx context.Context) (context.Context, error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
return ctx, fmt.Errorf("unable to extract metadata")
return ctx, errors.New("unable to extract metadata")
}
authStr, ok := md["authorization"]
if !ok {
return ctx, fmt.Errorf("authorization header missing")
return ctx, errors.New("authorization header missing")
}
if !strings.Contains(authStr[0], "Basic") {
return ctx, fmt.Errorf("basic not found in authorization header")
return ctx, errors.New("basic not found in authorization header")
}
decoded, err := crypto.Base64Decode(strings.Split(authStr[0], " ")[1])
if err != nil {
return ctx, fmt.Errorf("unable to base64 decode authorization header")
return ctx, errors.New("unable to base64 decode authorization header")
}
creds := strings.Split(string(decoded), ":")
@@ -164,7 +164,7 @@ func (s *GRPCServer) authenticateClient(ctx context.Context) (context.Context, e
if username != s.config.GRPC.Username ||
password != s.config.GRPC.Password {
return ctx, fmt.Errorf("username/password mismatch")
return ctx, errors.New("username/password mismatch")
}
return ctx, nil
}

View File

@@ -858,7 +858,7 @@ func (bt *BackTest) loadData(cfg *config.Config, exch gctexchange.IBotExchange,
return nil, err
}
if resp == nil {
return nil, fmt.Errorf("processing error, response returned nil")
return nil, errors.New("processing error, response returned nil")
}
resp.Item.UnderlyingPair = underlyingPair