Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Lint Rule: unused-receiver #5521

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,6 @@ linters-settings:
# do a clean-up and enable
- name: unused-parameter
disabled: true
# do a clean-up and enable
- name: unused-receiver
disabled: true
# we use storage_v2, so...
- name: var-naming
disabled: true
Expand Down
6 changes: 3 additions & 3 deletions cmd/agent/app/builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,11 @@ func TestMultipleCollectorProxies(t *testing.T) {

type fakeCollectorProxy struct{}

func (f fakeCollectorProxy) GetReporter() reporter.Reporter {
func (fakeCollectorProxy) GetReporter() reporter.Reporter {
return fakeCollectorProxy{}
}

func (f fakeCollectorProxy) GetManager() configmanager.ClientConfigManager {
func (fakeCollectorProxy) GetManager() configmanager.ClientConfigManager {
return fakeCollectorProxy{}
}

Expand All @@ -202,7 +202,7 @@ func (fakeCollectorProxy) Close() error {
return nil
}

func (f fakeCollectorProxy) GetSamplingStrategy(_ context.Context, _ string) (*api_v2.SamplingStrategyResponse, error) {
func (fakeCollectorProxy) GetSamplingStrategy(_ context.Context, _ string) (*api_v2.SamplingStrategyResponse, error) {
return nil, errors.New("no peers available")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/configmanager/grpc/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ func (s *ConfigManagerProxy) GetSamplingStrategy(ctx context.Context, serviceNam
}

// GetBaggageRestrictions returns baggage restrictions from collector.
func (s *ConfigManagerProxy) GetBaggageRestrictions(_ context.Context, _ string) ([]*baggage.BaggageRestriction, error) {
func (*ConfigManagerProxy) GetBaggageRestrictions(_ context.Context, _ string) ([]*baggage.BaggageRestriction, error) {
return nil, errors.New("baggage not implemented")
}
8 changes: 4 additions & 4 deletions cmd/agent/app/customtransport/buffered_read_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ func NewTBufferedReadTransport(readBuf *bytes.Buffer) (*TBufferedReadTransport,

// IsOpen does nothing as transport is not maintaining the connection
// Required to maintain thrift.TTransport interface
func (p *TBufferedReadTransport) IsOpen() bool {
func (*TBufferedReadTransport) IsOpen() bool {
return true
}

// Open does nothing as transport is not maintaining the connection
// Required to maintain thrift.TTransport interface
func (p *TBufferedReadTransport) Open() error {
func (*TBufferedReadTransport) Open() error {
return nil
}

// Close does nothing as transport is not maintaining the connection
// Required to maintain thrift.TTransport interface
func (p *TBufferedReadTransport) Close() error {
func (*TBufferedReadTransport) Close() error {
return nil
}

Expand All @@ -72,6 +72,6 @@ func (p *TBufferedReadTransport) Write(buf []byte) (int, error) {

// Flush does nothing as udp server does not write responses back
// Required to maintain thrift.TTransport interface
func (p *TBufferedReadTransport) Flush(_ context.Context) error {
func (*TBufferedReadTransport) Flush(_ context.Context) error {
return nil
}
2 changes: 1 addition & 1 deletion cmd/agent/app/reporter/grpc/reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func TestReporter_MakeModelKeyValue(t *testing.T) {

type mockMultitenantSpanHandler struct{}

func (h *mockMultitenantSpanHandler) PostSpans(ctx context.Context, r *api_v2.PostSpansRequest) (*api_v2.PostSpansResponse, error) {
func (*mockMultitenantSpanHandler) PostSpans(ctx context.Context, r *api_v2.PostSpansRequest) (*api_v2.PostSpansResponse, error) {
md, ok := metadata.FromIncomingContext(ctx)
if !ok {
return &api_v2.PostSpansResponse{}, status.Errorf(codes.PermissionDenied, "missing tenant header")
Expand Down
2 changes: 1 addition & 1 deletion cmd/agent/app/servers/tbuffered_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (t *fakeTransport) Read(p []byte) (n int, err error) {
return len(p), nil
}

func (t *fakeTransport) Close() error {
func (*fakeTransport) Close() error {
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/agent/app/servers/thriftudp/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func NewTUDPServerTransport(hostPort string) (*TUDPTransport, error) {

// Open does nothing as connection is opened on creation
// Required to maintain thrift.TTransport interface
func (p *TUDPTransport) Open() error {
func (*TUDPTransport) Open() error {
return nil
}

Expand Down Expand Up @@ -131,7 +131,7 @@ func (p *TUDPTransport) Read(buf []byte) (int, error) {

// RemainingBytes returns the max number of bytes (same as Thrift's StreamTransport) as we
// do not know how many bytes we have left.
func (p *TUDPTransport) RemainingBytes() uint64 {
func (*TUDPTransport) RemainingBytes() uint64 {
const maxSize = ^uint64(0)
return maxSize
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/collector/app/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ func (c *Collector) Start(options *flags.CollectorOptions) error {
return nil
}

func (c *Collector) publishOpts(cOpts *flags.CollectorOptions) {
func (*Collector) publishOpts(cOpts *flags.CollectorOptions) {
safeexpvar.SetInt(metricNumWorkers, int64(cOpts.NumWorkers))
safeexpvar.SetInt(metricQueueSize, int64(cOpts.QueueSize))
}
Expand Down
6 changes: 3 additions & 3 deletions cmd/collector/app/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (t *mockAggregator) HandleRootSpan(span *model.Span, logger *zap.Logger) {
t.callCount.Add(1)
}

func (t *mockAggregator) Start() {}
func (*mockAggregator) Start() {}

func (t *mockAggregator) Close() error {
t.closeCount.Add(1)
Expand Down Expand Up @@ -146,11 +146,11 @@ func TestCollector_StartErrors(t *testing.T) {

type mockStrategyStore struct{}

func (m *mockStrategyStore) GetSamplingStrategy(_ context.Context, serviceName string) (*api_v2.SamplingStrategyResponse, error) {
func (*mockStrategyStore) GetSamplingStrategy(_ context.Context, serviceName string) (*api_v2.SamplingStrategyResponse, error) {
return &api_v2.SamplingStrategyResponse{}, nil
}

func (m *mockStrategyStore) Close() error {
func (*mockStrategyStore) Close() error {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/collector/app/handler/grpc_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (p *mockSpanProcessor) reset() {
p.spanFormat = ""
}

func (p *mockSpanProcessor) Close() error {
func (*mockSpanProcessor) Close() error {
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/collector/app/handler/http_thrift_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func TestCannotReadBodyFromRequest(t *testing.T) {

type errReader struct{}

func (e *errReader) Read(p []byte) (int, error) {
func (*errReader) Read(p []byte) (int, error) {
return 0, fmt.Errorf("Simulated error reading body")
}

Expand All @@ -180,7 +180,7 @@ type dummyResponseWriter struct {
myStatusCode int
}

func (d *dummyResponseWriter) Header() http.Header {
func (*dummyResponseWriter) Header() http.Header {
return http.Header{}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/collector/app/handler/thrift_span_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (s *shouldIErrorProcessor) ProcessSpans(mSpans []*model.Span, _ processor.S
return retMe, nil
}

func (s *shouldIErrorProcessor) Close() error {
func (*shouldIErrorProcessor) Close() error {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/collector/app/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (options) OnDroppedSpan(onDroppedSpan func(span *model.Span)) Option {
}
}

func (o options) apply(opts ...Option) options {
func (options) apply(opts ...Option) options {
ret := options{}
for _, opt := range opts {
opt(&ret)
Expand Down
4 changes: 2 additions & 2 deletions cmd/collector/app/sampling/grpc_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (

type mockSamplingStore struct{}

func (s mockSamplingStore) GetSamplingStrategy(ctx context.Context, serviceName string) (*api_v2.SamplingStrategyResponse, error) {
func (mockSamplingStore) GetSamplingStrategy(ctx context.Context, serviceName string) (*api_v2.SamplingStrategyResponse, error) {
if serviceName == "error" {
return nil, errors.New("some error")
} else if serviceName == "nil" {
Expand All @@ -37,7 +37,7 @@ func (s mockSamplingStore) GetSamplingStrategy(ctx context.Context, serviceName
return &api_v2.SamplingStrategyResponse{StrategyType: api_v2.SamplingStrategyType_PROBABILISTIC}, nil
}

func (s mockSamplingStore) Close() error {
func (mockSamplingStore) Close() error {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/collector/app/sanitizer/cache/auto_refresh_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (c *autoRefreshCache) Get(key string) string {
}

// Put implementation that does nothing
func (c *autoRefreshCache) Put(key string, value string) error {
func (*autoRefreshCache) Put(key string, value string) error {
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/collector/app/sanitizer/service_name_sanitizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ func (d *fixedMappingCache) Get(key string) string {
return k
}

func (d *fixedMappingCache) Put(key string, value string) error {
func (*fixedMappingCache) Put(key string, value string) error {
return nil
}

func (d *fixedMappingCache) Initialize() error {
func (*fixedMappingCache) Initialize() error {
return nil
}

Expand Down
8 changes: 4 additions & 4 deletions cmd/collector/app/sanitizer/zipkin/span_sanitizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func NewSpanDurationSanitizer() Sanitizer {

type spanDurationSanitizer struct{}

func (s *spanDurationSanitizer) Sanitize(span *zc.Span) *zc.Span {
func (*spanDurationSanitizer) Sanitize(span *zc.Span) *zc.Span {
if span.Duration == nil {
duration := defaultDuration
if len(span.Annotations) >= 2 {
Expand Down Expand Up @@ -116,7 +116,7 @@ func NewSpanStartTimeSanitizer() Sanitizer {

type spanStartTimeSanitizer struct{}

func (s *spanStartTimeSanitizer) Sanitize(span *zc.Span) *zc.Span {
func (*spanStartTimeSanitizer) Sanitize(span *zc.Span) *zc.Span {
if span.Timestamp != nil || len(span.Annotations) == 0 {
return span
}
Expand All @@ -143,7 +143,7 @@ func NewParentIDSanitizer() Sanitizer {

type parentIDSanitizer struct{}

func (s *parentIDSanitizer) Sanitize(span *zc.Span) *zc.Span {
func (*parentIDSanitizer) Sanitize(span *zc.Span) *zc.Span {
if span.ParentID == nil || *span.ParentID != 0 {
return span
}
Expand All @@ -166,7 +166,7 @@ func NewErrorTagSanitizer() Sanitizer {

type errorTagSanitizer struct{}

func (s *errorTagSanitizer) Sanitize(span *zc.Span) *zc.Span {
func (*errorTagSanitizer) Sanitize(span *zc.Span) *zc.Span {
for _, binAnno := range span.BinaryAnnotations {
if binAnno.AnnotationType != zc.AnnotationType_BOOL && strings.EqualFold("error", binAnno.Key) {
binAnno.AnnotationType = zc.AnnotationType_BOOL
Expand Down
8 changes: 4 additions & 4 deletions cmd/collector/app/server/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@

type mockSamplingStore struct{}

func (s mockSamplingStore) GetSamplingStrategy(_ context.Context, serviceName string) (*api_v2.SamplingStrategyResponse, error) {
func (mockSamplingStore) GetSamplingStrategy(_ context.Context, serviceName string) (*api_v2.SamplingStrategyResponse, error) {

Check warning on line 27 in cmd/collector/app/server/test.go

View check run for this annotation

Codecov / codecov/patch

cmd/collector/app/server/test.go#L27

Added line #L27 was not covered by tests
return nil, nil
}

func (s mockSamplingStore) Close() error {
func (mockSamplingStore) Close() error {

Check warning on line 31 in cmd/collector/app/server/test.go

View check run for this annotation

Codecov / codecov/patch

cmd/collector/app/server/test.go#L31

Added line #L31 was not covered by tests
return nil
}

type mockSpanProcessor struct{}

func (p *mockSpanProcessor) Close() error {
func (*mockSpanProcessor) Close() error {

Check warning on line 37 in cmd/collector/app/server/test.go

View check run for this annotation

Codecov / codecov/patch

cmd/collector/app/server/test.go#L37

Added line #L37 was not covered by tests
return nil
}

func (p *mockSpanProcessor) ProcessSpans(spans []*model.Span, _ processor.SpansOptions) ([]bool, error) {
func (*mockSpanProcessor) ProcessSpans(spans []*model.Span, _ processor.SpansOptions) ([]bool, error) {
return []bool{}, nil
}
2 changes: 1 addition & 1 deletion cmd/collector/app/span_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (n *fakeSpanWriter) WriteSpan(ctx context.Context, span *model.Span) error
return n.err
}

func (n *fakeSpanWriter) Close() error {
func (*fakeSpanWriter) Close() error {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/es-index-cleaner/app/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type Config struct {
}

// AddFlags adds flags for TLS to the FlagSet.
func (c *Config) AddFlags(flags *flag.FlagSet) {
func (*Config) AddFlags(flags *flag.FlagSet) {
flags.String(indexPrefix, "", "Index prefix")
flags.Bool(archive, false, "Whether to remove archive indices. It works only for rollover")
flags.Bool(rollover, false, "Whether to remove indices created by rollover")
Expand Down
2 changes: 1 addition & 1 deletion cmd/es-rollover/app/init/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type Config struct {
}

// AddFlags adds flags for TLS to the FlagSet.
func (c *Config) AddFlags(flags *flag.FlagSet) {
func (*Config) AddFlags(flags *flag.FlagSet) {
flags.Int(shards, 5, "Number of shards")
flags.Int(replicas, 1, "Number of replicas")
flags.Int(prioritySpanTemplate, 0, "Priority of jaeger-span index template (ESv8 only)")
Expand Down
2 changes: 1 addition & 1 deletion cmd/es-rollover/app/lookback/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type Config struct {
}

// AddFlags adds flags for TLS to the FlagSet.
func (c *Config) AddFlags(flags *flag.FlagSet) {
func (*Config) AddFlags(flags *flag.FlagSet) {
flags.String(unit, defaultUnit, "used with lookback to remove indices from read alias e.g, days, weeks, months, years")
flags.Int(unitCount, defaultUnitCount, "count of UNITs")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/es-rollover/app/rollover/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type Config struct {
}

// AddFlags adds flags for TLS to the FlagSet.
func (c *Config) AddFlags(flags *flag.FlagSet) {
func (*Config) AddFlags(flags *flag.FlagSet) {
flags.String(conditions, defaultRollbackCondition, "conditions used to rollover to a new write index")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/ingester/app/consumer/committing_processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestNewCommittingProcessorError(t *testing.T) {

type fakeProcessorMessage struct{}

func (f fakeProcessorMessage) Value() []byte {
func (fakeProcessorMessage) Value() []byte {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/ingester/app/consumer/processor_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (f *fakeProcessor) Start() {

type fakeMsg struct{}

func (f *fakeMsg) Value() []byte {
func (*fakeMsg) Value() []byte {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/ingester/app/processor/decorator/retry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestNewRetryingProcessorNoErrorPropagation(t *testing.T) {

type fakeRand struct{}

func (f *fakeRand) Int63n(v int64) int64 {
func (*fakeRand) Int63n(v int64) int64 {
return v
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func (exp *storageExporter) start(_ context.Context, host component.Host) error
return nil
}

func (exp *storageExporter) close(_ context.Context) error {
func (*storageExporter) close(_ context.Context) error {
// span writer is not closable
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/jaeger/internal/extension/jaegerquery/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func newServer(config *Config, otel component.TelemetrySettings) *server {
}

// Dependencies implements extension.Dependent to ensure this always starts after jaegerstorage extension.
func (s *server) Dependencies() []component.ID {
func (*server) Dependencies() []component.ID {
return []component.ID{jaegerstorage.ID}
}

Expand Down
Loading
Loading