Skip to content

Commit

Permalink
review: use strings.Cut instead of Split
Browse files Browse the repository at this point in the history
  • Loading branch information
sdelicata committed Aug 22, 2022
1 parent 513171f commit 6fd34b4
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions pkg/tracing/datadog/datadog.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ func (c *Config) Setup(serviceName string) (opentracing.Tracer, io.Closer, error
if c.GlobalTag != "" {
log.WithoutContext().Warn(`Datadog: option "globalTag" is deprecated, please use "globalTags" instead.`)

parts := strings.SplitN(c.GlobalTag, ":", 2)

key, value := parts[0], ""
if len(parts) == 2 {
value = parts[1]
}
key, value, _ := strings.Cut(c.GlobalTag, ":")

// Don't override a tag already defined with the new option.
if _, ok := c.GlobalTags[key]; !ok {
Expand Down

0 comments on commit 6fd34b4

Please sign in to comment.