github.com/elastic/go-elasticsearch

github.com/elastic/go-elasticsearch

The official Go client for Elasticsearch

Wrap elasticsearch.Config value (v6)

Join Point
Struct literal elasticsearch.Config
  • Value
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	elasticsearch "github.com/elastic/go-elasticsearch/v6"
	elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6"
)
func(cfg elasticsearch.Config) elasticsearch.Config {
	if cfg.Transport == nil {
		cfg.Transport = elastictrace.NewRoundTripper()
	} else {
		base := cfg.Transport
		cfg.Transport = elastictrace.NewRoundTripper(elastictrace.WithTransport(base))
	}
	return cfg
}({{ . }})

Wrap elasticsearch.Config pointer (v6)

Join Point
Struct literal elasticsearch.Config
  • Pointer
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	elasticsearch "github.com/elastic/go-elasticsearch/v6"
	elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6"
)
func(cfg *elasticsearch.Config) *elasticsearch.Config {
	if cfg.Transport == nil {
		cfg.Transport = elastictrace.NewRoundTripper()
	} else {
		base := cfg.Transport
		cfg.Transport = elastictrace.NewRoundTripper(elastictrace.WithTransport(base))
	}
	return cfg
}({{ . }})

Wrap elasticsearch.Config value (v7)

Join Point
Struct literal elasticsearch.Config
  • Value
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	elasticsearch "github.com/elastic/go-elasticsearch/v7"
	elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6"
)
func(cfg elasticsearch.Config) elasticsearch.Config {
	if cfg.CACert != nil {
		// refuse to set transport as it will make the NewClient call fail.
		return cfg
	}
	if cfg.Transport == nil {
		cfg.Transport = elastictrace.NewRoundTripper()
	} else {
		base := cfg.Transport
		cfg.Transport = elastictrace.NewRoundTripper(elastictrace.WithTransport(base))
	}
	return cfg
}({{ . }})

Wrap elasticsearch.Config pointer (v7)

Join Point
Struct literal elasticsearch.Config
  • Pointer
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	elasticsearch "github.com/elastic/go-elasticsearch/v7"
	elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6"
)
func(cfg *elasticsearch.Config) *elasticsearch.Config {
	if cfg.CACert != nil {
		// refuse to set transport as it will make the NewClient call fail.
		return cfg
	}
	if cfg.Transport == nil {
		cfg.Transport = elastictrace.NewRoundTripper()
	} else {
		base := cfg.Transport
		cfg.Transport = elastictrace.NewRoundTripper(elastictrace.WithTransport(base))
	}
	return cfg
}({{ . }})

Wrap elasticsearch.Config value (v8)

Join Point
Struct literal elasticsearch.Config
  • Value
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	elasticsearch "github.com/elastic/go-elasticsearch/v8"
	elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6"
)
func(cfg elasticsearch.Config) elasticsearch.Config {
	if cfg.CACert != nil {
		// refuse to set transport as it will make the NewClient call fail.
		return cfg
	}
	if cfg.Transport == nil {
		cfg.Transport = elastictrace.NewRoundTripper()
	} else {
		base := cfg.Transport
		cfg.Transport = elastictrace.NewRoundTripper(elastictrace.WithTransport(base))
	}
	return cfg
}({{ . }})

Wrap elasticsearch.Config pointer (v8)

Join Point
Struct literal elasticsearch.Config
  • Pointer
Advice
Replace the expression using the template:
// Using the following synthetic imports:
import (
	elasticsearch "github.com/elastic/go-elasticsearch/v8"
	elastictrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/elastic/go-elasticsearch.v6"
)
func(cfg *elasticsearch.Config) *elasticsearch.Config {
	if cfg.CACert != nil {
		// refuse to set transport as it will make the NewClient call fail.
		return cfg
	}
	if cfg.Transport == nil {
		cfg.Transport = elastictrace.NewRoundTripper()
	} else {
		base := cfg.Transport
		cfg.Transport = elastictrace.NewRoundTripper(elastictrace.WithTransport(base))
	}
	return cfg
}({{ . }})