1
0
mirror of https://github.com/golang/go synced 2024-11-25 00:28:00 -07:00
go/src/internal
Didier Spezia c68f2f8996 go/format: fix //line corner case when formatting statements
The code formatting mechanism can be applied to partial Go code,
such as a list of statements. The statements are wrapped into a
function definition (to be parsed fine), and unwrapped after formatting.

When the statements contain //line annotations, it may fail,
because not all comments are flushed by the printer before the final '}'.
Formatting "\ta()\n//line :1" results in "\ta() }\n\n//line", which
is wrong.

Tweaked the wrapping/unwrapping code to make sure comments are flushed
before the '}'.

Fixes #11276

Change-Id: Id15c80279b0382ee9ed939cca1647f525c4929f5
Reviewed-on: https://go-review.googlesource.com/11282
Run-TryBot: Robert Griesemer <gri@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
2015-06-24 21:45:49 +00:00
..
format go/format: fix //line corner case when formatting statements 2015-06-24 21:45:49 +00:00
singleflight cmd/go: cache results of HTTP requests done during meta tag discovery 2015-04-13 07:08:00 +00:00
syscall internal/syscall/windows/registry: fix read overrun in GetStringsValue 2015-05-15 03:25:41 +00:00
testenv internal/testenv: skip network tests only when -short is specified 2015-06-18 21:10:44 +00:00
trace all: fix misprints in comments 2015-06-11 14:18:57 +00:00