]> Cypherpunks repositories - gostls13.git/commit
go/doc: add // while wrapping a line comment in ToText
authorAgniva De Sarker <agnivade@yahoo.co.in>
Wed, 20 Feb 2019 08:03:30 +0000 (13:33 +0530)
committerRobert Griesemer <gri@golang.org>
Tue, 5 Mar 2019 23:31:27 +0000 (23:31 +0000)
commite90f572cd68adf11337faf30d1db0231d0c9d870
tree4f9205cff06c7b0c42b38091b291cc153dfefb62
parent5c22842cf2761811058f6b2477cf074e544c629c
go/doc: add // while wrapping a line comment in ToText

Currently, lineWrapper does not detect if it is printing a line comment or not.
Hence, while wrapping a comment, the new line does not get prefixed with a //.

We add logic to lineWrapper to detect this case and add // accordingly. Block
comments do not need any such handling.

Added tests for both cases.

Fixes #20929

Change-Id: I656037c2d865f31dd853cf9195f43ab7c6e6fc53
Reviewed-on: https://go-review.googlesource.com/c/go/+/163578
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/doc/comment.go
src/go/doc/comment_test.go