diff --git a/receiver/elasticsearchreceiver/config.go b/receiver/elasticsearchreceiver/config.go index 06c71ea112cf..7c81fc75350f 100644 --- a/receiver/elasticsearchreceiver/config.go +++ b/receiver/elasticsearchreceiver/config.go @@ -11,14 +11,11 @@ import ( "go.opentelemetry.io/collector/config/confighttp" "go.opentelemetry.io/collector/config/configopaque" "go.opentelemetry.io/collector/receiver/scraperhelper" - "go.uber.org/multierr" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/elasticsearchreceiver/internal/metadata" ) -var ( - defaultEndpoint = "http://localhost:9200" -) +var defaultEndpoint = "http://localhost:9200" var ( errEndpointBadScheme = errors.New("endpoint scheme must be http or https") @@ -54,16 +51,16 @@ type Config struct { func (cfg *Config) Validate() error { var combinedErr error if err := invalidCredentials(cfg.Username, string(cfg.Password)); err != nil { - combinedErr = multierr.Append(combinedErr, err) + combinedErr = err } if cfg.Endpoint == "" { - return multierr.Append(combinedErr, errEmptyEndpoint) + return errors.Join(combinedErr, errEmptyEndpoint) } u, err := url.Parse(cfg.Endpoint) if err != nil { - return multierr.Append( + return errors.Join( combinedErr, fmt.Errorf("invalid endpoint '%s': %w", cfg.Endpoint, err), ) @@ -72,7 +69,7 @@ func (cfg *Config) Validate() error { switch u.Scheme { case "http", "https": // ok default: - return multierr.Append(combinedErr, errEndpointBadScheme) + return errors.Join(combinedErr, errEndpointBadScheme) } return combinedErr diff --git a/receiver/elasticsearchreceiver/go.mod b/receiver/elasticsearchreceiver/go.mod index f2909c8831d0..d8bd78d6d437 100644 --- a/receiver/elasticsearchreceiver/go.mod +++ b/receiver/elasticsearchreceiver/go.mod @@ -22,7 +22,6 @@ require ( go.opentelemetry.io/otel/metric v1.26.0 go.opentelemetry.io/otel/trace v1.26.0 go.uber.org/goleak v1.3.0 - go.uber.org/multierr v1.11.0 go.uber.org/zap v1.27.0 ) @@ -98,6 +97,7 @@ require ( go.opentelemetry.io/otel/exporters/prometheus v0.48.0 // indirect go.opentelemetry.io/otel/sdk v1.26.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.26.0 // indirect + go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.23.0 // indirect golang.org/x/mod v0.16.0 // indirect golang.org/x/net v0.25.0 // indirect