From cdebf6bf8e92bd2bd5bcde2c1161d4e6fe5f79a3 Mon Sep 17 00:00:00 2001 From: Alex Normand Date: Tue, 29 Mar 2022 18:39:45 -0700 Subject: [PATCH] Add godoc and move main function to top --- ddtrace/tracer/sqlcomment.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) 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)