diff --git a/ddtrace/tracer/sqlcomment.go b/ddtrace/tracer/sqlcomment.go index 0dab6ccf02..ce0e606b9e 100644 --- a/ddtrace/tracer/sqlcomment.go +++ b/ddtrace/tracer/sqlcomment.go @@ -7,10 +7,19 @@ import ( "strings" ) +// SQLCommentCarrier holds tags to be serialized as a SQL Comment type SQLCommentCarrier struct { tags map[string]string } +// Set implements TextMapWriter. +func (c *SQLCommentCarrier) Set(key, val string) { + if c.tags == nil { + c.tags = make(map[string]string) + } + c.tags[key] = val +} + func commentWithTags(tags map[string]string) (comment string) { if len(tags) == 0 { return "" @@ -26,14 +35,6 @@ func commentWithTags(tags map[string]string) (comment string) { return fmt.Sprintf("/* %s */", comment) } -// Set implements TextMapWriter. -func (c *SQLCommentCarrier) Set(key, val string) { - if c.tags == nil { - c.tags = make(map[string]string) - } - c.tags[key] = val -} - func (c *SQLCommentCarrier) CommentedQuery(query string) (commented string) { comment := commentWithTags(c.tags)