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
(This new issue extracts a sub-issue that was originally mentioned in #5128 (comment). After investigating the cause, I've realized this issue is different and smaller in scope than the original issue #5128, that's why I'm making this new issue.)
An instance of gofmt not being idempotent. Repeatedly invoking gofmt will add a level of indent to the b string line each time:
I've identified the root cause in go/printer package (therefore the bug affects cmd/gofmt, go/format and go/printer packages). It's due to an unhandled edge case in stripCommonPrefix func.
It happens when a comment block consists of a first line with /*, 1 or more blank lines, last line with */. The internal prefix variable ends up never being set to a correct value before being used (it's not set at all, so it always has zero value, the empty string). See #5128 (comment) for more details.
I already have a fix and test cases done locally, I will submit a CL that closes this issue shortly.
The text was updated successfully, but these errors were encountered:
(This new issue extracts a sub-issue that was originally mentioned in #5128 (comment). After investigating the cause, I've realized this issue is different and smaller in scope than the original issue #5128, that's why I'm making this new issue.)
An instance of
gofmt
not being idempotent. Repeatedly invokinggofmt
will add a level of indent to theb string
line each time:http://play.golang.org/p/Pwn4cOHtMN
I've identified the root cause in
go/printer
package (therefore the bug affectscmd/gofmt
,go/format
andgo/printer
packages). It's due to an unhandled edge case instripCommonPrefix
func.It happens when a comment block consists of a first line with
/*
, 1 or more blank lines, last line with*/
. The internalprefix
variable ends up never being set to a correct value before being used (it's not set at all, so it always has zero value, the empty string). See #5128 (comment) for more details.I already have a fix and test cases done locally, I will submit a CL that closes this issue shortly.
The text was updated successfully, but these errors were encountered: