You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ cat x.go
package main
// Unlike the above comment block, only the current line in this comment block has length greater than the
// target maximum line length
// but since the previous line doesn't end with a period, it should be reflown with this line
// despite both the lines being shorter than the target maximum line length.
$ golines --shorten-comments x.go
package main
// Unlike the above comment block, only the current line in this comment block has length greater
// than the
// target maximum line length
// but since the previous line doesn't end with a period, it should be reflown with this line
// despite both the lines being shorter than the target maximum line length.
The modified behavior is to reflow long lines which don't end with
period with the consecutive lines, irrespective of the latter being long
or not.
$ golines --shorten-comments x.go
package main
// Unlike the above comment block, only the current line in this comment block has length greater
// than the target maximum line length but since the previous line doesn't end with a period, it
// should be reflown with this line despite both the lines being shorter than the target maximum
// line length.
Copy file name to clipboardExpand all lines: _fixtures/comments.go
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,18 @@ package fixtures
3
3
import"fmt"
4
4
5
5
// Short prefix
6
-
// This is a really, really long comment on a single line. We should try to break it up if possible because it's longer than 100 chars. In fact, it's so long that it should probably be on three lines instead of two. Wow, so long!!
6
+
// This is a really, really long comment on a single line. We should try to break it up if possible because it's longer than 100 chars. In fact, it's so long that it should probably be on three lines instead of two. Wow, so long.
7
7
// Short suffix
8
8
//
9
9
10
10
// This comment contains multiple contiguous lines which are greater than the target maximum line length.
11
11
// The expected result is a sequence of shortened (reflown) lines without preserving the position of line breaks.
12
12
13
+
// Unlike the above comment block, only the current line in this comment block has length greater than the
14
+
// target maximum line length
15
+
// but since the previous line doesn't end with a period, it should be reflown with this line
16
+
// despite both the lines being shorter than the target maximum line length.
17
+
13
18
// Another comment
14
19
15
20
/*
@@ -28,7 +33,7 @@ func testFunc() {
28
33
29
34
// These are comments like the ones in https://github.com/segmentio/golines/issues/9
0 commit comments