From 08abd1bd94aaa5ac5cdeb6738e0b5f973dd0911c Mon Sep 17 00:00:00 2001 From: Nick Fischer Date: Fri, 24 Jul 2020 13:08:27 -0700 Subject: [PATCH] Use componenterror package errors --- receiver/statsdreceiver/receiver.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/receiver/statsdreceiver/receiver.go b/receiver/statsdreceiver/receiver.go index 530680a7b0fd..8a46a709f915 100644 --- a/receiver/statsdreceiver/receiver.go +++ b/receiver/statsdreceiver/receiver.go @@ -16,7 +16,6 @@ package statsdreceiver import ( "context" - "errors" "sync" "go.opentelemetry.io/collector/component" @@ -28,12 +27,6 @@ import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/transport" ) -var ( - errNilNextConsumer = errors.New("nil nextConsumer") - errAlreadyStarted = errors.New("already started") - errAlreadyStopped = errors.New("already stopped") -) - var _ component.MetricsReceiver = (*statsdReceiver)(nil) // statsdReceiver implements the component.MetricsReceiver for StatsD protocol. @@ -56,7 +49,7 @@ func New( config Config, nextConsumer consumer.MetricsConsumerOld) (component.MetricsReceiver, error) { if nextConsumer == nil { - return nil, errNilNextConsumer + return nil, componenterror.ErrNilNextConsumer } if config.Endpoint == "" { @@ -102,7 +95,7 @@ func (ddr *statsdReceiver) Shutdown(context.Context) error { ddr.Lock() defer ddr.Unlock() - var err = errAlreadyStopped + var err = componenterror.ErrAlreadyStopped ddr.stopOnce.Do(func() { err = ddr.server.Close() })