Skip to content

Commit

Permalink
fixed related lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikspatil024 committed Feb 28, 2023
1 parent 441efb0 commit 2d93fb6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
3 changes: 3 additions & 0 deletions internal/cli/server/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1173,18 +1173,21 @@ func getNodeKey(hex string, file string) *ecdsa.PrivateKey {
key *ecdsa.PrivateKey
err error
)

switch {
case file != "" && hex != "":
utils.Fatalf("Options %q and %q are mutually exclusive", file, hex)
case file != "":
if key, err = crypto.LoadECDSA(file); err != nil {
utils.Fatalf("Option %q: %v", file, err)
}

return key
case hex != "":
if key, err = crypto.HexToECDSA(hex); err != nil {
utils.Fatalf("Option %q: %v", hex, err)
}

return key
}

Expand Down
2 changes: 2 additions & 0 deletions internal/cli/server/pprof/pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ func SetSetBlockProfileRate(rate int) {

func StartPProf(address string) {
log.Info("Starting pprof server", "addr", fmt.Sprintf("http://%s/debug/pprof", address))

go func() {
// nolint: gosec
if err := http.ListenAndServe(address, nil); err != nil {
log.Error("Failure in running pprof server", "err", err)
}
Expand Down
28 changes: 16 additions & 12 deletions internal/cli/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ import (
"strings"
"time"

"github.com/mattn/go-colorable"
"github.com/mattn/go-isatty"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
"google.golang.org/grpc"

"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/accounts/keystore"
"github.com/ethereum/go-ethereum/consensus/beacon" //nolint:typecheck
Expand All @@ -28,15 +38,6 @@ import (
"github.com/ethereum/go-ethereum/metrics/influxdb"
"github.com/ethereum/go-ethereum/metrics/prometheus"
"github.com/ethereum/go-ethereum/node"
"github.com/mattn/go-colorable"
"github.com/mattn/go-isatty"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
"google.golang.org/grpc"

// Force-load the tracer engines to trigger registration
_ "github.com/ethereum/go-ethereum/eth/tracers/js"
Expand Down Expand Up @@ -457,7 +458,6 @@ func (s *Server) loggingServerInterceptor(ctx context.Context, req interface{},
}

func setupLogger(logLevel string, loggingInfo LoggingConfig) {

var ostream log.Handler

output := io.Writer(os.Stderr)
Expand All @@ -482,11 +482,15 @@ func setupLogger(logLevel string, loggingInfo LoggingConfig) {
glogger.Verbosity(log.LvlInfo)
}

glogger.Vmodule(loggingInfo.Vmodule)
if err := glogger.Vmodule(loggingInfo.Vmodule); err != nil {
log.Error("failed to set Vmodule", "err", err)
}

log.PrintOrigins(loggingInfo.Debug)

glogger.BacktraceAt(loggingInfo.Backtrace)
if err := glogger.BacktraceAt(loggingInfo.Backtrace); err != nil {
log.Error("failed to set BacktraceAt", "err", err)
}

log.Root().SetHandler(glogger)
}
Expand Down

0 comments on commit 2d93fb6

Please sign in to comment.