File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed
Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ func SplitMarginComments(sql string) (query string, comments MarginComments) {
111111 Leading : strings .TrimLeftFunc (sql [:leadingEnd ], unicode .IsSpace ),
112112 Trailing : strings .TrimRightFunc (sql [trailingStart :], unicode .IsSpace ),
113113 }
114- return strings .TrimRightFunc (sql [leadingEnd :trailingStart ], unicode .IsSpace ), comments
114+ return strings .TrimFunc (sql [leadingEnd :trailingStart ], unicode .IsSpace ), comments
115115}
116116
117117// StripLeadingComments trims the SQL string and removes any leading comments
Original file line number Diff line number Diff line change @@ -79,6 +79,11 @@ func TestSplitComments(t *testing.T) {
7979 outSQL : "foo" ,
8080 outLeadingComments : "/* before */ " ,
8181 outTrailingComments : " /* bar */" ,
82+ }, {
83+ input : "/* before1 */ /* before2 */ foo /* after1 */ /* after2 */" ,
84+ outSQL : "foo" ,
85+ outLeadingComments : "/* before1 */ /* before2 */ " ,
86+ outTrailingComments : " /* after1 */ /* after2 */" ,
8287 }, {
8388 input : "/** before */ foo /** bar */" ,
8489 outSQL : "foo" ,
@@ -110,11 +115,8 @@ func TestSplitComments(t *testing.T) {
110115 outLeadingComments : "" ,
111116 outTrailingComments : "" ,
112117 }, {
113- input : " foo " ,
114- // NOTE(dweitzman): Preserving leading whitespace because the WhereClause entries for 'update'
115- // in exec_cases.txt have leading whitespace and if we trim it here that will change. It may be
116- // safe to change, but changing query plans is not an intended effect of this diff.
117- outSQL : " foo" ,
118+ input : " foo " ,
119+ outSQL : "foo" ,
118120 outLeadingComments : "" ,
119121 outTrailingComments : "" ,
120122 }}
You can’t perform that action at this time.
0 commit comments