From c1ca1e07bed1e6d4d4a024b7c2024cb1c4b90c87 Mon Sep 17 00:00:00 2001 From: Koenraad Verheyden Date: Thu, 15 Jul 2021 21:26:46 +0200 Subject: [PATCH] Clean up CI linting (#819) * Tweak golangci-lint: exclude Log statements from errcheck * Ignore use of unbuffered os.Signal channel in tempo-cli * Remove redundant type assertion (golangci-lint) --- .errcheck-exclude.txt | 3 +++ .golangci.yml | 4 ++++ cmd/tempo-cli/cmd-list-block.go | 1 + modules/distributor/receiver/shim.go | 16 +++------------- 4 files changed, 11 insertions(+), 13 deletions(-) create mode 100644 .errcheck-exclude.txt diff --git a/.errcheck-exclude.txt b/.errcheck-exclude.txt new file mode 100644 index 00000000000..ea7f3557b76 --- /dev/null +++ b/.errcheck-exclude.txt @@ -0,0 +1,3 @@ +// the following functions will be excluded from errcheck +// https://github.com/kisielk/errcheck#excluding-functions +(github.com/go-kit/kit/log.Logger).Log \ No newline at end of file diff --git a/.golangci.yml b/.golangci.yml index 001e467c15f..0a70aa55306 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -61,6 +61,10 @@ linters: - interfacer - typecheck +linters-settings: + errcheck: + exclude: ./.errcheck-exclude.txt + issues: exclude: - Error return value of .*log\.Logger\)\.Log\x60 is not checked diff --git a/cmd/tempo-cli/cmd-list-block.go b/cmd/tempo-cli/cmd-list-block.go index 9a36350904c..7c0c676f2bf 100644 --- a/cmd/tempo-cli/cmd-list-block.go +++ b/cmd/tempo-cli/cmd-list-block.go @@ -96,6 +96,7 @@ func dumpBlock(r tempodb_backend.Reader, c tempodb_backend.Compactor, tenantID s // Print stats on ctrl+c c := make(chan os.Signal) + // nolint:govet signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { <-c diff --git a/modules/distributor/receiver/shim.go b/modules/distributor/receiver/shim.go index b02470dc29b..68c0a058391 100644 --- a/modules/distributor/receiver/shim.go +++ b/modules/distributor/receiver/shim.go @@ -102,22 +102,12 @@ func New(receiverCfg map[string]interface{}, pusher tempopb.PusherServer, multit return nil, fmt.Errorf("receiver factory not found for type: %s", cfg.Type()) } - if factory, ok := factoryBase.(component.ReceiverFactory); ok { - receiver, err := factory.CreateTracesReceiver(ctx, params, cfg, shim) - if err != nil { - return nil, err - } - - shim.receivers = append(shim.receivers, receiver) - continue - } - - /*factory := factoryBase.(component.ReceiverFactoryOld) - receiver, err := factory.CreateTraceReceiver(ctx, zapLogger, cfg, converter.NewOCToInternalTraceConverter(shim)) + receiver, err := factoryBase.CreateTracesReceiver(ctx, params, cfg, shim) if err != nil { return nil, err } - shim.receivers = append(shim.receivers, receiver)*/ + + shim.receivers = append(shim.receivers, receiver) } shim.Service = services.NewIdleService(shim.starting, shim.stopping)